C64: better muting strategy

now directly inside reSID rather than in the DivDispatch
fixes #285
This commit is contained in:
tildearrow 2022-04-15 01:20:09 -05:00
parent b77b9e61ec
commit 397ab43ffd
4 changed files with 33 additions and 12 deletions

View file

@ -18,6 +18,7 @@
// ---------------------------------------------------------------------------
#include "sid.h"
#include <stdio.h>
#include <math.h>
// ----------------------------------------------------------------------------
@ -39,6 +40,10 @@ SID::SID()
bus_value_ttl = 0;
ext_in = 0;
isMuted[0]=false;
isMuted[1]=false;
isMuted[2]=false;
}
@ -51,6 +56,14 @@ SID::~SID()
delete[] fir;
}
// ----------------------------------------------------------------------------
// Mute/unmute channel.
// ----------------------------------------------------------------------------
void SID::set_is_muted(int ch, bool val) {
if (ch<0 || ch>2) return;
isMuted[ch]=val;
}
// ----------------------------------------------------------------------------
// Set chip model.
@ -626,7 +639,7 @@ void SID::clock()
}
// Clock filter.
filter.clock(voice[0].output(), voice[1].output(), voice[2].output(), ext_in);
filter.clock(isMuted[0]?0:voice[0].output(), isMuted[1]?0:voice[1].output(), isMuted[2]?0:voice[2].output(), ext_in);
// Clock external filter.
extfilt.clock(filter.output());
@ -706,7 +719,7 @@ void SID::clock(cycle_count delta_t)
// Clock filter.
filter.clock(delta_t,
voice[0].output(), voice[1].output(), voice[2].output(), ext_in);
isMuted[0]?0:voice[0].output(), isMuted[1]?0:voice[1].output(), isMuted[2]?0:voice[2].output(), ext_in);
// Clock external filter.
extfilt.clock(delta_t, filter.output());

View file

@ -32,6 +32,7 @@ public:
SID();
~SID();
void set_is_muted(int ch, bool val);
void set_chip_model(chip_model model);
void enable_filter(bool enable);
void enable_external_filter(bool enable);
@ -102,6 +103,8 @@ protected:
Potentiometer potx;
Potentiometer poty;
bool isMuted[3];
reg8 bus_value;
cycle_count bus_value_ttl;