2021-05-26 04:17:12 -04:00
|
|
|
#ifndef _GB_H
|
|
|
|
#define _GB_H
|
|
|
|
|
|
|
|
#include "../dispatch.h"
|
|
|
|
#include "../macroInt.h"
|
|
|
|
#include "sound/gb/gb.h"
|
|
|
|
|
|
|
|
class DivPlatformGB: public DivDispatch {
|
|
|
|
struct Channel {
|
2022-01-20 16:56:35 -05:00
|
|
|
int freq, baseFreq, pitch, note;
|
|
|
|
unsigned char ins, duty, sweep;
|
2021-05-28 03:30:09 -04:00
|
|
|
bool active, insChanged, freqChanged, sweepChanged, keyOn, keyOff, inPorta;
|
2021-05-27 17:47:09 -04:00
|
|
|
signed char vol, outVol, wave;
|
2021-05-26 04:17:12 -04:00
|
|
|
DivMacroInt std;
|
|
|
|
Channel():
|
|
|
|
freq(0),
|
|
|
|
baseFreq(0),
|
|
|
|
pitch(0),
|
|
|
|
note(0),
|
2022-01-20 16:56:35 -05:00
|
|
|
ins(-1),
|
2021-05-26 18:43:14 -04:00
|
|
|
duty(0),
|
2021-05-28 02:26:57 -04:00
|
|
|
sweep(0),
|
2021-05-26 04:17:12 -04:00
|
|
|
active(false),
|
|
|
|
insChanged(true),
|
|
|
|
freqChanged(false),
|
2021-05-28 02:26:57 -04:00
|
|
|
sweepChanged(false),
|
2021-05-26 04:17:12 -04:00
|
|
|
keyOn(false),
|
|
|
|
keyOff(false),
|
2021-05-28 03:30:09 -04:00
|
|
|
inPorta(false),
|
2021-05-28 00:03:10 -04:00
|
|
|
vol(15),
|
2022-01-26 18:03:25 -05:00
|
|
|
outVol(15),
|
2021-05-28 00:03:10 -04:00
|
|
|
wave(-1) {}
|
2021-05-26 04:17:12 -04:00
|
|
|
};
|
|
|
|
Channel chan[4];
|
2021-12-18 03:25:42 -05:00
|
|
|
bool isMuted[4];
|
2021-05-28 00:33:04 -04:00
|
|
|
unsigned char lastPan;
|
2021-05-26 18:43:14 -04:00
|
|
|
|
2021-05-26 04:17:12 -04:00
|
|
|
GB_gameboy_t* gb;
|
2021-12-18 03:25:42 -05:00
|
|
|
unsigned char procMute();
|
2021-05-27 14:30:37 -04:00
|
|
|
void updateWave();
|
2022-01-27 00:29:16 -05:00
|
|
|
friend void putDispatchChan(void*,int,int);
|
2021-05-26 04:17:12 -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-26 04:17:12 -04:00
|
|
|
int dispatch(DivCommand c);
|
2022-01-27 00:29:16 -05:00
|
|
|
void* getChanState(int chan);
|
2021-12-11 13:14:38 -05:00
|
|
|
void reset();
|
2021-12-21 01:29:07 -05:00
|
|
|
void forceIns();
|
2021-05-26 04:17:12 -04:00
|
|
|
void tick();
|
2021-12-18 03:25:42 -05:00
|
|
|
void muteChannel(int ch, bool mute);
|
2021-12-06 16:51:18 -05:00
|
|
|
bool isStereo();
|
2022-01-17 23:59:52 -05:00
|
|
|
void notifyInsChange(int ins);
|
2022-01-18 00:25:10 -05:00
|
|
|
void notifyWaveChange(int wave);
|
2022-01-13 19:36:02 -05:00
|
|
|
void notifyInsDeletion(void* ins);
|
2022-02-01 18:08:19 -05:00
|
|
|
void poke(unsigned int addr, unsigned short val);
|
|
|
|
void poke(std::vector<DivRegWrite>& wlist);
|
2022-02-03 18:38:57 -05:00
|
|
|
const char** getRegisterSheet();
|
2022-01-28 12:59:53 -05:00
|
|
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
2021-12-15 00:37:27 -05:00
|
|
|
void quit();
|
|
|
|
~DivPlatformGB();
|
2021-05-26 04:17:12 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|