Copyright © 2001-2008 MultiMedia Soft 
Return to Table of contents  
 
How to work with multiple output devices and speakers 
 
Output devices 
 
If the target system has more than one output device, also known as "sound card", compatible with DirectSound, you can force each of the allocated players to redirect its output to a specific device: the number and friendly description of available output devices can be obtained using the GetOutputDevicesCount and GetOutputDeviceDesc methods: once you have obtained the list of installed devices, you can initialise each player's output through a single call to the InitDJSystem method, passing the device index to the nOutputX parameters; the output device returned when calling the GetOutputDeviceDesc method with parameter 0 is always the system default device set through the Windows Control Panel: in case the system default output device should be changed through the Control Panel, the container application would be notified of the change through the DeviceChange event. 
 
During the container application execution there could be the need to change "on the fly" the output device for a certain player: the current output device can be obtained through a call to the GetPlayerOutputDevice method and the output device change can be performed through the SetPlayerOutputDevice method; the capability of changing the output device on a plying sound is very useful if you need a monitor output for your headphones. It's important to note that the switch of the output device can be performed without problems when the player is in "Playing", "Paused" or "Stopped" state. If the output device is changed successfully, an OutputDeviceChanged event is fired. 
 
 
Speakers 
 
Most sound cards can have more than plain stereo output in order to support surround sound or in order to support multiplayer features: this control allows playback of multichannel sound files (for WAV, AIFF, OGG Vorbis and WMA formats) loaded through the LoadSound method and, at the same time, it can support speakers assignment. 
Speakers assignment can be usually set through the Control Panel as seen on the screenshot below: 
 
 
 
after pressing the "Advanced..." button you will see the following dialog box: 
 
 
 
 
If your application needs to manage speakers assignment, the first thing to do is setting the EnableSpeakers property to TRUE: this property must be set at design-time; setting this property at runtime will not have any effect and will be simply ignored. 
 
Once the speakers management has been enabled, the control can retrieve the actual number of speakers enabled on an output device through the GetOutputSpeakersConfig method and change it through the SetOutputSpeakersConfig method. It's important to note that some specific sound card software (for example the Sound Blaster Audigy 2 NX) could override these settings so you should modify the speakers setup for this sound card using the sound card's proprietary control panel. The actual configurations supported by the control are the following: 
 
  • Sound cards with 1 plain stereo output (2 speakers) 
  •  
     
    This configuration allows 1 single player to play 1 stereo sound. 
    In alternative, this configuration allows 2 different players to play 2 different mono sounds on the following speakers: 
    1. Left speaker 
    2. Right speaker 
     
  • Sound cards with 2 stereo outputs (4 speakers), also known as Quadraphonic 
  •  
     
     
    This configuration allows 2 different players to play 2 stereo sounds on the following speakers: 
    1. Front speakers 
    2. Rear speakers 
     
    In alternative, this configuration allows 4 different players to play 4 different mono sounds on the following speakers: 
    1. Front-Left speaker 
    2. Front-Right speaker 
    3. Rear-Left speaker 
    4. Rear-Right speaker 
     
  • Sound cards with 3 stereo outputs (6 speakers), also known as 5.1 
  •  
     
     
    This configuration allows 3 different players to play 3 stereo sounds on the following speakers: 
    1. Front speakers 
    2. Rear speakers 
    3. Center speakers 
     
    In alternative, this configuration allows 6 different players to play 6 different mono sounds on the following speakers: 
    1. Front-Left speaker 
    2. Front-Right speaker 
    3. Rear-Left speaker 
    4. Rear-Right speaker 
    5. Center speaker 
    6. LFE speaker that, usually, is attached to a subwoofer 
     
  • Sound cards with 4 stereo outputs (8 speakers), also known as 7.1 
  •  
     
     
    This configuration allows 4 different players to play 4 stereo sounds on the following speakers: 
    1. Front speakers 
    2. Rear speakers 
    3. Center speakers 
    4. Rear-center speakers 
     
    In alternative, this configuration allows 8 different players to play 8 different mono sounds on the following speakers: 
    1. Front-Left speaker 
    2. Front-Right speaker 
    3. Rear-Left speaker 
    4. Rear-Right speaker 
    5. Center speaker 
    6. LFE speaker that, usually, is attached to a subwoofer 
    7. Rear Center-Left speaker 
    8. Rear Center-Right speaker 
     
     
     
    Usually the control will automatically enumerate the available speakers for each installed output device and the container application will be able retrieving the number of available speakers through the GetOutputSpeakersCount method or, in alternative, through the GetPlayerSpeakersCount method. Some specific output device (for example the Maya EX7 sound card) will always return 2 speakers also if it supports up to 8 mono speakers: in this case the container application can force the speakers assignment through a call to the ForceSpeakersAssignment method. 
     
    Some specific output device (again the Maya EX7 sound card) will invert the Rear and Center speakers assignment: you can get rid of this situation through the SwapSpeakersRearAndCenter method. 
     
    The GetPlayerSpeaker and SetPlayerSpeaker methods allow a given player to obtain/redirect its output to a specific speaker of the current output device; if two allocated players are currently using two different speakers on the same output device, you can swap their speakers assignment through a call to the SwapPlayersSpeakers method: note that it's not allowed swapping speakers of players currently redirecting their output to different output devices. 
     
    Note on subwoofer assignment: the control maps the Center mono speaker as a Left channel and the Subwoofer mono speaker as a Right channel: some commercial Home Theatre system inverts these speakers: the control cannot manage this situation so, when using the control with these kind of systems, you will have to swap cables for Center and Subwoofer speakers. 
     
     
    Samples of use of speakers and output devices management in Visual C# and Visual Basic.NET can be found inside the following samples installed with the product's setup package: 
    - OutputDevices 
    - SpeakersManager 
     
     
     
     
     
     
     
     
     
     
     
    Copyright © 2001-2008 MultiMedia Soft 
    Return to Table of contents