| Re: [AD] get_audio_stream_buffer | 
[ Thread Index | 
Date Index
| More lists.liballeg.org/allegro-developers Archives
] 
Evert Glebbeek wrote:
I don't have Allegro installed here to check against, but I suspect it has to do
with not being able to read from disk in a timer context in DOS.
I'm trying to look through the source and understand why, but it doesn't 
seem to be a swap/disk read issue (since all the data is locked). The 
problem is that not all platforms are able to lock the data, and the 
timer method is unknown to the user/programmer. What I can gather from 
thinking is this:
Threaded systems should be fine, though the time between getting the 
buffer and freeing it must be kept to an absolute minimum (as it is 
now). Signal/interrupt systems are not since your interrupt can itself 
be interrupted, even between retrieving and freeing the data stream, 
causing delay problems.
Though even on systems where threads are available, it doesn't mean 
Allegro's timers are using a thread.
Calling from a different thread is the same as calling from a timer, by
the way, since timers are implemented using threads on platforms other than DOS
and UNIX SIGALARM.
I wouldn't really say that. While it's true that the majority of 
platforms use a thread for timers, they use just that.. a single thread 
to run every timer that's installed. A timer behaves completely 
different from a thread.
But basically, in conclusion:
If you start the thread yourself, and keep the audio stream contained 
wholey in that thread, it should be alright. Using an Allegro timer to 
do the threading for you is bad, since you can't gaurantee the method 
the timer is using.
- Kitty Cat