Fix NDSP wavebuf synchronization issue (thanks to Lectem)

This commit is contained in:
fincs 2015-10-24 00:54:57 +02:00
parent f06d37659c
commit ebad126fc0
2 changed files with 5 additions and 5 deletions

View File

@ -18,7 +18,7 @@ typedef struct
/// Performs a clrex operation.
static inline void __clrex(void)
{
__asm__ __volatile__("clrex");
__asm__ __volatile__("clrex" ::: "memory");
}
/**

View File

@ -143,12 +143,12 @@ void ndspChnWaveBufClear(int id)
void ndspChnWaveBufAdd(int id, ndspWaveBuf* buf)
{
ndspChnSt* chn = &ndspChn[id];
ndspWaveBuf* cb = chn->waveBuf;
if (!buf->nsamples) return;
buf->next = NULL;
buf->status = NDSP_WBUF_QUEUED;
LightLock_Lock(&chn->lock);
ndspWaveBuf* cb = chn->waveBuf;
if (cb)
{
@ -360,13 +360,13 @@ void ndspiReadChnState(void)
if (chn->syncCount == st->syncCount)
{
u16 seqId = st->curSeqId;
LightLock_Lock(&chn->lock);
ndspWaveBuf* wb = chn->waveBuf;
chn->samplePos = ndspiRotateVal(st->samplePos);
if ((st->flags & 0xFF00) && wb)
{
LightLock_Lock(&chn->lock);
while (wb->sequence_id != seqId)
{
chn->wavBufCount--;
@ -382,9 +382,9 @@ void ndspiReadChnState(void)
chn->wavBufCount = 0;
chn->waveBuf = wb;
chn->waveBufSeqPos = seqId;
LightLock_Unlock(&chn->lock);
}
LightLock_Unlock(&chn->lock);
}
chn->playing = (st->flags & 0xFF) ? true : false;
}