Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 93b30c0

Browse files
authoredJun 24, 2024
Merge pull request #6 from phillipivan/main
Add action recorder
2 parents b1f888b + 5c416f1 commit 93b30c0

File tree

5 files changed

+66
-8
lines changed

5 files changed

+66
-8
lines changed
 

‎companion/HELP.md

+7
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,15 @@ They will not have a value assigned until used by an action.
4343

4444
No feedbacks are provided. The native Internal Variable Check Value feedback is suitable for common feedback tasks such as mute tally when provided with a controls value or position variable.
4545

46+
## Action Recorder
47+
The Action Recorder will translate any recieved numeric valueIs messages into Control Position Set (if RATCv2) or Control Set actions.
48+
4649
## Version History
4750

51+
### Version 1.1.0
52+
- Action Recorder
53+
- Update dependencies
54+
4855
### Version 1.0.3
4956
- Minor fixes
5057

‎package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "peavy-ratc",
3-
"version": "1.0.3",
3+
"version": "1.1.0",
44
"main": "src/main.js",
55
"scripts": {
66
"test": "echo \"Error: no test specified\" && exit 1",
@@ -17,7 +17,7 @@
1717
"@companion-module/base": "~1.8.0"
1818
},
1919
"devDependencies": {
20-
"@companion-module/tools": "^1.5.0"
20+
"@companion-module/tools": "^1.5.1"
2121
},
2222
"prettier": "@companion-module/tools/.prettierrc.json"
2323
}

‎src/main.js

+5
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ class PEAVY_RATC extends InstanceBase {
4848
initVariables() {
4949
}
5050

51+
// Track whether actions are being recorded
52+
handleStartStopRecordActions(isRecording) {
53+
this.isRecordingActions = isRecording
54+
}
55+
5156
updateActions() {
5257
UpdateActions(this)
5358
}

‎src/processcmd.js

+46
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,29 @@ module.exports = {
113113
break
114114
case resp.ratcV1.valueIs:
115115
this.log('info', `${reply}`)
116+
if (this.isRecordingActions) {
117+
if (this.config.v2) {
118+
if (!isNaN(valPos[1])) {
119+
this.recordAction(
120+
{
121+
actionId: 'controlPositionSet',
122+
options: { alias: aliases[1], value: valPos[1] },
123+
},
124+
`controlPositionSet ${aliases[1]}`
125+
)
126+
}
127+
} else {
128+
if (!isNaN(Number(valPos[0])))
129+
this.recordAction(
130+
{
131+
actionId: 'controlSet',
132+
options: { alias: aliases[1], value: valPos[0] },
133+
},
134+
`controlSet ${aliases[1]}`
135+
)
136+
}
137+
138+
}
116139
aliases[1] = aliases[1].replaceAll(/\/| /g,'_')
117140
this.log('debug', `control data for alias: ${aliases[1]} value: ${valPos[0]} position: ${valPos[1]}`)
118141
aliasValues[`controlAliasValue_${aliases[1]}`] = valPos[0]
@@ -184,6 +207,29 @@ module.exports = {
184207
break
185208
case resp.ratcV2.valueIs:
186209
this.log('debug', `${reply}`)
210+
if (this.isRecordingActions) {
211+
if (this.config.v2) {
212+
if (!isNaN(valPos[1])) {
213+
this.recordAction(
214+
{
215+
actionId: 'controlPositionSet',
216+
options: { alias: aliases[1], value: valPos[1] },
217+
},
218+
`controlPositionSet ${aliases[1]}`
219+
)
220+
}
221+
} else {
222+
if (!isNaN(Number(valPos[0])))
223+
this.recordAction(
224+
{
225+
actionId: 'controlSet',
226+
options: { alias: aliases[1], value: valPos[0] },
227+
},
228+
`controlSet ${aliases[1]}`
229+
)
230+
}
231+
232+
}
187233
aliases[1] = aliases[1].replace(' ', '_').replace('/','')
188234
this.log('debug', `control data for alias: ${aliases[1]} value: ${valPos[0]} position: ${valPos[1]}`)
189235
aliasValues[`controlAliasValue_${aliases[1]}`] = valPos[0]

‎yarn.lock

+6-6
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
p-timeout "^4.1.0"
2525
tslib "^2.6.2"
2626

27-
"@companion-module/tools@^1.5.0":
28-
version "1.5.0"
29-
resolved "https://registry.yarnpkg.com/@companion-module/tools/-/tools-1.5.0.tgz#ce3cc1fc8aa71ebcbb8fcc65ccaad22099bb3c9e"
30-
integrity sha512-J9sY2DE6i7bWYZ1uoPE8Drux53StYVqpVe+xHF0mERvV9QXOvPQ5AqxM12ts/Jd0vzd94jqLEUzm1I/y/KEWtw==
27+
"@companion-module/tools@^1.5.1":
28+
version "1.5.1"
29+
resolved "https://registry.yarnpkg.com/@companion-module/tools/-/tools-1.5.1.tgz#5f5d3e65eee22926e704de3084e3f66de9d841d0"
30+
integrity sha512-9KJC0mZLpg7dlS3MKCYzbUbOjiDMpjjwHgeAxMzh9AOM1ybgsEkmYLfIyZ/EWWSSJ/1s75IJmOtIUWVkZUuqhQ==
3131
dependencies:
3232
"@typescript-eslint/eslint-plugin" "^5.59.9"
3333
"@typescript-eslint/parser" "^5.59.9"
@@ -38,7 +38,7 @@
3838
find-up "^7.0.0"
3939
parse-author "^2.0.0"
4040
prettier "^2.8.8"
41-
tar "^6.2.0"
41+
tar "^6.2.1"
4242
webpack "^5.90.0"
4343
webpack-cli "^5.1.4"
4444
zx "^7.2.3"
@@ -1941,7 +1941,7 @@ tapable@^2.1.1, tapable@^2.2.0:
19411941
resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0"
19421942
integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==
19431943

1944-
tar@^6.2.0:
1944+
tar@^6.2.1:
19451945
version "6.2.1"
19461946
resolved "https://registry.yarnpkg.com/tar/-/tar-6.2.1.tgz#717549c541bc3c2af15751bea94b1dd068d4b03a"
19471947
integrity sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==

0 commit comments

Comments
 (0)
Please sign in to comment.