Sound input stream.
More...
#include <base/sound/SoundInputStream.h>
Inherits Object.
Sound input stream.
Sound input stream.
- See also
- SoundOutputStream
- Version
- 1.0
◆ SoundInputStream()
SoundInputStream::SoundInputStream |
( |
unsigned int |
samplingRate, |
|
|
unsigned int |
channels |
|
) |
| |
Initializes the sound input device. Common sampling rates are 5000Hz, 8000Hz, 11025Hz, 22050Hz, 44100Hz, and 48000Hz.
- Parameters
-
samplingRate | The sampling rate specified in samples per second. |
channels | The number of channels (must be greater than 0). |
◆ ~SoundInputStream()
SoundInputStream::~SoundInputStream |
( |
| ) |
|
|
noexcept |
Destructs the stream object.
◆ available()
unsigned int SoundInputStream::available |
( |
| ) |
const |
|
noexcept |
Returns the number of available samples.
◆ getChannels()
unsigned int SoundInputStream::getChannels |
( |
| ) |
const |
|
noexcept |
Returns the number of channels (greater than 0).
◆ getPosition()
unsigned int SoundInputStream::getPosition |
( |
| ) |
const |
|
noexcept |
Returns the total number of samples since the last resume.
◆ getRate()
unsigned int SoundInputStream::getRate |
( |
| ) |
const |
|
noexcept |
Returns the sampling rate (samples per second).
◆ pause()
void SoundInputStream::pause |
( |
| ) |
|
|
noexcept |
◆ read()
unsigned int SoundInputStream::read |
( |
void * |
buffer, |
|
|
unsigned int |
size |
|
) |
| |
Fills the specified buffer with bytes from the stream. In blocking mode the method does not return until all bytes have been read. In non-blocking mode the total bytes read may be any number below or equal to the requested number of bytes. Attempting to read beyond the end of a stream in blocking mode results in an EndOfFile exception.
- Parameters
-
buffer | The buffer to receive the bytes. |
size | The size of the buffer. |
- Returns
- The actual number of bytes read from the stream.
◆ reset()
void SoundInputStream::reset |
( |
| ) |
|
|
noexcept |
◆ resume()
void SoundInputStream::resume |
( |
| ) |
|
|
noexcept |