feat: osc goto

- renamed previous goto to gotoid
This commit is contained in:
cv
2021-05-15 23:50:44 +02:00
parent f38823e077
commit 5959053e94
2 changed files with 17 additions and 6 deletions
+6 -5
View File
@@ -461,18 +461,15 @@ class EventTimer extends Timer {
if (eventIndex === -1) return;
this.pause();
this.loadEvent(eventIndex);
this.broadcastState();
this.loadEvent(eventIndex, true, true);
}
// Loads a given event
// load timers
// load selectedEventIndex
// load titles
loadEvent(eventIndex, type = 'load') {
loadEvent(eventIndex, type = 'load', broadcastChange = 'false') {
const e = this._eventlist[eventIndex];
if (e == null) return;
const start = e.timeStart == null || e.timeStart === '' ? 0 : e.timeStart;
@@ -503,6 +500,10 @@ class EventTimer extends Timer {
// look for event after
this._loadTitlesNext();
if (broadcastChange)
// broadcast current state
this.broadcastState();
}
_loadTitlesNow() {
+11 -1
View File
@@ -20,7 +20,7 @@ const initiateOSC = (config) => {
if (address !== 'ontime') return;
// get second part (command)
switch (path) {
switch (path.toLocaleLowerCase()) {
case 'start':
case 'play':
console.log('calling play');
@@ -60,6 +60,16 @@ const initiateOSC = (config) => {
break;
case 'goto':
console.log('calling goto with', args);
try {
let eventIndex = parseInt(args);
if (isNaN(eventIndex) || eventIndex <= 0) return;
global.timer.loadEvent(eventIndex - 1, undefined, true);
} catch (error) {
console.log('error calling goto: ', error);
}
break;
case 'gotoid':
console.log('calling gotoid with', args);
try {
global.timer.loadEventById(args.toLowerCase());
} catch (error) {