Class AudioBufferReadWriteBase
Represents the base class for AudioBufferReader and AudioBufferWriter instances.
Inherited Members
Namespace: Cosmos.System.Audio.IO
Assembly: Cosmos.System2.dll
Syntax
public abstract class AudioBufferReadWriteBase
Fields
| Improve this Doc View Sourcetarget
The audio buffer this reader/writer is working on.
Declaration
protected AudioBuffer target
Field Value
Type | Description |
---|---|
AudioBuffer |
Methods
| Improve this Doc View SourceChangeBitDepth(Byte*, AudioBitDepth, Byte, Byte*)
Converts 8-bit samples to the the specified format, using the specified
buffer. If target
is equal to Bits8,
no action is performed.
Declaration
protected static void ChangeBitDepth(byte *outputPtr, AudioBitDepth target, byte channels, byte *inputPtr)
Parameters
Type | Name | Description |
---|---|---|
System.Byte* | outputPtr | |
AudioBitDepth | target | |
System.Byte | channels | |
System.Byte* | inputPtr |
ChangeBitDepth(Byte*, AudioBitDepth, Byte, Int16*)
Converts 16-bit samples to the specified format, using the specified
buffer. If target
is equal to Bits16,
no action is performed.
Declaration
protected static void ChangeBitDepth(byte *outputPtr, AudioBitDepth target, byte channels, short *inputPtr)
Parameters
Type | Name | Description |
---|---|---|
System.Byte* | outputPtr | |
AudioBitDepth | target | |
System.Byte | channels | |
System.Int16* | inputPtr |
ChangeBitDepth(Byte*, AudioBitDepth, Byte, Int32*)
Converts 32-bit samples to the specified format, using the specified
buffer. If target
is equal to Bits32,
no action is performed.
Declaration
protected static void ChangeBitDepth(byte *outputPtr, AudioBitDepth target, byte channels, int *inputPtr)
Parameters
Type | Name | Description |
---|---|---|
System.Byte* | outputPtr | |
AudioBitDepth | target | |
System.Byte | channels | |
System.Int32* | inputPtr |
ChangeBitDepth(Byte*, Byte, AudioBitDepth, AudioBitDepth)
Converts the specified samples to the specified target format. The specified buffer pointer must be large enough to hold both the input samples, and the converted output samples.
Declaration
protected static void ChangeBitDepth(byte *bufferPtr, byte channels, AudioBitDepth inputBitDepth, AudioBitDepth outputBitDepth)
Parameters
Type | Name | Description |
---|---|---|
System.Byte* | bufferPtr | |
System.Byte | channels | |
AudioBitDepth | inputBitDepth | |
AudioBitDepth | outputBitDepth |
ChangeBitDepth24(Byte*, AudioBitDepth, Byte, Int32*)
Converts 24-bit samples to the specified format, using the specified
buffer. Each langword_csharp_int in the specified buffer will be
interpreted as 24-bit values, and any extra bits will be ignored.
If target
is equal to Bits24,
no action is performed.
Declaration
protected static void ChangeBitDepth24(byte *outputPtr, AudioBitDepth target, byte channels, int *inputPtr)
Parameters
Type | Name | Description |
---|---|---|
System.Byte* | outputPtr | |
AudioBitDepth | target | |
System.Byte | channels | |
System.Int32* | inputPtr |
MakeSigned(Byte*, AudioBitDepth, Byte)
Makes a single unsigned audio sample signed.
Declaration
protected static void MakeSigned(byte *sourcePtr, AudioBitDepth bitDepth, byte channels)
Parameters
Type | Name | Description |
---|---|---|
System.Byte* | sourcePtr | The pointer to the target sample. |
AudioBitDepth | bitDepth | |
System.Byte | channels |
MakeSigned(Byte*, SampleFormat)
Declaration
protected static void MakeSigned(byte *sourcePtr, SampleFormat format)
Parameters
Type | Name | Description |
---|---|---|
System.Byte* | sourcePtr | |
SampleFormat | format |
MakeUnsigned(Byte*, AudioBitDepth, Byte)
Makes a single signed audio sample unsigned.
Declaration
protected static void MakeUnsigned(byte *sourcePtr, AudioBitDepth bitDepth, byte channels)
Parameters
Type | Name | Description |
---|---|---|
System.Byte* | sourcePtr | The pointer to the target sample. |
AudioBitDepth | bitDepth | |
System.Byte | channels |
MakeUnsigned(Byte*, SampleFormat)
Declaration
protected static void MakeUnsigned(byte *sourcePtr, SampleFormat format)
Parameters
Type | Name | Description |
---|---|---|
System.Byte* | sourcePtr | |
SampleFormat | format |
ToInt24(Byte*, Int32)
Returns a 24-bit signed integer converted from three bytes at a specified position in a byte array pointer.
Declaration
protected static int ToInt24(byte *arrayPtr, int startIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Byte* | arrayPtr | A pointer to an array of bytes that includes the three bytes to convert. |
System.Int32 | startIndex | The starting position within |
Returns
Type | Description |
---|---|
System.Int32 | A 32-bit signed integer formed by three bytes beginning at |
UpmixChannels(Byte[], Byte, Byte, SampleFormat)
Up-mixes an audio sample by duplicating channels.
Declaration
protected static void UpmixChannels(byte[] buffer, byte srcChannels, byte destChannels, SampleFormat format)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | The target buffer. |
System.Byte | srcChannels | The amount of channels available in the buffer. |
System.Byte | destChannels | The destination amount of channels. |
SampleFormat | format | The format of the samples. |
WriteInt24ToBuffer(Byte*, Int32, Int32)
Directly writes a 24-bit integer value to a buffer. Only the first 3 bytes of the provided System.Int32 are used.
Declaration
protected static void WriteInt24ToBuffer(byte *bufferPtr, int offset, int i24)
Parameters
Type | Name | Description |
---|---|---|
System.Byte* | bufferPtr | The pointer to the target buffer. |
System.Int32 | offset | The location in the provided buffer the integer should be written to. |
System.Int32 | i24 | The target 24-bit integer to write. The last byte is ignored. |