mirror of
https://github.com/tildearrow/furnace.git
synced 2024-12-31 20:11:29 +00:00
NES: better channel muting
This commit is contained in:
parent
1030bc13b2
commit
5ffda66f22
2 changed files with 10 additions and 11 deletions
|
@ -428,10 +428,7 @@ int DivPlatformNES::dispatch(DivCommand c) {
|
||||||
|
|
||||||
void DivPlatformNES::muteChannel(int ch, bool mute) {
|
void DivPlatformNES::muteChannel(int ch, bool mute) {
|
||||||
isMuted[ch]=mute;
|
isMuted[ch]=mute;
|
||||||
rWrite(0x4015,(!isMuted[0])|((!isMuted[1])<<1)|((!isMuted[2])<<2)|((!isMuted[3])<<3)|((!isMuted[4])<<4));
|
nes->muted[ch]=mute;
|
||||||
if (isMuted[4]) {
|
|
||||||
rWrite(0x4011,0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformNES::forceIns() {
|
void DivPlatformNES::forceIns() {
|
||||||
|
@ -465,7 +462,7 @@ void DivPlatformNES::reset() {
|
||||||
nes->apu.cpu_cycles=0;
|
nes->apu.cpu_cycles=0;
|
||||||
nes->apu.cpu_opcode_cycle=0;
|
nes->apu.cpu_opcode_cycle=0;
|
||||||
|
|
||||||
rWrite(0x4015,(!isMuted[0])|((!isMuted[1])<<1)|((!isMuted[2])<<2)|((!isMuted[3])<<3)|((!isMuted[4])<<4));
|
rWrite(0x4015,0x1f);
|
||||||
rWrite(0x4001,chan[0].sweep);
|
rWrite(0x4001,chan[0].sweep);
|
||||||
rWrite(0x4005,chan[1].sweep);
|
rWrite(0x4005,chan[1].sweep);
|
||||||
}
|
}
|
||||||
|
@ -510,10 +507,11 @@ int DivPlatformNES::init(DivEngine* p, int channels, int sugRate, unsigned int f
|
||||||
apuType=flags;
|
apuType=flags;
|
||||||
dumpWrites=false;
|
dumpWrites=false;
|
||||||
skipRegisterWrites=false;
|
skipRegisterWrites=false;
|
||||||
|
nes=new struct NESAPU;
|
||||||
for (int i=0; i<5; i++) {
|
for (int i=0; i<5; i++) {
|
||||||
isMuted[i]=false;
|
isMuted[i]=false;
|
||||||
|
nes->muted[i]=false;
|
||||||
}
|
}
|
||||||
nes=new struct NESAPU;
|
|
||||||
setFlags(flags);
|
setFlags(flags);
|
||||||
|
|
||||||
init_nla_table(500,500);
|
init_nla_table(500,500);
|
||||||
|
|
|
@ -338,15 +338,15 @@ enum apu_mode { APU_60HZ, APU_48HZ };
|
||||||
#define _apu_channel_volume_adjust(ch, index)\
|
#define _apu_channel_volume_adjust(ch, index)\
|
||||||
((ch))
|
((ch))
|
||||||
#define s1_out(a)\
|
#define s1_out(a)\
|
||||||
_apu_channel_volume_adjust(a->S1.output, APU_S1)
|
(a->muted[0] ? 0 : _apu_channel_volume_adjust(a->S1.output, APU_S1))
|
||||||
#define s2_out(a)\
|
#define s2_out(a)\
|
||||||
_apu_channel_volume_adjust(a->S2.output, APU_S2)
|
(a->muted[1] ? 0 : _apu_channel_volume_adjust(a->S2.output, APU_S2))
|
||||||
#define tr_out(a)\
|
#define tr_out(a)\
|
||||||
_apu_channel_volume_adjust(a->TR.output, APU_TR)
|
(a->muted[2] ? 0 : _apu_channel_volume_adjust(a->TR.output, APU_TR))
|
||||||
#define ns_out(a)\
|
#define ns_out(a)\
|
||||||
_apu_channel_volume_adjust(a->NS.output, APU_NS)
|
(a->muted[3] ? 0 : _apu_channel_volume_adjust(a->NS.output, APU_NS))
|
||||||
#define dmc_out(a)\
|
#define dmc_out(a)\
|
||||||
_apu_channel_volume_adjust(a->DMC.output, APU_DMC)
|
(a->muted[4] ? 0 : _apu_channel_volume_adjust(a->DMC.output, APU_DMC))
|
||||||
#define extra_out(ch)\
|
#define extra_out(ch)\
|
||||||
(ch * cfg->apu.channel[APU_EXTRA])
|
(ch * cfg->apu.channel[APU_EXTRA])
|
||||||
#define pulse_output(a)\
|
#define pulse_output(a)\
|
||||||
|
@ -523,6 +523,7 @@ EXTERNC struct NESAPU {
|
||||||
_apuTriangle TR;
|
_apuTriangle TR;
|
||||||
_apuNoise NS;
|
_apuNoise NS;
|
||||||
_apuDMC DMC;
|
_apuDMC DMC;
|
||||||
|
unsigned char muted[5];
|
||||||
};
|
};
|
||||||
|
|
||||||
/* apuPeriod[mode][type][cycles] */
|
/* apuPeriod[mode][type][cycles] */
|
||||||
|
|
Loading…
Reference in a new issue