You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm developing a Windows service that lets you use an external controller to modify the volume of certain applications.
The general volume modification works, but when I want to retrieve all sessions, there are none of the sessions I want (in SetApplicationVolume function).
For your information, my service runs on the local system account. I've already tried using my local account, but it makes no difference.
Do you have a solution? Or is this a bug?
My code :
namespacetest{internalclassAudioManager{privateCoreAudioControllercontroller;publicAudioManager(){this.controller=newCoreAudioController();}publicvoidSetProcessVolume(string[]processus,intvolume){if(processus.Length==0)return;foreach(stringprocessNameinprocessus){SetApplicationVolume(processName,volume);}}publicvoidSetMasterVolume(intvolume){vardefaultPlaybackDevice=controller.DefaultPlaybackDevice;if(defaultPlaybackDevice.Volume==volume)return;defaultPlaybackDevice.Volume=volume;Logger.Info("Master volume changed to \""+volume+"%\"");}publicCoreAudioDeviceGetDevice(stringname){returncontroller.GetPlaybackDevices().FirstOrDefault(a =>a.Name==name||a.FullName==name||a.InterfaceName==name);}publicvoidSetDefaultAudioDevice(GuiddeviceGuid){vardevice=controller.GetDevice(deviceGuid);controller.SetDefaultDevice(device);controller.SetDefaultCommunicationsDevice(device);}publicvoidSetDefaultAudioDevice(stringdeviceName){vardevice=GetDevice(deviceName);if(device!=null){SetDefaultAudioDevice(device.Id);}}publicvoidSetApplicationVolume(stringprocessName,intvolume){if(volume<0||volume>100){return;}vardefaultPlaybackDevice=controller.DefaultPlaybackDevice;// No session herevarsessions=defaultPlaybackDevice.SessionController.All();foreach(varsessioninsessions){using(varprocess=Process.GetProcessById(session.ProcessId)){if(process.ProcessName.Equals(processName,StringComparison.OrdinalIgnoreCase)){session.Volume=volume;break;}}}}}}
The text was updated successfully, but these errors were encountered:
I'm developing a Windows service that lets you use an external controller to modify the volume of certain applications.
The general volume modification works, but when I want to retrieve all sessions, there are none of the sessions I want (in SetApplicationVolume function).
For your information, my service runs on the local system account. I've already tried using my local account, but it makes no difference.
Do you have a solution? Or is this a bug?
My code :
The text was updated successfully, but these errors were encountered: