Finalize title screen name
This commit is contained in:
@@ -3,6 +3,7 @@ class SoundDirector {
|
||||
private master?: GainNode;
|
||||
private musicGain?: GainNode;
|
||||
private started = false;
|
||||
private muted = false;
|
||||
private sequenceTimer?: number;
|
||||
|
||||
start() {
|
||||
@@ -17,7 +18,7 @@ class SoundDirector {
|
||||
|
||||
this.context = new AudioContextCtor();
|
||||
this.master = this.context.createGain();
|
||||
this.master.gain.value = 0.34;
|
||||
this.master.gain.value = this.muted ? 0 : 0.34;
|
||||
this.master.connect(this.context.destination);
|
||||
|
||||
this.musicGain = this.context.createGain();
|
||||
@@ -34,6 +35,21 @@ class SoundDirector {
|
||||
void this.context?.resume();
|
||||
}
|
||||
|
||||
setMuted(muted: boolean) {
|
||||
this.muted = muted;
|
||||
|
||||
if (!this.context || !this.master) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.master.gain.cancelScheduledValues(this.context.currentTime);
|
||||
this.master.gain.linearRampToValueAtTime(muted ? 0 : 0.34, this.context.currentTime + 0.18);
|
||||
}
|
||||
|
||||
isMuted() {
|
||||
return this.muted;
|
||||
}
|
||||
|
||||
playHover() {
|
||||
this.playTone(660, 0.035, 0.04, 'sine');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user