|
InitDJSystem method |
![]() ![]()
|
Remarks
Initializes the control: the call to this method (or in alternative to the IniDJSystemEx method) is always mandatory when the control is instanced inside the container form and must be performed before calling any other method that will use any player related functionality, possibly from the initialization routine of the container form or dialog: calling this method inside the constructor function of the container form will not work and could cause unpredictable results.
In case the component should be instanced in conjunction with the recorder component and/or the editor component, this method should be called before calling the initialization methods of the other components (InitRecordingSystem for the recorder component and InitEditor for the editor component).
The purpose of this initialization method is to allocate the desired number of players (*), to synchronise the control with the container form, to set the output device (sound card) for each of the allocated players and, eventually, setting the DirectX buffer length in order to reduce the latency time: if using the Light edition of the control, the system default sound card is the unique available output device.
Use the value returned by the GetOutputDevicesCount method in order to know how many output devices are currently installed on the system and the GetOutputDeviceDesc method in order to retrieve the friendly name of every output device.
The output device for a certain player can be changed at a later time using the StreamOutputDeviceSet method.
For further details about "multi-player" management, take a look to the How to deal with multi-player features section. For further details about output devices management, take a look to the How to work with multiple output devices and speakers section.
Syntax
Examples of use of the nOutputX parameters
We have already told that you can obtain the number of sound cards calling the GetOutputDevicesCount method and storing its return value into a numeric variable called, for example, nCount.
Example 1: nCount value is 1
Suppose that you must allocate two players (0 and 1); you have only one sound card that, for exclusion, will be the default one, so you can set the following values: nTotalPlayers = 2 (*) hWndParent = your form or dialog box HWND nOutput0 = 0 (use default sound card) nOutput1 = 0 (use default sound card) nOutput2 = 0 (value ignored) nOutput3 = 0 (value ignored)
Example 2: nCount value is 3 Call the GetOutputDeviceDesc method nCount times (once for every sound card) using a zero-based index in order to obtain every sound card friendly name (suppose you obtain A, B and C). Now suppose that you must allocate four players (0, 1, 2 and 3) that will redirect their output in the following way:
- player 0 and player 1 must output to the system default sound card A. - player 2 must output to sound card C. - player 3 must output to sound card B.
You will have to call the InitDJSystem method with the following parameters: nTotalPlayers = 4 (*) hWndParent = your form or dialog box HWND nOutput0 = 0 nOutput1 = 0 nOutput2 = 2 nOutput3 = 1
Return value
(*) 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.
|