Class AudioFifo
Represents a managed wrapper around FFmpeg's AVAudioFifo for audio buffering.
Implements
Inherited Members
Namespace: FFmpeg.Audio
Assembly: FFmpeg.dll
Syntax
public class AudioFifo : IDisposable
Remarks
This class provides safe, high-level methods to write and read audio data into and from an underlying AVAudioFifo buffer.
It supports multiple input formats and channel configurations, and can handle packed ↔ planar (interleaved/unpacked) data internally.
Important: AudioFifo does not convert between sample formats (for example, float ↔ int16). The data is always stored internally according to the Format specified when the FIFO was created.
To avoid unnecessary copying and conversion overhead, it is recommended to provide data in the same planar/packed layout as the FIFO’s Format. If the input layout differs, the FIFO will perform planar ↔ packed conversions internally, which may allocate temporary buffers.
The FIFO maintains an internal buffer for audio samples, allowing for flexible processing pipelines in multi-channel or multi-format audio applications.
Constructors
View SourceAudioFifo(SampleFormat, int)
Initializes a new instance of the AudioFifo class with the specified sample format and channel count.
Declaration
public AudioFifo(SampleFormat format, int channels)
Parameters
| Type | Name | Description |
|---|---|---|
| SampleFormat | format | The SampleFormat representing the audio sample type and layout. |
| int | channels | The number of channels in the audio stream. |
Remarks
Allocates a new AVAudioFifo with default initial capacity (0).
Use this constructor when you do not need to preallocate a specific buffer size.
AudioFifo(SampleFormat, int, int)
Initializes a new instance of the AudioFifo class with the specified sample format, channel count, and initial capacity.
Declaration
public AudioFifo(SampleFormat format, int channels, int capacity)
Parameters
| Type | Name | Description |
|---|---|---|
| SampleFormat | format | The SampleFormat representing the audio sample type and layout. |
| int | channels | The number of channels in the audio stream. |
| int | capacity | The initial capacity of the FIFO, in number of samples per channel. |
Remarks
Allocates a new AVAudioFifo with the specified initial capacity.
Use this constructor when you want to preallocate a buffer to reduce runtime allocations.
Properties
View SourceCapacity
Gets the total capacity of the audio FIFO in samples, including both used and available space.
Declaration
public int Capacity { get; }
Property Value
| Type | Description |
|---|---|
| int |
Remarks
Calculated as the sum of the currently available space (FFmpeg.AutoGen.ffmpeg.av_audio_fifo_space(FFmpeg.AutoGen._AVAudioFifo*)) and the number of samples currently in the FIFO (FFmpeg.AutoGen.ffmpeg.av_audio_fifo_size(FFmpeg.AutoGen._AVAudioFifo*)).
Channels
Gets the number of channels in the audio data handled by this FIFO.
Declaration
public int Channels { get; }
Property Value
| Type | Description |
|---|---|
| int |
Count
Gets the number of audio samples currently stored in the FIFO.
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| int |
Remarks
This corresponds to the value returned by FFmpeg.AutoGen.ffmpeg.av_audio_fifo_size(FFmpeg.AutoGen._AVAudioFifo*) and represents the number of samples available for reading.
Format
Gets the audio sample format used by this FIFO.
Declaration
public SampleFormat Format { get; }
Property Value
| Type | Description |
|---|---|
| SampleFormat |
Methods
View SourceClear()
Clears all samples from the FIFO buffer, resetting it to an empty state.
Declaration
public void Clear()
Remarks
After calling this method, the FIFO will contain zero samples.
This does not change the capacity of the FIFO, only the number of stored samples.
Dispose()
Releases all resources used by the AudioFifo.
Declaration
public void Dispose()
Remarks
This method frees the underlying FFmpeg.AutoGen.ffmpeg.av_audio_fifo_free(FFmpeg.AutoGen._AVAudioFifo*) and suppresses finalization.
Always call Dispose() when finishedReading using an AudioFifo instance to free unmanaged memory.
Dispose(bool)
Releases the resources used by the AudioFifo.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | disposing | true to release both managed and unmanaged resources; false to release only unmanaged resources. |
Drop(int)
Drops (removes) a specified number of samples from the start of the FIFO buffer.
Declaration
public AVResult32 Drop(int samples)
Parameters
| Type | Name | Description |
|---|---|---|
| int | samples | The number of samples to drop from the FIFO. |
Returns
| Type | Description |
|---|---|
| AVResult32 | Returns 0 on success, or a negative error code if the operation fails. |
Remarks
This method reduces the number of available samples in the FIFO by samples.
Dropping more samples than are currently available in the FIFO will result in an error.
Drop(TimeSpan, int)
Drops (removes) audio samples corresponding to the specified duration from the beginning of the FIFO buffer.
Declaration
public AVResult32 Drop(TimeSpan duration, int sampleRate)
Parameters
| Type | Name | Description |
|---|---|---|
| TimeSpan | duration | The duration of audio to remove from the FIFO. |
| int | sampleRate | The sample rate, in samples per second, used to convert the duration into a sample count. |
Returns
| Type | Description |
|---|---|
| AVResult32 |
|
Remarks
The specified duration is converted to a sample count
using sampleRate. Attempting to remove more samples than
are currently stored in the FIFO results in an error.
~AudioFifo()
Finalizer to ensure unmanaged resources are freed if Dispose() was not called.
Declaration
protected ~AudioFifo()
Peek(AVFrame)
Declaration
public AVResult32 Peek(AVFrame frame)
Parameters
| Type | Name | Description |
|---|---|---|
| AVFrame | frame | The AVFrame to receive audio samples.
If the frame alpeeky has a buffer and any of these properties are unset, an exception is thrown. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Remarks
The AudioFifo stores all audio data according to the Format specified when the FIFO was created. This method does not convert between sample types (e.g., float ↔ int16); doing so must be handled by the caller.
Planar ↔ packed conversions are handled automatically:
- If the frame's format exactly matches the FIFO format, the data is peek directly using
ffmpeg.av_audio_fifo_peek. - If the FIFO stores planar but the frame is packed, the data is converted from planar to packed.
- If the FIFO stores packed but the frame is planar, the data is converted from packed to planar.
To avoid unnecessary copying, it is recommended to provide frames in the same planar/packed layout as the FIFO’s Format.
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown if the frame alpeeky has a buffer allocated and some properties would need to be set, |
Peek(AVFrame, int)
Peeks audio data from the AudioFifo buffer into an AVFrame,
starting at the specified sample offset within the FIFO.
Declaration
public AVResult32 Peek(AVFrame frame, int offset)
Parameters
| Type | Name | Description |
|---|---|---|
| AVFrame | frame | The AVFrame to receive audio samples.
If the frame already has a buffer and any of these properties are unset, an exception is thrown. |
| int | offset | The sample index within the FIFO at which to begin peeking. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Remarks
The AudioFifo stores all audio data according to the Format specified when the FIFO was created. This method does not convert between sample types (e.g., float ↔ int16); doing so must be handled by the caller.
Planar ↔ packed conversions are handled automatically:
- If the frame's format exactly matches the FIFO format, the data is peeked directly using
ffmpeg.av_audio_fifo_peek. - If the FIFO stores planar but the frame is packed, the data is converted from planar to packed.
- If the FIFO stores packed but the frame is planar, the data is converted from packed to planar.
To avoid unnecessary copying, it is recommended to provide frames in the same planar/packed layout as the FIFO’s Format.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if |
| ArgumentException | Thrown if the frame already has a buffer allocated and some properties would need to be set, |
| ArgumentOutOfRangeException | Thrown if |
Peek(byte[,])
Peeks multi-channel audio data into a two-dimensional byte array.
Declaration
public AVResult32 Peek(byte[,] data)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[,] | data | A two-dimensional byte array where the first dimension is the channel index and the second is the byte index. |
Returns
| Type | Description |
|---|---|
| AVResult32 | The number of samples peek. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
| NotSupportedException | Thrown when the number of channels does not match Channels. |
Peek(byte[,], int)
Peeks multi-channel audio data into a two-dimensional byte array.
Declaration
public AVResult32 Peek(byte[,] data, int offset)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[,] | data | A two-dimensional byte array where the first dimension is the channel index and the second is the byte index. |
| int | offset | The sample offset from which to start peeking. Each unit corresponds to one multi-channel sample. |
Returns
| Type | Description |
|---|---|
| AVResult32 | The number of samples successfully peeked. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
| NotSupportedException | Thrown when the number of channels does not match Channels. |
Peek(byte[])
Peeks audio data into a single byte array without advancing the read position.
Declaration
public AVResult32 Peek(byte[] data)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | data | A byte array to receive interleaved audio samples. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Remarks
This method allows inspecting audio data without consuming it.
It simply wraps Peek(Span<byte>) for convenience and reads interleaved (packed) samples directly into data.
Peek(byte[], int)
Peeks audio data into a single byte array starting at a specific sample offset,
without advancing the current read position.
Declaration
public AVResult32 Peek(byte[] data, int offset)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | data | A writable byte array to receive interleaved audio samples. |
| int | offset | The sample offset (in frames) from which to start peeking. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Remarks
This method allows inspecting buffered audio starting at a specific position without consuming it.
It simply wraps Peek(Span<byte>, int) for convenience and reads interleaved (packed) samples directly into data.
Peek(params byte[][])
Peeks multi-channel audio data into an array of channel buffers.
Declaration
public AVResult32 Peek(params byte[][] data)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[][] | data | An array of byte arrays, where each element represents one channel’s audio samples. |
Returns
| Type | Description |
|---|---|
| AVResult32 | The number of samples peek. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
| ArgumentException | Thrown when any element of |
| NotSupportedException | Thrown when |
Peek(byte[][], int)
Peeks multi-channel audio data into an array of channel buffers.
Declaration
public AVResult32 Peek(byte[][] data, int offset)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[][] | data | An array of byte arrays, where each element represents one channel’s audio samples. The number of elements must match Channels. |
| int | offset | The sample offset from which to start peeking. Each unit corresponds to one multi-channel sample. |
Returns
| Type | Description |
|---|---|
| AVResult32 | The number of samples successfully peeked. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
| ArgumentException | Thrown when any element of |
| NotSupportedException | Thrown when |
Peek(Span<byte>)
Peeks packed multi-channel audio data from the AudioFifo into a single contiguous buffer.
Declaration
public AVResult32 Peek(Span<byte> buffer)
Parameters
| Type | Name | Description |
|---|---|---|
| Span<byte> | buffer | A writable span to receive interleaved audio samples for all channels. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Remarks
The number of channels is determined from the current audio stream's Channels property.
The total number of samples is calculated as buffer.Length / Format.GetBytesPerSample().
Planar ↔ packed conversions are handled automatically:
- If the FIFO stores packed data, samples are peek directly using FFmpeg.Audio.AudioFifo.PeekPackedToPacked(System.Byte*,System.Int32).
- If the FIFO stores planar data, samples are deinterleaved from planar into the packed buffer using FFmpeg.Audio.AudioFifo.PeekPlanarToPacked(System.Byte*,System.Int32).
Peek(Span<byte>, int)
Peeks packed multi-channel audio data from the AudioFifo into a single contiguous buffer.
Declaration
public AVResult32 Peek(Span<byte> buffer, int offset = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| Span<byte> | buffer | A writable span to receive interleaved audio samples for all channels. |
| int | offset | The sample offset from which to start peeking. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Remarks
The number of channels is determined from the current audio stream's Channels property.
The total number of samples is calculated as buffer.Length / Format.GetBytesPerSample().
Planar ↔ packed conversions are handled automatically:
- If the FIFO stores packed data, samples are peeked directly using FFmpeg.Audio.AudioFifo.PeekPackedToPacked(System.Byte*,System.Int32,System.Int32).
- If the FIFO stores planar data, samples are deinterleaved from planar into the packed buffer using FFmpeg.Audio.AudioFifo.PeekPlanarToPacked(System.Byte*,System.Int32,System.Int32).
Peek(Span<byte>, Span<byte>)
Peeks stereo (two-channel) audio data into separate left and right channel buffers.
Declaration
public AVResult32 Peek(Span<byte> left, Span<byte> right)
Parameters
| Type | Name | Description |
|---|---|---|
| Span<byte> | left | A writable span to receive audio samples for the left channel. |
| Span<byte> | right | A writable span to receive audio samples for the right channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the current audio stream does not have exactly two channels. |
Peek(Span<byte>, Span<byte>, int)
Peeks stereo (two-channel) audio data into separate left and right channel buffers.
Declaration
public AVResult32 Peek(Span<byte> left, Span<byte> right, int offset = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| Span<byte> | left | A writable span to receive audio samples for the left channel. |
| Span<byte> | right | A writable span to receive audio samples for the right channel. |
| int | offset | The sample offset from which to start peeking. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Remarks
Planar ↔ packed conversions are handled automatically.
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the current audio stream does not have exactly two channels. |
Peek(Span<byte>, Span<byte>, Span<byte>)
Peeks 3-channel audio data into separate channel buffers.
Declaration
public AVResult32 Peek(Span<byte> ch1, Span<byte> ch2, Span<byte> ch3)
Parameters
| Type | Name | Description |
|---|---|---|
| Span<byte> | ch1 | |
| Span<byte> | ch2 | |
| Span<byte> | ch3 |
Returns
| Type | Description |
|---|---|
| AVResult32 |
Peek(Span<byte>, Span<byte>, Span<byte>, int)
Peeks 3-channel audio data into separate channel buffers.
Declaration
public AVResult32 Peek(Span<byte> ch1, Span<byte> ch2, Span<byte> ch3, int offset = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| Span<byte> | ch1 | A writable span for channel 1 samples. |
| Span<byte> | ch2 | A writable span for channel 2 samples. |
| Span<byte> | ch3 | A writable span for channel 3 samples. |
| int | offset | The sample offset from which to start peeking. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Remarks
Planar ↔ packed conversions are handled automatically.
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the current audio stream does not have exactly three channels. |
Peek(Span<byte>, Span<byte>, Span<byte>, Span<byte>)
Peeks 4-channel audio data into separate channel buffers.
Declaration
public AVResult32 Peek(Span<byte> ch1, Span<byte> ch2, Span<byte> ch3, Span<byte> ch4)
Parameters
| Type | Name | Description |
|---|---|---|
| Span<byte> | ch1 | |
| Span<byte> | ch2 | |
| Span<byte> | ch3 | |
| Span<byte> | ch4 |
Returns
| Type | Description |
|---|---|
| AVResult32 |
Peek(Span<byte>, Span<byte>, Span<byte>, Span<byte>, int)
Peeks 4-channel audio data into separate channel buffers.
Declaration
public AVResult32 Peek(Span<byte> ch1, Span<byte> ch2, Span<byte> ch3, Span<byte> ch4, int offset = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| Span<byte> | ch1 | A writable span to receive audio samples for the first channel. |
| Span<byte> | ch2 | A writable span to receive audio samples for the second channel. |
| Span<byte> | ch3 | A writable span to receive audio samples for the third channel. |
| Span<byte> | ch4 | A writable span to receive audio samples for the fourth channel. |
| int | offset | The sample offset from which to start peeking. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Remarks
Planar ↔ packed conversions are handled automatically.
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the audio stream does not have exactly four channels. |
Peek(Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>)
Peeks 5-channel audio data into separate channel buffers.
Declaration
public AVResult32 Peek(Span<byte> ch1, Span<byte> ch2, Span<byte> ch3, Span<byte> ch4, Span<byte> ch5)
Parameters
| Type | Name | Description |
|---|---|---|
| Span<byte> | ch1 | A span to receive samples for the first channel. |
| Span<byte> | ch2 | A span to receive samples for the second channel. |
| Span<byte> | ch3 | A span to receive samples for the third channel. |
| Span<byte> | ch4 | A span to receive samples for the fourth channel. |
| Span<byte> | ch5 | A span to receive samples for the fifth channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown if the audio stream does not have exactly five channels. |
Peek(Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, int)
Peeks 5-channel audio data into separate channel buffers.
Declaration
public AVResult32 Peek(Span<byte> ch1, Span<byte> ch2, Span<byte> ch3, Span<byte> ch4, Span<byte> ch5, int offset = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| Span<byte> | ch1 | A writable span to receive audio samples for the first channel. |
| Span<byte> | ch2 | A writable span to receive audio samples for the second channel. |
| Span<byte> | ch3 | A writable span to receive audio samples for the third channel. |
| Span<byte> | ch4 | A writable span to receive audio samples for the fourth channel. |
| Span<byte> | ch5 | A writable span to receive audio samples for the fifth channel. |
| int | offset | The sample offset from which to start peeking. Each unit corresponds to one 5-channel sample. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Remarks
Planar ↔ packed conversions are handled automatically.
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the audio stream does not have exactly five channels. |
Peek(Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>)
Peeks 6-channel audio data into separate channel buffers.
Declaration
public AVResult32 Peek(Span<byte> ch1, Span<byte> ch2, Span<byte> ch3, Span<byte> ch4, Span<byte> ch5, Span<byte> ch6)
Parameters
| Type | Name | Description |
|---|---|---|
| Span<byte> | ch1 | A span to receive samples for the first channel. |
| Span<byte> | ch2 | A span to receive samples for the second channel. |
| Span<byte> | ch3 | A span to receive samples for the third channel. |
| Span<byte> | ch4 | A span to receive samples for the fourth channel. |
| Span<byte> | ch5 | A span to receive samples for the fifth channel. |
| Span<byte> | ch6 | A span to receive samples for the sixth channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown if the audio stream does not have exactly six channels. |
Peek(Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, int)
Peeks 6-channel audio data into separate channel buffers.
Declaration
public AVResult32 Peek(Span<byte> ch1, Span<byte> ch2, Span<byte> ch3, Span<byte> ch4, Span<byte> ch5, Span<byte> ch6, int offset = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| Span<byte> | ch1 | A writable span to receive audio samples for the first channel. |
| Span<byte> | ch2 | A writable span to receive audio samples for the second channel. |
| Span<byte> | ch3 | A writable span to receive audio samples for the third channel. |
| Span<byte> | ch4 | A writable span to receive audio samples for the fourth channel. |
| Span<byte> | ch5 | A writable span to receive audio samples for the fifth channel. |
| Span<byte> | ch6 | A writable span to receive audio samples for the sixth channel. |
| int | offset | The sample offset from which to start peeking. Each unit corresponds to one 6-channel sample. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Remarks
Planar ↔ packed conversions are handled automatically.
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the audio stream does not have exactly six channels. |
Peek(Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>)
Peeks 7-channel audio data into separate channel buffers.
Declaration
public AVResult32 Peek(Span<byte> ch1, Span<byte> ch2, Span<byte> ch3, Span<byte> ch4, Span<byte> ch5, Span<byte> ch6, Span<byte> ch7)
Parameters
| Type | Name | Description |
|---|---|---|
| Span<byte> | ch1 | A span to receive samples for the first channel. |
| Span<byte> | ch2 | A span to receive samples for the second channel. |
| Span<byte> | ch3 | A span to receive samples for the third channel. |
| Span<byte> | ch4 | A span to receive samples for the fourth channel. |
| Span<byte> | ch5 | A span to receive samples for the fifth channel. |
| Span<byte> | ch6 | A span to receive samples for the sixth channel. |
| Span<byte> | ch7 | A span to receive samples for the seventh channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown if the audio stream does not have exactly seven channels. |
Peek(Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, int)
Peeks 7-channel audio data into separate channel buffers.
Declaration
public AVResult32 Peek(Span<byte> ch1, Span<byte> ch2, Span<byte> ch3, Span<byte> ch4, Span<byte> ch5, Span<byte> ch6, Span<byte> ch7, int offset = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| Span<byte> | ch1 | A writable span to receive audio samples for the first channel. |
| Span<byte> | ch2 | A writable span to receive audio samples for the second channel. |
| Span<byte> | ch3 | A writable span to receive audio samples for the third channel. |
| Span<byte> | ch4 | A writable span to receive audio samples for the fourth channel. |
| Span<byte> | ch5 | A writable span to receive audio samples for the fifth channel. |
| Span<byte> | ch6 | A writable span to receive audio samples for the sixth channel. |
| Span<byte> | ch7 | A writable span to receive audio samples for the seventh channel. |
| int | offset | The sample offset from which to start peeking. Each unit corresponds to one 7-channel sample. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Remarks
Planar ↔ packed conversions are handled automatically.
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the audio stream does not have exactly seven channels. |
Peek(Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>)
Peeks 8-channel audio data into separate channel buffers.
Declaration
public AVResult32 Peek(Span<byte> ch1, Span<byte> ch2, Span<byte> ch3, Span<byte> ch4, Span<byte> ch5, Span<byte> ch6, Span<byte> ch7, Span<byte> ch8)
Parameters
| Type | Name | Description |
|---|---|---|
| Span<byte> | ch1 | A span to receive samples for the first channel. |
| Span<byte> | ch2 | A span to receive samples for the second channel. |
| Span<byte> | ch3 | A span to receive samples for the third channel. |
| Span<byte> | ch4 | A span to receive samples for the fourth channel. |
| Span<byte> | ch5 | A span to receive samples for the fifth channel. |
| Span<byte> | ch6 | A span to receive samples for the sixth channel. |
| Span<byte> | ch7 | A span to receive samples for the seventh channel. |
| Span<byte> | ch8 | A span to receive samples for the eighth channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown if the audio stream does not have exactly eight channels. |
Peek(Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, int)
Peeks 8-channel audio data into separate channel buffers.
Declaration
public AVResult32 Peek(Span<byte> ch1, Span<byte> ch2, Span<byte> ch3, Span<byte> ch4, Span<byte> ch5, Span<byte> ch6, Span<byte> ch7, Span<byte> ch8, int offset = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| Span<byte> | ch1 | A writable span to receive audio samples for the first channel. |
| Span<byte> | ch2 | A writable span to receive audio samples for the second channel. |
| Span<byte> | ch3 | A writable span to receive audio samples for the third channel. |
| Span<byte> | ch4 | A writable span to receive audio samples for the fourth channel. |
| Span<byte> | ch5 | A writable span to receive audio samples for the fifth channel. |
| Span<byte> | ch6 | A writable span to receive audio samples for the sixth channel. |
| Span<byte> | ch7 | A writable span to receive audio samples for the seventh channel. |
| Span<byte> | ch8 | A writable span to receive audio samples for the eighth channel. |
| int | offset | The sample offset from which to start peeking. Each unit corresponds to one 8-channel sample. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Remarks
Planar ↔ packed conversions are handled automatically.
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the audio stream does not have exactly eight channels. |
Peek(Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>)
Peeks 9-channel audio data into separate channel buffers.
Declaration
public AVResult32 Peek(Span<byte> ch1, Span<byte> ch2, Span<byte> ch3, Span<byte> ch4, Span<byte> ch5, Span<byte> ch6, Span<byte> ch7, Span<byte> ch8, Span<byte> ch9)
Parameters
| Type | Name | Description |
|---|---|---|
| Span<byte> | ch1 | A span to receive samples for the first channel. |
| Span<byte> | ch2 | A span to receive samples for the second channel. |
| Span<byte> | ch3 | A span to receive samples for the third channel. |
| Span<byte> | ch4 | A span to receive samples for the fourth channel. |
| Span<byte> | ch5 | A span to receive samples for the fifth channel. |
| Span<byte> | ch6 | A span to receive samples for the sixth channel. |
| Span<byte> | ch7 | A span to receive samples for the seventh channel. |
| Span<byte> | ch8 | A span to receive samples for the eighth channel. |
| Span<byte> | ch9 | A span to receive samples for the ninth channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown if the audio stream does not have exactly nine channels. |
Peek(Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, int)
Peeks 9-channel audio data into separate channel buffers.
Declaration
public AVResult32 Peek(Span<byte> ch1, Span<byte> ch2, Span<byte> ch3, Span<byte> ch4, Span<byte> ch5, Span<byte> ch6, Span<byte> ch7, Span<byte> ch8, Span<byte> ch9, int offset = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| Span<byte> | ch1 | A writable span to receive audio samples for the first channel. |
| Span<byte> | ch2 | A writable span to receive audio samples for the second channel. |
| Span<byte> | ch3 | A writable span to receive audio samples for the third channel. |
| Span<byte> | ch4 | A writable span to receive audio samples for the fourth channel. |
| Span<byte> | ch5 | A writable span to receive audio samples for the fifth channel. |
| Span<byte> | ch6 | A writable span to receive audio samples for the sixth channel. |
| Span<byte> | ch7 | A writable span to receive audio samples for the seventh channel. |
| Span<byte> | ch8 | A writable span to receive audio samples for the eighth channel. |
| Span<byte> | ch9 | A writable span to receive audio samples for the ninth channel. |
| int | offset | The sample offset from which to start peeking. Each unit corresponds to one 9-channel sample. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Remarks
Planar ↔ packed conversions are handled automatically.
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the audio stream does not have exactly nine channels. |
Peek<T>(Span<T>)
Peeks packed multi-channel audio data from the AudioFifo into a span of typed samples.
Declaration
public AVResult32 Peek<T>(Span<T> buffer) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| Span<T> | buffer | A writable span to receive interleaved audio samples for all channels. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T | The unmanaged sample type (for example, float or short). |
Remarks
The number of channels is determined from the current audio stream's Channels property.
This method simply reinterprets the T span as bytes and calls Peek(Span<byte>).
Peek<T>(Span<T>, int)
Peeks packed multi-channel audio data from the AudioFifo into a span of typed samples.
Declaration
public AVResult32 Peek<T>(Span<T> buffer, int offset = 0) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| Span<T> | buffer | A writable span to receive interleaved audio samples for all channels. |
| int | offset | The sample offset from which to start peeking. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T | The unmanaged sample type (for example, float or short). |
Remarks
This method simply reinterprets the T span as bytes and calls Peek(Span<byte>, int).
Peek<T>(Span<T>, Span<T>)
Peeks stereo (two-channel) audio data into typed sample buffers.
Declaration
public AVResult32 Peek<T>(Span<T> left, Span<T> right) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| Span<T> | left | A writable span for left-channel samples. |
| Span<T> | right | A writable span for right-channel samples. |
Returns
| Type | Description |
|---|---|
| AVResult32 | The number of samples peek or an error code. |
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the current audio stream does not have exactly two channels. |
Peek<T>(Span<T>, Span<T>, int)
Peeks stereo (two-channel) audio data into typed sample buffers.
Declaration
public AVResult32 Peek<T>(Span<T> left, Span<T> right, int offset = 0) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| Span<T> | left | A writable span to receive left-channel samples. |
| Span<T> | right | A writable span to receive right-channel samples. |
| int | offset | The sample offset from which to start peeking. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either the number of samples peeked or an error code. |
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the current audio stream does not have exactly two channels. |
Peek<T>(Span<T>, Span<T>, Span<T>)
Peeks 3-channel audio data into typed sample buffers.
Declaration
public AVResult32 Peek<T>(Span<T> ch1, Span<T> ch2, Span<T> ch3) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| Span<T> | ch1 | |
| Span<T> | ch2 | |
| Span<T> | ch3 |
Returns
| Type | Description |
|---|---|
| AVResult32 |
Type Parameters
| Name | Description |
|---|---|
| T |
Peek<T>(Span<T>, Span<T>, Span<T>, int)
Peeks 3-channel audio data into typed sample buffers.
Declaration
public AVResult32 Peek<T>(Span<T> ch1, Span<T> ch2, Span<T> ch3, int offset = 0) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| Span<T> | ch1 | A writable span for channel 1 samples. |
| Span<T> | ch2 | A writable span for channel 2 samples. |
| Span<T> | ch3 | A writable span for channel 3 samples. |
| int | offset | The sample offset from which to start peeking. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either the number of samples peeked or an error code. |
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the current audio stream does not have exactly three channels. |
Peek<T>(Span<T>, Span<T>, Span<T>, Span<T>)
Peeks 4-channel audio data into typed sample buffers.
Declaration
public AVResult32 Peek<T>(Span<T> ch1, Span<T> ch2, Span<T> ch3, Span<T> ch4) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| Span<T> | ch1 | A span to receive samples for the first channel. |
| Span<T> | ch2 | A span to receive samples for the second channel. |
| Span<T> | ch3 | A span to receive samples for the third channel. |
| Span<T> | ch4 | A span to receive samples for the fourth channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown if the audio stream does not have exactly four channels. |
Peek<T>(Span<T>, Span<T>, Span<T>, Span<T>, int)
Peeks 4-channel audio data into typed sample buffers.
Declaration
public AVResult32 Peek<T>(Span<T> ch1, Span<T> ch2, Span<T> ch3, Span<T> ch4, int offset = 0) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| Span<T> | ch1 | A writable span to receive samples for the first channel. |
| Span<T> | ch2 | A writable span to receive samples for the second channel. |
| Span<T> | ch3 | A writable span to receive samples for the third channel. |
| Span<T> | ch4 | A writable span to receive samples for the fourth channel. |
| int | offset | The sample offset from which to start peeking. Each unit corresponds to one 4-channel sample. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T |
Remarks
This method simply reinterprets the T spans as bytes and calls Peek(Span<byte>, Span<byte>, Span<byte>, Span<byte>, int).
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the audio stream does not have exactly four channels. |
Peek<T>(Span<T>, Span<T>, Span<T>, Span<T>, Span<T>)
Peeks 5-channel audio data into typed sample buffers.
Declaration
public AVResult32 Peek<T>(Span<T> ch1, Span<T> ch2, Span<T> ch3, Span<T> ch4, Span<T> ch5) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| Span<T> | ch1 | A span to receive samples for the first channel. |
| Span<T> | ch2 | A span to receive samples for the second channel. |
| Span<T> | ch3 | A span to receive samples for the third channel. |
| Span<T> | ch4 | A span to receive samples for the fourth channel. |
| Span<T> | ch5 | A span to receive samples for the fifth channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown if the audio stream does not have exactly five channels. |
Peek<T>(Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, int)
Peeks 5-channel audio data into typed sample buffers.
Declaration
public AVResult32 Peek<T>(Span<T> ch1, Span<T> ch2, Span<T> ch3, Span<T> ch4, Span<T> ch5, int offset = 0) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| Span<T> | ch1 | |
| Span<T> | ch2 | |
| Span<T> | ch3 | |
| Span<T> | ch4 | |
| Span<T> | ch5 | |
| int | offset |
Returns
| Type | Description |
|---|---|
| AVResult32 |
Type Parameters
| Name | Description |
|---|---|
| T |
Peek<T>(Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, Span<T>)
Peeks 6-channel audio data into typed sample buffers.
Declaration
public AVResult32 Peek<T>(Span<T> ch1, Span<T> ch2, Span<T> ch3, Span<T> ch4, Span<T> ch5, Span<T> ch6) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| Span<T> | ch1 | A span to receive samples for the first channel. |
| Span<T> | ch2 | A span to receive samples for the second channel. |
| Span<T> | ch3 | A span to receive samples for the third channel. |
| Span<T> | ch4 | A span to receive samples for the fourth channel. |
| Span<T> | ch5 | A span to receive samples for the fifth channel. |
| Span<T> | ch6 | A span to receive samples for the sixth channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown if the audio stream does not have exactly six channels. |
Peek<T>(Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, int)
Peeks 6-channel audio data into typed sample buffers.
Declaration
public AVResult32 Peek<T>(Span<T> ch1, Span<T> ch2, Span<T> ch3, Span<T> ch4, Span<T> ch5, Span<T> ch6, int offset = 0) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| Span<T> | ch1 | A writable span to receive samples for the first channel. |
| Span<T> | ch2 | A writable span to receive samples for the second channel. |
| Span<T> | ch3 | A writable span to receive samples for the third channel. |
| Span<T> | ch4 | A writable span to receive samples for the fourth channel. |
| Span<T> | ch5 | A writable span to receive samples for the fifth channel. |
| Span<T> | ch6 | A writable span to receive samples for the sixth channel. |
| int | offset | The sample offset from which to start peeking. Each unit corresponds to one 6-channel sample. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T |
Remarks
This method simply reinterprets the T spans as bytes and calls
Peek(Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, int).
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the audio stream does not have exactly six channels. |
Peek<T>(Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, Span<T>)
Peeks 7-channel audio data into typed sample buffers.
Declaration
public AVResult32 Peek<T>(Span<T> ch1, Span<T> ch2, Span<T> ch3, Span<T> ch4, Span<T> ch5, Span<T> ch6, Span<T> ch7) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| Span<T> | ch1 | A span to receive samples for the first channel. |
| Span<T> | ch2 | A span to receive samples for the second channel. |
| Span<T> | ch3 | A span to receive samples for the third channel. |
| Span<T> | ch4 | A span to receive samples for the fourth channel. |
| Span<T> | ch5 | A span to receive samples for the fifth channel. |
| Span<T> | ch6 | A span to receive samples for the sixth channel. |
| Span<T> | ch7 | A span to receive samples for the seventh channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown if the audio stream does not have exactly seven channels. |
Peek<T>(Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, int)
Peeks 7-channel audio data into typed sample buffers.
Declaration
public AVResult32 Peek<T>(Span<T> ch1, Span<T> ch2, Span<T> ch3, Span<T> ch4, Span<T> ch5, Span<T> ch6, Span<T> ch7, int offset = 0) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| Span<T> | ch1 | A writable span to receive samples for the first channel. |
| Span<T> | ch2 | A writable span to receive samples for the second channel. |
| Span<T> | ch3 | A writable span to receive samples for the third channel. |
| Span<T> | ch4 | A writable span to receive samples for the fourth channel. |
| Span<T> | ch5 | A writable span to receive samples for the fifth channel. |
| Span<T> | ch6 | A writable span to receive samples for the sixth channel. |
| Span<T> | ch7 | A writable span to receive samples for the seventh channel. |
| int | offset | The sample offset from which to start peeking. Each unit corresponds to one 7-channel sample. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T |
Remarks
This method simply reinterprets the T spans as bytes and calls
Peek(Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, int).
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the audio stream does not have exactly seven channels. |
Peek<T>(Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, Span<T>)
Peeks 8-channel audio data into typed sample buffers.
Declaration
public AVResult32 Peek<T>(Span<T> ch1, Span<T> ch2, Span<T> ch3, Span<T> ch4, Span<T> ch5, Span<T> ch6, Span<T> ch7, Span<T> ch8) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| Span<T> | ch1 | A span to receive samples for the first channel. |
| Span<T> | ch2 | A span to receive samples for the second channel. |
| Span<T> | ch3 | A span to receive samples for the third channel. |
| Span<T> | ch4 | A span to receive samples for the fourth channel. |
| Span<T> | ch5 | A span to receive samples for the fifth channel. |
| Span<T> | ch6 | A span to receive samples for the sixth channel. |
| Span<T> | ch7 | A span to receive samples for the seventh channel. |
| Span<T> | ch8 | A span to receive samples for the eighth channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown if the audio stream does not have exactly eight channels. |
Peek<T>(Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, int)
Peeks 8-channel audio data into typed sample buffers.
Declaration
public AVResult32 Peek<T>(Span<T> ch1, Span<T> ch2, Span<T> ch3, Span<T> ch4, Span<T> ch5, Span<T> ch6, Span<T> ch7, Span<T> ch8, int offset = 0) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| Span<T> | ch1 | A writable span to receive samples for the first channel. |
| Span<T> | ch2 | A writable span to receive samples for the second channel. |
| Span<T> | ch3 | A writable span to receive samples for the third channel. |
| Span<T> | ch4 | A writable span to receive samples for the fourth channel. |
| Span<T> | ch5 | A writable span to receive samples for the fifth channel. |
| Span<T> | ch6 | A writable span to receive samples for the sixth channel. |
| Span<T> | ch7 | A writable span to receive samples for the seventh channel. |
| Span<T> | ch8 | A writable span to receive samples for the eighth channel. |
| int | offset | The sample offset from which to start peeking. Each unit corresponds to one 8-channel sample. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T |
Remarks
This method simply reinterprets the T spans as bytes and calls
Peek(Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, int).
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the audio stream does not have exactly eight channels. |
Peek<T>(Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, Span<T>)
Peeks 9-channel audio data into typed sample buffers.
Declaration
public AVResult32 Peek<T>(Span<T> ch1, Span<T> ch2, Span<T> ch3, Span<T> ch4, Span<T> ch5, Span<T> ch6, Span<T> ch7, Span<T> ch8, Span<T> ch9) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| Span<T> | ch1 | A span to receive samples for the first channel. |
| Span<T> | ch2 | A span to receive samples for the second channel. |
| Span<T> | ch3 | A span to receive samples for the third channel. |
| Span<T> | ch4 | A span to receive samples for the fourth channel. |
| Span<T> | ch5 | A span to receive samples for the fifth channel. |
| Span<T> | ch6 | A span to receive samples for the sixth channel. |
| Span<T> | ch7 | A span to receive samples for the seventh channel. |
| Span<T> | ch8 | A span to receive samples for the eighth channel. |
| Span<T> | ch9 | A span to receive samples for the ninth channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown if the audio stream does not have exactly nine channels. |
Peek<T>(Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, int)
Peeks 9-channel audio data into typed sample buffers.
Declaration
public AVResult32 Peek<T>(Span<T> ch1, Span<T> ch2, Span<T> ch3, Span<T> ch4, Span<T> ch5, Span<T> ch6, Span<T> ch7, Span<T> ch8, Span<T> ch9, int offset = 0) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| Span<T> | ch1 | A writable span to receive samples for the first channel. |
| Span<T> | ch2 | A writable span to receive samples for the second channel. |
| Span<T> | ch3 | A writable span to receive samples for the third channel. |
| Span<T> | ch4 | A writable span to receive samples for the fourth channel. |
| Span<T> | ch5 | A writable span to receive samples for the fifth channel. |
| Span<T> | ch6 | A writable span to receive samples for the sixth channel. |
| Span<T> | ch7 | A writable span to receive samples for the seventh channel. |
| Span<T> | ch8 | A writable span to receive samples for the eighth channel. |
| Span<T> | ch9 | A writable span to receive samples for the ninth channel. |
| int | offset | The sample offset from which to start peeking. Each unit corresponds to one 9-channel sample. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T |
Remarks
This method simply reinterprets the T spans as bytes and calls
Peek(Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, int).
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the audio stream does not have exactly nine channels. |
Peek<T>(T[,])
Peeks multi-channel audio data into a two-dimensional typed array.
Declaration
public AVResult32 Peek<T>(T[,] data) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| T[,] | data | A two-dimensional |
Returns
| Type | Description |
|---|---|
| AVResult32 | The number of samples peek. |
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
| NotSupportedException | Thrown when the number of channels does not match Channels or
when |
Peek<T>(T[,], int)
Peeks multi-channel audio data into a two-dimensional typed array.
Declaration
public AVResult32 Peek<T>(T[,] data, int offset) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| T[,] | data | A two-dimensional |
| int | offset | The sample offset from which to start peeking. Each unit corresponds to one multi-channel sample. |
Returns
| Type | Description |
|---|---|
| AVResult32 | The number of samples successfully peeked. |
Type Parameters
| Name | Description |
|---|---|
| T |
Remarks
This method simply reinterprets the T array as bytes and calls
Peek(byte[,], int).
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
| NotSupportedException | Thrown when the number of channels does not match Channels or
when |
Peek<T>(T[])
Peeks typed audio samples into a single buffer without advancing the read position.
Declaration
public AVResult32 Peek<T>(T[] data) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| T[] | data | A buffer to receive interleaved audio samples for all channels. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T | The unmanaged sample type (for example, float or short). |
Remarks
This method reinterprets data as a Span<T> and calls
Peek(Span<byte>) internally.
Like all Peek methods, it does not advance the internal read position.
Peek<T>(T[], int)
Peeks typed audio samples into a single buffer starting at a specific sample offset,
without advancing the current read position.
Declaration
public AVResult32 Peek<T>(T[] data, int offset) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| T[] | data | A writable buffer to receive interleaved audio samples for all channels. |
| int | offset | The sample offset (in frames) from which to start peeking. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T | The unmanaged sample type (for example, float or short). |
Remarks
This method reinterprets data as a Span<T> and calls
Peek(Span<byte>, int) internally.
Like all Peek methods, it does not advance the internal read position.
Peek<T>(params T[][])
Peeks multi-channel audio data into an array of typed sample buffers.
Declaration
public AVResult32 Peek<T>(params T[][] data) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| T[][] | data | An array of |
Returns
| Type | Description |
|---|---|
| AVResult32 | The number of samples peek. |
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
| ArgumentException | Thrown when any element of |
| NotSupportedException | Thrown when |
Peek<T>(T[][], int)
Peeks multi-channel audio data into an array of typed sample buffers.
Declaration
public AVResult32 Peek<T>(T[][] data, int offset) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| T[][] | data | An array of |
| int | offset | The sample offset from which to start peeking. Each unit corresponds to one multi-channel sample. |
Returns
| Type | Description |
|---|---|
| AVResult32 | The number of samples successfully peeked. |
Type Parameters
| Name | Description |
|---|---|
| T |
Remarks
This method simply reinterprets the T arrays as bytes and calls
Peek(byte[][], int).
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
| ArgumentException | Thrown when any element of |
| NotSupportedException | Thrown when |
Read(AVFrame)
Declaration
public AVResult32 Read(AVFrame frame)
Parameters
| Type | Name | Description |
|---|---|---|
| AVFrame | frame | The AVFrame to receive audio samples.
If the frame already has a buffer and any of these properties are unset, an exception is thrown. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Remarks
The AudioFifo stores all audio data according to the Format specified when the FIFO was created. This method does not convert between sample types (e.g., float ↔ int16); doing so must be handled by the caller.
Planar ↔ packed conversions are handled automatically:
- If the frame's format exactly matches the FIFO format, the data is read directly using
ffmpeg.av_audio_fifo_read. - If the FIFO stores planar but the frame is packed, the data is converted from planar to packed using FFmpeg.Audio.AudioFifo.ReadPlanarToPacked(System.Byte*,System.Int32).
- If the FIFO stores packed but the frame is planar, the data is converted from packed to planar using FFmpeg.Audio.AudioFifo.ReadPackedToPlanar(System.Byte**,System.Int32).
To avoid unnecessary copying, it is recommended to provide frames in the same planar/packed layout as the FIFO’s Format.
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown if the frame already has a buffer allocated and some properties would need to be set, |
Read(byte[,])
Reads multi-channel audio data into a two-dimensional byte array.
Declaration
public AVResult32 Read(byte[,] data)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[,] | data | A two-dimensional byte array where the first dimension is the channel index and the second is the byte index. |
Returns
| Type | Description |
|---|---|
| AVResult32 | The number of samples read. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
| NotSupportedException | Thrown when the number of channels does not match Channels. |
Read(byte[])
Reads audio data into a single byte array.
Declaration
public AVResult32 Read(byte[] data)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | data | A byte array to receive interleaved audio samples. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Remarks
This method simply wraps Read(Span<byte>) for convenience.
It reads interleaved (packed) audio samples directly into data.
Read(params byte[][])
Reads multi-channel audio data into an array of channel buffers.
Declaration
public AVResult32 Read(params byte[][] data)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[][] | data | An array of byte arrays, where each element represents one channel’s audio samples. |
Returns
| Type | Description |
|---|---|
| AVResult32 | The number of samples read. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
| ArgumentException | Thrown when any element of |
| NotSupportedException | Thrown when |
Read(Span<byte>)
Reads packed multi-channel audio data from the AudioFifo into a single contiguous buffer.
Declaration
public AVResult32 Read(Span<byte> buffer)
Parameters
| Type | Name | Description |
|---|---|---|
| Span<byte> | buffer | A writable span to receive interleaved audio samples for all channels. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Remarks
The number of channels is determined from the current audio stream's Channels property.
The total number of samples is calculated as buffer.Length / Format.GetBytesPerSample().
Planar ↔ packed conversions are handled automatically:
- If the FIFO stores packed data, samples are read directly using FFmpeg.Audio.AudioFifo.ReadPackedToPacked(System.Byte*,System.Int32).
- If the FIFO stores planar data, samples are deinterleaved from planar into the packed buffer using FFmpeg.Audio.AudioFifo.ReadPlanarToPacked(System.Byte*,System.Int32).
Read(Span<byte>, Span<byte>)
Reads stereo (two-channel) audio data into separate left and right channel buffers.
Declaration
public AVResult32 Read(Span<byte> left, Span<byte> right)
Parameters
| Type | Name | Description |
|---|---|---|
| Span<byte> | left | A writable span to receive audio samples for the left channel. |
| Span<byte> | right | A writable span to receive audio samples for the right channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the current audio stream does not have exactly two channels. |
Read(Span<byte>, Span<byte>, Span<byte>)
Reads 3-channel audio data into separate channel buffers.
Declaration
public AVResult32 Read(Span<byte> ch1, Span<byte> ch2, Span<byte> ch3)
Parameters
| Type | Name | Description |
|---|---|---|
| Span<byte> | ch1 | |
| Span<byte> | ch2 | |
| Span<byte> | ch3 |
Returns
| Type | Description |
|---|---|
| AVResult32 |
Read(Span<byte>, Span<byte>, Span<byte>, Span<byte>)
Reads 4-channel audio data into separate channel buffers.
Declaration
public AVResult32 Read(Span<byte> ch1, Span<byte> ch2, Span<byte> ch3, Span<byte> ch4)
Parameters
| Type | Name | Description |
|---|---|---|
| Span<byte> | ch1 | |
| Span<byte> | ch2 | |
| Span<byte> | ch3 | |
| Span<byte> | ch4 |
Returns
| Type | Description |
|---|---|
| AVResult32 |
Read(Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>)
Reads 5-channel audio data into separate channel buffers.
Declaration
public AVResult32 Read(Span<byte> ch1, Span<byte> ch2, Span<byte> ch3, Span<byte> ch4, Span<byte> ch5)
Parameters
| Type | Name | Description |
|---|---|---|
| Span<byte> | ch1 | A span to receive samples for the first channel. |
| Span<byte> | ch2 | A span to receive samples for the second channel. |
| Span<byte> | ch3 | A span to receive samples for the third channel. |
| Span<byte> | ch4 | A span to receive samples for the fourth channel. |
| Span<byte> | ch5 | A span to receive samples for the fifth channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown if the audio stream does not have exactly five channels. |
Read(Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>)
Reads 6-channel audio data into separate channel buffers.
Declaration
public AVResult32 Read(Span<byte> ch1, Span<byte> ch2, Span<byte> ch3, Span<byte> ch4, Span<byte> ch5, Span<byte> ch6)
Parameters
| Type | Name | Description |
|---|---|---|
| Span<byte> | ch1 | A span to receive samples for the first channel. |
| Span<byte> | ch2 | A span to receive samples for the second channel. |
| Span<byte> | ch3 | A span to receive samples for the third channel. |
| Span<byte> | ch4 | A span to receive samples for the fourth channel. |
| Span<byte> | ch5 | A span to receive samples for the fifth channel. |
| Span<byte> | ch6 | A span to receive samples for the sixth channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown if the audio stream does not have exactly six channels. |
Read(Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>)
Reads 7-channel audio data into separate channel buffers.
Declaration
public AVResult32 Read(Span<byte> ch1, Span<byte> ch2, Span<byte> ch3, Span<byte> ch4, Span<byte> ch5, Span<byte> ch6, Span<byte> ch7)
Parameters
| Type | Name | Description |
|---|---|---|
| Span<byte> | ch1 | A span to receive samples for the first channel. |
| Span<byte> | ch2 | A span to receive samples for the second channel. |
| Span<byte> | ch3 | A span to receive samples for the third channel. |
| Span<byte> | ch4 | A span to receive samples for the fourth channel. |
| Span<byte> | ch5 | A span to receive samples for the fifth channel. |
| Span<byte> | ch6 | A span to receive samples for the sixth channel. |
| Span<byte> | ch7 | A span to receive samples for the seventh channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown if the audio stream does not have exactly seven channels. |
Read(Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>)
Reads 8-channel audio data into separate channel buffers.
Declaration
public AVResult32 Read(Span<byte> ch1, Span<byte> ch2, Span<byte> ch3, Span<byte> ch4, Span<byte> ch5, Span<byte> ch6, Span<byte> ch7, Span<byte> ch8)
Parameters
| Type | Name | Description |
|---|---|---|
| Span<byte> | ch1 | A span to receive samples for the first channel. |
| Span<byte> | ch2 | A span to receive samples for the second channel. |
| Span<byte> | ch3 | A span to receive samples for the third channel. |
| Span<byte> | ch4 | A span to receive samples for the fourth channel. |
| Span<byte> | ch5 | A span to receive samples for the fifth channel. |
| Span<byte> | ch6 | A span to receive samples for the sixth channel. |
| Span<byte> | ch7 | A span to receive samples for the seventh channel. |
| Span<byte> | ch8 | A span to receive samples for the eighth channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown if the audio stream does not have exactly eight channels. |
Read(Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>, Span<byte>)
Reads 9-channel audio data into separate channel buffers.
Declaration
public AVResult32 Read(Span<byte> ch1, Span<byte> ch2, Span<byte> ch3, Span<byte> ch4, Span<byte> ch5, Span<byte> ch6, Span<byte> ch7, Span<byte> ch8, Span<byte> ch9)
Parameters
| Type | Name | Description |
|---|---|---|
| Span<byte> | ch1 | A span to receive samples for the first channel. |
| Span<byte> | ch2 | A span to receive samples for the second channel. |
| Span<byte> | ch3 | A span to receive samples for the third channel. |
| Span<byte> | ch4 | A span to receive samples for the fourth channel. |
| Span<byte> | ch5 | A span to receive samples for the fifth channel. |
| Span<byte> | ch6 | A span to receive samples for the sixth channel. |
| Span<byte> | ch7 | A span to receive samples for the seventh channel. |
| Span<byte> | ch8 | A span to receive samples for the eighth channel. |
| Span<byte> | ch9 | A span to receive samples for the ninth channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown if the audio stream does not have exactly nine channels. |
Read<T>(Span<T>)
Reads packed multi-channel audio data from the AudioFifo into a span of typed samples.
Declaration
public AVResult32 Read<T>(Span<T> buffer) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| Span<T> | buffer | A writable span to receive interleaved audio samples for all channels. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T | The unmanaged sample type (for example, float or short). |
Remarks
The number of channels is determined from the current audio stream's Channels property.
This method simply reinterprets the T span as bytes and calls Read(Span<byte>).
Read<T>(Span<T>, Span<T>)
Reads stereo (two-channel) audio data into typed sample buffers.
Declaration
public AVResult32 Read<T>(Span<T> left, Span<T> right) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| Span<T> | left | A writable span for left-channel samples. |
| Span<T> | right | A writable span for right-channel samples. |
Returns
| Type | Description |
|---|---|
| AVResult32 | The number of samples read or an error code. |
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the current audio stream does not have exactly two channels. |
Read<T>(Span<T>, Span<T>, Span<T>)
Reads 3-channel audio data into typed sample buffers.
Declaration
public AVResult32 Read<T>(Span<T> ch1, Span<T> ch2, Span<T> ch3) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| Span<T> | ch1 | |
| Span<T> | ch2 | |
| Span<T> | ch3 |
Returns
| Type | Description |
|---|---|
| AVResult32 |
Type Parameters
| Name | Description |
|---|---|
| T |
Read<T>(Span<T>, Span<T>, Span<T>, Span<T>)
Reads 4-channel audio data into typed sample buffers.
Declaration
public AVResult32 Read<T>(Span<T> ch1, Span<T> ch2, Span<T> ch3, Span<T> ch4) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| Span<T> | ch1 | A span to receive samples for the first channel. |
| Span<T> | ch2 | A span to receive samples for the second channel. |
| Span<T> | ch3 | A span to receive samples for the third channel. |
| Span<T> | ch4 | A span to receive samples for the fourth channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown if the audio stream does not have exactly four channels. |
Read<T>(Span<T>, Span<T>, Span<T>, Span<T>, Span<T>)
Reads 5-channel audio data into typed sample buffers.
Declaration
public AVResult32 Read<T>(Span<T> ch1, Span<T> ch2, Span<T> ch3, Span<T> ch4, Span<T> ch5) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| Span<T> | ch1 | A span to receive samples for the first channel. |
| Span<T> | ch2 | A span to receive samples for the second channel. |
| Span<T> | ch3 | A span to receive samples for the third channel. |
| Span<T> | ch4 | A span to receive samples for the fourth channel. |
| Span<T> | ch5 | A span to receive samples for the fifth channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown if the audio stream does not have exactly five channels. |
Read<T>(Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, Span<T>)
Reads 6-channel audio data into typed sample buffers.
Declaration
public AVResult32 Read<T>(Span<T> ch1, Span<T> ch2, Span<T> ch3, Span<T> ch4, Span<T> ch5, Span<T> ch6) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| Span<T> | ch1 | A span to receive samples for the first channel. |
| Span<T> | ch2 | A span to receive samples for the second channel. |
| Span<T> | ch3 | A span to receive samples for the third channel. |
| Span<T> | ch4 | A span to receive samples for the fourth channel. |
| Span<T> | ch5 | A span to receive samples for the fifth channel. |
| Span<T> | ch6 | A span to receive samples for the sixth channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown if the audio stream does not have exactly six channels. |
Read<T>(Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, Span<T>)
Reads 7-channel audio data into typed sample buffers.
Declaration
public AVResult32 Read<T>(Span<T> ch1, Span<T> ch2, Span<T> ch3, Span<T> ch4, Span<T> ch5, Span<T> ch6, Span<T> ch7) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| Span<T> | ch1 | A span to receive samples for the first channel. |
| Span<T> | ch2 | A span to receive samples for the second channel. |
| Span<T> | ch3 | A span to receive samples for the third channel. |
| Span<T> | ch4 | A span to receive samples for the fourth channel. |
| Span<T> | ch5 | A span to receive samples for the fifth channel. |
| Span<T> | ch6 | A span to receive samples for the sixth channel. |
| Span<T> | ch7 | A span to receive samples for the seventh channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown if the audio stream does not have exactly seven channels. |
Read<T>(Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, Span<T>)
Reads 8-channel audio data into typed sample buffers.
Declaration
public AVResult32 Read<T>(Span<T> ch1, Span<T> ch2, Span<T> ch3, Span<T> ch4, Span<T> ch5, Span<T> ch6, Span<T> ch7, Span<T> ch8) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| Span<T> | ch1 | A span to receive samples for the first channel. |
| Span<T> | ch2 | A span to receive samples for the second channel. |
| Span<T> | ch3 | A span to receive samples for the third channel. |
| Span<T> | ch4 | A span to receive samples for the fourth channel. |
| Span<T> | ch5 | A span to receive samples for the fifth channel. |
| Span<T> | ch6 | A span to receive samples for the sixth channel. |
| Span<T> | ch7 | A span to receive samples for the seventh channel. |
| Span<T> | ch8 | A span to receive samples for the eighth channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown if the audio stream does not have exactly eight channels. |
Read<T>(Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, Span<T>, Span<T>)
Reads 9-channel audio data into typed sample buffers.
Declaration
public AVResult32 Read<T>(Span<T> ch1, Span<T> ch2, Span<T> ch3, Span<T> ch4, Span<T> ch5, Span<T> ch6, Span<T> ch7, Span<T> ch8, Span<T> ch9) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| Span<T> | ch1 | A span to receive samples for the first channel. |
| Span<T> | ch2 | A span to receive samples for the second channel. |
| Span<T> | ch3 | A span to receive samples for the third channel. |
| Span<T> | ch4 | A span to receive samples for the fourth channel. |
| Span<T> | ch5 | A span to receive samples for the fifth channel. |
| Span<T> | ch6 | A span to receive samples for the sixth channel. |
| Span<T> | ch7 | A span to receive samples for the seventh channel. |
| Span<T> | ch8 | A span to receive samples for the eighth channel. |
| Span<T> | ch9 | A span to receive samples for the ninth channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown if the audio stream does not have exactly nine channels. |
Read<T>(T[,])
Reads multi-channel audio data into a two-dimensional typed array.
Declaration
public AVResult32 Read<T>(T[,] data) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| T[,] | data | A two-dimensional |
Returns
| Type | Description |
|---|---|
| AVResult32 | The number of samples read. |
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
| NotSupportedException | Thrown when the number of channels does not match Channels or
when |
Read<T>(T[])
Reads typed audio samples into a single buffer.
Declaration
public AVResult32 Read<T>(T[] data) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| T[] | data | A buffer to receive interleaved audio samples for all channels. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T | The unmanaged sample type (for example, float or short). |
Remarks
This method reinterprets data as a Span<T> and calls
Read(Span<byte>) internally.
Read<T>(params T[][])
Reads multi-channel audio data into an array of typed sample buffers.
Declaration
public AVResult32 Read<T>(params T[][] data) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| T[][] | data | An array of |
Returns
| Type | Description |
|---|---|
| AVResult32 | The number of samples read. |
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
| ArgumentException | Thrown when any element of |
| NotSupportedException | Thrown when |
Write(AVFrame)
Declaration
public AVResult32 Write(AVFrame frame)
Parameters
| Type | Name | Description |
|---|---|---|
| AVFrame | frame | The AVFrame containing audio samples to write. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Remarks
The AudioFifo stores all audio data according to the Format specified when the FIFO was created. This method does not convert between sample types (e.g., float ↔ int16); doing so must be handled by the caller.
Planar ↔ packed conversions are handled automatically:
- If the frame's format exactly matches the FIFO format, the data is written directly using
ffmpeg.av_audio_fifo_write. - If the FIFO expects planar but the frame is packed, the data is converted from packed to planar using FFmpeg.Audio.AudioFifo.WritePackedToPlanar(System.Byte*,System.Int32).
- If the FIFO expects packed but the frame is planar, the data is converted from planar to packed using FFmpeg.Audio.AudioFifo.WritePlanarToPacked(System.Byte**,System.Int32).
To avoid unnecessary copying, it is recommended to provide frames in the same planar/packed layout as the FIFO’s Format.
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown if the frame's channel count does not match the FIFO’s Channels, or if the frame's planar/packed layout does not match the FIFO's Format. |
Write(byte[,])
Writes multi-channel audio data from a two-dimensional byte array.
Declaration
public AVResult32 Write(byte[,] data)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[,] | data | A two-dimensional byte array where:
The number of channels ( |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
| NotSupportedException | Thrown when the number of provided channels ( |
Write(byte[])
Writes audio data from a single byte array.
Declaration
public AVResult32 Write(byte[] data)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | data | A byte array containing interleaved audio samples to write. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Remarks
This method simply reinterprets data as a ReadOnlySpan<T> and calls
Write(ReadOnlySpan<byte>).
Write(params byte[][])
Writes multi-channel audio data from an array of channel buffers.
Declaration
public AVResult32 Write(params byte[][] data)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[][] | data | An array of byte arrays, where each element represents one channel’s audio samples. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
| ArgumentException | Thrown when |
| NotSupportedException | Thrown when the number of provided channel buffers does not match the expected number of channels. |
Write(ReadOnlySpan<byte>)
Writes packed multi-channel audio data from a single contiguous buffer.
Declaration
public AVResult32 Write(ReadOnlySpan<byte> packedData)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<byte> | packedData | A read-only span containing interleaved audio samples for all channels. Samples are packed: one sample per channel in sequence for each frame. |
Returns
| Type | Description |
|---|---|
| AVResult32 | The number of frames successfully written, or an error code. |
Write(ReadOnlySpan<byte>, ReadOnlySpan<byte>)
Writes stereo (two-channel) audio data from separate left and right channel buffers.
Declaration
public AVResult32 Write(ReadOnlySpan<byte> left, ReadOnlySpan<byte> right)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<byte> | left | A read-only span containing audio sample data for the left channel. |
| ReadOnlySpan<byte> | right | A read-only span containing audio sample data for the right channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the current audio stream does not have exactly two channels. |
Write(ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>)
Writes 3-channel audio data from separate channel buffers.
Declaration
public AVResult32 Write(ReadOnlySpan<byte> ch1, ReadOnlySpan<byte> ch2, ReadOnlySpan<byte> ch3)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<byte> | ch1 | A read-only span containing audio sample data for the first channel. |
| ReadOnlySpan<byte> | ch2 | A read-only span containing audio sample data for the second channel. |
| ReadOnlySpan<byte> | ch3 | A read-only span containing audio sample data for the third channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the current audio stream does not have exactly three channels. |
Write(ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>)
Writes 4-channel audio data from separate channel buffers.
Declaration
public AVResult32 Write(ReadOnlySpan<byte> ch1, ReadOnlySpan<byte> ch2, ReadOnlySpan<byte> ch3, ReadOnlySpan<byte> ch4)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<byte> | ch1 | A read-only span containing audio sample data for the first channel. |
| ReadOnlySpan<byte> | ch2 | A read-only span containing audio sample data for the second channel. |
| ReadOnlySpan<byte> | ch3 | A read-only span containing audio sample data for the third channel. |
| ReadOnlySpan<byte> | ch4 | A read-only span containing audio sample data for the fourth channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the current audio stream does not have exactly four channels. |
Write(ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>)
Writes 5-channel audio data from separate channel buffers.
Declaration
public AVResult32 Write(ReadOnlySpan<byte> ch1, ReadOnlySpan<byte> ch2, ReadOnlySpan<byte> ch3, ReadOnlySpan<byte> ch4, ReadOnlySpan<byte> ch5)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<byte> | ch1 | A read-only span containing audio sample data for the first channel. |
| ReadOnlySpan<byte> | ch2 | A read-only span containing audio sample data for the second channel. |
| ReadOnlySpan<byte> | ch3 | A read-only span containing audio sample data for the third channel. |
| ReadOnlySpan<byte> | ch4 | A read-only span containing audio sample data for the fourth channel. |
| ReadOnlySpan<byte> | ch5 | A read-only span containing audio sample data for the fifth channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the current audio stream does not have exactly five channels. |
Write(ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>)
Writes 6-channel audio data from separate channel buffers.
Declaration
public AVResult32 Write(ReadOnlySpan<byte> ch1, ReadOnlySpan<byte> ch2, ReadOnlySpan<byte> ch3, ReadOnlySpan<byte> ch4, ReadOnlySpan<byte> ch5, ReadOnlySpan<byte> ch6)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<byte> | ch1 | A read-only span containing audio sample data for the first channel. |
| ReadOnlySpan<byte> | ch2 | A read-only span containing audio sample data for the second channel. |
| ReadOnlySpan<byte> | ch3 | A read-only span containing audio sample data for the third channel. |
| ReadOnlySpan<byte> | ch4 | A read-only span containing audio sample data for the fourth channel. |
| ReadOnlySpan<byte> | ch5 | A read-only span containing audio sample data for the fifth channel. |
| ReadOnlySpan<byte> | ch6 | A read-only span containing audio sample data for the sixth channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the current audio stream does not have exactly six channels. |
Write(ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>)
Writes 7-channel audio data from separate channel buffers.
Declaration
public AVResult32 Write(ReadOnlySpan<byte> ch1, ReadOnlySpan<byte> ch2, ReadOnlySpan<byte> ch3, ReadOnlySpan<byte> ch4, ReadOnlySpan<byte> ch5, ReadOnlySpan<byte> ch6, ReadOnlySpan<byte> ch7)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<byte> | ch1 | A read-only span containing audio sample data for the first channel. |
| ReadOnlySpan<byte> | ch2 | A read-only span containing audio sample data for the second channel. |
| ReadOnlySpan<byte> | ch3 | A read-only span containing audio sample data for the third channel. |
| ReadOnlySpan<byte> | ch4 | A read-only span containing audio sample data for the fourth channel. |
| ReadOnlySpan<byte> | ch5 | A read-only span containing audio sample data for the fifth channel. |
| ReadOnlySpan<byte> | ch6 | A read-only span containing audio sample data for the sixth channel. |
| ReadOnlySpan<byte> | ch7 | A read-only span containing audio sample data for the seventh channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the current audio stream does not have exactly seven channels. |
Write(ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>)
Writes 8-channel audio data from separate channel buffers.
Declaration
public AVResult32 Write(ReadOnlySpan<byte> ch1, ReadOnlySpan<byte> ch2, ReadOnlySpan<byte> ch3, ReadOnlySpan<byte> ch4, ReadOnlySpan<byte> ch5, ReadOnlySpan<byte> ch6, ReadOnlySpan<byte> ch7, ReadOnlySpan<byte> ch8)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<byte> | ch1 | A read-only span containing audio sample data for the first channel. |
| ReadOnlySpan<byte> | ch2 | A read-only span containing audio sample data for the second channel. |
| ReadOnlySpan<byte> | ch3 | A read-only span containing audio sample data for the third channel. |
| ReadOnlySpan<byte> | ch4 | A read-only span containing audio sample data for the fourth channel. |
| ReadOnlySpan<byte> | ch5 | A read-only span containing audio sample data for the fifth channel. |
| ReadOnlySpan<byte> | ch6 | A read-only span containing audio sample data for the sixth channel. |
| ReadOnlySpan<byte> | ch7 | A read-only span containing audio sample data for the seventh channel. |
| ReadOnlySpan<byte> | ch8 | A read-only span containing audio sample data for the eighth channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the current audio stream does not have exactly eight channels. |
Write(ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>)
Writes 9-channel audio data from separate channel buffers.
Declaration
public AVResult32 Write(ReadOnlySpan<byte> ch1, ReadOnlySpan<byte> ch2, ReadOnlySpan<byte> ch3, ReadOnlySpan<byte> ch4, ReadOnlySpan<byte> ch5, ReadOnlySpan<byte> ch6, ReadOnlySpan<byte> ch7, ReadOnlySpan<byte> ch8, ReadOnlySpan<byte> ch9)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<byte> | ch1 | A read-only span containing audio sample data for the first channel. |
| ReadOnlySpan<byte> | ch2 | A read-only span containing audio sample data for the second channel. |
| ReadOnlySpan<byte> | ch3 | A read-only span containing audio sample data for the third channel. |
| ReadOnlySpan<byte> | ch4 | A read-only span containing audio sample data for the fourth channel. |
| ReadOnlySpan<byte> | ch5 | A read-only span containing audio sample data for the fifth channel. |
| ReadOnlySpan<byte> | ch6 | A read-only span containing audio sample data for the sixth channel. |
| ReadOnlySpan<byte> | ch7 | A read-only span containing audio sample data for the seventh channel. |
| ReadOnlySpan<byte> | ch8 | A read-only span containing audio sample data for the eighth channel. |
| ReadOnlySpan<byte> | ch9 | A read-only span containing audio sample data for the ninth channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the current audio stream does not have exactly nine channels. |
Write<T>(ReadOnlySpan<T>)
Writes packed multi-channel audio data from a read-only span of typed samples.
Declaration
public AVResult32 Write<T>(ReadOnlySpan<T> buffer) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<T> | buffer | A read-only span containing interleaved audio samples for all channels. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T | The unmanaged sample type (for example, float or short). |
Remarks
The number of channels is determined from the current audio stream's Channels property.
This method simply reinterprets the T span as bytes and calls
Write(ReadOnlySpan<byte>).
Write<T>(ReadOnlySpan<T>, ReadOnlySpan<T>)
Writes stereo (two-channel) audio data from typed sample buffers.
Declaration
public AVResult32 Write<T>(ReadOnlySpan<T> left, ReadOnlySpan<T> right) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<T> | left | A read-only span containing left-channel samples. |
| ReadOnlySpan<T> | right | A read-only span containing right-channel samples. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the current audio stream does not have exactly two channels. |
Write<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, ReadOnlySpan<T>)
Writes 3-channel audio data from typed sample buffers.
Declaration
public AVResult32 Write<T>(ReadOnlySpan<T> ch1, ReadOnlySpan<T> ch2, ReadOnlySpan<T> ch3) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<T> | ch1 | A read-only span containing samples for the first channel. |
| ReadOnlySpan<T> | ch2 | A read-only span containing samples for the second channel. |
| ReadOnlySpan<T> | ch3 | A read-only span containing samples for the third channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the current audio stream does not have exactly three channels. |
Write<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, ReadOnlySpan<T>, ReadOnlySpan<T>)
Writes 4-channel audio data from typed sample buffers.
Declaration
public AVResult32 Write<T>(ReadOnlySpan<T> ch1, ReadOnlySpan<T> ch2, ReadOnlySpan<T> ch3, ReadOnlySpan<T> ch4) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<T> | ch1 | A read-only span containing samples for the first channel. |
| ReadOnlySpan<T> | ch2 | A read-only span containing samples for the second channel. |
| ReadOnlySpan<T> | ch3 | A read-only span containing samples for the third channel. |
| ReadOnlySpan<T> | ch4 | A read-only span containing samples for the fourth channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the current audio stream does not have exactly four channels. |
Write<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, ReadOnlySpan<T>, ReadOnlySpan<T>, ReadOnlySpan<T>)
Writes 5-channel audio data from typed sample buffers.
Declaration
public AVResult32 Write<T>(ReadOnlySpan<T> ch1, ReadOnlySpan<T> ch2, ReadOnlySpan<T> ch3, ReadOnlySpan<T> ch4, ReadOnlySpan<T> ch5) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<T> | ch1 | A read-only span containing samples for the first channel. |
| ReadOnlySpan<T> | ch2 | A read-only span containing samples for the second channel. |
| ReadOnlySpan<T> | ch3 | A read-only span containing samples for the third channel. |
| ReadOnlySpan<T> | ch4 | A read-only span containing samples for the fourth channel. |
| ReadOnlySpan<T> | ch5 | A read-only span containing samples for the fifth channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the current audio stream does not have exactly five channels. |
Write<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, ReadOnlySpan<T>, ReadOnlySpan<T>, ReadOnlySpan<T>, ReadOnlySpan<T>)
Writes 6-channel audio data from typed sample buffers.
Declaration
public AVResult32 Write<T>(ReadOnlySpan<T> ch1, ReadOnlySpan<T> ch2, ReadOnlySpan<T> ch3, ReadOnlySpan<T> ch4, ReadOnlySpan<T> ch5, ReadOnlySpan<T> ch6) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<T> | ch1 | A read-only span containing samples for the first channel. |
| ReadOnlySpan<T> | ch2 | A read-only span containing samples for the second channel. |
| ReadOnlySpan<T> | ch3 | A read-only span containing samples for the third channel. |
| ReadOnlySpan<T> | ch4 | A read-only span containing samples for the fourth channel. |
| ReadOnlySpan<T> | ch5 | A read-only span containing samples for the fifth channel. |
| ReadOnlySpan<T> | ch6 | A read-only span containing samples for the sixth channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the current audio stream does not have exactly six channels. |
Write<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, ReadOnlySpan<T>, ReadOnlySpan<T>, ReadOnlySpan<T>, ReadOnlySpan<T>, ReadOnlySpan<T>)
Writes 7-channel audio data from typed sample buffers.
Declaration
public AVResult32 Write<T>(ReadOnlySpan<T> ch1, ReadOnlySpan<T> ch2, ReadOnlySpan<T> ch3, ReadOnlySpan<T> ch4, ReadOnlySpan<T> ch5, ReadOnlySpan<T> ch6, ReadOnlySpan<T> ch7) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<T> | ch1 | A read-only span containing samples for the first channel. |
| ReadOnlySpan<T> | ch2 | A read-only span containing samples for the second channel. |
| ReadOnlySpan<T> | ch3 | A read-only span containing samples for the third channel. |
| ReadOnlySpan<T> | ch4 | A read-only span containing samples for the fourth channel. |
| ReadOnlySpan<T> | ch5 | A read-only span containing samples for the fifth channel. |
| ReadOnlySpan<T> | ch6 | A read-only span containing samples for the sixth channel. |
| ReadOnlySpan<T> | ch7 | A read-only span containing samples for the seventh channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the current audio stream does not have exactly seven channels. |
Write<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, ReadOnlySpan<T>, ReadOnlySpan<T>, ReadOnlySpan<T>, ReadOnlySpan<T>, ReadOnlySpan<T>, ReadOnlySpan<T>)
Writes 8-channel audio data from typed sample buffers.
Declaration
public AVResult32 Write<T>(ReadOnlySpan<T> ch1, ReadOnlySpan<T> ch2, ReadOnlySpan<T> ch3, ReadOnlySpan<T> ch4, ReadOnlySpan<T> ch5, ReadOnlySpan<T> ch6, ReadOnlySpan<T> ch7, ReadOnlySpan<T> ch8) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<T> | ch1 | A read-only span containing samples for the first channel. |
| ReadOnlySpan<T> | ch2 | A read-only span containing samples for the second channel. |
| ReadOnlySpan<T> | ch3 | A read-only span containing samples for the third channel. |
| ReadOnlySpan<T> | ch4 | A read-only span containing samples for the fourth channel. |
| ReadOnlySpan<T> | ch5 | A read-only span containing samples for the fifth channel. |
| ReadOnlySpan<T> | ch6 | A read-only span containing samples for the sixth channel. |
| ReadOnlySpan<T> | ch7 | A read-only span containing samples for the seventh channel. |
| ReadOnlySpan<T> | ch8 | A read-only span containing samples for the eighth channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the current audio stream does not have exactly eight channels. |
Write<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, ReadOnlySpan<T>, ReadOnlySpan<T>, ReadOnlySpan<T>, ReadOnlySpan<T>, ReadOnlySpan<T>, ReadOnlySpan<T>, ReadOnlySpan<T>)
Writes 9-channel audio data from typed sample buffers.
Declaration
public AVResult32 Write<T>(ReadOnlySpan<T> ch1, ReadOnlySpan<T> ch2, ReadOnlySpan<T> ch3, ReadOnlySpan<T> ch4, ReadOnlySpan<T> ch5, ReadOnlySpan<T> ch6, ReadOnlySpan<T> ch7, ReadOnlySpan<T> ch8, ReadOnlySpan<T> ch9) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<T> | ch1 | A read-only span containing samples for the first channel. |
| ReadOnlySpan<T> | ch2 | A read-only span containing samples for the second channel. |
| ReadOnlySpan<T> | ch3 | A read-only span containing samples for the third channel. |
| ReadOnlySpan<T> | ch4 | A read-only span containing samples for the fourth channel. |
| ReadOnlySpan<T> | ch5 | A read-only span containing samples for the fifth channel. |
| ReadOnlySpan<T> | ch6 | A read-only span containing samples for the sixth channel. |
| ReadOnlySpan<T> | ch7 | A read-only span containing samples for the seventh channel. |
| ReadOnlySpan<T> | ch8 | A read-only span containing samples for the eighth channel. |
| ReadOnlySpan<T> | ch9 | A read-only span containing samples for the ninth channel. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the current audio stream does not have exactly nine channels. |
Write<T>(T[,])
Writes multi-channel audio data from a two-dimensional typed array.
Declaration
public AVResult32 Write<T>(T[,] data) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| T[,] | data | A two-dimensional array of
The number of channels ( |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
| NotSupportedException | Thrown when the number of provided channels ( |
Write<T>(T[])
Writes typed audio samples from a single buffer.
Declaration
public AVResult32 Write<T>(T[] data) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| T[] | data | A buffer containing interleaved audio samples for all channels. |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T |
Remarks
This method simply reinterprets data as a ReadOnlySpan<T> and calls
Write(ReadOnlySpan<byte>).
Write<T>(params T[][])
Writes multi-channel audio data from an array of typed sample buffers.
Declaration
public AVResult32 Write<T>(params T[][] data) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| T[][] | data | An array of |
Returns
| Type | Description |
|---|---|
| AVResult32 | An AVResult32 value representing either:
|
Type Parameters
| Name | Description |
|---|---|
| T |
Remarks
This method simply reinterprets each T array as bytes and calls
Write(params byte[][]).
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
| ArgumentException | Thrown when |
| NotSupportedException | Thrown when the number of provided channel buffers does not match the expected number of channels. |