C# Class NAudio.Wave.DirectSoundOut

NativeDirectSoundOut using DirectSound COM interop. Contact author: Alexandre Mutel - alexandre_mutel at yahoo.fr Modified by: Graham "Gee" Plumb
Inheritance: IWavePlayer
Show file Open project: jishi/Jishi.StreamToSonos Class Usage Examples

Public Properties

Property Type Description
DSDEVID_DefaultCapture System.Guid
DSDEVID_DefaultPlayback System.Guid
DSDEVID_DefaultVoiceCapture System.Guid
DSDEVID_DefaultVoicePlayback System.Guid

Public Methods

Method Description
DirectSoundOut ( ) : System

Initializes a new instance of the DirectSoundOut class.

DirectSoundOut ( System.Guid device ) : System

Initializes a new instance of the DirectSoundOut class.

DirectSoundOut ( System.Guid device, int latency ) : System

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

DirectSoundOut ( int latency ) : System

Initializes a new instance of the DirectSoundOut class.

Dispose ( ) : void

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

GetPosition ( ) : long

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)

Init ( IWaveProvider waveProvider ) : void

Initialise playback

Pause ( ) : void

Pause Playback

Play ( ) : void

Begin playback

Stop ( ) : void

Stop playback

Private Methods

Method Description
DirectSoundCreate ( System.Guid &GUID, [ directSound, IntPtr pUnkOuter ) : void
DirectSoundEnumerate ( DSEnumCallback lpDSEnumCallback, IntPtr lpContext ) : void
EnumCallback ( IntPtr lpGuid, IntPtr lpcstrDescription, IntPtr lpcstrModule, IntPtr lpContext ) : bool
Feed ( int bytesToCopy ) : int

Feeds the SecondaryBuffer with the WaveStream

GetDesktopWindow ( ) : IntPtr
InitializeDirectSound ( ) : void
IsBufferLost ( ) : bool

Determines whether the SecondaryBuffer is lost.

MsToBytes ( int ms ) : int

Convert ms to bytes size according to WaveFormat

PlaybackThreadFunc ( ) : void

Processes the samples in a separate thread.

RaisePlaybackStopped ( Exception e ) : void
StopPlayback ( ) : void

Stop playback

Method Details

DirectSoundOut() public method

Initializes a new instance of the DirectSoundOut class.
public DirectSoundOut ( ) : System
return System

DirectSoundOut() public method

Initializes a new instance of the DirectSoundOut class.
public DirectSoundOut ( System.Guid device ) : System
device System.Guid
return System

DirectSoundOut() public method

Initializes a new instance of the DirectSoundOut class. (40ms seems to work under Vista).
public DirectSoundOut ( System.Guid device, int latency ) : System
device System.Guid Selected device
latency int The latency.
return System

DirectSoundOut() public method

Initializes a new instance of the DirectSoundOut class.
public DirectSoundOut ( int latency ) : System
latency int
return System

Dispose() public method

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public Dispose ( ) : void
return void

GetPosition() public method

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 GetPosition ( ) : long
return long

Init() public method

Initialise playback
public Init ( IWaveProvider waveProvider ) : void
waveProvider IWaveProvider The waveprovider to be played
return void

Pause() public method

Pause Playback
public Pause ( ) : void
return void

Play() public method

Begin playback
public Play ( ) : void
return void

Stop() public method

Stop playback
public Stop ( ) : void
return void

Property Details

DSDEVID_DefaultCapture public static property

DirectSound default capture device GUID
public static Guid,System DSDEVID_DefaultCapture
return System.Guid

DSDEVID_DefaultPlayback public static property

DirectSound default playback device GUID
public static Guid,System DSDEVID_DefaultPlayback
return System.Guid

DSDEVID_DefaultVoiceCapture public static property

DirectSound default device for voice capture
public static Guid,System DSDEVID_DefaultVoiceCapture
return System.Guid

DSDEVID_DefaultVoicePlayback public static property

DirectSound default device for voice playback
public static Guid,System DSDEVID_DefaultVoicePlayback
return System.Guid