|
Windows环境下的麦克风录音系统(11) // if you invoke any member function return error/false please // use this function to get the result... DWORD __getLastError(); // // when the capture buffer is filled please invoke this function to 'add buffer'(Actually // you should create two-circular buffers,when 1st buffer is filled then switch to 2st,1st // buffer will be wrote into wav file. // void AddBuffer(); virtual ~CSoundIn(); friend CSoundIn & theSoundCapture(); private: BOOL GetBestWaveFormat(WAVEFORMATEX & waveFormatEx); // because sound card is one and only so i must limit the number of CSoundIn object, // but how to limit the class object nums?maybe put constructor into private scope is // a good idea,:-) CSoundIn(); private: WAVEINCAPS m_WaveInDevCaps; HWAVEIN m_WaveIn; WAVEHDR m_WaveHeader; WAVEFORMATEX m_WaveFormat; UINT m_WaveInSampleRate; int m_NbMaxSamples; UINT m_SizeRecord; DWORD m_dwLastError; enum { MAX_SIZE_INPUT_BUFFER = 1 * 2 * 1024 }; // samples * voie * size_samples public: SHORT InputBuffer[MAX_SIZE_INPUT_BUFFER]; // used for int FFT,many GUI application // want to display sound peak so..
|