diff --git a/src/engine/platform/msm5232.cpp b/src/engine/platform/msm5232.cpp index 39e9d08b..4ce5c9e4 100644 --- a/src/engine/platform/msm5232.cpp +++ b/src/engine/platform/msm5232.cpp @@ -226,7 +226,7 @@ int DivPlatformMSM5232::dispatch(DivCommand c) { void DivPlatformMSM5232::muteChannel(int ch, bool mute) { isMuted[ch]=mute; - // TODO: this + msm->mute(ch,mute); } void DivPlatformMSM5232::forceIns() { @@ -281,6 +281,7 @@ void DivPlatformMSM5232::reset() { for (int i=0; i<8; i++) { rWrite(i,0); + msm->mute(i,isMuted[i]); } } diff --git a/src/engine/platform/sound/oki/msm5232.cpp b/src/engine/platform/sound/oki/msm5232.cpp index c92d9204..d1dd1454 100644 --- a/src/engine/platform/sound/oki/msm5232.cpp +++ b/src/engine/platform/sound/oki/msm5232.cpp @@ -225,8 +225,13 @@ void msm5232_device::init_voice(int i) m_voi[i].eg = 0.0; m_voi[i].eg_arm = 0; m_voi[i].pitch = -1.0; + m_voi[i].mute = false; } +void msm5232_device::mute(int voice, bool mute) +{ + m_voi[voice].mute = mute; +} void msm5232_device::gate_update() { @@ -571,16 +576,18 @@ void msm5232_device::TG_group_advance(int groupidx) } /* calculate signed output */ - o16 += ( (out16-(1<<(STEP_SH-1))) * voi->egvol) >> STEP_SH; - o8 += ( (out8 -(1<<(STEP_SH-1))) * voi->egvol) >> STEP_SH; - o4 += ( (out4 -(1<<(STEP_SH-1))) * voi->egvol) >> STEP_SH; - o2 += ( (out2 -(1<<(STEP_SH-1))) * voi->egvol) >> STEP_SH; + if (!voi->mute) { + o16 += ( (out16-(1<<(STEP_SH-1))) * voi->egvol) >> STEP_SH; + o8 += ( (out8 -(1<<(STEP_SH-1))) * voi->egvol) >> STEP_SH; + o4 += ( (out4 -(1<<(STEP_SH-1))) * voi->egvol) >> STEP_SH; + o2 += ( (out2 -(1<<(STEP_SH-1))) * voi->egvol) >> STEP_SH; - if (i == 1 && groupidx == 1) - { - solo16 += ( (out16-(1<<(STEP_SH-1))) << 11) >> STEP_SH; - solo8 += ( (out8 -(1<<(STEP_SH-1))) << 11) >> STEP_SH; - } + if (i == 1 && groupidx == 1) + { + solo16 += ( (out16-(1<<(STEP_SH-1))) << 11) >> STEP_SH; + solo8 += ( (out8 -(1<<(STEP_SH-1))) << 11) >> STEP_SH; + } + } voi++; i--; diff --git a/src/engine/platform/sound/oki/msm5232.h b/src/engine/platform/sound/oki/msm5232.h index bddc97c6..66cce81c 100644 --- a/src/engine/platform/sound/oki/msm5232.h +++ b/src/engine/platform/sound/oki/msm5232.h @@ -19,6 +19,7 @@ public: void write(unsigned int offset, uint8_t data); void set_clock(int clock); + void mute(int voice, bool mute); // device-level overrides void device_start(); @@ -34,6 +35,7 @@ public: private: struct VOICE { uint8_t mode; + bool mute; int TG_count_period; int TG_count;