Re: [AD] voice_stop() and voice_start() on Linux

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


> In my game, I'm calling get_audio_stream_buffer() even when the stream is
> paused.

I'm not sure we are commited to supporting that...

> Any clues as to what might have changed to cause this to stop working?

Index: src/stream.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/stream.c,v
retrieving revision 1.2
retrieving revision 1.4
diff -u -p -r1.2 -r1.4
--- src/stream.c        16 Aug 2001 11:11:25 -0000      1.2
+++ src/stream.c        15 Jan 2002 22:03:59 -0000      1.4
@@ -48,7 +48,7 @@ AUDIOSTREAM *play_audio_stream(int len,
    stream->len = len;
    stream->bufcount = bufcount;
    stream->bufnum = 0;
-   stream->active = 0;
+   stream->active = 1;
    stream->locked = NULL;

    /* create the underlying sample */
@@ -84,7 +84,6 @@ AUDIOSTREAM *play_audio_stream(int len,
    voice_set_playmode(stream->voice, PLAYMODE_LOOP);
    voice_set_volume(stream->voice, vol);
    voice_set_pan(stream->voice, pan);
-   voice_start(stream->voice);

    return stream;
 }
@@ -123,6 +122,7 @@ void *get_audio_stream_buffer(AUDIOSTREA
    int pos;
    char *data = NULL;

+
    if (stream->bufnum == stream->active * stream->bufcount) {
       /* waiting for the sample to switch halves */
       pos = voice_get_position(stream->voice);
@@ -181,4 +181,8 @@ void free_audio_stream_buffer(AUDIOSTREA

       stream->locked = NULL;
    }
+
+   /* start playing if it wasn't already */
+   if (voice_get_position(stream->voice) == -1)
+      voice_start(stream->voice);
 }


The CVS logs reads:
"Javier fixed a problem with audiostreams where if you used a large buffer 
therewould be a long delay between play_audio_stream and 
get_audio_stream_buffer"

"Javier rolled back his previous patch (dated 01/09) and used another 
approach to avoid the delay"

-- 
Eric Botcazou




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