AndreMiras / pycaw

Python Core Audio Windows Library
MIT License
385 stars 67 forks source link

session.Process of the System Sounds process value is None. #14

Open Rehi146 opened 5 years ago

Rehi146 commented 5 years ago

An example: sessions = AudioUtilities.GetAllSessions() print(get_time() + "Audio device volume is set to max, Setting processes volume:") for session in sessions: interface = session.SimpleAudioVolume if interface.GetMasterVolume() <= 0.99: interface.SetMasterVolume(interface.GetMasterVolume() + 0.01, None) name = "Can't get process name: " if session.Process: # If it's not None, otherwise session.Process.name() would crash the program name = session.Process.name() print(name + ": volume changed to " + str(int(interface.GetMasterVolume() * 100)) + "%")

Rehi146 commented 5 years ago

Maybe there are more processes like this. Better check it out.

TurboAnonym commented 3 years ago

... a bit late, but this is only true for the System Sounds. 😇

It is caused by session._ctl.GetProcessId() == 0 for the System Sounds. (see pycaw.utils AudioSession)

TJ-59 commented 1 month ago

Btw, a session's ._ctl.IsSystemSoundsSession() return 1 for everything except for the actual "system sounds" session, which returns a 0. Shouldn't it be the opposite ? or changing it now would cause some code to behave badly ?