diff --git a/main.js b/main.js index 7b1058a..7f13839 100644 --- a/main.js +++ b/main.js @@ -3,6 +3,7 @@ const UpgradeScripts = require('./upgrades') const UpdateActions = require('./actions') const UpdateFeedbacks = require('./feedbacks') const UpdateVariableDefinitions = require('./variables') +const UpdatePresets = require('./presets') const { VoiceMod } = require('voicemod') class ModuleInstance extends InstanceBase { @@ -108,6 +109,7 @@ class ModuleInstance extends InstanceBase { this.loaded = true this.updateStatus(InstanceStatus.Ok) + this.updatePresets() this.updateActionsFeedbacksVariables() this.log('debug', 'connected to VM and ready') @@ -123,7 +125,6 @@ class ModuleInstance extends InstanceBase { this.updateStatus(InstanceStatus.UnknownError) ++this.failure } - if (this.loaded === false) await this.sleep(500) } while (this.loaded === false && this.failure < 5) } // When module gets deleted @@ -146,13 +147,6 @@ class ModuleInstance extends InstanceBase { tooltip: 'Enter the IP/Hostname for the voicemod instance', 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, }) } + + updatePresets() { + UpdatePresets(this) + } } runEntrypoint(ModuleInstance, UpgradeScripts) diff --git a/presets.js b/presets.js new file mode 100644 index 0000000..c4ad505 --- /dev/null +++ b/presets.js @@ -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) +}