### Added

- preset for hold to beep (basically the 'censor beep')
This commit is contained in:
2024-01-27 00:59:01 -05:00
parent 73e4f56599
commit 56d486e4cf
2 changed files with 45 additions and 8 deletions

14
main.js
View File

@@ -3,6 +3,7 @@ const UpgradeScripts = require('./upgrades')
const UpdateActions = require('./actions') const UpdateActions = require('./actions')
const UpdateFeedbacks = require('./feedbacks') const UpdateFeedbacks = require('./feedbacks')
const UpdateVariableDefinitions = require('./variables') const UpdateVariableDefinitions = require('./variables')
const UpdatePresets = require('./presets')
const { VoiceMod } = require('voicemod') const { VoiceMod } = require('voicemod')
class ModuleInstance extends InstanceBase { class ModuleInstance extends InstanceBase {
@@ -108,6 +109,7 @@ class ModuleInstance extends InstanceBase {
this.loaded = true this.loaded = true
this.updateStatus(InstanceStatus.Ok) this.updateStatus(InstanceStatus.Ok)
this.updatePresets()
this.updateActionsFeedbacksVariables() this.updateActionsFeedbacksVariables()
this.log('debug', 'connected to VM and ready') this.log('debug', 'connected to VM and ready')
@@ -123,7 +125,6 @@ class ModuleInstance extends InstanceBase {
this.updateStatus(InstanceStatus.UnknownError) this.updateStatus(InstanceStatus.UnknownError)
++this.failure ++this.failure
} }
if (this.loaded === false) await this.sleep(500)
} while (this.loaded === false && this.failure < 5) } while (this.loaded === false && this.failure < 5)
} }
// When module gets deleted // When module gets deleted
@@ -146,13 +147,6 @@ class ModuleInstance extends InstanceBase {
tooltip: 'Enter the IP/Hostname for the voicemod instance', tooltip: 'Enter the IP/Hostname for the voicemod instance',
default: '127.0.0.1', default: '127.0.0.1',
}, },
// {
// id: 'apiKey',
// type: 'textinput',
// label: 'API Key',
// tooltip: 'Enter your developer API Key for voicemod (not required for now)',
// default: '',
// },
] ]
} }
@@ -183,6 +177,10 @@ class ModuleInstance extends InstanceBase {
voiceSelected: this.currentVoiceName, voiceSelected: this.currentVoiceName,
}) })
} }
updatePresets() {
UpdatePresets(this)
}
} }
runEntrypoint(ModuleInstance, UpgradeScripts) runEntrypoint(ModuleInstance, UpgradeScripts)

39
presets.js Normal file
View File

@@ -0,0 +1,39 @@
const { combineRgb } = require('@companion-module/base')
module.exports = async function (self) {
const presets = {}
presets[`beep`] = {
type: 'button',
category: 'Sounds',
name: 'Beep!',
style: {
text: `Beep!`,
size: '24',
color: combineRgb(255, 255, 255),
bgcolor: combineRgb(0, 0, 0),
},
steps: [
{
down: [
{
actionId: 'set_beep_sound',
options: {
beepEnabled: true,
},
},
],
up: [
{
actionId: 'set_beep_sound',
options: {
beepEnabled: false,
},
},
],
},
],
feedbacks: [],
}
self.setPresetDefinitions(presets)
}