Lock sound timer thread.

svn-id: r23340
This commit is contained in:
Won Star 2006-06-29 05:34:56 +00:00
parent d954c5ebd5
commit 5e7d109e3c

View File

@ -43,6 +43,14 @@ static GPSOUNDBUF soundBuf;
// polls the current playing position within the buffer. // polls the current playing position within the buffer.
static void soundTimer() { static void soundTimer() {
static int locked = false;
if (locked) {
return;
}
locked = true;
unsigned int sampleshiftVal = soundBuf.samples << shiftVal; unsigned int sampleshiftVal = soundBuf.samples << shiftVal;
unsigned int t = (((unsigned int)(*soundPos) - (unsigned int)buffer) >> shiftVal) >= soundBuf.samples ? 1 : 0; unsigned int t = (((unsigned int)(*soundPos) - (unsigned int)buffer) >> shiftVal) >= soundBuf.samples ? 1 : 0;
if (t != frame) { if (t != frame) {
@ -90,6 +98,8 @@ static void soundTimer() {
} while ((uint32)d < max); } while ((uint32)d < max);
} }
} }
locked = false;
} }
int gp_soundBufStart(GPSOUNDBUF *sb) { int gp_soundBufStart(GPSOUNDBUF *sb) {