dlembed83
Nov 22 2003, 21:45
In my application, I want four buffers representing the four speakers individually.I will fill up each channel(buffer) with different data (dynamically at run time,not statically), then send them to a four-channel soundcard.How can I do?
I find DirectSound only surport playing multichannel media file .Is KS ok?If so ,could you please suggest me some references?
Many thanks.
milosoftware
Dec 9 2003, 07:03
Something to try may be to just open the device 4 times. Use a single-channel format for each device, assigning the correct speaker to each "device" you opened.
The windows 'mixer' will take care of interleaving the data then.
Practically all soundcard API's I know of use interleaved buffers, so I don't think you have any other option than to interleave the audio data before you send it to the soundcard (and as that isn't very hard or slow it probably won't give a lot of problems).
Opening the device four times does not sound like a good idea to me, it sounds like a lot of hassle and you'll have to interleave the signal anyhow (only now you need to do it four times and with zeroes in between).
Of course it is an entirely different matter if your soundcard allows you to open all four channels separately (it might through ASIO, not sure). But even then I would still recommend simply interleaving the sound yourself, unless you'd have some special reason not to (what that would be though?).
dlembed83
Dec 11 2003, 23:13
How can I use soundcard API, surpassing the DirectSound and the like?I'm thinking about writing a four-channel wave file, with DS playing back the wave synchronously.Could you please suggest me some soundcard with the very feature you mentioned?
Jasper
Dec 13 2003, 02:20
With soundcard API I meant API's like DirectSound, Windows MME (waveIn/waveOut), ASIO, etc. To play a four channel wave file you just have to open a device which supports four channels (a lot of modern soundcards support this) or two stereo devices. The sound data in a wave file is also interleaved, so you will only have to do something with it if you can't open a single device with four channels, if that's the case you'll have to send two channels to one device and the other two to another device.
If you are unfamiliar with how to do this kind of thing I would suggest looking at some of the examples in the MSDN Library (http://msdn.microsoft.com/library/).
You might also want to consider looking at PortAudio (http://www.portaudio.com/), its MME implementation has support for opening more than one device simultaniously (in such a way that you will can pretend it's a single device).
Also, if you are only interested in playing a wave file you might get by with using PlaySound (look for it in the MSDN Library). I believe this function will send the sound to the Windows default output device.
dlembed83
Dec 13 2003, 18:46
Thanks , Jasper. I'm trying that.
dlembed83
Dec 14 2003, 09:12
Yes , it works ,with a buffer created with WAVEFORMATENTENSIBLE.
Thanks a lot.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.