log play cursor history on underrun

This commit is contained in:
Glenn Maynard
2004-11-30 23:02:26 +00:00
parent 22812c0e7f
commit cac8e02281
2 changed files with 16 additions and 1 deletions
+14 -1
View File
@@ -176,6 +176,7 @@ DSoundBuf::DSoundBuf( DSound &ds, DSoundBuf::hw hardware,
extra_writeahead = 0;
LastPosition = 0;
playing = false;
ZERO( last_cursors );
/* The size of the actual DSound buffer. This can be large; we generally
* won't fill it completely. */
@@ -426,6 +427,10 @@ void DSoundBuf::CheckUnderrun( int cursorstart, int cursorend )
if( extra_writeahead )
s += ssprintf( "; extended writeahead by %i to %i", extra_writeahead, writeahead );
s += "; last: ";
for( int i = 0; i < 4; ++i )
s += ssprintf( "%i, %i; ", last_cursors[i][0], last_cursors[i][1] );
LOG->Trace( "%s", s.c_str() );
}
@@ -455,6 +460,10 @@ bool DSoundBuf::get_output_buf( char **buffer, unsigned *bufsiz, int chunksize )
}
#endif
memmove( &last_cursors[0][0], &last_cursors[1][0], sizeof(int)*6 );
last_cursors[3][0] = cursorstart;
last_cursors[3][1] = cursorend;
/* Some cards (Creative AudioPCI) have a no-write area even when not playing. I'm not
* sure what that means, but it breaks the assumption that we can fill the whole writeahead
* when prebuffering. */
@@ -505,7 +514,11 @@ bool DSoundBuf::get_output_buf( char **buffer, unsigned *bufsiz, int chunksize )
if( extra_writeahead )
{
int used = min( extra_writeahead, bytes_played );
LOG->Trace("used %i of %i", used, extra_writeahead);
CString s = ssprintf("used %i of %i (%i..%i)", used, extra_writeahead, cursorstart, cursorend );
s += "; last: ";
for( int i = 0; i < 4; ++i )
s += ssprintf( "%i, %i; ", last_cursors[i][0], last_cursors[i][1] );
LOG->Trace("%s", s.c_str());
writeahead -= used;
extra_writeahead -= used;
}
+2
View File
@@ -73,6 +73,8 @@ private:
char *locked_buf1, *locked_buf2;
int locked_size1, locked_size2;
char *temp_buffer;
int last_cursors[4][2];
};
#endif