From 0e7575f5627408678b61a82ed3fa65e9670f9967 Mon Sep 17 00:00:00 2001 From: Raphael Forment Date: Sun, 8 Oct 2023 01:21:55 +0200 Subject: [PATCH] Adding one other bar... --- index.html | 25 +++++++++++++++++++------ src/classes/SoundEvent.ts | 10 +++++++--- src/main.ts | 12 ++++++++++++ 3 files changed, 38 insertions(+), 9 deletions(-) diff --git a/index.html b/index.html index 78a1dd2..2172daf 100644 --- a/index.html +++ b/index.html @@ -307,18 +307,31 @@
-

Audio Output nudge

-
+

Audio/Event Nudging

+
- 0 + 0
+ +
+ + 0 +
+
diff --git a/src/classes/SoundEvent.ts b/src/classes/SoundEvent.ts index ea39327..27f3948 100644 --- a/src/classes/SoundEvent.ts +++ b/src/classes/SoundEvent.ts @@ -13,8 +13,13 @@ export type SoundParams = { } export class SoundEvent extends AudibleEvent { + + nudge: number; + constructor(sound: string | object, public app: Editor) { super(app); + this.nudge = app.dough_nudge / 100; + console.log(this.nudge) if (typeof sound === "string") { if (sound.includes(":")) { this.values = { @@ -260,7 +265,6 @@ export class SoundEvent extends AudibleEvent { } } public snd = this.sound; - public nudge = (value: number) => this.updateValue("nudge", value); public cut = (value: number) => this.updateValue("cut", value); public clip = (value: number) => this.updateValue("clip", value); public n = (value: number) => this.updateValue("n", value); @@ -337,10 +341,10 @@ export class SoundEvent extends AudibleEvent { this.values.chord.forEach((obj: { [key: string]: number }) => { const copy = { ...this.values }; copy.freq = obj.freq - superdough(copy, 0.25, this.values.dur); + superdough(copy, this.nudge, this.values.dur); }); } else { - superdough(this.values, 0.25, this.values.dur); + superdough(this.values, this.nudge, this.values.dur); } }; } diff --git a/src/main.ts b/src/main.ts index 43d111e..e67b39b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -110,6 +110,7 @@ export class Editor { // Audio stuff audioContext: AudioContext; + dough_nudge: number = 0.25; view: EditorView; clock: Clock; manualPlay: boolean = false; @@ -267,6 +268,12 @@ export class Editor { "audio_nudge" ) as HTMLInputElement; + + // Dough nudge range + dough_nudge_range: HTMLInputElement = document.getElementById( + "dough_nudge" + ) as HTMLInputElement; + // Error line error_line: HTMLElement = document.getElementById( "error_line" @@ -602,6 +609,11 @@ export class Editor { this.clock.nudge = parseInt(this.audio_nudge_range.value); }) + + this.dough_nudge_range.addEventListener("input", () => { + this.dough_nudge = parseInt(this.dough_nudge_range.value); + }) + this.upload_universe_button.addEventListener("click", () => { const fileInput = document.createElement("input"); fileInput.type = "file";