Instance of a defined sound (EmbedSound). More...
#include <EmbedSoundInst.h>
Public Member Functions | |
EmbedSoundInst (EmbedSound &def, media::MediaHandler &mh, sound_handler::StreamBlockId blockId, unsigned int inPoint, unsigned int outPoint, const SoundEnvelopes *envelopes, unsigned int loopCount) | |
Create an embedded sound instance. | |
unsigned int | fetchSamples (boost::int16_t *to, unsigned int nSamples) |
Fetch the given amount of samples, non-blocking and thread-safe. | |
unsigned int | samplesFetched () const |
Return number of samples fetched from this stream. | |
bool | eof () const |
Return true if there'll be no more data to fetch. | |
~EmbedSoundInst () | |
Unregister self from the associated EmbedSound. |
Instance of a defined sound (EmbedSound).
This class contains a pointer to the EmbedSound used for playing and a SimpleBuffer to use when decoding is needed.
When the SimpleBuffer is NULL we'll play the EmbedSound bytes directly (we assume they are decoded already)
gnash::sound::EmbedSoundInst::EmbedSoundInst | ( | EmbedSound & | def, | |
media::MediaHandler & | mh, | |||
sound_handler::StreamBlockId | blockId, | |||
unsigned int | inPoint, | |||
unsigned int | outPoint, | |||
const SoundEnvelopes * | envelopes, | |||
unsigned int | loopCount | |||
) |
Create an embedded sound instance.
def | The definition of this sound (where immutable data is kept) | |
mh | The MediaHandler to use for on-demand decoding | |
blockId | Identifier of the encoded block to start decoding from. |
inPoint | Offset in output samples this instance should start playing from. These are post-resampling samples (44100 for one second of samples). | |
outPoint | Offset in output samples this instance should stop playing at. These are post-resampling samples (44100 for one second of samples). Use numeric_limits<unsigned int>::max() for never | |
envelopes | SoundEnvelopes to apply to this sound. May be 0 for none. | |
loopCount | Number of times this instance should loop over the defined sound. Note that every loop begins and ends at the range given by inPoint and outPoint. |
gnash::sound::EmbedSoundInst::~EmbedSoundInst | ( | ) |
Unregister self from the associated EmbedSound.
WARNING: must be thread-safe!
References gnash::sound::EmbedSound::eraseActiveSound().
bool gnash::sound::EmbedSoundInst::eof | ( | ) | const [virtual] |
Return true if there'll be no more data to fetch.
Implements gnash::sound::InputStream.
unsigned int gnash::sound::EmbedSoundInst::fetchSamples | ( | boost::int16_t * | to, | |
unsigned int | nSamples | |||
) | [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) |
Implements gnash::sound::InputStream.
References data.
unsigned int gnash::sound::EmbedSoundInst::samplesFetched | ( | ) | const [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.
Implements gnash::sound::InputStream.