Copyright © 2005-2019 MultiMedia Soft

How to deal with multi-player features

Previous pageReturn to chapter overviewNext page

A "player" can be compared to a physical "deck" on a DJ console, the place where you put the vinyl/CD to be played; the developer can create a console with many virtual decks that can play simultaneously many different songs on one or more sound cards, each deck having its own volume/tempo/pitch settings. The availability of a certain number of players (decks) will enable the container application to mix several songs on different output channels, giving for example the ability to play advertising spots while songs are being played/mixed on different output channels: this is very useful for multi-channel radio stations automation software.

 

The number of players allocated by a single control instance is defined using the nTotalPlayers parameter of the InitSoundSystem method.

 

A couple of possible questions:

 

"In order to define the player output device, the InitSoundSystem method supports only four parameters: what happens if I have the Deluxe edition and I set the nTotalPlayers parameter to 6?"

 

In this case the 4 nOutputX parameters will define the output device for players 0, 1, 2 and 3 (players are zero-based) while players 4 and 5 will automatically output to the system default sound card. Output device for players 4 and 5 can be changed at a later time using the StreamOutputDeviceSet method. An alternative approach would be instantiating 2 controls, the first one allocating 4 players and the second one allocating 2 players.

 

"If I need to allocate 12 players, how can I set for each of them a specific output device?"

 

In this case you need to allocate on your form 3 separate instances of the control, each of them calling the respective InitSoundSystem method and each of them setting the nTotalPlayers parameter to 4 (3 * 4 = 12). In this way each of the instanced control will have the possibility to assign to each allocated player the respective output device.