a couple corrections

SID3 will have data independent of C64 and SID2
This commit is contained in:
tildearrow 2024-09-13 23:08:25 -05:00
parent 1458ecc165
commit 0b0e6d5e13
10 changed files with 100 additions and 67 deletions

View file

@ -864,9 +864,13 @@ struct DivInstrumentSID2 {
noiseMode(0) {}
};
struct DivInstrumentSID3
struct DivInstrumentSID3
{
bool triOn, sawOn, pulseOn, noiseOn;
unsigned char a, d, s, r;
unsigned char sr;
unsigned short duty;
unsigned char ringMod, oscSync;
bool phase_mod;
unsigned char phase_mod_source, ring_mod_source, sync_source;
bool specialWaveOn;
@ -874,8 +878,11 @@ struct DivInstrumentSID3
bool separateNoisePitch;
unsigned char special_wave;
bool doWavetable;
bool dutyIsAbs;
bool resetDuty;
unsigned char phaseInv;
unsigned char feedback;
unsigned char mixMode;
struct Filter
{
@ -935,7 +942,18 @@ struct DivInstrumentSID3
return !(*this==other);
}
DivInstrumentSID3():
triOn(false),
sawOn(true),
pulseOn(false),
noiseOn(false),
a(0),
d(8),
s(0),
r(0),
sr(0),
duty(2048),
ringMod(0),
oscSync(0),
phase_mod(false),
phase_mod_source(0),
ring_mod_source(0),
@ -945,8 +963,11 @@ struct DivInstrumentSID3
separateNoisePitch(false),
special_wave(0),
doWavetable(false),
dutyIsAbs(true),
resetDuty(false),
phaseInv(0),
feedback(0)
feedback(0),
mixMode(0)
{
filt[0].mode = 16 | 32; //default settings so filter just works, connect to input and channel output
filt[0].output_volume = 0xff;

View file

@ -383,7 +383,7 @@ void DivPlatformSID3::tick(bool sysTick)
}
if (chan[i].std.duty.had) {
DivInstrument* ins=parent->getIns(chan[i].ins,DIV_INS_SID3);
if (ins->c64.dutyIsAbs) {
if (ins->sid3.dutyIsAbs) {
chan[i].duty=chan[i].std.duty.val;
} else {
chan[i].duty-=chan[i].std.duty.val;
@ -846,28 +846,28 @@ int DivPlatformSID3::dispatch(DivCommand c) {
if (chan[c.chan].insChanged)
{
chan[c.chan].wave = (ins->c64.triOn ? SID3_WAVE_TRIANGLE : 0) | (ins->c64.sawOn ? SID3_WAVE_SAW : 0) |
(ins->c64.pulseOn ? SID3_WAVE_PULSE : 0) | (ins->c64.noiseOn ? SID3_WAVE_NOISE : 0) | (ins->sid3.specialWaveOn ? SID3_WAVE_SPECIAL : 0); //waveform
chan[c.chan].wave = (ins->sid3.triOn ? SID3_WAVE_TRIANGLE : 0) | (ins->sid3.sawOn ? SID3_WAVE_SAW : 0) |
(ins->sid3.pulseOn ? SID3_WAVE_PULSE : 0) | (ins->sid3.noiseOn ? SID3_WAVE_NOISE : 0) | (ins->sid3.specialWaveOn ? SID3_WAVE_SPECIAL : 0); //waveform
chan[c.chan].special_wave = ins->sid3.special_wave; //special wave
chan[c.chan].attack=ins->c64.a;
chan[c.chan].decay=ins->c64.d;
chan[c.chan].sustain=ins->c64.s;
chan[c.chan].attack=ins->sid3.a;
chan[c.chan].decay=ins->sid3.d;
chan[c.chan].sustain=ins->sid3.s;
chan[c.chan].sr=ins->sid3.sr;
chan[c.chan].release=ins->c64.r;
chan[c.chan].release=ins->sid3.r;
if(ins->c64.resetDuty)
if(ins->sid3.resetDuty)
{
chan[c.chan].duty=ins->c64.duty;
chan[c.chan].duty=ins->sid3.duty;
updateDuty(c.chan);
}
chan[c.chan].sync = ins->c64.oscSync;
chan[c.chan].ring = ins->c64.ringMod;
chan[c.chan].sync = ins->sid3.oscSync;
chan[c.chan].ring = ins->sid3.ringMod;
chan[c.chan].phase = ins->sid3.phase_mod;
chan[c.chan].oneBitNoise = ins->sid3.oneBitNoise;
chan[c.chan].mix_mode = ins->sid2.mixMode;
chan[c.chan].mix_mode = ins->sid3.mixMode;
chan[c.chan].ringSrc = ins->sid3.ring_mod_source;
chan[c.chan].syncSrc = ins->sid3.sync_source;
@ -1044,7 +1044,7 @@ int DivPlatformSID3::dispatch(DivCommand c) {
case DIV_CMD_C64_DUTY_RESET:
if (c.value&15) {
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_SID3);
chan[c.chan].duty=ins->c64.duty;
chan[c.chan].duty=ins->sid3.duty;
updateDuty(c.chan);
}
chan[c.chan].resetDuty=c.value>>4;