Creating your own effect class

Previous | Next | Home

    So there are two ways to create an effect. Either you use the AEffect record directly, or you create a new class which descends from AudioEffect. The first way is troublesome and I don't really see an advantage to it. So here I'll concentrate on creating your own effect class.

    There is an example project which demonstrates what is explained here. You can download it.

    There are a lot of methods in AudioEffect. To build a basic plugin, you only need to override seven of them. These are the constructor, Process(), getParameterLabel, getParameterDisplay, getParameterName, getParameter and setParameter. To see how to override the constructor and what to do in your own version, see the example project (uExampleEffect.pas). Processing and parameters are described later. Here I want to explain some of the things to do in the overridden constructor.


setProgram(0);
This sets the current program to the first. Programs are explained later.

setNumInputs(1);
Like I said, a plugin processes audio data. For this, it needs inputs and outputs. You can define any number of inputs, but the most used are 1 and 2. The number of inputs and outputs determines wether your plugin is considered a Master effect or not by Cubase. The number of inputs and outputs is also important in the Process() and ProcessReplacing methods, explained later.

setNumOutputs(2);
This sets the number of outputs.

hasVu(TRUE);
Set this to true to tell the host you have a VU. I don't know if this is implemented in Cubase.

canProcessReplacing(TRUE);
Set this to true if you do some processing in ProcessReplacing() as well, and not just in Process().

setUniqueID(FourCharToLong('E', 'x', 'm', 'E'));
You need to fill in four letters to give your plugin a unique id. Cubase uses this to tell plugins apart, so it's VERY important.

suspend;
Calling suspend in the constructor might be necessary, depending on what you do in Suspend().

StrCopy(programName, 'Default');
You need to initialize the program name.