Exemplo n.º 1
0
 public void OnSliderValueChanged(float value)
 {
     if (percentageLabel != null)
     {
         percentageLabel.text = Mathf.RoundToInt(value * 100) + "%";
         NativeSystemVolumeManager.SetSystemVolume(value, AudioStreamType);
     }
 }
Exemplo n.º 2
0
        public void InitUI(AudioStreamType audioStreamType)
        {
            AudioStreamType = audioStreamType;
            slider.value    = NativeSystemVolumeManager.GetSystemVolume(AudioStreamType);
            UpdateTitleLabel(audioStreamType.ToString());
            NativeSystemVolumeManager.AddSystemVolumeChangedListener(OnSystemVolumeChanged);
            NativeSystemVolumeManager.AddSystemVolumeMuteChangedListener(OnSystemVolumeMuteChanged);

            muted = NativeSystemVolumeManager.IsSystemVolumeMuted(audioStreamType);
            UpdateMuteSprite();
        }
Exemplo n.º 3
0
        public void InitUI(AudioOutputDevice audioOutputDevice)
        {
            AudioOutputDevice = audioOutputDevice;
            slider.value      = NativeSystemVolumeManager.GetDeviceVolume(audioOutputDevice);
            UpdateTitleLabel(audioOutputDevice.name);
            NativeSystemVolumeManager.AddDeviceVolumeChangedListener(OnDeviceVolumeChanged);
            NativeSystemVolumeManager.AddDeviceVolumeMuteChangedListener(OnDeviceVolumeMuteChanged);

            muted = NativeSystemVolumeManager.IsDeviceVolumeMuted(audioOutputDevice);
            UpdateMuteSprite();
        }
Exemplo n.º 4
0
        public void OnMuteClick()
        {
            muted = !muted;

            if (muted)
            {
                NativeSystemVolumeManager.MuteSystemVolume(AudioStreamType);
            }
            else
            {
                NativeSystemVolumeManager.UnmuteSystemVolume(AudioStreamType);
            }

            UpdateMuteSprite();
        }
Exemplo n.º 5
0
        public void OnMuteClick()
        {
            muted = !muted;

            if (muted)
            {
                NativeSystemVolumeManager.MuteDeviceVolume(AudioOutputDevice);
            }
            else
            {
                NativeSystemVolumeManager.UnmuteDeviceVolume(AudioOutputDevice);
            }

            UpdateMuteSprite();
        }
Exemplo n.º 6
0
        private void Start()
        {
            if (NativeSystemVolumeManager.IsCurrentPlatformSupported())
            {
                view.HideErrorLabel();

                AudioStreamType[]   audioStreamTypes   = NativeSystemVolumeManager.GetSupportedAudioStreamTypes();
                AudioOutputDevice[] audioOutputDevices = NativeSystemVolumeManager.GetAudioOutputDevices();
                view.InitializeUI(audioStreamTypes, audioOutputDevices);
            }
            else
            {
                view.ShowErrorLabel();

                Debug.LogWarningFormat("Native System Volume is not supported on this platform.");
            }
        }