diff --git a/apps/electron-app/src/render/components/react-flow/nodes/Trigger.tsx b/apps/electron-app/src/render/components/react-flow/nodes/Trigger.tsx index 83c64c7..cce1b4a 100644 --- a/apps/electron-app/src/render/components/react-flow/nodes/Trigger.tsx +++ b/apps/electron-app/src/render/components/react-flow/nodes/Trigger.tsx @@ -10,8 +10,8 @@ export function Trigger(props: Props) { - - + + ); } diff --git a/packages/components/src/components/BaseComponent.ts b/packages/components/src/components/BaseComponent.ts index ee950ba..5574f0a 100644 --- a/packages/components/src/components/BaseComponent.ts +++ b/packages/components/src/components/BaseComponent.ts @@ -74,22 +74,4 @@ export class BaseComponent { value: error, }); } - - /** - * @TODO apparently this doesn't work - * - * bang the output 'change' gate - */ - public bang() { - let value: number = 1.0; - this.eventEmitter.emit('change', JSON.stringify(value)); - } - - /** - * "unbang" - */ - public quiet() { - let value: number = 0.0; - this.eventEmitter.emit('change', JSON.stringify(value)); - } } diff --git a/packages/components/src/components/Trigger.ts b/packages/components/src/components/Trigger.ts index a9f5183..277053e 100644 --- a/packages/components/src/components/Trigger.ts +++ b/packages/components/src/components/Trigger.ts @@ -2,8 +2,6 @@ import { BaseComponent, BaseComponentOptions } from './BaseComponent'; export type TriggerBehaviour = 'increasing' | 'exact' | 'decreasing'; -//export type WaveformType = 'sinus' | 'square' | 'sawtooth' | 'triangle' | 'random'; - export type TriggerData = { behaviour: TriggerBehaviour; threshold: number; @@ -87,27 +85,26 @@ export class Trigger extends BaseComponent { switch (this.options.behaviour) { case 'increasing': { - retval = this.checkIncreasing(value); + retval = this.checkIncreasing(Number(value)); //console.log(`[>] trigger ${this.value} < ${value}`); break; } case 'exact': { - retval = this.value === value ? true : false; + retval = this.value === Number(value); //console.log(`[=] trigger ${this.value} = ${value}`); break; } case 'decreasing': { - retval = this.checkDecreasing(value); //this.value > value ? true : false; + retval = this.checkDecreasing(Number(value)); //this.value > value ? true : false; //console.log(`[<] trigger ${this.value} > ${value}`); break; } } - if (retval) { - this.value = 1.0; // not ideal, I don't really want to send a specific value here but rather a gate bang - setTimeout(() => { - this.value = 0.0; - }, this.options.duration); - } + this.value = Number(value); + + if (!retval) return; + + this.eventEmitter.emit('bang', this.value); } // input() } // Trigger component