jh Guest
|
Posted: Wed Mar 22, 2006 10:03 pm Post subject: waveInOpen and CALLBACK |
|
|
I have no problem with playing wave files with CALLBACK_WINDOW. I have
questions about other CALLBACKs. I want to play files using file stream not
from memory (large audio files).
1. Using CALLBACK_FUNCTION looks a little bit strange because I have no idea
how to finish playing... I prepare next headers when buffers are returned to
application (waveOutProc) - ok. But when audio stream reached the end I'd
like to reset and stop the wave out device. The problem is I cannnot do it
from waveOutProc (Applications should not call any system-defined functions
from inside a callback function, except for EnterCriticalSection,
LeaveCriticalSection, midiOutLongMsg, midiOutShortMsg, OutputDebugString,
PostMessage, PostThreadMessage, SetEvent, timeGetSystemTime, timeGetTime,
timeKillEvent, and timeSetEvent. Calling other wave functions will cause
deadlock.). So how can I stop it? Posting a message? Then it looks like
CALLBACK_WINDOW....
2. CALLBACK_THREAD. Does it mean that Execute method of the thread should
prepare a next buffer for playing? But how can I know what buffer is
returned? CALLBACK_WINDOW and CALLBACK_FUNCTION return address of PWAVEHDR
structure. How it looks with CALLBACK_THREAD?
3. CALLBACK_EVENT. Similar problem. I cannot find any example how I should
use it.
What are benefits of using these callbacks? Which one I should use and when?
Please don't suggest using components. I want to use WinAPI solution.
Jacek |
|