#include <gapecontroller.h>
Inheritance diagram for GapeController::
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. |
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.
Definition at line 45 of file gapecontroller.h.
|
The constructor.
Definition at line 54 of file gapecontroller.h. |
|
Sets the frequency. Usually some slider is attached to this. Should call emitFreq() at the end regardless.
Definition at line 67 of file gapecontroller.h. |
|
Sets the gain. Usually some slider is attached to this. Should call emitGain() at the end regardless.
Definition at line 75 of file gapecontroller.h. |
|
Sets the gain in db. Usually some slider is attached to this. Should call emitGainDb() at the end regardless.
Definition at line 83 of file gapecontroller.h. |
|
Requests solo mode. Usually some checkbox is attached to this. Should call emitSolo() at the end regardless.
Definition at line 91 of file gapecontroller.h. |
|
Requests mute mode. Usually some checkbox is attached to this. Should call emitMute() at the end regardless.
Definition at line 99 of file gapecontroller.h. |
|
sets the number of channels. Should call emitNumChannels() at the end.
Definition at line 107 of file gapecontroller.h. |
|
Re-implemetation of Qt's custom event handling for our needs.
Definition at line 143 of file gapecontroller.h. |