gen latch @init - is it possible to use an indirect value such as a param or history name rather than a float ?

dlwhite's icon

I want to set the @init value of a latch or sah as the default value of a param (or could use history object).
But @init is not an inlet, and it appears that I can't use the name of a param or history object.

Is there any way to set the value of latch @init except as a float on the object itself?

What I'm trying to do:

I am working in Oopsy for the Daisy Seed. I have a physical pedal that has 6 knobs. But I have 12 parameters I want to control.

When I hold a footswitch for 1 second I am in "alt mode" then the physical knobs 1-6 control vKnobs 7-12. I have built a "takeover" mode so that there isn't a "jump" to the the physical knob value... the the vKnob will only start to change when the physical knob crosses over the previous value ("normal mode") of the vKnob.

This is all working in the attached testing patch. But one thing I can't figure out how to do is to define the vKnob value on pedal power up. For knobs 1-6 I can use param @default

But there is no "param vKnob @default..." The obvious spot to do this is in the Latch of my knob takeover. But if I decide the default values need to be updated, I'd rather not dig into every vknobcontrol to change the latch @init value. it would be much easier to follow the same style as the physical knobs which use param @default to set their initial values.

Max Patch
Copy patch and select New From Clipboard in Max.

Graham Wakefield's icon

Unfortunately not currently.

However it is possible to patch your own latch that does have a 3rd inlet for init value, and save it as an abstraction.

You just need two switches and a history.

Connect [history] and [in 3] to [switch elapsed]

Connect [in 1], [in 2], [switch elapsed] to [switch]

Connect that [switch] to [out 1] and also back to the [history].

Basically, elapsed counts the samples since the patch opened, starting at 0. switch elapsed uses elapsed as the switch condition, so on the first sample it passes the second inlet (in 3), then from then on it passes the first inlet (`history`).

The second switch basically does the job of latch, passing in1 of in2 is not zero. This feeds back through history as the stored value.

dlwhite's icon

I hadn't run across elapsed, that's helpful and I get it.

Thanks, Graham.