Async::AudioValve Class Reference

Implements a "valve" for audio. More...

#include <AsyncAudioValve.h>

Inheritance diagram for Async::AudioValve:
Async::AudioSink Async::AudioSource

List of all members.

Public Member Functions


Detailed Description

Implements a "valve" for audio.

Author:
Tobias Blomberg / SM0SVX
Date:
2006-07-08

This class implements a "valve" for audio. That is, the audio stream can be turned on or off. It's named "valve" since the whole Async audio concept is called audio pipe.

Definition at line 116 of file AsyncAudioValve.h.


Constructor & Destructor Documentation

Async::AudioValve::AudioValve ( void   )  [inline, explicit]

Default constuctor.

Definition at line 122 of file AsyncAudioValve.h.

Async::AudioValve::~AudioValve ( void   )  [inline]

Destructor.

Definition at line 131 of file AsyncAudioValve.h.


Member Function Documentation

virtual void Async::AudioValve::allSamplesFlushed ( void   )  [inline, virtual]

The registered sink has flushed all samples.

This function must be implemented by the inheriting class. This function will be called when all samples have been flushed in the registered sink.

Reimplemented from Async::AudioSource.

Definition at line 305 of file AsyncAudioValve.h.

References Async::AudioSink::sourceAllSamplesFlushed().

void Async::AudioValve::flushSamples ( void   )  [inline, virtual]

Tell the valve to flush the previously written samples.

This function is used to tell the valve to flush previously written samples. When done flushing, the valve will call the allSamplesFlushed function in the connected source object. This function is normally only called from a connected source object.

Reimplemented from Async::AudioSink.

Definition at line 263 of file AsyncAudioValve.h.

References Async::AudioSource::sinkFlushSamples(), and Async::AudioSink::sourceAllSamplesFlushed().

bool Async::AudioValve::isIdle ( void   )  const [inline]

Check if the valve is idle.

Returns:
Return true if the valve is idle or else false

Definition at line 217 of file AsyncAudioValve.h.

bool Async::AudioValve::isOpen ( void   )  const [inline]

Check if the valve is open.

Returns:
Return true if the valve is open or else false

Definition at line 208 of file AsyncAudioValve.h.

void Async::AudioValve::resumeOutput ( void   )  [inline, virtual]

Resume audio output to the sink.

This function must be reimplemented by the inheriting class. It will be called when the registered audio sink is ready to accept more samples. This function is normally only called from a connected sink object.

Reimplemented from Async::AudioSource.

Definition at line 286 of file AsyncAudioValve.h.

References Async::AudioSink::sourceResumeOutput().

void Async::AudioValve::setBlockWhenClosed ( bool  block_when_closed  )  [inline]

Setup audio stream blocking when valve is closed.

Parameters:
block_when_closed When true, block the incoming audio stream when the valve is closed. When false, incoming audio is thrown away when the valve is closed.

Use this method to set if the valve should block or drop the incoming audio stream when the valve is closed.

Definition at line 188 of file AsyncAudioValve.h.

References Async::AudioSink::sourceResumeOutput().

void Async::AudioValve::setOpen ( bool  do_open  )  [inline]

Open or close the valve.

Parameters:
do_open If true the valve is open or else it's closed

This function is used to open or close the audio valve. When the valve is closed, the connected sink is flushed. What is done with the incoming audio when the valve is closed depends on the block_when_closed parameter to the constructor.

Definition at line 142 of file AsyncAudioValve.h.

References Async::AudioSource::sinkFlushSamples(), Async::AudioSink::sourceAllSamplesFlushed(), and Async::AudioSink::sourceResumeOutput().

int Async::AudioValve::writeSamples ( const float *  samples,
int  count 
) [inline, virtual]

Write samples into the valve.

Parameters:
samples The buffer containing the samples
count The number of samples in the buffer
Returns:
Returns the number of samples that has been taken care of

This function is used to write audio into the valve. If it returns 0, no more samples should be written until the resumeOutput function in the source have been called. This function is normally only called from a connected source object.

Reimplemented from Async::AudioSink.

Definition at line 233 of file AsyncAudioValve.h.

References Async::AudioSource::sinkWriteSamples().


The documentation for this class was generated from the following file:
Generated by  doxygen 1.6.2-20100208