OPN: VGM export - good night

This commit is contained in:
tildearrow 2022-05-11 03:41:02 -05:00
parent ab969c1da0
commit ff0319780e
7 changed files with 1627 additions and 22 deletions

View file

@ -27,8 +27,8 @@
#include "fmshared_OPN.h"
static unsigned char konOffs[6]={
0, 1, 2, 4, 5, 6
static unsigned char konOffs[3]={
0, 1, 2
};
#define CHIP_DIVIDER 32
@ -287,11 +287,6 @@ const char* DivPlatformYM2203::getEffectName(unsigned char effect) {
return NULL;
}
double DivPlatformYM2203::NOTE_OPN(int ch, int note) {
// FM
return NOTE_FNUM_BLOCK(note,11);
}
void DivPlatformYM2203::acquire(short* bufL, short* bufR, size_t start, size_t len) {
static int os;
@ -314,9 +309,9 @@ void DivPlatformYM2203::acquire(short* bufL, short* bufR, size_t start, size_t l
if (!writes.empty()) {
if (--delay<1) {
QueuedWrite& w=writes.front();
fm->write(0x0+((w.addr>>8)<<1),w.addr);
fm->write(0x1+((w.addr>>8)<<1),w.val);
regPool[w.addr&0x1ff]=w.val;
fm->write(0x0,w.addr);
fm->write(0x1,w.val);
regPool[w.addr&0xff]=w.val;
writes.pop();
delay=16;
}
@ -520,7 +515,7 @@ void DivPlatformYM2203::tick(bool sysTick) {
}
}
for (int i=16; i<512; i++) {
for (int i=16; i<256; i++) {
if (pendingWrites[i]!=oldWrites[i]) {
immWrite(i,pendingWrites[i]&0xff);
oldWrites[i]=pendingWrites[i];
@ -670,7 +665,7 @@ int DivPlatformYM2203::dispatch(DivCommand c) {
}
case DIV_CMD_NOTE_PORTA: {
if (c.chan>2 || parent->song.linearPitch==2) { // PSG
int destFreq=NOTE_OPN(c.chan,c.value2);
int destFreq=NOTE_FNUM_BLOCK(c.value2,11);
bool return2=false;
if (destFreq>chan[c.chan].baseFreq) {
chan[c.chan].baseFreq+=c.value;
@ -737,7 +732,7 @@ int DivPlatformYM2203::dispatch(DivCommand c) {
break;
}
case DIV_CMD_LEGATO: {
chan[c.chan].baseFreq=NOTE_OPN(c.chan,c.value);
chan[c.chan].baseFreq=NOTE_FNUM_BLOCK(c.value,11);
chan[c.chan].freqChanged=true;
break;
}
@ -1002,7 +997,7 @@ unsigned char* DivPlatformYM2203::getRegisterPool() {
}
int DivPlatformYM2203::getRegisterPoolSize() {
return 512;
return 256;
}
void DivPlatformYM2203::poke(unsigned int addr, unsigned short val) {
@ -1015,7 +1010,7 @@ void DivPlatformYM2203::poke(std::vector<DivRegWrite>& wlist) {
void DivPlatformYM2203::reset() {
while (!writes.empty()) writes.pop();
memset(regPool,0,512);
memset(regPool,0,256);
if (dumpWrites) {
addWrite(0xffffffff,0);
}
@ -1032,7 +1027,7 @@ void DivPlatformYM2203::reset() {
chan[i].vol=0x0f;
}
for (int i=0; i<512; i++) {
for (int i=0; i<256; i++) {
oldWrites[i]=-1;
pendingWrites[i]=-1;
}