First time here? Check out the FAQ!
x

Avoiding an STGC generated value from jumping to value when re-activated

0 votes
304 views
Hi

I'm continuing my explorations with integrating Monone gear with Kyma which is going well so far and i'm quite some way into creating a bi-directional control surface for NEL's excellent GlobSeq.  

I'm building in lots of functionality where the Monome's send and receive different data depending on when buttons on the Monone Grid are pressed or not.

I'm making use of various STGC approaches including multiplexable STCG and triggered but I can't quite get the functionality that i'm looking for which is for a STGC value to not jump to a different value when the condition becomes true again.

An example:

I'm using a Multiplexable STGC to generate an event called !Control1 with the following active when (!GKeyDownLeft eq: 0).  That is saying active when i'm not holding a key/button on the left hand side of my Monome Grid.

Within the generated value parameter i'm using the following:

((((((!Arc1_Delta hasChangedInLast: 0.1 s) trackAndHold: !Arc1_Delta) * 0.01) accumulateWhile: (!Arc1_Delta hasChangedInLast: 0.001 s) initialValue: 0.5 reset: !Arc1Reset) roundTo: 0.01) max: 0) min: 1

This expression is the neatest way i could get to:

a) Use delta change values coming in from my Monome Arc [via osc] as !Arc1_Delta to accumulate/decumluate

b) Constrain to 0 - 1 (note, I'm using another STCG which generates !Arc1Reset when the value goes above 1

c) Deal with the fact that the Arc is always sending a positive or negative delta value - it doesn't send zero when not turned.  So the 'hasChangedInLast' capytalk is needed to track whether you're actually moving the encoder.

This works well - however i'm now looking to use that same approach to generate a different value (let's call it !Control1A) when !GKeyDownLeft is gt: 0 [i.e. the opposite of above].  I can get this working but the !Control1 value automatically jumps back to the accumulated value in the background.

What's the best approach to try and deal with this do you think?

Thanks

Edit: i've also tried an approach using hasChangedReset: and trackAndHold: but this too seems to jump once condition active again.
asked Aug 23, 2020 in Capytalk & Smalltalk by ghood (Master) (3,060 points)
edited Aug 23, 2020 by ghood

1 Answer

0 votes
Sorry to answer my own question but I figured out a way.

I slotted an AND (/\) into the 'accumulateWhile' portion to only accumulate when !GKeyDownLeft is eq: 0 [i.e. not pressed] and created a second STCG with !GKeyDownLeft gt: 0 and !Control1A generated instead.  

If there are neater ways then please share :)
answered Aug 23, 2020 by ghood (Master) (3,060 points)
...