First time here? Check out the FAQ!
x

"triggerEvery" ... but then stop after ...?

0 votes
342 views
working with a MemoryRecorder and a Replicator, I have the following expression

{!Gate triggerEvery: ?NumberVoices offset: ?VoiceNumber - 1}

Rather than a continuous roundrobin, I would like it to cycle once through the number of voices (let's say 4) and then stop triggering. I suppose it might involve something like  ...

countTriggers eq: 4

But I can't find a way to successfully combine them into this field
asked Jan 7, 2020 in Capytalk & Smalltalk by mark-phillips (Practitioner) (990 points)

1 Answer

+1 vote

You could try combining the !Gate with something that enables the gating for a limited time, for example

{(!Gate countTriggers lt: 5) /\ !Gate) triggerEvery: ?NumberVoices offset: ?VoiceNumber - 1}

is saying "gate only when the number of gates has been fewer than 5 AND there is a Gate signal".

answered Jan 7, 2020 by ssc (Savant) (126,620 points)
/\  ...?

I have never seen this character in a script. It does not appear to be the same as "^" (the carat above the 6). I had to copy it from your answer and paste it into my comment to get it to look like yours. How does one type it into a script?

(Of course... I should have been thinking " lt:5 " instead of eq: 4 in this case)
never mind ... changing the font made it pretty clear it's actually two characters.
Another approach might be:
{(!Gate gateWhen: (!Gate countTriggers eq: ?VoiceNumber))}
...