2021-05-16 18:43:10 -04:00
|
|
|
#ifndef _GENESIS_H
|
|
|
|
#define _GENESIS_H
|
2021-05-12 18:19:18 -04:00
|
|
|
#include "../dispatch.h"
|
|
|
|
#include <queue>
|
|
|
|
#include "../../../extern/Nuked-OPN2/ym3438.h"
|
|
|
|
|
2021-05-15 17:59:57 -04:00
|
|
|
#include "sms.h"
|
|
|
|
|
2021-05-12 18:19:18 -04:00
|
|
|
class DivPlatformGenesis: public DivDispatch {
|
2021-05-16 18:43:10 -04:00
|
|
|
protected:
|
|
|
|
struct Channel {
|
|
|
|
unsigned char freqH, freqL;
|
|
|
|
int freq, baseFreq, pitch;
|
|
|
|
unsigned char ins;
|
|
|
|
signed char konCycles;
|
2021-05-19 15:39:39 -04:00
|
|
|
bool active, insChanged, freqChanged, keyOn, keyOff, portaPause;
|
2021-05-17 16:51:12 -04:00
|
|
|
int vol;
|
2021-05-16 18:43:10 -04:00
|
|
|
unsigned char pan;
|
2021-05-19 15:39:39 -04:00
|
|
|
Channel(): freqH(0), freqL(0), freq(0), baseFreq(0), pitch(0), ins(-1), active(false), insChanged(true), freqChanged(false), keyOn(false), keyOff(false), portaPause(false), vol(0), pan(3) {}
|
2021-05-16 18:43:10 -04: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-16 21:49:54 -04:00
|
|
|
|
|
|
|
bool extMode;
|
2021-05-16 18:43:10 -04:00
|
|
|
|
|
|
|
short oldWrites[512];
|
|
|
|
short pendingWrites[512];
|
2021-05-18 02:20:38 -04:00
|
|
|
|
|
|
|
int octave(int freq);
|
2021-05-19 15:39:39 -04:00
|
|
|
int toFreq(int freq);
|
2021-05-16 18:43:10 -04:00
|
|
|
|
2021-05-12 18:19:18 -04:00
|
|
|
public:
|
2021-12-06 16:51:18 -05:00
|
|
|
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
2021-05-12 18:19:18 -04:00
|
|
|
int dispatch(DivCommand c);
|
|
|
|
void tick();
|
2021-12-06 16:51:18 -05:00
|
|
|
bool isStereo();
|
2021-12-08 00:33:00 -05:00
|
|
|
bool keyOffAffectsArp(int ch);
|
2021-05-12 18:19:18 -04:00
|
|
|
int init(DivEngine* parent, int channels, int sugRate);
|
|
|
|
};
|
2021-05-16 18:43:10 -04:00
|
|
|
#endif
|