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 on the latest pycaw update, And I'm using windows 10, When I do this:
for session in sessions:
if session.Process and session.Process.name() == "python.exe":
if psutil.pid_exists(session.Process.pid):
volume_interface.SetMasterVolumeLevelScalar(volume, None)
For some reason it controls the Global volume of the whole output device, Is there a way I can make it so it controls the python script it's running from instead?
The text was updated successfully, but these errors were encountered:
def set_volume(self, decibels , process):
sessions = AudioUtilities.GetSessionsFromAllDevices()
for session in sessions:
interface = session.SimpleAudioVolume
if session.Process and session.Process.name() == process:
# only set volume in the range 0.0 to 1.0
self.volume = min(1.0, max(0.0, decibels))
interface.SetMasterVolume(self.volume, None)
#print("Volume set to", self.volume) # debug
Might be because you're supposed to use GetMasterVolume() and SetMasterVolume() on a session's SimpleAudioVolume.
Well, as long as you actually want the ratio to be depending on the ACTUAL device's GetMasterVolumeLevelScalar() and SetMasterVolumeLevelScalar().
If you set your DEVICE at 0.5 (aka 50%), and then set your session, using SetMasterVolume(), to 1.0, then your session is at "100% of 50%"... If you set your session to 0.3, then the volume is "30% of 50%" (aka 15%).
Think of it like the Windows Audio Mixer : the device's volume, on the left side of the panel, casts a bar over the rest of the panel, above the apps' volumes; whenever you try to raise the volume of an app ABOVE that bar, the device's volume is moved UP to accommodate the "extra volume needed", but by doing so, it only ever raises the global volume, as nothing can automatically bring it down.
Using a SetMasterVolumeLevelScalar() on a SESSION is just doing that, hence the global volume going up when you're only touching the app's volume.
I'm on the latest pycaw update, And I'm using windows 10, When I do this:
For some reason it controls the Global volume of the whole output device, Is there a way I can make it so it controls the python script it's running from instead?
The text was updated successfully, but these errors were encountered: