ISoundReader
Declaration
public interface Strawberry.Sound.ISoundReader
Defines an interface for reading and decoding sound data from a stream.
Implements: System.IDisposable
Properties
Stream abstract
Gets the underlying stream that contains the sound data.
Stream Stream { get }
BitsPerSample abstract
Gets the number of bits per sample (bit depth) of the audio data (e.g., 8, 16, 24).
int BitsPerSample { get }
SampleRate abstract
Gets the sample rate of the audio data in samples per second (Hz) (e.g., 44100, 48000).
int SampleRate { get }
Channels abstract
Gets the number of audio channels (e.g., 1 for mono, 2 for stereo).
int Channels { get }
DataSize abstract
Gets the total size of the raw audio data in bytes.
int DataSize { get }
Methods
Read abstract
Reads a sequence of bytes from the audio stream and advances the position within the stream by the number of bytes read.
int Read(byte[] buffer, int offset, int count)
Parameters:
| Name | Type | Description |
|---|---|---|
buffer |
System.Byte[] |
An array of bytes. When this method returns, the buffer contains the specified byte array with the values between offset and (offset + count - 1) replaced by the bytes read from the current source. |
offset |
System.Int32 |
The zero-based byte offset in buffer at which to begin storing the data read from the current stream. |
count |
System.Int32 |
The maximum number of bytes to be read from the current stream. |
Returns: The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero if the end of the stream has been reached.
Seek abstract
Sets the position within the audio data stream.
void Seek(long offset)
Parameters:
| Name | Type | Description |
|---|---|---|
offset |
System.Int64 |
The byte offset to seek to. |
ReadAll abstract
Reads all the audio data from the current position to the end of the stream.
byte[] ReadAll()
Returns: A byte array containing all the remaining audio data.