HadronPlugin base class for all Hadron plugins



HadronPlugin is the base class which all user created plugins must inherit.


See also: Hadron Writing-Hadron-Plugins HadronModTargetControl


Methods and Variables Provided for Plugin Development


The plugin interface is designed to get out of your way when you are writing your own classes, as much as possible. But there is some glue code you need to fill for sure. Here are the list of variables and their descriptions provided for you.


Supplied Variables:


inBusses: This is an array of audio busses (see: Bus) that holds the input busses of your plugin. The size of the array is  determined by the number of input channels you define in your *new class method. You should get the audio from these busses (in our case, there are two inputs and they are inBusses[0] and inBusses[1]) using InFeedback. These busses should be sent as arguments to your synth.


outBusses: This is an array of audio busses (see: Bus) that holds the output busses of your plugin. The size of the array is  determined by the number of output channels you define in your *new class method. You should write to those busses with Out. These busses should be sent as arguments to your synth.


uniqueID: An Integer between 0 and 65536 unique to the instances of your plugins. Every plugin active in a running Hadron system has a uniqueID. This number is provided to you by the HadronPlugin interface.


ident: The ident text as String, if supplied by the user.


window: This is an instance of CompositeView. You should use this as the parent view when drawing your widgets to your GUI. This window is embedded into the outerWindow (which you should not use) which shows the standard In/Outs, Kill and Hide buttons for all plugins. The bounds of the canvas are defined in your *new method.


extraArgs: If extra arguments for your objects are supplied by the user, they are stored in this variable. This is an array of Strings. You might want to check out the source codes of HrStereoMixer and HrStereoSplitter to see them in action.


saveGets: An uninitialized Array you should fill with functions that will return the values you need to save when the user saves the state of his / her patch, when evaluated. For example, if you need to save the values of a NumberBox and a Slider, you need to say:


saveGets = [ { myNumBox.value; }, { mySlider.value; } ];


saveSets: An uninitialized Array you should fill with functions that will set the values of the parameters saved from obtaining the values of functions from the saveGets variable. The functions will be passed the saved value. The ordering must be same with the functions declared in the saveGets variable. So the companion for the above saveGets variable will be:


saveSets = [{|argVal| myNumBox.valueAction_(argVal);}, {|argVal| mySlider.valueAction_(argVal);} ];


modSets: This is an empty Dictionary. If you want any of the controls / values of your plugin to be modulatable, you should fill this dictionary with key - value pairs where keys will be the descriptive names you give to the modulatable parameters, and the values will be functions (that will be passed values by the system) which should get the argument and do the relevant action for modulation. So if we have a level slider in our GUI and want it to be modulatable with the help of HadronModTargetControl (see its help for more info) we might put:


modSets.put(\level, {|argVal| myLevelSlider.valueAction_(argVal); });


modGets: This is essentially the same with modSets (a dictionary), but in the functions, you should return the value instead of setting one. So the complementary modGets for the above modSets would be:


modGets.put(\level, { myLevelSlider.value; }); //returns value


group: This is a Group reserved for your synth. Your Groups and Synths should have this group in their targets. See Synth and Group help for more info.


Supplied Methods:


updateBusConnections: This method is called when a connection change relevant to your plugins input or output busses occur. In this method, you should notify your synth instances about the change by sending the inBusses and outBusses Bus holders as arguments. To see an example of doing this, consult to the Writing-Hadron-Plugins help. You can also check out the sources of the provided plugins with your Hadron distribution.


cleanUp: This method is called when your plugin instance is being killed. You should free any private resources you allocate during the life time of your plugin. The supplied Group "group" is freed automatically, so any nodes attached to the group will be freed automatically for you.


notifyPlugKill(argPlugin): This method is called when ANY of the running instances is being killed. If your system and/or GUI state is dependent on other running plugins, you should take care of the removal in this method. The instance of plugin being killed is sent as an argument to this method. To see an example of how this might be necessary, check the sources of the supplied HrSimpleModulator plugin.


notifyPlugAdd(argPlugin): This is the same with notifyPlugKill, but called only when a new plugin instance is introduced to the system. the new plugin instance is sent as an argument to this method. To see an example of how this might be necessary, check the sources of the supplied HrSimpleModulator plugin.


wakeFromLoad: If your plugins saved state in the Hadron environment is dependent on all other plugins being alive, you should do necessary operations in this method. This method is called when all other plugins are loaded from a saved file, and is in the active state. To see an example of how this might be necessary, check the sources of the supplied HrSimpleModulator plugin.


collide: When the user presses the "Collide" button from the main Hadron GUI, this method in all alive plugins is called.


To find out more about plugin development by inheriting this class see: Writing-Hadron-Plugins