public override async Task SendToPlugin(StreamDeckSendToPluginEventMessage message) { var messageEvent = message.Payload["event"]; if (messageEvent?.Value <string>() != "getDevices") { return; } var devices = await Controller.GetDevicesAsync(DeviceType.Playback); var responseDevices = new JArray(devices.OrderBy(d => d.FullName).Select(d => new JObject { { "id", d.Id.ToString() }, { "displayName", d.FullName }, { "active", (d.State & DeviceState.Active) > 0 } })); var response = new JObject { { "event", "getDevices" }, { "devices", responseDevices } }; await Client.SendToPropertyInspector(message.Action, response); }
private async Task toggleMute() { var devices = (await audioController.GetDevicesAsync(DeviceType.Capture, DeviceState.Active)).ToList(); wantMute = !await IsMuted(devices); await SetMute(wantMute, devices); sound?.Stop(); if (enableSound) { var soundFile = wantMute ? Properties.Resources.beep300 : Properties.Resources.beep750; sound = new SoundPlayer(soundFile); sound.Play(); } else { sound = null; } }
private async void UpdateMuteStatus() { var devices = await AudioController.GetDevicesAsync(DeviceType.Capture, DeviceState.Active); var device = devices.FirstOrDefault(x => x.IsDefaultDevice); if (device != null) { this.MicMuted = device.IsMuted; this.myNotifyIcon.Icon = device.IsMuted ? Properties.Resources.off : Properties.Resources.on; } }