feat: you can now get volume for all sound individually, not only via fullstate

This commit is contained in:
2026-02-25 00:34:05 +03:00
parent e72fc519a0
commit ce948ce678
5 changed files with 36 additions and 8 deletions
+10 -3
View File
@@ -40,7 +40,9 @@ pub struct IsPausedCommand {}
pub struct GetStateCommand {}
pub struct GetVolumeCommand {}
pub struct GetVolumeCommand {
pub id: Option<u32>,
}
pub struct SetVolumeCommand {
pub volume: Option<f32>,
@@ -188,9 +190,14 @@ impl Executable for GetStateCommand {
#[async_trait]
impl Executable for GetVolumeCommand {
async fn execute(&self) -> Response {
let audio_player = get_audio_player().await.lock().await;
let volume = audio_player.volume;
let mut audio_player = get_audio_player().await.lock().await;
let volume = audio_player.get_volume(self.id);
if let Some(volume) = volume {
Response::new(true, volume.to_string())
} else {
Response::new(false, "Failed to get volume")
}
}
}