K007232: oscBuf was too fast

This commit is contained in:
tildearrow 2023-08-25 04:18:22 -05:00
parent 91c3c04082
commit 55d7a5e9bc
2 changed files with 13 additions and 6 deletions

View File

@ -78,15 +78,21 @@ void DivPlatformK007232::acquire(short** buf, size_t len) {
const signed int rout[2]={(k007232.output(0)*((vol1>>4)&0xf)),(k007232.output(1)*((vol2>>4)&0xf))};
buf[0][h]=(lout[0]+lout[1])<<4;
buf[1][h]=(rout[0]+rout[1])<<4;
for (int i=0; i<2; i++) {
oscBuf[i]->data[oscBuf[i]->needle++]=(lout[i]+rout[i])<<3;
if (++oscDivider>=8) {
oscDivider=0;
for (int i=0; i<2; i++) {
oscBuf[i]->data[oscBuf[i]->needle++]=(lout[i]+rout[i])<<3;
}
}
} else {
const unsigned char vol=regPool[0xc];
const signed int out[2]={(k007232.output(0)*(vol&0xf)),(k007232.output(1)*((vol>>4)&0xf))};
buf[0][h]=(out[0]+out[1])<<4;
for (int i=0; i<2; i++) {
oscBuf[i]->data[oscBuf[i]->needle++]=out[i]<<4;
if (++oscDivider>=8) {
oscDivider=0;
for (int i=0; i<2; i++) {
oscBuf[i]->data[oscBuf[i]->needle++]=out[i]<<4;
}
}
}
}
@ -484,7 +490,7 @@ void DivPlatformK007232::setFlags(const DivConfig& flags) {
stereo=flags.getBool("stereo",false);
for (int i=0; i<2; i++) {
chan[i].volumeChanged=true;
oscBuf[i]->rate=rate;
oscBuf[i]->rate=rate/8;
}
}
@ -575,6 +581,7 @@ int DivPlatformK007232::init(DivEngine* p, int channels, int sugRate, const DivC
}
sampleMem=new unsigned char[getSampleMemCapacity()];
sampleMemLen=0;
oscDivider=0;
setFlags(flags);
reset();

View File

@ -68,7 +68,7 @@ class DivPlatformK007232: public DivDispatch, public k007232_intf {
bool sampleLoaded[256];
int delay;
unsigned char lastLoop, lastVolume;
unsigned char lastLoop, lastVolume, oscDivider;
bool stereo;
unsigned char* sampleMem;