Implement Volume Persistence

Modifies the startup sequence to read the volume_level from the loaded preferences.

This saved value is then passed as the initial_volume when creating the music_player and tts_player instances.
This commit is contained in:
imonlinux
2025-10-11 15:34:45 -07:00
committed by GitHub
parent efbcbc599f
commit 92867db2b2
+10 -2
View File
@@ -200,6 +200,14 @@ async def main() -> None:
assert stop_model is not None assert stop_model is not None
# Create media players with saved volume
music_player = MpvMediaPlayer(
device=args.audio_output_device, initial_volume=preferences.volume_level
)
tts_player = MpvMediaPlayer(
device=args.audio_output_device, initial_volume=preferences.volume_level
)
state = ServerState( state = ServerState(
name=args.name, name=args.name,
mac_address=get_mac(), mac_address=get_mac(),
@@ -208,8 +216,8 @@ async def main() -> None:
available_wake_words=available_wake_words, available_wake_words=available_wake_words,
wake_words=wake_models, wake_words=wake_models,
stop_word=stop_model, stop_word=stop_model,
music_player=MpvMediaPlayer(device=args.audio_output_device), music_player=music_player,
tts_player=MpvMediaPlayer(device=args.audio_output_device), tts_player=tts_player,
wakeup_sound=args.wakeup_sound, wakeup_sound=args.wakeup_sound,
timer_finished_sound=args.timer_finished_sound, timer_finished_sound=args.timer_finished_sound,
preferences=preferences, preferences=preferences,