![]() IAudioSessionEnumerator sessionEnumerator IAudioSessionManager2 mgr = (IAudioSessionManager2)o Speakers.Activate(ref IID_IAudioSessionManager2, 0, IntPtr.Zero, out o) Guid IID_IAudioSessionManager2 = typeof(IAudioSessionManager2).GUID IMMDeviceEnumerator deviceEnumerator = (IMMDeviceEnumerator)(new MMDeviceEnumerator()) ĭeviceEnumerator.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia, out speakers) ![]() get the speakers (1st render + multimedia) device Public static IEnumerable EnumerateApplications() Public static void SetApplicationMute(string name, bool mute) Volume.SetMasterVolume(level / 100, ref guid) Public static void SetApplicationVolume(string name, float level) Public static bool? GetApplicationMute(string name) ISimpleAudioVolume volume = GetVolumeObject(name) Public static float? GetApplicationVolume(string name) set the volume to half of master volume (50%) display mute state & volume level (% of master)Ĭonsole.WriteLine("Mute:" + GetApplicationMute(app)) Ĭonsole.WriteLine("Volume:" + GetApplicationVolume(app)) ![]() using System įoreach (string name in EnumerateApplications()) It's based on the Windows Core Audio Library. Here is a sample C# Console Application that does it. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |