async fn update_volume_streams(
        &mut self,
        update_from: UpdateFrom<'_>,
        push_to_audio_core: bool,
    ) -> Result<bool, ControllerError> {
        let new_streams = match &update_from {
            UpdateFrom::AudioInfo(audio_info) => &audio_info.streams[..],
            UpdateFrom::NewStreams(streams) => streams,
        };
        if push_to_audio_core {
            self.check_and_bind_volume_controls(&default_audio_info().streams.to_vec()).await?;
            for stream in new_streams {
                if let Some(volume_control) =
                    self.stream_volume_controls.get_mut(&stream.stream_type)
                {
                    volume_control.set_volume(*stream).await?;
                }
            }
        } else {
            self.check_and_bind_volume_controls(new_streams).await?;
        }

        let mut stored_value = match update_from {
            UpdateFrom::AudioInfo(audio_info) => audio_info,
            _ => self.client.read_setting::<AudioInfo>().await,
        };
        stored_value.streams = get_streams_array_from_map(&self.stream_volume_controls);
        stored_value.modified_counters = Some(self.modified_counters.clone());

        Ok(self.client.write_setting(stored_value.into(), false).await.notified())
    }
/// Updates the state with the given streams' volume levels.
///
/// If [push_to_audio_core] is true, pushes the changes to the audio core.
/// If not, just sets it on the local stored state. Should be called with
/// true on first restore and on volume changes, and false otherwise.
/// Returns whether the change triggered a notification.
Updates the state with the given streams' volume levels.
If [push_to_audio_core] is true, pushes the changes to the audio core.
If not, just sets it on the local stored state. Should be called with
true on first restore and on volume changes, and false otherwise.
Returns whether the change triggered a notification.
Updates the state with the given streams ' volume levels . If [ push_to_audio_core ] is true pushes the changes to the audio core . If not just sets it on the local stored state . Should be called with true on first restore and on volume changes and false otherwise . Returns whether the change triggered a notification .
async fn update_volume_streams(
        &mut self,
        update_from: UpdateFrom<'_>,
        push_to_audio_core: bool,
    ) -> Result<bool, ControllerError> {
        let new_streams = match &update_from {
            UpdateFrom::AudioInfo(audio_info) => &audio_info.streams[..],
            UpdateFrom::NewStreams(streams) => streams,
        };
        if push_to_audio_core {
            self.check_and_bind_volume_controls(&default_audio_info().streams.to_vec()).await?;
            for stream in new_streams {
                if let Some(volume_control) =
                    self.stream_volume_controls.get_mut(&stream.stream_type)
                {
                    volume_control.set_volume(*stream).await?;
                }
            }
        } else {
            self.check_and_bind_volume_controls(new_streams).await?;
        }
        let mut stored_value = match update_from {
            UpdateFrom::AudioInfo(audio_info) => audio_info,
            _ => self.client.read_setting::<AudioInfo>().await,
        };
        stored_value.streams = get_streams_array_from_map(&self.stream_volume_controls);
        stored_value.modified_counters = Some(self.modified_counters.clone());
        Ok(self.client.write_setting(stored_value.into(), false).await.notified())
    }
async fn update_volume_streams ( & mut self , update_from : UpdateFrom < ' _ > , push_to_audio_core : bool , ) -> Result < bool , ControllerError > { let new_streams = match & update_from { UpdateFrom :: AudioInfo ( audio_info ) => & audio_info . streams [ .. ] , UpdateFrom :: NewStreams ( streams ) => streams , } ; if push_to_audio_core { self . check_and_bind_volume_controls ( & default_audio_info ( ) . streams . to_vec ( ) ) . await ? ; for stream in new_streams { if let Some ( volume_control ) = self . stream_volume_controls . get_mut ( & stream . stream_type ) { volume_control . set_volume ( * stream ) . await ? ; } } } else { self . check_and_bind_volume_controls ( new_streams ) . await ? ; } let mut stored_value = match update_from { UpdateFrom :: AudioInfo ( audio_info ) => audio_info , _ => self . client . read_setting :: < AudioInfo > ( ) . await , } ; stored_value . streams = get_streams_array_from_map ( & self . stream_volume_controls ) ; stored_value . modified_counters = Some ( self . modified_counters . clone ( ) ) ; Ok ( self . client . write_setting ( stored_value . into ( ) , false ) . await . notified ( ) ) }
Updates the state with the given streams' volume levels.
Updates the state with the given streams ' volume levels .
&mut self
update_from
UpdateFrom<'_>
push_to_audio_core
bool
&mut self
update_from
UpdateFrom<'_>
push_to_audio_core
bool