I am trying to create some classes for my GUI's - the general idea is captured in the code below (lifted from various help-files etc.) and modified a bit. This (rudimentary) class compiles and does a simple job. It may require some re-writing in the interests of best-practice etc. Particular question: how do I put the synthdef name in a variable that I can set when I write in the arguments on instantiation? I imagine this will be connected to "getter / setter" elements. The "getter" parts of this class work. The writing in of arguments does not however.....Any information on the particular question or other observations in relation to best practice in this case would be much appreciated.
this way you can have multiple instances of YourGuiClass. You used classvar in your code - if you made synthDefName a classvar you could only have one type of synthdef. This way everytime you call YourGuiClass.new(\someSynthDefName) it will store its own synthdef name in its instance variable synthDefName, which you can access like so:
~gui = YourGuiClass.new(\bleepSynthDef);
~gui.synthDefName //prints the name of the synthdef this object controls
~gui.synthDefName = \blorpSynthDef //sets it to play a different synth
The code I posted above was just off the top of my head, it might need a bit of tweaking to actually work.