Exemple #1
0
        private void BindVolumeSlider(string sliderName, AudioChannel audioChannel)
        {
            var volumeSlider = Engine.Gui.GetWidgetByName <Slider>(sliderName);
            var volume       = AudioChannels.VolumeLevelFromConfiguration(audioChannel);

            volumeSlider.Value   = (int)(volume * 100.0f);
            volumeSlider.Change += o =>
            {
                var value = ((Slider)o).Value / 100.0f;
                Engine.AudioEngine.GetChannel((int)audioChannel, false).ChannelVolume = value;
                var channelName = AudioChannels.ChannelLevelConfigurationName(audioChannel);
                StaticConfigurationManager.ConfigurationManager.SetFloat(channelName, value);
            };
        }
Exemple #2
0
        private void BindMasterVolumeSlider()
        {
            var volume = AudioChannels.VolumeLevelFromConfiguration(AudioChannel.Master);

            var masterVolumeSlider = Engine.Gui.GetWidgetByName <Slider>("masterVolume");

            masterVolumeSlider.Value   = (int)(volume * 100.0f);
            masterVolumeSlider.Change += o =>
            {
                var value = ((Slider)o).Value / 100.0f;
                Engine.AudioEngine.MasterVolume = value;
                var channelName = AudioChannels.ChannelLevelConfigurationName(AudioChannel.Master);
                StaticConfigurationManager.ConfigurationManager.SetFloat(channelName, value);
            };
        }