public void ChangeVolume(string input) { OnVolumeChanged?.Invoke(); switch (input) { case "low": { AudioListener.volume = 0; PlayerPrefs.SetFloat("volume", 0); } break; case "mid": { AudioListener.volume = 0.5f; PlayerPrefs.SetFloat("volume", 0.5f); } break; case "high": { AudioListener.volume = 1; PlayerPrefs.SetFloat("volume", 1); } break; } MoveVolumeIndicator(); }
public AudioControlPanel() { InitializeComponent(); MusicProgress.OnProgressChanged += x => OnProgressChanged?.Invoke(x); VolumeBar.OnValueChanged += x => { if (x >= 25 && x < 75) { VolumeAdj.Content = FindResource("Volume_025"); } else if (x >= 75) { VolumeAdj.Content = FindResource("Volume_075"); } else if (x >= 1) { VolumeAdj.Content = FindResource("Volume_0"); } else { VolumeAdj.Content = FindResource("Volume_off"); } OnVolumeChanged?.Invoke(x); }; }
private void SlVolume_OnValueChanged(object sender, ValueChangedEventArgs e) { if (e.NewValue != e.OldValue) { OnVolumeChanged?.Invoke((int)e.NewValue); } m_Percent = e.NewValue; slVolume.Value = m_Percent; _OnDataUpdated(); }
private void slVolume_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e) { if (e.NewValue != e.OldValue) { OnVolumeChanged?.Invoke((int)e.NewValue); } m_Percent = e.NewValue; slVolume.Value = m_Percent; _OnDataUpdated(); }
private void m_VolumeSlider_OnValueChanged(object Sender, RoutedPropertyChangedEventArgs <double> E) { if (!IsPlayerInitialized) { return; } Player.MediaPlayer.SetVolume(( float )E.NewValue); OnVolumeChanged?.Invoke(this, E); }
private void VolumeSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e) { if (VolumeControl_Button?.Content is null) { return; } var newImage = e.NewValue == 0 ? Properties.Resources.Sound_muted : Properties.Resources.audio_icon_edited; ((Image)VolumeControl_Button.Content).SetSource(newImage); OnVolumeChanged?.Invoke(this, e.NewValue); }
private void VolumeSet(AudioType aType, float _value, bool _relative) { //Modify the volume of the requested type float newValue = Volume[(int)aType]; if (_relative) { newValue += _value; } else { newValue = _value; } Volume[(int)aType] = Mathf.Clamp(newValue, 0f, 1f); if (OnVolumeChanged != null) { OnVolumeChanged.Invoke(); } }
public void Save() { globalWidth = width; globalHeight = height; globalFullscreen = Fullscreen; ChangeResolution(globalWidth, globalHeight, globalFullscreen); PlayerPrefs.SetInt("Fullscreen", Fullscreen ? 1 : 0); PlayerPrefs.SetInt("Width", globalWidth); PlayerPrefs.SetInt("Height", globalHeight); PlayerPrefs.SetFloat("Volume", audioSrc.volume); currentVolume = audioSrc.volume; mainAudioSource.volume = audioSrc.volume; PlayerPrefs.Save(); if (OnVolumeChanged != null) { OnVolumeChanged.Invoke(null, EventArgs.Empty); } }
int IAudioEndpointVolumeCallback.OnNotify(IntPtr pNotify) { OnVolumeChanged?.Invoke(this, new EndpointVolumeChangedEventArgs(pNotify)); return(0); }
internal static void InstallEvents() { PlaybackStatusHasChanged_t.Install(x => OnPlaybackChanged?.Invoke()); VolumeHasChanged_t.Install(x => OnVolumeChanged?.Invoke(x.NewVolume)); }
internal static void InstallEvents() { Dispatch.Install <PlaybackStatusHasChanged_t>(x => OnPlaybackChanged?.Invoke()); Dispatch.Install <VolumeHasChanged_t>(x => OnVolumeChanged?.Invoke(x.NewVolume)); }
public static void SetVolume(VolumeSource v, float f) { _volumes[(int)v] = f; OnVolumeChanged?.Invoke(v, f); }
public void VolumeChanged(double value) { OnVolumeChanged?.Invoke(value); }
private void OnVolumeTweenUpdate(float volume) { _volume = volume; OnVolumeChanged?.Invoke(_volume); }
private void IsMutedChanged(object sender, bool e) { OnVolumeChanged?.Invoke(_player.CurrentVolumeLevel, e); _appWebServer.OnVolumeChanged?.Invoke(_player.CurrentVolumeLevel, e); }
private void VolumeLevelChanged(object sender, double e) { OnVolumeChanged?.Invoke(e, _player.IsMuted); _appWebServer.OnVolumeChanged?.Invoke(e, _player.IsMuted); }
protected void SetSFXVolume(float volume) => OnVolumeChanged?.Invoke(volume);
private void SetVolumeInternal(VolumeInfo info) { Volume = info; OnVolumeChanged?.Invoke(Volume); }
public void UpdateVolume(float value) { Volume = value; OnVolumeChanged.Invoke(); }