prime4
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
prime4 [2023/09/10 21:44] – ounsatn | prime4 [2023/09/11 23:01] (current) – ounsatn | ||
---|---|---|---|
Line 31: | Line 31: | ||
(qml syntax has been taken from Prime Firmware) | (qml syntax has been taken from Prime Firmware) | ||
+ | [[http:// | ||
+ | [[http:// | ||
- | Akai_Pro_Force_Private_Device.qml : | + | [[http:// |
+ | [[http:// | ||
+ | |||
+ | I will explain a bit the syntax | ||
+ | |||
+ | **_Private_ files are used for inputs / actions buttons .** | ||
< | < | ||
+ | |||
+ | Akai_Pro_Force_Private_Device.qml : | ||
+ | |||
import airAssignments 1.0 | import airAssignments 1.0 | ||
import InputAssignment 0.1 | import InputAssignment 0.1 | ||
Line 228: | Line 238: | ||
< | < | ||
+ | Akai_Pro_Force_Private_Assignments.qml : | ||
import airAssignments 1.0 | import airAssignments 1.0 | ||
Line 878: | Line 889: | ||
*/ | */ | ||
+ | </ | ||
+ | **_Public_ files are used to lit leds / pads.** | ||
+ | < | ||
+ | Akai_Pro_Force_Public_Device.qml : | ||
+ | import airAssignments 1.0 | ||
+ | import InputAssignment 0.1 | ||
+ | import OutputAssignment 0.1 | ||
+ | import Device 0.1 | ||
+ | import QtQuick 2.0 | ||
+ | import Planck 1.0 | ||
+ | Device { | ||
+ | id: device | ||
+ | |||
+ | property real gamma: 3.5 | ||
+ | property real padGamma: 3.5 | ||
+ | controls: [] | ||
+ | useGlobalShift: | ||
+ | numberOfLayers: | ||
+ | |||
+ | property string deviceInfo: "" | ||
+ | |||
+ | property QObjProperty pRunningDark: | ||
+ | property bool isRunningDark: | ||
+ | onIsRunningDarkChanged: | ||
+ | if(isRunningDark) { | ||
+ | Midi.sendNoteOn(0, | ||
+ | } | ||
+ | else { | ||
+ | for(var channel in currentColors) { | ||
+ | for(var key in currentColors[channel]) { | ||
+ | sendColor(channel, | ||
+ | } | ||
+ | } | ||
+ | for(var channel in currentSimpleColors) { | ||
+ | for(var simpleKey in currentSimpleColors[channel]) { | ||
+ | sendSimpleColor(channel, | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | property QObjProperty pCalibratePlatter: | ||
+ | property bool calibratePlatter: | ||
+ | onCalibratePlatterChanged: | ||
+ | if(calibratePlatter) { | ||
+ | console.log(" | ||
+ | // | ||
+ | } | ||
+ | } | ||
+ | |||
+ | /////////////////////////////////////////////////////////////////////////// | ||
+ | // Setup | ||
+ | |||
+ | property Timer initTimer: Timer { | ||
+ | interval: 1000 | ||
+ | repeat: false | ||
+ | onTriggered: | ||
+ | console.log(" | ||
+ | device.isInitializing = false | ||
+ | } | ||
+ | } | ||
+ | |||
+ | property bool isInitializing: | ||
+ | |||
+ | Component.onCompleted: | ||
+ | currentColors = {} | ||
+ | currentSimpleColors = {} | ||
+ | |||
+ | // | ||
+ | |||
+ | isInitializing = true | ||
+ | |||
+ | requestPowerOnButtonState(); | ||
+ | |||
+ | console.log(" | ||
+ | // | ||
+ | initTimer.start() | ||
+ | } | ||
+ | |||
+ | Component.onDestruction: | ||
+ | if(Planck.quitReason() === QuitReasons.ControllerMode) { | ||
+ | Midi.sendNoteOn(0, | ||
+ | } | ||
+ | else { | ||
+ | Midi.sendNoteOff(0, | ||
+ | } | ||
+ | } | ||
+ | |||
+ | property var currentColors | ||
+ | property var currentSimpleColors | ||
+ | |||
+ | function padToTwo(str) { | ||
+ | return str.padStart(2, | ||
+ | } | ||
+ | |||
+ | function dec2hex(d){ | ||
+ | return padToTwo((+d).toString(16).toUpperCase()) | ||
+ | |||
+ | |||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | function midiColorChannel(c, | ||
+ | return dec2hex(Math.min(127, | ||
+ | } | ||
+ | |||
+ | function mapColor(color) { | ||
+ | return Qt.rgba(color.r, | ||
+ | } | ||
+ | |||
+ | function midiColor(color, | ||
+ | var c = mapColor(color) | ||
+ | return midiColorChannel(c.r, | ||
+ | } | ||
+ | |||
+ | function sendNoteOn(channel, | ||
+ | Midi.sendNoteOn(channel, | ||
+ | } | ||
+ | |||
+ | function sendSimpleColor(channel, | ||
+ | |||
+ | if(!currentSimpleColors[channel]) { | ||
+ | currentSimpleColors[channel] = {}; | ||
+ | } | ||
+ | |||
+ | currentSimpleColors[channel][index] = value | ||
+ | |||
+ | if(isRunningDark) | ||
+ | return; | ||
+ | |||
+ | if(value === 0) { | ||
+ | Midi.sendNoteOff(channel, | ||
+ | } else { | ||
+ | Midi.sendNoteOn(channel, | ||
+ | } | ||
+ | } | ||
+ | |||
+ | //Color Send Function | ||
+ | function sendColor(channel, | ||
+ | { | ||
+ | if(!currentColors[channel]) { | ||
+ | currentColors[channel] = {}; | ||
+ | } | ||
+ | currentColors[channel][index] = color; | ||
+ | |||
+ | if(isRunningDark) { | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | var g = device.gamma | ||
+ | if(index >= 15 && index <= 23) { | ||
+ | g = device.padGamma | ||
+ | } | ||
+ | |||
+ | //var sysEx = "F0 47 7F 40 65 00 04 " + dec2hex(channel) + " " + dec2hex(index) + " " + midiColor(color, | ||
+ | var sysEx = "F0 47 7F 40 65 00 04 " + dec2hex(index) + " " + padToTwo(midiColor(color, | ||
+ | Midi.sendSysEx(sysEx) | ||
+ | console.info(" | ||
+ | |||
+ | } | ||
+ | |||
+ | property list< | ||
+ | property bool enablePartialOledUpdates: | ||
+ | |||
+ | Repeater { | ||
+ | model: 8 | ||
+ | Item { | ||
+ | id: self | ||
+ | property var buffer | ||
+ | |||
+ | function numberToHex( num ) | ||
+ | { | ||
+ | var result = " | ||
+ | if(num < 0x10) | ||
+ | { | ||
+ | result += " | ||
+ | } | ||
+ | result += num.toString(16); | ||
+ | return result; | ||
+ | } | ||
+ | |||
+ | function buildSysEx(painter, | ||
+ | var result = "00 02 0B 7F 08 0B" | ||
+ | |||
+ | var imageData = painter.imageToString(x, | ||
+ | var dataLen = ((imageData.length+1) / 3) + 5; | ||
+ | |||
+ | result += " " + numberToHex((dataLen | ||
+ | result += " " + numberToHex( dataLen | ||
+ | result += " " + index.toString(16); | ||
+ | result += " " + numberToHex(y/ | ||
+ | result += " " + numberToHex((y/ | ||
+ | result += " " + numberToHex(x) + " "; | ||
+ | result += " " + numberToHex(x+w-1); | ||
+ | result += " " + imageData | ||
+ | |||
+ | return result; | ||
+ | } | ||
+ | |||
+ | function update(painter) { | ||
+ | if(device.enablePartialOledUpdates) { | ||
+ | var i = 0 | ||
+ | var bufToSend = [] | ||
+ | for(var y = 0; y < 4; y++) { | ||
+ | for(var x = 0; x < 16; x++) { | ||
+ | var result = buildSysEx(painter, | ||
+ | if(buffer[i] !== result) { | ||
+ | // | ||
+ | buffer[i] = result; | ||
+ | bufToSend.push(result); | ||
+ | } | ||
+ | i++ | ||
+ | } | ||
+ | } | ||
+ | |||
+ | if(bufToSend.length < 20) { | ||
+ | for(var i = 0; i < bufToSend.length; | ||
+ | |||
+ | // | ||
+ | // | ||
+ | } | ||
+ | } else { | ||
+ | var fullSysEx = buildSysEx(painter, | ||
+ | // | ||
+ | // | ||
+ | } | ||
+ | } else { | ||
+ | var fullSysEx = buildSysEx(painter, | ||
+ | // | ||
+ | // | ||
+ | |||
+ | } | ||
+ | } | ||
+ | |||
+ | Component.onCompleted: | ||
+ | var b = []; | ||
+ | for(var i = 0; i < 4 * 16; i++) | ||
+ | { | ||
+ | b.push( "" | ||
+ | } | ||
+ | |||
+ | buffer = b; | ||
+ | device.oleds.push(self) | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function requestPowerOnButtonState() { | ||
+ | // | ||
+ | } | ||
+ | |||
+ | function sysExToIntList(sysExString) | ||
+ | { | ||
+ | var valueList = sysExString.split(" | ||
+ | var result = []; | ||
+ | |||
+ | for(var i=0; | ||
+ | result.push(parseInt(valueList[i], | ||
+ | } | ||
+ | |||
+ | return result; | ||
+ | } | ||
+ | |||
+ | function sysEx(sysExString) { | ||
+ | // | ||
+ | var valueList = sysExToIntList(sysExString); | ||
+ | var result = ""; | ||
+ | |||
+ | // 0xf0 0x00 0x02 0x0b 0x00 0x06 0x42 0x00 0x01 0x01 0xf7 | ||
+ | if(valueList[1] === 0x00 && valueList[2] === 0x02 && valueList[3] === 0x0B && valueList[6] === 0x42) | ||
+ | { | ||
+ | if(valueList[9] === 0x0) { | ||
+ | console.log(" | ||
+ | } | ||
+ | else if(valueList[9] === 0x1) { | ||
+ | console.log(" | ||
+ | quitToTestApp() | ||
+ | } | ||
+ | } | ||
+ | else if(valueList[1] === 0x7E && valueList[2] === 0x00 && valueList[3] === 0x06 && valueList[4] === 0x02) | ||
+ | { | ||
+ | for(var i=0; | ||
+ | result += valueList[i + 11]; | ||
+ | if(i == 1) | ||
+ | result += " | ||
+ | } | ||
+ | deviceInfo = result; | ||
+ | } | ||
+ | } | ||
} | } | ||
</ | </ | ||
+ | |||
+ | } | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | < | ||
+ | |||
+ | Akai_Pro_Force_Public_Assignments.qml : | ||
+ | |||
+ | import airAssignments 1.0 | ||
+ | import InputAssignment 0.1 | ||
+ | import OutputAssignment 0.1 | ||
+ | import ControlSurfaceModules 0.1 | ||
+ | import QtQuick 2.12 | ||
+ | |||
+ | MidiAssignment { | ||
+ | objectName: | ||
+ | id: assignment | ||
+ | |||
+ | Utility { | ||
+ | id: util | ||
+ | } | ||
+ | |||
+ | GlobalAssignmentConfig { | ||
+ | id: globalConfig | ||
+ | midiChannel: | ||
+ | } | ||
+ | |||
+ | GlobalAction { | ||
+ | id: globalAction | ||
+ | } | ||
+ | |||
+ | Back { | ||
+ | note: 3 | ||
+ | ledType: LedType.Simple | ||
+ | } | ||
+ | |||
+ | Forward { | ||
+ | note: 4 | ||
+ | shiftAction: | ||
+ | ledType: LedType.Simple | ||
+ | } | ||
+ | |||
+ | BrowseEncoder { | ||
+ | pushNote: 6 | ||
+ | turnCC: 5 | ||
+ | ledType: LedType.Simple | ||
+ | } | ||
+ | |||
+ | View { | ||
+ | note: 7 | ||
+ | shiftAction: | ||
+ | holdAction: | ||
+ | ledType: LedType.Simple | ||
+ | } | ||
+ | |||
+ | ZoneOut { | ||
+ | note: 16 | ||
+ | } | ||
+ | |||
+ | Media { | ||
+ | mediaButtonsModel: | ||
+ | ListElement { | ||
+ | name: ' | ||
+ | shiftName: | ||
+ | note: 20 | ||
+ | hasLed: true | ||
+ | } | ||
+ | } | ||
+ | removableDeviceModel: | ||
+ | ListElement { // SD | ||
+ | slot: ' | ||
+ | note: 52 | ||
+ | } | ||
+ | ListElement { // USB 1 | ||
+ | slot: ' | ||
+ | note: 53 | ||
+ | } | ||
+ | ListElement { // USB 2 | ||
+ | slot: ' | ||
+ | note: 54 | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | Repeater { | ||
+ | model: ListModel { | ||
+ | ListElement { | ||
+ | deckName: | ||
+ | deckMidiChannel: | ||
+ | loadNote: | ||
+ | } | ||
+ | } | ||
+ | |||
+ | Item { | ||
+ | objectName: | ||
+ | |||
+ | DeckAssignmentConfig { | ||
+ | id: deckConfig | ||
+ | name: model.deckName | ||
+ | midiChannel: | ||
+ | } | ||
+ | |||
+ | DeckAction { | ||
+ | id: deckAction | ||
+ | } | ||
+ | |||
+ | Load { | ||
+ | note: model.loadNote | ||
+ | ledType: | ||
+ | } | ||
+ | |||
+ | Censor { | ||
+ | note: 1 | ||
+ | } | ||
+ | |||
+ | TrackSkip { | ||
+ | prevNote: | ||
+ | nextNote: | ||
+ | } | ||
+ | |||
+ | BeatJump { | ||
+ | prevNote: | ||
+ | nextNote: | ||
+ | } | ||
+ | |||
+ | Sync { | ||
+ | syncNote: | ||
+ | syncHoldAction: | ||
+ | } | ||
+ | |||
+ | PlayCue { | ||
+ | cueNote: | ||
+ | cueShiftAction: | ||
+ | playNote: | ||
+ | |||
+ | } | ||
+ | |||
+ | PerformanceModes { | ||
+ | ledType: | ||
+ | modesModel: | ||
+ | ListElement { | ||
+ | note: 56 | ||
+ | view: ' | ||
+ | } | ||
+ | ListElement { | ||
+ | note: 57 | ||
+ | view: ' | ||
+ | altView: | ||
+ | } | ||
+ | ListElement { | ||
+ | note: 58 | ||
+ | view: ' | ||
+ | } | ||
+ | ListElement { | ||
+ | note: 59 | ||
+ | view: ' | ||
+ | altView: | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | ActionPads { | ||
+ | firstPadNote: | ||
+ | ledType: | ||
+ | } | ||
+ | |||
+ | Parameter { | ||
+ | leftNote: | ||
+ | rightNote: | ||
+ | } | ||
+ | |||
+ | BeatGrid { | ||
+ | leftNote: | ||
+ | rightNote: | ||
+ | editGridNote: | ||
+ | } | ||
+ | |||
+ | Shift { | ||
+ | note: 28 | ||
+ | ledType: | ||
+ | } | ||
+ | |||
+ | PitchBend { | ||
+ | minusNote: | ||
+ | plusNote: | ||
+ | } | ||
+ | |||
+ | JogWheel { | ||
+ | touchNote: | ||
+ | ccUpper: | ||
+ | ccLower: | ||
+ | jogSensitivity: | ||
+ | ledType: | ||
+ | } | ||
+ | |||
+ | KeyLock { | ||
+ | note: 34 | ||
+ | } | ||
+ | |||
+ | Vinyl { | ||
+ | note: 35 | ||
+ | } | ||
+ | |||
+ | Slip { | ||
+ | note: 36 | ||
+ | } | ||
+ | |||
+ | ManualLoop { | ||
+ | inNote: 37 | ||
+ | outNote: | ||
+ | } | ||
+ | |||
+ | AutoLoop { | ||
+ | pushNote: | ||
+ | turnCC: 32 | ||
+ | ledType: | ||
+ | } | ||
+ | |||
+ | SpeedSlider { | ||
+ | ccUpper: | ||
+ | ccLower: | ||
+ | downLedNote: | ||
+ | centreLedNote: | ||
+ | upLedNote: | ||
+ | } | ||
+ | |||
+ | DeckSelect { | ||
+ | primaryDeckIndex: | ||
+ | primaryDeckNote: | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | Repeater { | ||
+ | model: ListModel { | ||
+ | ListElement { | ||
+ | deckName: | ||
+ | deckMidiChannel: | ||
+ | loadNote: | ||
+ | } | ||
+ | } | ||
+ | |||
+ | Item { | ||
+ | |||
+ | DeckAssignmentConfig { | ||
+ | id: deckConfig | ||
+ | name: model.deckName | ||
+ | midiChannel: | ||
+ | } | ||
+ | |||
+ | DeckAction { | ||
+ | id: deckAction | ||
+ | } | ||
+ | |||
+ | Load { | ||
+ | note: model.loadNote | ||
+ | ledType: | ||
+ | } | ||
+ | |||
+ | Censor { | ||
+ | note: 1 | ||
+ | } | ||
+ | |||
+ | TrackSkip { | ||
+ | prevNote: | ||
+ | nextNote: | ||
+ | } | ||
+ | |||
+ | BeatJump { | ||
+ | prevNote: | ||
+ | nextNote: | ||
+ | } | ||
+ | |||
+ | Sync { | ||
+ | syncNote: | ||
+ | syncHoldAction: | ||
+ | } | ||
+ | |||
+ | PlayCue { | ||
+ | cueNote: | ||
+ | cueShiftAction: | ||
+ | playNote: | ||
+ | |||
+ | } | ||
+ | |||
+ | PerformanceModes { | ||
+ | ledType: | ||
+ | modesModel: | ||
+ | ListElement { | ||
+ | note: 24 | ||
+ | view: ' | ||
+ | } | ||
+ | ListElement { | ||
+ | note: 25 | ||
+ | view: ' | ||
+ | altView: | ||
+ | } | ||
+ | ListElement { | ||
+ | note: 26 | ||
+ | view: ' | ||
+ | } | ||
+ | ListElement { | ||
+ | note: 27 | ||
+ | view: ' | ||
+ | altView: | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | ActionPads { | ||
+ | firstPadNote: | ||
+ | ledType: | ||
+ | } | ||
+ | |||
+ | Parameter { | ||
+ | leftNote: | ||
+ | rightNote: | ||
+ | } | ||
+ | |||
+ | BeatGrid { | ||
+ | leftNote: | ||
+ | rightNote: | ||
+ | editGridNote: | ||
+ | } | ||
+ | |||
+ | Shift { | ||
+ | note: 28 | ||
+ | ledType: | ||
+ | } | ||
+ | |||
+ | PitchBend { | ||
+ | minusNote: | ||
+ | plusNote: | ||
+ | } | ||
+ | |||
+ | JogWheel { | ||
+ | touchNote: | ||
+ | ccUpper: | ||
+ | ccLower: | ||
+ | jogSensitivity: | ||
+ | ledType: | ||
+ | } | ||
+ | |||
+ | KeyLock { | ||
+ | note: 34 | ||
+ | } | ||
+ | |||
+ | Vinyl { | ||
+ | note: 35 | ||
+ | } | ||
+ | |||
+ | Slip { | ||
+ | note: 36 | ||
+ | } | ||
+ | |||
+ | ManualLoop { | ||
+ | inNote: 37 | ||
+ | outNote: | ||
+ | } | ||
+ | |||
+ | AutoLoop { | ||
+ | pushNote: | ||
+ | turnCC: 32 | ||
+ | ledType: | ||
+ | } | ||
+ | |||
+ | SpeedSlider { | ||
+ | ccUpper: | ||
+ | ccLower: | ||
+ | downLedNote: | ||
+ | centreLedNote: | ||
+ | upLedNote: | ||
+ | } | ||
+ | |||
+ | DeckSelect { | ||
+ | primaryDeckIndex: | ||
+ | primaryDeckNote: | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | // Numbers of channels arranged from left to right: | ||
+ | readonly property var mixerChannelOrder: | ||
+ | Repeater { | ||
+ | model: mixerChannelOrder | ||
+ | |||
+ | ValueNoteAssignment { | ||
+ | objectName: | ||
+ | note: 21 + index | ||
+ | channel: 15 | ||
+ | output: QtObject { | ||
+ | readonly property QObjProperty pLine: Planck.getProperty("/ | ||
+ | function setValue(channel, | ||
+ | if(assignmentEnabled) { | ||
+ | pLine.translator.value = value | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | Repeater { | ||
+ | model: 4 | ||
+ | Item { | ||
+ | ColorOutputAssignment { | ||
+ | objectName: | ||
+ | idx: 13 | ||
+ | channel: | ||
+ | |||
+ | readonly property color deckColor: Planck.getProperty("/ | ||
+ | onColor: | ||
+ | } | ||
+ | } | ||
+ | Component.onCompleted: | ||
+ | device.sendSimpleColor(15, | ||
+ | device.sendSimpleColor(15, | ||
+ | device.sendSimpleColor(15, | ||
+ | device.sendSimpleColor(15, | ||
+ | device.sendSimpleColor(15, | ||
+ | |||
+ | device.sendSimpleColor(15, | ||
+ | device.sendSimpleColor(15, | ||
+ | device.sendSimpleColor(15, | ||
+ | device.sendSimpleColor(15, | ||
+ | device.sendSimpleColor(15, | ||
+ | } | ||
+ | } | ||
+ | |||
+ | /////// FX | ||
+ | |||
+ | Repeater { | ||
+ | model: ListModel { | ||
+ | ListElement { | ||
+ | deck: " | ||
+ | controlChannel: | ||
+ | ccIndex: | ||
+ | } | ||
+ | ListElement { | ||
+ | deck: " | ||
+ | controlChannel: | ||
+ | ccIndex: | ||
+ | } | ||
+ | ListElement { | ||
+ | deck: " | ||
+ | controlChannel: | ||
+ | ccIndex: | ||
+ | } | ||
+ | ListElement { | ||
+ | deck: " | ||
+ | controlChannel: | ||
+ | ccIndex: | ||
+ | } | ||
+ | } | ||
+ | OutputAssignment { | ||
+ | properties: | ||
+ | |||
+ | readonly property QObjProperty pCurrentBPM: | ||
+ | readonly property int currentBpm: pCurrentBPM && pCurrentBPM.translator ? Math.round(pCurrentBPM.translator.unnormalized * 10) : 1200 | ||
+ | readonly property int minMixerTempo: | ||
+ | readonly property int maxMixerTempo: | ||
+ | |||
+ | function send() { | ||
+ | if(currentBpm === 0) { | ||
+ | return | ||
+ | } | ||
+ | var bpm = currentBpm | ||
+ | Math.log2 = Math.log2 || function(x){return Math.log(x)*Math.LOG2E; | ||
+ | if(currentBpm < minMixerTempo) { | ||
+ | var wrapPower = Math.ceil(Math.log2(minMixerTempo / currentBpm)) | ||
+ | bpm = currentBpm * Math.pow(2, wrapPower) | ||
+ | } | ||
+ | else if(currentBpm > maxMixerTempo) { | ||
+ | var wrapPower = Math.ceil(Math.log2(currentBpm / maxMixerTempo)) | ||
+ | bpm = currentBpm / Math.pow(2, wrapPower) | ||
+ | } | ||
+ | Midi.sendControlChange(controlChannel, | ||
+ | Midi.sendControlChange(controlChannel, | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | property bool displaysActive : false | ||
+ | onDisplaysActiveChanged: | ||
+ | if(!displaysActive) { | ||
+ | clearPainter.draw(); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | ValueNoteAssignment { | ||
+ | objectName: | ||
+ | note: -1 | ||
+ | channel: -1 | ||
+ | output: QtObject { | ||
+ | function setValue(channel, | ||
+ | activityTimer.restart() | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ValueCCAssignment { | ||
+ | objectName: | ||
+ | cc: -1 | ||
+ | channel: -1 | ||
+ | output: QtObject { | ||
+ | function setValue(channel, | ||
+ | activityTimer.restart() | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | Connections { | ||
+ | target: globalConfig | ||
+ | onCurrentFocusAreaChanged: | ||
+ | activityTimer.restart() | ||
+ | } | ||
+ | } | ||
+ | |||
+ | Timer { | ||
+ | id: activityTimer | ||
+ | interval: 10 * 60 * 1000 | ||
+ | running: true | ||
+ | onRunningChanged: | ||
+ | if(running) { | ||
+ | displaysActive = true | ||
+ | } | ||
+ | } | ||
+ | |||
+ | onTriggered: | ||
+ | } | ||
+ | |||
+ | Painter { | ||
+ | id: clearPainter | ||
+ | width: 128 | ||
+ | height: 64 | ||
+ | format: Painter.AK01_DISPLAY | ||
+ | |||
+ | function draw() | ||
+ | { | ||
+ | setCompositionMode(Painter.SourceOver); | ||
+ | |||
+ | clear(" | ||
+ | setColor(" | ||
+ | |||
+ | for (var displayIndex = 0; displayIndex < device.oleds.length; | ||
+ | device.oleds[displayIndex].update(clearPainter) | ||
+ | } | ||
+ | } | ||
+ | |||
+ | Component.onDestruction: | ||
+ | } | ||
+ | |||
+ | |||
+ | Repeater { | ||
+ | model: ListModel { | ||
+ | ListElement { | ||
+ | sideChannel: | ||
+ | controlChannel: | ||
+ | displayIndex: | ||
+ | slotName: | ||
+ | } | ||
+ | ListElement { | ||
+ | sideChannel: | ||
+ | controlChannel: | ||
+ | displayIndex: | ||
+ | slotName: | ||
+ | } | ||
+ | } | ||
+ | |||
+ | Item { | ||
+ | id: beatSlot | ||
+ | readonly property QObjProperty pEffectType: | ||
+ | readonly property string effectType: pEffectType && pEffectType.translator ? pEffectType.translator.string : "" | ||
+ | |||
+ | readonly property bool hasBeatLengths: | ||
+ | |||
+ | ValueCCAssignment { | ||
+ | objectName: | ||
+ | cc: 4 | ||
+ | channel: | ||
+ | enabled: | ||
+ | output: JogOutput { | ||
+ | jogAcceleration: | ||
+ | jogSensitivity: | ||
+ | roundRobin: | ||
+ | |||
+ | type: 0 | ||
+ | target: | ||
+ | path: "/ | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | ValueNoteAssignment { | ||
+ | objectName: | ||
+ | note: 9 | ||
+ | channel: | ||
+ | enabled: | ||
+ | output: IncDecValueOutput { | ||
+ | target: | ||
+ | path: "/ | ||
+ | } | ||
+ | increaseValue: | ||
+ | roundRobin: | ||
+ | } | ||
+ | } | ||
+ | ValueNoteAssignment { | ||
+ | objectName: | ||
+ | note: 10 | ||
+ | channel: | ||
+ | enabled: | ||
+ | output: IncDecValueOutput { | ||
+ | target: | ||
+ | path: "/ | ||
+ | } | ||
+ | increaseValue: | ||
+ | roundRobin: | ||
+ | } | ||
+ | } | ||
+ | ValueNoteAssignment { | ||
+ | objectName: | ||
+ | note: 9 | ||
+ | channel: | ||
+ | initialValue: | ||
+ | enabled: | ||
+ | resendValueOnEnabledChanged: | ||
+ | |||
+ | output: QtObject { | ||
+ | function setValue(channel, | ||
+ | device.sendSimpleColor(sideChannel, | ||
+ | } | ||
+ | } | ||
+ | Component.onCompleted: | ||
+ | } | ||
+ | ValueNoteAssignment { | ||
+ | objectName: | ||
+ | note: 10 | ||
+ | channel: | ||
+ | initialValue: | ||
+ | enabled: | ||
+ | resendValueOnEnabledChanged: | ||
+ | |||
+ | output: QtObject { | ||
+ | function setValue(channel, | ||
+ | device.sendSimpleColor(sideChannel, | ||
+ | } | ||
+ | } | ||
+ | Component.onCompleted: | ||
+ | } | ||
+ | |||
+ | OutputAssignment { | ||
+ | properties: | ||
+ | function send() { | ||
+ | if(effectType === 'Bit Crush' | ||
+ | Midi.sendControlChange(controlChannel, | ||
+ | } | ||
+ | else { | ||
+ | Midi.sendControlChange(controlChannel, | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | OutputAssignment { | ||
+ | properties: | ||
+ | function send() { | ||
+ | Midi.sendControlChange(controlChannel, | ||
+ | } | ||
+ | readonly property bool fxEnable: Planck.getProperty("/ | ||
+ | onFxEnableChanged: | ||
+ | if (fxEnable) { | ||
+ | send() | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | Item { | ||
+ | Connections { | ||
+ | target: | ||
+ | onDisplaysActiveChanged: | ||
+ | if(assignment.displaysActive) { | ||
+ | beatDrawTimer.start() | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | Timer { | ||
+ | id: beatDrawTimer | ||
+ | interval: | ||
+ | onTriggered: | ||
+ | } | ||
+ | |||
+ | Painter { | ||
+ | id: beatDisplayPainter | ||
+ | width: 128 | ||
+ | height: | ||
+ | font.family: | ||
+ | font.weight: | ||
+ | font.pixelSize: | ||
+ | font.capitalization: | ||
+ | format: | ||
+ | |||
+ | property QObjProperty pBeatLength: | ||
+ | property string beatLength: pBeatLength && pBeatLength.translator ? pBeatLength.translator.string : "" | ||
+ | property int beatLengthIndex: | ||
+ | |||
+ | property QObjProperty pValue: Planck.getProperty("/ | ||
+ | property real value: pValue && pValue.translator ? pValue.translator.value : 0.25 | ||
+ | property int iValue: Math.round(value * 124) | ||
+ | |||
+ | property string effectType: beatSlot.effectType | ||
+ | |||
+ | function draw() | ||
+ | { | ||
+ | setCompositionMode(Painter.SourceOver); | ||
+ | |||
+ | clear(" | ||
+ | setColor(" | ||
+ | |||
+ | if(effectType === 'Bit Crush' | ||
+ | drawTextInRect(0, | ||
+ | } | ||
+ | else if(beatSlot.hasBeatLengths) { | ||
+ | drawTextInRect(0, | ||
+ | } | ||
+ | |||
+ | drawRect(0, | ||
+ | fillRect(2, | ||
+ | |||
+ | if(value !== 0.5) { | ||
+ | if(value > 0.5) | ||
+ | setColor(" | ||
+ | drawLine(62, | ||
+ | } | ||
+ | |||
+ | device.oleds[displayIndex].update(beatDisplayPainter) | ||
+ | } | ||
+ | |||
+ | onEffectTypeChanged: | ||
+ | onBeatLengthChanged: | ||
+ | onIValueChanged: | ||
+ | |||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | Repeater { | ||
+ | model: ListModel { | ||
+ | ListElement { | ||
+ | sideChannel: | ||
+ | controlChannel: | ||
+ | displayIndex: | ||
+ | slotName: | ||
+ | } | ||
+ | ListElement { | ||
+ | sideChannel: | ||
+ | controlChannel: | ||
+ | displayIndex: | ||
+ | slotName: | ||
+ | } | ||
+ | } | ||
+ | |||
+ | Item { | ||
+ | id: fxBank | ||
+ | ValueCCAssignment { | ||
+ | objectName: | ||
+ | cc: 1 | ||
+ | channel: | ||
+ | enabled: | ||
+ | output: JogOutput { | ||
+ | jogAcceleration: | ||
+ | jogSensitivity: | ||
+ | |||
+ | type: 0 | ||
+ | target: | ||
+ | path: "/ | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | ValueCCAssignment { | ||
+ | objectName: | ||
+ | cc: 2 | ||
+ | channel: | ||
+ | enabled: | ||
+ | output: JogOutput { | ||
+ | jogAcceleration: | ||
+ | jogSensitivity: | ||
+ | roundRobin: | ||
+ | |||
+ | type: 0 | ||
+ | target: | ||
+ | path: "/ | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ValueCCAssignment { | ||
+ | objectName: | ||
+ | cc: 3 | ||
+ | channel: | ||
+ | enabled: | ||
+ | output: JogOutput { | ||
+ | jogAcceleration: | ||
+ | jogSensitivity: | ||
+ | roundRobin: | ||
+ | |||
+ | type: 0 | ||
+ | target: | ||
+ | path: "/ | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | ValueNoteAssignment { | ||
+ | note: 6 | ||
+ | channel: | ||
+ | enabled: | ||
+ | output: IncDecValueOutput { | ||
+ | target: | ||
+ | path: "/ | ||
+ | } | ||
+ | changeAmount: | ||
+ | increaseValue: | ||
+ | roundRobin: | ||
+ | } | ||
+ | } | ||
+ | ValueNoteAssignment { | ||
+ | objectName: | ||
+ | note: 6 | ||
+ | channel: | ||
+ | output: QtObject { | ||
+ | function setValue(channel, | ||
+ | if(value< | ||
+ | return | ||
+ | } | ||
+ | var pEnable = Planck.getProperty("/ | ||
+ | if(!device.shift) { | ||
+ | pEnable.translator.state = !pEnable.translator.state | ||
+ | } else if(pEnable.translator.state) { | ||
+ | pEnable.translator.state = false | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ValueNoteAssignment { | ||
+ | objectName: | ||
+ | note: 7 | ||
+ | channel: | ||
+ | enabled: | ||
+ | output: QtObject { | ||
+ | function setValue(channel, | ||
+ | if(value< | ||
+ | return | ||
+ | } | ||
+ | var pTwoStateParam = Planck.getProperty("/ | ||
+ | pTwoStateParam.translator.state = !pTwoStateParam.translator.state | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ValueNoteAssignment { | ||
+ | objectName: | ||
+ | note: 8 | ||
+ | channel: | ||
+ | enabled: | ||
+ | output: QtObject { | ||
+ | function setValue(channel, | ||
+ | Midi.sendNoteOn(sideChannel, | ||
+ | if(value< | ||
+ | return | ||
+ | } | ||
+ | Planck.getProperty("/ | ||
+ | |||
+ | var pTwoStateParam = Planck.getProperty("/ | ||
+ | pTwoStateParam.translator.state = true | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | OutputAssignment { | ||
+ | properties: | ||
+ | function send() { | ||
+ | Midi.sendControlChange(controlChannel, | ||
+ | if(propertyData.type.string === 'Bit Crush' | ||
+ | Midi.sendControlChange(controlChannel, | ||
+ | } | ||
+ | else { | ||
+ | Midi.sendControlChange(controlChannel, | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | OutputAssignment { | ||
+ | properties: | ||
+ | function send() { | ||
+ | Midi.sendControlChange(controlChannel, | ||
+ | } | ||
+ | } | ||
+ | OutputAssignment { | ||
+ | properties: | ||
+ | function send() { | ||
+ | Midi.sendControlChange(controlChannel, | ||
+ | } | ||
+ | } | ||
+ | OutputAssignment { | ||
+ | properties: | ||
+ | function send() { | ||
+ | if(propertyData.fxEnable.state) { | ||
+ | Midi.sendNoteOn(sideChannel, | ||
+ | Midi.sendNoteOn(controlChannel, | ||
+ | } else { | ||
+ | Midi.sendNoteOn(sideChannel, | ||
+ | Midi.sendNoteOn(controlChannel, | ||
+ | Midi.sendNoteOff(controlChannel, | ||
+ | |||
+ | var pTwoStateParam = Planck.getProperty("/ | ||
+ | if (pTwoStateParam.translator.state === true) { | ||
+ | pTwoStateParam.translator.state = false | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | OutputAssignment { | ||
+ | |||
+ | properties: | ||
+ | ' | ||
+ | ' | ||
+ | } | ||
+ | |||
+ | property var flashStates: | ||
+ | |||
+ | Timer { | ||
+ | id: freezeTimer | ||
+ | repeat: | ||
+ | interval: | ||
+ | running: | ||
+ | property bool isOn: false | ||
+ | |||
+ | onTriggered: | ||
+ | isOn = !isOn | ||
+ | for(var x = 0; x < Object.keys(parent.flashStates).length; | ||
+ | var channelNumber = parent.flashStates[Object.keys(parent.flashStates)[x]] | ||
+ | if(channelNumber !== 0){ | ||
+ | if(isOn) { | ||
+ | Midi.sendNoteOn(channelNumber, | ||
+ | } else { | ||
+ | Midi.sendNoteOff(channelNumber, | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function stopTimer() { | ||
+ | delete flashStates[slotName] | ||
+ | if(Object.keys(flashStates).length === 0) | ||
+ | freezeTimer.stop() | ||
+ | } | ||
+ | |||
+ | function send() { | ||
+ | const dspNote = 2 | ||
+ | const colourNote = 7 | ||
+ | |||
+ | const full = 127 | ||
+ | const dim = 1 | ||
+ | |||
+ | if(propertyData.fxTwoStateParamName.string === "" | ||
+ | // No param | ||
+ | Midi.sendNoteOff(sideChannel, | ||
+ | Midi.sendNoteOff(controlChannel, | ||
+ | stopTimer() | ||
+ | } | ||
+ | else if(propertyData.fxTwoState.state){ | ||
+ | // Param present and on | ||
+ | var effectEnabled = Planck.getProperty("/ | ||
+ | var effectName = Planck.getProperty("/ | ||
+ | if(effectEnabled) { | ||
+ | Midi.sendNoteOn(sideChannel, | ||
+ | Midi.sendNoteOn(controlChannel, | ||
+ | if(effectName === " | ||
+ | freezeTimer.start() | ||
+ | flashStates[slotName] = sideChannel | ||
+ | } | ||
+ | } | ||
+ | else { | ||
+ | propertyData.fxTwoState.state = false | ||
+ | if(effectName === " | ||
+ | stopTimer() | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | else { | ||
+ | // Param present and off | ||
+ | Midi.sendNoteOn(sideChannel, | ||
+ | Midi.sendNoteOff(controlChannel, | ||
+ | stopTimer() | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | OutputAssignment { | ||
+ | properties: | ||
+ | function send() { | ||
+ | if(propertyData.fxTwoState.state) { | ||
+ | Midi.sendNoteOn(sideChannel, | ||
+ | } else { | ||
+ | Midi.sendNoteOn(sideChannel, | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | Item { | ||
+ | |||
+ | Timer { | ||
+ | id: fxSelectDrawTimer | ||
+ | repeat: | ||
+ | interval: | ||
+ | running: | ||
+ | onTriggered: | ||
+ | } | ||
+ | |||
+ | Painter { | ||
+ | id: fxSelectDisplayPainter | ||
+ | width: 128 | ||
+ | height: | ||
+ | font.family: | ||
+ | font.pixelSize: | ||
+ | font.capitalization: | ||
+ | format: | ||
+ | |||
+ | property QObjProperty pType: Planck.getProperty("/ | ||
+ | property string type: pType && pType.translator ? pType.translator.string : "" | ||
+ | |||
+ | function draw() | ||
+ | { | ||
+ | setCompositionMode(Painter.SourceOver); | ||
+ | clear(" | ||
+ | setColor(" | ||
+ | |||
+ | drawTextInRect(0, | ||
+ | device.oleds[displayIndex].update(fxSelectDisplayPainter) | ||
+ | } | ||
+ | |||
+ | onTypeChanged: | ||
+ | } | ||
+ | } | ||
+ | Item { | ||
+ | Timer { | ||
+ | id: drawTimer | ||
+ | repeat: | ||
+ | interval: | ||
+ | running: | ||
+ | onTriggered: | ||
+ | } | ||
+ | |||
+ | Painter { | ||
+ | id: fxDisplayPainter | ||
+ | width: 128 | ||
+ | height: | ||
+ | font.family: | ||
+ | font.weight: | ||
+ | font.pixelSize: | ||
+ | font.capitalization: | ||
+ | format: | ||
+ | |||
+ | property QObjProperty pType: Planck.getProperty("/ | ||
+ | property string type: pType && pType.translator ? pType.translator.string : "" | ||
+ | |||
+ | property QObjProperty pParamName: Planck.getProperty("/ | ||
+ | property string paramName: pParamName && pParamName.translator ? pParamName.translator.string : "" | ||
+ | |||
+ | property QObjProperty pValue: Planck.getProperty("/ | ||
+ | property real value: pValue && pValue.translator ? pValue.translator.value : 0.25 | ||
+ | property int iValue: Math.round(value * 124) | ||
+ | property string lastPattern: | ||
+ | |||
+ | readonly property var patterns: [ | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ] | ||
+ | |||
+ | function draw() | ||
+ | { | ||
+ | setCompositionMode(Painter.SourceOver); | ||
+ | |||
+ | clear(" | ||
+ | setColor(" | ||
+ | |||
+ | if(paramName !== ' | ||
+ | lastPattern = "" | ||
+ | } | ||
+ | if(paramName === ' | ||
+ | drawTextInRect(0, | ||
+ | |||
+ | var patternNumber = (value * 127) >> 3 | ||
+ | var ptn = patterns[patternNumber] | ||
+ | if(lastPattern === ptn) { | ||
+ | return | ||
+ | } | ||
+ | lastPattern = ptn | ||
+ | |||
+ | var x = 3 | ||
+ | for (var i = 0; i < ptn.length; i++) { | ||
+ | if (ptn[i] == ' | ||
+ | fillRect(x, | ||
+ | } | ||
+ | x = x + 7 | ||
+ | if ((i + 1) % 4 === 0) { | ||
+ | x = x + 3 | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | else if(paramName !== '' | ||
+ | drawTextInRect(0, | ||
+ | if(type === 'Ping Pong') { | ||
+ | var newValue = (2 * value) - 1 | ||
+ | drawRect(0, | ||
+ | fillRect(2, | ||
+ | fillRect(64, | ||
+ | fillRect(64, | ||
+ | fillRect(64, | ||
+ | } | ||
+ | else { | ||
+ | drawRect(0, | ||
+ | fillRect(2, | ||
+ | } | ||
+ | } | ||
+ | |||
+ | device.oleds[displayIndex+1].update(fxDisplayPainter) | ||
+ | } | ||
+ | |||
+ | onParamNameChanged: | ||
+ | onIValueChanged: | ||
+ | } | ||
+ | } | ||
+ | Item { | ||
+ | Timer { | ||
+ | id: fqDrawTimer | ||
+ | repeat: | ||
+ | interval: | ||
+ | running: | ||
+ | onTriggered: | ||
+ | } | ||
+ | |||
+ | Timer { | ||
+ | id: waitTimer | ||
+ | repeat: | ||
+ | interval: | ||
+ | running: | ||
+ | onTriggered: | ||
+ | } | ||
+ | |||
+ | Painter { | ||
+ | id: fqDisplayPainter | ||
+ | width: 128 | ||
+ | height: | ||
+ | font.family: | ||
+ | font.weight: | ||
+ | font.pixelSize: | ||
+ | font.capitalization: | ||
+ | format: | ||
+ | |||
+ | property QObjProperty pValue: Planck.getProperty("/ | ||
+ | property real value: pValue && pValue.translator ? pValue.translator.value : 0.25 | ||
+ | property int iValue: Math.round(value * 124) | ||
+ | property bool drawTitle: false | ||
+ | |||
+ | property var freqencyArray: | ||
+ | 60, | ||
+ | 124, | ||
+ | 256, | ||
+ | 554, | ||
+ | 1145, | ||
+ | 2366, | ||
+ | 4889, | ||
+ | 10103, | ||
+ | |||
+ | function drawFrequencyTitle() | ||
+ | { | ||
+ | drawTitle = true | ||
+ | draw() | ||
+ | } | ||
+ | |||
+ | function draw() | ||
+ | { | ||
+ | setCompositionMode(Painter.SourceOver); | ||
+ | |||
+ | clear(" | ||
+ | setColor(" | ||
+ | |||
+ | waitTimer.restart() | ||
+ | |||
+ | if(iValue === 62){ | ||
+ | drawTextInRect(0, | ||
+ | fillRect(2, | ||
+ | } | ||
+ | else if(value < 0.5) { | ||
+ | var msg = freqencyArray[iValue] + " | ||
+ | if(freqencyArray[iValue] >= 1000) { | ||
+ | msg = (freqencyArray[iValue]/ | ||
+ | } | ||
+ | drawTextInRect(0, | ||
+ | fillRect(2, | ||
+ | } else { | ||
+ | var val = iValue-63 | ||
+ | var msg = freqencyArray[val] + " | ||
+ | if(freqencyArray[val] >= 1000) { | ||
+ | msg = (freqencyArray[val]/ | ||
+ | } | ||
+ | drawTextInRect(0, | ||
+ | fillRect(2 + (value - 0.5) * 2 * 125, 20, 124, 10, " | ||
+ | } | ||
+ | drawRect(0, | ||
+ | |||
+ | if(drawTitle === true){ | ||
+ | setCompositionMode(Painter.SourceOver); | ||
+ | fillRect(0, | ||
+ | drawTextInRect(0, | ||
+ | drawTitle = false | ||
+ | waitTimer.stop() | ||
+ | } | ||
+ | |||
+ | device.oleds[displayIndex+2].update(fqDisplayPainter) | ||
+ | } | ||
+ | |||
+ | onIValueChanged: | ||
+ | } | ||
+ | } | ||
+ | |||
+ | Connections { | ||
+ | target: assignment | ||
+ | onDisplaysActiveChanged: | ||
+ | if(assignment.displaysActive) { | ||
+ | fxSelectDrawTimer.start() | ||
+ | drawTimer.start() | ||
+ | fqDrawTimer.start() | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | readonly property var activeDecks: | ||
+ | property var deckThru: [0, 0, 0, 0] | ||
+ | property bool xFaderStartLeft: | ||
+ | property bool xFaderStartRight: | ||
+ | |||
+ | ValueNoteAssignment { | ||
+ | note: 25 | ||
+ | channel: 15 | ||
+ | output: QtObject { | ||
+ | function setValue(channel, | ||
+ | xFaderStartLeft = value !== 0 | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ValueNoteAssignment { | ||
+ | note: 27 | ||
+ | channel: 15 | ||
+ | output: QtObject { | ||
+ | function setValue(channel, | ||
+ | xFaderStartRight = value !== 0 | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | property var crossFaderTable: | ||
+ | 0.00000000, | ||
+ | 0.00205353, | ||
+ | 0.01090184, | ||
+ | 0.04340103, | ||
+ | 0.10441190, | ||
+ | 0.20832913, | ||
+ | 0.35995648, | ||
+ | 0.44990933, | ||
+ | 0.50626161, | ||
+ | 0.56640229, | ||
+ | 0.63551382, | ||
+ | 0.71511354, | ||
+ | 0.79719121, | ||
+ | 0.84442776, | ||
+ | 0.89446325, | ||
+ | 0.94746353, | ||
+ | ]; | ||
+ | |||
+ | function calculateExternalMixerVolume(deckIndex) | ||
+ | { | ||
+ | var crossFader = Planck.getProperty("/ | ||
+ | var deckVolume = Planck.getProperty("/ | ||
+ | var externalVolume | ||
+ | |||
+ | if(deckThru[deckIndex - 1] === 1) { | ||
+ | externalVolume = deckVolume | ||
+ | } else { | ||
+ | var deckIdx = parseInt(deckIndex, | ||
+ | if(deckIdx === 1 || deckIdx === 3) { | ||
+ | if(deckThru[deckIdx - 1] === 2) { | ||
+ | crossFader = 1 - crossFader | ||
+ | } | ||
+ | } else if(deckIdx === 2 || deckIdx === 4) { | ||
+ | if(deckThru[deckIdx - 1] === 0) { | ||
+ | crossFader = 1 - crossFader | ||
+ | } | ||
+ | } | ||
+ | var faderIndex = crossFader * 511; | ||
+ | |||
+ | if (deckIdx === 1 || deckIdx === 3) | ||
+ | { | ||
+ | faderIndex = 511 - faderIndex; | ||
+ | } | ||
+ | if (faderIndex > 255) | ||
+ | { | ||
+ | faderIndex = 255; | ||
+ | } | ||
+ | |||
+ | var crossFaderLow = crossFaderTable[Math.floor(faderIndex)] | ||
+ | var crossFaderHigh = crossFaderTable[Math.ceil(faderIndex)] | ||
+ | |||
+ | var interpolatedTableValue = crossFaderLow + ((crossFaderHigh - crossFaderLow) * (crossFader - Math.floor(crossFader))); | ||
+ | externalVolume = deckVolume * interpolatedTableValue; | ||
+ | } | ||
+ | |||
+ | Planck.getProperty("/ | ||
+ | |||
+ | } | ||
+ | |||
+ | ValueCCAssignment { | ||
+ | id: xfaderStartStop | ||
+ | objectName: | ||
+ | cc: 14 | ||
+ | channel: 15 | ||
+ | enabled: xFaderStartLeft || xFaderStartRight | ||
+ | |||
+ | property QObjProperty pCrossFaderPosition: | ||
+ | |||
+ | output: QtObject { | ||
+ | function setValue(channel, | ||
+ | xfaderStartStop.pCrossFaderPosition.translator.value = value | ||
+ | if(assignmentEnabled) { | ||
+ | for (var i = 0; i < deckThru.length; | ||
+ | calculateExternalMixerVolume(i+1); | ||
+ | var deckIndex = " | ||
+ | var deckIsActive = activeDecks.indexOf(deckIndex) !== -1 | ||
+ | if(xFaderStartLeft && deckIsActive && deckThru[i] === 0) { | ||
+ | if (value === 1) | ||
+ | Planck.getProperty("/ | ||
+ | else | ||
+ | Planck.getProperty("/ | ||
+ | } | ||
+ | if (xFaderStartRight && deckIsActive && deckThru[i] === 2) { | ||
+ | if (value === 0) | ||
+ | Planck.getProperty("/ | ||
+ | else | ||
+ | Planck.getProperty("/ | ||
+ | } | ||
+ | } | ||
+ | } else { | ||
+ | for (var index = 1; index < deckThru.length + 1; index++) { | ||
+ | calculateExternalMixerVolume(index); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | |||
+ | Repeater { | ||
+ | model: parseInt(Planck.getProperty("/ | ||
+ | Item { | ||
+ | property string deckIndex: " | ||
+ | |||
+ | ValueCCAssignment { | ||
+ | objectName: | ||
+ | cc: 14 | ||
+ | channel: | ||
+ | output: QtObject { | ||
+ | function setValue(channel, | ||
+ | Planck.getProperty("/ | ||
+ | calculateExternalMixerVolume(deckIndex); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | ValueNoteAssignment { | ||
+ | objectName: | ||
+ | note: 15 | ||
+ | channel: | ||
+ | normalizeValue: | ||
+ | output: QtObject { | ||
+ | function setValue(channel, | ||
+ | deckThru[channel] = value | ||
+ | calculateExternalMixerVolume(deckIndex) | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | And what it gives : | ||
+ | I'm in slicer mode, on the 2 decks. | ||
+ | |||
+ | |||
+ | {{http:// | ||
prime4.1694375067.txt.gz · Last modified: 2023/09/10 21:44 by ounsatn