add ability to select custom clock rates
This commit is contained in:
parent
d6d6743740
commit
c6604ff581
|
@ -453,18 +453,6 @@ class DivDispatch {
|
||||||
*/
|
*/
|
||||||
virtual bool getWantPreNote();
|
virtual bool getWantPreNote();
|
||||||
|
|
||||||
/**
|
|
||||||
* get minimum chip clock.
|
|
||||||
* @return clock in Hz, or 0 if custom clocks are not supported.
|
|
||||||
*/
|
|
||||||
virtual unsigned int getClockRangeMin();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get maximum chip clock.
|
|
||||||
* @return clock in Hz, or 0 if custom clocks are not supported.
|
|
||||||
*/
|
|
||||||
virtual unsigned int getClockRangeMax();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set the chip flags.
|
* set the chip flags.
|
||||||
* @param flags a DivConfig containing chip flags.
|
* @param flags a DivConfig containing chip flags.
|
||||||
|
@ -591,6 +579,14 @@ class DivDispatch {
|
||||||
virtual ~DivDispatch();
|
virtual ~DivDispatch();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// custom chip clock helper define. put in setFlags, but before rate is set.
|
||||||
|
#define CHECK_CUSTOM_CLOCK \
|
||||||
|
if (flags.getInt("customClock",0)>0) { \
|
||||||
|
chipClock=flags.getInt("customClock",1000000); \
|
||||||
|
if (chipClock>20000000) chipClock=20000000; \
|
||||||
|
if (chipClock<100000) chipClock=100000; \
|
||||||
|
}
|
||||||
|
|
||||||
// pitch calculation:
|
// pitch calculation:
|
||||||
// - a DivDispatch usually contains four variables per channel:
|
// - a DivDispatch usually contains four variables per channel:
|
||||||
// - baseFreq: this changes on new notes, legato, arpeggio and slides.
|
// - baseFreq: this changes on new notes, legato, arpeggio and slides.
|
||||||
|
|
|
@ -97,14 +97,6 @@ bool DivDispatch::getWantPreNote() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int DivDispatch::getClockRangeMin() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int DivDispatch::getClockRangeMax() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DivDispatch::setFlags(const DivConfig& flags) {
|
void DivDispatch::setFlags(const DivConfig& flags) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -826,6 +826,7 @@ void DivPlatformAY8910::setFlags(const DivConfig& flags) {
|
||||||
chipClock=COLOR_NTSC/2.0;
|
chipClock=COLOR_NTSC/2.0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
rate=chipClock/8;
|
rate=chipClock/8;
|
||||||
}
|
}
|
||||||
for (int i=0; i<3; i++) {
|
for (int i=0; i<3; i++) {
|
||||||
|
|
|
@ -804,6 +804,7 @@ void DivPlatformAY8930::setFlags(const DivConfig& flags) {
|
||||||
chipClock=COLOR_NTSC/2.0;
|
chipClock=COLOR_NTSC/2.0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
rate=chipClock/4;
|
rate=chipClock/4;
|
||||||
for (int i=0; i<3; i++) {
|
for (int i=0; i<3; i++) {
|
||||||
oscBuf[i]->rate=rate;
|
oscBuf[i]->rate=rate;
|
||||||
|
|
|
@ -323,6 +323,7 @@ void DivPlatformBubSysWSG::notifyInsDeletion(void* ins) {
|
||||||
|
|
||||||
void DivPlatformBubSysWSG::setFlags(const DivConfig& flags) {
|
void DivPlatformBubSysWSG::setFlags(const DivConfig& flags) {
|
||||||
chipClock=COLOR_NTSC;
|
chipClock=COLOR_NTSC;
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
rate=chipClock;
|
rate=chipClock;
|
||||||
for (int i=0; i<2; i++) {
|
for (int i=0; i<2; i++) {
|
||||||
oscBuf[i]->rate=rate/64;
|
oscBuf[i]->rate=rate/64;
|
||||||
|
|
|
@ -535,17 +535,18 @@ void DivPlatformC64::setFP(bool fp) {
|
||||||
void DivPlatformC64::setFlags(const DivConfig& flags) {
|
void DivPlatformC64::setFlags(const DivConfig& flags) {
|
||||||
switch (flags.getInt("clockSel",0)) {
|
switch (flags.getInt("clockSel",0)) {
|
||||||
case 0x0: // NTSC C64
|
case 0x0: // NTSC C64
|
||||||
rate=COLOR_NTSC*2.0/7.0;
|
chipClock=COLOR_NTSC*2.0/7.0;
|
||||||
break;
|
break;
|
||||||
case 0x1: // PAL C64
|
case 0x1: // PAL C64
|
||||||
rate=COLOR_PAL*2.0/9.0;
|
chipClock=COLOR_PAL*2.0/9.0;
|
||||||
break;
|
break;
|
||||||
case 0x2: // SSI 2001
|
case 0x2: // SSI 2001
|
||||||
default:
|
default:
|
||||||
rate=14318180.0/16.0;
|
chipClock=14318180.0/16.0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
chipClock=rate;
|
CHECK_CUSTOM_CLOCK;
|
||||||
|
rate=chipClock;
|
||||||
for (int i=0; i<3; i++) {
|
for (int i=0; i<3; i++) {
|
||||||
oscBuf[i]->rate=rate/16;
|
oscBuf[i]->rate=rate/16;
|
||||||
}
|
}
|
||||||
|
|
|
@ -454,13 +454,14 @@ void DivPlatformFDS::setNSFPlay(bool use) {
|
||||||
void DivPlatformFDS::setFlags(const DivConfig& flags) {
|
void DivPlatformFDS::setFlags(const DivConfig& flags) {
|
||||||
int clockSel=flags.getInt("clockSel",0);
|
int clockSel=flags.getInt("clockSel",0);
|
||||||
if (clockSel==2) { // Dendy
|
if (clockSel==2) { // Dendy
|
||||||
rate=COLOR_PAL*2.0/5.0;
|
chipClock=COLOR_PAL*2.0/5.0;
|
||||||
} else if (clockSel==1) { // PAL
|
} else if (clockSel==1) { // PAL
|
||||||
rate=COLOR_PAL*3.0/8.0;
|
chipClock=COLOR_PAL*3.0/8.0;
|
||||||
} else { // NTSC
|
} else { // NTSC
|
||||||
rate=COLOR_NTSC/2.0;
|
chipClock=COLOR_NTSC/2.0;
|
||||||
}
|
}
|
||||||
chipClock=rate;
|
CHECK_CUSTOM_CLOCK;
|
||||||
|
rate=chipClock;
|
||||||
oscBuf->rate=rate/32;
|
oscBuf->rate=rate/32;
|
||||||
if (useNP) {
|
if (useNP) {
|
||||||
fds_NP->SetClock(rate);
|
fds_NP->SetClock(rate);
|
||||||
|
|
|
@ -655,6 +655,7 @@ void DivPlatformGB::setFlags(const DivConfig& flags) {
|
||||||
|
|
||||||
int DivPlatformGB::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
|
int DivPlatformGB::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
|
||||||
chipClock=4194304;
|
chipClock=4194304;
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
rate=chipClock/16;
|
rate=chipClock/16;
|
||||||
for (int i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
isMuted[i]=false;
|
isMuted[i]=false;
|
||||||
|
|
|
@ -1221,6 +1221,7 @@ void DivPlatformGenesis::setFlags(const DivConfig& flags) {
|
||||||
ladder=flags.getBool("ladderEffect",false);
|
ladder=flags.getBool("ladderEffect",false);
|
||||||
noExtMacros=flags.getBool("noExtMacros",false);
|
noExtMacros=flags.getBool("noExtMacros",false);
|
||||||
OPN2_SetChipType(ladder?ym3438_mode_ym2612:0);
|
OPN2_SetChipType(ladder?ym3438_mode_ym2612:0);
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
if (useYMFM) {
|
if (useYMFM) {
|
||||||
if (fm_ymfm!=NULL) delete fm_ymfm;
|
if (fm_ymfm!=NULL) delete fm_ymfm;
|
||||||
if (ladder) {
|
if (ladder) {
|
||||||
|
|
|
@ -471,6 +471,7 @@ int DivPlatformLynx::init(DivEngine* p, int channels, int sugRate, const DivConf
|
||||||
}
|
}
|
||||||
|
|
||||||
chipClock = 16000000;
|
chipClock = 16000000;
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
rate = chipClock/128;
|
rate = chipClock/128;
|
||||||
|
|
||||||
for (int i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
|
|
|
@ -389,13 +389,14 @@ bool DivPlatformMMC5::keyOffAffectsArp(int ch) {
|
||||||
void DivPlatformMMC5::setFlags(const DivConfig& flags) {
|
void DivPlatformMMC5::setFlags(const DivConfig& flags) {
|
||||||
int clockSel=flags.getInt("clockSel",0);
|
int clockSel=flags.getInt("clockSel",0);
|
||||||
if (clockSel==2) { // Dendy
|
if (clockSel==2) { // Dendy
|
||||||
rate=COLOR_PAL*2.0/5.0;
|
chipClock=COLOR_PAL*2.0/5.0;
|
||||||
} else if (clockSel==1) { // PAL
|
} else if (clockSel==1) { // PAL
|
||||||
rate=COLOR_PAL*3.0/8.0;
|
chipClock=COLOR_PAL*3.0/8.0;
|
||||||
} else { // NTSC
|
} else { // NTSC
|
||||||
rate=COLOR_NTSC/2.0;
|
chipClock=COLOR_NTSC/2.0;
|
||||||
}
|
}
|
||||||
chipClock=rate;
|
CHECK_CUSTOM_CLOCK;
|
||||||
|
rate=chipClock;
|
||||||
for (int i=0; i<3; i++) {
|
for (int i=0; i<3; i++) {
|
||||||
oscBuf[i]->rate=rate/32;
|
oscBuf[i]->rate=rate/32;
|
||||||
}
|
}
|
||||||
|
|
|
@ -372,6 +372,7 @@ void DivPlatformMSM5232::notifyInsDeletion(void* ins) {
|
||||||
|
|
||||||
void DivPlatformMSM5232::setFlags(const DivConfig& flags) {
|
void DivPlatformMSM5232::setFlags(const DivConfig& flags) {
|
||||||
chipClock=2119040;
|
chipClock=2119040;
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
detune=flags.getInt("detune",0);
|
detune=flags.getInt("detune",0);
|
||||||
msm->set_clock(chipClock+detune*1024);
|
msm->set_clock(chipClock+detune*1024);
|
||||||
rate=msm->get_rate();
|
rate=msm->get_rate();
|
||||||
|
|
|
@ -412,6 +412,7 @@ void DivPlatformMSM6258::setFlags(const DivConfig& flags) {
|
||||||
chipClock=4000000;
|
chipClock=4000000;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
rate=chipClock/256;
|
rate=chipClock/256;
|
||||||
for (int i=0; i<1; i++) {
|
for (int i=0; i<1; i++) {
|
||||||
oscBuf[i]->rate=rate;
|
oscBuf[i]->rate=rate;
|
||||||
|
|
|
@ -438,6 +438,7 @@ void DivPlatformMSM6295::setFlags(const DivConfig& flags) {
|
||||||
chipClock=4000000/4;
|
chipClock=4000000/4;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
rate=chipClock/3;
|
rate=chipClock/3;
|
||||||
for (int i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
oscBuf[i]->rate=rate/22;
|
oscBuf[i]->rate=rate/22;
|
||||||
|
|
|
@ -624,18 +624,19 @@ void DivPlatformN163::poke(std::vector<DivRegWrite>& wlist) {
|
||||||
void DivPlatformN163::setFlags(const DivConfig& flags) {
|
void DivPlatformN163::setFlags(const DivConfig& flags) {
|
||||||
switch (flags.getInt("clockSel",0)) {
|
switch (flags.getInt("clockSel",0)) {
|
||||||
case 1: // PAL
|
case 1: // PAL
|
||||||
rate=COLOR_PAL*3.0/8.0;
|
chipClock=COLOR_PAL*3.0/8.0;
|
||||||
break;
|
break;
|
||||||
case 2: // Dendy
|
case 2: // Dendy
|
||||||
rate=COLOR_PAL*2.0/5.0;
|
chipClock=COLOR_PAL*2.0/5.0;
|
||||||
break;
|
break;
|
||||||
default: // NTSC
|
default: // NTSC
|
||||||
rate=COLOR_NTSC/2.0;
|
chipClock=COLOR_NTSC/2.0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
initChanMax=chanMax=flags.getInt("channels",0)&7;
|
initChanMax=chanMax=flags.getInt("channels",0)&7;
|
||||||
multiplex=!flags.getBool("multiplex",false); // not accurate in real hardware
|
multiplex=!flags.getBool("multiplex",false); // not accurate in real hardware
|
||||||
chipClock=rate;
|
rate=chipClock;
|
||||||
rate/=15;
|
rate/=15;
|
||||||
n163.set_multiplex(multiplex);
|
n163.set_multiplex(multiplex);
|
||||||
rWrite(0x7f,initChanMax<<4);
|
rWrite(0x7f,initChanMax<<4);
|
||||||
|
|
|
@ -532,6 +532,7 @@ void DivPlatformNamcoWSG::setDeviceType(int type) {
|
||||||
|
|
||||||
void DivPlatformNamcoWSG::setFlags(const DivConfig& flags) {
|
void DivPlatformNamcoWSG::setFlags(const DivConfig& flags) {
|
||||||
chipClock=3072000;
|
chipClock=3072000;
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
rate=chipClock/32;
|
rate=chipClock/32;
|
||||||
namco->device_clock_changed(rate);
|
namco->device_clock_changed(rate);
|
||||||
for (int i=0; i<chans; i++) {
|
for (int i=0; i<chans; i++) {
|
||||||
|
|
|
@ -663,13 +663,13 @@ bool DivPlatformNES::keyOffAffectsArp(int ch) {
|
||||||
void DivPlatformNES::setFlags(const DivConfig& flags) {
|
void DivPlatformNES::setFlags(const DivConfig& flags) {
|
||||||
int clockSel=flags.getInt("clockSel",0);
|
int clockSel=flags.getInt("clockSel",0);
|
||||||
if (clockSel==2) { // Dendy
|
if (clockSel==2) { // Dendy
|
||||||
rate=COLOR_PAL*2.0/5.0;
|
chipClock=COLOR_PAL*2.0/5.0;
|
||||||
apuType=2;
|
apuType=2;
|
||||||
} else if (clockSel==1) { // PAL
|
} else if (clockSel==1) { // PAL
|
||||||
rate=COLOR_PAL*3.0/8.0;
|
chipClock=COLOR_PAL*3.0/8.0;
|
||||||
apuType=1;
|
apuType=1;
|
||||||
} else { // NTSC
|
} else { // NTSC
|
||||||
rate=COLOR_NTSC/2.0;
|
chipClock=COLOR_NTSC/2.0;
|
||||||
apuType=0;
|
apuType=0;
|
||||||
}
|
}
|
||||||
if (useNP) {
|
if (useNP) {
|
||||||
|
@ -681,7 +681,8 @@ void DivPlatformNES::setFlags(const DivConfig& flags) {
|
||||||
} else {
|
} else {
|
||||||
nes->apu.type=apuType;
|
nes->apu.type=apuType;
|
||||||
}
|
}
|
||||||
chipClock=rate;
|
CHECK_CUSTOM_CLOCK;
|
||||||
|
rate=chipClock;
|
||||||
for (int i=0; i<5; i++) {
|
for (int i=0; i<5; i++) {
|
||||||
oscBuf[i]->rate=rate/32;
|
oscBuf[i]->rate=rate/32;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1694,6 +1694,7 @@ void DivPlatformOPL::setFlags(const DivConfig& flags) {
|
||||||
chipClock=COLOR_NTSC;
|
chipClock=COLOR_NTSC;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
rate=chipClock/72;
|
rate=chipClock/72;
|
||||||
chipRateBase=rate;
|
chipRateBase=rate;
|
||||||
break;
|
break;
|
||||||
|
@ -1715,6 +1716,7 @@ void DivPlatformOPL::setFlags(const DivConfig& flags) {
|
||||||
chipClock=COLOR_NTSC*4.0;
|
chipClock=COLOR_NTSC*4.0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
rate=chipClock/288;
|
rate=chipClock/288;
|
||||||
chipRateBase=rate;
|
chipRateBase=rate;
|
||||||
break;
|
break;
|
||||||
|
@ -1730,6 +1732,7 @@ void DivPlatformOPL::setFlags(const DivConfig& flags) {
|
||||||
chipClock=COLOR_NTSC*8.0;
|
chipClock=COLOR_NTSC*8.0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
rate=chipClock/768;
|
rate=chipClock/768;
|
||||||
chipRateBase=chipClock/684;
|
chipRateBase=chipClock/684;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -958,6 +958,7 @@ void DivPlatformOPLL::setFlags(const DivConfig& flags) {
|
||||||
} else {
|
} else {
|
||||||
chipClock=COLOR_NTSC;
|
chipClock=COLOR_NTSC;
|
||||||
}
|
}
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
rate=chipClock/36;
|
rate=chipClock/36;
|
||||||
patchSet=flags.getInt("patchSet",0);
|
patchSet=flags.getInt("patchSet",0);
|
||||||
for (int i=0; i<11; i++) {
|
for (int i=0; i<11; i++) {
|
||||||
|
|
|
@ -565,6 +565,7 @@ void DivPlatformPCE::setFlags(const DivConfig& flags) {
|
||||||
} else {
|
} else {
|
||||||
chipClock=COLOR_NTSC;
|
chipClock=COLOR_NTSC;
|
||||||
}
|
}
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
antiClickEnabled=!flags.getBool("noAntiClick",false);
|
antiClickEnabled=!flags.getBool("noAntiClick",false);
|
||||||
rate=chipClock/12;
|
rate=chipClock/12;
|
||||||
for (int i=0; i<6; i++) {
|
for (int i=0; i<6; i++) {
|
||||||
|
|
|
@ -598,6 +598,7 @@ void DivPlatformPCSpeaker::setFlags(const DivConfig& flags) {
|
||||||
chipClock=COLOR_NTSC/3.0;
|
chipClock=COLOR_NTSC/3.0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
rate=chipClock/PCSPKR_DIVIDER;
|
rate=chipClock/PCSPKR_DIVIDER;
|
||||||
speakerType=flags.getInt("speakerType",0)&3;
|
speakerType=flags.getInt("speakerType",0)&3;
|
||||||
oscBuf->rate=rate;
|
oscBuf->rate=rate;
|
||||||
|
|
|
@ -300,6 +300,7 @@ int DivPlatformPET::init(DivEngine* p, int channels, int sugRate, const DivConfi
|
||||||
dumpWrites=false;
|
dumpWrites=false;
|
||||||
skipRegisterWrites=false;
|
skipRegisterWrites=false;
|
||||||
chipClock=1000000;
|
chipClock=1000000;
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
rate=chipClock/SAMP_DIVIDER; // = 250000kHz
|
rate=chipClock/SAMP_DIVIDER; // = 250000kHz
|
||||||
isMuted=false;
|
isMuted=false;
|
||||||
oscBuf=new DivDispatchOscBuffer;
|
oscBuf=new DivDispatchOscBuffer;
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include "../engine.h"
|
#include "../engine.h"
|
||||||
#include "../../ta-log.h"
|
#include "../../ta-log.h"
|
||||||
|
|
||||||
#define CHIP_DIVIDER 16
|
#define CHIP_DIVIDER 1024
|
||||||
|
|
||||||
void DivPlatformPong::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformPong::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
||||||
int out=0;
|
int out=0;
|
||||||
|
@ -226,8 +226,9 @@ bool DivPlatformPong::keyOffAffectsArp(int ch) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformPong::setFlags(const DivConfig& flags) {
|
void DivPlatformPong::setFlags(const DivConfig& flags) {
|
||||||
chipClock=15625;
|
chipClock=1000000;
|
||||||
rate=chipClock;
|
CHECK_CUSTOM_CLOCK;
|
||||||
|
rate=chipClock/64;
|
||||||
oscBuf->rate=rate;
|
oscBuf->rate=rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -348,6 +348,7 @@ void DivPlatformRF5C68::setFlags(const DivConfig& flags) {
|
||||||
case 2: chipClock=12500000; break;
|
case 2: chipClock=12500000; break;
|
||||||
default: chipClock=8000000; break;
|
default: chipClock=8000000; break;
|
||||||
}
|
}
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
chipType=flags.getInt("chipType",0);
|
chipType=flags.getInt("chipType",0);
|
||||||
rate=chipClock/384;
|
rate=chipClock/384;
|
||||||
for (int i=0; i<8; i++) {
|
for (int i=0; i<8; i++) {
|
||||||
|
|
|
@ -438,6 +438,7 @@ void DivPlatformSAA1099::setFlags(const DivConfig& flags) {
|
||||||
} else {
|
} else {
|
||||||
chipClock=8000000;
|
chipClock=8000000;
|
||||||
}
|
}
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
rate=chipClock/32;
|
rate=chipClock/32;
|
||||||
|
|
||||||
for (int i=0; i<6; i++) {
|
for (int i=0; i<6; i++) {
|
||||||
|
|
|
@ -375,6 +375,7 @@ void DivPlatformSCC::setFlags(const DivConfig& flags) {
|
||||||
chipClock=COLOR_NTSC/2.0;
|
chipClock=COLOR_NTSC/2.0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
rate=chipClock/8;
|
rate=chipClock/8;
|
||||||
for (int i=0; i<5; i++) {
|
for (int i=0; i<5; i++) {
|
||||||
oscBuf[i]->rate=rate;
|
oscBuf[i]->rate=rate;
|
||||||
|
|
|
@ -486,7 +486,8 @@ void DivPlatformSegaPCM::reset() {
|
||||||
|
|
||||||
void DivPlatformSegaPCM::setFlags(const DivConfig& flags) {
|
void DivPlatformSegaPCM::setFlags(const DivConfig& flags) {
|
||||||
chipClock=8000000.0;
|
chipClock=8000000.0;
|
||||||
rate=31250;
|
CHECK_CUSTOM_CLOCK;
|
||||||
|
rate=chipClock/256;
|
||||||
for (int i=0; i<16; i++) {
|
for (int i=0; i<16; i++) {
|
||||||
oscBuf[i]->rate=rate;
|
oscBuf[i]->rate=rate;
|
||||||
}
|
}
|
||||||
|
|
|
@ -568,6 +568,7 @@ void DivPlatformSMS::setFlags(const DivConfig& flags) {
|
||||||
stereo=false;
|
stereo=false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
rate=chipClock/divider;
|
rate=chipClock/divider;
|
||||||
for (int i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
oscBuf[i]->rate=rate;
|
oscBuf[i]->rate=rate;
|
||||||
|
|
|
@ -511,6 +511,7 @@ void DivPlatformSoundUnit::setFlags(const DivConfig& flags) {
|
||||||
} else {
|
} else {
|
||||||
chipClock=1236000;
|
chipClock=1236000;
|
||||||
}
|
}
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
rate=chipClock/4;
|
rate=chipClock/4;
|
||||||
for (int i=0; i<8; i++) {
|
for (int i=0; i<8; i++) {
|
||||||
oscBuf[i]->rate=rate;
|
oscBuf[i]->rate=rate;
|
||||||
|
|
|
@ -514,6 +514,7 @@ int DivPlatformSwan::init(DivEngine* p, int channels, int sugRate, const DivConf
|
||||||
dumpWrites=false;
|
dumpWrites=false;
|
||||||
skipRegisterWrites=false;
|
skipRegisterWrites=false;
|
||||||
chipClock=3072000;
|
chipClock=3072000;
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
rate=chipClock/16; // = 192000kHz, should be enough
|
rate=chipClock/16; // = 192000kHz, should be enough
|
||||||
for (int i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
isMuted[i]=false;
|
isMuted[i]=false;
|
||||||
|
|
|
@ -343,6 +343,7 @@ void DivPlatformT6W28::notifyInsDeletion(void* ins) {
|
||||||
|
|
||||||
void DivPlatformT6W28::setFlags(const DivConfig& flags) {
|
void DivPlatformT6W28::setFlags(const DivConfig& flags) {
|
||||||
chipClock=3072000.0;
|
chipClock=3072000.0;
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
rate=chipClock/16;
|
rate=chipClock/16;
|
||||||
for (int i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
oscBuf[i]->rate=rate;
|
oscBuf[i]->rate=rate;
|
||||||
|
|
|
@ -356,6 +356,7 @@ void DivPlatformTIA::setFlags(const DivConfig& flags) {
|
||||||
} else {
|
} else {
|
||||||
rate=COLOR_NTSC;
|
rate=COLOR_NTSC;
|
||||||
}
|
}
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
chipClock=rate;
|
chipClock=rate;
|
||||||
mixingType=flags.getInt("mixingType",0)&3;
|
mixingType=flags.getInt("mixingType",0)&3;
|
||||||
for (int i=0; i<2; i++) {
|
for (int i=0; i<2; i++) {
|
||||||
|
|
|
@ -486,6 +486,7 @@ void DivPlatformVB::notifyInsDeletion(void* ins) {
|
||||||
|
|
||||||
void DivPlatformVB::setFlags(const DivConfig& flags) {
|
void DivPlatformVB::setFlags(const DivConfig& flags) {
|
||||||
chipClock=5000000.0;
|
chipClock=5000000.0;
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
rate=chipClock/16;
|
rate=chipClock/16;
|
||||||
for (int i=0; i<6; i++) {
|
for (int i=0; i<6; i++) {
|
||||||
oscBuf[i]->rate=rate;
|
oscBuf[i]->rate=rate;
|
||||||
|
|
|
@ -438,6 +438,7 @@ int DivPlatformVERA::init(DivEngine* p, int channels, int sugRate, const DivConf
|
||||||
dumpWrites=false;
|
dumpWrites=false;
|
||||||
skipRegisterWrites=false;
|
skipRegisterWrites=false;
|
||||||
chipClock=25000000;
|
chipClock=25000000;
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
rate=chipClock/512;
|
rate=chipClock/512;
|
||||||
for (int i=0; i<17; i++) {
|
for (int i=0; i<17; i++) {
|
||||||
oscBuf[i]->rate=rate;
|
oscBuf[i]->rate=rate;
|
||||||
|
|
|
@ -307,6 +307,7 @@ void DivPlatformVIC20::setFlags(const DivConfig& flags) {
|
||||||
} else {
|
} else {
|
||||||
chipClock=COLOR_NTSC*2.0/7.0;
|
chipClock=COLOR_NTSC*2.0/7.0;
|
||||||
}
|
}
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
rate=chipClock/4;
|
rate=chipClock/4;
|
||||||
for (int i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
oscBuf[i]->rate=rate;
|
oscBuf[i]->rate=rate;
|
||||||
|
|
|
@ -482,13 +482,14 @@ bool DivPlatformVRC6::keyOffAffectsArp(int ch) {
|
||||||
void DivPlatformVRC6::setFlags(const DivConfig& flags) {
|
void DivPlatformVRC6::setFlags(const DivConfig& flags) {
|
||||||
int clockSel=flags.getInt("clockSel",0);
|
int clockSel=flags.getInt("clockSel",0);
|
||||||
if (clockSel==2) { // Dendy
|
if (clockSel==2) { // Dendy
|
||||||
rate=COLOR_PAL*2.0/5.0;
|
chipClock=COLOR_PAL*2.0/5.0;
|
||||||
} else if (clockSel==1) { // PAL
|
} else if (clockSel==1) { // PAL
|
||||||
rate=COLOR_PAL*3.0/8.0;
|
chipClock=COLOR_PAL*3.0/8.0;
|
||||||
} else { // NTSC
|
} else { // NTSC
|
||||||
rate=COLOR_NTSC/2.0;
|
chipClock=COLOR_NTSC/2.0;
|
||||||
}
|
}
|
||||||
chipClock=rate;
|
CHECK_CUSTOM_CLOCK;
|
||||||
|
rate=chipClock;
|
||||||
for (int i=0; i<3; i++) {
|
for (int i=0; i<3; i++) {
|
||||||
oscBuf[i]->rate=rate/32;
|
oscBuf[i]->rate=rate/32;
|
||||||
}
|
}
|
||||||
|
|
|
@ -922,6 +922,7 @@ void DivPlatformX1_010::setFlags(const DivConfig& flags) {
|
||||||
chipClock=16000000;
|
chipClock=16000000;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
rate=chipClock/512;
|
rate=chipClock/512;
|
||||||
stereo=flags.getBool("stereo",false);
|
stereo=flags.getBool("stereo",false);
|
||||||
for (int i=0; i<16; i++) {
|
for (int i=0; i<16; i++) {
|
||||||
|
|
|
@ -952,6 +952,7 @@ void DivPlatformYM2203::setFlags(const DivConfig& flags) {
|
||||||
ayDiv=16;
|
ayDiv=16;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
noExtMacros=flags.getBool("noExtMacros",false);
|
noExtMacros=flags.getBool("noExtMacros",false);
|
||||||
rate=fm->sample_rate(chipClock);
|
rate=fm->sample_rate(chipClock);
|
||||||
for (int i=0; i<6; i++) {
|
for (int i=0; i<6; i++) {
|
||||||
|
|
|
@ -1407,6 +1407,7 @@ void DivPlatformYM2608::setFlags(const DivConfig& flags) {
|
||||||
ayDiv=32;
|
ayDiv=32;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
noExtMacros=flags.getBool("noExtMacros",false);
|
noExtMacros=flags.getBool("noExtMacros",false);
|
||||||
rate=fm->sample_rate(chipClock);
|
rate=fm->sample_rate(chipClock);
|
||||||
for (int i=0; i<16; i++) {
|
for (int i=0; i<16; i++) {
|
||||||
|
|
|
@ -294,6 +294,7 @@ template<int ChanNum> class DivPlatformYM2610Base: public DivPlatformOPN {
|
||||||
chipClock=8000000.0;
|
chipClock=8000000.0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
noExtMacros=flags.getBool("noExtMacros",false);
|
noExtMacros=flags.getBool("noExtMacros",false);
|
||||||
rate=chipClock/16;
|
rate=chipClock/16;
|
||||||
for (int i=0; i<ChanNum; i++) {
|
for (int i=0; i<ChanNum; i++) {
|
||||||
|
|
|
@ -494,6 +494,7 @@ void DivPlatformYMZ280B::setFlags(const DivConfig& flags) {
|
||||||
chipClock=16934400;
|
chipClock=16934400;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
rate=chipClock/384;
|
rate=chipClock/384;
|
||||||
break;
|
break;
|
||||||
case 759:
|
case 759:
|
||||||
|
|
|
@ -293,6 +293,7 @@ void DivPlatformZXBeeper::setFlags(const DivConfig& flags) {
|
||||||
} else {
|
} else {
|
||||||
chipClock=COLOR_NTSC;
|
chipClock=COLOR_NTSC;
|
||||||
}
|
}
|
||||||
|
CHECK_CUSTOM_CLOCK;
|
||||||
rate=chipClock/4;
|
rate=chipClock/4;
|
||||||
for (int i=0; i<6; i++) {
|
for (int i=0; i<6; i++) {
|
||||||
oscBuf[i]->rate=rate;
|
oscBuf[i]->rate=rate;
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool modifyOnChange) {
|
bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool modifyOnChange) {
|
||||||
bool altered=false;
|
bool altered=false;
|
||||||
bool restart=settings.restartOnFlagChange && modifyOnChange;
|
bool restart=settings.restartOnFlagChange && modifyOnChange;
|
||||||
|
bool supportsCustomRate=true;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case DIV_SYSTEM_YM2612:
|
case DIV_SYSTEM_YM2612:
|
||||||
|
@ -765,6 +766,8 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
||||||
flags.set("echoFeedback",echoFeedback);
|
flags.set("echoFeedback",echoFeedback);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
supportsCustomRate=false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DIV_SYSTEM_X1_010: {
|
case DIV_SYSTEM_X1_010: {
|
||||||
|
@ -1401,6 +1404,8 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
supportsCustomRate=false;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DIV_SYSTEM_MSM5232: {
|
case DIV_SYSTEM_MSM5232: {
|
||||||
|
@ -1542,13 +1547,15 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DIV_SYSTEM_SWAN:
|
case DIV_SYSTEM_SWAN:
|
||||||
case DIV_SYSTEM_VERA:
|
|
||||||
case DIV_SYSTEM_BUBSYS_WSG:
|
case DIV_SYSTEM_BUBSYS_WSG:
|
||||||
case DIV_SYSTEM_YMU759:
|
|
||||||
case DIV_SYSTEM_PET:
|
case DIV_SYSTEM_PET:
|
||||||
case DIV_SYSTEM_VBOY:
|
case DIV_SYSTEM_VBOY:
|
||||||
ImGui::Text("nothing to configure");
|
ImGui::Text("nothing to configure");
|
||||||
break;
|
break;
|
||||||
|
case DIV_SYSTEM_VERA:
|
||||||
|
case DIV_SYSTEM_YMU759:
|
||||||
|
supportsCustomRate=false;
|
||||||
|
break;
|
||||||
default: {
|
default: {
|
||||||
bool sysPal=flags.getInt("clockSel",0);
|
bool sysPal=flags.getInt("clockSel",0);
|
||||||
|
|
||||||
|
@ -1565,6 +1572,32 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (supportsCustomRate) {
|
||||||
|
ImGui::Separator();
|
||||||
|
int customClock=flags.getInt("customClock",0);
|
||||||
|
bool usingCustomClock=customClock>=100000;
|
||||||
|
|
||||||
|
if (ImGui::Checkbox("Custom clock rate",&usingCustomClock)) {
|
||||||
|
if (usingCustomClock) {
|
||||||
|
customClock=1000000;
|
||||||
|
} else {
|
||||||
|
customClock=0;
|
||||||
|
}
|
||||||
|
altered=true;
|
||||||
|
}
|
||||||
|
if (ImGui::InputInt("Hz",&customClock)) {
|
||||||
|
if (customClock<100000) customClock=0;
|
||||||
|
if (customClock>20000000) customClock=20000000;
|
||||||
|
altered=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (altered) {
|
||||||
|
e->lockSave([&]() {
|
||||||
|
flags.set("customClock",customClock);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (altered) {
|
if (altered) {
|
||||||
if (chan>=0) {
|
if (chan>=0) {
|
||||||
e->updateSysFlags(chan,restart);
|
e->updateSysFlags(chan,restart);
|
||||||
|
|
Loading…
Reference in New Issue