Skip to content

Commit

Permalink
Merge pull request #13884 from GerryDE/notification-sound-volume
Browse files Browse the repository at this point in the history
Add option to set notification sound volume
  • Loading branch information
AUTOMATIC1111 authored Nov 7, 2023
2 parents 9c1c0da + 9ba991c commit 47bccbe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion javascript/notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions modules/shared_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"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"), {
Expand Down

0 comments on commit 47bccbe

Please sign in to comment.