Is it possible to control multiple device pages simultaneously??
- KVRist
- 207 posts since 23 Oct, 2008
You can, indirectly, by creating multiple cursordevices, then using the page names observer of each of them to a) detect that the device has changed, b) determine how many param pages the device actually has, and c) re-select the parameter page specific for the cursor. Won't win the code elegance award, but it works. Maybe there's better ways in v2.. Didn't check yet.
-
- KVRist
- Topic Starter
- 59 posts since 31 Oct, 2007 from Australia
Any chance you could have a look at my script, and point out what bit i need to modify??
Right now, the control function is using the same 8 cc and then pagescroll to directly access the different pages.
But following that, envelope, macro and common are all their own 8 cc, and they are the cc i'd like to control page 1, 2 & 3 while my control function address's pages 4-19
function.js
And if you need, heres the control.js
Right now, the control function is using the same 8 cc and then pagescroll to directly access the different pages.
But following that, envelope, macro and common are all their own 8 cc, and they are the cc i'd like to control page 1, 2 & 3 while my control function address's pages 4-19
function.js
Code: Select all
// functions.js
var parameters = {
offset: 25
,
control: function(data1, data2)
{
if(data1 >= this.offset && data1 < this.offset + 8 ){
cursorDevice.getParameter(data1 - this.offset).set(data2,128);
}
},
envelope: function(data1, data2)
{
if(data1 >= this.offset - 9 && data1 < this.offset){
cursorDevice.getEnvelopeParameter(data1 - (this.offset - 9)).set(data2,128);
}
},
common: function(data1, data2)
{
if(data1 >= this.offset - 17 && data1 < this.offset - 9){
cursorDevice.getCommonParameter(data1 - (this.offset - 17)).set(data2,128);
}
},
macro: function(data1, data2) {
var macroIndex = data1 - (this.offset +32);
if (macroIndex >= 0 && macroIndex < 8) {
cursorDevice.getMacro(macroIndex).getAmount().set(data2, 128);
}
},
pageScroll: function(data1, data2) {
if (data2 != 0) {
if (data1 >= 33 && data1 <= 39)
cursorDevice.setParameterPage(data1 - 30);
if (data1 === 40)
cursorDevice.setParameterPage(10);
if (data1 >= 49 && data1 <= 56)
cursorDevice.setParameterPage(data1 - 38);
}
},
update: function()
{
for(var p = 0; p <8; p ++)
{
cursorDevice.getParameter(p).setIndication(true)
}
}
}
And if you need, heres the control.js
Code: Select all
loadAPI(1);
host.defineController("Akai", "Midimix", "1.0", "80c4f150-32c7-11e6-bdf4-0800200c9a66");
host.defineMidiPorts(1, 1);
host.addDeviceNameBasedDiscoveryPair(["MIDI mix"], ["MIDI mix"]);
//load externals
load("midimix.functions.js")
//define the range of CCs
var CC_RANGE_HI = 120;
var CC_RANGE_LO = 100;
var parameterIds = [];
//------------------------------------ Init -----------------------------------//
function init()
{
//-------- Set MIDI callbacks / port
host.getMidiInPort(0).setMidiCallback(onMidiPort1);
//Sends Notes to Bitwig, with no input filters.
noteIn = host.getMidiInPort(0).createNoteInput("Notes");
noteIn.setShouldConsumeEvents(false);
//Creates an array of user controls with the proper amount of CC#s
//Creating a view onto the selected device
cursorDevice = host.createEditorCursorDevice(2);
parameters.update();
}
function onMidiPort1(status, data1, data2)
{
//Running our control Functions
parameters.control(data1,data2)
parameters.envelope(data1,data2)
parameters.common(data1, data2)
parameters.macro(data1,data2)
parameters.pageScroll(data1, data2);
//Note Data
}