Gnash
0.8.10
|
A sound input stream. More...
#include <InputStream.h>
Public Member Functions | |
virtual unsigned int | fetchSamples (boost::int16_t *to, unsigned int nSamples)=0 |
Fetch the given amount of samples, non-blocking and thread-safe. | |
virtual unsigned int | samplesFetched () const =0 |
Return number of samples fetched from this stream. | |
virtual bool | eof () const =0 |
Return true if there'll be no more data to fetch. | |
virtual | ~InputStream () |
A sound input stream.
Instance of this class are sounds you can pull samples from.
The format of the samples you pull is expected to be PCM samples as signed 16bit values in system-endian format.
It is expected that consecutive samples fetched are one for left and one for right stereo channel, in that order (even indexes for left channel, odd indexes for right channel).
Instances of this class would be the input for the gnash Mixer (currently sound_handler) instance.
virtual gnash::sound::InputStream::~InputStream | ( | ) | [inline, virtual] |
virtual bool gnash::sound::InputStream::eof | ( | ) | const [pure virtual] |
Return true if there'll be no more data to fetch.
Implemented in gnash::sound::LiveSound, gnash::sound::EmbedSoundInst, gnash::sound::StreamingSound, and gnash::sound::AuxStream.
virtual unsigned int gnash::sound::InputStream::fetchSamples | ( | boost::int16_t * | to, |
unsigned int | nSamples | ||
) | [pure virtual] |
Fetch the given amount of samples, non-blocking and thread-safe.
to | Output buffer, must be at least nSamples*bytes. (or nSamples items sized, being a container of 16bit values). |
nSamples | Number of samples to fetch. It is expected that the fetcher fetches samples in multiples of 2, being each couple composed by a sample for the left channel and a sample for the right channel, in that order. |
a | SoundException (to be better defined a set of them) if unable to process this and further requests due to internal errors (not if it just happens to complete its source) |
Implemented in gnash::sound::AuxStream.
Referenced by gnash::sound::sound_handler::fetchSamples().
virtual unsigned int gnash::sound::InputStream::samplesFetched | ( | ) | const [pure virtual] |
Return number of samples fetched from this stream.
It is expected for the return to be always a multiple of 2, being each stereo sample unit composed by a sample for the left channel and a sample for the right channel, in that order.
Implemented in gnash::sound::LiveSound, and gnash::sound::AuxStream.
Referenced by gnash::sound::sound_handler::tell(), and gnash::sound::sound_handler::fetchSamples().