Adding one other bar...
This commit is contained in:
25
index.html
25
index.html
@ -307,18 +307,31 @@
|
|||||||
|
|
||||||
<!-- Audio nudge slider -->
|
<!-- 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">
|
<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>
|
<p class="font-bold text-xl ml-4 pb-4 underline underline-offset-4">Audio/Event Nudging</p>
|
||||||
<div class="flex flex-colunm">
|
<div class="flex flex-column pb-2">
|
||||||
<input
|
<input
|
||||||
type="range" id="audio_nudge"
|
type="range" id="audio_nudge"
|
||||||
name="rangeInput"
|
name="audiorangeInput"
|
||||||
min="-1000" max="1000"
|
min="-200" max="200"
|
||||||
value="0"
|
value="0"
|
||||||
class="w-full ml-4"
|
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>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
<div class="flex space-x-6 border-t border-gray-200 rounded-b dark:border-gray-600 mx-4 border-spacing-y-4">
|
<div class="flex space-x-6 border-t border-gray-200 rounded-b dark:border-gray-600 mx-4 border-spacing-y-4">
|
||||||
|
|||||||
@ -13,8 +13,13 @@ export type SoundParams = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class SoundEvent extends AudibleEvent {
|
export class SoundEvent extends AudibleEvent {
|
||||||
|
|
||||||
|
nudge: number;
|
||||||
|
|
||||||
constructor(sound: string | object, public app: Editor) {
|
constructor(sound: string | object, public app: Editor) {
|
||||||
super(app);
|
super(app);
|
||||||
|
this.nudge = app.dough_nudge / 100;
|
||||||
|
console.log(this.nudge)
|
||||||
if (typeof sound === "string") {
|
if (typeof sound === "string") {
|
||||||
if (sound.includes(":")) {
|
if (sound.includes(":")) {
|
||||||
this.values = {
|
this.values = {
|
||||||
@ -260,7 +265,6 @@ export class SoundEvent extends AudibleEvent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public snd = this.sound;
|
public snd = this.sound;
|
||||||
public nudge = (value: number) => this.updateValue("nudge", value);
|
|
||||||
public cut = (value: number) => this.updateValue("cut", value);
|
public cut = (value: number) => this.updateValue("cut", value);
|
||||||
public clip = (value: number) => this.updateValue("clip", value);
|
public clip = (value: number) => this.updateValue("clip", value);
|
||||||
public n = (value: number) => this.updateValue("n", 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 }) => {
|
this.values.chord.forEach((obj: { [key: string]: number }) => {
|
||||||
const copy = { ...this.values };
|
const copy = { ...this.values };
|
||||||
copy.freq = obj.freq
|
copy.freq = obj.freq
|
||||||
superdough(copy, 0.25, this.values.dur);
|
superdough(copy, this.nudge, this.values.dur);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
superdough(this.values, 0.25, this.values.dur);
|
superdough(this.values, this.nudge, this.values.dur);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
12
src/main.ts
12
src/main.ts
@ -110,6 +110,7 @@ export class Editor {
|
|||||||
|
|
||||||
// Audio stuff
|
// Audio stuff
|
||||||
audioContext: AudioContext;
|
audioContext: AudioContext;
|
||||||
|
dough_nudge: number = 0.25;
|
||||||
view: EditorView;
|
view: EditorView;
|
||||||
clock: Clock;
|
clock: Clock;
|
||||||
manualPlay: boolean = false;
|
manualPlay: boolean = false;
|
||||||
@ -267,6 +268,12 @@ export class Editor {
|
|||||||
"audio_nudge"
|
"audio_nudge"
|
||||||
) as HTMLInputElement;
|
) as HTMLInputElement;
|
||||||
|
|
||||||
|
|
||||||
|
// Dough nudge range
|
||||||
|
dough_nudge_range: HTMLInputElement = document.getElementById(
|
||||||
|
"dough_nudge"
|
||||||
|
) as HTMLInputElement;
|
||||||
|
|
||||||
// Error line
|
// Error line
|
||||||
error_line: HTMLElement = document.getElementById(
|
error_line: HTMLElement = document.getElementById(
|
||||||
"error_line"
|
"error_line"
|
||||||
@ -602,6 +609,11 @@ export class Editor {
|
|||||||
this.clock.nudge = parseInt(this.audio_nudge_range.value);
|
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", () => {
|
this.upload_universe_button.addEventListener("click", () => {
|
||||||
const fileInput = document.createElement("input");
|
const fileInput = document.createElement("input");
|
||||||
fileInput.type = "file";
|
fileInput.type = "file";
|
||||||
|
|||||||
Reference in New Issue
Block a user