Hi, I’d like to map a push encoder to do one thing when pressed while an Instrument track is selected (namely, open the VST instrument) and another when an Audio track is selected (“Edit Plugin” which will open my guitar amp sim like NeuralDSP if the track uses it). As far as I can see I can get the title of the selected track or it’s color, but not it’s type. Is there a way to get this information?
I figure I could rename my Instrument tracks to end with “INSTRUMENT” and my Audio tracks to end with “AUDIO” and then use onTitleChange to get the selected track’s title and search if it contains one string or the other. Alternatively I could color map them but I’d like a solution that doesn’t require that. Thanks for your time.
Hi again, I had the time to implement your idea and it worked great. I appreciate your time and input.
However I have run into the issue that a ValueBinding between my CustomValueVariable and the Host Values does not behave as expected. My custom variable behaves exactly like a push encoder - as I press the encoder its value is 1 and when I release it its value goes to 0. I used “setTypeToggle()” on the value binding and it doesn’t behave as a toggle. Rather when I push the encoder the VST interface opens and when I release the encoder it closes. It simply follows the values 1 for open and 0 for closed. It behaves the same way when I use “setTypeDefault()”. What is worse, when I make a ValueBinding between the mPushValue as a surface element and these Host Values and set its type to Toggle, it works correctly.
What am I missing?
Here is the relevant piece of code:
surfaceElements.aiKnob.mPushValue.mOnProcessValueChange = function (context, value){
if (MiniLab_3_Var.SELECTED_TRACK_TYPE == 'Instrument') {
surfaceElements.varPushValueInstrumentTrack.setProcessValue(context, value)
}
else if (MiniLab_3_Var.SELECTED_TRACK_TYPE == 'Audio') {
surfaceElements.varPushValueAudioTrack.setProcessValue(context, value)
}
}
page.makeValueBinding(surfaceElements.varPushValueInstrumentTrack, page.mHostAccess.mTrackSelection.mMixerChannel.mValue.mInstrumentOpen).setTypeToggle()
page.makeValueBinding(surfaceElements.varPushValueAudioTrack, page.mHostAccess.mTrackSelection.mMixerChannel.mInsertAndStripEffects.makeInsertEffectViewer('').mEdit).setTypeToggle()