Class AudioStream
Represents a single audio stream. An audio stream is responsible for providing audio samples of a certain format to various audio buffers.
Inherited Members
Namespace: Cosmos.System.Audio
Assembly: Cosmos.System2.dll
Syntax
public abstract class AudioStream
Properties
| Improve this Doc View SourceDepleted
A value indicating whether the audio stream contains no further audio data.
Declaration
public abstract bool Depleted { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
PostProcessors
The post-processors to use when reading the stream.
Declaration
public List<AudioPostProcessor> PostProcessors { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<AudioPostProcessor> |
SampleRate
The sample rate, i.e. how many samples correspond to one second of audio. No class should attempt to set the sample rate of an abstract AudioStream without a known type, as it may not support this operation.
Declaration
public abstract uint SampleRate { get; set; }
Property Value
Type | Description |
---|---|
System.UInt32 |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | The given audio stream does not support changing the |
Methods
| Improve this Doc View SourceApplyPostProcessing(AudioBuffer)
Applies all post-processors in the PostProcessors list. All inherited classes should call this method after writing data to a buffer.
Declaration
protected void ApplyPostProcessing(AudioBuffer buffer)
Parameters
Type | Name | Description |
---|---|---|
AudioBuffer | buffer | The target buffer. |
GetPostProcessor<T>()
Gets the first post processor of the given type in the effect chain.
Declaration
public T GetPostProcessor<T>()
where T : AudioPostProcessor
Returns
Type | Description |
---|---|
T | The found post processor. If no post processor of the given type was found, this method returns null. |
Type Parameters
Name | Description |
---|---|
T | The type of the post processor to return. |
Read(AudioBuffer)
Reads samples into the specified buffer and advances the position by the size of the buffer. An AudioStream instance should write the correct type of audio data, depending on the provided buffer.
Declaration
public abstract void Read(AudioBuffer buffer)
Parameters
Type | Name | Description |
---|---|---|
AudioBuffer | buffer | The target buffer. |