Hello all,
I try to write a script for the PreSonus FaderPort 2018 Version but I’m stuck with the fader:
The FaderPort sends 2 Midi messages for the motorized Fader. Note-On & Note Off for indicating the touch of the fader + Pitch Bend for the position change.
The connection to the volume doesn’t work like expected. Interestingly the volume change is communicated perfectly to the FaderPort but the moving the fader on the FaderPort doesn’t change anything in Cubase.
May someone sees the error immediately…
Thx for helping out
//-----------------------------------------------------------------------------
// 1. DRIVER SETUP - create driver object, midi ports and detection information
//-----------------------------------------------------------------------------
// get the api's entry point
var midiremote_api = require('midiremote_api_v1')
// create the device driver main object
var deviceDriver = midiremote_api.makeDeviceDriver('PreSonus', 'FaderPort', 'xxx')
// create objects representing the hardware's MIDI ports
var midiInput = deviceDriver.mPorts.makeMidiInput()
var midiOutput = deviceDriver.mPorts.makeMidiOutput()
// define all possible namings the devices MIDI ports could have
// NOTE: Windows and MacOS handle port naming differently
//deviceDriver.makeDetectionUnit().detectPortPair(midiInput, midiOutput)
// .expectInputNameEquals('SimpleDevice IN')
// .expectOutputNameEquals('SimpleDevice OUT')
deviceDriver.makeDetectionUnit().detectPortPair(midiInput, midiOutput)
.expectInputNameEquals('PreSonus FP2')
.expectOutputNameEquals('PreSonus FP2')
//-----------------------------------------------------------------------------
// 2. SURFACE LAYOUT - create control elements and midi bindings
//-----------------------------------------------------------------------------
// create control element representing your hardware's surface
var fd_Volume = deviceDriver.mSurface.makeFader(2, 0, 1, 2).setTypeVertical()
var btn_Volume = deviceDriver.mSurface.makeButton(1, 0, 1, 1)
var kb_Rotary = deviceDriver.mSurface.makeKnob(0, 3, 1, 1)
var btn_Solo = deviceDriver.mSurface.makeButton(0, 0, 1, 1)
var btn_PrevTrack = deviceDriver.mSurface.makeButton(0, 1, 1, 1)
var btn_NextTrack = deviceDriver.mSurface.makeButton(1, 1, 1, 1)
// bind midi ports to surface elements
fd_Volume.mSurfaceValue.mMidiBinding
.setInputPort(midiInput)
.setOutputPort(midiOutput)
.bindToPitchBend(0)
btn_Volume.mSurfaceValue.mMidiBinding
.setInputPort(midiInput)
.setOutputPort(midiOutput)
.bindToNote (0, 104)
kb_Rotary.mSurfaceValue.mMidiBinding
.setInputPort(midiInput)
.setOutputPort(midiOutput)
.bindToNote (0, 176)
btn_Solo.mSurfaceValue.mMidiBinding
.setInputPort(midiInput)
.setOutputPort(midiOutput)
.bindToNote (0, 8)
btn_PrevTrack.mSurfaceValue.mMidiBinding
.setInputPort(midiInput)
.setOutputPort(midiOutput)
.bindToNote (0, 46)
btn_NextTrack.mSurfaceValue.mMidiBinding
.setInputPort(midiInput)
.setOutputPort(midiOutput)
.bindToNote (0, 47)
//-----------------------------------------------------------------------------
// 3. HOST MAPPING - create mapping pages and host bindings
//-----------------------------------------------------------------------------
// create at least one mapping page
var page = deviceDriver.mMapping.makePage('Example Mixer Page')
// bind surface elements to host accessing object values
page.makeActionBinding(btn_PrevTrack.mSurfaceValue, page.mHostAccess.mTrackSelection.mAction.mPrevTrack)
page.makeActionBinding(btn_NextTrack.mSurfaceValue, page.mHostAccess.mTrackSelection.mAction.mNextTrack)
// create host accessing objects
var hostSelectedMixerChannel = page.mHostAccess.mTrackSelection.mMixerChannel
page.makeValueBinding(fd_Volume.mSurfaceValue, hostSelectedMixerChannel.mValue.mVolume)
fd_Volume.mSurfaceValue.mOnProcessValueChange = function (context, newValue, oldValue) {
console.log("PV: " + fd_Volume.mSurfaceValue.getProcessValue(context).toString())
console.log("NV: " + newValue.toString())
}