aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerryDE <gerritfresen4@gmail.com>2023-11-07 03:09:08 +0100
committerGerryDE <gerritfresen4@gmail.com>2023-11-07 03:09:08 +0100
commit9ba991cad8a15a99f71f5b2ec5feff7dd9d270d7 (patch)
tree2354924014d44ec67f06987d07e46d94e58b58ea
parent9c1c0da026cb7ef091a0f3fa24b14ae8634f6de5 (diff)
Add option to set notification sound volume
-rw-r--r--javascript/notification.js6
-rw-r--r--modules/shared_options.py1
2 files changed, 6 insertions, 1 deletions
diff --git a/javascript/notification.js b/javascript/notification.js
index 6d799561..3ee972ae 100644
--- a/javascript/notification.js
+++ b/javascript/notification.js
@@ -26,7 +26,11 @@ onAfterUiUpdate(function() {
lastHeadImg = headImg;
// play notification sound if available
- gradioApp().querySelector('#audio_notification audio')?.play();
+ const notificationAudio = gradioApp().querySelector('#audio_notification audio');
+ if (notificationAudio) {
+ notificationAudio.volume = opts.notification_volume / 100.0 || 1.0;
+ notificationAudio.play();
+ }
if (document.hasFocus()) return;
diff --git a/modules/shared_options.py b/modules/shared_options.py
index a9964fcb..d40db530 100644
--- a/modules/shared_options.py
+++ b/modules/shared_options.py
@@ -64,6 +64,7 @@ options_templates.update(options_section(('saving-images', "Saving images/grids"
"save_incomplete_images": OptionInfo(False, "Save incomplete images").info("save images that has been interrupted in mid-generation; even if not saved, they will still show up in webui output."),
"notification_audio": OptionInfo(True, "Play notification sound after image generation").info("notification.mp3 should be present in the root directory").needs_reload_ui(),
+ "notification_volume": OptionInfo(100, "Notification sound volume", gr.Slider, {"minimum": 0, "maximum": 100, "step": 1}).info("in %"),
}))
options_templates.update(options_section(('saving-paths', "Paths for saving"), {