Really really fix NDSP wavebuf scheduling, this time for real

This commit is contained in:
fincs 2015-10-24 01:47:23 +02:00
parent 28f73801cc
commit b3e6a64596
2 changed files with 23 additions and 19 deletions

View File

@ -360,13 +360,16 @@ 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;
chn->samplePos = ndspiRotateVal(st->samplePos); chn->samplePos = ndspiRotateVal(st->samplePos);
chn->waveBufSeqPos = seqId; chn->waveBufSeqPos = seqId;
if ((st->flags & 0xFF00) && wb) if (st->flags & 0xFF00)
{
LightLock_Lock(&chn->lock);
ndspWaveBuf* wb = chn->waveBuf;
if (wb)
{
if (chn->wavBufCount)
{ {
while (wb->sequence_id != seqId) while (wb->sequence_id != seqId)
{ {
@ -379,13 +382,14 @@ void ndspiReadChnState(void)
} }
if (wb && wb->status != NDSP_WBUF_DONE) if (wb && wb->status != NDSP_WBUF_DONE)
wb->status = NDSP_WBUF_PLAYING; wb->status = NDSP_WBUF_PLAYING;
}
if (seqId == 0) if (seqId == 0)
chn->wavBufCount = 0; chn->wavBufCount = 0;
chn->waveBuf = wb; chn->waveBuf = wb;
} }
LightLock_Unlock(&chn->lock); LightLock_Unlock(&chn->lock);
} }
}
chn->playing = (st->flags & 0xFF) ? true : false; chn->playing = (st->flags & 0xFF) ? true : false;
} }
} }

View File

@ -461,7 +461,7 @@ Result ndspInit(void)
ndspiInitChn(); ndspiInitChn();
rc = initCfgu(); rc = initCfgu();
if (rc) if (rc==0)
{ {
u8 outMode; u8 outMode;
CFGU_GetConfigInfoBlk2(sizeof(outMode), 0x70001, &outMode); CFGU_GetConfigInfoBlk2(sizeof(outMode), 0x70001, &outMode);