Re: waveOutOpen with CALLBACK_EVENT example?
- From: "Chris P. [MVP]" <msdn@xxxxxxxxxxxx>
- Date: Wed, 2 Nov 2005 17:21:12 -0500
On Tue, 1 Nov 2005 22:56:16 +0100, jh wrote:
> OK. I've tried with CALLBACK_WINDOW. It works. Almost. The problem is audio
> pauses when minimizing, maximazing windows etc. I plan to play about 8
> stereo streams at the same time to 8 stereo output pairs of my RME HDSP
> Multiface II with synchronization between all these channels.
>
> Please correct if I'm wrong. I plan to use independent threads for playing
> data for each channel. Each thread prepares headers, loads initial data to
> buffers (wave file) and waits. Main application starts playing in all these
> threads at the same time. So it looks that I should use CALLBACK_THREAD...
> But I was suggested to use CALLBACK_EVENT as the best way to play wave data.
> What is the schema for using CALLBACK_EVENT?
Actually I've found that a single thread works best when you are trying to
maintain synchronization. There are a few ways you can handle this
depending on how the driver works.
Option A) If the sound card supports a multi-channel mode use it. The
device will need to be opened with a WAVEFORMATEXTENSIBLE wave header in
place of WAVEFORMATEX. If you need to take data from multiple sources
that's ok, interleaving the data is cheap.
Option B) Listen for event on first "device" only. When you get the event
you check the flags of all the buffers from all devices and see which ones
need servicing. This usually works fine if there is only 1 physical
device.
Option C) Wait for events from all devices but don't process until they are
all signalled (use WaitForMultipleObjects). Again, only will work reliably
with 1 physical device.
.
- References:
- waveOutOpen with CALLBACK_EVENT example?
- From: jh
- Re: waveOutOpen with CALLBACK_EVENT example?
- From: Chris P. [MVP]
- Re: waveOutOpen with CALLBACK_EVENT example?
- From: jh
- waveOutOpen with CALLBACK_EVENT example?
- Prev by Date: Re: volume detection/monitoring of WAVE files
- Next by Date: Re: Hide - show Real Player and WMP
- Previous by thread: Re: waveOutOpen with CALLBACK_EVENT example?
- Next by thread: convert pcm to mp3
- Index(es):
Relevant Pages
|