DO NOT USE - THIS FAILS - WORK IN PROGRESS

This commit is contained in:
tildearrow 2022-05-14 18:19:07 -05:00
parent 06ec22d6a5
commit 14053f70cb
5 changed files with 73 additions and 36 deletions

View file

@ -17,20 +17,20 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "ym2610bext.h"
#include "ym2203ext.h"
#include "../engine.h"
#include <math.h>
#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() {
}

View file

@ -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();
};