POINTER(IAudioSessionControl2)' object has no attribute 'GetState‘
See original GitHub issuecode:
from pycaw.pycaw import AudioUtilities
import time
def main():
while True:
sessions = AudioUtilities.GetAllSessions()
for session in sessions:
if session.Process and session.InstanceIdentifier.find("foobar") >= 0:
print(session.InstanceIdentifier)
print(session.State)
time.sleep(1)
if __name__ == "__main__":
main()
error:
{0.0.0.00000000}.{03b51635-f342-4dcd-b24d-c459985d9f01}|#%b{0B9C664C-1049-4DB7-8104-97016411F561}|1%b#
Traceback (most recent call last):
File "D:/code/pystream/device.py", line 17, in <module>
main()
File "D:/code/pystream/device.py", line 12, in main
print(session.State)
File "D:\anaconda3\envs\pystream32\lib\site-packages\pycaw\pycaw.py", line 608, in State
s = self._ctl.GetState()
AttributeError: 'POINTER(IAudioSessionControl2)' object has no attribute 'GetState'
https://docs.microsoft.com/en-us/windows/win32/api/audiopolicy/nn-audiopolicy-iaudiosessioncontrol2 The IAudioSessionControl2 interface inherits from IAudioSessionControl. I need to use getstate method,what should I do? https://docs.microsoft.com/en-us/windows/win32/api/audiopolicy/nf-audiopolicy-iaudiosessioncontrol-getstate
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
"AttributeError: 'module' object has no attribute '__getstate__ ...
AttributeError : 'module' object has no attribute '__getstate__'. I'm using setuptools-0.6c11-py2.6. python · django · easy-install.
Read more >IAudioSessionControl::GetState (audiopolicy.h) - Win32 apps
Pointer to a variable into which the method writes the current session state. The state must be one of the following AudioSessionState ...
Read more >Code - e7devteam/Rhythm-Breaker - Yona
Object @)"> <summary> Retrieves an interface pointer associated with a key. </summary> </member> <member name="M:NAudio.MediaFoundation.IMFAttributes.
Read more >API Document | PDF | Microsoft Windows - Scribd
sIDHistory attribute of a security principal in another domain ... object creation extension with a pointer to the directory object created.
Read more >Diff - wine-1.3.20 - Git repositories on goma
user32: Only call the driver when the cursor position has really changed. ... + mmdevapi/tests: Add tests for IAudioSessionControl::GetState.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
it is done https://github.com/AndreMiras/pycaw/pull/37 😀
Hi @zhjy8827 😉 I will make a pull request later but a quick fix for now is replacing this code from the pycaw.pycaw file: (your pycaw location: “D:\anaconda3\envs\pystream32\lib\site-packages\pycaw\pycaw.py”)
with the following:
After that
session.State
will return an int: 0 = AudioSessionStateInactive 1 = AudioSessionStateActive 2 = AudioSessionStateExpired