AudioDevice

namespace VideoKit {
    /// <summary>
    /// Audio device for streaming audio buffers.
    /// </summary>
    class AudioDevice { ... }
}

The AudioDevice abstracts a hardware microphone that streams audio buffers.


Discovering Audio Devices

INCOMPLETE

Checking Permissions

/// <summary>
/// Check the current microphone permission status.
/// </summary>
/// <param name="request">Request permissions if the user has not yet been asked.</param>
/// <returns>Current microphone permissions status.</returns>
static Task<PermissionStatus> CheckPermissions (bool request = true);

INCOMPLETE

 /// <summary>
/// Device permissions status.
/// </summary>
enum PermissionStatus : int {
    /// <summary>
    /// User has not authorized or denied access to media device.
    /// </summary>
    Unknown = 0,
    /// <summary>
    /// User has denied access to media device.
    /// </summary>
    Denied = 2,
    /// <summary>
    /// User has authorized access to media device.
    /// </summary>
    Authorized = 3
}

Discovering Audio Devices

/// <summary>
/// Discover available audio input devices.
/// </summary>
/// <param name="configureAudioSession">Configure the application's global audio session for audio device discovery.</param>
static Task<AudioDevice[]> Discover (bool configureAudioSession = true);

INCOMPLETE


Identifying the Device

Media devices can be identified in several ways:

Inspecting the Unique Identifier

/// <summary>
/// Device unique ID.
/// </summary>
string uniqueId { get; }

INCOMPLETE

Inspecting the Device Name

/// <summary>
/// Display friendly device name.
/// </summary>
string name { get; }

INCOMPLETE

Inspecting the Device Location

/// <summary>
/// Device location.
/// </summary>
Location location { get; }

INCOMPLETE

Checking for the Default Device

/// <summary>
/// Device is the default device for its media type.
/// </summary>
bool defaultForMediaType { get; }

INCOMPLETE


Configuring the Microphone

INCOMPLETE

Specifying the Sample Rate

/// <summary>
/// Get or set the audio sample rate.
/// </summary>
int sampleRate { get; set; }

INCOMPLETE

Specifying the Channel Count

/// <summary>
/// Get ot set the audio channel count.
/// </summary>
int channelCount { get; set; }

INCOMPLETE

Checking Echo Cancellation Support

/// <summary>
/// Enable or disable Adaptive Echo Cancellation (AEC).
/// </summary>
bool echoCancellationSupported { get; }

INCOMPLETE

Requesting Echo Cancellation

/// <summary>
/// Enable or disable Adaptive Echo Cancellation (AEC).
/// </summary>
bool echoCancellation { get; set }

INCOMPLETE


Streaming Audiio

The main function of the AudioDevice is to stream AudioBuffer instances to consumers.

Checking the Streaming Status

/// <summary>
/// Whether the device is running.
/// </summary>
bool running { get; }

INCOMPLETE

Starting the Stream

/// <summary>
/// Start running.
/// </summary>
/// <param name="handler">Delegate to receive audio buffers.</param>
void StartRunning (Action<AudioBuffer> handler);

INCOMPLETE

Stopping the Stream

/// <summary>
/// Stop running.
/// </summary>
void StopRunning ();

INCOMPLETE


Managing the Device State

INCOMPLETE

Listening for Disconnections

/// <summary>
/// Event raised when the device is disconnected.
/// </summary>
event Action onDisconnected { add; remove; }

INCOMPLETE


Was this page helpful?