pyminiaudio icon indicating copy to clipboard operation
pyminiaudio copied to clipboard

pyminiaudio isn't usable with Cython because inspect.isgenerator on Cython generators isn't True

Open ell1e opened this issue 1 year ago • 2 comments

pyminiaudio isn't usable with Cython audio sources because inspect.isgenerator on Cython generators isn't True:

  File "/home/user/.local/lib/python3.11/site-packages/miniaudio.py", line 1402, in start
    raise TypeError("callback must be a generator", type(callback_generator))
TypeError: ('callback must be a generator', <class '_cython_3_0_3.generator'>)

It would be nice if this check could be expanded in a way that also supports Cython.

ell1e avatar Feb 08 '24 13:02 ell1e

In pyminiaudio version 1.59, this problem still seems to be present if my tests are correct.

ell1e avatar Jul 07 '24 16:07 ell1e

I know very little about cython.
Do you have any idea how to fix it, and/or how to test a potential fix?

irmen avatar Jul 14 '24 20:07 irmen

Sadly, I don't know how to check this for Cython either. To be able to use miniaudio, I simply deleted that check on my local copy.

ell1e avatar Sep 09 '24 21:09 ell1e

Ok that is interesting, this check is the only thing that prevents it from working in cython?

irmen avatar Sep 10 '24 16:09 irmen

Yup! I use it from a Cython program just fine, passing in a Cython function to generate sound. But it only works if I remove that check.

ell1e avatar Sep 10 '24 16:09 ell1e

I'll see what I can do about that, then.

irmen avatar Sep 10 '24 16:09 irmen