Re: [Plib-users] Patch for plib and alsa oss emulation
Brought to you by:
sjbaker
From: Felix <fx...@gm...> - 2002-07-27 18:53:15
|
Hmm, looks like I should clarify this ... On Sat, 27 Jul 2002 13:17:15 -0500 Steve Baker <sjb...@ai...> wrote: > Felix Kühling wrote: > > > The cause turned out to be that plib writes more data to the > > (non-blocking) sound device with the default safety_margin than it can > > take. The attached patch fixes this problem for linux, both Tuxkart and > > Flightgear work fine :) and it doesn't break Torcs which was ok before. > > But PLIB asks the OSS API how many bytes are free in the input buffer and > always writes that number. I think there must be something wrong with > the slDSP::secondsRemaining function for this device. Maybe we are talking about different versions, I was talking about the latest stable version 1.4.2. In slScheduler::realUpdate audio data is written in fragments using slDSP::play. The fragment size was determined in slScheduler::initBuffers. However, realUpdate keeps writing to the audio device while ( secondsUsed() <= safety_margin ). slScheduler::safety_margin is not related to the buffer memory available in the audio device. It is initialized to 1 second by default. Torcs which sets this value to 0.128 works fine. BTW, slDSP::secondsRemaining is never called in slDSP.cxx and slScheduler.cxx. > > However, it introduces a new function slDSP::fragmentsRemaining which > > would have to be implemented (as dummy?) for other platforms. > > But that's exactly what 'secondsRemaining' is doing (except that it's > supposed to be implemented on every platform and it doesn't export the > concept of 'fragments' which isn't meaningful at this level. I tried some magic with secondsRemaining first but I never got it to work reliably. Also this approach would require a new function like secondsFragment in order to be sure that there is enough buffer memory left for an entire fragment. > > I don't think this is the correct patch for whatever your problem is. I think the fact that other people don't have the problem (like me on my other computer with a real OSS driver ;) is that there is usually enough buffer available for the default safety margin of 1 sec. The patch works for me. Maybe the problem does not exist in the latest unstable version but this is not a solution for me since I don't want to recompile all the programmes and I'm not even sure that they would work with plib 1.5.x. Regards, Felix Kühling __\|/__ ___ ___ ___ __Tschüß_______\_6 6_/___/__ \___/__ \___/___\___You can do anything,___ _____Felix_______\Ä/\ \_____\ \_____\ \______U___just not everything____ fx...@gm... >o<__/ \___/ \___/ at the same time! |