<PackageReference Include="System.Windows.Extensions" Version="10.0.0-rc.2.25502.107" />

SoundPlayer

Controls playback of a sound from a .wav file.
public bool IsLoadCompleted { get; }

Gets a value indicating whether loading of a .wav file has successfully completed.

public int LoadTimeout { get; set; }

Gets or sets the time, in milliseconds, in which the .wav file must load.

public string SoundLocation { get; set; }

Gets or sets the file path or URL of the .wav file to load.

public Stream Stream { get; set; }

Gets or sets the Stream from which to load the .wav file.

public object Tag { get; set; }

Gets or sets the Object that contains data about the SoundPlayer.

Occurs when a .wav file has been successfully or unsuccessfully loaded.

Occurs when a new audio source path for this SoundPlayer has been set.

Occurs when a new Stream audio source for this SoundPlayer has been set.

public SoundPlayer()

Initializes a new instance of the SoundPlayer class.

public SoundPlayer(Stream stream)

Initializes a new instance of the SoundPlayer class, and attaches the .wav file within the specified Stream.

protected SoundPlayer(SerializationInfo serializationInfo, StreamingContext context)

Initializes a new instance of the SoundPlayer class.

public SoundPlayer(string soundLocation)

Initializes a new instance of the SoundPlayer class, and attaches the specified .wav file.

public void Load()

Loads a sound synchronously.

public void LoadAsync()

Loads a .wav file from a stream or a Web resource using a new thread.

protected virtual void OnLoadCompleted(AsyncCompletedEventArgs e)

Raises the LoadCompleted event.

protected virtual void OnSoundLocationChanged(EventArgs e)

Raises the SoundLocationChanged event.

protected virtual void OnStreamChanged(EventArgs e)

Raises the StreamChanged event.

public void Play()

Plays the .wav file using a new thread, and loads the .wav file first if it has not been loaded.

public void PlayLooping()

Plays and loops the .wav file using a new thread, and loads the .wav file first if it has not been loaded.

public void PlaySync()

Plays the .wav file and loads the .wav file first if it has not been loaded.

public void Stop()

Stops playback of the sound if playback is occurring.