Path: blob/master/src/java.desktop/share/native/libjsound/DirectAudio.h
41152 views
/*1* Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425#ifndef DIRECT_AUDIO_INCLUDED26#define DIRECT_AUDIO_INCLUDED2728// includes for types29#include "SoundDefs.h"3031// for memset32#include <string.h>3334#include "Utilities.h"3536// the following defines should match the ones in AbstractMixer.java37#define DAUDIO_PCM 038#define DAUDIO_ULAW 139#define DAUDIO_ALAW 24041#define DAUDIO_STRING_LENGTH 2004243typedef struct tag_DirectAudioDeviceDescription {44// optional deviceID (complementary to deviceIndex)45INT32 deviceID;46INT32 maxSimulLines;47char name[DAUDIO_STRING_LENGTH+1];48char vendor[DAUDIO_STRING_LENGTH+1];49char description[DAUDIO_STRING_LENGTH+1];50char version[DAUDIO_STRING_LENGTH+1];51} DirectAudioDeviceDescription;525354// method definitions5556#if (USE_DAUDIO == TRUE)5758// callback from GetFormats, implemented in DirectAudioDevice.c59void DAUDIO_AddAudioFormat(void* creator, int significantBits, int frameSizeInBytes,60int channels, float sampleRate,61int encoding, int isSigned,62int bigEndian);636465// the following methods need to be implemented by the platform dependent code6667/* returns the number of mixer devices */68INT32 DAUDIO_GetDirectAudioDeviceCount();6970/* returns TRUE on success, FALSE otherwise */71INT32 DAUDIO_GetDirectAudioDeviceDescription(INT32 mixerIndex,72DirectAudioDeviceDescription* description);7374// SourceDataLine and TargetDataLine7576void DAUDIO_GetFormats(INT32 mixerIndex, INT32 deviceID, int isSource, void* creator);7778void* DAUDIO_Open(INT32 mixerIndex, INT32 deviceID, int isSource,79int encoding, float sampleRate, int sampleSizeInBits,80int frameSize, int channels,81int isSigned, int isBigEndian, int bufferSizeInBytes);82int DAUDIO_Start(void* id, int isSource);83int DAUDIO_Stop(void* id, int isSource);84void DAUDIO_Close(void* id, int isSource);85int DAUDIO_Write(void* id, char* data, int byteSize); // returns -1 on error86int DAUDIO_Read(void* id, char* data, int byteSize); // returns -1 on error8788int DAUDIO_GetBufferSize(void* id, int isSource);89int DAUDIO_StillDraining(void* id, int isSource);90int DAUDIO_Flush(void* id, int isSource);91/* in bytes */92int DAUDIO_GetAvailable(void* id, int isSource);93INT64 DAUDIO_GetBytePosition(void* id, int isSource, INT64 javaBytePos);94void DAUDIO_SetBytePosition(void* id, int isSource, INT64 javaBytePos);9596int DAUDIO_RequiresServicing(void* id, int isSource);97void DAUDIO_Service(void* id, int isSource);9899#endif // USE_DAUDIO100101#endif // DIRECT_AUDIO_INCLUDED102103104