Gnash  0.8.11dev
Public Member Functions | List of all members
gnash::sound::Mkit_sound_handler Class Reference

Mkit media kit based sound_handler. More...

#include <sound_handler_mkit.h>

Inheritance diagram for gnash::sound::Mkit_sound_handler:
gnash::sound::sound_handler

Public Member Functions

 Mkit_sound_handler (media::MediaHandler *m)
 
 ~Mkit_sound_handler ()
 
virtual int create_sound (std::unique_ptr< SimpleBuffer > data, std::unique_ptr< media::SoundInfo > sinfo)
 
virtual StreamBlockId addSoundBlock (unsigned char *data, unsigned int data_bytes, unsigned int sample_count, int streamId)
 
virtual void stop_sound (int sound_handle)
 
virtual void delete_sound (int sound_handle)
 Discard the sound data for an embedded event sound. More...
 
virtual void reset ()
 Discard all sound inputs (slots and aux streamers) and clear scheduling. More...
 
virtual void stop_all_sounds ()
 Mixed functions: More...
 
virtual int get_volume (int sound_handle)
 
virtual void set_volume (int sound_handle, int volume)
 Sets the volume for a given event sound. More...
 
virtual media::SoundInfoget_sound_info (int soundHandle)
 
virtual void pause ()
 gnash calls this to pause audio More...
 
virtual void unpause ()
 gnash calls this to unpause audio More...
 
virtual unsigned int get_duration (int sound_handle)
 
virtual unsigned int tell (int sound_handle)
 
void plugInputStream (std::unique_ptr< InputStream > in)
 Plug an InputStream to the mixer. More...
 
void fetchSamples (std::int16_t *to, unsigned int nSamples)
 Fetch mixed samples. More...
 
- Public Member Functions inherited from gnash::sound::sound_handler
virtual ~sound_handler ()
 
virtual int create_sound (std::unique_ptr< SimpleBuffer > data, const media::SoundInfo &sinfo)
 Event sound functions: More...
 
virtual void stopEventSound (int sound_handle)
 Remove scheduled requests to play the specified sound buffer slot. More...
 
virtual void stopAllEventSounds ()
 Stop all instances of all playing event sounds. More...
 
void startSound (int id, int loops, const SoundEnvelopes *env, bool allowMultiple, unsigned int inPoint=0, unsigned int outPoint=std::numeric_limits< unsigned int >::max())
 Start playback of an event sound. More...
 
bool isSoundPlaying (int id) const
 Check if an event sound is playing. More...
 
virtual unsigned int get_duration (int sound_handle) const
 Gets the duration in milliseconds of an event sound. More...
 
virtual unsigned int tell (int sound_handle) const
 Gets the playhead position in milliseconds of an event sound. More...
 
virtual int get_volume (int sound_handle) const
 Gets the volume for a given sound buffer slot. More...
 
virtual int createStreamingSound (const media::SoundInfo &sinfo)
 Streaming sound functions: More...
 
virtual void stopStreamingSound (int handle)
 Remove scheduled requests to play the specified sound buffer slot. More...
 
virtual StreamBlockId addSoundBlock (SimpleBuffer data, size_t sampleCount, int seekSamples, int streamId)
 
virtual media::SoundInfoget_sound_info (int handle) const
 Returns a SoundInfo object for the sound with the given id. More...
 
void playStream (int handle, StreamBlockId blockId)
 Start playback of a streaming sound, if not playing already. More...
 
int getStreamBlock (int handle) const
 Get the identifier for the block playing in a specific stream. More...
 
int getFinalVolume () const
 Sound output functions. More...
 
void setFinalVolume (int v)
 Set the volume to apply to mixed output. More...
 
void mute ()
 Call this to mute audio. More...
 
void unmute ()
 Call this to unmute audio. More...
 
bool is_muted () const
 Returns whether or not sound is muted. More...
 
bool isPaused () const
 return true if audio is paused More...
 
virtual InputStreamattach_aux_streamer (aux_streamer_ptr ptr, void *udata)
 Plug an external InputStream into the mixer. More...
 
virtual void unplugInputStream (InputStream *id)
 Unplug an external InputStream from the mixer. More...
 
size_t numSoundsStarted () const
 Special test-fuction. Reports how many times a sound has been started. More...
 
size_t numSoundsStopped () const
 Special test-fuction. Reports how many times a sound has been stopped. More...
 
virtual void mix (std::int16_t *outSamples, std::int16_t *inSamples, unsigned int nSamples, float volume)
 Mix nSamples from inSamples to outSamples, with given volume. More...
 
void setAudioDump (const std::string &wavefile)
 Request to dump audio to the given filename. More...
 
bool streamingSound () const
 Check if a streaming sound is playing. More...
 

Additional Inherited Members

- Public Types inherited from gnash::sound::sound_handler
typedef unsigned long StreamBlockId
 Identifier of a streaming sound block. More...
 
- Protected Member Functions inherited from gnash::sound::sound_handler
 sound_handler (media::MediaHandler *m)
 
virtual void unplugAllInputStreams ()
 Unplug all input streams. More...
 
