// WaveAudioSource.h: interface for the WaveAudioSource class. // ////////////////////////////////////////////////////////////////////// #ifndef AFX_WAVEAUDIOSOURCE_H__1FF46522_ECF5_44DC_9C3F_EE7E509676D6__INCLUDED_ #define AFX_WAVEAUDIOSOURCE_H__1FF46522_ECF5_44DC_9C3F_EE7E509676D6__INCLUDED_ #include // required by mmsystem.h #include #include #include "AudioSource.h" #include "Parameters.h" class AudioSampleManager; class WaveAudioSource : public AudioSource { public: WaveAudioSource(); virtual ~WaveAudioSource(); int SetFormat(int waveFormatNumber); int SetVolume(unsigned long volume); int SetDeviceID(unsigned int deviceID); int SetNumBuffers(int n); int SetBufferSize(int s); int SourceStarted(); int SourceStopped(); int SourceThreadStarted(HANDLE sourceThreadHandle, DWORD sourceThreadID); int SourceThreadStopped(HANDLE sourceThreadHandle, DWORD sourceThreadID); protected: virtual int GenerateData(AudioSample **ppAudioSample); virtual int SetTraceLevel(); private: int BeginAudioCapture(); int ResetAudioCapture(); int EndAudioCapture(); int AddBuffer(int i); static void CALLBACK WaveInCallback(HWAVEIN hWaveIn, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2); private: WAVEFORMATEX format; HANDLE dataEvent; HWAVEIN hWaveIn; WAVEHDR waveHdr[WAVESOURCE_MAX_WAVEHDR]; char dataBuffer[WAVESOURCE_MAX_WAVEHDR][WAVESOURCE_MAX_WAVEHDR_SIZE]; int numBuffers; int bufferSize; std::list buffersToAdd; bool bEnableAddBuffer; CRITICAL_SECTION waveInMutex; CRITICAL_SECTION bufferListMutex; CRITICAL_SECTION filterMutex; AudioSampleManager *audioSampleManager; bool bRunning; unsigned int waveinDeviceID; bool needToSetVolume; unsigned int micVolume; }; #endif // !defined(AFX_WAVEAUDIOSOURCE_H__1FF46522_ECF5_44DC_9C3F_EE7E509676D6__INCLUDED_)