![]() |
DSPatch
v.2.42
C++ Cross-Platform, Object-Oriented, Flow-Based Programming Library
|
Abstract base class for all DSPatch components. More...
#include <DspComponent.h>
Public Member Functions | |
void | SetComponentName (std::string componentName) |
std::string | GetComponentName () const |
void | SetParentCircuit (DspCircuit *parentCircuit) |
DspCircuit * | GetParentCircuit () |
template<class FromOutputType , class ToInputType > | |
bool | ConnectInput (DspComponent *fromComponent, FromOutputType fromOutput, ToInputType toInput) |
template<class FromOutputType , class ToInputType > | |
bool | ConnectInput (DspComponent &fromComponent, FromOutputType fromOutput, ToInputType toInput) |
template<class FromOutputType , class ToInputType > | |
void | DisconnectInput (DspComponent *fromComponent, FromOutputType fromOutput, ToInputType toInput) |
template<class FromOutputType , class ToInputType > | |
void | DisconnectInput (DspComponent &fromComponent, FromOutputType fromOutput, ToInputType toInput) |
void | DisconnectInput (unsigned short inputIndex) |
void | DisconnectInput (std::string inputName) |
void | DisconnectInput (DspComponent *inputComponent) |
void | DisconnectInputs () |
unsigned short | GetInputCount () const |
unsigned short | GetOutputCount () const |
bool | FindInput (std::string signalName, unsigned short &returnIndex) const |
bool | FindInput (unsigned short signalIndex, unsigned short &returnIndex) const |
bool | FindOutput (std::string signalName, unsigned short &returnIndex) const |
bool | FindOutput (unsigned short signalIndex, unsigned short &returnIndex) const |
void | Tick () |
void | Reset () |
virtual void | StartAutoTick () |
virtual void | StopAutoTick () |
virtual void | PauseAutoTick () |
virtual void | ResumeAutoTick () |
void | SetBufferCount (unsigned short bufferCount) |
unsigned short | GetBufferCount () const |
void | ThreadTick (unsigned short threadNo) |
void | ThreadReset (unsigned short threadNo) |
bool | SetInputSignal (unsigned short inputIndex, const DspSignal *newSignal) |
bool | SetInputSignal (unsigned short inputIndex, unsigned short threadIndex, const DspSignal *newSignal) |
DspSignal * | GetOutputSignal (unsigned short outputIndex) |
DspSignal * | GetOutputSignal (unsigned short outputIndex, unsigned short threadIndex) |
Protected Member Functions | |
virtual void | Process_ (DspSignalBus &inputs, DspSignalBus &outputs) |
bool | AddInput_ (std::string inputName="") |
bool | AddOutput_ (std::string outputName="") |
void | ClearInputs_ () |
void | ClearOutputs_ () |
Abstract base class for all DSPatch components.
Classes derived from DspComponent can be added to an DspCircuit and routed to and from other DspComponents. On construction, derived classes must configure the component's IO buses by calling AddInput_() and AddOutput_() respectively. Derived classes must also implement the virtual method: Process_(). The Process_() method is a callback from the DSPatch engine that occurs when a new set of input signals is ready for processing. The Process_() method has 2 parameters: the input bus and the output bus. This method's purpose is to pull its required inputs out of the input bus, process these inputs, and populate the output bus with the results (see DspSignalBus).
In order for a component to do any work it must be ticked over. This is performed by repeatedly calling the Tick() and Reset() methods. The Tick() method is responsible for acquiring the next set of input signals from component input wires and populating the component's input bus. To insure that these inputs are up-to-date, the dependent component first calls all of its input components' Tick() methods -hence recursively called in all components going backward through the circuit (This is what's classified as a "pull system"). The acquired input bus is then passed to the Process_() method. The Reset() method then informs the component that the last circuit traversal has completed and hence can execute the next Tick() request. A component's Tick() and Reset() methods can be called in a loop from the main application thread, or alternatively, by calling StartAutoTick(), a seperate thread will spawn, automatically calling Tick() and Reset() methods continuously (This is most commonly used to tick over an instance of DspCircuit).
Definition at line 61 of file DspComponent.h.