Adding one other bar...
This commit is contained in:
@ -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);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
12
src/main.ts
12
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";
|
||||
|
||||
Reference in New Issue
Block a user