From 0d2f7046c995e2657d1f640b34c95f099b162828 Mon Sep 17 00:00:00 2001 From: Raphael Forment Date: Sat, 20 Apr 2024 03:14:33 +0200 Subject: [PATCH] Fix more compiler whining --- src/API/IO/OSC.ts | 5 ++--- src/DOM/Visuals/Oscilloscope.ts | 6 +++--- src/classes/MidiEvent.ts | 26 +++++++++++++------------- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/API/IO/OSC.ts b/src/API/IO/OSC.ts index 4fde8b9..663105f 100644 --- a/src/API/IO/OSC.ts +++ b/src/API/IO/OSC.ts @@ -1,8 +1,7 @@ import { sendToServer, type OSCMessage } from "../../IO/OSC"; -import { Editor } from "../../main"; import { oscMessages } from "../../IO/OSC"; -export const osc = (app: Editor) => (address: string, port: number, ...args: any[]): void => { +export const osc = () => (address: string, port: number, ...args: any[]): void => { /** * Sends an OSC message to the server. */ @@ -10,7 +9,7 @@ export const osc = (app: Editor) => (address: string, port: number, ...args: any address: address, port: port, args: args, - timetag: Math.round(Date.now() + (app.clock.nudge - app.clock.deviation)), + timetag: Math.round(Date.now()), } as OSCMessage); }; diff --git a/src/DOM/Visuals/Oscilloscope.ts b/src/DOM/Visuals/Oscilloscope.ts index fe6aa02..81cb871 100644 --- a/src/DOM/Visuals/Oscilloscope.ts +++ b/src/DOM/Visuals/Oscilloscope.ts @@ -139,7 +139,7 @@ export const runOscilloscope = ( canvasCtx.fillStyle = "rgba(0, 0, 0, 0)"; canvasCtx.fillRect(0, 0, WIDTH, HEIGHT); - if (app.clock.time_position.pulse % app.osc.refresh == 0) { + if (app.clock.time_position.tick % app.osc.refresh == 0) { canvasCtx.clearRect( -OFFSET_WIDTH, -OFFSET_HEIGHT, @@ -150,14 +150,14 @@ export const runOscilloscope = ( canvasCtx.lineWidth = app.osc.thickness; if (app.osc.color === "random") { - if (app.clock.time_position.pulse % 16 === 0) { + if (app.clock.time_position.tick % 16 === 0) { canvasCtx.strokeStyle = `hsl(${Math.random() * 360}, 100%, 50%)`; } } else { canvasCtx.strokeStyle = app.osc.color; } const remainingRefreshTime = - app.clock.time_position.pulse % app.osc.refresh; + app.clock.time_position.tick % app.osc.refresh; const opacityRatio = 1 - remainingRefreshTime / app.osc.refresh; canvasCtx.globalAlpha = opacityRatio; canvasCtx.beginPath(); diff --git a/src/classes/MidiEvent.ts b/src/classes/MidiEvent.ts index 9ea01a5..0c310f2 100644 --- a/src/classes/MidiEvent.ts +++ b/src/classes/MidiEvent.ts @@ -23,7 +23,7 @@ export class MidiEvent extends AudibleEvent { constructor( input: MidiParams, - public app: Editor, + app: Editor, ) { super(app); this.values = input; @@ -57,11 +57,11 @@ export class MidiEvent extends AudibleEvent { }; add = (value: number): this => { - this.values.note += value; + this.values["note"] += value; return this; }; - modify = (func: Function): this => { + override modify = (func: Function): this => { const funcResult = func(this); if (funcResult instanceof Object) { return funcResult; @@ -83,7 +83,7 @@ export class MidiEvent extends AudibleEvent { return this; }; - update = (): this => { + override update = (): this => { const filteredValues = filterObject(this.values, [ "key", "pitch", @@ -98,20 +98,20 @@ export class MidiEvent extends AudibleEvent { events.forEach((soundEvent) => { const resolvedPitchClass = resolvePitchClass( - (soundEvent.key || "C4"), - (soundEvent.originalPitch || soundEvent.pitch || 0), - (soundEvent.parsedScale || soundEvent.scale || "MAJOR"), - (soundEvent.addedOctave || 0) + (soundEvent['key'] || "C4"), + (soundEvent['originalPitch'] || soundEvent['pitch'] || 0), + (soundEvent['parsedScale'] || soundEvent['scale'] || "MAJOR"), + (soundEvent['addedOctave'] || 0) ); - soundEvent.note = resolvedPitchClass.note; - soundEvent.pitch = resolvedPitchClass.pitch; - soundEvent.octave = resolvedPitchClass.octave; + soundEvent['note'] = resolvedPitchClass.note; + soundEvent['pitch'] = resolvedPitchClass.pitch; + soundEvent['octave'] = resolvedPitchClass.octave; }); const newArrays = arrayOfObjectsToObjectWithArrays(events) as MidiParams; - this.values.note = maybeAtomic(newArrays.note); - if (newArrays.bend) this.values.bend = maybeAtomic(newArrays.bend); + this.values['note'] = maybeAtomic(newArrays.note); + if (newArrays.bend) this.values['bend'] = maybeAtomic(newArrays.bend); return this; };