Represents a wave out device.
More...
|
| WaveOut () |
| Creates a default WaveOut device Will use window callbacks if called from a GUI thread, otherwise function callbacks.
|
|
| WaveOut (IntPtr windowHandle) |
| Creates a WaveOut device using the specified window handle for callbacks.
|
|
| WaveOut (WaveCallbackInfo callbackInfo) |
| Opens a WaveOut device.
|
|
void | Init (IWaveProvider waveProvider) |
| Initializes the audio output with the specified wave provider.
|
|
void | Play () |
| Plays the audio if the playback state is stopped, or resumes playing if the state is paused.
|
|
void | Pause () |
| Pauses the playback if the current state is playing.
|
|
void | Resume () |
| Resumes playback of the audio.
|
|
void | Stop () |
| Stops the audio playback.
|
|
long | GetPosition () |
| Gets the current position in bytes of the audio playback.
|
|
void | Dispose () |
| Releases the unmanaged resources used by the WaveOut device and optionally releases the managed resources.
|
|
|
void | Dispose (bool disposing) |
| Closes the WaveOut device and disposes of buffers.
|
|
|
static Int32 | DeviceCount [get] |
| Returns the number of Wave Out devices available in the system.
|
|
int | DesiredLatency [get, set] |
| Gets or sets the desired latency in milliseconds Should be set before a call to Init.
|
|
int | NumberOfBuffers [get, set] |
| Gets or sets the number of buffers used Should be set before a call to Init.
|
|
int | DeviceNumber = -1 [get, set] |
| Gets or sets the device number Should be set before a call to Init This must be between -1 and DeviceCount- 1. -1 means stick to default device even default device is changed.
|
|
WaveFormat | OutputWaveFormat [get] |
| Gets a Wave.WaveFormat instance indicating the format the hardware is using.
|
|
PlaybackState | PlaybackState [get] |
| Playback State.
|
|
float | Volume [get, set] |
| Volume for this device 1.0 is full scale.
|
|
Represents a wave out device.
◆ WaveOut() [1/3]
NAudio.Wave.WaveOut.WaveOut |
( |
| ) |
|
|
inline |
Creates a default WaveOut device Will use window callbacks if called from a GUI thread, otherwise function callbacks.
◆ WaveOut() [2/3]
NAudio.Wave.WaveOut.WaveOut |
( |
IntPtr | windowHandle | ) |
|
|
inline |
Creates a WaveOut device using the specified window handle for callbacks.
- Parameters
-
windowHandle | A valid window handle |
◆ WaveOut() [3/3]
◆ ~WaveOut()
NAudio.Wave.WaveOut.~WaveOut |
( |
| ) |
|
|
inlineprivate |
Finalizer. Only called when user forgets to call Dispose
◆ Callback()
Callback method for the wave out function.
- Parameters
-
hWaveOut | Handle to the waveform-audio output device associated with the callback. |
uMsg | The message sent to the callback function. |
dwInstance | User instance data specified with waveOutOpen. |
wavhdr | Pointer to a WaveHeader structure that identifies the header of the completed waveform-audio data block. |
dwReserved | Not used. |
This method is called when a waveform-audio output buffer is done. It checks if the playback state is playing and then processes the buffer. If an exception occurs during processing, it is caught and stored in the 'exception' variable. After processing, it checks if all buffers have been played and raises the playback stopped event if so.
◆ Dispose() [1/2]
void NAudio.Wave.WaveOut.Dispose |
( |
| ) |
|
|
inline |
Releases the unmanaged resources used by the WaveOut device and optionally releases the managed resources.
- Parameters
-
disposing | true to release both managed and unmanaged resources; false to release only unmanaged resources. |
This method stops the playback of audio using the WaveOut device and releases the unmanaged resources associated with it. If disposing is true, it also releases the managed resources, such as audio buffers.
◆ Dispose() [2/2]
void NAudio.Wave.WaveOut.Dispose |
( |
bool | disposing | ) |
|
|
inlineprotected |
Closes the WaveOut device and disposes of buffers.
- Parameters
-
disposing | True if called from Dispose |
◆ EnqueueBuffers()
void NAudio.Wave.WaveOut.EnqueueBuffers |
( |
| ) |
|
|
inlineprivate |
Enqueues the available buffers for playback.
This method iterates through the available buffers and enqueues them for playback if they are not already in the queue. If a buffer is successfully enqueued, the count of queued buffers is incremented. If a buffer's 'OnDone' method returns false, the playback state is set to 'Stopped' and the iteration is terminated.
◆ GetCapabilities()
Retrieves the capabilities of the specified audio output device.
- Parameters
-
devNumber | The device number for which to retrieve the capabilities. |
- Returns
- The capabilities of the audio output device specified by devNumber .
- Exceptions
-
MmException | Thrown when an error occurs while retrieving the device capabilities. |
This method retrieves the capabilities of the specified audio output device using the WaveOut API. It initializes a new instance of WaveOutCapabilities and populates it with the capabilities of the specified device. The method then returns the retrieved capabilities.
◆ GetPosition()
long NAudio.Wave.WaveOut.GetPosition |
( |
| ) |
|
Gets the current position in bytes of the audio playback.
- Returns
- The current position in bytes of the audio playback.
Implements NAudio.Wave.IWavePosition.
◆ Init()
Initializes the audio output with the specified wave provider.
- Parameters
-
waveProvider | The wave provider to be used for audio output. |
- Exceptions
-
MmException | Thrown when an error occurs during the initialization process. |
This method initializes the audio output with the provided wave provider and sets up the necessary buffers for playback. It calculates the buffer size based on the desired latency and number of buffers, and then opens the wave output device. After successful initialization, the audio output is ready for playback.
Implements NAudio.Wave.IWavePlayer.
◆ Pause()
void NAudio.Wave.WaveOut.Pause |
( |
| ) |
|
|
inline |
Pauses the playback if the current state is playing.
- Exceptions
-
MmException | Thrown when an error occurs during the pause operation. |
Implements NAudio.Wave.IWavePlayer.
◆ Play()
void NAudio.Wave.WaveOut.Play |
( |
| ) |
|
|
inline |
Plays the audio if the playback state is stopped, or resumes playing if the state is paused.
If the playbackState is PlaybackState.Stopped, this method changes the state to PlaybackState.Playing and enqueues any available buffers for playback. If the playbackState is PlaybackState.Paused, this method enqueues any available buffers for playback, resumes playback, and changes the state to PlaybackState.Playing.
Implements NAudio.Wave.IWavePlayer.
◆ RaisePlaybackStoppedEvent()
void NAudio.Wave.WaveOut.RaisePlaybackStoppedEvent |
( |
Exception | e | ) |
|
|
inlineprivate |
Raises the PlaybackStopped event with the specified exception.
- Parameters
-
e | The exception that caused the playback to stop. |
This method raises the PlaybackStopped event with the specified exception. If a synchronization context is available, the event is raised on the synchronization context; otherwise, it is raised on the current thread.
◆ Resume()
void NAudio.Wave.WaveOut.Resume |
( |
| ) |
|
|
inline |
Resumes playback of the audio.
If the playback state is paused, this method resumes the audio playback using the waveOutRestart function from the WaveInterop class. If an error occurs during the resumption of playback, a MmException is thrown with the corresponding error message.
- Exceptions
-
MmException | Thrown when an error occurs during the resumption of audio playback. |
◆ Stop()
void NAudio.Wave.WaveOut.Stop |
( |
| ) |
|
|
inline |
Stops the audio playback.
- Exceptions
-
MmException | Thrown when an error occurs during the audio playback stop operation. |
If the current playback state is not already stopped, this method resets the audio output device and stops the playback. This method also raises the PlaybackStopped event if the audio playback was stopped successfully.
Implements NAudio.Wave.IWavePlayer.
◆ buffers
◆ callback
◆ callbackInfo
◆ hWaveOut
IntPtr NAudio.Wave.WaveOut.hWaveOut |
|
private |
◆ playbackState
◆ queuedBuffers
int NAudio.Wave.WaveOut.queuedBuffers |
|
private |
◆ syncContext
readonly SynchronizationContext NAudio.Wave.WaveOut.syncContext |
|
private |
◆ waveOutLock
readonly object NAudio.Wave.WaveOut.waveOutLock |
|
private |
◆ waveStream
◆ DesiredLatency
int NAudio.Wave.WaveOut.DesiredLatency |
|
getset |
Gets or sets the desired latency in milliseconds Should be set before a call to Init.
◆ DeviceCount
Int32 NAudio.Wave.WaveOut.DeviceCount |
|
staticget |
Returns the number of Wave Out devices available in the system.
◆ DeviceNumber
int NAudio.Wave.WaveOut.DeviceNumber = -1 |
|
getset |
Gets or sets the device number Should be set before a call to Init This must be between -1 and DeviceCount- 1. -1 means stick to default device even default device is changed.
◆ NumberOfBuffers
int NAudio.Wave.WaveOut.NumberOfBuffers |
|
getset |
Gets or sets the number of buffers used Should be set before a call to Init.
◆ OutputWaveFormat
◆ PlaybackState
◆ Volume
float NAudio.Wave.WaveOut.Volume |
|
getset |
◆ PlaybackStopped
Indicates playback has stopped automatically.
The documentation for this class was generated from the following file:
- /Users/sumansaurabh/Documents/my-startup/xeno-rat/Plugins/LiveMicrophone/lib/NAudio.WinForms/WaveOut.cs