Suggestions

close search

Add Messaging, Voice, and Authentication to your apps with Vonage Communications APIs

Visit the Vonage API Developer Portal

OpenTok.MMAudioDevice

Custom audio device implementation based on mmdeviceapi. This custom audio device can be used instead of the default internal audio device provided by OpenTok.AudioDevice. More...

Inherits OpenTok.IAudioDevice, and IDisposable.

Public Member Functions

 MMAudioDevice (IDispatcher dispatcher)
 Creates a MMAudioDevice with enabled notifications that will be raised throw the provided IDispatcher. Subscribe to InputDeviceAdded, InputDeviceRemoved, DefaultInputDeviceChanged, OutputDeviceAdded, OutputDeviceRemoved, DefaultOutputDeviceChanged to take advantage of these notifications. More...
IList< AudioDevice.InputAudioDeviceEnumerateInputAudioDevices ()
 Returns a list of available audio input devices on the system. More...
IList< AudioDevice.OutputAudioDeviceEnumerateOutputAudioDevices ()
 Returns a list of available audio output devices on the system. More...
AudioDevice.InputAudioDevice GetDefaultInputAudioDevice ()
 Gets the system default audio input device. More...
AudioDevice.OutputAudioDevice GetDefaultOutputAudioDevice ()
 Gets the system default audio output device. More...
void SetInputAudioDevice (string deviceId)
 Selects a device for audio input. This method also invokes AudioDevice.RestartInputAudioDevice() More...
void SetOutputAudioDevice (string deviceId)
 Selects a device for audio output. This method also invokes AudioDevice.RestartOutputAudioDevice() More...
void InitAudio (AudioDevice.AudioBus audioBus)
 Called when the AudioDevice is initialized. Use the AudioBus object to read write audio data. Call the AudioBus.ReadRenderData(IntPtr buffer, int numberOfSamples) and AudioBus.WriteCaptureData(IntPtr buffer, int numberOfSamples) methods to read render data from subscribers and write capture data to publishers. More...
void DestroyAudio ()
 Called when the IAudioDevice instance is destroyed. More...
void InitAudioCapturer ()
 Called when the audio capturer for the IAudioDevice instance is initialized. More...
void DestroyAudioCapturer ()
 Called when th audio capturer for the IAudioDevice instance is destroyed. More...
void StartAudioCapturer ()
 Called when the audio capturer starts. You should begin providing audio samples to the AudioBus.WriteCaptureData(IntPtr buffer, int numberOfSamples) method. More...
void StopAudioCapturer ()
 Called when the audio capturer stops. More...
bool IsAudioCapturerInitialized ()
 Checks if the audio capturer for the IAudioDevice instance is initialized. More...
bool IsAudioCapturerStarted ()
 Checks if the audio capturer for the IAudioDevice instance is started. More...
int GetEstimatedAudioCaptureDelay ()
 Gets the estimated audio capture delay. More...
AudioDeviceSettings GetAudioCapturerSettings ()
 Called when the IAudioDevice instance requires settings. In your implementation of this method, return an AudioDeviceSettings object. More...
void InitAudioRenderer ()
 Called when the audio renderer for the IAudioDevice instance is initialized. More...
void DestroyAudioRenderer ()
 Called when th audio renderer for the IAudioDevice instance is destroyed. More...
void StartAudioRenderer ()
 Called when the audio renderer starts. You should begin receiving audio samples from the AudioBus.ReadRenderData(IntPtr buffer, int numberOfSamples) method. More...
void StopAudioRenderer ()
 Called when the audio renderer stops. More...
bool IsAudioRendererInitialized ()
 Checks if the audio renderer for the IAudioDevice instance is initialized. More...
bool IsAudioRendererStarted ()
 Checks if the audio renderer for the IAudioDevice instance is started. More...
int GetEstimatedAudioRenderDelay ()
 Gets the estimated audio render delay. More...
AudioDeviceSettings GetAudioRendererSettings ()
 Gets settings for the audio renderer for the IAudioDevice instance. More...
void Dispose ()

Protected Member Functions

virtual void Dispose (bool disposing)

Events

EventHandler< AudioDevice.Notifications.InputAudioDeviceEventArgsInputDeviceAdded
 Sent when a new audio input device is detected by the system. More...
EventHandler< AudioDevice.Notifications.OutputAudioDeviceEventArgsOutputDeviceAdded
 Sent when a new audio output device is detected by the system. More...
EventHandler< AudioDevice.Notifications.InputAudioDeviceEventArgsInputDeviceRemoved
 Sent when an audio input device is removed from the system. More...
