Improve web UI sound deployment
This commit is contained in:
+7
-2
@@ -265,6 +265,7 @@ function reflectSettings() {
|
||||
/** @type {AudioContext} */
|
||||
let notificationAudioContext = null;
|
||||
let userNotificationSoundsReady = false;
|
||||
let notificationSoundGainScale = 2.5;
|
||||
|
||||
function notificationSoundsEnabled() {
|
||||
return !!getSettings().notificationSounds;
|
||||
@@ -309,7 +310,9 @@ function scheduleGlide(start, duration, fromFrequency, toFrequency, gainValue, t
|
||||
oscillator.frequency.setValueAtTime(fromFrequency, start);
|
||||
oscillator.frequency.exponentialRampToValueAtTime(toFrequency, start + duration);
|
||||
gain.gain.setValueAtTime(0, start);
|
||||
gain.gain.linearRampToValueAtTime(gainValue, start + 0.02);
|
||||
gain.gain.linearRampToValueAtTime(
|
||||
gainValue * notificationSoundGainScale, start + 0.02,
|
||||
);
|
||||
gain.gain.exponentialRampToValueAtTime(0.0001, start + duration);
|
||||
oscillator.connect(gain);
|
||||
gain.connect(context.destination);
|
||||
@@ -335,7 +338,9 @@ function scheduleTone(offset, duration, frequency, gainValue, type) {
|
||||
oscillator.type = type || 'sine';
|
||||
oscillator.frequency.setValueAtTime(frequency, start);
|
||||
gain.gain.setValueAtTime(0, start);
|
||||
gain.gain.linearRampToValueAtTime(gainValue, start + 0.015);
|
||||
gain.gain.linearRampToValueAtTime(
|
||||
gainValue * notificationSoundGainScale, start + 0.015,
|
||||
);
|
||||
gain.gain.exponentialRampToValueAtTime(0.0001, start + duration);
|
||||
oscillator.connect(gain);
|
||||
gain.connect(context.destination);
|
||||
|
||||
Reference in New Issue
Block a user