Skip to content

Commit

Permalink
Merge pull request #136 from istnv/feat/pauseresume
Browse files Browse the repository at this point in the history
Add a computed pause/unpause command
  • Loading branch information
istnv authored Jul 24, 2024
2 parents b00f55c + e0894d8 commit 31dd276
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 36 deletions.
74 changes: 67 additions & 7 deletions actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,13 @@ export function compileActionDefinitions(self) {
await sendCommand(action, pfx + cmd + sfx, args)
},
},
add_slice: {
name: 'Add Slice',
options: [],
callback: async (action, context) => {
await sendCommand(action, '/cue/selected/addSliceMarker')
}
},
add_slice: {
name: 'Add Slice',
options: [],
callback: async (action, context) => {
await sendCommand(action, '/cue/selected/addSliceMarker')
},
},
previous: {
name: 'Previous Cue',
options: [],
Expand Down Expand Up @@ -394,6 +394,66 @@ export function compileActionDefinitions(self) {
await sendCommand(action, '/cue/selected/togglePause')
},
},
new_togglePause: {
name: 'Pause/Resume toggle with optional Cue selection',
options: [
{
type: 'dropdown',
label: 'Scope',
id: 'scope',
default: 'D',
choices: Choices.FB_SCOPE,
},
{
type: 'textinput',
label: 'Cue Number',
id: 'q_num',
default: self.nextCue.q_num,
useVariables: true,
isVisible: (options, data) => {
return options.scope === 'N'
},
},
{
type: 'textinput',
label: 'Cue ID',
id: 'q_id',
default: self.nextCue.q_id,
useVariables: true,
isVisible: (options, data) => {
return options.scope === 'I'
},
},
],
callback: async (action, context) => {
const opt = action.options
const scope = opt.scope
let cmd = ''
let pfx = ''

switch (scope) {
case 'D':
pfx = '/cue/playhead/'
cmd = self.nextCue.isPaused ? 'resume' : 'pause'
break
case 'R':
let rc = self.runningCue
cmd = self.runningCue.isPaused ? 'resume' : 'pause'
pfx = `/cue_id/${rc.uniqueID}/`
break
case 'N':
let qnum = await context.parseVariablesInString(opt.q_num.trim())
pfx = `/cue/${qnum}/`
cmd = self.wsCues[self.cueByNum[qnum]].isPaused ? 'resume' : 'pause'
break
case 'I':
let qid = await context.parseVariablesInString(opt.q_id.trim())
pfx = `/cue_id/${qid}/`
cmd = self.wsCues[qid].isPaused ? 'resume' : 'pause'
}
await sendCommand(action, pfx + cmd)
},
},
stopSelected: {
name: 'Stop selected',
options: [],
Expand Down
5 changes: 3 additions & 2 deletions companion/HELP.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Contributions for development and maintenance of this open source module are alw
| **Audition GO** | 'Audition' the current cue QLab5 Only |
| **Audition Preview** | 'Audition' Preview the selected cue without moving the Playhead. QLab5 Only |
| **Toggle Pause** | Pause/Unpause selected cue |
| **Pause Toggle (Cue/ID)** | Toggle pause mode for the selected cue. Unlike the built-in `togglePause` command, this one uses the state of the current cue |
| **GoTo (Cue/ID)** | Move the playhead to (Cue/ID). Does not start the cue. |
| **Start (Cue/ID)** | Start (Cue/ID). Does not move the playhead. If the specified cue is playing, this command has no effect. |
| **Stop (Cue/ID)** | Stops (Cue/ID) if Playing. Does not move the playhead. |
Expand Down Expand Up @@ -143,8 +144,8 @@ To use these, replace INSTANCENAME with the name of your module instance.
| **Show if ANY cue is runing** | Set the button to show when any cue is running |
| **Show Cue # is Running** | Set the button to show when a specific cue is running |
| **Show Cue ID is Running** | Set the button to show when a specific cue ID is running |
| **Show Cue is Armed** | Set the button to show when a requested cues are Armed |
| **Show Cue is Flagged** | Set the button to show when a requested cues are Flagged |
| **Show Cue is Armed** | Set the button to show when a requested cues are Armed |
| **Show Cue is Flagged** | Set the button to show when a requested cues are Flagged |

## OSC

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "figure53-qlab-advance",
"version": "2.7.4",
"version": "2.8.0",
"main": "qlabfb.js",
"type": "module",
"scripts": {
Expand Down
89 changes: 63 additions & 26 deletions presets.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,6 @@ function textColor(pbin) {
export function compilePresetDefinitions(self) {
const presets = {}

presets['cuelist-pause'] = {
type: 'button',
category: 'CueList',
name: 'Pause',
style: {
text: '',
png64: Icons.ICON_PAUSE_INACTIVE,
pngalignment: 'center:center',
size: '18',
color: combineRgb(255, 255, 255),
bgcolor: 0,
},
steps: [
{
down: [
{
actionId: 'pause',
options: {},
},
],
up: [],
},
],
feedbacks: [],
}

presets['cuelist-go'] = {
type: 'button',
category: 'CueList',
Expand Down Expand Up @@ -104,6 +78,69 @@ export function compilePresetDefinitions(self) {
],
}

presets['cuelist-pause-resume'] = {
type: 'button',
category: 'CueList',
name: 'Pause Toggle',
style: {
text: '',
png64: Icons.ICON_PAUSE_INACTIVE,
pngalignment: 'center:center',
size: '18',
color: combineRgb(255, 255, 255),
bgcolor: 0,
},
steps: [
{
down: [
{
actionId: 'new_togglePause',
options: {
scope: 'R',
},
},
],
up: [],
},
],
feedbacks: [
{
feedbackId: 'q_paused',
options: {
scope: 'R',
},
style: {
bgcolor: combineRgb(102, 0, 102),
color: combineRgb(255, 255, 255),
},
},
],
}

presets['cuelist-pause'] = {
type: 'button',
category: 'CueList',
name: 'Pause',
style: {
text: 'Pause',
size: '18',
color: combineRgb(255, 255, 255),
bgcolor: 0,
},
steps: [
{
down: [
{
actionId: 'pause',
options: {},
},
],
up: [],
},
],
feedbacks: [],
}

presets['cuelist-resume'] = {
type: 'button',
category: 'CueList',
Expand Down

0 comments on commit 31dd276

Please sign in to comment.