WASAPI.DeviceStartExclusive method |
|
Remarks
Starts a WASAPI device in exclusive mode. In order to start the device in shared mode you can use the WASAPI.DeviceStartShared method. You can know if a WASAPI device is already started through the WASAPI .DeviceIsStarted method.
Loopback devices cannot be started in exclusive mode.
This method is only effective if the InitDriversType method has been invoked with the nDriverType parameter set to DRIVER_TYPE_WASAPI and must be always called at a later stage respect to the call to the InitRecordingSystem method.
This method will affect any other instance of the component inside the application. If the component should be used in conjunction with the Audio DJ Studio API for .NET and/or Audio Sound Editor API for .NET components, these ones would be affected too.
If you should be using this API in conjunction with Audio DJ Studio API for .NET, as seen inside the WasapiStreamMixer sample, you should prefer calling this method from Audio DJ Studio API for .NET so you would have a better control over the channel mode used for playback.
This method is only intended for usage with Windows Vista and later versions.
For further details about the use of WASAPI see the WASAPIMan class and the How to manage audio flow through WASAPI tutorial
Syntax
[Visual Basic] Public Function DeviceStartExclusive ( nDeviceIndex as Int32, nDeviceType as enumWasapiDeviceTypes, nSampleRate as Int32, nChannels as Int16, nBufferLengthMs as Int32, nBufferUpdateTimeMs as Int32 ) as enumErrorCodes |
[C#] public enumErrorCodes DeviceStartExclusive ( Int32 nDeviceIndex, enumWasapiDeviceTypes nDeviceType, Int32 nSampleRate, Int16 nChannels, Int32 nBufferLengthMs, Int32 nBufferUpdateTimeMs ); |
[C++] public: enumErrorCodes DeviceStartExclusive ( Int32 nDeviceIndex, enumWasapiDeviceTypes nDeviceType, Int32 nSampleRate, Int16 nChannels, Int32 nBufferLengthMs, Int32 nBufferUpdateTimeMs ); |
Parameter |
Description |
|||||||||
|
|
|||||||||
nDeviceIndex |
Number representing the zero-based index of the WASAPI device of interest. The total number of available WASAPI devices can be obtained using the WASAPI.DeviceGetCount method. |
|||||||||
nDeviceType |
The type of device. Supported values are the following:
|
|||||||||
nSampleRate |
Sample rate, for example 44100 |
|||||||||
nChannels |
Number of channels |
|||||||||
nBufferLengthMs |
Length of the buffer expressed in milliseconds. This value determines the latency and if it should be too small the sound card driver may eventually adjust it to its minimum supported value. You can know if the given length has been accepted by verifying the value of the nLatencyMs parameter after calling the WASAPI.DeviceLatencyGet method. |
|||||||||
nBufferUpdateTimeMs |
Update time, expressed in milliseconds, for filling the buffer. You can set this value to 0 in order to let the sound card driver use its default. |
Return value
Value |
Meaning |
|
|
Negative value |
An error occurred (see the LastError property for further error details) |
enumErrorCodes.ERR_NOERROR (0) |
The method call was successful. |