D
Dave Hall
I'm trying to play a wav file on CE.NET 4.1. I'm able to successfully play
the first buffer full of data, by calling waveOutWrite()but I never get any
call to the overridden WndProc of my messageWindow class to let me know it's
been played so that I can play the next buffer full of data.
In the following code, hWaveOut, waveFormat and messageWindow are class
members, so they won't go out of scope while the audio is playing.
waveOutOpen(out hWaveOut, 0, waveFormat, messageWindow.Hwnd, 0,
CALLBACK_WINDOW) and
waveOutPrepareHeader(hWaveOut, wh.lpWAVEHDR, WAVEHDR.WAVEHDR_SIZE) and
waveOutWrite(hWaveOut, wh.lpWAVEHDR, WAVEHDR.WAVEHDR_SIZE)
all return MMSYSERR_NOERROR
Without going into alot of detail, I think it's important to note
wh.lpWAVEHDR is an IntPtr to unmanaged memory, and so is the lpData member
within the unmanaged WAVEHDR. I'm not sure if this is related to the
problem, but I thought I'd mention it because I couldn't even get the wave
APIs to work at all until I used this approach based on the examples at
OpenNETCF.
Although I can't directly use the OpenNETCF.Multimedia.Audio sourcecode for
this application, I'm trying to use it as an example. The OpenNETCF code
works fine, but there's something I'm missing in my version. I haven't
posted my code here because a lot of the P/Invoke stuff gets wordy, but I'll
be glad to post any of it that might help anyone show me what I'm doing
wrong. I just can't figure out any reason why the WndProc of my
messageWindow shouldn't be invoked after the first buffer of sound is
played.
Any help would be appreciated.
Dave
the first buffer full of data, by calling waveOutWrite()but I never get any
call to the overridden WndProc of my messageWindow class to let me know it's
been played so that I can play the next buffer full of data.
In the following code, hWaveOut, waveFormat and messageWindow are class
members, so they won't go out of scope while the audio is playing.
waveOutOpen(out hWaveOut, 0, waveFormat, messageWindow.Hwnd, 0,
CALLBACK_WINDOW) and
waveOutPrepareHeader(hWaveOut, wh.lpWAVEHDR, WAVEHDR.WAVEHDR_SIZE) and
waveOutWrite(hWaveOut, wh.lpWAVEHDR, WAVEHDR.WAVEHDR_SIZE)
all return MMSYSERR_NOERROR
Without going into alot of detail, I think it's important to note
wh.lpWAVEHDR is an IntPtr to unmanaged memory, and so is the lpData member
within the unmanaged WAVEHDR. I'm not sure if this is related to the
problem, but I thought I'd mention it because I couldn't even get the wave
APIs to work at all until I used this approach based on the examples at
OpenNETCF.
Although I can't directly use the OpenNETCF.Multimedia.Audio sourcecode for
this application, I'm trying to use it as an example. The OpenNETCF code
works fine, but there's something I'm missing in my version. I haven't
posted my code here because a lot of the P/Invoke stuff gets wordy, but I'll
be glad to post any of it that might help anyone show me what I'm doing
wrong. I just can't figure out any reason why the WndProc of my
messageWindow shouldn't be invoked after the first buffer of sound is
played.
Any help would be appreciated.
Dave