Public Member Functions

gnash::sound::InputStream Class Reference

A sound input stream. More...

#include <InputStream.h>

Inheritance diagram for gnash::sound::InputStream:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual unsigned int fetchSamples (boost::int16_t *to, unsigned int nSamples)=0
 Fetch the given amount of samples, non-blocking and thread-safe.
virtual unsigned int samplesFetched () const =0
 Return number of samples fetched from this stream.
virtual bool eof () const =0
 Return true if there'll be no more data to fetch.
virtual ~InputStream ()

Detailed Description

A sound input stream.

Instance of this class are sounds you can pull samples from.

The format of the samples you pull is expected to be PCM samples as signed 16bit values in system-endian format.

It is expected that consecutive samples fetched are one for left and one for right stereo channel, in that order (even indexes for left channel, odd indexes for right channel).

Instances of this class would be the input for the gnash Mixer (currently sound_handler) instance.


Constructor & Destructor Documentation

virtual gnash::sound::InputStream::~InputStream (  )  [inline, virtual]

Member Function Documentation

virtual bool gnash::sound::InputStream::eof (  )  const [pure virtual]

Return true if there'll be no more data to fetch.

Implemented in gnash::sound::AuxStream, and gnash::sound::EmbedSoundInst.

virtual unsigned int gnash::sound::InputStream::fetchSamples ( boost::int16_t *  to,
unsigned int  nSamples 
) [pure virtual]

Fetch the given amount of samples, non-blocking and thread-safe.

Parameters:
to Output buffer, must be at least nSamples*bytes. (or nSamples items sized, being a container of 16bit values).
nSamples Number 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:
a SoundException (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)

Implemented in gnash::sound::AuxStream, and gnash::sound::EmbedSoundInst.

Referenced by gnash::sound::sound_handler::fetchSamples().

virtual unsigned int gnash::sound::InputStream::samplesFetched (  )  const [pure 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.

Implemented in gnash::sound::AuxStream, and gnash::sound::EmbedSoundInst.

Referenced by gnash::sound::sound_handler::fetchSamples(), and gnash::sound::sound_handler::tell().


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