diff --git a/CMakeLists.txt b/CMakeLists.txt index 52cef63c..b7b111f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -354,6 +354,7 @@ src/engine/platform/c64.cpp src/engine/platform/arcade.cpp src/engine/platform/tx81z.cpp src/engine/platform/ym2203.cpp +src/engine/platform/ym2203ext.cpp src/engine/platform/ym2608.cpp src/engine/platform/ym2610.cpp src/engine/platform/ym2610ext.cpp diff --git a/src/engine/platform/ym2203ext.cpp b/src/engine/platform/ym2203ext.cpp index 440dce6a..7948d51e 100644 --- a/src/engine/platform/ym2203ext.cpp +++ b/src/engine/platform/ym2203ext.cpp @@ -17,20 +17,20 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "ym2610bext.h" +#include "ym2203ext.h" #include "../engine.h" #include #include "ym2610shared.h" #include "fmshared_OPN.h" -int DivPlatformYM2610BExt::dispatch(DivCommand c) { +int DivPlatformYM2203Ext::dispatch(DivCommand c) { if (c.chan<2) { - return DivPlatformYM2610B::dispatch(c); + return DivPlatformYM2203::dispatch(c); } if (c.chan>5) { c.chan-=3; - return DivPlatformYM2610B::dispatch(c); + return DivPlatformYM2203::dispatch(c); } int ch=c.chan-2; int ordch=orderedOps[ch]; @@ -384,7 +384,7 @@ static int opChanOffsH[4]={ 0xad, 0xae, 0xac, 0xa6 }; -void DivPlatformYM2610BExt::tick(bool sysTick) { +void DivPlatformYM2203Ext::tick(bool sysTick) { if (extMode) { bool writeSomething=false; unsigned char writeMask=2; @@ -401,7 +401,7 @@ void DivPlatformYM2610BExt::tick(bool sysTick) { } } - DivPlatformYM2610B::tick(sysTick); + DivPlatformYM2203::tick(sysTick); bool writeNoteOn=false; unsigned char writeMask=2; @@ -438,13 +438,13 @@ void DivPlatformYM2610BExt::tick(bool sysTick) { } } -void DivPlatformYM2610BExt::muteChannel(int ch, bool mute) { +void DivPlatformYM2203Ext::muteChannel(int ch, bool mute) { if (ch<2) { - DivPlatformYM2610B::muteChannel(ch,mute); + DivPlatformYM2203::muteChannel(ch,mute); return; } if (ch>5) { - DivPlatformYM2610B::muteChannel(ch-3,mute); + DivPlatformYM2203::muteChannel(ch-3,mute); return; } isOpMuted[ch-2]=mute; @@ -462,7 +462,7 @@ void DivPlatformYM2610BExt::muteChannel(int ch, bool mute) { } } -void DivPlatformYM2610BExt::forceIns() { +void DivPlatformYM2203Ext::forceIns() { for (int i=0; i<6; i++) { for (int j=0; j<4; j++) { unsigned short baseAddr=chanOffs[i]|opOffs[j]; @@ -494,7 +494,6 @@ void DivPlatformYM2610BExt::forceIns() { rWrite(baseAddr+ADDR_SSG,op.ssgEnv&15); } rWrite(chanOffs[i]+ADDR_FB_ALG,(chan[i].state.alg&7)|(chan[i].state.fb<<3)); - rWrite(chanOffs[i]+ADDR_LRAF,(isMuted[i]?0:(chan[i].pan<<6))|(chan[i].state.fms&7)|((chan[i].state.ams&3)<<4)); if (chan[i].active) { chan[i].keyOn=true; chan[i].freqChanged=true; @@ -518,23 +517,23 @@ void DivPlatformYM2610BExt::forceIns() { } } -void* DivPlatformYM2610BExt::getChanState(int ch) { +void* DivPlatformYM2203Ext::getChanState(int ch) { if (ch>=6) return &chan[ch-3]; if (ch>=2) return &opChan[ch-2]; return &chan[ch]; } -DivDispatchOscBuffer* DivPlatformYM2610BExt::getOscBuffer(int ch) { +DivDispatchOscBuffer* DivPlatformYM2203Ext::getOscBuffer(int ch) { if (ch>=6) return oscBuf[ch-3]; if (ch<3) return oscBuf[ch]; return NULL; } -void DivPlatformYM2610BExt::reset() { - DivPlatformYM2610B::reset(); +void DivPlatformYM2203Ext::reset() { + DivPlatformYM2203::reset(); for (int i=0; i<4; i++) { - opChan[i]=DivPlatformYM2610BExt::OpChannel(); + opChan[i]=DivPlatformYM2203Ext::OpChannel(); opChan[i].vol=127; } @@ -543,12 +542,12 @@ void DivPlatformYM2610BExt::reset() { extMode=true; } -bool DivPlatformYM2610BExt::keyOffAffectsArp(int ch) { +bool DivPlatformYM2203Ext::keyOffAffectsArp(int ch) { return (ch>8); } -void DivPlatformYM2610BExt::notifyInsChange(int ins) { - DivPlatformYM2610B::notifyInsChange(ins); +void DivPlatformYM2203Ext::notifyInsChange(int ins) { + DivPlatformYM2203::notifyInsChange(ins); for (int i=0; i<4; i++) { if (opChan[i].ins==ins) { opChan[i].insChanged=true; @@ -556,8 +555,8 @@ void DivPlatformYM2610BExt::notifyInsChange(int ins) { } } -int DivPlatformYM2610BExt::init(DivEngine* parent, int channels, int sugRate, unsigned int flags) { - DivPlatformYM2610B::init(parent,channels,sugRate,flags); +int DivPlatformYM2203Ext::init(DivEngine* parent, int channels, int sugRate, unsigned int flags) { + DivPlatformYM2203::init(parent,channels,sugRate,flags); for (int i=0; i<4; i++) { isOpMuted[i]=false; } @@ -566,9 +565,9 @@ int DivPlatformYM2610BExt::init(DivEngine* parent, int channels, int sugRate, un return 19; } -void DivPlatformYM2610BExt::quit() { - DivPlatformYM2610B::quit(); +void DivPlatformYM2203Ext::quit() { + DivPlatformYM2203::quit(); } -DivPlatformYM2610BExt::~DivPlatformYM2610BExt() { +DivPlatformYM2203Ext::~DivPlatformYM2203Ext() { } diff --git a/src/engine/platform/ym2203ext.h b/src/engine/platform/ym2203ext.h index 4e3f7c5f..7dde3abb 100644 --- a/src/engine/platform/ym2203ext.h +++ b/src/engine/platform/ym2203ext.h @@ -19,9 +19,9 @@ #include "../dispatch.h" -#include "ym2610b.h" +#include "ym2203.h" -class DivPlatformYM2610BExt: public DivPlatformYM2610B { +class DivPlatformYM2203Ext: public DivPlatformYM2203 { struct OpChannel { DivMacroInt std; unsigned char freqH, freqL; @@ -47,5 +47,5 @@ class DivPlatformYM2610BExt: public DivPlatformYM2610B { void notifyInsChange(int ins); int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); void quit(); - ~DivPlatformYM2610BExt(); + ~DivPlatformYM2203Ext(); }; diff --git a/src/engine/song.cpp b/src/engine/song.cpp index 7a815eb1..4c142c5f 100644 --- a/src/engine/song.cpp +++ b/src/engine/song.cpp @@ -19,6 +19,8 @@ #include "song.h" +DivOrders emptyOrders; + void DivSong::clearSongData() { for (int i=0; i ins; - DivChannelData pat[DIV_MAX_CHANS]; + DivChannelData* pat; std::vector wave; std::vector sample; - bool chanShow[DIV_MAX_CHANS]; - unsigned char chanCollapse[DIV_MAX_CHANS]; + std::vector subsongs; + + bool* chanShow; + unsigned char* chanCollapse; DivInstrument nullIns, nullInsOPLL, nullInsOPL, nullInsQSound; DivWavetable nullWave; @@ -457,10 +491,11 @@ struct DivSong { systemPan[i]=0; systemFlags[i]=0; } - for (int i=0; i