neo geo: ADPCM!!

This commit is contained in:
tildearrow 2021-12-10 22:51:50 -05:00
parent a95ee7b7ba
commit fbd94bbce9
3 changed files with 11 additions and 4 deletions

View file

@ -869,6 +869,8 @@ void DivEngine::renderSamples() {
s->rendLength=(double)s->length/samplePitches[s->pitch];
s->rendData=new short[s->rendLength];
size_t adpcmLen=((s->rendLength>>1)+255)&0xffffff00;
s->adpcmRendLength=adpcmLen;
printf("al: %x\n",s->adpcmRendLength);
s->adpcmRendData=new unsigned char[adpcmLen];
memset(s->adpcmRendData,0,adpcmLen);

View file

@ -187,10 +187,10 @@ int DivPlatformYM2610::dispatch(DivCommand c) {
}
writes.emplace(0x110+c.chan-7,0);
writes.emplace(0x118+c.chan-7,c.value%12);
int sampleLen=(parent->song.sample[12*sampleBank+c.value%12]->rendLength+255)>>8;
int sampleLen=(parent->song.sample[12*sampleBank+c.value%12]->adpcmRendLength-1)>>8;
writes.emplace(0x120+c.chan-7,sampleLen&0xff);
writes.emplace(0x128+c.chan-7,(c.value%12)+(sampleLen>>8));
writes.emplace(0x108+c.chan-7,0xff);
writes.emplace(0x108+(c.chan-7),0xc0|chan[c.chan].vol);
writes.emplace(0x100,0x00|(1<<(c.chan-7)));
break;
}
@ -251,7 +251,11 @@ int DivPlatformYM2610::dispatch(DivCommand c) {
case DIV_CMD_VOLUME: {
chan[c.chan].vol=c.value;
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
if (c.chan>3) {
if (c.chan>6) { // ADPCM
writes.emplace(0x108+(c.chan-7),0xc0|chan[c.chan].vol);
break;
}
if (c.chan>3) { // PSG
if (!chan[c.chan].std.hasVol) {
chan[c.chan].outVol=c.value;
}

View file

@ -4,7 +4,7 @@ struct DivSample {
signed char vol, pitch;
unsigned char depth;
short* data;
int rendLength;
int rendLength, adpcmRendLength;
short* rendData;
unsigned char* adpcmRendData;
@ -17,6 +17,7 @@ struct DivSample {
depth(16),
data(NULL),
rendLength(0),
adpcmRendLength(0),
rendData(NULL),
adpcmRendData(NULL) {}
};