New in MIDI Remote v1.3
Version 1.3 of the MIDI Remote API extends DirectAccess and device detection with new runtime inspection and plugin-management functionality.
Supported host versions: Cubase / Nuendo 15.
Deep dives:
1. Platform Filters in Device Detection
API 1.3 added platform filters on detection units:
expectPlatformMacOS()expectPlatformNotMacOS()expectPlatformWindows()expectPlatformNotWindows()
var driver = midiremote_api.makeDeviceDriver('ExampleCompany', 'DetectionDevice', 'Example Author')
var detectionUnit = driver.makeDetectionUnit()
if (detectionUnit.mPlatformFilter && detectionUnit.mPlatformFilter.expectPlatformMacOS) {
detectionUnit.mPlatformFilter.expectPlatformMacOS()
}
2. Extended DirectAccess Parameter Introspection
API 1.3 added:
getParameterProcessValueType(...)isParameterAutomatable(...)convertParameterProcessValueToPlain(...)convertParameterPlainToProcessValue(...)
if (da.getParameterProcessValueType) {
var valueType = da.getParameterProcessValueType(activeMapping, objectID, parameterTag)
var automatable = da.isParameterAutomatable(activeMapping, objectID, parameterTag)
var plainValue = da.convertParameterProcessValueToPlain(activeMapping, objectID, parameterTag, 0.5)
var processValue = da.convertParameterPlainToProcessValue(activeMapping, objectID, parameterTag, plainValue)
console.log('type=' + valueType + ', automatable=' + automatable + ', plain=' + plainValue + ', process=' + processValue)
}
3. DirectAccess Plugin Manager
API 1.3 added plugin slot browsing and assignment through da.mPluginManager.
if (da.mPluginManager && da.mPluginManager.getNumberOfPluginCollections) {
var collectionCount = da.mPluginManager.getNumberOfPluginCollections(activeMapping, pluginSlotObjectID)
var activeCollectionIndex = da.mPluginManager.getIndexOfActivePluginCollection(activeMapping, pluginSlotObjectID)
if (activeCollectionIndex >= 0 && activeCollectionIndex < collectionCount) {
var collection = da.mPluginManager.getPluginCollectionByIndex(activeMapping, pluginSlotObjectID, activeCollectionIndex)
if (collection.mEntries.length > 0) {
var pluginUID = collection.mEntries[0].mPluginUID
da.mPluginManager.trySetSlotPlugin(activeMapping, pluginSlotObjectID, pluginUID, true)
}
}
}
4. DirectAccess Object Type Name
API 1.3 added getObjectTypeName(...) for explicit type-level runtime inspection.
var objectTypeName = da.getObjectTypeName(activeMapping, objectID)
console.log('DA object type = ' + objectTypeName)
5. Surface Display String Access
API 1.3 added display-text helpers on surface values:
setDisplayValue(activeDevice, value)getDisplayValue(activeDevice)
var driver = midiremote_api.makeDeviceDriver('ExampleCompany', 'SurfaceDevice', 'Example Author')
var knob = driver.mSurface.makeKnob(0, 0, 1, 1)
function updateDisplay(activeDevice) {
if (knob.mSurfaceValue.setDisplayValue && knob.mSurfaceValue.getDisplayValue) {
knob.mSurfaceValue.setDisplayValue(activeDevice, 'Drive')
var displayText = knob.mSurfaceValue.getDisplayValue(activeDevice)
console.log(displayText)
}
}
6. Command Binding Capability Check
API 1.3 added canPerform(activeMapping) on command bindings.
var driver = midiremote_api.makeDeviceDriver('ExampleCompany', 'CommandDevice', 'Example Author')
var page = driver.mMapping.makePage('Main')
var knob = driver.mSurface.makeKnob(0, 0, 1, 1)
var commandBinding = page.makeCommandBinding(knob.mSurfaceValue, 'Transport', 'Start')
page.mOnActivate = function (activeDevice, activeMapping) {
if (commandBinding.canPerform && commandBinding.canPerform(activeMapping)) {
console.log('Command is currently performable')
}
}
Compatibility note
All API 1.3 features should be guarded when your script must run on Cubase/Nuendo versions that only provide API 1.2 or older.
All API 1.3 features should be guarded when your script must run on Cubase/Nuendo versions that only provide API 1.2 or older.