Prepare to support YM2610B and with Extended channel 3 mode

Allow 8 bit volume for YM2610 ADPCM-B
Remove sample mode macro in YM2610, it's always enabled and seperated channels.

TODO: ADPCM-B is still not implemented, FM Channel 2 is silenced in extended channel 3 configuration
This commit is contained in:
cam900 2022-02-25 01:02:35 +09:00
parent 1e98f0c4a1
commit 1e2d5694b9
18 changed files with 1592 additions and 22 deletions

View file

@ -506,6 +506,28 @@ void DivEngine::renderSamples() {
memPos+=length+16;
}
qsoundMemLen=memPos+256;
// step 5: allocate ADPCM-B samples
if (adpcmBMem==NULL) adpcmBMem=new unsigned char[16777216];
memPos=0;
for (int i=0; i<song.sampleLen; i++) {
DivSample* s=song.sample[i];
if (memPos>=16777216) {
logW("out of ADPCM-B memory for sample %d!\n",i);
break;
}
if (memPos+s->adpcmBRendLength>=16777216) {
memcpy(adpcmBMem+memPos,s->adpcmBRendData,16777216-memPos);
logW("out of ADPCM-B memory for sample %d!\n",i);
} else {
memcpy(adpcmBMem+memPos,s->adpcmBRendData,s->adpcmBRendLength);
}
s->rendOff=memPos;
memPos+=s->adpcmBRendLength;
}
adpcmBMemLen=memPos+256;
*/
}
@ -905,7 +927,9 @@ int DivEngine::getEffectiveSampleRate(int rate) {
return 1789773/(1789773/rate);
case DIV_SYSTEM_SEGAPCM: case DIV_SYSTEM_SEGAPCM_COMPAT:
return (31250*MIN(255,(rate*255/31250)))/255;
case DIV_SYSTEM_YM2610: case DIV_SYSTEM_YM2610_EXT: case DIV_SYSTEM_YM2610_FULL: case DIV_SYSTEM_YM2610_FULL_EXT:
case DIV_SYSTEM_QSOUND:
return (24038*MIN(65535,(rate*4096/24038)))/4096;
case DIV_SYSTEM_YM2610: case DIV_SYSTEM_YM2610_EXT: case DIV_SYSTEM_YM2610_FULL: case DIV_SYSTEM_YM2610_FULL_EXT: case DIV_SYSTEM_YM2610B: case DIV_SYSTEM_YM2610B_EXT:
return 18518;
default:
break;