EventHandler< AudioDevice.Notifications.OutputAudioDeviceEventArgsOutputDeviceRemoved
 Sent when an audio output device is removed from the system. More...
EventHandler< AudioDevice.Notifications.InputAudioDeviceEventArgsDefaultInputDeviceChanged
 Sent when the default audio input device changes at the system level. More...
EventHandler< AudioDevice.Notifications.OutputAudioDeviceEventArgsDefaultOutputDeviceChanged
 Sent when the default audio output device changes at the system level. More...

Detailed Description

Custom audio device implementation based on mmdeviceapi. This custom audio device can be used instead of the default internal audio device provided by OpenTok.AudioDevice.

To use this custom audio device:

  1. Create an instance of this class.

  2. Use AudioDevice.SetCustomAudioDevice before creating the first session to inform webrtc that it will be using this class as the audio device.

Use the following MMAudioDevice methods instead of the static equivalents in AudioDevice:

Subscribe to the following MMAudioDevice events instead of default AudioDevice.Notifications events:

  • InputDeviceAdded, OutputDeviceAdded
  • InputDeviceRemoved, OutputDeviceRemoved
  • DefaultInputDeviceChanged, DefaultOutputDeviceChanged

Constructor & Destructor Documentation

◆ MMAudioDevice()

OpenTok.MMAudioDevice.MMAudioDevice ( IDispatcher  dispatcher)

Creates a MMAudioDevice with enabled notifications that will be raised throw the provided IDispatcher. Subscribe to InputDeviceAdded, InputDeviceRemoved, DefaultInputDeviceChanged, OutputDeviceAdded, OutputDeviceRemoved, DefaultOutputDeviceChanged to take advantage of these notifications.

Member Function Documentation

◆ DestroyAudio()

void OpenTok.MMAudioDevice.DestroyAudio ( )

Called when the IAudioDevice instance is destroyed.

Implements OpenTok.IAudioDevice.

◆ DestroyAudioCapturer()

void OpenTok.MMAudioDevice.DestroyAudioCapturer ( )

Called when th audio capturer for the IAudioDevice instance is destroyed.

Implements OpenTok.IAudioDevice.

◆ DestroyAudioRenderer()

void OpenTok.MMAudioDevice.DestroyAudioRenderer ( )

Called when th audio renderer for the IAudioDevice instance is destroyed.

Implements OpenTok.IAudioDevice.

◆ EnumerateInputAudioDevices()

IList<AudioDevice.InputAudioDevice> OpenTok.MMAudioDevice.EnumerateInputAudioDevices ( )

Returns a list of available audio input devices on the system.

Returns
A list of InputAudioDevice objects, representing available audio input devices on the system.

◆ EnumerateOutputAudioDevices()

IList<AudioDevice.OutputAudioDevice> OpenTok.MMAudioDevice.EnumerateOutputAudioDevices ( )

Returns a list of available audio output devices on the system.

Returns
A list of InputAudioDevice objects, representing available audio input devices on the system.

◆ GetAudioCapturerSettings()

AudioDeviceSettings OpenTok.MMAudioDevice.GetAudioCapturerSettings ( )

Called when the IAudioDevice instance requires settings. In your implementation of this method, return an AudioDeviceSettings object.

Implements OpenTok.IAudioDevice.

◆ GetAudioRendererSettings()

AudioDeviceSettings OpenTok.MMAudioDevice.GetAudioRendererSettings ( )

Gets settings for the audio renderer for the IAudioDevice instance.

Implements OpenTok.IAudioDevice.

◆ GetDefaultInputAudioDevice()

AudioDevice.InputAudioDevice OpenTok.MMAudioDevice.GetDefaultInputAudioDevice ( )

Gets the system default audio input device.

Returns
The system default audio input device.

◆ GetDefaultOutputAudioDevice()

AudioDevice.OutputAudioDevice OpenTok.MMAudioDevice.GetDefaultOutputAudioDevice ( )

Gets the system default audio output device.

Returns
The system default audio output device.

◆ GetEstimatedAudioCaptureDelay()

int OpenTok.MMAudioDevice.GetEstimatedAudioCaptureDelay ( )

Gets the estimated audio capture delay.

Implements OpenTok.IAudioDevice.

◆ GetEstimatedAudioRenderDelay()

int OpenTok.MMAudioDevice.GetEstimatedAudioRenderDelay ( )

Gets the estimated audio render delay.

Implements OpenTok.IAudioDevice.

◆ InitAudio()

void OpenTok.MMAudioDevice.InitAudio ( AudioDevice.AudioBus  audioBus)

