mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-27 06:53:01 +00:00
game boy progress, part 2
This commit is contained in:
parent
a1ab7c5d57
commit
d6398ac10e
2 changed files with 14 additions and 6 deletions
|
@ -47,8 +47,13 @@ void DivPlatformGB::tick() {
|
|||
}
|
||||
}
|
||||
if (chan[i].std.hadWave) {
|
||||
if (chan[i].wave!=chan[i].std.wave) {
|
||||
chan[i].wave=chan[i].std.wave;
|
||||
if (i==2) updateWave();
|
||||
if (i==2) {
|
||||
updateWave();
|
||||
if (!chan[i].keyOff) chan[i].keyOn=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
|
||||
chan[i].freq=(chan[i].baseFreq*(ONE_SEMITONE-chan[i].pitch))/ONE_SEMITONE;
|
||||
|
@ -56,6 +61,10 @@ void DivPlatformGB::tick() {
|
|||
if (chan[i].keyOn) {
|
||||
DivInstrument* ins=parent->getIns(chan[i].ins);
|
||||
if (i==2) { // wave
|
||||
if (chan[i].wave<0) {
|
||||
chan[i].wave=0;
|
||||
updateWave();
|
||||
}
|
||||
rWrite(16+i*5,0x80);
|
||||
rWrite(16+i*5+2,gbVolMap[chan[i].vol]);
|
||||
} else {
|
||||
|
@ -94,7 +103,6 @@ int DivPlatformGB::dispatch(DivCommand c) {
|
|||
chan[c.chan].note=c.value;
|
||||
chan[c.chan].active=true;
|
||||
chan[c.chan].keyOn=true;
|
||||
if (c.chan==2) updateWave();
|
||||
chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
|
||||
break;
|
||||
case DIV_CMD_NOTE_OFF:
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
class DivPlatformGB: public DivDispatch {
|
||||
struct Channel {
|
||||
int freq, baseFreq, pitch;
|
||||
unsigned char ins, note, duty, wave;
|
||||
unsigned char ins, note, duty;
|
||||
bool active, insChanged, freqChanged, keyOn, keyOff;
|
||||
signed char vol, outVol;
|
||||
signed char vol, outVol, wave;
|
||||
DivMacroInt std;
|
||||
Channel():
|
||||
freq(0),
|
||||
|
@ -19,7 +19,7 @@ class DivPlatformGB: public DivDispatch {
|
|||
ins(-1),
|
||||
note(0),
|
||||
duty(0),
|
||||
wave(0),
|
||||
wave(-1),
|
||||
active(false),
|
||||
insChanged(true),
|
||||
freqChanged(false),
|
||||
|
|
Loading…
Reference in a new issue