I want to make a simple Voice Recoder by using WaveInOpen and WaveOutOpen Function.
I set CALLBACK to WINDOW (the Function is as follows) and I tried to receive MM_WIN_OPEN, MM_WIN_DATA of HandleEvent.
But I don't know what to set the Class Name of CreateWindow.
I really need your help.
Or Are there any Voice Recoder Sample File made by Harbour?
- Code: Select all Expand view RUN
#define MM_WIM_OPEN 958 /* waveform input */
#define MM_WIM_CLOSE 959
#define MM_WIM_DATA 960
CLASS TWave FROM TControl
DATA hWaveIn
METHOD New() CONSTRUCTOR
METHOD WaveInStart( oWnd )
...
METHOD HandleEvent( nMsg, nWParam, nLParam )
...
ENDCLASS
METHOE New() CLASS TWave
::Create( "????" ) => ? Class Name
//
Return Self
METHOD WaveInStart( oWnd ) CLASS TWave
LOCAL hWaveIn
if WaveInOpen( &hWaveIn, oWnd:hWnd ) >= 0
::hWaveIn := hWaveIn
//
endif
Return NIL
METHOD HandleEvent( nMsg, nWParam, nLParam ) CLASS TWave
do case
case nMsg == MM_WIN_OPEN
//
case nMsg == MM_WIN_DATA
//
otherwise
//
endcase
Return NIL
HB_FUNC( WAVEINOPEN )
{
HWAVEIN hWaveIn;
WAVEFORMATEX waveformat;
int nResult;
waveformat.wFormatTag = WAVE_FORMAT_PCM;
waveformat.nChannels = 1 ;
waveformat.nSamplesPerSec = 11025;
waveformat.wBitsPerSample = 8;
waveformat.nBlockAlign = waveformat.nChannels*waveformat.wBitsPerSample/8;
waveformat.nAvgBytesPerSec = waveformat.nSamplesPerSec*waveformat.nBlockAlign;
waveformat.cbSize = 0;
nResult = WaveInOpen( &hWaveIn, WAVE_MAPPER, (WAVEFORMATEX)&waveformat, (DWORD) hb_parnl(2), 0, CALLBACK_WINDOW );
hb_stornl( ( LONG ) hWaveIn, 1 );
hb_retni( nResult );
}