[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] functions question



You shouldn't attempt to generate variable names in this way. Always use the data structures provided (i.e dictionaries, arrays etc.). Try to make it work with functions. When things get too complex you can have a look at writing your own classes. Reframe the problem into something that a function returns.

// One solution (not neccesarily the best)
~synthCreate = { var bus, synth;
  bus = Bus.audio(s, 2);
  synth = Synth(\send2, [\in2: bus, \out2: 0], ~mix_group, \addToTail);
  ^[bus, synth]
}

~saw = ~synthCreate.value;

~saw[0]; // the bus
~saw[1]; // the synth

You can now create another function that uses ~synthCreate to generate any amount of these synths and store then in a dictionary, array etc. for easy access.

Hope that helps :)
_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/