First time here? Check out the FAQ!
x

How to clear an EventVariable array

+1 vote
298 views

Hi,

I'm trying to write a small sequencer/buttonpush-recorder in a SoundToGlobalController.

It more or less works, but now I want to push a single button and clear the entire recorded sequence/EventVariable array.

Is there a clever way to do that? Or do I have to write a zero into every single position in my array going at it one by one?

Here is my code:

| anArray |

anArray := EventVariable new size: 500.

(!clearSeq true: (((anArray @< !WritePtr) <~ 0)) false: (nil)).

(!RecordOn true: ((anArray @< !WritePtr) <~ (!column * (!Row eq: 2))) false: (nil)),

(anArray @< !ReadPtr rounded)

asked Jul 18, 2018 in Capytalk & Smalltalk by anders-skibsted (Adept) (1,320 points)
its great to see some EventVariable Array assignment code!  This is such a powerful feature, an event driven array in Capytalk.

1 Answer

+1 vote
 
Best answer
Your way will work. But maybe there is a way to have two arrays and alternate between them?
answered Jul 18, 2018 by ssc (Savant) (128,000 points)
selected Jul 19, 2018 by anders-skibsted
The two array way might be good. I just have to have the same button write a lot of  0 into my original array...
I had just hoped for a magic button that would clear it for me, but this will work.
Thanks!
...