Gnash
0.8.11dev
|
Definition of an embedded sound. More...
#include <StreamingSoundData.h>
Public Types | |
typedef std::list< InputStream * > | Instances |
Container for the active instances of this sounds being played. More... | |
Public Member Functions | |
StreamingSoundData (media::SoundInfo info, int nVolume) | |
Construct a sound with given data, info and volume. More... | |
~StreamingSoundData () | |
size_t | append (SimpleBuffer data, size_t sampleCount, int seekSamples) |
Append a sound data block. More... | |
bool | empty () const |
Do we have any data? More... | |
const SimpleBuffer & | getBlock (size_t index) const |
size_t | getSampleCount (size_t index) const |
size_t | getSeekSamples (size_t index) const |
size_t | blockCount () const |
size_t | playingBlock () const |
bool | isPlaying () const |
Are there known playing instances of this sound ? More... | |
size_t | numPlayingInstances () const |
Return number of playing instances of this sound. More... | |
void | getPlayingInstances (std::vector< InputStream *> &to) const |
Append to the given vector all playing instances of this sound def. More... | |
InputStream * | firstPlayingInstance () const |
Return the first created instance of this sound. More... | |
std::unique_ptr< StreamingSound > | createInstance (media::MediaHandler &mh, unsigned long blockOffset) |
Create an instance of this sound. More... | |
void | clearInstances () |
Drop all active sounds. More... | |
Instances::iterator | eraseActiveSound (Instances::iterator i) |
Drop an active sound (by iterator) More... | |
void | eraseActiveSound (InputStream *inst) |
Drop an active sound (by pointer) More... | |
Public Attributes | |
media::SoundInfo | soundinfo |
Object holding information about the sound. More... | |
int | volume |
Definition of an embedded sound.
typedef std::list<InputStream*> gnash::sound::StreamingSoundData::Instances |
Container for the active instances of this sounds being played.
NOTE: This class does NOT own the active sounds
gnash::sound::StreamingSoundData::StreamingSoundData | ( | media::SoundInfo | info, |
int | nVolume | ||
) |
Construct a sound with given data, info and volume.
info | encoding info |
nVolume | initial volume (0..100). |
gnash::sound::StreamingSoundData::~StreamingSoundData | ( | ) |
References clearInstances().
size_t gnash::sound::StreamingSoundData::append | ( | SimpleBuffer | data, |
size_t | sampleCount, | ||
int | seekSamples | ||
) |
Append a sound data block.
data | Undecoded sound data. Must be appropriately padded (see MediaHandler::getInputPaddingBytes()) |
sampleCount | The number of samples when decoded. |
seekSamples | Where to start playing from at a particular frame. |
Referenced by gnash::sound::sound_handler::addSoundBlock().
|
inline |
References gnash::key::i.
void gnash::sound::StreamingSoundData::clearInstances | ( | ) |
Drop all active sounds.
Locks _soundInstancesMutex
Referenced by gnash::sound::sound_handler::stopAllEventSounds(), and ~StreamingSoundData().
std::unique_ptr< StreamingSound > gnash::sound::StreamingSoundData::createInstance | ( | media::MediaHandler & | mh, |
unsigned long | blockOffset | ||
) |
Create an instance of this sound.
The returned instance ownership is transferred
mh | The MediaHandler to use for on-demand decoding |
blockOffset | Block number in the immutable (encoded) data this instance should start decoding. This refers to a specific StreamSoundBlock. |
Referenced by gnash::sound::sound_handler::playStream().
|
inline |
Do we have any data?
Referenced by gnash::sound::sound_handler::playStream().
StreamingSoundData::Instances::iterator gnash::sound::StreamingSoundData::eraseActiveSound | ( | Instances::iterator | i | ) |
Drop an active sound (by iterator)
Does NOT lock the _soundInstancesMutex
Referenced by eraseActiveSound(), and gnash::sound::StreamingSound::~StreamingSound().
void gnash::sound::StreamingSoundData::eraseActiveSound | ( | InputStream * | inst | ) |
Drop an active sound (by pointer)
inst | The active sound instance to unregister |
This is intended to be called by StreamingSoundDataInst destructor, which may be called by a separate thread so MUST be thread-safe
Does lock the _soundInstancesMutex
References eraseActiveSound(), and gnash::log_error().
InputStream * gnash::sound::StreamingSoundData::firstPlayingInstance | ( | ) | const |
Return the first created instance of this sound.
Locks _soundInstancesMutex
|
inline |
Referenced by gnash::sound::StreamingSound::StreamingSound().
void gnash::sound::StreamingSoundData::getPlayingInstances | ( | std::vector< InputStream *> & | to | ) | const |
Append to the given vector all playing instances of this sound def.
Referenced by gnash::sound::sound_handler::stopAllEventSounds().
|
inline |
|
inline |
bool gnash::sound::StreamingSoundData::isPlaying | ( | ) | const |
Are there known playing instances of this sound ?
Locks _soundInstancesMutex
Referenced by gnash::sound::sound_handler::playStream().
size_t gnash::sound::StreamingSoundData::numPlayingInstances | ( | ) | const |
Return number of playing instances of this sound.
Locks _soundInstancesMutex
size_t gnash::sound::StreamingSoundData::playingBlock | ( | ) | const |
media::SoundInfo gnash::sound::StreamingSoundData::soundinfo |
Object holding information about the sound.
int gnash::sound::StreamingSoundData::volume |
Volume for AS-sounds, range: 0-100. It's the SWF range that is represented here.
Referenced by gnash::sound::StreamingSound::StreamingSound().