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

Re: [sc-users] functions question



Hi Heinricus -- maybe this is something like what you want?:

~buses = Dictionary.with(*[\saw1, \kick].collect {|name| name -> Bus.audio(s, 2) })

Now you can get that bus with e.g.:

~buses[\saw1]

Tom



On Mon, Dec 12, 2016 at 1:23 AM, Henricus J. Holtman <clfest@xxxxxxxxxx> wrote:
I have in my code reason to write something like this:

~mix_group     = Group();

~saw1_bus       = Bus.audio(s, 2);
~kick_bus       = Bus.audio(s, 2);
...

~saw1_dry_send = Synth(\send2, [\in2: ~saw1_bus, \out2: 0], ~mix_group, \addToTail);
~kick_dry_send = Synth(\send2, [\in2: ~kick_bus, \out2: 0], ~mix_group, \addToTail);
...

In other words a bunch of definitions using 'saw1', 'kick' and so forth in various places. Being lazy, I thought of constructing a function to do this
semi-automatically, something like:

[ \saw1, \kick ... ].do({|thing| "~" ++ thing ++ "_dry_send" = Synth(\send2, [\in2: "~" ++ thing ++ "_bus", \out2: 0], ~mix_group)});

But this, unfortunately, doesn't work. I am aware that furthermore the construction of lvalues might be tricky. Does somebody know
the way to write this function so it performs the required assignments to environment variables saw1_dry_send, kick_dry_send etc.

                                                    Thanks for your attention



--
"Life is just a game, you fly a paper plane, there is no aim." - Thunderclap Newman in Accidents


_______________________________________________
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/