furnace/src/engine/platform/pce.h

53 lines
1.1 KiB
C
Raw Normal View History

#ifndef _PCE_H
#define _PCE_H
#include "../dispatch.h"
2021-06-07 07:49:43 +00:00
#include <queue>
#include "../macroInt.h"
#include "sound/pce_psg.h"
class DivPlatformPCE: public DivDispatch {
struct Channel {
int freq, baseFreq, pitch;
2021-06-07 07:49:43 +00:00
unsigned char ins, note, duty, pan;
bool active, insChanged, freqChanged, keyOn, keyOff, inPorta;
signed char vol, outVol, wave;
DivMacroInt std;
Channel():
freq(0),
baseFreq(0),
pitch(0),
ins(-1),
note(0),
duty(0),
2021-06-07 07:49:43 +00:00
pan(255),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
inPorta(false),
2021-06-07 07:49:43 +00:00
vol(31),
wave(-1) {}
};
2021-06-07 07:49:43 +00:00
Channel chan[6];
struct QueuedWrite {
unsigned char addr;
unsigned char val;
QueuedWrite(unsigned char a, unsigned char v): addr(a), val(v) {}
};
std::queue<QueuedWrite> writes;
unsigned char lastPan;
2021-06-07 07:49:43 +00:00
int tempL, tempR, cycles, curChan, delay;
PCE_PSG* pce;
2021-06-07 07:49:43 +00:00
void updateWave(int ch);
public:
void acquire(int& l, int& r);
int dispatch(DivCommand c);
void tick();
int init(DivEngine* parent, int channels, int sugRate);
};
#endif