2021-05-16 22:43:10 +00:00
|
|
|
#ifndef _GENESIS_H
|
|
|
|
#define _GENESIS_H
|
2021-05-12 22:19:18 +00:00
|
|
|
#include "../dispatch.h"
|
|
|
|
#include <queue>
|
|
|
|
#include "../../../extern/Nuked-OPN2/ym3438.h"
|
|
|
|
|
2021-05-15 21:59:57 +00:00
|
|
|
#include "sms.h"
|
|
|
|
|
2021-05-12 22:19:18 +00:00
|
|
|
class DivPlatformGenesis: public DivDispatch {
|
2021-05-16 22:43:10 +00:00
|
|
|
protected:
|
|
|
|
struct Channel {
|
|
|
|
unsigned char freqH, freqL;
|
|
|
|
int freq, baseFreq, pitch;
|
|
|
|
unsigned char ins;
|
|
|
|
signed char konCycles;
|
|
|
|
bool active, insChanged, freqChanged, keyOn, keyOff;
|
2021-05-17 20:51:12 +00:00
|
|
|
int vol;
|
2021-05-16 22:43:10 +00:00
|
|
|
unsigned char pan;
|
2021-05-17 01:49:54 +00:00
|
|
|
Channel(): freqH(0), freqL(0), freq(0), baseFreq(0), pitch(0), ins(-1), active(false), insChanged(true), freqChanged(false), keyOn(false), keyOff(false), vol(0), pan(3) {}
|
2021-05-16 22:43:10 +00:00
|
|
|
};
|
|
|
|
Channel chan[10];
|
|
|
|
struct QueuedWrite {
|
|
|
|
unsigned short addr;
|
|
|
|
unsigned char val;
|
|
|
|
bool addrOrVal;
|
|
|
|
QueuedWrite(unsigned short a, unsigned char v): addr(a), val(v), addrOrVal(false) {}
|
|
|
|
};
|
|
|
|
std::queue<QueuedWrite> writes;
|
|
|
|
ym3438_t fm;
|
|
|
|
DivPlatformSMS psg;
|
|
|
|
int psgClocks;
|
|
|
|
int psgOut;
|
|
|
|
int delay;
|
|
|
|
unsigned char lastBusy;
|
|
|
|
|
|
|
|
bool dacMode;
|
|
|
|
int dacPeriod;
|
|
|
|
int dacRate;
|
|
|
|
int dacPos;
|
|
|
|
int dacSample;
|
2021-05-17 01:49:54 +00:00
|
|
|
|
|
|
|
bool extMode;
|
2021-05-16 22:43:10 +00:00
|
|
|
|
|
|
|
short oldWrites[512];
|
|
|
|
short pendingWrites[512];
|
2021-05-18 06:20:38 +00:00
|
|
|
|
|
|
|
int octave(int freq);
|
2021-05-16 22:43:10 +00:00
|
|
|
|
2021-05-12 22:19:18 +00:00
|
|
|
public:
|
2021-05-16 08:03:23 +00:00
|
|
|
void acquire(int& l, int& r);
|
2021-05-12 22:19:18 +00:00
|
|
|
int dispatch(DivCommand c);
|
|
|
|
void tick();
|
|
|
|
int init(DivEngine* parent, int channels, int sugRate);
|
|
|
|
};
|
2021-05-16 22:43:10 +00:00
|
|
|
#endif
|