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

GapeController Class Reference

A core GAPE class. More...

#include <gapecontroller.h>

Inheritance diagram for GapeController::

GapeAudioPlot GapeDelayController GapeMuteController GapeSimpleController GapeFreqDomainPlot GapeTimeDomainPlot GapeWaveformPalette List of all members.

Public Slots

void setFreq (double freq)
 Sets the frequency. More...

void setGain (double gain)
 Sets the gain. More...

void setGainDb (double gain)
 Sets the gain in db. More...

void setSolo (bool s)
 Requests solo mode. More...

void setMute (bool m)
 Requests mute mode. More...

void setNumChannels (int c)
 sets the number of channels. More...


Signals

void emitFreq (double freq)
void emitGain (double gain)
void emitGainDb (double gain)
void emitSolo (bool s)
void emitMute (bool m)
void emitNumChannels (int c)

Public Methods

 GapeController (QWidget *parent=0, const char *name=0)
 The constructor. More...

 ~GapeController ()
 The destructor.


Protected Methods

virtual void requestUpdate ()
 Requests an update from the GUI thread - see class docs for more details.

virtual void customEvent (QCustomEvent *e)
 Re-implemetation of Qt's custom event handling for our needs. More...

virtual void updateDisplay ()
 Should be re-implemented to update the display if necesary - see class docs for more details.


Detailed Description

A core GAPE class.

All GUI elements are derived from this class. GapeControllers are used to control one (or many) underlying GapeUnits using Qt's slots and signals convention. This class implements some common functionality for controls like gain, freq, etc, but these can be ignored if they are not appropriate to the unit they are controlling (ie for a reverb). The class itself is abstract and does not set up any sliders, knobs, etc for control, but classes like GapeSimpleController are available for users who wish to entirely avoid coding their own GUI. You should also check out the (link here) section on using Qt's GUI designer program.

This class also has built in functionality for GUI elements that need to refresh themselves independantly of clicks from the user (ie waveform displays). Because all drawing on the screen must be performed by the same OS GUI thread, GapeControllers can NOT simply call drawing or screen updating functions from the audio thread that is doing the work computing samples (if you are unfamiliar with this topic or with threading in general, just trust me and assume bad things will happen if you break this rule). If a GapeController needs to update its display, it can define the virtual function updateDisplay(), which should refresh the screen appropriately whenever it is called. Users should NOT call this function directly however; instead they should just make a call to requestUpdate(), which will take care of the coordination with the GUI thread, and call updateDisplay when appropriate. If you have a very complex display which needs optimized refreshing, or needs to deal with different types of refresh events, see the GapeRedrawEvent class docs as well as reading about Qt's custom event handling at their documentation site.

The GapeControllerClass has virtual slots like setFreq, setGain, etc to receive messages from things like sliders, knobs, buttons, etc as well as signals emitFreq, emitGain, etc which should signal the underlying GapeUnits. Generally the slots will simply call their corresponding emit function, but occasionally they might want to do some something else, especially if they can be controlled in a non graphic manner. These slots should always emit a signal though, since calling controller->setFreq won't notify the underlying units. These slots could be skipped by wiring the slider and knob signals directly to the GapeUnits, but this is more flexible and also works much better with the Qt GUI designer program.

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

Definition at line 45 of file gapecontroller.h.


Constructor & Destructor Documentation

GapeController::GapeController ( QWidget * parent = 0,
const char * name = 0 ) [inline]
 

The constructor.

Parameters:
parent   The widget which will contain this GUI element.
name   An (optional) name for debugging purposes.

Definition at line 54 of file gapecontroller.h.


Member Function Documentation

void GapeController::setFreq ( double freq ) [inline, slot]
 

Sets the frequency.

Usually some slider is attached to this. Should call emitFreq() at the end regardless.

Parameters:
freq   The new frequency in hz

Definition at line 67 of file gapecontroller.h.

void GapeController::setGain ( double gain ) [inline, slot]
 

Sets the gain.

Usually some slider is attached to this. Should call emitGain() at the end regardless.

Parameters:
freq   The new gain as a floating point coefficient.

Definition at line 75 of file gapecontroller.h.

void GapeController::setGainDb ( double gain ) [inline, slot]
 

Sets the gain in db.

Usually some slider is attached to this. Should call emitGainDb() at the end regardless.

Parameters:
freq   The new gain in db.

Definition at line 83 of file gapecontroller.h.

void GapeController::setSolo ( bool s ) [inline, slot]
 

Requests solo mode.

Usually some checkbox is attached to this. Should call emitSolo() at the end regardless.

Parameters:
s   True if we want solo mode.

Definition at line 91 of file gapecontroller.h.

void GapeController::setMute ( bool m ) [inline, slot]
 

Requests mute mode.

Usually some checkbox is attached to this. Should call emitMute() at the end regardless.

Parameters:
m   True if we want to be muted.

Definition at line 99 of file gapecontroller.h.

void GapeController::setNumChannels ( int c ) [inline, slot]
 

sets the number of channels.

Should call emitNumChannels() at the end.

Parameters:
c   The new number of channels

Definition at line 107 of file gapecontroller.h.

void GapeController::customEvent ( QCustomEvent * e ) [inline, protected, virtual]
 

Re-implemetation of Qt's custom event handling for our needs.

Parameters:
e   Generally is a GapeRedrawEvent.

Definition at line 143 of file gapecontroller.h.


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