async fn play_media_volume_sound(
    sound_player_connection: Option<PlayerProxy>,
    volume: &Vec<AudioStream>,
    stored_streams: &HashMap<AudioStreamType, StreamVolumeControl>,
    mut sound_player_added_files: &mut HashSet<&str>,
) {
    if let Some(sound_player_proxy) = sound_player_connection.clone() {
        let media_stream = volume.iter().find(|x| x.stream_type == AudioStreamType::Media);
        if let Some(stream) = media_stream {
            let media_volume_stream = match stored_streams.get(&AudioStreamType::Media) {
                Some(stream) => stream,
                None => {
                    fx_log_err!("Could not find media stream");
                    return;
                }
            };
            let last_media_user_volume = media_volume_stream.stored_stream.user_volume_level;

            // If volume didn't change, don't play the sound.
            if stream.user_volume_level == last_media_user_volume {
                return;
            };
            let volume_level = stream.user_volume_level;
            if volume_level >= 1.0 {
                play_sound(
                    &sound_player_proxy,
                    VOLUME_MAX_FILE_PATH,
                    0,
                    &mut sound_player_added_files,
                )
                .await
                .ok();
            } else if volume_level > 0.0 {
                play_sound(
                    &sound_player_proxy,
                    VOLUME_CHANGED_FILE_PATH,
                    1,
                    &mut sound_player_added_files,
                )
                .await
                .ok();
            }
        }
    }
}
// Play the earcons sound given the changed volume streams.
Play the earcons sound given the changed volume streams.
Play the earcons sound given the changed volume streams .
async fn play_media_volume_sound(
    sound_player_connection: Option<PlayerProxy>,
    volume: &Vec<AudioStream>,
    stored_streams: &HashMap<AudioStreamType, StreamVolumeControl>,
    mut sound_player_added_files: &mut HashSet<&str>,
) {
    if let Some(sound_player_proxy) = sound_player_connection.clone() {
        let media_stream = volume.iter().find(|x| x.stream_type == AudioStreamType::Media);
        if let Some(stream) = media_stream {
            let media_volume_stream = match stored_streams.get(&AudioStreamType::Media) {
                Some(stream) => stream,
                None => {
                    fx_log_err!("Could not find media stream");
                    return;
                }
            };
            let last_media_user_volume = media_volume_stream.stored_stream.user_volume_level;
            // If volume didn't change, don't play the sound.
            if stream.user_volume_level == last_media_user_volume {
                return;
            };
            let volume_level = stream.user_volume_level;
            if volume_level >= 1.0 {
                play_sound(
                    &sound_player_proxy,
                    VOLUME_MAX_FILE_PATH,
                    0,
                    &mut sound_player_added_files,
                )
                .await
                .ok();
            } else if volume_level > 0.0 {
                play_sound(
                    &sound_player_proxy,
                    VOLUME_CHANGED_FILE_PATH,
                    1,
                    &mut sound_player_added_files,
                )
                .await
                .ok();
            }
        }
    }
}
async fn play_media_volume_sound ( sound_player_connection : Option < PlayerProxy > , volume : & Vec < AudioStream > , stored_streams : & HashMap < AudioStreamType , StreamVolumeControl > , mut sound_player_added_files : & mut HashSet < & str > , ) { if let Some ( sound_player_proxy ) = sound_player_connection . clone ( ) { let media_stream = volume . iter ( ) . find ( | x | x . stream_type == AudioStreamType :: Media ) ; if let Some ( stream ) = media_stream { let media_volume_stream = match stored_streams . get ( & AudioStreamType :: Media ) { Some ( stream ) => stream , None => { fx_log_err ! ( " " ) ; return ; } } ; let last_media_user_volume = media_volume_stream . stored_stream . user_volume_level ; // If volume didn't change, don't play the sound. if stream . user_volume_level == last_media_user_volume { return ; } ; let volume_level = stream . user_volume_level ; if volume_level >= 1.0 { play_sound ( & sound_player_proxy , VOLUME_MAX_FILE_PATH , 0 , & mut sound_player_added_files , ) . await . ok ( ) ; } else if volume_level > 0.0 { play_sound ( & sound_player_proxy , VOLUME_CHANGED_FILE_PATH , 1 , & mut sound_player_added_files , ) . await . ok ( ) ; } } } }
Play the earcons sound given the changed volume streams.
Play the earcons sound given the changed volume streams .
sound_player_connection
Option<PlayerProxy>
volume
&Vec<AudioStream>
stored_streams
&HashMap<AudioStreamType, StreamVolumeControl>
sound_player_added_files
&mut HashSet<&str>