mirror of
https://github.com/vitling/acid-banger.git
synced 2025-09-01 01:01:48 +02:00
add volume param to program state and corresponding dial to ui - issue #12
This commit is contained in:
@@ -244,9 +244,12 @@ async function start() {
|
||||
drums: await NineOhUnit(audio),
|
||||
gen,
|
||||
delay,
|
||||
clock
|
||||
clock,
|
||||
masterVolume: parameter("Volume", [0,1], 0.5)
|
||||
}
|
||||
|
||||
programState.masterVolume.subscribe(newVolume => { audio.master.in.gain.value = newVolume; });
|
||||
|
||||
clock.currentStep.subscribe(step => [...programState.notes, programState.drums].forEach(d => d.step(step)));
|
||||
const autoPilot = AutoPilot(programState);
|
||||
const ui = UI(programState, autoPilot, audio.master.analyser);
|
||||
|
@@ -107,5 +107,6 @@ export type ProgramState = {
|
||||
drums: NineOhMachine,
|
||||
gen: NoteGenerator,
|
||||
delay: DelayUnit
|
||||
clock: ClockUnit
|
||||
}
|
||||
clock: ClockUnit,
|
||||
masterVolume: NumericParameter
|
||||
}
|
||||
|
@@ -302,6 +302,7 @@ export function UI(state: ProgramState, autoPilot: AutoPilotUnit, analyser: Anal
|
||||
NoteGen(state.gen),
|
||||
DelayControls(state.delay),
|
||||
controlGroup(label("Clock"), DialSet([state.clock.bpm], "horizontal")),
|
||||
controlGroup(label("Volume"), DialSet([state.masterVolume], "horizontal")),
|
||||
controlGroup(label("Meter"), group(AudioMeter(analyser)), "meter")
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user