Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | Examples

Async::SampleFifo Class Reference

A FIFO class for handling audio samples. More...

#include <AsyncSampleFifo.h>

List of all members.

Public Member Functions

Public Attributes


Detailed Description

A FIFO class for handling audio samples.

Author:
Tobias Blomberg / SM0SVX
Date:
2004-03-07
This class implements a FIFO for handling audio samples.

Definition at line 116 of file AsyncSampleFifo.h.


Constructor & Destructor Documentation

Async::SampleFifo::SampleFifo int  fifo_size  )  [explicit]
 

Default constuctor.

Async::SampleFifo::~SampleFifo void   ) 
 

Destructor.


Member Function Documentation

int Async::SampleFifo::addSamples short *  samples,
int  count
 

Add samples to the FIFO.

Parameters:
samples A buffer containing samples to put into the FIFO
count The number of samples to put into the FIFO
Returns:
Return the number of samples that have been put into the FIFO

void Async::SampleFifo::clear void   )  [inline]
 

Clear all samples from the FIFO.

Definition at line 234 of file AsyncSampleFifo.h.

References allSamplesWritten.

bool Async::SampleFifo::empty void   )  const [inline]
 

Check if the FIFO is empty.

Returns:
Returns true if the FIFO is empty or else false

Definition at line 156 of file AsyncSampleFifo.h.

void Async::SampleFifo::flushSamples void   ) 
 

Flush out the samples in the buffer.

bool Async::SampleFifo::full void   )  const
 

Check if the FIFO is full.

Returns:
Returns true if the FIFO is full or else false
This function is used to check if the FIFO is full or not. The FIFO can only reach the buffer full condition if overwrite is false. The overwrite mode is set by the setOverwrite function.

bool Async::SampleFifo::overwrite void   )  const [inline]
 

Check the overwrite mode.

Returns:
Returns true if overwrite is enabled or else false
The FIFO can operate in overwrite or normal mode. When in normal mode, it will not be possible to add any more samples to the FIFO when it is full. Samples has to be removed first. When overwrite is set, newly added samples will overwrite the oldest samples in the buffer so the FIFO will never get full but instead samples are lost. Use this function the check the current overwrite mode. Use the setOverwrite function to set the overwrite mode.

Definition at line 215 of file AsyncSampleFifo.h.

int Async::SampleFifo::readSamples short *  samples,
int  count
 

Read samples from the FIFO.

Parameters:
samples A buffer to put the read samples into
count The number of samples to read. This value must not be larger than the size of the "samples" buffer given in the first argument.
Returns:
Returns the number of samples actually read
This function can be used to read samples from the FIFO if the automatic output of samples is not enabled. Automatic output of samples and this function must not be used at the sample time.

unsigned Async::SampleFifo::samplesInFifo void   )  const
 

Find out how many samples there are in the FIFO.

Returns:
Returns the number of samples in the FIFO

void Async::SampleFifo::setDebugName const std::string &  name  )  [inline]
 

Set a name for this FIFO used for debugging.

Parameters:
name The name to use for this FIFO

Definition at line 252 of file AsyncSampleFifo.h.

void Async::SampleFifo::setOverwrite bool  overwrite  )  [inline]
 

Set the overwrite mode.

Parameters:
overwrite Set to true to overwrite or else false
The FIFO can operate in overwrite or normal mode. When in normal mode, it will not be possible to add any more samples to the FIFO when it is full. Samples has to be removed first. When overwrite is set, newly added samples will overwrite the oldest samples in the buffer so the FIFO will never get full but instead samples are lost. Use this function to set the overwrite mode.

Definition at line 201 of file AsyncSampleFifo.h.

void Async::SampleFifo::setPrebufSamples unsigned  prebuf_samples  ) 
 

Set the number of samples that must be in the fifo before any samples are written out from it.

Parameters:
prebuf_samples The number of samples

void Async::SampleFifo::stopOutput bool  stop  ) 
 

Stop automatic audio output via the writeSamples signal.

Parameters:
stop Set to true to stop audio output or else false
This FIFO has the ability to automatically output audio samples using the writeSamples signal. The samples are output as fast as the receiver can handle them. Flow control is handled by the receiver setting the return value from the writeSamples signal and by calling the writeBufferFull method. When the FIFO run out of samples, the allSamplesWritten signal is emitted. Use this function to enable/disable the automatic output of samples. By default, automatic output is enabled.

void Async::SampleFifo::writeBufferFull bool  is_full  ) 
 

Indicate to the FIFO if the receiver is ready or not to accept more samples.

Parameters:
is_full Set to false if more samples can be accepted or true if not.
This FIFO has the ability to automatically output audio samples using the writeSamples signal. The samples are output as fast as the receiver can handle them. Flow control is handled by the receiver setting the return value from the writeSamples signal and by calling this function. When the FIFO run out of samples, the allSamplesWritten signal is emitted. Use this function to stop or start the output of samples.


Member Data Documentation

SigC::Signal0<void> Async::SampleFifo::allSamplesWritten
 

A signal that is emitted when the FIFO has been emptied.

This FIFO has the ability to automatically output audio samples using the the writeSamples signal. The samples are output as fast as the receiver can handle them. Flow control is handled by the receiver setting the return value from the writeSamples signal and by calling the writeBufferFull function. When the FIFO run out of samples, this signal is emitted.

Definition at line 293 of file AsyncSampleFifo.h.

Referenced by clear().

SigC::Signal1<void, bool> Async::SampleFifo::fifoFull
 

A signal that is emitted when the FIFO is full.

Parameters:
is_full Set to true if the buffer is full or false if the buffer full condition has been cleared

Definition at line 260 of file AsyncSampleFifo.h.

SigC::Signal2<int, short *, int> Async::SampleFifo::writeSamples
 

A signal that is emitted when the FIFO want to output samples.

Parameters:
samples A buffer containing the samples to output
count The number of samples in the output buffer
Returns:
Return the number of samples actually read by the receiver
This FIFO has the ability to automatically output audio samples using the this signal. The samples are output as fast as the receiver can handle them. Flow control is handled by the receiver setting the return value from this signal and by calling the writeBufferFull method. When the FIFO run out of samples, the allSamplesWritten signal is emitted.

If the value returned by the connected slot (receiver) differs from the value of the second argument of this signal (count), output will be stopped until the writeBufferFull function is called. This is how the flow control is handled.

Definition at line 281 of file AsyncSampleFifo.h.


The documentation for this class was generated from the following file:
Generated on Sat Dec 3 00:20:39 2005 for Async by  doxygen 1.4.4