The Transport→Create Markers from Selected Events (with Current Settings) is from Nuendo, right? I don’t have Nuendo to give it a try. Perhaps later tonight (after the dentist
)
Till then, here’s a draft snippet, just to answer your question about whether MIDI Remote can create Macros. Not only it can, but we can also add some delays between commands, because it’s well known that sometimes Macros tend to fail because of the absence of such delays.
var midiremote_api = require('midiremote_api_v1')
var deviceDriver = midiremote_api.makeDeviceDriver('Test', 'Select 3-4 events from 6 then empty', 'Someone')
var midiInput = deviceDriver.mPorts.makeMidiInput("anInput")
var midiOutput = deviceDriver.mPorts.makeMidiOutput("anOutput")
var detectUnit=deviceDriver.makeDetectionUnit()
detectUnit.detectPortPair(midiInput,midiOutput)
.expectInputNameEquals("an input port")
.expectOutputNameEquals("an output port")
var surface = deviceDriver.mSurface
var btn=surface.makeButton(0,0,1,1)
btn.mSurfaceValue.mMidiBinding
.setInputPort(midiInput)
.bindToControlChange(0,24)
//First element of each, set to command category. Second element to command name. Third element to some delay added to perform accurately. This delay is measured in cycles of a custom variable trigger
var sequence=[
['Transport', 'Locate Next Event','0'],
['Transport', 'Locate Next Event','0'],
['Transport', 'Locate Next Event','0'],
['Navigate', 'Add Right','5'],
['Transport', 'Locators to Selection','5'],
['Transport', 'Insert Cycle Marker','5'],
['Transport', 'Locate Next Event','0'],
['Transport', 'Locate Next Event','0'],
['Transport', 'Locate Next Event','0'],
['Transport', 'Locate Next Event','0']
]
var sequenceRepeats=5 //Number of times to repeat the sequence
var customVars=[]
for(var i=0;i<sequence.length;i++){
var customVar=surface.makeCustomValueVariable("customVar"+i)
customVars.push(customVar)
}
var customTimer=surface.makeCustomValueVariable("customTimer")
var page=deviceDriver.mMapping.makePage("page")
var dummyStart=page.mCustom.makeHostValueVariable("dummyStart")
page.makeValueBinding(btn.mSurfaceValue,dummyStart).mOnValueChange=function(activeDevice,activeMapping,value,diff){
if(value==1){
page.mHostAccess.mTransport.mTimeDisplay.mPrimary.mTransportLocator.setTime(activeMapping,"-1")
activeDevice.setState("counter",sequenceRepeats.toString())
initTimer(activeDevice,0)
}
}
for(var i=0;i<sequence.length;i++){
var step=sequence[i]
var commandCategory=step[0]
var command=step[1]
page.makeCommandBinding(customVars[i],commandCategory,command).mOnValueChange=function(activeDevice,activeMapping,value,diff){
if(value==1){
var i=this.i
customVars[i].setProcessValue(activeDevice,0)
var newStepCount=i+1
if(i==sequence.length-1){
newStepCount=0
var counter=parseInt(activeDevice.getState("counter"))
counter--
if (counter==0) {
return
}
activeDevice.setState("counter",counter.toString())
}
initTimer(activeDevice,newStepCount)
}
}.bind({i})
}
customTimer.mOnProcessValueChange=function(activeDevice,value,diff){
if(value>0){
value--
customTimer.setProcessValue(activeDevice,value)
return
}
var customTimerAction=parseInt(activeDevice.getState("customTimerAction"))
customVars[customTimerAction].setProcessValue(activeDevice,1)
}
function initTimer(activeDevice,customTimerAction){
activeDevice.setState("customTimerAction",customTimerAction.toString())
var timerSteps=parseInt(sequence[customTimerAction][2])
customTimer.setProcessValue(activeDevice,timerSteps)
}