Creating Signal Classes

When creating a new class, you must define two functions:

Those two functions must be defined in order for the class to compile without error, since the functions were declared as undefined virtual functions in the Signal class.

There are a few additional functions which you don't have to define, but it would be elegant programming style if you did so:

When I want to create a new (Filter) class, I usually just copy the Add class and replace the contents of the functions in the new class with different definitions. The Add class is very simple and hardly does anything at all. Here is the header file and the source file which I start with when making a new class.

Here is a technical note: there is a Signal class variable called brandname which can be set to be either FILTER or GENERATOR. This variable is used by the Action class in determining the tickFrozenState array. For examples, the DownSample class pretends to be a generator to the Action class in that case. Avoid using the Action.tickFrozenState if you masquerade a Filter as a Generator when that class is used in feedback -- I don't know what would happen as I havent tried a case like that yet. When masquerading as a Generator, a Filter class prevents the Action.freezeState function from following any upstream connections on the class.







craig@ccrma.stanford.edu