IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
Multichannel Programming, buffer -> speaker separately?
dlembed83
post Nov 23 2003, 04:45
Post #1





Group: Members
Posts: 4
Joined: 23-November 03
Member No.: 9986



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.
Go to the top of the page
+Quote Post
milosoftware
post Dec 9 2003, 14:03
Post #2





Group: Members
Posts: 55
Joined: 9-December 03
Member No.: 10308



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.


--------------------
MiLo Software - http://www.milosoftware.com - http://www.cdwave.com
Go to the top of the page
+Quote Post
Jasper
post Dec 9 2003, 17:44
Post #3





Group: Members
Posts: 189
Joined: 9-July 02
Member No.: 2536



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?).
Go to the top of the page
+Quote Post
dlembed83
post Dec 12 2003, 06:13
Post #4





Group: Members
Posts: 4
Joined: 23-November 03
Member No.: 9986



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?
Go to the top of the page
+Quote Post
Jasper
post Dec 13 2003, 09:20
Post #5





Group: Members
Posts: 189
Joined: 9-July 02
Member No.: 2536



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.
Go to the top of the page
+Quote Post
dlembed83
post Dec 14 2003, 01:46
Post #6





Group: Members
Posts: 4
Joined: 23-November 03
Member No.: 9986



Thanks , Jasper. I'm trying that.
Go to the top of the page
+Quote Post
dlembed83
post Dec 14 2003, 16:12
Post #7





Group: Members
Posts: 4
Joined: 23-November 03
Member No.: 9986



Yes , it works ,with a buffer created with WAVEFORMATENTENSIBLE.
Thanks a lot.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 31st July 2014 - 00:37