00001 #ifndef __DSOUND_WRAPPER_H
00002 #define __DSOUND_WRAPPER_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #include <DSound.h>
00039 #if !defined(BOOL)
00040 #define BOOL short
00041 #endif
00042 #ifndef SUPPORT_AUDIO_CAPTURE
00043 #define SUPPORT_AUDIO_CAPTURE (1)
00044 #endif
00045
00046 #ifdef __cplusplus
00047 extern "C"
00048 {
00049 #endif
00050
00051 #define DSW_NUM_POSITIONS (4)
00052 #define DSW_NUM_EVENTS (5)
00053 #define DSW_TERMINATION_EVENT (DSW_NUM_POSITIONS)
00054
00055 typedef struct
00056 {
00057
00058 LPDIRECTSOUND dsw_pDirectSound;
00059 LPDIRECTSOUNDBUFFER dsw_OutputBuffer;
00060 DWORD dsw_WriteOffset;
00061 INT dsw_OutputSize;
00062 INT dsw_BytesPerFrame;
00063
00064 LARGE_INTEGER dsw_CounterTicksPerBuffer;
00065 LARGE_INTEGER dsw_LastPlayTime;
00066 UINT dsw_LastPlayCursor;
00067 UINT dsw_OutputUnderflows;
00068 BOOL dsw_OutputRunning;
00069
00070 double dsw_FramesWritten;
00071 double dsw_FramesPlayed;
00072 #if SUPPORT_AUDIO_CAPTURE
00073
00074 LPDIRECTSOUNDCAPTURE dsw_pDirectSoundCapture;
00075 LPDIRECTSOUNDCAPTUREBUFFER dsw_InputBuffer;
00076 UINT dsw_ReadOffset;
00077 UINT dsw_InputSize;
00078 #endif
00079
00080 }
00081 DSoundWrapper;
00082 HRESULT DSW_Init( DSoundWrapper *dsw );
00083 void DSW_Term( DSoundWrapper *dsw );
00084 HRESULT DSW_InitOutputBuffer( DSoundWrapper *dsw, unsigned long nFrameRate,
00085 int nChannels, int bufSize );
00086 HRESULT DSW_StartOutput( DSoundWrapper *dsw );
00087 HRESULT DSW_StopOutput( DSoundWrapper *dsw );
00088 DWORD DSW_GetOutputStatus( DSoundWrapper *dsw );
00089 HRESULT DSW_WriteBlock( DSoundWrapper *dsw, char *buf, long numBytes );
00090 HRESULT DSW_ZeroEmptySpace( DSoundWrapper *dsw );
00091 HRESULT DSW_QueryOutputSpace( DSoundWrapper *dsw, long *bytesEmpty );
00092 HRESULT DSW_Enumerate( DSoundWrapper *dsw );
00093
00094 #if SUPPORT_AUDIO_CAPTURE
00095 HRESULT DSW_InitInputBuffer( DSoundWrapper *dsw, unsigned long nFrameRate,
00096 int nChannels, int bufSize );
00097 HRESULT DSW_StartInput( DSoundWrapper *dsw );
00098 HRESULT DSW_StopInput( DSoundWrapper *dsw );
00099 HRESULT DSW_ReadBlock( DSoundWrapper *dsw, char *buf, long numBytes );
00100 HRESULT DSW_QueryInputFilled( DSoundWrapper *dsw, long *bytesFilled );
00101 #endif
00102
00103 #ifdef __cplusplus
00104 }
00105 #endif
00106 #endif