private void UpdateDropdowns() { var Outputdevices = Controller.GetPlaybackDevices(DeviceState.Active); var Inputdevices = Controller.GetCaptureDevices(DeviceState.Active); InputDropdown.Items.Clear(); OutputDropdown.Items.Clear(); foreach (var endpoint in Inputdevices) { InputDropdown.Items.Add(endpoint.FullName); //Console.WriteLine(endpoint.Fullname); } //Console.WriteLine("These are output devices"); foreach (var endpoint in Outputdevices) { OutputDropdown.Items.Add(endpoint.FullName); //Console.WriteLine(endpoint.FullName); } var defaultInputDevice = Controller.GetDefaultDevice(DeviceType.Capture, Role.Multimedia); var defaultOutputDevice = Controller.GetDefaultDevice(DeviceType.Playback, Role.Multimedia); OutputDropdown.SelectedItem = defaultOutputDevice; OutputDropdown.Text = defaultOutputDevice.FullName; InputDropdown.SelectedItem = defaultInputDevice; InputDropdown.Text = defaultInputDevice.FullName; }
public VolumeControl() { InitializeComponent(); CoreAudioController coreAudioConteroller = new CoreAudioController(); App.CoreAudioDevice = coreAudioConteroller.GetDefaultDevice(AudioSwitcher.AudioApi.DeviceType.Playback, AudioSwitcher.AudioApi.Role.Multimedia); }
public static void UpdateLevel(bool reportFix) { if (audio == null) { return; } //Communication capture { var dev = audio.GetDefaultDevice(AudioSwitcher.AudioApi.DeviceType.Capture, AudioSwitcher.AudioApi.Role.Communications); UpdateLevel(dev, reportFix); } foreach (var dev in audio.GetDevices()) { if (dev.State != AudioSwitcher.AudioApi.DeviceState.Active) { continue; } if ((dev.DeviceType & AudioSwitcher.AudioApi.DeviceType.Capture) != 0) { UpdateLevel(dev, reportFix); } } }
private void Form1_Load(object sender, EventArgs e) { thisNotifyIcon.Click += ThisNotifyIcon_Click; this.FormBorderStyle = FormBorderStyle.None; Controller = new CoreAudioController(); var defaultInputDevice = Controller.GetDefaultDevice(DeviceType.Capture, Role.Multimedia); var defaultInputComDevice = Controller.GetDefaultDevice(DeviceType.Capture, Role.Communications); var defaultOutputDevice = Controller.GetDefaultDevice(DeviceType.Playback, Role.Multimedia); var defaultOutputComDevice = Controller.GetDefaultDevice(DeviceType.Playback, Role.Communications); DefaultInputLabel.Text = defaultInputComDevice.FullName; DefaultInputComLabel.Text = defaultInputDevice.FullName; DefaultOutputComLabel.Text = defaultOutputComDevice.FullName; DefaultOutputLabel.Text = defaultOutputDevice.FullName; /* * var Outputdevices = Controller.GetPlaybackDevices(DeviceState.Active); * * var Inputdevices = Controller.GetCaptureDevices(DeviceState.Active); * * //Console.WriteLine("These are input devices"); * foreach (var endpoint in Inputdevices) * { * InputDropdown.Items.Add(endpoint.FullName); * //Console.WriteLine(endpoint.Fullname); * } * * //Console.WriteLine("These are output devices"); * foreach (var endpoint in Outputdevices) * { * OutputDropdown.Items.Add(endpoint.FullName); * //Console.WriteLine(endpoint.FullName); * } */ OutputDropdown.DropDownStyle = ComboBoxStyle.DropDownList; InputDropdown.DropDownStyle = ComboBoxStyle.DropDownList; UpdateDropdowns(); }
private void cleanUpSessionKeepers() { var defaultDevice = m_coreAudioController.GetDefaultDevice(DeviceType.Playback, Role.Multimedia); IDictionary <string, IAudioSession> currentSessions = new Dictionary <string, IAudioSession>(); foreach (var session in defaultDevice.GetCapability <IAudioSessionController>()) { currentSessions[session.Id] = session; } var deadSessions = m_sessions.Values.Where(session => !currentSessions.ContainsKey(session.id())).ToList(); foreach (var session in deadSessions) { session.Dispose(); m_sessions.Remove(session.id()); } }
private void Form1_Load(object sender, EventArgs e) { DefaultAudioDevice = Controller.GetDefaultDevice(AudioSwitcher.AudioApi.DeviceType.Playback, Role.Multimedia); txtActualDevice.Text = DefaultAudioDevice.FullName; ChargeDevicesList(); chkStartAtStartUp.Checked = Settings.Default.StartWithWin; this.WindowState = FormWindowState.Minimized; this.ShowInTaskbar = false; }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); TrayIcon tray = new TrayIcon(); tray.Display(); audio = new CoreAudioController(); startDevice = audio.GetDefaultDevice(AudioSwitcher.AudioApi.DeviceType.Playback, AudioSwitcher.AudioApi.Role.Multimedia); System.Timers.Timer timer = new System.Timers.Timer(); timer.Elapsed += new ElapsedEventHandler(ProcessTimer); timer.Interval = 500; timer.Enabled = true; Application.Run(); }
static public JObject getDeviceData(bool json, CoreAudioDevice device = null) { if (device == null) { mainDevice = controller.GetDefaultDevice(DeviceType.Playback, Role.Console); device = mainDevice; } IDictionary <string, object> data = new Dictionary <string, object>(); data.Add("name", mainDevice.FullName); //Device Name + Interface data.Add("type", mainDevice.Name); //Name Only data.Add("interface", mainDevice.InterfaceName); //Interface Only data.Add("device", mainDevice.DeviceType); data.Add("icon", mainDevice.Icon); data.Add("iconPath", mainDevice.IconPath); data.Add("id", mainDevice.Id); data.Add("realID", mainDevice.RealId); data.Add("isMuted", mainDevice.IsMuted); data.Add("volume", mainDevice.Volume); //Master Volume data.Add("state", mainDevice.State); //Current State (Active/Disable) return((JObject)JsonConvert.DeserializeObject(JsonConvert.SerializeObject(data, Formatting.Indented))); }
public TrayApplication() { coreAudioController = new CoreAudioController(); manager = new HotKeyManager(); if (File.Exists("save.mm")) { using (var r = new BinaryReader(File.OpenRead("save.mm"))) { if (r.BaseStream.Length >= 40) { var g = new Guid(r.ReadString()); CoreAudioDevice mic = coreAudioController.GetDevice(g); if (mic != null && mic.State == DeviceState.Active) { microphone = mic; } else { microphone = coreAudioController.GetDefaultDevice(DeviceType.Capture, Role.Communications); } beepEnabled = r.ReadBoolean(); Register((ModifierKeys)r.ReadInt32(), (Key)r.ReadInt32(), true); if (r.BaseStream.Position != r.BaseStream.Length) { onBeep.Freq = r.ReadInt32(); onBeep.Duration = r.ReadInt32(); offBeep.Freq = r.ReadInt32(); offBeep.Duration = r.ReadInt32(); } else { onBeep.Freq = 750; onBeep.Duration = 200; offBeep.Freq = 300; offBeep.Duration = 200; } if (r.BaseStream.Position != r.BaseStream.Length) { notificationBallForm = new NotificationBallForm { Enabled = r.ReadBoolean() }; notificationBallForm.DraggingEnd += (asd, esd) => Save(); notificationBallForm.Show(); notificationBallForm.Visible = notificationBallForm.Enabled; notificationBallForm.Location = new Point(r.ReadInt32(), r.ReadInt32()); } else { notificationBallForm = new NotificationBallForm { Enabled = false }; notificationBallForm.Show(); notificationBallForm.Visible = false; } } } } else { microphone = coreAudioController.GetDefaultDevice(DeviceType.Capture, Role.Communications); beepEnabled = false; onBeep.Freq = 750; onBeep.Duration = 200; offBeep.Freq = 300; offBeep.Duration = 200; notificationBallForm = new NotificationBallForm { Enabled = false }; notificationBallForm.Show(); notificationBallForm.Visible = false; Register(ModifierKeys.None, Key.None); } trayMenu = new ContextMenuStrip(); trayMenu.Items.Add(new ToolStripMenuItem("Toogle Mute", default, ToggleMute));
private CoreAudioDevice GetDefaultDevice() { return(AudioController.GetDefaultDevice(DeviceType.Playback, Role.Multimedia)); }
public AudioControl() { var controller = new CoreAudioController(); _device = controller.GetDefaultDevice(DeviceType.Playback, Role.Multimedia); }