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 { 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);
};

View File

@ -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();

View File

@ -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;
};