Fix more compiler whining

This commit is contained in:
2024-04-20 03:14:33 +02:00
parent 1824a345fc
commit 0d2f7046c9
3 changed files with 18 additions and 19 deletions

View File

@ -1,8 +1,7 @@
import { sendToServer, type OSCMessage } from "../../IO/OSC"; import { sendToServer, type OSCMessage } from "../../IO/OSC";
import { Editor } from "../../main";
import { oscMessages } from "../../IO/OSC"; 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. * Sends an OSC message to the server.
*/ */
@ -10,7 +9,7 @@ export const osc = (app: Editor) => (address: string, port: number, ...args: any
address: address, address: address,
port: port, port: port,
args: args, args: args,
timetag: Math.round(Date.now() + (app.clock.nudge - app.clock.deviation)), timetag: Math.round(Date.now()),
} as OSCMessage); } as OSCMessage);
}; };

View File

@ -139,7 +139,7 @@ export const runOscilloscope = (
canvasCtx.fillStyle = "rgba(0, 0, 0, 0)"; canvasCtx.fillStyle = "rgba(0, 0, 0, 0)";
canvasCtx.fillRect(0, 0, WIDTH, HEIGHT); 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( canvasCtx.clearRect(
-OFFSET_WIDTH, -OFFSET_WIDTH,
-OFFSET_HEIGHT, -OFFSET_HEIGHT,
@ -150,14 +150,14 @@ export const runOscilloscope = (
canvasCtx.lineWidth = app.osc.thickness; canvasCtx.lineWidth = app.osc.thickness;
if (app.osc.color === "random") { 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%)`; canvasCtx.strokeStyle = `hsl(${Math.random() * 360}, 100%, 50%)`;
} }
} else { } else {
canvasCtx.strokeStyle = app.osc.color; canvasCtx.strokeStyle = app.osc.color;
} }
const remainingRefreshTime = 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; const opacityRatio = 1 - remainingRefreshTime / app.osc.refresh;
canvasCtx.globalAlpha = opacityRatio; canvasCtx.globalAlpha = opacityRatio;
canvasCtx.beginPath(); canvasCtx.beginPath();

View File

@ -23,7 +23,7 @@ export class MidiEvent extends AudibleEvent {
constructor( constructor(
input: MidiParams, input: MidiParams,
public app: Editor, app: Editor,
) { ) {
super(app); super(app);
this.values = input; this.values = input;
@ -57,11 +57,11 @@ export class MidiEvent extends AudibleEvent {
}; };
add = (value: number): this => { add = (value: number): this => {
this.values.note += value; this.values["note"] += value;
return this; return this;
}; };
modify = (func: Function): this => { override modify = (func: Function): this => {
const funcResult = func(this); const funcResult = func(this);
if (funcResult instanceof Object) { if (funcResult instanceof Object) {
return funcResult; return funcResult;
@ -83,7 +83,7 @@ export class MidiEvent extends AudibleEvent {
return this; return this;
}; };
update = (): this => { override update = (): this => {
const filteredValues = filterObject(this.values, [ const filteredValues = filterObject(this.values, [
"key", "key",
"pitch", "pitch",
@ -98,20 +98,20 @@ export class MidiEvent extends AudibleEvent {
events.forEach((soundEvent) => { events.forEach((soundEvent) => {
const resolvedPitchClass = resolvePitchClass( const resolvedPitchClass = resolvePitchClass(
(soundEvent.key || "C4"), (soundEvent['key'] || "C4"),
(soundEvent.originalPitch || soundEvent.pitch || 0), (soundEvent['originalPitch'] || soundEvent['pitch'] || 0),
(soundEvent.parsedScale || soundEvent.scale || "MAJOR"), (soundEvent['parsedScale'] || soundEvent['scale'] || "MAJOR"),
(soundEvent.addedOctave || 0) (soundEvent['addedOctave'] || 0)
); );
soundEvent.note = resolvedPitchClass.note; soundEvent['note'] = resolvedPitchClass.note;
soundEvent.pitch = resolvedPitchClass.pitch; soundEvent['pitch'] = resolvedPitchClass.pitch;
soundEvent.octave = resolvedPitchClass.octave; soundEvent['octave'] = resolvedPitchClass.octave;
}); });
const newArrays = arrayOfObjectsToObjectWithArrays(events) as MidiParams; const newArrays = arrayOfObjectsToObjectWithArrays(events) as MidiParams;
this.values.note = maybeAtomic(newArrays.note); this.values['note'] = maybeAtomic(newArrays.note);
if (newArrays.bend) this.values.bend = maybeAtomic(newArrays.bend); if (newArrays.bend) this.values['bend'] = maybeAtomic(newArrays.bend);
return this; return this;
}; };