C# Class AudioPlayerApp.AudioPlayer

An audio player able to play audio from several audio and video formats (mp3, wma, avi, mp4... etc.) using XAudio2 and MediaFoundation.
Mostra file Open project: HakanL/animatroller Class Usage Examples

Public Properties

Property Type Description
CrossFadeStarting EventHandler
StateChanged EventHandler

Private Properties

Property Type Description
DisposePlayer void
PlayAsync void
sourceVoice_BufferEnd void

Public Methods

Method Description
AudioPlayer ( SharpDX.XAudio2.XAudio2 xaudio2, Stream audioStream ) : System

Initializes a new instance of the AudioPlayer class.

Close ( ) : void

Close this audio player.

This is similar to call Stop(), Dispose(), Wait().

Pause ( ) : void

Pauses the sound.

Play ( ) : void

Plays the sound.

Stop ( ) : void

Stops the sound.

Wait ( ) : void

Wait that the player is finished.

Protected Methods

Method Description
RaiseCrossFadeStarting ( ) : void
RaiseStateChanged ( StateEventArgs args ) : void

Private Methods

Method Description
DisposePlayer ( ) : void
PlayAsync ( ) : void

Internal method to play the sound.

sourceVoice_BufferEnd ( IntPtr obj ) : void

Method Details

AudioPlayer() public method

Initializes a new instance of the AudioPlayer class.
public AudioPlayer ( SharpDX.XAudio2.XAudio2 xaudio2, Stream audioStream ) : System
xaudio2 SharpDX.XAudio2.XAudio2 The xaudio2 engine.
audioStream Stream The input audio stream.
return System

Close() public method

Close this audio player.
This is similar to call Stop(), Dispose(), Wait().
public Close ( ) : void
return void

Pause() public method

Pauses the sound.
public Pause ( ) : void
return void

Play() public method

Plays the sound.
public Play ( ) : void
return void

RaiseCrossFadeStarting() protected method

protected RaiseCrossFadeStarting ( ) : void
return void

RaiseStateChanged() protected method

protected RaiseStateChanged ( StateEventArgs args ) : void
args StateEventArgs
return void

Stop() public method

Stops the sound.
public Stop ( ) : void
return void

Wait() public method

Wait that the player is finished.
public Wait ( ) : void
return void

Property Details

CrossFadeStarting public_oe property

public EventHandler CrossFadeStarting
return EventHandler

StateChanged public_oe property

public EventHandler StateChanged
return EventHandler