Called when the AudioDevice is initialized. Use the AudioBus object to read write audio data. Call the AudioBus.ReadRenderData(IntPtr buffer, int numberOfSamples) and AudioBus.WriteCaptureData(IntPtr buffer, int numberOfSamples) methods to read render data from subscribers and write capture data to publishers.

Parameters
audioBusThe instance of the AudioBus to use for all publishers and subscribers.

Implements OpenTok.IAudioDevice.

◆ InitAudioCapturer()

void OpenTok.MMAudioDevice.InitAudioCapturer ( )

Called when the audio capturer for the IAudioDevice instance is initialized.

Implements OpenTok.IAudioDevice.

◆ InitAudioRenderer()

void OpenTok.MMAudioDevice.InitAudioRenderer ( )

Called when the audio renderer for the IAudioDevice instance is initialized.

Implements OpenTok.IAudioDevice.

◆ IsAudioCapturerInitialized()

bool OpenTok.MMAudioDevice.IsAudioCapturerInitialized ( )

Checks if the audio capturer for the IAudioDevice instance is initialized.

Implements OpenTok.IAudioDevice.

◆ IsAudioCapturerStarted()

bool OpenTok.MMAudioDevice.IsAudioCapturerStarted ( )

Checks if the audio capturer for the IAudioDevice instance is started.

Implements OpenTok.IAudioDevice.

◆ IsAudioRendererInitialized()

bool OpenTok.MMAudioDevice.IsAudioRendererInitialized ( )

Checks if the audio renderer for the IAudioDevice instance is initialized.

Implements OpenTok.IAudioDevice.

◆ IsAudioRendererStarted()

bool OpenTok.MMAudioDevice.IsAudioRendererStarted ( )

Checks if the audio renderer for the IAudioDevice instance is started.

Implements OpenTok.IAudioDevice.

◆ SetInputAudioDevice()

void OpenTok.MMAudioDevice.SetInputAudioDevice ( string  deviceId)

Selects a device for audio input. This method also invokes AudioDevice.RestartInputAudioDevice()

Parameters
deviceIdId of the device

◆ SetOutputAudioDevice()

void OpenTok.MMAudioDevice.SetOutputAudioDevice ( string  deviceId)

Selects a device for audio output. This method also invokes AudioDevice.RestartOutputAudioDevice()

Parameters
deviceIdId of the device

◆ StartAudioCapturer()

void OpenTok.MMAudioDevice.StartAudioCapturer ( )

Called when the audio capturer starts. You should begin providing audio samples to the AudioBus.WriteCaptureData(IntPtr buffer, int numberOfSamples) method.

Implements OpenTok.IAudioDevice.

◆ StartAudioRenderer()

void OpenTok.MMAudioDevice.StartAudioRenderer ( )

Called when the audio renderer starts. You should begin receiving audio samples from the AudioBus.ReadRenderData(IntPtr buffer, int numberOfSamples) method.

Implements OpenTok.IAudioDevice.

◆ StopAudioCapturer()

void OpenTok.MMAudioDevice.StopAudioCapturer ( )

Called when the audio capturer stops.

Implements OpenTok.IAudioDevice.

◆ StopAudioRenderer()

void OpenTok.MMAudioDevice.StopAudioRenderer ( )

Called when the audio renderer stops.

Implements OpenTok.IAudioDevice.

Event Documentation

◆ DefaultInputDeviceChanged

EventHandler<AudioDevice.Notifications.InputAudioDeviceEventArgs> OpenTok.MMAudioDevice.DefaultInputDeviceChanged

Sent when the default audio input device changes at the system level.

◆ DefaultOutputDeviceChanged

EventHandler<AudioDevice.Notifications.OutputAudioDeviceEventArgs> OpenTok.MMAudioDevice.DefaultOutputDeviceChanged

Sent when the default audio output device changes at the system level.

◆ InputDeviceAdded

EventHandler<AudioDevice.Notifications.InputAudioDeviceEventArgs> OpenTok.MMAudioDevice.InputDeviceAdded

Sent when a new audio input device is detected by the system.

◆ InputDeviceRemoved

EventHandler<AudioDevice.Notifications.InputAudioDeviceEventArgs> OpenTok.MMAudioDevice.InputDeviceRemoved

Sent when an audio input device is removed from the system.

◆ OutputDeviceAdded

EventHandler<AudioDevice.Notifications.OutputAudioDeviceEventArgs> OpenTok.MMAudioDevice.OutputDeviceAdded

Sent when a new audio output device is detected by the system.

◆ OutputDeviceRemoved

EventHandler<AudioDevice.Notifications.OutputAudioDeviceEventArgs> OpenTok.MMAudioDevice.OutputDeviceRemoved

Sent when an audio output device is removed from the system.