mirror of
https://github.com/tildearrow/furnace.git
synced 2024-12-29 19:11:23 +00:00
C64: bind reSIDfp
This commit is contained in:
parent
32050a211f
commit
8d280fd9a3
3 changed files with 56 additions and 13 deletions
|
@ -218,10 +218,12 @@ void DivDispatchContainer::init(DivSystem sys, DivEngine* eng, int chanCount, do
|
||||||
break;
|
break;
|
||||||
case DIV_SYSTEM_C64_6581:
|
case DIV_SYSTEM_C64_6581:
|
||||||
dispatch=new DivPlatformC64;
|
dispatch=new DivPlatformC64;
|
||||||
|
((DivPlatformC64*)dispatch)->setFP(eng->getConfInt("c64Core",1)==1);
|
||||||
((DivPlatformC64*)dispatch)->setChipModel(true);
|
((DivPlatformC64*)dispatch)->setChipModel(true);
|
||||||
break;
|
break;
|
||||||
case DIV_SYSTEM_C64_8580:
|
case DIV_SYSTEM_C64_8580:
|
||||||
dispatch=new DivPlatformC64;
|
dispatch=new DivPlatformC64;
|
||||||
|
((DivPlatformC64*)dispatch)->setFP(eng->getConfInt("c64Core",1)==1);
|
||||||
((DivPlatformC64*)dispatch)->setChipModel(false);
|
((DivPlatformC64*)dispatch)->setChipModel(false);
|
||||||
break;
|
break;
|
||||||
case DIV_SYSTEM_YM2151:
|
case DIV_SYSTEM_YM2151:
|
||||||
|
|
|
@ -19,9 +19,10 @@
|
||||||
|
|
||||||
#include "c64.h"
|
#include "c64.h"
|
||||||
#include "../engine.h"
|
#include "../engine.h"
|
||||||
|
#include "sound/c64_fp/siddefs-fp.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#define rWrite(a,v) if (!skipRegisterWrites) {sid.write(a,v); regPool[(a)&0x1f]=v; if (dumpWrites) {addWrite(a,v);} }
|
#define rWrite(a,v) if (!skipRegisterWrites) {if (isFP) {sid_fp.write(a,v);} else {sid.write(a,v);}; regPool[(a)&0x1f]=v; if (dumpWrites) {addWrite(a,v);} }
|
||||||
|
|
||||||
#define CHIP_FREQBASE 524288
|
#define CHIP_FREQBASE 524288
|
||||||
|
|
||||||
|
@ -63,15 +64,19 @@ const char** DivPlatformC64::getRegisterSheet() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformC64::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformC64::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
||||||
int dcOff=sid.get_dc(0);
|
int dcOff=isFP?0:sid.get_dc(0);
|
||||||
for (size_t i=start; i<start+len; i++) {
|
for (size_t i=start; i<start+len; i++) {
|
||||||
sid.clock();
|
if (isFP) {
|
||||||
bufL[i]=sid.output();
|
sid_fp.clock(4,&bufL[i]);
|
||||||
if (++writeOscBuf>=8) {
|
} else {
|
||||||
writeOscBuf=0;
|
sid.clock();
|
||||||
oscBuf[0]->data[oscBuf[0]->needle++]=(sid.last_chan_out[0]-dcOff)>>5;
|
bufL[i]=sid.output();
|
||||||
oscBuf[1]->data[oscBuf[1]->needle++]=(sid.last_chan_out[1]-dcOff)>>5;
|
if (++writeOscBuf>=8) {
|
||||||
oscBuf[2]->data[oscBuf[2]->needle++]=(sid.last_chan_out[2]-dcOff)>>5;
|
writeOscBuf=0;
|
||||||
|
oscBuf[0]->data[oscBuf[0]->needle++]=(sid.last_chan_out[0]-dcOff)>>5;
|
||||||
|
oscBuf[1]->data[oscBuf[1]->needle++]=(sid.last_chan_out[1]-dcOff)>>5;
|
||||||
|
oscBuf[2]->data[oscBuf[2]->needle++]=(sid.last_chan_out[2]-dcOff)>>5;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -405,7 +410,11 @@ int DivPlatformC64::dispatch(DivCommand c) {
|
||||||
|
|
||||||
void DivPlatformC64::muteChannel(int ch, bool mute) {
|
void DivPlatformC64::muteChannel(int ch, bool mute) {
|
||||||
isMuted[ch]=mute;
|
isMuted[ch]=mute;
|
||||||
sid.set_is_muted(ch,mute);
|
if (isFP) {
|
||||||
|
sid_fp.mute(ch,mute);
|
||||||
|
} else {
|
||||||
|
sid.set_is_muted(ch,mute);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformC64::forceIns() {
|
void DivPlatformC64::forceIns() {
|
||||||
|
@ -462,13 +471,21 @@ bool DivPlatformC64::getWantPreNote() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float DivPlatformC64::getPostAmp() {
|
||||||
|
return isFP?3.0f:1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
void DivPlatformC64::reset() {
|
void DivPlatformC64::reset() {
|
||||||
for (int i=0; i<3; i++) {
|
for (int i=0; i<3; i++) {
|
||||||
chan[i]=DivPlatformC64::Channel();
|
chan[i]=DivPlatformC64::Channel();
|
||||||
chan[i].std.setEngine(parent);
|
chan[i].std.setEngine(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
sid.reset();
|
if (isFP) {
|
||||||
|
sid_fp.reset();
|
||||||
|
} else {
|
||||||
|
sid.reset();
|
||||||
|
}
|
||||||
memset(regPool,0,32);
|
memset(regPool,0,32);
|
||||||
|
|
||||||
rWrite(0x18,0x0f);
|
rWrite(0x18,0x0f);
|
||||||
|
@ -490,12 +507,24 @@ void DivPlatformC64::poke(std::vector<DivRegWrite>& wlist) {
|
||||||
|
|
||||||
void DivPlatformC64::setChipModel(bool is6581) {
|
void DivPlatformC64::setChipModel(bool is6581) {
|
||||||
if (is6581) {
|
if (is6581) {
|
||||||
sid.set_chip_model(MOS6581);
|
if (isFP) {
|
||||||
|
sid_fp.setChipModel(reSIDfp::MOS6581);
|
||||||
|
} else {
|
||||||
|
sid.set_chip_model(MOS6581);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
sid.set_chip_model(MOS8580);
|
if (isFP) {
|
||||||
|
sid_fp.setChipModel(reSIDfp::MOS8580);
|
||||||
|
} else {
|
||||||
|
sid.set_chip_model(MOS8580);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DivPlatformC64::setFP(bool fp) {
|
||||||
|
isFP=fp;
|
||||||
|
}
|
||||||
|
|
||||||
void DivPlatformC64::setFlags(unsigned int flags) {
|
void DivPlatformC64::setFlags(unsigned int flags) {
|
||||||
switch (flags&0xf) {
|
switch (flags&0xf) {
|
||||||
case 0x0: // NTSC C64
|
case 0x0: // NTSC C64
|
||||||
|
@ -513,6 +542,10 @@ void DivPlatformC64::setFlags(unsigned int flags) {
|
||||||
for (int i=0; i<3; i++) {
|
for (int i=0; i<3; i++) {
|
||||||
oscBuf[i]->rate=rate/16;
|
oscBuf[i]->rate=rate/16;
|
||||||
}
|
}
|
||||||
|
if (isFP) {
|
||||||
|
rate/=4;
|
||||||
|
sid_fp.setSamplingParameters(chipClock,reSIDfp::DECIMATE,rate,0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int DivPlatformC64::init(DivEngine* p, int channels, int sugRate, unsigned int flags) {
|
int DivPlatformC64::init(DivEngine* p, int channels, int sugRate, unsigned int flags) {
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "../dispatch.h"
|
#include "../dispatch.h"
|
||||||
#include "../macroInt.h"
|
#include "../macroInt.h"
|
||||||
#include "sound/c64/sid.h"
|
#include "sound/c64/sid.h"
|
||||||
|
#include "sound/c64_fp/SID.h"
|
||||||
|
|
||||||
class DivPlatformC64: public DivDispatch {
|
class DivPlatformC64: public DivDispatch {
|
||||||
struct Channel {
|
struct Channel {
|
||||||
|
@ -76,12 +77,17 @@ class DivPlatformC64: public DivDispatch {
|
||||||
unsigned char filtControl, filtRes, vol;
|
unsigned char filtControl, filtRes, vol;
|
||||||
unsigned char writeOscBuf;
|
unsigned char writeOscBuf;
|
||||||
int filtCut, resetTime;
|
int filtCut, resetTime;
|
||||||
|
bool isFP;
|
||||||
|
|
||||||
SID sid;
|
SID sid;
|
||||||
|
reSIDfp::SID sid_fp;
|
||||||
unsigned char regPool[32];
|
unsigned char regPool[32];
|
||||||
|
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
|
|
||||||
|
void acquire_classic(short* bufL, short* bufR, size_t start, size_t len);
|
||||||
|
void acquire_fp(short* bufL, short* bufR, size_t start, size_t len);
|
||||||
|
|
||||||
void updateFilter();
|
void updateFilter();
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
||||||
|
@ -98,6 +104,7 @@ class DivPlatformC64: public DivDispatch {
|
||||||
void notifyInsChange(int ins);
|
void notifyInsChange(int ins);
|
||||||
bool getDCOffRequired();
|
bool getDCOffRequired();
|
||||||
bool getWantPreNote();
|
bool getWantPreNote();
|
||||||
|
float getPostAmp();
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
void notifyInsDeletion(void* ins);
|
void notifyInsDeletion(void* ins);
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
|
@ -105,6 +112,7 @@ class DivPlatformC64: public DivDispatch {
|
||||||
const char** getRegisterSheet();
|
const char** getRegisterSheet();
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void setChipModel(bool is6581);
|
void setChipModel(bool is6581);
|
||||||
|
void setFP(bool fp);
|
||||||
void quit();
|
void quit();
|
||||||
~DivPlatformC64();
|
~DivPlatformC64();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue