mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-05 04:15:05 +00:00
C64: better muting strategy
now directly inside reSID rather than in the DivDispatch fixes #285
This commit is contained in:
parent
b77b9e61ec
commit
397ab43ffd
4 changed files with 33 additions and 12 deletions
|
@ -168,16 +168,16 @@ void DivPlatformC64::tick() {
|
|||
}
|
||||
if (chan[i].testWhen>0) {
|
||||
if (--chan[i].testWhen<1) {
|
||||
if (!chan[i].resetMask && !isMuted[i]) {
|
||||
if (!chan[i].resetMask) {
|
||||
rWrite(i*7+5,0);
|
||||
rWrite(i*7+6,0);
|
||||
rWrite(i*7+4,(isMuted[i]?8:(chan[i].wave<<4))|8|(chan[i].ring<<2)|(chan[i].sync<<1));
|
||||
rWrite(i*7+4,(chan[i].wave<<4)|8|(chan[i].ring<<2)|(chan[i].sync<<1));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (chan[i].std.wave.had) {
|
||||
chan[i].wave=chan[i].std.wave.val;
|
||||
rWrite(i*7+4,(isMuted[i]?8:(chan[i].wave<<4))|(chan[i].ring<<2)|(chan[i].sync<<1)|(int)(chan[i].active));
|
||||
rWrite(i*7+4,(chan[i].wave<<4)|(chan[i].ring<<2)|(chan[i].sync<<1)|(int)(chan[i].active));
|
||||
}
|
||||
if (chan[i].std.ex1.had) {
|
||||
filtControl=chan[i].std.ex1.val&15;
|
||||
|
@ -199,12 +199,12 @@ void DivPlatformC64::tick() {
|
|||
if (chan[i].keyOn) {
|
||||
rWrite(i*7+5,(chan[i].attack<<4)|(chan[i].decay));
|
||||
rWrite(i*7+6,(chan[i].sustain<<4)|(chan[i].release));
|
||||
rWrite(i*7+4,(isMuted[i]?8:(chan[i].wave<<4))|(chan[i].ring<<2)|(chan[i].sync<<1)|1);
|
||||
rWrite(i*7+4,(chan[i].wave<<4)|(chan[i].ring<<2)|(chan[i].sync<<1)|1);
|
||||
}
|
||||
if (chan[i].keyOff && !isMuted[i]) {
|
||||
if (chan[i].keyOff) {
|
||||
rWrite(i*7+5,(chan[i].attack<<4)|(chan[i].decay));
|
||||
rWrite(i*7+6,(chan[i].sustain<<4)|(chan[i].release));
|
||||
rWrite(i*7+4,(isMuted[i]?8:(chan[i].wave<<4))|(chan[i].ring<<2)|(chan[i].sync<<1)|0);
|
||||
rWrite(i*7+4,(chan[i].wave<<4)|(chan[i].ring<<2)|(chan[i].sync<<1)|0);
|
||||
}
|
||||
rWrite(i*7,chan[i].freq&0xff);
|
||||
rWrite(i*7+1,chan[i].freq>>8);
|
||||
|
@ -330,7 +330,7 @@ int DivPlatformC64::dispatch(DivCommand c) {
|
|||
break;
|
||||
case DIV_CMD_WAVE:
|
||||
chan[c.chan].wave=c.value;
|
||||
rWrite(c.chan*7+4,(isMuted[c.chan]?8:(chan[c.chan].wave<<4))|(chan[c.chan].ring<<2)|(chan[c.chan].sync<<1)|(int)(chan[c.chan].active));
|
||||
rWrite(c.chan*7+4,(chan[c.chan].wave<<4)|(chan[c.chan].ring<<2)|(chan[c.chan].sync<<1)|(int)(chan[c.chan].active));
|
||||
break;
|
||||
case DIV_CMD_LEGATO:
|
||||
chan[c.chan].baseFreq=NOTE_FREQUENCY(c.value+((chan[c.chan].std.arp.will && !chan[c.chan].std.arp.mode)?(chan[c.chan].std.arp.val):(0)));
|
||||
|
@ -411,11 +411,11 @@ int DivPlatformC64::dispatch(DivCommand c) {
|
|||
break;
|
||||
case 4:
|
||||
chan[c.chan].ring=c.value;
|
||||
rWrite(c.chan*7+4,(isMuted[c.chan]?8:(chan[c.chan].wave<<4))|(chan[c.chan].ring<<2)|(chan[c.chan].sync<<1)|(int)(chan[c.chan].active));
|
||||
rWrite(c.chan*7+4,(chan[c.chan].wave<<4)|(chan[c.chan].ring<<2)|(chan[c.chan].sync<<1)|(int)(chan[c.chan].active));
|
||||
break;
|
||||
case 5:
|
||||
chan[c.chan].sync=c.value;
|
||||
rWrite(c.chan*7+4,(isMuted[c.chan]?8:(chan[c.chan].wave<<4))|(chan[c.chan].ring<<2)|(chan[c.chan].sync<<1)|(int)(chan[c.chan].active));
|
||||
rWrite(c.chan*7+4,(chan[c.chan].wave<<4)|(chan[c.chan].ring<<2)|(chan[c.chan].sync<<1)|(int)(chan[c.chan].active));
|
||||
break;
|
||||
case 6:
|
||||
filtControl&=7;
|
||||
|
@ -434,7 +434,7 @@ int DivPlatformC64::dispatch(DivCommand c) {
|
|||
|
||||
void DivPlatformC64::muteChannel(int ch, bool mute) {
|
||||
isMuted[ch]=mute;
|
||||
rWrite(ch*7+4,(isMuted[ch]?8:(chan[ch].wave<<4))|(chan[ch].ring<<2)|(chan[ch].sync<<1)|(int)(chan[ch].active));
|
||||
sid.set_is_muted(ch,mute);
|
||||
}
|
||||
|
||||
void DivPlatformC64::forceIns() {
|
||||
|
@ -475,6 +475,10 @@ int DivPlatformC64::getRegisterPoolSize() {
|
|||
return 32;
|
||||
}
|
||||
|
||||
bool DivPlatformC64::getDCOffRequired() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void DivPlatformC64::reset() {
|
||||
for (int i=0; i<3; i++) {
|
||||
chan[i]=DivPlatformC64::Channel();
|
||||
|
|
|
@ -87,6 +87,7 @@ class DivPlatformC64: public DivDispatch {
|
|||
void muteChannel(int ch, bool mute);
|
||||
void setFlags(unsigned int flags);
|
||||
void notifyInsChange(int ins);
|
||||
bool getDCOffRequired();
|
||||
void notifyInsDeletion(void* ins);
|
||||
void poke(unsigned int addr, unsigned short val);
|
||||
void poke(std::vector<DivRegWrite>& wlist);
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue