Cabbage Logo
Back to Cabbage Site

Possible to latch filebutton?

Wondering if it’s possible to latch a file button in its “1” state.
I am using it to trigger a new instrument that records. In the past I have used a “rec” and “stop” button individually and swapped their positions out but I want to do something like this with a single button (and have it switch between color:0 and color:1 too!)

filebutton bounds(345, 390, 30, 30), latched(1), text("R", "R"), channel("RecordMode"), mode("save") $BUTTON1, colour:0("245,0,245,200")

gSSaveFile, kTrigRecord cabbageGetValue “RecordMode”
schedkwhennamed kTrigRecord, 0, 1, “recorder”, 0, 500000

and then pass the instrument a turnoff when the button returns to its zero “off” state. Possible to do this with a single button?

You might want to have a look at Andrea’s grains program. It allows the on-the-fly recording of audio, and he tackles the problem by having the user hold the record button for the duration of what is being recorded.

Cool - i’ll check that out, thanks! Unfortunately, that won’t work in this case as the user needs to be able to move widgets while recording… but maybe I can just set the value of the button to =1 hmmm… :thinking:

Hmm, with a filebutton? I’m not sure this is possible. Also, the trigger won’t, er, trigger, unless the file has changed. So if the user wants to record to the same file again this won’t work?

One thing you could do is overlay a regular button on the filebutton when the user has picked a file. Then when they hit this button they can stop the recording.

Yeah, kind of the same as I’ve been doing - just swapping bounds for the record and stop buttons. Thanks!