Gnash  0.8.11dev
Public Member Functions | Public Attributes
gnash::sound::NullSoundHandler Class Reference

Null sound_handler, for testing or manual fetching of samples. More...

#include <NullSoundHandler.h>

Inheritance diagram for gnash::sound::NullSoundHandler:
gnash::sound::sound_handler

List of all members.

Public Member Functions

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

Public Attributes

sound_handler_mixer

Additional Inherited Members

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

Detailed Description

Null sound_handler, for testing or manual fetching of samples.


Constructor & Destructor Documentation

gnash::sound::NullSoundHandler::NullSoundHandler ( media::MediaHandler m,
sound_handler mixer = 0 
)
inline

Member Function Documentation

void gnash::sound::NullSoundHandler::mix ( boost::int16_t *  outSamples,
boost::int16_t *  inSamples,
unsigned int  nSamples,
float  volume 
)
inlinevirtual

Mix nSamples from inSamples to outSamples, with given volume.

Parameters:
outSamplesThe output samples buffer, to mix to. Must be big enough to contain nSamples. Can be larger.
inSamplesThe input samples buffer, to mix in. It is non-const as this method is allowed to mess with content, for example to apply volume. TODO: why not applying volume upstream ?!
nSamplesThe amount of samples to mix in.
volumeThe volume to apply to input samples, as a fraction (0..1)

TODO: this interface says nothing about how many channels we're going to mix. It should, to be a sane interface. Maybe, a Mixer instance should be created, initialized with number of channels, at each fetching.

Implements gnash::sound::sound_handler.

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


Member Data Documentation

sound_handler* gnash::sound::NullSoundHandler::_mixer

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