Gnash 0.8.9
Public Member Functions

gnash::sound::EmbedSoundInst Class Reference

Instance of a defined sound (EmbedSound) More...

#include <EmbedSoundInst.h>

Inheritance diagram for gnash::sound::EmbedSoundInst:
gnash::sound::InputStream

List of all members.

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.

Detailed Description

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)


Constructor & Destructor Documentation

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.

Parameters:
defThe definition of this sound (where immutable data is kept)
mhThe MediaHandler to use for on-demand decoding
blockIdIdentifier of the encoded block to start decoding from.
See also:
gnash::swf::StreamSoundBlockTag
Parameters:
inPointOffset in output samples this instance should start playing from. These are post-resampling samples (44100 for one second of samples).
outPointOffset 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
envelopesSoundEnvelopes to apply to this sound. May be 0 for none.
loopCountNumber 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().


Member Function Documentation

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.

Parameters:
toOutput buffer, must be at least nSamples*bytes. (or nSamples items sized, being a container of 16bit values).
nSamplesNumber 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.
Returns:
number of samples actually written to the output buffer. If < nSamples this InputStream ran out of data, either temporarly or permanently. Use eof() to tell.
Exceptions:
aSoundException (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.


The documentation for this class was generated from the following files: