Fix NDSP wavebuf synchronization issue (thanks to Lectem)
This commit is contained in:
parent
f06d37659c
commit
ebad126fc0
@ -18,7 +18,7 @@ typedef struct
|
|||||||
/// Performs a clrex operation.
|
/// Performs a clrex operation.
|
||||||
static inline void __clrex(void)
|
static inline void __clrex(void)
|
||||||
{
|
{
|
||||||
__asm__ __volatile__("clrex");
|
__asm__ __volatile__("clrex" ::: "memory");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -143,12 +143,12 @@ void ndspChnWaveBufClear(int id)
|
|||||||
void ndspChnWaveBufAdd(int id, ndspWaveBuf* buf)
|
void ndspChnWaveBufAdd(int id, ndspWaveBuf* buf)
|
||||||
{
|
{
|
||||||
ndspChnSt* chn = &ndspChn[id];
|
ndspChnSt* chn = &ndspChn[id];
|
||||||
ndspWaveBuf* cb = chn->waveBuf;
|
|
||||||
if (!buf->nsamples) return;
|
if (!buf->nsamples) return;
|
||||||
|
|
||||||
buf->next = NULL;
|
buf->next = NULL;
|
||||||
buf->status = NDSP_WBUF_QUEUED;
|
buf->status = NDSP_WBUF_QUEUED;
|
||||||
LightLock_Lock(&chn->lock);
|
LightLock_Lock(&chn->lock);
|
||||||
|
ndspWaveBuf* cb = chn->waveBuf;
|
||||||
|
|
||||||
if (cb)
|
if (cb)
|
||||||
{
|
{
|
||||||
@ -360,13 +360,13 @@ void ndspiReadChnState(void)
|
|||||||
if (chn->syncCount == st->syncCount)
|
if (chn->syncCount == st->syncCount)
|
||||||
{
|
{
|
||||||
u16 seqId = st->curSeqId;
|
u16 seqId = st->curSeqId;
|
||||||
|
LightLock_Lock(&chn->lock);
|
||||||
|
|
||||||
ndspWaveBuf* wb = chn->waveBuf;
|
ndspWaveBuf* wb = chn->waveBuf;
|
||||||
chn->samplePos = ndspiRotateVal(st->samplePos);
|
chn->samplePos = ndspiRotateVal(st->samplePos);
|
||||||
|
|
||||||
if ((st->flags & 0xFF00) && wb)
|
if ((st->flags & 0xFF00) && wb)
|
||||||
{
|
{
|
||||||
LightLock_Lock(&chn->lock);
|
|
||||||
|
|
||||||
while (wb->sequence_id != seqId)
|
while (wb->sequence_id != seqId)
|
||||||
{
|
{
|
||||||
chn->wavBufCount--;
|
chn->wavBufCount--;
|
||||||
@ -382,9 +382,9 @@ void ndspiReadChnState(void)
|
|||||||
chn->wavBufCount = 0;
|
chn->wavBufCount = 0;
|
||||||
chn->waveBuf = wb;
|
chn->waveBuf = wb;
|
||||||
chn->waveBufSeqPos = seqId;
|
chn->waveBufSeqPos = seqId;
|
||||||
LightLock_Unlock(&chn->lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LightLock_Unlock(&chn->lock);
|
||||||
}
|
}
|
||||||
chn->playing = (st->flags & 0xFF) ? true : false;
|
chn->playing = (st->flags & 0xFF) ? true : false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user