Hello! Currently working on a tool where I need to know which device is currently visible/selected, i.e. whether the tracks/mixer pane is currently visible or the sample DSP chain.
I’ve seen there are options to tell the corrent track and dsp chain selected device, but not which view is actually currently visible.
Looking for this, because I want to load data from an instrument to a specific device and back, so I need to know whether the user would want to trigger the command in track or sample effects chain.
i have Convolver as a selected device. if i have nothing selected, then the selection is nil.
>>> oprint (renoise.song().selected_device.name)
*** [string "oprint (renoise.song().selected_device.name..."]:1: attempt to index field 'selected_device' (a nil value)
*** stack traceback:
*** [string "oprint (renoise.song().selected_device.name..."]:1: in main chunk
>>> oprint (renoise.song().selected_device)
nil
which will definitely set the lower frame to that specific view.
now, if the lower frame is not visible, you can check this with
renoise.app().window.lower_frame_is_visible
you’ll get true if it’s visible, false if it’s not visible.
situations where trackdsps will not be visible == if you’re in the sample editor, or any other view in the samples (instrument mappings, etc).
then you gotta kick yourself to pattern editor, or mixer, to get to show trackdsps.
in this case, you’ll do it like this
this last thing “so i need to know whether the user would want to trigger the command in track or sample effects chain” is something i need to know.
i think what you maybe mean, is, the Convolver might be in the Sample FX Chain, or in the Track DSP Chain.
In this case, i think, let’s see.
yes, selected_device will tell you what the track dsp device is.
but if there’s nothing selected, it won’t tell you that “oh, you don’t have track dsp device selected, but i see you have a sample fx chain device selected, and that is this”, instead you gotta then go… like this.
renoise.song().selected_sample_device
this’ll tell you if you have a device selected in the Sample FX chain.
and if you want to make sure the device is a Convolver, then of course use
renoise.song().selected_sample_device.name
the way i’ve solved this for myself, is, i query, first and foremost, which frame is being displayed. if the frame is 7, in this case, renoise.ApplicationWindow.MIDDLE_FRAME_INSTRUMENT_SAMPLE_EFFECTS - i’ll know to go "ah, okay, sample_fx chain is displayed, i’m gonna run the script so that it imports or extracts something from the Convolver device.
and if it’s NOT displayed, then do the import + extract Convolver device stuff from trackdsp instead.