bool hasInputStreams () const
 Does the mixer have input streams ? More...
 
virtual void delete_all_sounds ()
 Stop and delete all sounds. More...
 

Detailed Description

Mkit media kit based sound_handler.

Constructor & Destructor Documentation

§ Mkit_sound_handler()

gnash::sound::Mkit_sound_handler::Mkit_sound_handler ( media::MediaHandler m)

References _.

Referenced by gnash::sound::create_sound_handler_mkit().

§ ~Mkit_sound_handler()

gnash::sound::Mkit_sound_handler::~Mkit_sound_handler ( )

Member Function Documentation

§ addSoundBlock()

sound_handler::StreamBlockId gnash::sound::Mkit_sound_handler::addSoundBlock ( unsigned char *  data,
unsigned int  data_bytes,
unsigned int  sample_count,
int  streamId 
)
virtual

§ create_sound()

int gnash::sound::Mkit_sound_handler::create_sound ( std::unique_ptr< SimpleBuffer data,
std::unique_ptr< media::SoundInfo sinfo 
)
virtual

§ delete_sound()

void gnash::sound::Mkit_sound_handler::delete_sound ( int  sound_handle)
virtual

Discard the sound data for an embedded event sound.

Only embedded event sounds are deleted; this happens when the associated sound_sample is deleted.

Parameters
sound_handleThe id for the event sound to be deleted

Reimplemented from gnash::sound::sound_handler.

References gnash::sound::sound_handler::delete_sound().

§ fetchSamples()

void gnash::sound::Mkit_sound_handler::fetchSamples ( std::int16_t *  to,
unsigned int  nSamples 
)
virtual

Fetch mixed samples.

We run through all the plugged InputStreams fetching decoded audio blocks and mixing them into the given output stream.

Parameters
toThe buffer to write mixed samples to. Buffer must be big enough to hold nSamples samples.
nSamplesThe amount of samples to fetch. NOTE: this number currently refers to "mono" samples due to some bad design decision. It is so expected that the user fetches 44100 * 2 samples which has to be interpreted as series of left,right channel couples. TODO: use actual number of samples so that it's expected to fetch 44100 per second and let expose a function to give interpretation of what comes back (how many bytes per channel, which format).

Reimplemented from gnash::sound::sound_handler.

References gnash::sound::sound_handler::fetchSamples(), fill, gnash::sound::sound_handler::hasInputStreams(), gnash::log_debug(), and gnash::sound::sound_handler::pause().

Referenced by ~Mkit_sound_handler().

§ get_duration()

unsigned int gnash::sound::Mkit_sound_handler::get_duration ( int  sound_handle)
virtual

§ get_sound_info()

media::SoundInfo * gnash::sound::Mkit_sound_handler::get_sound_info ( int  soundHandle)
virtual

§ get_volume()

int gnash::sound::Mkit_sound_handler::get_volume ( int  sound_handle)
virtual

§ pause()

void gnash::sound::Mkit_sound_handler::pause ( )
virtual

gnash calls this to pause audio

Reimplemented from gnash::sound::sound_handler.

References _, gnash::log_debug(), and gnash::sound::sound_handler::pause().

§ plugInputStream()

void gnash::sound::Mkit_sound_handler::plugInputStream ( std::unique_ptr< InputStream in)
virtual

Plug an InputStream to the mixer.

Parameters
inThe InputStream to plug, ownership transferred

Reimplemented from gnash::sound::sound_handler.

References gnash::log_debug(), gnash::sound::sound_handler::plugInputStream(), and gnash::sound::sound_handler::unpause().

§ reset()

void gnash::sound::Mkit_sound_handler::reset ( )
virtual

Discard all sound inputs (slots and aux streamers) and clear scheduling.

Gnash calls this on movie restart.

The function should stop all sounds and get ready for a "parse from scratch" operation.

Reimplemented from gnash::sound::sound_handler.

References gnash::sound::sound_handler::delete_all_sounds(), and gnash::sound::sound_handler::stop_all_sounds().

§ set_volume()

void gnash::sound::Mkit_sound_handler::set_volume ( int  sound_handle,
int  volume 
)
virtual

Sets the volume for a given event sound.

Only used by the AS Sound class

Parameters
sound_handleThe handle of the event sound to set volume for.
volumeA number from 0 to 100 representing a volume level. 100 is full volume and 0 is no volume. The default setting is 100.

Reimplemented from gnash::sound::sound_handler.

References gnash::sound::sound_handler::set_volume().

§ stop_all_sounds()

void gnash::sound::Mkit_sound_handler::stop_all_sounds ( )
virtual

Mixed functions:

Remove all scheduled request for playback of sound buffer slots This applies both to streaming and event sounds.

Reimplemented from gnash::sound::sound_handler.

References gnash::sound::sound_handler::stop_all_sounds().

§ stop_sound()

void gnash::sound::Mkit_sound_handler::stop_sound ( int  sound_handle)
virtual

§ tell()

unsigned int gnash::sound::Mkit_sound_handler::tell ( int  sound_handle)
virtual

§ unpause()

void gnash::sound::Mkit_sound_handler::unpause ( )
virtual

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