neXyon / audaspace

A high level and feature rich audio library written in C++ with language bindings.
Apache License 2.0
57 stars 25 forks source link

UPBGE crashing due to "Unable to initialise audio" + aud python module load #22

Closed lordloki closed 4 years ago

lordloki commented 4 years ago

Hi Nexyon,

we received an issue report on UPBGE pointing out to a crash. The issue is here: https://github.com/UPBGE/upbge/issues/1150

We investigated and came to the conclusion that the problem was that it was not possible to initialize the audio ("Unable to initialise audio") and when the python module (aud) was loaded, the crash occurred. The fix we made is here: https://github.com/UPBGE/upbge/commit/2ccc3063af74c266b4b03cbe509bccbb9a8fe09c. Can you guide us about the possible causes of the audio not being able to be initialized (the user has the updated drivers)?

Thanks in advance

neXyon commented 4 years ago

Hi!

This is weird! It can't have anything to do with audio. Should be a python problem, since all that happens there is the initialization of the python module (no audio devices are opened or so). To dig further, could you try to find out where exactly in PyInit_aud() it fails/returns? It could only return nullptr there if one of the python class initializations or the python module initialization fails... Those are all python functions though.

Cheers

lordloki commented 4 years ago

The nullptr is return in check (inside of PyInit_aud() ):

    if(!initializeSound())
        return nullptr;
neXyon commented 4 years ago

Can you then let me know what the following prints on stderr, when you change the function in PySound.cpp:

bool initializeSound()
{
    import_array();

    if(PyType_Ready(&SoundType) < 0)
    {
        PyErr_Print();
        return false;
    }

    return true;
}
lordloki commented 4 years ago

Hi Nexyon,

the bug was solved. The issue was related to the user's Python has a mix the environment and Blender site-packages. Fix for Blender: https://developer.blender.org/rB79a58eef059ffc3f12d11bd68938cfb1b4cd2462 Additional fix for UPBGE: https://github.com/UPBGE/upbge/commit/00ae19e59d44ce26cc55e922a69755b07d3f1581

Thanks for your help and time. I close the report.