diff --git a/src/engine/platform/ga20.cpp b/src/engine/platform/ga20.cpp index 0d2a7846..23452d93 100644 --- a/src/engine/platform/ga20.cpp +++ b/src/engine/platform/ga20.cpp @@ -121,8 +121,12 @@ void DivPlatformGA20::tick(bool sysTick) { } } if (chan[i].volumeChanged) { - chan[i].resVol=(chan[i].active && isMuted[i])?0:chan[i].outVol&0xff; - chWrite(i,0x5,chan[i].resVol); + if (isMuted[i]) { + chWrite(i,0x5,0); + } else { + chan[i].resVol=(isMuted[i])?0:chan[i].outVol&0xff; + chWrite(i,0x5,chan[i].resVol); + } chan[i].volumeChanged=false; } if (chan[i].setPos) { @@ -320,6 +324,7 @@ int DivPlatformGA20::dispatch(DivCommand c) { void DivPlatformGA20::muteChannel(int ch, bool mute) { isMuted[ch]=mute; + ga20.set_mute(ch,mute); chan[ch].volumeChanged=true; } diff --git a/src/engine/platform/sound/ga20/iremga20.cpp b/src/engine/platform/sound/ga20/iremga20.cpp index 8a3167b1..e9af15fa 100644 --- a/src/engine/platform/sound/ga20/iremga20.cpp +++ b/src/engine/platform/sound/ga20/iremga20.cpp @@ -104,7 +104,7 @@ void iremga20_device::sound_stream_update(short** outputs, int len) ch.play = false; else { - sampleout = (sample - 0x80) * (s32)ch.volume; + sampleout = ch.mute ? 0 : (sample - 0x80) * (s32)ch.volume; ch.counter--; if (ch.counter <= ch.rate) { diff --git a/src/engine/platform/sound/ga20/iremga20.h b/src/engine/platform/sound/ga20/iremga20.h index 782f0be8..dc29d86f 100644 --- a/src/engine/platform/sound/ga20/iremga20.h +++ b/src/engine/platform/sound/ga20/iremga20.h @@ -38,6 +38,8 @@ public: void write(u32 offset, u8 data); u8 read(u32 offset); + inline void set_mute(const int ch, const bool mute) { m_channel[ch & 3].mute = mute; } + // device-level overrides void device_reset(); @@ -53,7 +55,8 @@ private: counter(0), end(0), volume(0), - play(0) + play(0), + mute(false) { } @@ -63,6 +66,7 @@ private: u32 end; u32 volume; bool play; + bool mute; }; u8 m_regs[0x20];