Cabbage Logo
Back to Cabbage Site

Using an instr to encapsulate parts of a gui

I’ve got a project that I need to create two different “modes” of operation, and I was thinking that this might be handled by using two different instr definitions, one for each mode. First of all, does this sound like a useful way to encapsulate different gui behaviors? And second, more to the point of what I’m trying to do, is what is the best way to create an instr instance that has no time limit, and then when switching “modes”, turn off the first instr before starting the second.

Currently, I am using global variables as flags to halt an instr, but I’ve been reading up on the Csound opcode “nstance”, and that it returns a handle to the instance. My only hesitation from using “nstance” is that it only operates at i-time.

Hope this makes sense. Does anyone have a suggestion of their own?

Ok, seems I just needed to look a little more…

Yeah turnoff, event, schedule are all things you should investigate. Keep in mind two that you can use control flow if/else statements to break up the flow through a single instrument. So you can also switch between modes within a single instrument. This is often cleaner.