AY PCM still doesn't work so I am leaving a note

This commit is contained in:
tildearrow 2022-09-23 19:34:44 -05:00
parent eb8849ce63
commit bc4c8acd87
2 changed files with 11 additions and 9 deletions

View File

@ -89,26 +89,27 @@ void DivPlatformAY8910::acquire(short* bufL, short* bufR, size_t start, size_t l
ayBuf[i]=new short[ayBufLen];
}
}
// TODO: try to fit this into the actual loop
// PCM part
for (int i=0; i<3; i++) {
if (chan[i].psgMode.dac && chan[i].dac.sample!=-1) {
chan[i].dac.period+=chan[i].dac.rate;
bool end=false;
bool changed=false;
int prev_out = chan[i].dac.out;
int prevOut=chan[i].dac.out;
while (chan[i].dac.period>rate && !end) {
DivSample* s=parent->getSample(chan[i].dac.sample);
if (s->samples<=0) {
chan[i].dac.sample=-1;
rWrite(0x08+i,0);
immWrite(0x08+i,0);
end=true;
break;
}
// Partially
unsigned char dacData=(((unsigned char)s->data8[chan[i].dac.pos]^0x80)>>4);
chan[i].dac.out=MAX(0,MIN(15,(dacData*chan[i].outVol)/15));
if (prev_out!=chan[i].dac.out) {
prev_out=chan[i].dac.out;
if (prevOut!=chan[i].dac.out) {
prevOut=chan[i].dac.out;
changed=true;
}
chan[i].dac.pos++;
@ -116,7 +117,7 @@ void DivPlatformAY8910::acquire(short* bufL, short* bufR, size_t start, size_t l
chan[i].dac.pos=s->loopStart;
} else if (chan[i].dac.pos>=(int)s->samples) {
chan[i].dac.sample=-1;
rWrite(0x08+i,0);
immWrite(0x08+i,0);
end=true;
break;
}
@ -124,7 +125,7 @@ void DivPlatformAY8910::acquire(short* bufL, short* bufR, size_t start, size_t l
}
if (changed && !end) {
if (!isMuted[i]) {
rWrite(0x08+i,chan[i].dac.out);
immWrite(0x08+i,chan[i].dac.out);
}
}
}

View File

@ -85,6 +85,7 @@ void DivPlatformAY8930::acquire(short* bufL, short* bufR, size_t start, size_t l
ayBuf[i]=new short[ayBufLen];
}
}
// TODO: try to fit this into the actual loop
// PCM part
for (int i=0; i<3; i++) {
if (chan[i].psgMode.dac && chan[i].dac.sample!=-1) {
@ -96,7 +97,7 @@ void DivPlatformAY8930::acquire(short* bufL, short* bufR, size_t start, size_t l
DivSample* s=parent->getSample(chan[i].dac.sample);
if (s->samples<=0) {
chan[i].dac.sample=-1;
rWrite(0x08+i,0);
immWrite(0x08+i,0);
end=true;
break;
}
@ -112,7 +113,7 @@ void DivPlatformAY8930::acquire(short* bufL, short* bufR, size_t start, size_t l
chan[i].dac.pos=s->loopStart;
} else if (chan[i].dac.pos>=(int)s->samples) {
chan[i].dac.sample=-1;
rWrite(0x08+i,0);
immWrite(0x08+i,0);
end=true;
break;
}
@ -120,7 +121,7 @@ void DivPlatformAY8930::acquire(short* bufL, short* bufR, size_t start, size_t l
}
if (changed && !end) {
if (!isMuted[i]) {
rWrite(0x08+i,chan[i].dac.out);
immWrite(0x08+i,chan[i].dac.out);
}
}
}