stephan papadakis
asked on
wavein-problems
I wrote the following Callback-Function in order to
add the filled buffer, which is returned by the driver, again to drivers queue. I don't know why it doesn't work.
The driver stopps recording when the buffer is filled.
I would be verry glad if you could help me.
stephan
void CALLBACK __export WaveProc(
HWAVE hWave, // handle of waveform device
UINT uMsg, // sent message
DWORD dwInstance, // instance data
DWORD dwParam1, // application-defined parameter
DWORD dwParam2 // application-defined parameter
)
{
LPWAVEHDR lpWaveHdrTemp = (LPWAVEHDR) dwParam1;
if( uMsg == WIM_DATA)
{
waveInUnprepareHeader((HWA VEIN) hWave, lpWaveHdrTemp ,sizeof(WAVEHDR) ) ;
waveInPrepareHeader((HWAVE IN)hWave, lpWaveHdrTemp, sizeof(WAVEHDR));
waveInAddBuffer((HWAVEIN)h Wave, lpWaveHdrTemp, sizeof(WAVEHDR));
}
}
add the filled buffer, which is returned by the driver, again to drivers queue. I don't know why it doesn't work.
The driver stopps recording when the buffer is filled.
I would be verry glad if you could help me.
stephan
void CALLBACK __export WaveProc(
HWAVE hWave, // handle of waveform device
UINT uMsg, // sent message
DWORD dwInstance, // instance data
DWORD dwParam1, // application-defined parameter
DWORD dwParam2 // application-defined parameter
)
{
LPWAVEHDR lpWaveHdrTemp = (LPWAVEHDR) dwParam1;
if( uMsg == WIM_DATA)
{
waveInUnprepareHeader((HWA
waveInPrepareHeader((HWAVE
waveInAddBuffer((HWAVEIN)h
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
By the way, I said it before in answer to your question Q861187135 (4/16/97). But 'this question is locked until stephan papadakis evaluates the answer' :(.
ASKER
Thank's a lot for your answere.
The only problem is, how can i solve my problem?
What should i do know. Should i create a dummy Callback -Window?
If i do so the waveinopen-function returns errorcode 11h
wich means "function is called with wrong parameters".
The only problem is, how can i solve my problem?
What should i do know. Should i create a dummy Callback -Window?
If i do so the waveinopen-function returns errorcode 11h
wich means "function is called with wrong parameters".
ASKER
Thank's a lot for your answere.
The only problem is, how can i solve my problem?
What should i do know. Should i create a dummy Callback -Window?
If i do so the waveinopen-function returns errorcode 11h
wich means "function is called with wrong parameters".
The only problem is, how can i solve my problem?
What should i do know. Should i create a dummy Callback -Window?
If i do so the waveinopen-function returns errorcode 11h
wich means "function is called with wrong parameters".
To avoid crash, you can try to process buffers in your window procedure, not in the callback function. For example:// Define our notify message#define WMU_FINISHED (WM_USER+1)// Fill it with handle of our windowHWND wnd;// Callback functionvoid CALLBACK WaveProc(HWAVE hWave, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2)
{
if( uMsg == WIM_DATA) {
// Device driver is finished! // Notify our window. PostMessage(wnd,WMU_FINISH ED,0,(LPAR AM) dwParam1); }}// Here is our window procedure... wndProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam){ LPWAVEHDR lpWaveHdrTemp = (LPWAVEHDR) lParam;
switch(uMsg) { // ... case WMU_FINISHED:
waveInUnprepareHeader((HWA VEIN) hWave, lpWaveHdrTemp, sizeof(WAVEHDR));
waveInPrepareHeader((HWAVE IN)hWave, lpWaveHdrTemp, sizeof(WAVEHDR));
waveInAddBuffer((HWAVEIN)h Wave, lpWaveHdrTemp, sizeof(WAVEHDR));
// .....
}Also you can try to use callback window instead of callback function. May be there are no restrictions on calling wave* functions from inside of callback window.P.S. It will be nice if you can post me your source code to nick@rtzi.ru
{
if( uMsg == WIM_DATA) {
// Device driver is finished! // Notify our window. PostMessage(wnd,WMU_FINISH
switch(uMsg) { // ... case WMU_FINISHED:
waveInUnprepareHeader((HWA
waveInPrepareHeader((HWAVE
waveInAddBuffer((HWAVEIN)h
// .....
}Also you can try to use callback window instead of callback function. May be there are no restrictions on calling wave* functions from inside of callback window.P.S. It will be nice if you can post me your source code to nick@rtzi.ru
ASKER
Thank's a lot.
I got it.
The problem is solved.
stephan
I got it.
The problem is solved.
stephan