Signal class public functions


Signal(void);
Sets the name of the object to "Signal". Sets sampling rate to 44100.

virtual ~Signal();
Deletes the name of the Signal. It is invalid to access the string returned by getName after this destructor is called.

virtual void action(void) = 0;
Generates a new sample wich is accessible through output. Usually called automatically with tick. Generally handled automatically through the Action class.

void clear(void);
Does nothing but can be defined in inherited classes. Used to initialize the state of the signal element.

char const* getName(void) const;
Will return a constant char pointer to the name of the signal. Pointer becomes invalid after the object is destructed.

float getSrate(void);
Returns the sampling rate of the signal object in samples per second.

virtual sampleType output(int channel) = 0;
Must be defined in an inherited class. Will return the current output sample of the object. If there are multiple outputs per sample, then output would usually be passed an channel index.

virtual void printConnections(int flag);
Defined in Generator and Filter classes. Prints any input signals connected to the object.

virtual void printState(void);
Defined in classes derived from Generator and Filter classes. Used to print out the important variables in the object, and useful for debugging.

void setName(const char* newname);
Will copy the newname into the name storage area of the signal object.

virtual void setSrate(float aSrate);
Sets the sampling rate of the signal object. Must be a positive number.

virtual void tick(int newTickNumber) = 0;
Must be defined in an inherited class. Will check if the object needs to be updated to generate another sample. If the object's interal tick counter is equal to newTickNumber then it is assumed that the object is already up to date, and therefore nothing will be done.