Example #1
0
        /// <summary>
        /// 音量を上げる
        /// </summary>
        async public void UpVolume()
        {
            this.GetVolume();
            int volumeValue = CurrentVolume == MAX_VOLUME ? CurrentVolume : ++CurrentVolume;
            await _AudioDevice.SetVolumeAsync(volumeValue);

            Debug.WriteLine("Set Volume:" + volumeValue);
            this.GetVolume();
        }
Example #2
0
        private void Window_KeyDown(object sender, KeyEventArgs e)
        {
#if DEBUG
            if (e.Key == Key.Escape)
            {
                App.Current.Shutdown();
            }
#endif

            if (e.Key == Key.F11 && WindowState != WindowState.Normal)
            {
                WindowState = WindowState.Normal;
                WindowStyle = WindowStyle.SingleBorderWindow;
            }
            else if (e.Key == Key.F11 && WindowState == WindowState.Normal)
            {
                WindowState = WindowState.Maximized;
                WindowStyle = WindowStyle.None;
            }

#if DEBUG
            if (e.Key == Key.F12)
            {
                isActiveSoundKeys = !isActiveSoundKeys;
            }
#endif

            else if (e.Key == Key.VolumeMute && isActiveSoundKeys)
            {
                defaultPlaybackDevice.SetMuteAsync(!defaultPlaybackDevice.IsMuted);
            }

            else if (e.Key == Key.VolumeUp && isActiveSoundKeys)
            {
                defaultPlaybackDevice.SetVolumeAsync(defaultPlaybackDevice.Volume + 1);
            }

            else if (e.Key == Key.VolumeDown && isActiveSoundKeys)
            {
                defaultPlaybackDevice.SetVolumeAsync(defaultPlaybackDevice.Volume - 1);
            }
        }
Example #3
0
        public async Task SetAudioVolume(Guid guid, double volume)
        {
            if (volume < 0 || volume > 100)
            {
                throw new Exception("Volume level needs to be between 0 and 100");
            }

            CoreAudioDevice device = GetDeviceByGuid(guid, mediaPlayback);

            if (device == null)
            {
                return;
            }

            await device.SetVolumeAsync(volume);
        }
 public async Task SetGlobalVolume(double value)
 {
     await PlaybackDevice.SetVolumeAsync(value);
 }
Example #5
0
 internal void ChangeVolume(double changeValue)
 {
     _defaultPlaybackDevice.SetVolumeAsync(changeValue);
 }
Example #6
0
 public static void Volume(double level) => _defaultPlaybackDevice.SetVolumeAsync(level).Wait();