Class AudioBufferWriter
Represents a write-only data view of an AudioBuffer. The AudioBufferWriter class allows for performant writing of samples of different formats than the target audio buffer.
Inherited Members
Namespace: Cosmos.System.Audio.IO
Assembly: Cosmos.System2.dll
Syntax
public class AudioBufferWriter : AudioBufferReadWriteBase
Constructors
| Improve this Doc View SourceAudioBufferWriter(AudioBuffer, SampleFormat)
Creates a new write-only data view for the specified audio buffer.
Declaration
public AudioBufferWriter(AudioBuffer target, SampleFormat writeFormat)
Parameters
Type | Name | Description |
---|---|---|
AudioBuffer | target | The target buffer. |
SampleFormat | writeFormat | The format of the samples that will be written. |
Methods
| Improve this Doc View SourceWrite(Byte*, Int32)
Writes a sample to the buffer.
Declaration
public void Write(byte *sample, int index)
Parameters
Type | Name | Description |
---|---|---|
System.Byte* | sample | A pointer to the first byte of the sample write. |
System.Int32 | index | The index of the target sample to overwrite. |
Write(Byte[], Int32)
Writes a sample to the buffer, reading from the given array.
Declaration
public void Write(byte[] sample, int index)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | sample | The bytes of the sample to write. |
System.Int32 | index | The index of the target sample to overwrite. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | The target array is not big enough to contain the sample information. |
Write(Byte[], Int32, Int32)
Writes a sample to the buffer, reading from the given array, starting from the given offset.
Declaration
public void Write(byte[] sample, int index, int offset)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | sample | The bytes of the sample to write. |
System.Int32 | index | The index of the target sample to overwrite. |
System.Int32 | offset | The starting index to read from. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | The target array is not big enough to provide the sample information with the given offset. |
WriteChannel(Byte*, Int32, Int32)
Overwrites a channel of a sample of the buffer.
Declaration
public void WriteChannel(byte *sample, int index, int channel)
Parameters
Type | Name | Description |
---|---|---|
System.Byte* | sample | A pointer to the first byte of the channel value to read from. |
System.Int32 | index | The index of the target sample to write to. |
System.Int32 | channel | The index of the channel to write to. |