Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Rehi146 opened this issue Mar 18, 2019 · 3 comments
Open

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

Rehi146 opened this issue Mar 18, 2019 · 3 comments

Comments

@Rehi146
Copy link

Rehi146 commented Mar 18, 2019

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
Copy link
Author

Rehi146 commented Mar 18, 2019

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

@TurboAnonym
Copy link
Contributor

... 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
Copy link

TJ-59 commented Sep 24, 2024

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants