Adding one other bar...

This commit is contained in:
2023-10-08 01:21:55 +02:00
parent 1a0d689441
commit 0e7575f562
3 changed files with 38 additions and 9 deletions

View File

@ -307,18 +307,31 @@
<!-- Audio nudge slider -->
<div id="midi-settings-container" class="bg-gray-200 rounded-lg flex flex-col mx-4 my-4 pt-4 pb-2">
<p class="font-bold text-xl ml-4 pb-4 underline underline-offset-4">Audio Output nudge</p>
<div class="flex flex-colunm">
<p class="font-bold text-xl ml-4 pb-4 underline underline-offset-4">Audio/Event Nudging</p>
<div class="flex flex-column pb-2">
<input
type="range" id="audio_nudge"
name="rangeInput"
min="-1000" max="1000"
name="audiorangeInput"
min="-200" max="200"
value="0"
class="w-full ml-4"
oninput="amount.value=audio_nudge.value"
oninput="nudgenumber.value=audio_nudge.value"
>
<output name="amount" id="amount" for="rangeInput" class="bg-gray-500 rounded-lg ml-2 mr-4 px-4 py-1 text-white">0</output>
<output name="nudgenumber" id="nudgenumber" for="audiorangeInput" class="bg-gray-500 rounded-lg ml-2 mr-4 px-4 py-1 text-white">0</output>
</div>
<div class="flex flex-column">
<input
type="range" id="dough_nudge"
name="doughrangeInput"
min="0" max="100"
value="0"
class="w-full ml-4"
oninput="doughnumber.value=dough_nudge.value"
>
<output name="doughnumber" id="doughnumber" for="doughrangeInput" class="bg-gray-500 rounded-lg ml-2 mr-4 px-4 py-1 text-white">0</output>
</div>
</div>
<div class="flex space-x-6 border-t border-gray-200 rounded-b dark:border-gray-600 mx-4 border-spacing-y-4">

View File

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

View File

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