First time here? Check out the FAQ!
x

How do I construct a large array of EventValues in the ExtraValues parameter of the AnalogueSequencer?

0 votes
484 views

The ExtraValues parameter expects an array that starts with an EventValue eg,

#(!Index 1 5 9 4)

I want to generate an array with a large number of EventValues, like:

#(!Index  !osc_index__1  !osc_index__2 ...  !osc_index__100)

 

So what I thought I would do is something like this:

#(!Index) , { 1 to: 100 collect: [ :i | !osc_index__ suffix: i ]}

But that gives me an error:

"Error: The value 3 was used to index OrderedCollection (`Index `osc_index__1) ... this index is out of bounds..."

I've tried every arrangement of brackets I can think of and I always get a similar error or a stack trace. What am I doing wrong?

asked Jul 4, 2016 in Capytalk & Smalltalk by alan-jackson (Virtuoso) (15,840 points)

1 Answer

+3 votes
 
Best answer

The ExtraValues parameter is expecting a list of Arrays. If you specify a single expression in the field, it expects that the expression will be in that form.

For your particular case, you could use:

{ Array with: #(!Index) , ( 1 to: 100 collect: [ :i | !osc_index__ suffix: i ]) }

This constructs an Array with a single entry which is another Array, with the first element being !Index and the remaining elements as your described above.

answered Jul 5, 2016 by ssc (Savant) (128,200 points)
selected Jul 5, 2016 by alan-jackson
Fantastic! That works great.

Thanks
this is a very powerful constructor, thanks for the example
When I enter this into the ExtraValues parameter and press the "accept" button, Kyma encloses the expression in #(...)

//to get this to work I have to delete #(...) and be careful not to click the "accept" button.
We tried out the expression from the answer (above) and did not see the added text you mention. Could you please make sure that you used the expression as listed above?
...