new chan osc, part 4

adapt dispatch code to it
This commit is contained in:
tildearrow 2025-03-01 19:49:56 -05:00
parent c0e4552c52
commit a16d20e190
18 changed files with 218 additions and 88 deletions

View file

@ -61,6 +61,9 @@ void DivPlatformGBAMinMod::acquire(short** buf, size_t len) {
chState[i].volL=(short)chReg[14];
chState[i].volR=(short)chReg[15];
}
for (int i=0; i<chanMax; i++) {
oscBuf[i]->begin(len);
}
for (size_t h=0; h<len; h++) {
while (sampTimer>=sampCycles) {
// the driver generates 4 samples at a time and can be start-offset
@ -133,10 +136,10 @@ void DivPlatformGBAMinMod::acquire(short** buf, size_t len) {
buf[0][h]=sampL;
buf[1][h]=sampR;
for (int i=0; i<chanMax; i++) {
oscBuf[i]->data[oscBuf[i]->needle++]=oscOut[i][sampPos];
oscBuf[i]->putSample(h,oscOut[i][sampPos]);
}
for (int i=chanMax; i<16; i++) {
oscBuf[i]->data[oscBuf[i]->needle++]=0;
oscBuf[i]->putSample(h,0);
}
while (updTimer>=updCycles) {
// flip buffer
@ -197,6 +200,9 @@ void DivPlatformGBAMinMod::acquire(short** buf, size_t len) {
updTimer+=1<<dacDepth;
sampTimer+=1<<dacDepth;
}
for (int i=0; i<chanMax; i++) {
oscBuf[i]->end(len);
}
// write back changed cached channel registers
for (int i=0; i<chanMax; i++) {
unsigned short* chReg=&regPool[i*16];
@ -728,7 +734,7 @@ void DivPlatformGBAMinMod::setFlags(const DivConfig& flags) {
chanMax=flags.getInt("channels",16);
rate=16777216>>dacDepth;
for (int i=0; i<16; i++) {
oscBuf[i]->rate=rate;
oscBuf[i]->setRate(rate);
}
sampCycles=16777216/flags.getInt("sampRate",21845);
chipClock=16777216/sampCycles;