コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: wouterhund/MicKey
        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;
            }
        }
コード例 #3
0
ファイル: MainWindow.xaml.cs プロジェクト: Anc813/QuickMute
        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;
            }
        }