ESFM: add "fast" mode

alters ESFMu to add a fast feedback calculation path
This commit is contained in:
tildearrow 2024-03-11 13:21:50 -05:00
parent 3e645e58f2
commit 0ac63d817d
12 changed files with 63 additions and 6 deletions

View file

@ -649,6 +649,11 @@ void DivDispatchContainer::init(DivSystem sys, DivEngine* eng, int chanCount, do
break;
case DIV_SYSTEM_ESFM:
dispatch=new DivPlatformESFM;
if (isRender) {
((DivPlatformESFM*)dispatch)->setFast(eng->getConfInt("esfmCoreRender",0));
} else {
((DivPlatformESFM*)dispatch)->setFast(eng->getConfInt("esfmCore",0));
}
break;
case DIV_SYSTEM_POWERNOISE:
dispatch=new DivPlatformPowerNoise;

View file

@ -983,7 +983,7 @@ int DivPlatformESFM::getRegisterPoolSize() {
void DivPlatformESFM::reset() {
while (!writes.empty()) writes.pop();
ESFM_init(&chip);
ESFM_init(&chip,isFast?1:0);
// set chip to native mode
ESFM_write_reg(&chip, 0x105, 0x80);
// ensure NTS bit in register 0x408 is reset, for smooth envelope rate scaling
@ -1053,6 +1053,10 @@ void DivPlatformESFM::setFlags(const DivConfig& flags) {
rate=chipClock/288.0;
}
void DivPlatformESFM::setFast(bool fast) {
isFast=fast;
}
int DivPlatformESFM::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p;
dumpWrites=false;

View file

@ -120,6 +120,7 @@ class DivPlatformESFM: public DivDispatch {
};
FixedQueue<QueuedWrite,2048> writes;
esfm_chip chip;
bool isFast;
unsigned char regPool[ESFM_REG_POOL_SIZE];
short oldWrites[ESFM_REG_POOL_SIZE];
@ -201,6 +202,7 @@ class DivPlatformESFM: public DivDispatch {
void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist);
void setFlags(const DivConfig& flags);
void setFast(bool fast);
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit();
~DivPlatformESFM();