Audio Class

Language:

The Audio class is primarily designed for very simple playback scenarios, or for use with the Video class.

Definition

Visual Basic NotInheritable Public Class Audio
    Inherits Object
    Implements IDisposable
C# public sealed class Audio : Object, IDisposable
C++ public ref class Audio sealed : Object, IDisposable
JScript public final class Audio extends Object implements IDisposable

Members Table

Event Description
Disposing Occurs when the Dispose method is called or when the object is finalized and collected by the garbage collector of the Microsoft .NET common language runtime.
Ending Occurs when the playback is ending.
Pausing Occurs when the playback is pausing.
Starting Occurs when the playback is starting.
Stopping Occurs when the playback is stopping.
Method Description
Audio Initializes a new instance of the object and opens an audio file for playback.
Dispose Immediately releases the unmanaged resources used by an object.
Finalize Called during garbage collection. If implemented, allows an object to free resources before it is destroyed by the garbage collector.
static (Shared in Visual Basic) FromFile Creates an Audio object from a file.
static (Shared in Visual Basic) FromUrl Creates an Audio object from a Uri Leave Site object.
Open Loads a new file into the Audio object.
Pause Pauses playback.
Play Starts playback.
raise_Disposing Raises the Audio.Disposing event when called from within a derived class.
raise_Ending Raises the Audio.Ending event when called from within a derived class.
raise_Pausing Raises the Audio.Pausing event when called from within a derived class.
raise_Starting Raises the Audio.Starting event when called from within a derived class.
raise_Stopping Raises the Audio.Stopping event when called from within a derived class.
SeekCurrentPosition Seeks to a specific playback position.
SeekStopPosition Sets a new stop position in playback.
Stop Stops playback.
StopWhenReady Stops playback when the Audio object is ready.
Property Description
Balance Retrieves and sets the playback position in the stereo field.
CurrentPosition Retrieves and sets the current position of playback.
Disposed Retrieves a value that is true if the object is disposed; otherwise the value is false.
Duration Retrieves the length, in seconds, of the audio file.
Paused Retrieves the current playback state, whether playback is currently paused.
Playing Retrieves the current playback state, whether playback is currently playing.
SeekingCaps Retrieves the seeking capabilities of playback.
State Retrieves the current state of playback.
Stopped Retrieves the current playback state, whether playback is currently stopped.
StopPosition Retrieves the position where playback stopped.
Volume Retrieves and sets the amount to attenuate the volume of audio playback.

Inheritance Hierarchy

Object Leave Site
Audio

Class Information

Namespace Microsoft.DirectX.AudioVideoPlayback
Assembly Microsoft.DirectX.AudioVideoPlayback (microsoft.directx.audiovideoplayback.dll)
Strong Name Microsoft.DirectX.AudioVideoPlayback,  Version=1.0.900.0,  Culture=neutral,  PublicKeyToken=d3231b57b74a1492

Send comments about this topic to Microsoft. © Microsoft Corporation. All rights reserved.

Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center