Reduce more FM codes
This commit is contained in:
parent
d1aeabe464
commit
ebbd9784e6
|
@ -19,19 +19,18 @@
|
||||||
|
|
||||||
#ifndef _ARCADE_H
|
#ifndef _ARCADE_H
|
||||||
#define _ARCADE_H
|
#define _ARCADE_H
|
||||||
#include "../dispatch.h"
|
#include "fmshared_OPM.h"
|
||||||
#include "../macroInt.h"
|
#include "../macroInt.h"
|
||||||
#include "../instrument.h"
|
#include "../instrument.h"
|
||||||
#include <queue>
|
#include <queue>
|
||||||
#include "../../../extern/opm/opm.h"
|
#include "../../../extern/opm/opm.h"
|
||||||
#include "sound/ymfm/ymfm_opm.h"
|
#include "sound/ymfm/ymfm_opm.h"
|
||||||
#include "fmshared_OPM.h"
|
|
||||||
|
|
||||||
class DivArcadeInterface: public ymfm::ymfm_interface {
|
class DivArcadeInterface: public ymfm::ymfm_interface {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DivPlatformArcade: public DivDispatch, public DivPlatformOPMBase {
|
class DivPlatformArcade: public DivPlatformOPMBase {
|
||||||
protected:
|
protected:
|
||||||
const unsigned short chanOffs[8]={
|
const unsigned short chanOffs[8]={
|
||||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
|
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
|
||||||
|
@ -85,15 +84,10 @@ class DivPlatformArcade: public DivDispatch, public DivPlatformOPMBase {
|
||||||
ymfm::ym2151::output_data out_ymfm;
|
ymfm::ym2151::output_data out_ymfm;
|
||||||
DivArcadeInterface iface;
|
DivArcadeInterface iface;
|
||||||
|
|
||||||
unsigned char regPool[256];
|
|
||||||
|
|
||||||
bool extMode, useYMFM;
|
bool extMode, useYMFM;
|
||||||
|
|
||||||
bool isMuted[8];
|
bool isMuted[8];
|
||||||
|
|
||||||
short oldWrites[256];
|
|
||||||
short pendingWrites[256];
|
|
||||||
|
|
||||||
int octave(int freq);
|
int octave(int freq);
|
||||||
int toFreq(int freq);
|
int toFreq(int freq);
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#ifndef _FMSHARED_BASE_H
|
#ifndef _FMSHARED_BASE_H
|
||||||
#define _FMSHARED_BASE_H
|
#define _FMSHARED_BASE_H
|
||||||
|
|
||||||
|
#include "../dispatch.h"
|
||||||
#include <deque>
|
#include <deque>
|
||||||
|
|
||||||
#define rWrite(a,v) if (!skipRegisterWrites) {pendingWrites[a]=v;}
|
#define rWrite(a,v) if (!skipRegisterWrites) {pendingWrites[a]=v;}
|
||||||
|
@ -37,7 +38,7 @@
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
class DivPlatformFMBase {
|
class DivPlatformFMBase: public DivDispatch {
|
||||||
protected:
|
protected:
|
||||||
const bool isOutput[8][4]={
|
const bool isOutput[8][4]={
|
||||||
// 1 3 2 4
|
// 1 3 2 4
|
||||||
|
@ -69,6 +70,10 @@ class DivPlatformFMBase {
|
||||||
unsigned char lastBusy;
|
unsigned char lastBusy;
|
||||||
int delay;
|
int delay;
|
||||||
|
|
||||||
|
unsigned char regPool[512];
|
||||||
|
short oldWrites[512];
|
||||||
|
short pendingWrites[512];
|
||||||
|
|
||||||
DivPlatformFMBase():
|
DivPlatformFMBase():
|
||||||
lastBusy(0),
|
lastBusy(0),
|
||||||
delay(0) {}
|
delay(0) {}
|
||||||
|
|
|
@ -19,18 +19,17 @@
|
||||||
|
|
||||||
#ifndef _GENESIS_H
|
#ifndef _GENESIS_H
|
||||||
#define _GENESIS_H
|
#define _GENESIS_H
|
||||||
#include "../dispatch.h"
|
#include "fmshared_OPN.h"
|
||||||
#include "../macroInt.h"
|
#include "../macroInt.h"
|
||||||
#include "../../../extern/Nuked-OPN2/ym3438.h"
|
#include "../../../extern/Nuked-OPN2/ym3438.h"
|
||||||
#include "sound/ymfm/ymfm_opn.h"
|
#include "sound/ymfm/ymfm_opn.h"
|
||||||
|
|
||||||
#include "fmshared_OPN.h"
|
|
||||||
|
|
||||||
class DivYM2612Interface: public ymfm::ymfm_interface {
|
class DivYM2612Interface: public ymfm::ymfm_interface {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DivPlatformGenesis: public DivDispatch, public DivPlatformOPNBase {
|
class DivPlatformGenesis: public DivPlatformOPNBase {
|
||||||
protected:
|
protected:
|
||||||
const unsigned short chanOffs[6]={
|
const unsigned short chanOffs[6]={
|
||||||
0x00, 0x01, 0x02, 0x100, 0x101, 0x102
|
0x00, 0x01, 0x02, 0x100, 0x101, 0x102
|
||||||
|
@ -112,7 +111,6 @@ class DivPlatformGenesis: public DivDispatch, public DivPlatformOPNBase {
|
||||||
ymfm::ym2612* fm_ymfm;
|
ymfm::ym2612* fm_ymfm;
|
||||||
ymfm::ym2612::output_data out_ymfm;
|
ymfm::ym2612::output_data out_ymfm;
|
||||||
DivYM2612Interface iface;
|
DivYM2612Interface iface;
|
||||||
unsigned char regPool[512];
|
|
||||||
|
|
||||||
unsigned char lfoValue;
|
unsigned char lfoValue;
|
||||||
|
|
||||||
|
@ -121,9 +119,6 @@ class DivPlatformGenesis: public DivDispatch, public DivPlatformOPNBase {
|
||||||
bool extMode, softPCM, useYMFM;
|
bool extMode, softPCM, useYMFM;
|
||||||
bool ladder;
|
bool ladder;
|
||||||
|
|
||||||
short oldWrites[512];
|
|
||||||
short pendingWrites[512];
|
|
||||||
|
|
||||||
unsigned char dacVolTable[128];
|
unsigned char dacVolTable[128];
|
||||||
|
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
|
@ -160,7 +155,6 @@ class DivPlatformGenesis: public DivDispatch, public DivPlatformOPNBase {
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void quit();
|
void quit();
|
||||||
DivPlatformGenesis():
|
DivPlatformGenesis():
|
||||||
DivDispatch(),
|
|
||||||
DivPlatformOPNBase(9440540.0, 72, 32) {}
|
DivPlatformOPNBase(9440540.0, 72, 32) {}
|
||||||
~DivPlatformGenesis();
|
~DivPlatformGenesis();
|
||||||
};
|
};
|
||||||
|
|
|
@ -19,18 +19,17 @@
|
||||||
|
|
||||||
#ifndef _TX81Z_H
|
#ifndef _TX81Z_H
|
||||||
#define _TX81Z_H
|
#define _TX81Z_H
|
||||||
#include "../dispatch.h"
|
#include "fmshared_OPM.h"
|
||||||
#include "../macroInt.h"
|
#include "../macroInt.h"
|
||||||
#include "../instrument.h"
|
#include "../instrument.h"
|
||||||
#include <queue>
|
#include <queue>
|
||||||
#include "sound/ymfm/ymfm_opz.h"
|
#include "sound/ymfm/ymfm_opz.h"
|
||||||
#include "fmshared_OPM.h"
|
|
||||||
|
|
||||||
class DivTXInterface: public ymfm::ymfm_interface {
|
class DivTXInterface: public ymfm::ymfm_interface {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DivPlatformTX81Z: public DivDispatch, public DivPlatformOPMBase {
|
class DivPlatformTX81Z: public DivPlatformOPMBase {
|
||||||
protected:
|
protected:
|
||||||
const unsigned short chanOffs[8]={
|
const unsigned short chanOffs[8]={
|
||||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
|
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
|
||||||
|
@ -82,15 +81,10 @@ class DivPlatformTX81Z: public DivDispatch, public DivPlatformOPMBase {
|
||||||
ymfm::ym2414::output_data out_ymfm;
|
ymfm::ym2414::output_data out_ymfm;
|
||||||
DivTXInterface iface;
|
DivTXInterface iface;
|
||||||
|
|
||||||
unsigned char regPool[330];
|
|
||||||
|
|
||||||
bool extMode;
|
bool extMode;
|
||||||
|
|
||||||
bool isMuted[8];
|
bool isMuted[8];
|
||||||
|
|
||||||
short oldWrites[330];
|
|
||||||
short pendingWrites[330];
|
|
||||||
|
|
||||||
int octave(int freq);
|
int octave(int freq);
|
||||||
int toFreq(int freq);
|
int toFreq(int freq);
|
||||||
|
|
||||||
|
|
|
@ -19,18 +19,17 @@
|
||||||
|
|
||||||
#ifndef _YM2203_H
|
#ifndef _YM2203_H
|
||||||
#define _YM2203_H
|
#define _YM2203_H
|
||||||
#include "../dispatch.h"
|
#include "fmshared_OPN.h"
|
||||||
#include "../macroInt.h"
|
#include "../macroInt.h"
|
||||||
#include "sound/ymfm/ymfm_opn.h"
|
#include "sound/ymfm/ymfm_opn.h"
|
||||||
|
|
||||||
#include "ay.h"
|
#include "ay.h"
|
||||||
#include "fmshared_OPN.h"
|
|
||||||
|
|
||||||
class DivYM2203Interface: public ymfm::ymfm_interface {
|
class DivYM2203Interface: public ymfm::ymfm_interface {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DivPlatformYM2203: public DivDispatch, public DivPlatformOPNBase {
|
class DivPlatformYM2203: public DivPlatformOPNBase {
|
||||||
protected:
|
protected:
|
||||||
const unsigned short chanOffs[3]={
|
const unsigned short chanOffs[3]={
|
||||||
0x00, 0x01, 0x02
|
0x00, 0x01, 0x02
|
||||||
|
@ -86,16 +85,12 @@ class DivPlatformYM2203: public DivDispatch, public DivPlatformOPNBase {
|
||||||
ymfm::ym2203* fm;
|
ymfm::ym2203* fm;
|
||||||
ymfm::ym2203::output_data fmout;
|
ymfm::ym2203::output_data fmout;
|
||||||
DivYM2203Interface iface;
|
DivYM2203Interface iface;
|
||||||
unsigned char regPool[256];
|
|
||||||
|
|
||||||
DivPlatformAY8910* ay;
|
DivPlatformAY8910* ay;
|
||||||
unsigned char sampleBank;
|
unsigned char sampleBank;
|
||||||
|
|
||||||
bool extMode;
|
bool extMode;
|
||||||
|
|
||||||
short oldWrites[256];
|
|
||||||
short pendingWrites[256];
|
|
||||||
|
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -123,7 +118,6 @@ class DivPlatformYM2203: public DivDispatch, public DivPlatformOPNBase {
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void quit();
|
void quit();
|
||||||
DivPlatformYM2203():
|
DivPlatformYM2203():
|
||||||
DivDispatch(),
|
|
||||||
DivPlatformOPNBase(4720270.0, 36, 16) {}
|
DivPlatformOPNBase(4720270.0, 36, 16) {}
|
||||||
~DivPlatformYM2203();
|
~DivPlatformYM2203();
|
||||||
};
|
};
|
||||||
|
|
|
@ -19,12 +19,11 @@
|
||||||
|
|
||||||
#ifndef _YM2608_H
|
#ifndef _YM2608_H
|
||||||
#define _YM2608_H
|
#define _YM2608_H
|
||||||
#include "../dispatch.h"
|
#include "fmshared_OPN.h"
|
||||||
#include "../macroInt.h"
|
#include "../macroInt.h"
|
||||||
#include "sound/ymfm/ymfm_opn.h"
|
#include "sound/ymfm/ymfm_opn.h"
|
||||||
|
|
||||||
#include "ay.h"
|
#include "ay.h"
|
||||||
#include "fmshared_OPN.h"
|
|
||||||
|
|
||||||
class DivYM2608Interface: public ymfm::ymfm_interface {
|
class DivYM2608Interface: public ymfm::ymfm_interface {
|
||||||
public:
|
public:
|
||||||
|
@ -35,7 +34,7 @@ class DivYM2608Interface: public ymfm::ymfm_interface {
|
||||||
DivYM2608Interface(): adpcmBMem(NULL), sampleBank(0) {}
|
DivYM2608Interface(): adpcmBMem(NULL), sampleBank(0) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class DivPlatformYM2608: public DivDispatch, public DivPlatformOPNBase {
|
class DivPlatformYM2608: public DivPlatformOPNBase {
|
||||||
protected:
|
protected:
|
||||||
const unsigned short chanOffs[6]={
|
const unsigned short chanOffs[6]={
|
||||||
0x00, 0x01, 0x02, 0x100, 0x101, 0x102
|
0x00, 0x01, 0x02, 0x100, 0x101, 0x102
|
||||||
|
@ -92,7 +91,6 @@ class DivPlatformYM2608: public DivDispatch, public DivPlatformOPNBase {
|
||||||
bool isMuted[16];
|
bool isMuted[16];
|
||||||
ymfm::ym2608* fm;
|
ymfm::ym2608* fm;
|
||||||
ymfm::ym2608::output_data fmout;
|
ymfm::ym2608::output_data fmout;
|
||||||
unsigned char regPool[512];
|
|
||||||
|
|
||||||
unsigned char* adpcmBMem;
|
unsigned char* adpcmBMem;
|
||||||
size_t adpcmBMemLen;
|
size_t adpcmBMemLen;
|
||||||
|
@ -106,9 +104,6 @@ class DivPlatformYM2608: public DivDispatch, public DivPlatformOPNBase {
|
||||||
double fmFreqBase;
|
double fmFreqBase;
|
||||||
unsigned char ayDiv;
|
unsigned char ayDiv;
|
||||||
|
|
||||||
short oldWrites[512];
|
|
||||||
short pendingWrites[512];
|
|
||||||
|
|
||||||
double NOTE_OPNB(int ch, int note);
|
double NOTE_OPNB(int ch, int note);
|
||||||
double NOTE_ADPCMB(int note);
|
double NOTE_ADPCMB(int note);
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
|
@ -142,7 +137,6 @@ class DivPlatformYM2608: public DivDispatch, public DivPlatformOPNBase {
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void quit();
|
void quit();
|
||||||
DivPlatformYM2608():
|
DivPlatformYM2608():
|
||||||
DivDispatch(),
|
|
||||||
DivPlatformOPNBase(9440540.0, 72, 32) {}
|
DivPlatformOPNBase(9440540.0, 72, 32) {}
|
||||||
~DivPlatformYM2608();
|
~DivPlatformYM2608();
|
||||||
};
|
};
|
||||||
|
|
|
@ -19,10 +19,9 @@
|
||||||
|
|
||||||
#ifndef _YM2610_H
|
#ifndef _YM2610_H
|
||||||
#define _YM2610_H
|
#define _YM2610_H
|
||||||
#include "../dispatch.h"
|
#include "fmshared_OPN.h"
|
||||||
#include "../macroInt.h"
|
#include "../macroInt.h"
|
||||||
#include "ay.h"
|
#include "ay.h"
|
||||||
#include "fmshared_OPN.h"
|
|
||||||
#include "sound/ymfm/ymfm_opn.h"
|
#include "sound/ymfm/ymfm_opn.h"
|
||||||
|
|
||||||
class DivYM2610Interface: public ymfm::ymfm_interface {
|
class DivYM2610Interface: public ymfm::ymfm_interface {
|
||||||
|
@ -35,7 +34,7 @@ class DivYM2610Interface: public ymfm::ymfm_interface {
|
||||||
DivYM2610Interface(): adpcmAMem(NULL), adpcmBMem(NULL), sampleBank(0) {}
|
DivYM2610Interface(): adpcmAMem(NULL), adpcmBMem(NULL), sampleBank(0) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class DivPlatformYM2610Base: public DivDispatch, public DivPlatformOPNBase {
|
class DivPlatformYM2610Base: public DivPlatformOPNBase {
|
||||||
protected:
|
protected:
|
||||||
unsigned char* adpcmAMem;
|
unsigned char* adpcmAMem;
|
||||||
size_t adpcmAMemLen;
|
size_t adpcmAMemLen;
|
||||||
|
@ -51,7 +50,6 @@ class DivPlatformYM2610Base: public DivDispatch, public DivPlatformOPNBase {
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void quit();
|
void quit();
|
||||||
DivPlatformYM2610Base():
|
DivPlatformYM2610Base():
|
||||||
DivDispatch(),
|
|
||||||
DivPlatformOPNBase(9440540.0, 72, 32) {}
|
DivPlatformOPNBase(9440540.0, 72, 32) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -118,15 +116,11 @@ class DivPlatformYM2610: public DivPlatformYM2610Base {
|
||||||
ymfm::ym2610::output_data fmout;
|
ymfm::ym2610::output_data fmout;
|
||||||
|
|
||||||
DivPlatformAY8910* ay;
|
DivPlatformAY8910* ay;
|
||||||
unsigned char regPool[512];
|
|
||||||
|
|
||||||
unsigned char sampleBank;
|
unsigned char sampleBank;
|
||||||
|
|
||||||
bool extMode;
|
bool extMode;
|
||||||
|
|
||||||
short oldWrites[512];
|
|
||||||
short pendingWrites[512];
|
|
||||||
|
|
||||||
double NOTE_OPNB(int ch, int note);
|
double NOTE_OPNB(int ch, int note);
|
||||||
double NOTE_ADPCMB(int note);
|
double NOTE_ADPCMB(int note);
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
|
|
|
@ -19,12 +19,11 @@
|
||||||
|
|
||||||
#ifndef _YM2610B_H
|
#ifndef _YM2610B_H
|
||||||
#define _YM2610B_H
|
#define _YM2610B_H
|
||||||
#include "../dispatch.h"
|
#include "ym2610.h"
|
||||||
#include "../macroInt.h"
|
#include "../macroInt.h"
|
||||||
#include <queue>
|
#include <queue>
|
||||||
#include "sound/ymfm/ymfm_opn.h"
|
#include "sound/ymfm/ymfm_opn.h"
|
||||||
|
|
||||||
#include "ym2610.h"
|
|
||||||
|
|
||||||
class DivPlatformYM2610B: public DivPlatformYM2610Base {
|
class DivPlatformYM2610B: public DivPlatformYM2610Base {
|
||||||
protected:
|
protected:
|
||||||
|
@ -83,7 +82,6 @@ class DivPlatformYM2610B: public DivPlatformYM2610Base {
|
||||||
bool isMuted[16];
|
bool isMuted[16];
|
||||||
ymfm::ym2610b* fm;
|
ymfm::ym2610b* fm;
|
||||||
ymfm::ym2610b::output_data fmout;
|
ymfm::ym2610b::output_data fmout;
|
||||||
unsigned char regPool[512];
|
|
||||||
|
|
||||||
DivPlatformAY8910* ay;
|
DivPlatformAY8910* ay;
|
||||||
unsigned char sampleBank;
|
unsigned char sampleBank;
|
||||||
|
@ -92,9 +90,6 @@ class DivPlatformYM2610B: public DivPlatformYM2610Base {
|
||||||
double fmFreqBase=9440540;
|
double fmFreqBase=9440540;
|
||||||
unsigned char ayDiv=32;
|
unsigned char ayDiv=32;
|
||||||
|
|
||||||
short oldWrites[512];
|
|
||||||
short pendingWrites[512];
|
|
||||||
|
|
||||||
double NOTE_OPNB(int ch, int note);
|
double NOTE_OPNB(int ch, int note);
|
||||||
double NOTE_ADPCMB(int note);
|
double NOTE_ADPCMB(int note);
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
|
|
Loading…
Reference in New Issue