Table of Contents

Class DirectSoundOut

Namespace
NAudio.Wave
Assembly
NAudio.Core.dll

NativeDirectSoundOut using DirectSound COM interop. Contact author: Alexandre Mutel - alexandre_mutel at yahoo.fr Modified by: Graham "Gee" Plumb

public class DirectSoundOut : IWavePlayer, IDisposable
Inheritance
DirectSoundOut
Implements
Inherited Members
Extension Methods

Constructors

DirectSoundOut()

Initializes a new instance of the DirectSoundOut class.

public DirectSoundOut()

DirectSoundOut(Guid)

Initializes a new instance of the DirectSoundOut class.

public DirectSoundOut(Guid device)

Parameters

device Guid

DirectSoundOut(Guid, int)

Initializes a new instance of the DirectSoundOut class. (40ms seems to work under Vista).

public DirectSoundOut(Guid device, int latency)

Parameters

device Guid

Selected device

latency int

The latency.

DirectSoundOut(int)

Initializes a new instance of the DirectSoundOut class.

public DirectSoundOut(int latency)

Parameters

latency int

Fields

DSDEVID_DefaultCapture

DirectSound default capture device GUID

public static readonly Guid DSDEVID_DefaultCapture

Field Value

Guid

DSDEVID_DefaultPlayback

DirectSound default playback device GUID

public static readonly Guid DSDEVID_DefaultPlayback

Field Value

Guid

DSDEVID_DefaultVoiceCapture

DirectSound default device for voice capture

public static readonly Guid DSDEVID_DefaultVoiceCapture

Field Value

Guid

DSDEVID_DefaultVoicePlayback

DirectSound default device for voice playback

public static readonly Guid DSDEVID_DefaultVoicePlayback

Field Value

Guid

Properties

Devices

Gets the DirectSound output devices in the system

public static IEnumerable<DirectSoundDeviceInfo> Devices { get; }

Property Value

IEnumerable<DirectSoundDeviceInfo>

OutputWaveFormat

public WaveFormat OutputWaveFormat { get; }

Property Value

WaveFormat

PlaybackPosition

Gets the current position from the wave output device.

public TimeSpan PlaybackPosition { get; }

Property Value

TimeSpan

PlaybackState

Current playback state

public PlaybackState PlaybackState { get; }

Property Value

PlaybackState

Volume

The volume 1.0 is full scale

public float Volume { get; set; }

Property Value

float

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

~DirectSoundOut()

Releases unmanaged resources and performs other cleanup operations before the DirectSoundOut is reclaimed by garbage collection.

protected ~DirectSoundOut()

GetPosition()

Gets the current position in bytes from the wave output device. (n.b. this is not the same thing as the position within your reader stream)

public long GetPosition()

Returns

long

Position in bytes

Init(IWaveProvider)

Initialise playback

public void Init(IWaveProvider waveProvider)

Parameters

waveProvider IWaveProvider

The waveprovider to be played

Pause()

Pause Playback

public void Pause()

Play()

Begin playback

public void Play()

Stop()

Stop playback

public void Stop()

Events

PlaybackStopped

Playback Stopped

public event EventHandler<StoppedEventArgs> PlaybackStopped

Event Type

EventHandler<StoppedEventArgs>