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

Detect audio playing with with pycaw, ctypes, and comtypes: Fails #85

Open
ghbaud opened this issue Dec 13, 2023 · 2 comments
Open

Detect audio playing with with pycaw, ctypes, and comtypes: Fails #85

ghbaud opened this issue Dec 13, 2023 · 2 comments

Comments

@ghbaud
Copy link

ghbaud commented Dec 13, 2023

I'm trying to detect whether audio is playing on a Windows 11 machine, python 3.11.3. The program runs correctly for a few iterations, but then fails silently, often at iteration 64.

I posted a question on stack overflow detailing the code and the issues I'm encountering. I'd be grateful for somebody to take a look at that.
Detect audio playing with with pycaw, ctypes, and comtypes: Fails

evaristorivi pushed a commit to evaristorivi/busylight-evaristorivi that referenced this issue Sep 3, 2024
@evaristorivi
Copy link

evaristorivi commented Sep 3, 2024

The same thing happened to me

Exception ignored in: <function _compointer_base.__del__ at 0x000001BF01CE8F40>
Traceback (most recent call last):
AppData\Local\Programs\Python\Python312\Lib\site-packages\comtypes\_post_coinit\unknwn.py", line 386, in __del__
    self.Release()
AppData\Local\Programs\Python\Python312\Lib\site-packages\comtypes\_post_coinit\unknwn.py", line 534, in Release
    return self.__com_Release()  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^
ValueError: COM method call without VTable
Depósito con errores 0, tipo 4
Nombre de evento: APPCRASH
Respuesta: No disponible
Identificador de archivo .cab: 0

Firma del problema:
P1: python.exe
P2: 3.12.5150.1013
P3: 66b28c14
P4: _ctypes.pyd
P5: 3.12.5150.1013
P6: 66b28be9
P7: c0000005
P8: 000000000000795d
P9: 
P10: 



Símbolo de análisis: 
Nueva búsqueda de una solución: 0
Id. de informe: 12da5f1d-2f47-44c6-8e98-f7b3677fa3b1
Estado del informe: 268435456
Depósito con algoritmo hash: 3ce9fa8f0a9f425017cb674253edc5be
GUID de archivo .cab: 0`

Nombre de la aplicación con errores: python.exe, versión: 3.12.5150.1013, marca de tiempo: 0x66b28c14
Nombre del módulo con errores: _ctypes.pyd, versión: 3.12.5150.1013, marca de tiempo: 0x66b28be9
Código de excepción: 0xc0000005
Desplazamiento de errores: 0x000000000000795d
Identificador del proceso con errores: 0x0xD2C

@TJ-59
Copy link

TJ-59 commented Sep 23, 2024

Worth noting, the stackoverflow post seems to have found an answer (basically using picaw as intended instead of checking endlessly with CoInitialize and casting tons of IAudioSessionControls ), but it still has a misunderstanding :
A session can be active and NOT play any sound.
things like youtube videos will start and stop accordingly (because "browser"), but it doesn't mean ALL PROGRAMS will.
Some may keep it active while doing nothing.

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