furnace/src/engine/platform/genesis.h

57 lines
1.4 KiB
C
Raw Normal View History

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, portaPause;
int vol;
2021-05-16 22:43:10 +00:00
unsigned char pan;
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 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;
bool extMode;
2021-05-16 22:43:10 +00:00
short oldWrites[512];
short pendingWrites[512];
int octave(int freq);
int toFreq(int freq);
2021-05-16 22:43:10 +00:00
2021-05-12 22:19:18 +00:00
public:
void acquire(short** buf, size_t start, size_t len);
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