SNES: Fix wavesynth and channel 1
This commit is contained in:
parent
7956d41f1b
commit
18d793dc20
|
@ -83,7 +83,6 @@ void DivPlatformSNES::acquire(short* bufL, short* bufR, size_t start, size_t len
|
||||||
void DivPlatformSNES::tick(bool sysTick) {
|
void DivPlatformSNES::tick(bool sysTick) {
|
||||||
// KON/KOFF can't be written several times per one sample
|
// KON/KOFF can't be written several times per one sample
|
||||||
// so they have to be accumulated
|
// so they have to be accumulated
|
||||||
// TODO due to pipelining, KON/KOFF writes need to be delayed to accomodate sample address changes in the table
|
|
||||||
unsigned char kon=0;
|
unsigned char kon=0;
|
||||||
unsigned char koff=0;
|
unsigned char koff=0;
|
||||||
for (int i=0; i<8; i++) {
|
for (int i=0; i<8; i++) {
|
||||||
|
@ -203,7 +202,10 @@ void DivPlatformSNES::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rWrite(0x4c,kon);
|
if (kon!=0) {
|
||||||
|
rWrite(0x4c,kon);
|
||||||
|
}
|
||||||
|
// always write KOFF as it's constantly polled
|
||||||
rWrite(0x5c,koff);
|
rWrite(0x5c,koff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,7 +215,7 @@ int DivPlatformSNES::dispatch(DivCommand c) {
|
||||||
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_AMIGA);
|
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_AMIGA);
|
||||||
if (ins->amiga.useWave) {
|
if (ins->amiga.useWave) {
|
||||||
chan[c.chan].useWave=true;
|
chan[c.chan].useWave=true;
|
||||||
chan[c.chan].wtLen=(unsigned int)(ins->amiga.waveLen)+1;
|
chan[c.chan].wtLen=ins->amiga.waveLen+1;
|
||||||
if (chan[c.chan].insChanged) {
|
if (chan[c.chan].insChanged) {
|
||||||
if (chan[c.chan].wave<0) {
|
if (chan[c.chan].wave<0) {
|
||||||
chan[c.chan].wave=0;
|
chan[c.chan].wave=0;
|
||||||
|
@ -221,6 +223,7 @@ int DivPlatformSNES::dispatch(DivCommand c) {
|
||||||
chan[c.chan].ws.changeWave1(chan[c.chan].wave);
|
chan[c.chan].ws.changeWave1(chan[c.chan].wave);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
chan[c.chan].ws.init(ins,chan[c.chan].wtLen,15,chan[c.chan].insChanged);
|
||||||
} else {
|
} else {
|
||||||
chan[c.chan].sample=ins->amiga.getSample(c.value);
|
chan[c.chan].sample=ins->amiga.getSample(c.value);
|
||||||
chan[c.chan].useWave=false;
|
chan[c.chan].useWave=false;
|
||||||
|
@ -404,7 +407,7 @@ void DivPlatformSNES::reset() {
|
||||||
dsp.set_output(NULL,0);
|
dsp.set_output(NULL,0);
|
||||||
memset(regPool,0,128);
|
memset(regPool,0,128);
|
||||||
// TODO more initial values
|
// TODO more initial values
|
||||||
sampleTableBase=0;
|
sampleTableBase=0x100; // hack: this can't be 0 or channel 1 won't play??
|
||||||
rWrite(0x5d,sampleTableBase>>8);
|
rWrite(0x5d,sampleTableBase>>8);
|
||||||
rWrite(0x0c,127); // global volume left
|
rWrite(0x0c,127); // global volume left
|
||||||
rWrite(0x1c,127); // global volume right
|
rWrite(0x1c,127); // global volume right
|
||||||
|
|
|
@ -29,12 +29,13 @@
|
||||||
class DivPlatformSNES: public DivDispatch {
|
class DivPlatformSNES: public DivDispatch {
|
||||||
struct Channel {
|
struct Channel {
|
||||||
int freq, baseFreq, pitch, pitch2;
|
int freq, baseFreq, pitch, pitch2;
|
||||||
unsigned int audPos, wtLen;
|
unsigned int audPos;
|
||||||
int sample, wave, ins;
|
int sample, wave, ins;
|
||||||
int note;
|
int note;
|
||||||
int panL, panR;
|
int panL, panR;
|
||||||
bool active, insChanged, freqChanged, keyOn, keyOff, inPorta, useWave, setPos;
|
bool active, insChanged, freqChanged, keyOn, keyOff, inPorta, useWave, setPos;
|
||||||
signed char vol;
|
signed char vol;
|
||||||
|
int wtLen;
|
||||||
bool useEnv;
|
bool useEnv;
|
||||||
DivMacroInt std;
|
DivMacroInt std;
|
||||||
DivWaveSynth ws;
|
DivWaveSynth ws;
|
||||||
|
@ -48,7 +49,6 @@ class DivPlatformSNES: public DivDispatch {
|
||||||
pitch(0),
|
pitch(0),
|
||||||
pitch2(0),
|
pitch2(0),
|
||||||
audPos(0),
|
audPos(0),
|
||||||
wtLen(16),
|
|
||||||
sample(-1),
|
sample(-1),
|
||||||
wave(-1),
|
wave(-1),
|
||||||
ins(-1),
|
ins(-1),
|
||||||
|
@ -64,6 +64,7 @@ class DivPlatformSNES: public DivDispatch {
|
||||||
useWave(false),
|
useWave(false),
|
||||||
setPos(false),
|
setPos(false),
|
||||||
vol(127),
|
vol(127),
|
||||||
|
wtLen(16),
|
||||||
useEnv(false) {}
|
useEnv(false) {}
|
||||||
};
|
};
|
||||||
Channel chan[8];
|
Channel chan[8];
|
||||||
|
|
Loading…
Reference in New Issue