Pitch correction (again), Fix compatibility issue

This commit is contained in:
cam900 2022-06-18 10:38:48 +09:00
parent 66f3f0e678
commit 6dc81c7af1
2 changed files with 17 additions and 11 deletions

View file

@ -120,7 +120,7 @@ void DivPlatformSMS::acquire(short* bufL, short* bufR, size_t start, size_t len)
void DivPlatformSMS::tick(bool sysTick) { void DivPlatformSMS::tick(bool sysTick) {
for (int i=0; i<4; i++) { for (int i=0; i<4; i++) {
int CHIP_DIVIDER=toneDivider; double CHIP_DIVIDER=toneDivider;
if (i==3) CHIP_DIVIDER=noiseDivider; if (i==3) CHIP_DIVIDER=noiseDivider;
chan[i].std.next(); chan[i].std.next();
if (chan[i].std.vol.had) { if (chan[i].std.vol.had) {
@ -245,7 +245,7 @@ void DivPlatformSMS::tick(bool sysTick) {
} }
int DivPlatformSMS::dispatch(DivCommand c) { int DivPlatformSMS::dispatch(DivCommand c) {
int CHIP_DIVIDER=toneDivider; double CHIP_DIVIDER=toneDivider;
if (c.chan==3) CHIP_DIVIDER=noiseDivider; if (c.chan==3) CHIP_DIVIDER=noiseDivider;
switch (c.cmd) { switch (c.cmd) {
case DIV_CMD_NOTE_ON: case DIV_CMD_NOTE_ON:
@ -465,8 +465,8 @@ void DivPlatformSMS::setFlags(unsigned int flags) {
} }
resetPhase=!(flags&16); resetPhase=!(flags&16);
divider=16; divider=16;
toneDivider=64; toneDivider=64.0;
noiseDivider=64; noiseDivider=64.0;
if (sn!=NULL) delete sn; if (sn!=NULL) delete sn;
switch (flags&0xcc) { switch (flags&0xcc) {
default: // Sega default: // Sega
@ -479,11 +479,13 @@ void DivPlatformSMS::setFlags(unsigned int flags) {
sn=new sn76489_device(); sn=new sn76489_device();
isRealSN=true; isRealSN=true;
stereo=false; stereo=false;
noiseDivider=60.0; // 64 for match to tone frequency on non-Sega PSG but compatibility
break; break;
case 0x08: // TI+Atari case 0x08: // TI+Atari
sn=new sn76496_base_device(0x4000, 0x0f35, 0x01, 0x02, true, false, 8, false, true); sn=new sn76496_base_device(0x4000, 0x0f35, 0x01, 0x02, true, false, 1/*8*/, false, true);
isRealSN=true; isRealSN=true;
stereo=false; stereo=false;
noiseDivider=60.0;
break; break;
case 0x0c: // Game Gear (not fully emulated yet!) case 0x0c: // Game Gear (not fully emulated yet!)
sn=new gamegear_device(); sn=new gamegear_device();
@ -494,37 +496,41 @@ void DivPlatformSMS::setFlags(unsigned int flags) {
sn=new sn76489a_device(); sn=new sn76489a_device();
isRealSN=false; // TODO isRealSN=false; // TODO
stereo=false; stereo=false;
noiseDivider=60.0;
break; break;
case 0x44: // TI SN76496 case 0x44: // TI SN76496
sn=new sn76496_device(); sn=new sn76496_device();
isRealSN=false; // TODO isRealSN=false; // TODO
stereo=false; stereo=false;
noiseDivider=60.0;
break; break;
case 0x48: // NCR 8496 case 0x48: // NCR 8496
sn=new ncr8496_device(); sn=new ncr8496_device();
isRealSN=false; isRealSN=false;
stereo=false; stereo=false;
noiseDivider=60.0;
break; break;
case 0x4c: // Tandy PSSJ 3-voice sound case 0x4c: // Tandy PSSJ 3-voice sound
sn=new pssj3_device(); sn=new pssj3_device();
isRealSN=false; isRealSN=false;
stereo=false; stereo=false;
noiseDivider=60.0;
break; break;
case 0x80: // TI SN94624 case 0x80: // TI SN94624
sn=new sn94624_device(); sn=new sn94624_device();
isRealSN=true; isRealSN=true;
stereo=false; stereo=false;
divider=2; divider=2;
toneDivider=8; toneDivider=8.0;
noiseDivider=8; noiseDivider=7.5;
break; break;
case 0x84: // TI SN76494 case 0x84: // TI SN76494
sn=new sn76494_device(); sn=new sn76494_device();
isRealSN=false; // TODO isRealSN=false; // TODO
stereo=false; stereo=false;
divider=2; divider=2;
toneDivider=8; toneDivider=8.0;
noiseDivider=8; noiseDivider=7.5;
break; break;
} }
rate=chipClock/divider; rate=chipClock/divider;

View file

@ -62,8 +62,8 @@ class DivPlatformSMS: public DivDispatch {
unsigned char oldValue; unsigned char oldValue;
unsigned char snNoiseMode; unsigned char snNoiseMode;
int divider=16; int divider=16;
int toneDivider=64; double toneDivider=64.0;
int noiseDivider=64; double noiseDivider=64.0;
bool updateSNMode; bool updateSNMode;
bool resetPhase; bool resetPhase;
bool isRealSN; bool isRealSN;