Gnash  0.8.11dev
Public Member Functions | Public Attributes | List of all members
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

Public Member Functions

 NullSoundHandler (media::MediaHandler *m, sound_handler *mixer=nullptr)
 
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...
 
- Public Member Functions inherited from gnash::sound::sound_handler
virtual ~sound_handler ()
 
virtual void stop_all_sounds ()
 Mixed functions: More...
 
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...
 
virtual void delete_sound (int sound_handle)
 Discard the sound data for an embedded event sound. 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 void set_volume (int sound_handle, int volume)
 Sets the volume for a given event sound. 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...
 
virtual void reset ()
 Discard all sound inputs (slots and aux streamers) and clear scheduling. 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...
 
virtual void pause ()
 gnash calls this to pause audio More...
 
virtual void unpause ()
 gnash calls this to unpause audio 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 fetchSamples (std::int16_t *to, unsigned int nSamples)
 Fetch mixed samples. 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...
 

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. More...
 
- Protected Member Functions inherited from gnash::sound::sound_handler
 sound_handler (media::MediaHandler *m)
 
virtual void plugInputStream (std::unique_ptr< InputStream > in)
 Plug an InputStream to the mixer. More...
 
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

Null sound_handler, for testing or manual fetching of samples.

Constructor & Destructor Documentation

§ NullSoundHandler()

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

Member Function Documentation

§ mix()

void gnash::sound::NullSoundHandler::mix ( std::int16_t *  outSamples,
std::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.

Reimplemented from gnash::sound::sound_handler.

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

Member Data Documentation

§ _mixer

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

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