log play cursor history on underrun
This commit is contained in:
@@ -176,6 +176,7 @@ DSoundBuf::DSoundBuf( DSound &ds, DSoundBuf::hw hardware,
|
|||||||
extra_writeahead = 0;
|
extra_writeahead = 0;
|
||||||
LastPosition = 0;
|
LastPosition = 0;
|
||||||
playing = false;
|
playing = false;
|
||||||
|
ZERO( last_cursors );
|
||||||
|
|
||||||
/* The size of the actual DSound buffer. This can be large; we generally
|
/* The size of the actual DSound buffer. This can be large; we generally
|
||||||
* won't fill it completely. */
|
* won't fill it completely. */
|
||||||
@@ -426,6 +427,10 @@ void DSoundBuf::CheckUnderrun( int cursorstart, int cursorend )
|
|||||||
if( extra_writeahead )
|
if( extra_writeahead )
|
||||||
s += ssprintf( "; extended writeahead by %i to %i", extra_writeahead, 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() );
|
LOG->Trace( "%s", s.c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -455,6 +460,10 @@ bool DSoundBuf::get_output_buf( char **buffer, unsigned *bufsiz, int chunksize )
|
|||||||
}
|
}
|
||||||
#endif
|
#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
|
/* 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
|
* sure what that means, but it breaks the assumption that we can fill the whole writeahead
|
||||||
* when prebuffering. */
|
* when prebuffering. */
|
||||||
@@ -505,7 +514,11 @@ bool DSoundBuf::get_output_buf( char **buffer, unsigned *bufsiz, int chunksize )
|
|||||||
if( extra_writeahead )
|
if( extra_writeahead )
|
||||||
{
|
{
|
||||||
int used = min( extra_writeahead, bytes_played );
|
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;
|
writeahead -= used;
|
||||||
extra_writeahead -= used;
|
extra_writeahead -= used;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,6 +73,8 @@ private:
|
|||||||
char *locked_buf1, *locked_buf2;
|
char *locked_buf1, *locked_buf2;
|
||||||
int locked_size1, locked_size2;
|
int locked_size1, locked_size2;
|
||||||
char *temp_buffer;
|
char *temp_buffer;
|
||||||
|
|
||||||
|
int last_cursors[4][2];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user