Using Allegro 5.0.5 running on Win XP, Directx9.0c I'm encountering an intermittent lockup when cleaning up audio.
Under Win7, I haven't encountered the bug at all.
If I destroy the mixer before destroying my voice, sometimes the program will lock at al_destroy_mixer.
If I destroy the voice first, it will hang on al_detach_voice(voice).
Once in a while it will get passed al_destroy_voice, al_destroy_mixer() and then hang on al_uninstall_audio().
This may be a huge assumption, but will al_destroy_mixer detach any attached voices before it is cleaned up? Will al_uninstall_audio() also attempt to do the same thing? WHAT IS THE PROPER ORDER?
When I say intermittent, I mean sometimes it will run/exit fine 20 times in a row (just loading main screen, exiting) and then randomly crash. Only thing I can do to reproduce it is to keep running/exiting until it happens. Code:blocks debugger doesnt appear to even catch that the app is hung up?
I can't really post complete code due to the size of the project and the resources involved. Just wanted to know if anyone else has had intermittent issues with cleaning up audio, and if so, what might I be doing wrong?
In that code, I am setting the streams to stop regardless of their state since if al_get_audio_stream_playing(stream) was returning false even though the stream WAS playing. Curious...
I generally don't post threads, preferring to smash my head against the wall and look at other forum posts until I've fixed the issue but I've searched high and low for similar issues and of the two threads I've seen, both seem to be unanswered.
Help me Obi Wan Allegro.cc... you're my only hope!
Edit: Debug did catch a crash finally...
#0 00000000 0x00448574 in _dsound_stop_voice() (??:??)
#1 00000000 0x00442f84 in al_detach_voice() (??:??)
#2 00000000 0x004467bf in _al_kcm_destroy_sample() (??:??)
#3 00000000 0x004445d6 in al_destroy_mixer() (??:??)
#4 00000000 0x00442930 in _al_kcm_shutdown_default_mixer() (??:??)
#5 00000000 0x00441e28 in al_uninstall_audio() (??:??)
#6 00000000 0x00467d1d in _al_run_exit_funcs() (??:??)
#7 00000000 0x00462ee8 in al_uninstall_system() (??:??)
#8 77C39E24 msvcrt!_initterm() (C:\WINNT\system32\msvcrt.dll:??)
#9 77C39EC5 msvcrt!_cexit() (C:\WINNT\system32\msvcrt.dll:??)
#10 00000000 0x00000000 in ??() (??:??)
EDIT - Updated Code:
Rather than crashing on al_detach_voice(); this code generally crashes on al_detach_mixer() unless I check al_get_mixer_attached(mixer). If I check, it seems to be false, and thus doesnt detach and it will crash on al_destroy_mixer()
I can't see anything in allegro.log that appears to be of relevance...
Tearing my hair out of my skull now... Why is it so random? Why do I have to run it 20-30 times before it'll happen? Then sometimes it'll happen as soon as I build and run once....