mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-14 11:53:49 +00:00
Feat/osc feedback (#35)
* Add roll function call to OSC * send finished message * request presenter * handling badly formatted messages * loadeventbyindex add step so that we can pause the titles when loading a new event via an API call (eg. OSC) * broadcast title data * handle empty title fields * send finished message in roll mode * calling stop is same as calling unload
This commit is contained in:
@@ -26,7 +26,15 @@ export const initiateOSC = (config) => {
|
||||
const args = msg[1];
|
||||
|
||||
// get first part before (ontime)
|
||||
if (address !== 'ontime') return;
|
||||
if (address !== 'ontime') {
|
||||
console.error(`OSC IN: Message address ${address} not recognised`);
|
||||
return;
|
||||
}
|
||||
|
||||
if (path == null) {
|
||||
console.error('OSC IN: No path found');
|
||||
return;
|
||||
}
|
||||
|
||||
// get second part (command)
|
||||
switch (path.toLowerCase()) {
|
||||
@@ -48,6 +56,7 @@ export const initiateOSC = (config) => {
|
||||
global.timer.next();
|
||||
break;
|
||||
case 'unload':
|
||||
case 'stop':
|
||||
console.log('calling unload');
|
||||
global.timer.unload();
|
||||
break;
|
||||
@@ -57,12 +66,17 @@ export const initiateOSC = (config) => {
|
||||
break;
|
||||
case 'roll':
|
||||
console.log('calling roll');
|
||||
global.timer.roll();
|
||||
break;
|
||||
case 'delay':
|
||||
console.log('calling delay with', args);
|
||||
try {
|
||||
let t = parseInt(args);
|
||||
if (!isNaN(t)) global.timer.increment(t * 1000 * 60);
|
||||
if (isNaN(t)) {
|
||||
console.error(`OSC IN: delay time not recognised ${args}`);
|
||||
return;
|
||||
}
|
||||
global.timer.increment(t * 1000 * 60);
|
||||
} catch (error) {
|
||||
console.log('error parsing: ', error);
|
||||
}
|
||||
@@ -71,16 +85,24 @@ export const initiateOSC = (config) => {
|
||||
console.log('calling goto with', args);
|
||||
try {
|
||||
let eventIndex = parseInt(args);
|
||||
if (isNaN(eventIndex) || eventIndex <= 0 || eventIndex == null)
|
||||
return;
|
||||
global.timer.loadEvent(eventIndex - 1, undefined, true);
|
||||
if (isNaN(eventIndex) || eventIndex <= 0 || eventIndex == null) {
|
||||
console.error(
|
||||
`OSC IN: event index not recognised or out of range ${eventIndex}`
|
||||
);
|
||||
}
|
||||
global.timer.loadEventByIndex(eventIndex - 1, undefined, true);
|
||||
} catch (error) {
|
||||
console.log('error calling goto: ', error);
|
||||
}
|
||||
break;
|
||||
case 'gotoid':
|
||||
console.log('calling gotoid with', args);
|
||||
if (args == null) return;
|
||||
if (args == null) {
|
||||
console.error(
|
||||
`OSC IN: event id not recognised or out of range ${args}`
|
||||
);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
global.timer.loadEventById(args.toString().toLowerCase());
|
||||
} catch (error) {
|
||||
@@ -89,7 +111,7 @@ export const initiateOSC = (config) => {
|
||||
break;
|
||||
|
||||
default:
|
||||
console.log('Error: not recognised');
|
||||
console.log(`Error: unhandled message ${path}`);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user