/// <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(); }
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); } }
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); }
internal void ChangeVolume(double changeValue) { _defaultPlaybackDevice.SetVolumeAsync(changeValue); }
public static void Volume(double level) => _defaultPlaybackDevice.SetVolumeAsync(level).Wait();