Main Page   Class Hierarchy   Compound List   File List   Compound Members   Related Pages  

GapeAccumulator Class Reference

Accumulates samples and sends them out in groups. More...

#include <gapeaccumulator.h>

Inheritance diagram for GapeAccumulator::

GapeUnit List of all members.

Public Slots

virtual void receiveTick (const GapeFloat *values, int numValues)
 The accumulator will save the ticks it receives until its buffer is full, and then emit them. More...

virtual void resizeAccumulator (int newSize)
 Change the size of the buffer the accumulator will save. More...


Public Methods

 GapeAccumulator (int numSamples)
 The constructor. More...

virtual ~GapeAccumulator ()
 The destructor.


Protected Methods

int spaceRemaining ()
void adjustBuffers (int newSize)

Protected Attributes

int d_numSamples
int d_writeIndex
GapeFloatd_samples
QMutex d_mutex
bool resizeNeeded
int resizeSize
int tickCounter

Detailed Description

Accumulates samples and sends them out in groups.

The accumulator class simply receives a specified number of ticks, saves them in a buffer, and emits them all at once. In this way, the "numValues" parameter when it performs emitTick() is used subtly different; generally it specifies how many channels of audio in a single sample cycle are sent, but here it specifies how many samples total are sent. This class is generally meant for mono channels audio (consider using a GapeChannelSplitter for multichannel audio), although its flexible enough to be used in another scheme. I'm not sure if it is threadsafe - I doubt it, but need to look into Randal's code more to be sure.

Author:
Randal Leistikow, Dave Chisholm
Since:
Beta 1.0
Version:
Last Modified Beta 1.0

Definition at line 23 of file gapeaccumulator.h.


Constructor & Destructor Documentation

GapeAccumulator::GapeAccumulator ( int numSamples )
 

The constructor.

Parameters:
numSamples   the number of samples to accumulate before emitting. A non-zero value - if 0 is passed in, the class will assume 1.

Definition at line 4 of file gapeaccumulator.cpp.


Member Function Documentation

void GapeAccumulator::receiveTick ( const GapeFloat * values,
int numValues ) [virtual, slot]
 

The accumulator will save the ticks it receives until its buffer is full, and then emit them.

Parameters:
values   pointer to samples data being sent to the function
numValues   number of floating point values pointed to by "values" (ie number of channels of audio)

Reimplemented from GapeUnit.

Definition at line 21 of file gapeaccumulator.cpp.

Referenced by GapeFreqDomainDisplay::receiveTick(), and GapeTimeDomainDisplay::receiveTick().

void GapeAccumulator::resizeAccumulator ( int newSize ) [virtual, slot]
 

Change the size of the buffer the accumulator will save.

If the new buffer is large enough, the accumulator will just copy its currently saved samples into it. If it is not, it will call emitTick() to send out samples until it has enough room.

Parameters:
values   pointer to samples data being sent to the function
numValues   number of floating point values pointed to by "values" (ie number of channels of audio)

Definition at line 101 of file gapeaccumulator.cpp.


The documentation for this class was generated from the following files:
Generated at Thu Jun 21 13:28:50 2001 for GAPE by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001