Om  1.0.0
A universal framework for multimedia simulation
Public Member Functions | Protected Member Functions | List of all members
om::sound::filters::FilterInputStream Class Reference

A class that wraps a SoundFilter in a SoundInputStream. More...

#include <omSoundFilterInputStream.h>

Inheritance diagram for om::sound::filters::FilterInputStream:
om::sound::base::SoundInputStream

Public Member Functions

 FilterInputStream ()
 Create a filter input stream that doesn't have a SoundFilter to wrap. More...
 
 FilterInputStream (SoundFilter *filter)
 Create a filter input stream that doesn't have a SoundFilter to wrap. More...
 
SoundFiltergetFilter () const
 Return a pointer to the sound filter that this filter input stream is currently wrapping. More...
 
void setFilter (SoundFilter *newFilter)
 Set the sound filter that this filter input stream should use a source of sound data. More...
 
virtual SoundSize getSamplesRemaining () const
 Return the number of samples remaining in the sound input stream. More...
 
virtual SampleIndex getPosition () const
 Return the current position of the stream in samples relative to the start of the stream. More...
 
virtual Size getChannelCount () const
 Return the number of channels that are in the sound input stream. More...
 
virtual SampleRate getSampleRate () const
 Return the sample rate of the sound input stream's source audio data. More...
 
virtual SampleType getNativeSampleType () const
 Return the actual sample type used in the stream. More...
 
virtual Bool isValid () const
 Return whether or not the stream has a valid source of sound data. More...
 
- Public Member Functions inherited from om::sound::base::SoundInputStream
virtual ~SoundInputStream ()
 Destroy this sound input stream and release any resources associated with it. More...
 
SoundResult read (SoundBuffer &buffer, Size numSamples)
 Read the specified number of samples from the input stream into a sound buffer. More...
 
virtual Bool canSeek () const
 Return whether or not seeking is allowed in this input stream. More...
 
virtual Bool canSeek (Int64 relativeSampleOffset) const
 Return whether or not this input stream's current position can be moved by the specified signed sample offset. More...
 
virtual Int64 seek (Int64 relativeSampleOffset)
 Move the current sample frame position in the stream by the specified signed amount. More...
 
Bool hasSamplesRemaining () const
 Return whether or not this sound input stream has any samples remaining in the stream. More...
 

Protected Member Functions

virtual SoundResult readSamples (SoundBuffer &inputBuffer, Size numSamples)
 Read the specified number of samples from the input stream into the output buffer. More...
 

Detailed Description

A class that wraps a SoundFilter in a SoundInputStream.

The filter input stream treats the SoundFilter as a read-only source of sound samples. This allows an output-only filter (e.g. a ToneGenerator, Sampler) to be used anywhere an input stream is required. The resulting stream is not seekable.

The filter stream does not own the filter pointer and does not destruct it upon its own destruction.

Constructor & Destructor Documentation

om::sound::filters::FilterInputStream::FilterInputStream ( )

Create a filter input stream that doesn't have a SoundFilter to wrap.

om::sound::filters::FilterInputStream::FilterInputStream ( SoundFilter filter)

Create a filter input stream that doesn't have a SoundFilter to wrap.

Member Function Documentation

SoundFilter* om::sound::filters::FilterInputStream::getFilter ( ) const
inline

Return a pointer to the sound filter that this filter input stream is currently wrapping.

This pointer can be NULL if the filter input stream has not been provided a sound filter.

void om::sound::filters::FilterInputStream::setFilter ( SoundFilter newFilter)

Set the sound filter that this filter input stream should use a source of sound data.

The filter input stream stores the pointer and uses the filter to read samples as needed. Calling this method resets the stream so that it matches the characteristics of the specified filter. The filter stream does not own the filter pointer and does not destruct it upon its own destruction.

virtual SoundSize om::sound::filters::FilterInputStream::getSamplesRemaining ( ) const
virtual

Return the number of samples remaining in the sound input stream.

Implements om::sound::base::SoundInputStream.

virtual SampleIndex om::sound::filters::FilterInputStream::getPosition ( ) const
virtual

Return the current position of the stream in samples relative to the start of the stream.

Implements om::sound::base::SoundInputStream.

virtual Size om::sound::filters::FilterInputStream::getChannelCount ( ) const
virtual

Return the number of channels that are in the sound input stream.

Implements om::sound::base::SoundInputStream.

virtual SampleRate om::sound::filters::FilterInputStream::getSampleRate ( ) const
virtual

Return the sample rate of the sound input stream's source audio data.

Implements om::sound::base::SoundInputStream.

virtual SampleType om::sound::filters::FilterInputStream::getNativeSampleType ( ) const
virtual

Return the actual sample type used in the stream.

Implements om::sound::base::SoundInputStream.

virtual Bool om::sound::filters::FilterInputStream::isValid ( ) const
virtual

Return whether or not the stream has a valid source of sound data.

Implements om::sound::base::SoundInputStream.

virtual SoundResult om::sound::filters::FilterInputStream::readSamples ( SoundBuffer inputBuffer,
Size  numSamples 
)
protectedvirtual

Read the specified number of samples from the input stream into the output buffer.

This method attempts to read the specified number of samples from the stream into the input buffer. It then returns the total number of valid samples which were read into the output buffer. The samples are converted to the format stored in the input buffer (Sample32f). The input position in the stream is advanced by the number of samples that are read.

The implementor of this method should make sure to set the sample rate of the buffer to be the correct output sample rate.

Implements om::sound::base::SoundInputStream.


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