I'm making a Sound that takes an arbitrary number of inputs, a bit like a Mixer.
My Sound has a Script that I want to iterate over the inputs and do stuff to them.
As a placeholder for the arbitrary number of inputs my Script ("MAIN") has a SoundCollectionVariable in its input.
To build and test this Sound I've put another Script (the "DEV" script) at the end that creates an OrderedCollection of Sounds and passes it to the MAIN Script.
For instance the DEV script would have something like this in it:
| sndCol |
sndCol := OrderedCollection new.
sndCol add: (osc freq: 256 hz).
sndCol add: (osc freq: 2017 hz).
"(Where osc is the name of an Oscillator Sound and mixerInputs is the name of main's SoundCollectionVariable)"
It doesn't work. I get errors that say:
"osc is redeclared. You may have declared it both as a temporary and as a block variable".
But if I replace the "main" Script with a Mixer containing the same SoundCollectionVariable it works fine, I can hear two oscillators purring away.
I'm using the SoundCollectionVariable because ultimately I want to encapsulate my Sound and I want it to have an "Inputs" parameter that can take an arbitrary number of input Sounds.
How do I write a Script that can go through each of its inputs and how can I pass a collection of Sounds to that Script?