hi, i’m trying to tweak my script that switches between automation and trackdsps.
i’ve just added an if clause there where it’s like “if you’re in sample editor, switch to pattern editor”.
but there are multiple middle_frame situations that would require me to switch to pattern editor, just so that the lower frame can be displayed.
they are:
now, instead of creating an if clause for all of these by hand, would it not be possible to go “if you’re in any of these ones, do x, otherwise do nothing and proceed with the script”?
i.e. “for if u r in 1…7 then do x” ? and have it be a list or an array or whatever the fancy kids call these nowadays.
i mean, is there a more aesthetically pleasing way than just hard-hammering
local w=renoise.app().window
local raw=renoise.ApplicationWindow
local wamf = renoise.app().window.active_middle_frame
if (wamf==raw.MIDDLE_FRAME_INSTRUMENT_SAMPLE_EDITOR)
or (wamf==raw.MIDDLE_FRAME_INSTRUMENT_PHRASE_EDITOR)
or (wamf==raw.MIDDLE_FRAME_INSTRUMENT_SAMPLE_KEYZONES)
or (wamf==raw.MIDDLE_FRAME_INSTRUMENT_SAMPLE_EDITOR)
or (wamf==raw.MIDDLE_FRAME_INSTRUMENT_SAMPLE_MODULATION)
or (wamf==raw.MIDDLE_FRAME_INSTRUMENT_SAMPLE_EFFECTS)
or (wamf==raw.MIDDLE_FRAME_INSTRUMENT_PLUGIN_EDITOR)
or (wamf==raw.MIDDLE_FRAME_INSTRUMENT_MIDI_EDITOR)
then renoise.app().window.active_middle_frame=1 else end
You could set up a bitop/flag system that would be very reusable and flexible. It’s likely what the big C boys might wanna do, but it’s maybe not the most practical answer if you don’t wanna spend some time learning a bit of programming/engineering.
Most practical answer depends on cases and logic needed. I wouldn’t bother with the aesthetics. Making it “nice looking” takes too much work. (Code above can be shortened by using values instead of constants, but this doesn’t seem advisable in principle with regards to auto-upgrading of tools).
to answer myself, here’s the solution. think very carefully about what you are actually doing. you’re going “if I’m NOT in the pattern editor, then go to the pattern editor”. that is all. so check if I’m NOT in the pattern editor, then go to pattern editor. Like this.
if renoise.app().window.active_middle_frame ~= 1 then
renoise.app().window_active_middle_frame = 1 end
that is all. no extra complexity required. now, of course, if Renoise suddenly has a bunch of middle frames you would like to react to in a different way, then you might wanna put something before that, so something like this:
if renoise.app().window.active_middle_frame == renoise.ApplicationWindow.MIDDLE_FRAME_INSTRUMENT_PLUGIN_EDITOR
then renoise.app().window.active_middle_frame = renoise.ApplicationWindow.MIDDLE_FRAME_INSTRUMENT_PHRASE_EDITOR
return
end
if renoise.app().window.active_middle_frame ~= 1 then
renoise.app().window_active_middle_frame = 1 end
this will now go “ok if you’re in the Instrument Plugin Editor, go to Phrase Editor and do nothing else”. and "if you’re anywhere other than Instrument Plugin Editor or Pattern Editor, then go to Pattern Editor.