2021-05-26 08:17:12 +00: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 21:56:35 +00:00
|
|
|
int freq, baseFreq, pitch, note;
|
|
|
|
unsigned char ins, duty, sweep;
|
2021-05-28 07:30:09 +00:00
|
|
|
bool active, insChanged, freqChanged, sweepChanged, keyOn, keyOff, inPorta;
|
2021-05-27 21:47:09 +00:00
|
|
|
signed char vol, outVol, wave;
|
2021-05-26 08:17:12 +00:00
|
|
|
DivMacroInt std;
|
|
|
|
Channel():
|
|
|
|
freq(0),
|
|
|
|
baseFreq(0),
|
|
|
|
pitch(0),
|
|
|
|
note(0),
|
2022-01-20 21:56:35 +00:00
|
|
|
ins(-1),
|
2021-05-26 22:43:14 +00:00
|
|
|
duty(0),
|
2021-05-28 06:26:57 +00:00
|
|
|
sweep(0),
|
2021-05-26 08:17:12 +00:00
|
|
|
active(false),
|
|
|
|
insChanged(true),
|
|
|
|
freqChanged(false),
|
2021-05-28 06:26:57 +00:00
|
|
|
sweepChanged(false),
|
2021-05-26 08:17:12 +00:00
|
|
|
keyOn(false),
|
|
|
|
keyOff(false),
|
2021-05-28 07:30:09 +00:00
|
|
|
inPorta(false),
|
2021-05-28 04:03:10 +00:00
|
|
|
vol(15),
|
|
|
|
wave(-1) {}
|
2021-05-26 08:17:12 +00:00
|
|
|
};
|
|
|
|
Channel chan[4];
|
2021-12-18 08:25:42 +00:00
|
|
|
bool isMuted[4];
|
2021-05-28 04:33:04 +00:00
|
|
|
unsigned char lastPan;
|
2021-05-26 22:43:14 +00:00
|
|
|
|
2021-05-26 08:17:12 +00:00
|
|
|
GB_gameboy_t* gb;
|
2021-12-18 08:25:42 +00:00
|
|
|
unsigned char procMute();
|
2021-05-27 18:30:37 +00:00
|
|
|
void updateWave();
|
2021-05-26 08:17:12 +00:00
|
|
|
public:
|
2021-12-06 21:51:18 +00:00
|
|
|
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
2021-05-26 08:17:12 +00:00
|
|
|
int dispatch(DivCommand c);
|
2021-12-11 18:14:38 +00:00
|
|
|
void reset();
|
2021-12-21 06:29:07 +00:00
|
|
|
void forceIns();
|
2021-05-26 08:17:12 +00:00
|
|
|
void tick();
|
2021-12-18 08:25:42 +00:00
|
|
|
void muteChannel(int ch, bool mute);
|
2021-12-06 21:51:18 +00:00
|
|
|
bool isStereo();
|
2022-01-18 04:59:52 +00:00
|
|
|
void notifyInsChange(int ins);
|
2022-01-18 05:25:10 +00:00
|
|
|
void notifyWaveChange(int wave);
|
2022-01-14 00:36:02 +00:00
|
|
|
void notifyInsDeletion(void* ins);
|
2021-12-08 06:56:40 +00:00
|
|
|
int init(DivEngine* parent, int channels, int sugRate, bool pal);
|
2021-12-15 05:37:27 +00:00
|
|
|
void quit();
|
|
|
|
~DivPlatformGB();
|
2021-05-26 08:17:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|