feat: add SFX volume control and improve audio feedback

- Implemented separate sound effects volume control in settings.
- Updated backend to handle new `sfx_volume` parameter.
- Enhanced UI to include sound effects volume slider in admin panel.
- Integrated sound effects for various user interactions (clicks, navigation, alerts).
- Added a new global sound engine to manage audio synthesis without external files.
- Updated documentation for Docker deployment and Windows packaging.
- Refactored audio context management to ensure sound effects are available post user interaction.
This commit is contained in:
Pine
2026-08-18 07:14:13 +08:00
parent 18d28be943
commit d70d9d5fbd
22 changed files with 561 additions and 28 deletions
+1
View File
@@ -72,6 +72,7 @@ async def admin_page(request: Request):
"play_mode": s.get("play_mode", "sequential"),
"image_duration": s.get("image_duration", 5),
"volume": s.get("volume", 80),
"sfx_volume": s.get("sfx_volume", 60),
"fullscreen": s.get("fullscreen", True),
"autostart": s.get("autostart", False),
"from_screen": request.query_params.get("from") == "screen",
+5 -2
View File
@@ -38,6 +38,7 @@ def _media_type(path):
class SettingsBody(BaseModel):
volume: int | None = None
sfx_volume: int | None = None
play_mode: str | None = None
image_duration: int | None = None
fullscreen: bool | None = None
@@ -106,7 +107,7 @@ async def login(request: Request):
@router.get("/api/settings")
async def get_settings():
s = storage.get_settings()
return {k: s[k] for k in ("volume", "play_mode", "image_duration", "fullscreen", "autostart")}
return {k: s[k] for k in ("volume", "sfx_volume", "play_mode", "image_duration", "fullscreen", "autostart")}
@router.get("/api/config")
@@ -135,7 +136,9 @@ async def runtime_config():
async def update_settings(body: SettingsBody):
storage.update_settings(**body.model_dump(exclude_none=True))
s = storage.get_settings()
hub.publish_command("settings_changed", {"volume": s["volume"], "play_mode": s["play_mode"]})
hub.publish_command("settings_changed", {
"volume": s["volume"], "sfx_volume": s["sfx_volume"], "play_mode": s["play_mode"],
})
return {"ok": True}
+1
View File
@@ -12,6 +12,7 @@ DEFAULT_SETTINGS = {
"username": "admin",
"password": "123456",
"volume": 80,
"sfx_volume": 60,
"auto_play": True,
"play_mode": "sequential",
"image_duration": 5,