diff --git a/stepmania/src/arch/Sound/ALSA9Functions.h b/stepmania/src/arch/Sound/ALSA9Functions.h index e94f313444..d6209949c9 100644 --- a/stepmania/src/arch/Sound/ALSA9Functions.h +++ b/stepmania/src/arch/Sound/ALSA9Functions.h @@ -50,4 +50,5 @@ FUNC(int, snd_pcm_sw_params_current, (snd_pcm_t *pcm, snd_pcm_sw_params_t *param FUNC(int, snd_pcm_sw_params_get_boundary, (const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val)); FUNC(int, snd_pcm_sw_params_get_xfer_align, (const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val)); FUNC(int, snd_pcm_sw_params_set_stop_threshold, (snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val)); +FUNC(int, snd_pcm_sw_params_get_avail_min, (snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val)); diff --git a/stepmania/src/arch/Sound/ALSA9Helpers.cpp b/stepmania/src/arch/Sound/ALSA9Helpers.cpp index 30c3691c0c..fde5d80823 100644 --- a/stepmania/src/arch/Sound/ALSA9Helpers.cpp +++ b/stepmania/src/arch/Sound/ALSA9Helpers.cpp @@ -88,6 +88,14 @@ bool Alsa9Buf::SetSWParams() int err = dsnd_pcm_sw_params_get_xfer_align( swparams, &xfer_align ); ALSA_ASSERT("dsnd_pcm_sw_params_get_xfer_align"); + snd_pcm_uframes_t avail_min; + err = dsnd_pcm_sw_params_get_avail_min( swparams, &avail_min ); + ALSA_ASSERT("dsnd_pcm_sw_params_get_avail_min"); + + /* So far, I havn't seen a case where avail_min > xfer_align. If that happens, + * the GetNumFramesToFill will need updating. */ + ASSERT( avail_min <= xfer_align ); + /* If this fails, we might have bound dsnd_pcm_sw_params_get_xfer_align to * the old SW API. */ ASSERT( err <= 0 ); diff --git a/stepmania/src/arch/Sound/DSoundHelpers.cpp b/stepmania/src/arch/Sound/DSoundHelpers.cpp index fe84828f09..b7c292cdd1 100644 --- a/stepmania/src/arch/Sound/DSoundHelpers.cpp +++ b/stepmania/src/arch/Sound/DSoundHelpers.cpp @@ -285,9 +285,6 @@ bool DSoundBuf::get_output_buf(char **buffer, unsigned *bufsiz, int chunksize) ASSERT(!buffer_locked); DWORD cursorstart, cursorend; -#if !defined(_XBOX) - DWORD junk; -#endif HRESULT result; @@ -353,7 +350,6 @@ bool DSoundBuf::get_output_buf(char **buffer, unsigned *bufsiz, int chunksize) LOG->Trace("underrun %p: %i..%i filled but cursor at %i..%i (missed it by %i) %i/%i", this, first_byte_filled, write_cursor, cursorstart, cursorend, missed_by, buffer_bytes_filled, buffersize); -// (cursorend - first_byte_filled + buffersize) % buffersize); /* Pretend the space between the play and write cursor is filled * with data, and continue filling from there. */ @@ -395,6 +391,7 @@ bool DSoundBuf::get_output_buf(char **buffer, unsigned *bufsiz, int chunksize) #ifdef _XBOX result = buf->Lock(write_cursor, num_bytes_empty, (LPVOID *)buffer, (DWORD *) bufsiz, NULL, NULL, 0); #else + DWORD junk; result = buf->Lock(write_cursor, num_bytes_empty, (LPVOID *)buffer, (DWORD *) bufsiz, NULL, &junk, 0); #endif