YM2612: implement 9xxx, part 1
does not work on VGM export yet
This commit is contained in:
parent
0b2de3b933
commit
0c5e58fa3e
|
@ -288,6 +288,9 @@ struct DivRegWrite {
|
||||||
* - x is the instance ID
|
* - x is the instance ID
|
||||||
* - 0xffffxx04: switch sample bank
|
* - 0xffffxx04: switch sample bank
|
||||||
* - for use in VGM export
|
* - for use in VGM export
|
||||||
|
* - 0xffffxx05: set sample position
|
||||||
|
* - xx is the instance ID
|
||||||
|
* - data is the sample position
|
||||||
* - 0xffffffff: reset
|
* - 0xffffffff: reset
|
||||||
*/
|
*/
|
||||||
unsigned int addr;
|
unsigned int addr;
|
||||||
|
|
|
@ -63,7 +63,7 @@ void DivPlatformGenesis::processDAC(int iRate) {
|
||||||
for (int i=5; i<7; i++) {
|
for (int i=5; i<7; i++) {
|
||||||
if (chan[i].dacSample!=-1) {
|
if (chan[i].dacSample!=-1) {
|
||||||
DivSample* s=parent->getSample(chan[i].dacSample);
|
DivSample* s=parent->getSample(chan[i].dacSample);
|
||||||
if (!isMuted[i] && s->samples>0) {
|
if (!isMuted[i] && s->samples>0 && chan[i].dacPos<s->samples) {
|
||||||
if (parent->song.noOPN2Vol) {
|
if (parent->song.noOPN2Vol) {
|
||||||
chan[i].dacOutput=s->data8[chan[i].dacDirection?(s->samples-chan[i].dacPos-1):chan[i].dacPos];
|
chan[i].dacOutput=s->data8[chan[i].dacDirection?(s->samples-chan[i].dacPos-1):chan[i].dacPos];
|
||||||
} else {
|
} else {
|
||||||
|
@ -110,7 +110,7 @@ void DivPlatformGenesis::processDAC(int iRate) {
|
||||||
chan[5].dacPeriod+=chan[5].dacRate;
|
chan[5].dacPeriod+=chan[5].dacRate;
|
||||||
if (chan[5].dacPeriod>=iRate) {
|
if (chan[5].dacPeriod>=iRate) {
|
||||||
DivSample* s=parent->getSample(chan[5].dacSample);
|
DivSample* s=parent->getSample(chan[5].dacSample);
|
||||||
if (s->samples>0) {
|
if (s->samples>0 && chan[5].dacPos<s->samples) {
|
||||||
if (!isMuted[5]) {
|
if (!isMuted[5]) {
|
||||||
if (chan[5].dacReady && writes.size()<16) {
|
if (chan[5].dacReady && writes.size()<16) {
|
||||||
int sample;
|
int sample;
|
||||||
|
@ -701,7 +701,11 @@ int DivPlatformGenesis::dispatch(DivCommand c) {
|
||||||
addWrite(0xffff0003,chan[c.chan].dacDirection);
|
addWrite(0xffff0003,chan[c.chan].dacDirection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
chan[c.chan].dacPos=0;
|
if (chan[c.chan].setPos) {
|
||||||
|
chan[c.chan].setPos=false;
|
||||||
|
} else {
|
||||||
|
chan[c.chan].dacPos=0;
|
||||||
|
}
|
||||||
chan[c.chan].dacPeriod=0;
|
chan[c.chan].dacPeriod=0;
|
||||||
if (c.value!=DIV_NOTE_NULL) {
|
if (c.value!=DIV_NOTE_NULL) {
|
||||||
chan[c.chan].baseFreq=parent->calcBaseFreq(1,1,c.value,false);
|
chan[c.chan].baseFreq=parent->calcBaseFreq(1,1,c.value,false);
|
||||||
|
@ -924,6 +928,11 @@ int DivPlatformGenesis::dispatch(DivCommand c) {
|
||||||
if (dumpWrites) addWrite(0xffff0003,chan[c.chan].dacDirection);
|
if (dumpWrites) addWrite(0xffff0003,chan[c.chan].dacDirection);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case DIV_CMD_SAMPLE_POS:
|
||||||
|
if (c.chan<5) c.chan=5;
|
||||||
|
chan[c.chan].dacPos=c.value;
|
||||||
|
chan[c.chan].setPos=true;
|
||||||
|
break;
|
||||||
case DIV_CMD_LEGATO: {
|
case DIV_CMD_LEGATO: {
|
||||||
if (c.chan==csmChan) {
|
if (c.chan==csmChan) {
|
||||||
chan[c.chan].baseFreq=NOTE_PERIODIC(c.value);
|
chan[c.chan].baseFreq=NOTE_PERIODIC(c.value);
|
||||||
|
|
|
@ -57,6 +57,7 @@ class DivPlatformGenesis: public DivPlatformOPN {
|
||||||
int dacDelay;
|
int dacDelay;
|
||||||
bool dacReady;
|
bool dacReady;
|
||||||
bool dacDirection;
|
bool dacDirection;
|
||||||
|
bool setPos;
|
||||||
unsigned char sampleBank;
|
unsigned char sampleBank;
|
||||||
signed char dacOutput;
|
signed char dacOutput;
|
||||||
Channel():
|
Channel():
|
||||||
|
@ -70,6 +71,7 @@ class DivPlatformGenesis: public DivPlatformOPN {
|
||||||
dacDelay(0),
|
dacDelay(0),
|
||||||
dacReady(true),
|
dacReady(true),
|
||||||
dacDirection(false),
|
dacDirection(false),
|
||||||
|
setPos(false),
|
||||||
sampleBank(0),
|
sampleBank(0),
|
||||||
dacOutput(0) {}
|
dacOutput(0) {}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue