Created
September 26, 2022 03:06
-
-
Save FigBug/b4321d3da301b552bead04ec4408ecbc to your computer and use it in GitHub Desktop.
Script Markers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ScriptMarkers() { | |
// Variables: these must be filled out so the session knows your controller layout | |
this.deviceDescription = "Script Markers"; // device name | |
this.needsMidiChannel = false; // send midi controller to daw | |
this.needsMidiBackChannel = false; // send midi daw to controller | |
this.needsOSCSocket = false; // communicate via osc | |
this.numberOfFaderChannels = 0; // number physical faders | |
this.numCharactersForTrackNames = 0; // characters of channel text | |
this.numCharactersForAuxLabels = 0; // characters of aux text | |
this.numParameterControls = 0; // number of labelled rotary dials that can control things like plugin parameters | |
this.numCharactersForParameterLabels = 0; // characters for rotary dials | |
this.wantsClock = false; // device wants MIDI clock | |
this.allowBankingOffEnd = true; // allow surface to display blank channels | |
this.numMarkers = 1000; // number of markers that can be displayed | |
this.numCharactersForMarkerLabels = 1000; // characters for markers | |
this.wantsAuxBanks = false; // display auxes | |
this.numAuxes = 0; // number of auxes that can be displayed | |
this.followsTrackSelection = false; // controller track follows UI selection | |
// Private variables: Any notes for the user here | |
this.notes = "Create clips with scripts and the activate when the playhead hits them"; | |
// Called once at startup. | |
this.initialise = function() { | |
}; | |
// Called at startup or any time the midi or osc ports change. | |
// You may now be talking to a new physical device now, time to | |
// initialise the hardware again | |
this.initialiseDevice = function() { | |
}; | |
// Called at shutdown | |
this.shutDownDevice = function() { | |
}; | |
// msg is array of midi bytes. return true to handle this message, otherwise false | |
// to pass on to the daw | |
// A keyboard with faders would return true for fader messages and false for keys | |
this.wantsMessage = function(msg) { | |
return true; | |
}; | |
// return true if you want all midi messages no matter what | |
// Something like a control surface should return true | |
// A keyboard with a few control surface knobs should say false | |
this.eatsAllMessages = function() { | |
return true; | |
}; | |
// Are plugin params visible on controller | |
this.isShowingPluginParams = function() { | |
return false; | |
}; | |
// Are markers showing on the controller | |
this.isShowingMarkers = function() { | |
return true; | |
}; | |
// Are tracks showing on the controller | |
this.isShowingTracks = function() { | |
return false; | |
}; | |
// is this the selected plugin? | |
this.isPluginSelected = function(plugin) { | |
return false; | |
}; | |
// If you started a timer, this callback will be called when it fires | |
this.onTimer = function(name) { | |
}; | |
// tells the device that the playback position has changed, so if it has a timecode | |
// display, it should update it. | |
this.onTimecodeChanged = function(barsOrHours, beatsOrMinutes, ticksOrSeconds, millisecs, isBarsBeats, isFrames) { | |
}; | |
// newValue.label | |
// newValue.number | |
// newValue.absolute | |
this.onMarkerChanged = function(parameterNumber, newValue) { | |
triggerAsyncUpdate(); | |
}; | |
this.onMarkerCleared = function(parameterNumber) { | |
triggerAsyncUpdate(); | |
}; | |
this.onAsyncUpdate = function() { | |
logMsg("update"); | |
if (Tracktion.isOnEditScreen()) { | |
var track = Tracktion.getMarkerTrack(); | |
if (track != null) { | |
logMsg(track); | |
var clips = Tracktion.getClipsFromTracks (track); | |
for (var i = 0; i < clips.length; i++) { | |
var clip = clips[i]; | |
logMsg(clip); | |
} | |
} | |
} else { | |
} | |
} | |
} | |
var controller = new ScriptMarkers(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment