In The Hand - .NET Components for Mobility
SoundPlayer Class
NamespacesInTheHand.MediaSoundPlayer
Controls playback of a sound from a .wav file.
Declaration Syntax
C#Visual Basic
public sealed class SoundPlayer : Component
Public NotInheritable Class SoundPlayer _
	Inherits Component
Members
All MembersConstructorsMethodsPropertiesEvents



IconMemberDescription
SoundPlayer()()()
Initializes a new instance of the SoundPlayer class.

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

SoundPlayer(String)
Initializes a new instance of the SoundPlayer class and attaches the specified .wav file.

Dispose()()()
Releases all resources used by the Component.
(Inherited from Component.)
Dispose(Boolean)
Releases the unmanaged resources used by the Component and optionally releases the managed resources.
(Inherited from Component.)
Disposed
Adds an event handler to listen to the Disposed event on the component.
(Inherited from Component.)
Equals(Object)
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Events
Gets the list of event handlers that are attached to this Component.
(Inherited from Component.)
Finalize()()()
Releases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection.
(Inherited from Component.)
GetHashCode()()()
Serves as a hash function for a particular type. GetHashCode()()() is suitable for use in hashing algorithms and data structures like a hash table.
(Inherited from Object.)
GetType()()()
Gets the Type of the current instance.
(Inherited from Object.)
MemberwiseClone()()()
Creates a shallow copy of the current Object.
(Inherited from Object.)
Play()()()
Plays the .wav file using a new thread.

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

PlaySync()()()
Plays the .wav file using the UI thread.

Site
Gets or sets the ISite of the Component.
(Inherited from Component.)
SoundLocation
Gets or sets the file path of the .wav file to load.

SoundLocationChanged
Occurs when the SoundLocation property is changed.

Stop()()()
Stops playback of the sound if playback is occurring.

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

StreamChanged
Occurs when the Stream property is changed.

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

ToString()()()
Returns a String that represents the current Object.
(Inherited from Object.)
Remarks
The SoundPlayer class provides a simple interface for loading and playing a .wav file. The SoundPlayer class supports loading a .wav file from a file path, a Stream that contains a .wav file, or an embedded resource that contains a .wav file.
Examples
This example plays a sound at a given path at run time.
CopyC#
[VB]
            Private Sub playSimpleSound()
                Dim simpleSound As New SoundPlayer("\Windows\alarm.wav")
                simpleSound.Play()
            End Sub
CopyC#
private void playSimpleSound()
{
    SoundPlayer simpleSound = new SoundPlayer(@"\Windows\alarm.wav");
    simpleSound.Play();
}
Inheritance Hierarchy

Assembly: InTheHand.WindowsMobile (Module: InTheHand.WindowsMobile) Version: 3.2.0.0