HadronModTargetControl a simple control view for Hadron modulator plugins



HadronModTargetControl is a custom view that integrates itself with the rest of Hadron system for your modulator plugins. To see it in action, check out the help file for HrSimpleModulator plugin, and use the plugin in the Hadron environment.


This control consists of 2 PopUpMenus, the left one holding the active plugins in the environment, and the right one holding the modulatable parameters for the selected plugin instance from the left menu. With the methods provided to you by the HadronPlugin interface, you need to keep your control instance up to date with what is happening with the rest of the environment, and it is an easy task. You just need to notify the control about the changes and it will adjust itself accordingly.


See also: Hadron Writing-Hadron-Plugins HrSimpleModulator


Notifying the Control


Notifying the control about the changes in the Hadron environment is easy. You need to use some methods provided to you by the HadronPlugin interface. Let's say you have a HadronModTargetControl instance stored in the variable called "modControl". In your plugin, you should make sure you add these methods to your class:


notifyPlugKill

{|argPlug|

modControl.plugRemoved(argPlug);

}


notifyPlugAdd

{|argPlug|

modControl.plugAdded;

}


wakeFromLoad

{

modControl.doWakeFromLoad;

}


To get more detailed info about the methods here, check out the help file for HadronPlugin.


To save the state of the control, there are special methods provided for you to use inside saveGets and saveSets arrays. If you want to have the ability to save the state of your "modControl", you need to add these into your saveGets and saveSets array:


saveGets = [ { modControl.getSaveValues; } /* additional items here */ ];

saveSets = [ {|argg| modControl.putSaveValues(argg); } /* additional items here */ ];


All the rest will be handled for you. To see all of them coming together check the source of the HrSimpleModulator plugin.


Creation / Class Methods


*new (argParentView, argBounds, argParentApp)

argParentView - The parent view for the control. Should be set to window.

argBounds - Type is Rect. The bounds of the control, 2 menus would be placed automatically inside these bounds.

argParentApp - The parent Hadron instance. Should be set to parentApp.



plugAdded

You should call this method in your plugins notifyPlugAdd method. Does not take any arguments.

notifyPlugAdd

{|argPlug|

modControl.plugAdded;

}



plugRemoved (argPlug)

You should call this method in your plugins notifyPlugKill method. Takes the killed plugin as the argument.

notifyPlugKill

{|argPlug|

modControl.plugRemoved(argPlug);

}



modulateWithValue (argVal)

This method sends the value to your designated target selected from the control GUI.

//somewhere in your code

modControl.modulateWithValue(aValue);

If the value you are modulating affects a GUI widget and you are in a Routine, you might need to use { }.defer around it.



getSaveValues

Should be used to get values for saving the patch into a file, using the saveGets variable provided by HadronPlugin interface.

saveGets = [ { modControl.getSaveValues; } /* additional items here */];



putSaveValues (argValArray)

Should be used to put the saved values back into the plugin, when the state is loaded from a file.

saveSets = [ {|argg| modControl.putSaveValues(argg); } /* additional items here */ ];



doWakeFromLoad

You should call this method in your plugins wakeFromLoad method.

wakeFromLoad

{

modControl.doWakeFromLoad;

}