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

GapeUnitGroup Class Reference

This is simply a generic container for GapeUnits. More...

#include <gapeunitgroup.h>

Inheritance diagram for GapeUnitGroup::

GapeUnit List of all members.

Public Slots

virtual void receiveTick (const GapeFloat *values, int numValues)
 Pure virtual function that all subclasses of GapeUnit must define. More...

virtual void addUnit (GapeUnit *u)
 Adds a new unit to the group. More...

virtual void removeUnit (GapeUnit *u)
 Removes the unit from the group. More...

virtual int getNumUnits ()
 Returns the number of units in this group. More...

virtual GapeUnitgetUnit (int index)
 Gets the unit at the specified place in the storage array. More...

virtual void requestSolo (GapeUnit *requestingUnit)
 Requests that the parent mute all other units besides the one making the request. More...

virtual void endSolo (GapeUnit *requestingUnit)
 Unmutes all other units in the group when the currently soloed unit ends its solo mode. More...

virtual void addController (GapeController *c)
 Adds a controller for this unit. More...

virtual void removeController (GapeController *c)
 Removes a controller for this unit. More...


Public Methods

 GapeUnitGroup (GapeController *c=NULL, int capacity=GAPE_DEFAULT_GROUP_CAPACITY)
 The constructor. More...

virtual ~GapeUnitGroup ()
 The destructor.


Protected Attributes

GapeUnit** units
int numUnits
int currentCapacity

Detailed Description

This is simply a generic container for GapeUnits.

This is not an abstract class and can be instantiated. It simply contains an array of GapeUnit*, and shifts them accordingly when units are added or removed. New units are put at the end. The receiveTick / emitTick chain is handled as follows: When GapeUnitGroup receives a tick, it calls recieveTick on the first unit in its array, whose emitTick is connected to the next unit's recieveTick, whose emitTick is connected to the next units receiveTick, etc... When the final unit emits a tick, this signal is hooked to the UnitGroup's emitTick signal, and so it emits the same tick. Thus, a GapeUnitGroup can be used like any other unit, and it will simply work like a serial chain of devices. This container will grow dynamically if more units than its capacity are created, so there is no need to worry about adding too many units for it to handle. All subclasses which override the array handling of this class should guarantee the same behavior. Keep in mind that a unit group deletes all of its children when it's deleted. When the group is empty or muted, the group just emits the same tick it recieves, bypassing it's array of units. GapeUnitGroups are useful when creating gui interfaces - for instance, it might help to have separate groups for sources, filters, and outputs. Subclasses of this might implement parallel ticking, or gain and frequency controls which control all of its children.

Author:
Dave Chisholm
Since:
Beta 1.0
Version:
Last Modified Beta 1.0

Definition at line 29 of file gapeunitgroup.h.


Constructor & Destructor Documentation

GapeUnitGroup::GapeUnitGroup ( GapeController * c = NULL,
int capacity = GAPE_DEFAULT_GROUP_CAPACITY )
 

The constructor.

Parameters:
c   An optional graphical controller
capacity   The recommended initial capacity of the group. Will grow dynamically if more than this many units are added

Definition at line 7 of file gapeunitgroup.cpp.


Member Function Documentation

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

Pure virtual function that all subclasses of GapeUnit must define.

This function is the primary function in the GapeUnit environment. See class documentation for more info.

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 47 of file gapeunitgroup.h.

Referenced by addUnit(), and removeUnit().

void GapeUnitGroup::addUnit ( GapeUnit * u ) [virtual, slot]
 

Adds a new unit to the group.

Parameters:
u   Unit to be added.

Definition at line 26 of file gapeunitgroup.cpp.

void GapeUnitGroup::removeUnit ( GapeUnit * u ) [virtual, slot]
 

Removes the unit from the group.

Exits gracefully if it does not actually own the unit. Does NOT delete the unit!

Parameters:
u   Unit to be removed.
Returns:
True if the unit was found and removed.

Definition at line 52 of file gapeunitgroup.cpp.

int GapeUnitGroup::getNumUnits ( ) [inline, virtual, slot]
 

Returns the number of units in this group.

Returns:
how many units in this group

Definition at line 76 of file gapeunitgroup.h.

GapeUnit * GapeUnitGroup::getUnit ( int index ) [virtual, slot]
 

Gets the unit at the specified place in the storage array.

Returns NULL if no such unit/

Parameters:
index   The index of the unit to be returned
Returns:
how many units in this group

Definition at line 140 of file gapeunitgroup.cpp.

void GapeUnitGroup::requestSolo ( GapeUnit * requestingUnit ) [virtual, slot]
 

Requests that the parent mute all other units besides the one making the request.

Parameters:
requestingUnit   A pointer to the unit to be played in solo mode

Definition at line 149 of file gapeunitgroup.cpp.

Referenced by GapeUnit::setSolo().

void GapeUnitGroup::endSolo ( GapeUnit * requestingUnit ) [virtual, slot]
 

Unmutes all other units in the group when the currently soloed unit ends its solo mode.

Parameters:
requestingUnit   A pointer to the unit to be played in solo mode

Definition at line 158 of file gapeunitgroup.cpp.

Referenced by GapeUnit::setSolo().

void GapeUnitGroup::addController ( GapeController * c ) [virtual, slot]
 

Adds a controller for this unit.

Attaches the controller to all units which are contained by this group

Parameters:
c   a pointer to the new controller

Reimplemented from GapeUnit.

Definition at line 124 of file gapeunitgroup.cpp.

void GapeUnitGroup::removeController ( GapeController * c ) [virtual, slot]
 

Removes a controller for this unit.

Removes the controller from all contained units

Parameters:
c   a pointer to the new controller

Reimplemented from GapeUnit.

Definition at line 132 of file gapeunitgroup.cpp.


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