C# Class BrightIdeasSoftware.Audio

Instances of this class allow sound to be played at specified points within a animation.

This class uses the SoundPlayer class internally, and thus can only handle system sounds and WAV sound files.

A sound that is already playing cannot be paused.

Inheritance: BrightIdeasSoftware.Animateable
Datei anzeigen Open project: ennerperez/ObjectListView Class Usage Examples

Protected Properties

Property Type Description
FileName string
Player SoundPlayer
ResourceName string
SystemSound SystemSound

Public Methods

Method Description
Audio ( ) : System

Create an empty Audio object

Audio ( SystemSound sound ) : System

Creates an Audio object that will play the given system sound

Audio ( string fileName ) : System

Creates an Audio object that will play the given "wav" file

FromResource ( string resourceName ) : Audio

Load a sound from a named resource.

To embed a wav file, simple add it to the project, and change "Build Action" to "Embedded Resource".

Start ( ) : void

Start the sound playing

Stop ( ) : void

Stop the sound

Tick ( long elapsed ) : bool

Advance the audio and return if it is done.

Method Details

Audio() public method

Create an empty Audio object
public Audio ( ) : System
return System

Audio() public method

Creates an Audio object that will play the given system sound
public Audio ( SystemSound sound ) : System
sound SystemSound
return System

Audio() public method

Creates an Audio object that will play the given "wav" file
public Audio ( string fileName ) : System
fileName string
return System

FromResource() public static method

Load a sound from a named resource.
To embed a wav file, simple add it to the project, and change "Build Action" to "Embedded Resource".
public static FromResource ( string resourceName ) : Audio
resourceName string The name of the resource including the trailing ".wav"
return Audio

Start() public method

Start the sound playing
public Start ( ) : void
return void

Stop() public method

Stop the sound
public Stop ( ) : void
return void

Tick() public method

Advance the audio and return if it is done.
public Tick ( long elapsed ) : bool
elapsed long
return bool

Property Details

FileName protected_oe property

Gets or sets the name of the audio file that will be played.
protected string FileName
return string

Player protected_oe property

protected SoundPlayer Player
return SoundPlayer

ResourceName protected_oe property

protected string ResourceName
return string

SystemSound protected_oe property

protected SystemSound SystemSound
return SystemSound