AudioOutputDevice Class |
Namespace: Accord.DirectSound
The AudioOutputDevice type exposes the following members.
Name | Description | |
---|---|---|
AudioOutputDevice(IntPtr, Int32, Int32) |
Constructs a new Audio Output Device.
| |
AudioOutputDevice(Guid, IntPtr, Int32, Int32) |
Constructs a new Audio Output Device.
|
Name | Description | |
---|---|---|
Channels |
Gets the number of channels for the current output device.
| |
IsRunning |
Gets a value indicating whether this instance is playing audio.
| |
Output |
Audio output.
| |
Owner |
Gets the parent owner form for the device.
| |
SamplingRate |
Gets the sampling rate for the current output device.
|
Name | Description | |
---|---|---|
Dispose |
Performs application-defined tasks associated with
freeing, releasing, or resetting unmanaged resources.
| |
Dispose(Boolean) |
Releases unmanaged and - optionally - managed resources
| |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize |
Releases unmanaged resources and performs other cleanup operations before the
WaveFileAudioSource is reclaimed by garbage collection.
(Overrides ObjectFinalize.) | |
GetHashCode | Serves as the default hash function. (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 |
Starts playing the current buffer.
| |
Play(Single) |
Starts playing the current buffer.
| |
SignalToStop |
Signals audio output to stop its work.
| |
Stop |
Stops playing the current buffer.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
WaitForStop |
Wait for audio output has stopped.
|
Name | Description | |
---|---|---|
AudioOutputError |
Audio output error event.
| |
FramePlayingStarted |
Raised when a frame starts playing.
| |
NewFrameRequested |
Raised when a frame starts playing.
| |
Stopped |
Indicates all frames have been played and the audio finished.
|
Name | Description | |
---|---|---|
HasMethod |
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.) | |
IsEqual |
Compares two objects for equality, performing an elementwise
comparison if the elements are vectors or matrices.
(Defined by Matrix.) | |
To(Type) | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) | |
ToT | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) |
This audio output sends audio data to a local output device such as a sound card. The audio is reproduced using DirectSound through SlimDX.
For instructions on how to list output devices, please see the AudioDeviceCollection documentation page.
Sample usage:
// To create an audio output device, DirectSound requires a handle to // the parent form of the application (or other application handle). In // Windows.Forms, this could be achieved by providing the Handle property // of the currently displayed form. int sampleRate = 22000; // 22kHz int channels = 2; // stereo // Create the audio output device with the desired values AudioOutputDevice output = new AudioOutputDevice(Handle, sampleRate, channels); // The output device works at real time, and as such, forms a queue of audio // samples to be played (more specifically, a buffer). When this buffer starts // to get empty, the output will ask the application for more samples of it // should stop playing. To ask for more samples, the output device will fire // an event which should be handled by the user: output.NewFrameRequested += output_NewFrameRequested; // It is also possible to configure an event to be fired when the device // has stopped playing and when it has just started playing a frame. Those // are mainly used for reporting status to GUI controls. output.Stopped += output_Stopped; output.FramePlayingStarted += output_FramePlayingStarted; // Start playing output.Play();
For more details regarding usage, please check one of the Audio sample applications accompanying the framework.