mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-26 22:43:01 +00:00
make OPN channel offsets common
This commit is contained in:
parent
5ecc79f8b9
commit
85d43a84a7
10 changed files with 31 additions and 32 deletions
|
@ -146,6 +146,8 @@ class DivPlatformOPN: public DivPlatformFMBase {
|
||||||
pan(3) {}
|
pan(3) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const int extChanOffs, psgChanOffs, adpcmAChanOffs, adpcmBChanOffs, chanNum;
|
||||||
|
|
||||||
double fmFreqBase;
|
double fmFreqBase;
|
||||||
unsigned int fmDivBase;
|
unsigned int fmDivBase;
|
||||||
unsigned int ayDiv;
|
unsigned int ayDiv;
|
||||||
|
@ -157,8 +159,13 @@ class DivPlatformOPN: public DivPlatformFMBase {
|
||||||
|
|
||||||
friend void putDispatchChip(void*,int);
|
friend void putDispatchChip(void*,int);
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
DivPlatformOPN(double f=9440540.0, unsigned int d=72, unsigned int a=32, bool isExtSys=false, unsigned char cc=255):
|
DivPlatformOPN(int ext, int psg, int adpcmA, int adpcmB, int chanCount, double f=9440540.0, unsigned int d=72, unsigned int a=32, bool isExtSys=false, unsigned char cc=255):
|
||||||
DivPlatformFMBase(),
|
DivPlatformFMBase(),
|
||||||
|
extChanOffs(ext),
|
||||||
|
psgChanOffs(psg),
|
||||||
|
adpcmAChanOffs(adpcmA),
|
||||||
|
adpcmBChanOffs(adpcmB),
|
||||||
|
chanNum(chanCount),
|
||||||
fmFreqBase(f),
|
fmFreqBase(f),
|
||||||
fmDivBase(d),
|
fmDivBase(d),
|
||||||
ayDiv(a),
|
ayDiv(a),
|
||||||
|
|
|
@ -126,7 +126,7 @@ class DivPlatformGenesis: public DivPlatformOPN {
|
||||||
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
|
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
|
||||||
void quit();
|
void quit();
|
||||||
DivPlatformGenesis():
|
DivPlatformGenesis():
|
||||||
DivPlatformOPN(9440540.0, 72, 32, false, 7) {}
|
DivPlatformOPN(2, 6, 6, 6, 6, 9440540.0, 72, 32, false, 7) {}
|
||||||
~DivPlatformGenesis();
|
~DivPlatformGenesis();
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -77,7 +77,7 @@ class DivPlatformYM2203: public DivPlatformOPN {
|
||||||
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
|
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
|
||||||
void quit();
|
void quit();
|
||||||
DivPlatformYM2203():
|
DivPlatformYM2203():
|
||||||
DivPlatformOPN(4720270.0, 36, 16),
|
DivPlatformOPN(2, 3, 6, 6, 6, 4720270.0, 36, 16),
|
||||||
prescale(0x2d) {}
|
prescale(0x2d) {}
|
||||||
~DivPlatformYM2203();
|
~DivPlatformYM2203();
|
||||||
};
|
};
|
||||||
|
|
|
@ -97,7 +97,7 @@ class DivPlatformYM2608: public DivPlatformOPN {
|
||||||
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
|
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
|
||||||
void quit();
|
void quit();
|
||||||
DivPlatformYM2608():
|
DivPlatformYM2608():
|
||||||
DivPlatformOPN(9440540.0, 72, 32),
|
DivPlatformOPN(2, 6, 9, 15, 16, 9440540.0, 72, 32),
|
||||||
prescale(0x2d) {}
|
prescale(0x2d) {}
|
||||||
~DivPlatformYM2608();
|
~DivPlatformYM2608();
|
||||||
};
|
};
|
||||||
|
|
|
@ -1275,7 +1275,7 @@ bool DivPlatformYM2610::keyOffAffectsArp(int ch) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformYM2610::notifyInsChange(int ins) {
|
void DivPlatformYM2610::notifyInsChange(int ins) {
|
||||||
for (int i=0; i<chanNum; i++) {
|
for (int i=0; i<16; i++) {
|
||||||
if (chan[i].ins==ins) {
|
if (chan[i].ins==ins) {
|
||||||
chan[i].insChanged=true;
|
chan[i].insChanged=true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#include "ym2610shared.h"
|
#include "ym2610shared.h"
|
||||||
|
|
||||||
class DivPlatformYM2610: public DivPlatformYM2610Base<14> {
|
class DivPlatformYM2610: public DivPlatformYM2610Base {
|
||||||
protected:
|
protected:
|
||||||
const unsigned short chanOffs[4]={
|
const unsigned short chanOffs[4]={
|
||||||
0x01, 0x02, 0x101, 0x102
|
0x01, 0x02, 0x101, 0x102
|
||||||
|
@ -60,7 +60,7 @@ class DivPlatformYM2610: public DivPlatformYM2610Base<14> {
|
||||||
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
|
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
|
||||||
void quit();
|
void quit();
|
||||||
DivPlatformYM2610():
|
DivPlatformYM2610():
|
||||||
DivPlatformYM2610Base<14>(1,4,7,13) {}
|
DivPlatformYM2610Base(1,4,7,13,14) {}
|
||||||
~DivPlatformYM2610();
|
~DivPlatformYM2610();
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1342,7 +1342,7 @@ bool DivPlatformYM2610B::keyOffAffectsArp(int ch) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformYM2610B::notifyInsChange(int ins) {
|
void DivPlatformYM2610B::notifyInsChange(int ins) {
|
||||||
for (int i=0; i<chanNum; i++) {
|
for (int i=0; i<16; i++) {
|
||||||
if (chan[i].ins==ins) {
|
if (chan[i].ins==ins) {
|
||||||
chan[i].insChanged=true;
|
chan[i].insChanged=true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#include "ym2610shared.h"
|
#include "ym2610shared.h"
|
||||||
|
|
||||||
class DivPlatformYM2610B: public DivPlatformYM2610Base<16> {
|
class DivPlatformYM2610B: public DivPlatformYM2610Base {
|
||||||
protected:
|
protected:
|
||||||
const unsigned short chanOffs[6]={
|
const unsigned short chanOffs[6]={
|
||||||
0x00, 0x01, 0x02, 0x100, 0x101, 0x102
|
0x00, 0x01, 0x02, 0x100, 0x101, 0x102
|
||||||
|
@ -56,7 +56,7 @@ class DivPlatformYM2610B: public DivPlatformYM2610Base<16> {
|
||||||
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
|
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
|
||||||
void quit();
|
void quit();
|
||||||
DivPlatformYM2610B():
|
DivPlatformYM2610B():
|
||||||
DivPlatformYM2610Base<16>(2,6,9,15) {}
|
DivPlatformYM2610Base(2,6,9,15,16) {}
|
||||||
~DivPlatformYM2610B();
|
~DivPlatformYM2610B();
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -44,11 +44,11 @@ class DivYM2610Interface: public ymfm::ymfm_interface {
|
||||||
sampleBank(0) {}
|
sampleBank(0) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<int ChanNum> class DivPlatformYM2610Base: public DivPlatformOPN {
|
class DivPlatformYM2610Base: public DivPlatformOPN {
|
||||||
protected:
|
protected:
|
||||||
OPNChannelStereo chan[ChanNum];
|
OPNChannelStereo chan[16];
|
||||||
DivDispatchOscBuffer* oscBuf[ChanNum];
|
DivDispatchOscBuffer* oscBuf[16];
|
||||||
bool isMuted[ChanNum];
|
bool isMuted[16];
|
||||||
|
|
||||||
ymfm::ym2610b* fm;
|
ymfm::ym2610b* fm;
|
||||||
ymfm::ym2610b::output_data fmout;
|
ymfm::ym2610b::output_data fmout;
|
||||||
|
@ -72,9 +72,6 @@ template<int ChanNum> class DivPlatformYM2610Base: public DivPlatformOPN {
|
||||||
unsigned char writeADPCMAOff, writeADPCMAOn;
|
unsigned char writeADPCMAOff, writeADPCMAOn;
|
||||||
int globalADPCMAVolume;
|
int globalADPCMAVolume;
|
||||||
|
|
||||||
const int extChanOffs, psgChanOffs, adpcmAChanOffs, adpcmBChanOffs;
|
|
||||||
const int chanNum=ChanNum;
|
|
||||||
|
|
||||||
double NOTE_OPNB(int ch, int note) {
|
double NOTE_OPNB(int ch, int note) {
|
||||||
if (ch>=adpcmBChanOffs) { // ADPCM
|
if (ch>=adpcmBChanOffs) { // ADPCM
|
||||||
return NOTE_ADPCMB(note);
|
return NOTE_ADPCMB(note);
|
||||||
|
@ -221,7 +218,7 @@ template<int ChanNum> class DivPlatformYM2610Base: public DivPlatformOPN {
|
||||||
CHECK_CUSTOM_CLOCK;
|
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<16; i++) {
|
||||||
oscBuf[i]->rate=rate;
|
oscBuf[i]->rate=rate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -231,7 +228,7 @@ template<int ChanNum> class DivPlatformYM2610Base: public DivPlatformOPN {
|
||||||
ayFlags.set("chipType",1);
|
ayFlags.set("chipType",1);
|
||||||
dumpWrites=false;
|
dumpWrites=false;
|
||||||
skipRegisterWrites=false;
|
skipRegisterWrites=false;
|
||||||
for (int i=0; i<ChanNum; i++) {
|
for (int i=0; i<16; i++) {
|
||||||
isMuted[i]=false;
|
isMuted[i]=false;
|
||||||
oscBuf[i]=new DivDispatchOscBuffer;
|
oscBuf[i]=new DivDispatchOscBuffer;
|
||||||
}
|
}
|
||||||
|
@ -253,7 +250,7 @@ template<int ChanNum> class DivPlatformYM2610Base: public DivPlatformOPN {
|
||||||
}
|
}
|
||||||
|
|
||||||
void quit() {
|
void quit() {
|
||||||
for (int i=0; i<ChanNum; i++) {
|
for (int i=0; i<16; i++) {
|
||||||
delete oscBuf[i];
|
delete oscBuf[i];
|
||||||
}
|
}
|
||||||
ay->quit();
|
ay->quit();
|
||||||
|
@ -262,12 +259,8 @@ template<int ChanNum> class DivPlatformYM2610Base: public DivPlatformOPN {
|
||||||
delete[] adpcmBMem;
|
delete[] adpcmBMem;
|
||||||
}
|
}
|
||||||
|
|
||||||
DivPlatformYM2610Base(int ext, int psg, int adpcmA, int adpcmB):
|
DivPlatformYM2610Base(int ext, int psg, int adpcmA, int adpcmB, int chanCount):
|
||||||
DivPlatformOPN(9440540.0, 72, 32),
|
DivPlatformOPN(ext,psg,adpcmA,adpcmB,chanCount,9440540.0, 72, 32) {}
|
||||||
extChanOffs(ext),
|
|
||||||
psgChanOffs(psg),
|
|
||||||
adpcmAChanOffs(adpcmA),
|
|
||||||
adpcmBChanOffs(adpcmB) {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -65,7 +65,11 @@
|
||||||
FM_CHIP_DEBUG; \
|
FM_CHIP_DEBUG; \
|
||||||
ImGui::Text("- fmFreqBase: %.f",ch->fmFreqBase); \
|
ImGui::Text("- fmFreqBase: %.f",ch->fmFreqBase); \
|
||||||
ImGui::Text("- fmDivBase: %d",ch->fmDivBase); \
|
ImGui::Text("- fmDivBase: %d",ch->fmDivBase); \
|
||||||
ImGui::Text("- ayDiv: %d",ch->ayDiv);
|
ImGui::Text("- ayDiv: %d",ch->ayDiv); \
|
||||||
|
ImGui::Text("- extChanOffs: %d",ch->extChanOffs); \
|
||||||
|
ImGui::Text("- psgChanOffs: %d",ch->psgChanOffs); \
|
||||||
|
ImGui::Text("- adpcmAChanOffs: %d",ch->adpcmAChanOffs); \
|
||||||
|
ImGui::Text("- adpcmBChanOffs: %d",ch->adpcmBChanOffs); \
|
||||||
|
|
||||||
#define COMMON_CHIP_DEBUG_BOOL \
|
#define COMMON_CHIP_DEBUG_BOOL \
|
||||||
ImGui::TextColored(ch->skipRegisterWrites?colorOn:colorOff,">> SkipRegisterWrites"); \
|
ImGui::TextColored(ch->skipRegisterWrites?colorOn:colorOff,">> SkipRegisterWrites"); \
|
||||||
|
@ -97,11 +101,6 @@
|
||||||
ImGui::Text("- writeADPCMAOff: %d",ch->writeADPCMAOff); \
|
ImGui::Text("- writeADPCMAOff: %d",ch->writeADPCMAOff); \
|
||||||
ImGui::Text("- writeADPCMAOn: %d",ch->writeADPCMAOn); \
|
ImGui::Text("- writeADPCMAOn: %d",ch->writeADPCMAOn); \
|
||||||
ImGui::Text("- globalADPCMAVolume: %d",ch->globalADPCMAVolume); \
|
ImGui::Text("- globalADPCMAVolume: %d",ch->globalADPCMAVolume); \
|
||||||
ImGui::Text("- extChanOffs: %d",ch->extChanOffs); \
|
|
||||||
ImGui::Text("- psgChanOffs: %d",ch->psgChanOffs); \
|
|
||||||
ImGui::Text("- adpcmAChanOffs: %d",ch->adpcmAChanOffs); \
|
|
||||||
ImGui::Text("- adpcmBChanOffs: %d",ch->adpcmBChanOffs); \
|
|
||||||
ImGui::Text("- chanNum: %d",ch->chanNum); \
|
|
||||||
FM_OPN_CHIP_DEBUG_BOOL; \
|
FM_OPN_CHIP_DEBUG_BOOL; \
|
||||||
ImGui::TextColored(ch->extMode?colorOn:colorOff,">> ExtMode");
|
ImGui::TextColored(ch->extMode?colorOn:colorOff,">> ExtMode");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue