Merge branch 'master' of https://github.com/tildearrow/furnace into es5506_alt

This commit is contained in:
cam900 2022-12-04 16:53:54 +09:00
commit 2ec35d903f
264 changed files with 836 additions and 166 deletions

View file

@ -826,6 +826,7 @@ void DivPlatformAY8910::setFlags(const DivConfig& flags) {
chipClock=COLOR_NTSC/2.0;
break;
}
CHECK_CUSTOM_CLOCK;
rate=chipClock/8;
}
for (int i=0; i<3; i++) {

View file

@ -804,6 +804,7 @@ void DivPlatformAY8930::setFlags(const DivConfig& flags) {
chipClock=COLOR_NTSC/2.0;
break;
}
CHECK_CUSTOM_CLOCK;
rate=chipClock/4;
for (int i=0; i<3; i++) {
oscBuf[i]->rate=rate;

View file

@ -323,6 +323,7 @@ void DivPlatformBubSysWSG::notifyInsDeletion(void* ins) {
void DivPlatformBubSysWSG::setFlags(const DivConfig& flags) {
chipClock=COLOR_NTSC;
CHECK_CUSTOM_CLOCK;
rate=chipClock;
for (int i=0; i<2; i++) {
oscBuf[i]->rate=rate/64;

View file

@ -535,17 +535,18 @@ void DivPlatformC64::setFP(bool fp) {
void DivPlatformC64::setFlags(const DivConfig& flags) {
switch (flags.getInt("clockSel",0)) {
case 0x0: // NTSC C64
rate=COLOR_NTSC*2.0/7.0;
chipClock=COLOR_NTSC*2.0/7.0;
break;
case 0x1: // PAL C64
rate=COLOR_PAL*2.0/9.0;
chipClock=COLOR_PAL*2.0/9.0;
break;
case 0x2: // SSI 2001
default:
rate=14318180.0/16.0;
chipClock=14318180.0/16.0;
break;
}
chipClock=rate;
CHECK_CUSTOM_CLOCK;
rate=chipClock;
for (int i=0; i<3; i++) {
oscBuf[i]->rate=rate/16;
}

View file

@ -454,13 +454,14 @@ void DivPlatformFDS::setNSFPlay(bool use) {
void DivPlatformFDS::setFlags(const DivConfig& flags) {
int clockSel=flags.getInt("clockSel",0);
if (clockSel==2) { // Dendy
rate=COLOR_PAL*2.0/5.0;
chipClock=COLOR_PAL*2.0/5.0;
} else if (clockSel==1) { // PAL
rate=COLOR_PAL*3.0/8.0;
chipClock=COLOR_PAL*3.0/8.0;
} else { // NTSC
rate=COLOR_NTSC/2.0;
chipClock=COLOR_NTSC/2.0;
}
chipClock=rate;
CHECK_CUSTOM_CLOCK;
rate=chipClock;
oscBuf->rate=rate/32;
if (useNP) {
fds_NP->SetClock(rate);

View file

@ -655,6 +655,7 @@ void DivPlatformGB::setFlags(const DivConfig& flags) {
int DivPlatformGB::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
chipClock=4194304;
CHECK_CUSTOM_CLOCK;
rate=chipClock/16;
for (int i=0; i<4; i++) {
isMuted[i]=false;

View file

@ -1226,6 +1226,7 @@ void DivPlatformGenesis::setFlags(const DivConfig& flags) {
ladder=flags.getBool("ladderEffect",false);
noExtMacros=flags.getBool("noExtMacros",false);
OPN2_SetChipType(ladder?ym3438_mode_ym2612:0);
CHECK_CUSTOM_CLOCK;
if (useYMFM) {
if (fm_ymfm!=NULL) delete fm_ymfm;
if (ladder) {

View file

@ -471,6 +471,7 @@ int DivPlatformLynx::init(DivEngine* p, int channels, int sugRate, const DivConf
}
chipClock = 16000000;
CHECK_CUSTOM_CLOCK;
rate = chipClock/128;
for (int i=0; i<4; i++) {

View file

@ -389,13 +389,14 @@ bool DivPlatformMMC5::keyOffAffectsArp(int ch) {
void DivPlatformMMC5::setFlags(const DivConfig& flags) {
int clockSel=flags.getInt("clockSel",0);
if (clockSel==2) { // Dendy
rate=COLOR_PAL*2.0/5.0;
chipClock=COLOR_PAL*2.0/5.0;
} else if (clockSel==1) { // PAL
rate=COLOR_PAL*3.0/8.0;
chipClock=COLOR_PAL*3.0/8.0;
} 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++) {
oscBuf[i]->rate=rate/32;
}

View file

@ -372,6 +372,7 @@ void DivPlatformMSM5232::notifyInsDeletion(void* ins) {
void DivPlatformMSM5232::setFlags(const DivConfig& flags) {
chipClock=2119040;
CHECK_CUSTOM_CLOCK;
detune=flags.getInt("detune",0);
msm->set_clock(chipClock+detune*1024);
rate=msm->get_rate();

View file

@ -412,6 +412,7 @@ void DivPlatformMSM6258::setFlags(const DivConfig& flags) {
chipClock=4000000;
break;
}
CHECK_CUSTOM_CLOCK;
rate=chipClock/256;
for (int i=0; i<1; i++) {
oscBuf[i]->rate=rate;

View file

@ -438,6 +438,7 @@ void DivPlatformMSM6295::setFlags(const DivConfig& flags) {
chipClock=4000000/4;
break;
}
CHECK_CUSTOM_CLOCK;
rate=chipClock/3;
for (int i=0; i<4; i++) {
oscBuf[i]->rate=rate/22;

View file

@ -624,18 +624,19 @@ void DivPlatformN163::poke(std::vector<DivRegWrite>& wlist) {
void DivPlatformN163::setFlags(const DivConfig& flags) {
switch (flags.getInt("clockSel",0)) {
case 1: // PAL
rate=COLOR_PAL*3.0/8.0;
chipClock=COLOR_PAL*3.0/8.0;
break;
case 2: // Dendy
rate=COLOR_PAL*2.0/5.0;
chipClock=COLOR_PAL*2.0/5.0;
break;
default: // NTSC
rate=COLOR_NTSC/2.0;
chipClock=COLOR_NTSC/2.0;
break;
}
CHECK_CUSTOM_CLOCK;
initChanMax=chanMax=flags.getInt("channels",0)&7;
multiplex=!flags.getBool("multiplex",false); // not accurate in real hardware
chipClock=rate;
rate=chipClock;
rate/=15;
n163.set_multiplex(multiplex);
rWrite(0x7f,initChanMax<<4);

View file

@ -532,6 +532,7 @@ void DivPlatformNamcoWSG::setDeviceType(int type) {
void DivPlatformNamcoWSG::setFlags(const DivConfig& flags) {
chipClock=3072000;
CHECK_CUSTOM_CLOCK;
rate=chipClock/32;
namco->device_clock_changed(rate);
for (int i=0; i<chans; i++) {

View file

@ -663,13 +663,13 @@ bool DivPlatformNES::keyOffAffectsArp(int ch) {
void DivPlatformNES::setFlags(const DivConfig& flags) {
int clockSel=flags.getInt("clockSel",0);
if (clockSel==2) { // Dendy
rate=COLOR_PAL*2.0/5.0;
chipClock=COLOR_PAL*2.0/5.0;
apuType=2;
} else if (clockSel==1) { // PAL
rate=COLOR_PAL*3.0/8.0;
chipClock=COLOR_PAL*3.0/8.0;
apuType=1;
} else { // NTSC
rate=COLOR_NTSC/2.0;
chipClock=COLOR_NTSC/2.0;
apuType=0;
}
if (useNP) {
@ -681,7 +681,8 @@ void DivPlatformNES::setFlags(const DivConfig& flags) {
} else {
nes->apu.type=apuType;
}
chipClock=rate;
CHECK_CUSTOM_CLOCK;
rate=chipClock;
for (int i=0; i<5; i++) {
oscBuf[i]->rate=rate/32;
}

View file

@ -1694,6 +1694,7 @@ void DivPlatformOPL::setFlags(const DivConfig& flags) {
chipClock=COLOR_NTSC;
break;
}
CHECK_CUSTOM_CLOCK;
rate=chipClock/72;
chipRateBase=rate;
break;
@ -1715,6 +1716,7 @@ void DivPlatformOPL::setFlags(const DivConfig& flags) {
chipClock=COLOR_NTSC*4.0;
break;
}
CHECK_CUSTOM_CLOCK;
rate=chipClock/288;
chipRateBase=rate;
break;
@ -1730,6 +1732,7 @@ void DivPlatformOPL::setFlags(const DivConfig& flags) {
chipClock=COLOR_NTSC*8.0;
break;
}
CHECK_CUSTOM_CLOCK;
rate=chipClock/768;
chipRateBase=chipClock/684;
break;

View file

@ -958,6 +958,7 @@ void DivPlatformOPLL::setFlags(const DivConfig& flags) {
} else {
chipClock=COLOR_NTSC;
}
CHECK_CUSTOM_CLOCK;
rate=chipClock/36;
patchSet=flags.getInt("patchSet",0);
for (int i=0; i<11; i++) {

View file

@ -565,6 +565,7 @@ void DivPlatformPCE::setFlags(const DivConfig& flags) {
} else {
chipClock=COLOR_NTSC;
}
CHECK_CUSTOM_CLOCK;
antiClickEnabled=!flags.getBool("noAntiClick",false);
rate=chipClock/12;
for (int i=0; i<6; i++) {

View file

@ -598,6 +598,7 @@ void DivPlatformPCSpeaker::setFlags(const DivConfig& flags) {
chipClock=COLOR_NTSC/3.0;
break;
}
CHECK_CUSTOM_CLOCK;
rate=chipClock/PCSPKR_DIVIDER;
speakerType=flags.getInt("speakerType",0)&3;
oscBuf->rate=rate;

View file

@ -300,6 +300,7 @@ int DivPlatformPET::init(DivEngine* p, int channels, int sugRate, const DivConfi
dumpWrites=false;
skipRegisterWrites=false;
chipClock=1000000;
CHECK_CUSTOM_CLOCK;
rate=chipClock/SAMP_DIVIDER; // = 250000kHz
isMuted=false;
oscBuf=new DivDispatchOscBuffer;

View file

@ -21,7 +21,7 @@
#include "../engine.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) {
int out=0;
@ -226,8 +226,9 @@ bool DivPlatformPong::keyOffAffectsArp(int ch) {
}
void DivPlatformPong::setFlags(const DivConfig& flags) {
chipClock=15625;
rate=chipClock;
chipClock=1000000;
CHECK_CUSTOM_CLOCK;
rate=chipClock/64;
oscBuf->rate=rate;
}

View file

@ -245,6 +245,22 @@ const unsigned char q1_reg_map[Q1V_REG_COUNT][16] = {
{0x06,0x0e,0x16,0x1e,0x26,0x2e,0x36,0x3e,0x46,0x4e,0x56,0x5e,0x66,0x6e,0x76,0x7e},
};
const unsigned char q1a_start_map[3]={
0xca, 0xce, 0xd2
};
const unsigned char q1a_end_map[3]={
0xcb, 0xcf, 0xd3
};
const unsigned char q1a_bank_map[3]={
0xcc, 0xd0, 0xd4
};
const unsigned char q1a_vol_map[3]={
0xcd, 0xd1, 0xd5
};
const char** DivPlatformQSound::getRegisterSheet() {
return regCheatSheetQSound;
}
@ -265,7 +281,7 @@ void DivPlatformQSound::acquire(short* bufL, short* bufR, size_t start, size_t l
}
void DivPlatformQSound::tick(bool sysTick) {
for (int i=0; i<16; i++) {
for (int i=0; i<19; i++) {
chan[i].std.next();
if (chan[i].std.vol.had) {
if (chan[i].isNewQSound) {
@ -277,7 +293,11 @@ void DivPlatformQSound::tick(bool sysTick) {
}
// Check if enabled and write volume
if (chan[i].active) {
rWrite(q1_reg_map[Q1V_VOL][i],chan[i].resVol);
if (i<16) {
rWrite(q1_reg_map[Q1V_VOL][i],chan[i].resVol);
} else {
rWrite(q1a_vol_map[i-16],chan[i].resVol);
}
}
}
uint16_t qsound_bank = 0;
@ -286,8 +306,13 @@ void DivPlatformQSound::tick(bool sysTick) {
uint16_t qsound_end = 0;
if (chan[i].sample>=0 && chan[i].sample<parent->song.sampleLen) {
DivSample* s=parent->getSample(chan[i].sample);
qsound_bank = 0x8000 | (offPCM[chan[i].sample] >> 16);
qsound_addr = offPCM[chan[i].sample] & 0xffff;
if (i<16) {
qsound_bank = 0x8000 | (offPCM[chan[i].sample] >> 16);
qsound_addr = offPCM[chan[i].sample] & 0xffff;
} else {
qsound_bank = 0x8000 | (offBS[chan[i].sample] >> 16);
qsound_addr = offBS[chan[i].sample] & 0xffff;
}
int loopStart=s->loopStart;
int length = s->loopEnd;
@ -295,10 +320,18 @@ void DivPlatformQSound::tick(bool sysTick) {
length = 65536 - 16;
}
if (loopStart == -1 || loopStart >= length) {
qsound_end = offPCM[chan[i].sample] + length + 15;
if (i<16) {
qsound_end = offPCM[chan[i].sample] + length + 15;
} else {
qsound_end = offBS[chan[i].sample] + length + 15;
}
qsound_loop = 15;
} else {
qsound_end = offPCM[chan[i].sample] + length;
if (i<16) {
qsound_end = offPCM[chan[i].sample] + length;
} else {
qsound_end = offBS[chan[i].sample] + length;
}
qsound_loop = length - loopStart;
}
}
@ -310,7 +343,9 @@ void DivPlatformQSound::tick(bool sysTick) {
}
if (chan[i].isNewQSound && chan[i].std.duty.had) {
chan[i].echo=CLAMP(chan[i].std.duty.val,0,32767);
immWrite(Q1_ECHO+i,chan[i].echo&0x7fff);
if (i<16) {
immWrite(Q1_ECHO+i,chan[i].echo&0x7fff);
}
}
if (chan[i].isNewQSound && chan[i].std.ex1.had) {
immWrite(Q1_ECHO_FEEDBACK,chan[i].std.ex1.val&0x3fff);
@ -355,11 +390,19 @@ void DivPlatformQSound::tick(bool sysTick) {
chan[i].freq=off*parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false,2,chan[i].pitch2,440.0,4096.0);
if (chan[i].freq>0xefff) chan[i].freq=0xefff;
if (chan[i].keyOn) {
rWrite(q1_reg_map[Q1V_BANK][i], qsound_bank);
rWrite(q1_reg_map[Q1V_END][i], qsound_end);
rWrite(q1_reg_map[Q1V_LOOP][i], qsound_loop);
rWrite(q1_reg_map[Q1V_START][i], qsound_addr);
rWrite(q1_reg_map[Q1V_PHASE][i], 0x8000);
if (i<16) {
rWrite(q1_reg_map[Q1V_BANK][i], qsound_bank);
rWrite(q1_reg_map[Q1V_END][i], qsound_end);
rWrite(q1_reg_map[Q1V_LOOP][i], qsound_loop);
rWrite(q1_reg_map[Q1V_START][i], qsound_addr);
rWrite(q1_reg_map[Q1V_PHASE][i], 0x8000);
} else {
rWrite(Q1A_KEYON+(i-16),0);
rWrite(q1a_bank_map[i-16], qsound_bank);
rWrite(q1a_end_map[i-16], qsound_end);
rWrite(q1a_start_map[i-16], qsound_addr);
rWrite(Q1A_KEYON+(i-16),1);
}
//logV("ch %d bank=%04x, addr=%04x, end=%04x, loop=%04x!",i,qsound_bank,qsound_addr,qsound_end,qsound_loop);
// Write sample address. Enable volume
if (!chan[i].std.vol.had) {
@ -368,16 +411,27 @@ void DivPlatformQSound::tick(bool sysTick) {
} else {
chan[i].resVol=chan[i].vol<<4;
}
rWrite(q1_reg_map[Q1V_VOL][i],chan[i].resVol);
if (i<16) {
rWrite(q1_reg_map[Q1V_VOL][i],chan[i].resVol);
} else {
rWrite(q1a_vol_map[i-16],chan[i].resVol);
}
}
}
if (chan[i].keyOff) {
// Disable volume
rWrite(q1_reg_map[Q1V_VOL][i],0);
rWrite(q1_reg_map[Q1V_FREQ][i],0);
if (i<16) {
rWrite(q1_reg_map[Q1V_VOL][i],0);
rWrite(q1_reg_map[Q1V_FREQ][i],0);
} else {
rWrite(q1a_vol_map[i-16],0);
rWrite(Q1A_KEYON+(i-16),0);
}
} else if (chan[i].active) {
//logV("ch %d frequency set to %04x, off=%f, note=%d, %04x!",i,chan[i].freq,off,chan[i].note,QS_NOTE_FREQUENCY(chan[i].note));
rWrite(q1_reg_map[Q1V_FREQ][i],chan[i].freq);
if (i<16) {
rWrite(q1_reg_map[Q1V_FREQ][i],chan[i].freq);
}
}
if (chan[i].keyOn) chan[i].keyOn=false;
if (chan[i].keyOff) chan[i].keyOff=false;
@ -441,8 +495,12 @@ int DivPlatformQSound::dispatch(DivCommand c) {
} else {
chan[c.chan].resVol=chan[c.chan].outVol<<4;
}
if (chan[c.chan].active && c.chan<16) {
rWrite(q1_reg_map[Q1V_VOL][c.chan],chan[c.chan].resVol);
if (chan[c.chan].active) {
if (c.chan<16) {
rWrite(q1_reg_map[Q1V_VOL][c.chan],chan[c.chan].resVol);
} else {
rWrite(q1a_vol_map[c.chan-16],chan[c.chan].resVol);
}
}
}
}
@ -459,6 +517,7 @@ int DivPlatformQSound::dispatch(DivCommand c) {
break;
case DIV_CMD_QSOUND_ECHO_LEVEL:
chan[c.chan].echo=c.value<<7;
if (c.chan>=16) break;
immWrite(Q1_ECHO+c.chan,chan[c.chan].echo&0x7fff);
break;
case DIV_CMD_QSOUND_ECHO_FEEDBACK:
@ -532,7 +591,8 @@ void DivPlatformQSound::muteChannel(int ch, bool mute) {
}
void DivPlatformQSound::forceIns() {
for (int i=0; i<4; i++) {
// TODO: what?
for (int i=0; i<19; i++) {
chan[i].insChanged=true;
chan[i].freqChanged=true;
chan[i].sample=-1;
@ -552,7 +612,7 @@ DivDispatchOscBuffer* DivPlatformQSound::getOscBuffer(int ch) {
}
void DivPlatformQSound::reset() {
for (int i=0; i<16; i++) {
for (int i=0; i<19; i++) {
chan[i]=DivPlatformQSound::Channel();
chan[i].std.setEngine(parent);
}
@ -582,8 +642,7 @@ void DivPlatformQSound::notifyInsChange(int ins) {
}
void DivPlatformQSound::notifyWaveChange(int wave) {
// TODO when wavetables are added
// TODO they probably won't be added unless the samples reside in RAM
// yeah won't add wavetables
}
void DivPlatformQSound::notifyInsDeletion(void* ins) {
@ -633,27 +692,32 @@ int DivPlatformQSound::getRegisterPoolDepth() {
}
const void* DivPlatformQSound::getSampleMem(int index) {
return index == 0 ? sampleMem : NULL;
return (index == 0 || index == 1) ? sampleMem : NULL;
}
size_t DivPlatformQSound::getSampleMemCapacity(int index) {
return index == 0 ? 16777216 : 0;
return (index == 0 || index == 1) ? 16777216 : 0;
}
size_t DivPlatformQSound::getSampleMemUsage(int index) {
return index == 0 ? sampleMemLen : 0;
return index == 0 ? sampleMemLen : index == 1 ? sampleMemLenBS : 0;
}
bool DivPlatformQSound::isSampleLoaded(int index, int sample) {
if (index!=0) return false;
if (index<0 || index>1) return false;
if (sample<0 || sample>255) return false;
if (index==1) return sampleLoadedBS[sample];
return sampleLoaded[sample];
}
// TODO: ADPCM... come on...
const char* DivPlatformQSound::getSampleMemName(int index) {
return index == 0 ? "PCM" : index == 1 ? "ADPCM" : NULL;
}
void DivPlatformQSound::renderSamples(int sysID) {
memset(sampleMem,0,getSampleMemCapacity());
memset(sampleLoaded,0,256*sizeof(bool));
memset(sampleLoadedBS,0,256*sizeof(bool));
size_t memPos=0;
for (int i=0; i<parent->song.sampleLen; i++) {
@ -689,6 +753,42 @@ void DivPlatformQSound::renderSamples(int sysID) {
memPos+=length+16;
}
sampleMemLen=memPos+256;
memPos=(memPos+0xffff)&0xff0000;
for (int i=0; i<parent->song.sampleLen; i++) {
DivSample* s=parent->song.sample[i];
if (!s->renderOn[1][sysID]) {
offBS[i]=0;
continue;
}
int length=s->lengthQSoundA;
if (length>65536) {
length=65536;
}
if ((memPos&0xff0000)!=((memPos+length)&0xff0000)) {
memPos=(memPos+0xffff)&0xff0000;
}
if (memPos>=getSampleMemCapacity()) {
logW("out of QSound ADPCM memory for sample %d!",i);
break;
}
if (memPos+length>=getSampleMemCapacity()) {
for (unsigned int i=0; i<getSampleMemCapacity()-(memPos+length); i++) {
sampleMem[(memPos+i)]=s->dataQSoundA[i];
}
logW("out of QSound ADPCM memory for sample %d!",i);
} else {
for (int i=0; i<length; i++) {
sampleMem[(memPos+i)]=s->dataQSoundA[i];
}
sampleLoaded[i]=true;
}
offBS[i]=memPos;
memPos+=length+16;
}
sampleMemLenBS=memPos+256;
}
int DivPlatformQSound::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
@ -706,6 +806,7 @@ int DivPlatformQSound::init(DivEngine* p, int channels, int sugRate, const DivCo
rate = qsound_start(&chip, chipClock);
sampleMem=new unsigned char[getSampleMemCapacity()];
sampleMemLen=0;
sampleMemLenBS=0;
chip.rom_data=sampleMem;
chip.rom_mask=0xffffff;
reset();

View file

@ -69,7 +69,9 @@ class DivPlatformQSound: public DivDispatch {
unsigned char* sampleMem;
size_t sampleMemLen;
size_t sampleMemLenBS;
bool sampleLoaded[256];
bool sampleLoadedBS[256];
struct qsound_chip chip;
unsigned short regPool[512];
@ -102,6 +104,7 @@ class DivPlatformQSound: public DivDispatch {
void poke(std::vector<DivRegWrite>& wlist);
const char** getRegisterSheet();
const void* getSampleMem(int index = 0);
const char* getSampleMemName(int index=0);
size_t getSampleMemCapacity(int index = 0);
size_t getSampleMemUsage(int index = 0);
bool isSampleLoaded(int index, int sample);

View file

@ -348,6 +348,7 @@ void DivPlatformRF5C68::setFlags(const DivConfig& flags) {
case 2: chipClock=12500000; break;
default: chipClock=8000000; break;
}
CHECK_CUSTOM_CLOCK;
chipType=flags.getInt("chipType",0);
rate=chipClock/384;
for (int i=0; i<8; i++) {

View file

@ -438,6 +438,7 @@ void DivPlatformSAA1099::setFlags(const DivConfig& flags) {
} else {
chipClock=8000000;
}
CHECK_CUSTOM_CLOCK;
rate=chipClock/32;
for (int i=0; i<6; i++) {

View file

@ -375,6 +375,7 @@ void DivPlatformSCC::setFlags(const DivConfig& flags) {
chipClock=COLOR_NTSC/2.0;
break;
}
CHECK_CUSTOM_CLOCK;
rate=chipClock/8;
for (int i=0; i<5; i++) {
oscBuf[i]->rate=rate;

View file

@ -486,7 +486,8 @@ void DivPlatformSegaPCM::reset() {
void DivPlatformSegaPCM::setFlags(const DivConfig& flags) {
chipClock=8000000.0;
rate=31250;
CHECK_CUSTOM_CLOCK;
rate=chipClock/256;
for (int i=0; i<16; i++) {
oscBuf[i]->rate=rate;
}

View file

@ -568,6 +568,7 @@ void DivPlatformSMS::setFlags(const DivConfig& flags) {
stereo=false;
break;
}
CHECK_CUSTOM_CLOCK;
rate=chipClock/divider;
for (int i=0; i<4; i++) {
oscBuf[i]->rate=rate;

View file

@ -511,6 +511,7 @@ void DivPlatformSoundUnit::setFlags(const DivConfig& flags) {
} else {
chipClock=1236000;
}
CHECK_CUSTOM_CLOCK;
rate=chipClock/4;
for (int i=0; i<8; i++) {
oscBuf[i]->rate=rate;

View file

@ -514,6 +514,7 @@ int DivPlatformSwan::init(DivEngine* p, int channels, int sugRate, const DivConf
dumpWrites=false;
skipRegisterWrites=false;
chipClock=3072000;
CHECK_CUSTOM_CLOCK;
rate=chipClock/16; // = 192000kHz, should be enough
for (int i=0; i<4; i++) {
isMuted[i]=false;

View file

@ -343,6 +343,7 @@ void DivPlatformT6W28::notifyInsDeletion(void* ins) {
void DivPlatformT6W28::setFlags(const DivConfig& flags) {
chipClock=3072000.0;
CHECK_CUSTOM_CLOCK;
rate=chipClock/16;
for (int i=0; i<4; i++) {
oscBuf[i]->rate=rate;

View file

@ -356,6 +356,7 @@ void DivPlatformTIA::setFlags(const DivConfig& flags) {
} else {
rate=COLOR_NTSC;
}
CHECK_CUSTOM_CLOCK;
chipClock=rate;
mixingType=flags.getInt("mixingType",0)&3;
for (int i=0; i<2; i++) {

View file

@ -486,6 +486,7 @@ void DivPlatformVB::notifyInsDeletion(void* ins) {
void DivPlatformVB::setFlags(const DivConfig& flags) {
chipClock=5000000.0;
CHECK_CUSTOM_CLOCK;
rate=chipClock/16;
for (int i=0; i<6; i++) {
oscBuf[i]->rate=rate;

View file

@ -438,6 +438,7 @@ int DivPlatformVERA::init(DivEngine* p, int channels, int sugRate, const DivConf
dumpWrites=false;
skipRegisterWrites=false;
chipClock=25000000;
CHECK_CUSTOM_CLOCK;
rate=chipClock/512;
for (int i=0; i<17; i++) {
oscBuf[i]->rate=rate;

View file

@ -307,6 +307,7 @@ void DivPlatformVIC20::setFlags(const DivConfig& flags) {
} else {
chipClock=COLOR_NTSC*2.0/7.0;
}
CHECK_CUSTOM_CLOCK;
rate=chipClock/4;
for (int i=0; i<4; i++) {
oscBuf[i]->rate=rate;

View file

@ -482,13 +482,14 @@ bool DivPlatformVRC6::keyOffAffectsArp(int ch) {
void DivPlatformVRC6::setFlags(const DivConfig& flags) {
int clockSel=flags.getInt("clockSel",0);
if (clockSel==2) { // Dendy
rate=COLOR_PAL*2.0/5.0;
chipClock=COLOR_PAL*2.0/5.0;
} else if (clockSel==1) { // PAL
rate=COLOR_PAL*3.0/8.0;
chipClock=COLOR_PAL*3.0/8.0;
} 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++) {
oscBuf[i]->rate=rate/32;
}

View file

@ -922,6 +922,7 @@ void DivPlatformX1_010::setFlags(const DivConfig& flags) {
chipClock=16000000;
break;
}
CHECK_CUSTOM_CLOCK;
rate=chipClock/512;
stereo=flags.getBool("stereo",false);
for (int i=0; i<16; i++) {

View file

@ -952,6 +952,7 @@ void DivPlatformYM2203::setFlags(const DivConfig& flags) {
ayDiv=16;
break;
}
CHECK_CUSTOM_CLOCK;
noExtMacros=flags.getBool("noExtMacros",false);
rate=fm->sample_rate(chipClock);
for (int i=0; i<6; i++) {

View file

@ -1407,6 +1407,7 @@ void DivPlatformYM2608::setFlags(const DivConfig& flags) {
ayDiv=32;
break;
}
CHECK_CUSTOM_CLOCK;
noExtMacros=flags.getBool("noExtMacros",false);
rate=fm->sample_rate(chipClock);
for (int i=0; i<16; i++) {

View file

@ -294,6 +294,7 @@ template<int ChanNum> class DivPlatformYM2610Base: public DivPlatformOPN {
chipClock=8000000.0;
break;
}
CHECK_CUSTOM_CLOCK;
noExtMacros=flags.getBool("noExtMacros",false);
rate=chipClock/16;
for (int i=0; i<ChanNum; i++) {

View file

@ -494,6 +494,7 @@ void DivPlatformYMZ280B::setFlags(const DivConfig& flags) {
chipClock=16934400;
break;
}
CHECK_CUSTOM_CLOCK;
rate=chipClock/384;
break;
case 759:

View file

@ -293,6 +293,7 @@ void DivPlatformZXBeeper::setFlags(const DivConfig& flags) {
} else {
chipClock=COLOR_NTSC;
}
CHECK_CUSTOM_CLOCK;
rate=chipClock/4;
for (int i=0; i<6; i++) {
oscBuf[i]->rate=rate;