buffer size, chunk size cleanup

use poll()
many systems (even 2.4) can now handle much smaller writeaheads with
software mixing
This commit is contained in:
Glenn Maynard
2004-05-08 03:02:25 +00:00
parent fe9c19b446
commit bed5872199
6 changed files with 76 additions and 48 deletions
@@ -41,28 +41,19 @@ void RageSound_ALSA9_Software::MixerThread()
setpriority( PRIO_PROCESS, 0, -15 );
// RageTimer UnderrunTest;
while(!shutdown)
{
while( !shutdown && GetData() )
;
const float delay_ms = 1000 * float(max_writeahead) / samplerate;
SDL_Delay( int(delay_ms) / 4 );
// if( UnderrunTest.PeekDeltaTime() > 10 )
// {
// UnderrunTest.GetDeltaTime();
// SDL_Delay( 250 );
// }
pcm->WaitUntilFramesCanBeFilled( 100 );
}
}
/* Returns the number of frames processed */
bool RageSound_ALSA9_Software::GetData()
{
const int chunksize = max_writeahead / num_chunks;
const int frames_to_fill = pcm->GetNumFramesToFill( max_writeahead, chunksize );
const int frames_to_fill = pcm->GetNumFramesToFill();
if( frames_to_fill <= 0 )
return false;
@@ -116,6 +107,9 @@ try {
pcm->SetSampleRate( samplerate );
LOG->Info( "ALSA: Software mixing at %ihz", samplerate );
pcm->SetWriteahead( max_writeahead );
pcm->SetChunksize( max_writeahead / num_chunks );
StartDecodeThread();
MixingThread.SetName( "RageSound_ALSA9_Software" );