View Full Version : Multiple DirectSound devices in one application
bpredic
12-31-2005, 02:38 AM
I have a sound card with multiple in/out. In windows it registers as 4 input and 4 output devices. From control panel I can choose which device is default playback device and send wave to that output only. That works just fine. My idea is to write DirectSound application that will be able to play different sounds to all outputs simultaniously. My idea was to create one DirectSound device object for each device registered by windows and play sounds simultaniously that way. Unfortunately, I ran into some problems. I have succesfully extended Microsoft playsound example from DirectSound SDK to create 4 different SoundManager objects for each device (each SoundManager object is initialized with correct device GUI). I have also created one static sound buffer for each device and tried to play them all. Unfortunatelly, nothing happens. No errors, just no sound from any outputs. When I modified the code to initialize only one device the playback was just fine. It doestn't matter which output, it plays just fine as long as there is only one CSoundManager in my app. When I have two or more, nothing happens. No change in code, just multiple CSoundManagers.
My question is: is it possible to have multiple DirectSound device objects in single application in order to control multiple sound cards? Am I doing something wrong? Thanks in advance.
Nils Pipenbrinck
01-01-2006, 04:40 PM
that's really a good question. If it does not work on your computer it's most probably a bug in the driver. It should work in theory, and there are no reasons why it shouldn't work except that the programmers thought noone would ever try to do this.
As a workaround you can try to use the ASIO interface. It's for music programs and can handle multiple outputs for sure. I think with a google session you can get the api documentation.
Nils Pipenbrinck
01-01-2006, 04:47 PM
*lol*
I just downloaded the asio sdk from steinberg.net, and this is a quote from the first chapter:
The personal computer platform really misses a relatively simple way of accessing multiple audio inputs and outputs. Today's operating system's audio support is designed for stereo input and stereo output only. There is no provision to extend this without creating major problems, i.e. synchronization issues between the different input and output channels.
Looks like it's really what you want.
bpredic
01-03-2006, 03:28 AM
Update on this:
I have tried similar thing at home with one SoundMAX integrated sound card and additional SB Audigy2. It works as a charm! :)
At work I have Delta 1010 card and it didn't work. For the hollidays I won't be able to try it but I will report as soon as possible. Is it a driver problem or I made some dumb rookie mistake when coding... who knows...
Microsoft DirectSound SDK documentation in ambiguous. At one place it says that there is only one device object per application. (It is not stating that two/more devices are NOT possible, probably the author thought noone would need more that one :) ) At another place in docs it says that enumeration of devices is needed only in special cases amongs which is situation when application will be using more than one device! :)
Regards,
Bratislav
vBulletin, Copyright ©2000-2008, Jelsoft Enterprises Ltd.