We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 18 - fake_stream in SDL_RunAudio...
Summary: fake_stream in SDL_RunAudio...
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: audio (show other bugs)
Version: HG 1.2
Hardware: All All
: P2 trivial
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-03 12:07 UTC by Ryan C. Gordon
Modified: 2006-03-21 01:45 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan C. Gordon 2006-01-03 12:07:51 UTC
Date: Thu, 27 Oct 2005 16:30:08 -0700
From: Bill May <wmay@cisco.com>
To: sdl@libsdl.org
Subject: [SDL] Use of fake_stream in SDL_RunAudio

Hi,

I'm trying to get the playback latency as low as I can for
audio playback.

I'm using Linux, and noticed that there is a delay in SDL_RunAudio while
stream gets set to audio->fake_stream, instead of getting the
buffer.

The below patch seems to work fine in my system (it tries GetAudioBuf
before the main loop); is there any reason this will not work ?

Thanks,
Bill May

Index: src/audio/SDL_audio.c
===================================================================
RCS file: /vws/pan/mpeg4ip/lib/SDLAudio/src/audio/SDL_audio.c,v
retrieving revision 1.6
diff -c -w -r1.6 SDL_audio.c
*** src/audio/SDL_audio.c       13 Jan 2005 18:21:29 -0000      1.6
--- src/audio/SDL_audio.c       27 Oct 2005 22:58:17 -0000
***************
*** 168,173 ****
--- 168,175 ----
                 silence = audio->spec.silence;
                 stream_len = audio->spec.size;
         }
+       stream = audio->GetAudioBuf(audio);
+       if (stream == NULL)
           stream = audio->fake_stream;

   #ifdef ENABLE_AHI
Comment 1 Ryan C. Gordon 2006-01-27 11:23:03 UTC
Setting Sam as "QA Contact" on all bugs (even resolved ones) so he'll definitely be in the loop to any further discussion here about SDL.

--ryan.

Comment 2 Ryan C. Gordon 2006-03-20 19:56:24 UTC
This patch is now in CVS.

--ryan.

Comment 3 Sam Lantinga 2006-03-21 00:12:59 UTC
I'm reverting this patch.  What it's doing is getting the first audio buffer, and then not doing anything with it.  What you really want is to grab the first audio buffer, fill it, and immediately start playing.

I'll investigate reordering the audio loop so it starts out playing immediately.
Comment 4 Sam Lantinga 2006-03-21 01:45:49 UTC
Okay, audio thread loop reordering is in CVS.