Re: [AD] get_audio_stream_buffer

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Serge Semashko wrote:

This should say, the entire timer where you use the audio stream functions should be kept as fast as possible. No other timers, including the sound driver ones, can run while this one is.

Although my advice is still the same. Do the threading yourself (there are pthreads available for Win32, and Linux/Unix usually comes with them), and keep the audio stream within one thread.


I'm using DUMB library for background music (it uses get_audio_stream_buffer) and all the music code works in its own thread. But sound is initialized in the main thread and sound effects are somtimes played from the main thread using play_sample function.

Looks like there are some problems with this approach in Linux. After playing music for some time in a loop, the game just starts making noise and becomes unresponsive. Time needed to wait before this problem shows up varies from about 15 minutes to several hours.

I will try to make a smaller testcase and experiment with it.

Done, a smaller part of code that can be used to reproduce the problem is here: http://ufo2000.lxnt.info/files/other/music-bug.zip

It required DUMB library version 0.9.2 installed (http://dumb.sf.net)

I tested this on two Linux systems (with and without NPTL), with both 4.0.3 and 4.1.14 versions of Allegro library. This bug does not seem to show up in Windows.


I suspect there is a problem with initializing sound as

install_sound(DIGI_AUTODETECT, MIDI_NONE, NULL);

and then using the code that contains the following lines

allegro_midi = load_midi(filename);
if (allegro_midi) {
	play_midi(allegro_midi, 1);
	return true;
}

When I comment out attempt to load and play the file as midi, I could not reproduce the problem (will try to make it run for the whole night to check if it really disappeared).

The question is: are there any sanity checks in allegro code when using midi funtions without proper initialization? If there are not, could they be added as it was really difficult to track the source of the problem (does not show up in Windows, requires to be run for a rather long time in Linux).






Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/