SAA1099: remove MAME core

closes #529

the MAME core is inaccurate.
it doesn't emulate envelope too well.
This commit is contained in:
tildearrow 2022-06-06 15:05:08 -05:00
parent ed9cd1ebe0
commit 6dc408d99c
5 changed files with 7 additions and 91 deletions

View File

@ -312,10 +312,7 @@ void DivDispatchContainer::init(DivSystem sys, DivEngine* eng, int chanCount, do
dispatch=new DivPlatformTX81Z;
break;
case DIV_SYSTEM_SAA1099: {
int saaCore=eng->getConfInt("saaCore",1);
if (saaCore<0 || saaCore>2) saaCore=0;
dispatch=new DivPlatformSAA1099;
((DivPlatformSAA1099*)dispatch)->setCore((DivSAACores)saaCore);
break;
}
case DIV_SYSTEM_PCSPKR:

View File

@ -71,28 +71,6 @@ const char* DivPlatformSAA1099::getEffectName(unsigned char effect) {
return NULL;
}
void DivPlatformSAA1099::acquire_mame(short* bufL, short* bufR, size_t start, size_t len) {
if (saaBufLen<len) {
saaBufLen=len;
for (int i=0; i<2; i++) {
delete[] saaBuf[i];
saaBuf[i]=new short[saaBufLen];
}
}
while (!writes.empty()) {
QueuedWrite w=writes.front();
saa.control_w(w.addr);
saa.data_w(w.val);
regPool[w.addr&0x1f]=w.val;
writes.pop();
}
saa.sound_stream_update(saaBuf,len,oscBuf);
for (size_t i=0; i<len; i++) {
bufL[i+start]=saaBuf[0][i];
bufR[i+start]=saaBuf[1][i];
}
}
void DivPlatformSAA1099::acquire_saaSound(short* bufL, short* bufR, size_t start, size_t len) {
if (saaBufLen<len*2) {
saaBufLen=len*2;
@ -115,17 +93,7 @@ void DivPlatformSAA1099::acquire_saaSound(short* bufL, short* bufR, size_t start
}
void DivPlatformSAA1099::acquire(short* bufL, short* bufR, size_t start, size_t len) {
switch (core) {
case DIV_SAA_CORE_MAME:
acquire_mame(bufL,bufR,start,len);
break;
case DIV_SAA_CORE_SAASOUND:
acquire_saaSound(bufL,bufR,start,len);
break;
case DIV_SAA_CORE_E:
//acquire_e(bufL,bufR,start,len);
break;
}
acquire_saaSound(bufL,bufR,start,len);
}
inline unsigned char applyPan(unsigned char vol, unsigned char pan) {
@ -420,16 +388,7 @@ int DivPlatformSAA1099::getRegisterPoolSize() {
void DivPlatformSAA1099::reset() {
while (!writes.empty()) writes.pop();
memset(regPool,0,32);
switch (core) {
case DIV_SAA_CORE_MAME:
saa=saa1099_device();
break;
case DIV_SAA_CORE_SAASOUND:
saa_saaSound->Clear();
break;
case DIV_SAA_CORE_E:
break;
}
saa_saaSound->Clear();
for (int i=0; i<6; i++) {
chan[i]=DivPlatformSAA1099::Channel();
chan[i].std.setEngine(parent);
@ -500,16 +459,8 @@ void DivPlatformSAA1099::setFlags(unsigned int flags) {
oscBuf[i]->rate=rate;
}
switch (core) {
case DIV_SAA_CORE_MAME:
break;
case DIV_SAA_CORE_SAASOUND:
saa_saaSound->SetClockRate(chipClock);
saa_saaSound->SetSampleRate(rate);
break;
case DIV_SAA_CORE_E:
break;
}
saa_saaSound->SetClockRate(chipClock);
saa_saaSound->SetSampleRate(rate);
}
void DivPlatformSAA1099::poke(unsigned int addr, unsigned short val) {
@ -520,10 +471,6 @@ void DivPlatformSAA1099::poke(std::vector<DivRegWrite>& wlist) {
for (DivRegWrite& i: wlist) rWrite(i.addr,i.val);
}
void DivPlatformSAA1099::setCore(DivSAACores c) {
core=c;
}
int DivPlatformSAA1099::init(DivEngine* p, int channels, int sugRate, unsigned int flags) {
parent=p;
dumpWrites=false;
@ -533,11 +480,9 @@ int DivPlatformSAA1099::init(DivEngine* p, int channels, int sugRate, unsigned i
isMuted[i]=false;
oscBuf[i]=new DivDispatchOscBuffer;
}
if (core==DIV_SAA_CORE_SAASOUND) {
saa_saaSound=CreateCSAASound();
saa_saaSound->SetOversample(1);
saa_saaSound->SetSoundParameters(SAAP_NOFILTER|SAAP_16BIT|SAAP_STEREO);
}
saa_saaSound=CreateCSAASound();
saa_saaSound->SetOversample(1);
saa_saaSound->SetSoundParameters(SAAP_NOFILTER|SAAP_16BIT|SAAP_STEREO);
setFlags(flags);
saaBufLen=65536;
for (int i=0; i<2; i++) saaBuf[i]=new short[saaBufLen];

View File

@ -22,15 +22,8 @@
#include "../dispatch.h"
#include "../macroInt.h"
#include <queue>
#include "sound/saa1099.h"
#include "../../../extern/SAASound/src/SAASound.h"
enum DivSAACores {
DIV_SAA_CORE_MAME=0,
DIV_SAA_CORE_SAASOUND,
DIV_SAA_CORE_E
};
class DivPlatformSAA1099: public DivDispatch {
protected:
struct Channel {
@ -58,8 +51,6 @@ class DivPlatformSAA1099: public DivDispatch {
QueuedWrite(unsigned short a, unsigned char v): addr(a), val(v), addrOrVal(false) {}
};
std::queue<QueuedWrite> writes;
DivSAACores core;
saa1099_device saa;
CSAASound* saa_saaSound;
unsigned char regPool[32];
unsigned char lastBusy;
@ -83,9 +74,7 @@ class DivPlatformSAA1099: public DivDispatch {
unsigned char saaNoise[2];
friend void putDispatchChan(void*,int,int);
void acquire_e(short* bufL, short* bufR, size_t start, size_t len);
void acquire_saaSound(short* bufL, short* bufR, size_t start, size_t len);
void acquire_mame(short* bufL, short* bufR, size_t start, size_t len);
public:
void acquire(short* bufL, short* bufR, size_t start, size_t len);
@ -99,7 +88,6 @@ class DivPlatformSAA1099: public DivDispatch {
void forceIns();
void tick(bool sysTick=true);
void muteChannel(int ch, bool mute);
void setCore(DivSAACores core);
void setFlags(unsigned int flags);
bool isStereo();
int getPortaFloor(int ch);

View File

@ -873,7 +873,6 @@ class FurnaceGUI {
int arcadeCore;
int ym2612Core;
int snCore;
int saaCore;
int nesCore;
int fdsCore;
int pcSpeakerOutMethod;
@ -974,7 +973,6 @@ class FurnaceGUI {
arcadeCore(0),
ym2612Core(0),
snCore(0),
saaCore(1),
nesCore(0),
fdsCore(0),
pcSpeakerOutMethod(0),

View File

@ -84,11 +84,6 @@ const char* snCores[]={
"Nuked-PSG Mod"
};
const char* saaCores[]={
"MAME",
"SAASound"
};
const char* nesCores[]={
"puNES",
"NSFplay"
@ -899,10 +894,6 @@ void FurnaceGUI::drawSettings() {
ImGui::SameLine();
ImGui::Combo("##SNCore",&settings.snCore,snCores,2);
ImGui::Text("SAA1099 core");
ImGui::SameLine();
ImGui::Combo("##SAACore",&settings.saaCore,saaCores,2);
ImGui::Text("NES core");
ImGui::SameLine();
ImGui::Combo("##NESCore",&settings.nesCore,nesCores,2);
@ -1954,7 +1945,6 @@ void FurnaceGUI::syncSettings() {
settings.arcadeCore=e->getConfInt("arcadeCore",0);
settings.ym2612Core=e->getConfInt("ym2612Core",0);
settings.snCore=e->getConfInt("snCore",0);
settings.saaCore=e->getConfInt("saaCore",1);
settings.nesCore=e->getConfInt("nesCore",0);
settings.fdsCore=e->getConfInt("fdsCore",0);
settings.pcSpeakerOutMethod=e->getConfInt("pcSpeakerOutMethod",0);
@ -2048,7 +2038,6 @@ void FurnaceGUI::syncSettings() {
clampSetting(settings.arcadeCore,0,1);
clampSetting(settings.ym2612Core,0,1);
clampSetting(settings.snCore,0,1);
clampSetting(settings.saaCore,0,1);
clampSetting(settings.nesCore,0,1);
clampSetting(settings.fdsCore,0,1);
clampSetting(settings.pcSpeakerOutMethod,0,4);
@ -2171,7 +2160,6 @@ void FurnaceGUI::commitSettings() {
e->setConf("arcadeCore",settings.arcadeCore);
e->setConf("ym2612Core",settings.ym2612Core);
e->setConf("snCore",settings.snCore);
e->setConf("saaCore",settings.saaCore);
e->setConf("nesCore",settings.nesCore);
e->setConf("fdsCore",settings.fdsCore);
e->setConf("pcSpeakerOutMethod",settings.pcSpeakerOutMethod);