ResetEngine method |
|
Remarks
Resets the multimedia engine: this method can be used in order to enumerate again available sound devices which could have been plugged or unplugged into a USB port; the container application can be notified when a USB device is plugged or unplugged through the DeviceChange event (On Windows XP) or through the events CoreAudioDeviceAdded, CoreAudioDeviceRemoved and CoreAudioDeviceDefaultChange (on Windows Vista and higher versions).
Important note when running under Windows Vista or higher versions
When the component is set to work with WASAPI drivers (see the How to manage audio flow through WASAPI tutorial for details), USB device plugging or unplugging doesn't require the engine to be reset because the list of available audio devices is automatically kept up to date: new calls to the WASAPI.DeviceGetCount and WASAPI.DeviceGetDesc methods will report the change.
|
Immediately after calling this method it's mandatory to make a call to the ResetControl method, on each of the instanced controls, in order to re-initialize the control(s).
By design the CoreAudioDeviceDefaultChange event is only sent to the first instance of the component: due to the fact that all instances of the component share the same instance of the multimedia engine, it's very important that ResetEngine is called only once from this specific instance of the component, as it will affect all of the other instances, and that you call ResetControl from all of the instances or you would experience the ERR_INVALID_PLAYER error on next calls to methods of the control.
In case the component should be used in conjunction with the sound recorder and/or sound editor components, you should call the ResetControl method of these components as well.
Syntax
[Visual Basic] Public Sub ResetEngine ( ) |
[C#] public void ResetEngine ( ); |
[C++] public: void ResetEngine ( ); |