From 2453ff49616dc9fcf5ddd7567dfc18e84bb2c6c3 Mon Sep 17 00:00:00 2001 From: hap Date: Fri, 7 Oct 2022 13:49:27 +0200 Subject: [PATCH] berzerk: use volume filter device --- src/mame/stern/berzerk.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/mame/stern/berzerk.cpp b/src/mame/stern/berzerk.cpp index dbbc3590f90..2245ef9db4d 100644 --- a/src/mame/stern/berzerk.cpp +++ b/src/mame/stern/berzerk.cpp @@ -61,6 +61,7 @@ Game difference analysis by The Cutting Room Floor (tcrf.net) #include "cpu/z80/z80.h" #include "machine/74181.h" #include "machine/nvram.h" +#include "sound/flt_vol.h" #include "sound/s14001a.h" #include "screen.h" @@ -77,6 +78,7 @@ public: driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_s14001a(*this, "speech"), + m_s14001a_volume(*this, "s14001a_volume"), m_ls181_10c(*this, "ls181_10c"), m_ls181_12c(*this, "ls181_12c"), m_custom(*this, "exidy"), @@ -100,6 +102,7 @@ protected: private: required_device m_maincpu; required_device m_s14001a; + required_device m_s14001a_volume; required_device m_ls181_10c; required_device m_ls181_12c; required_device m_custom; @@ -599,8 +602,7 @@ void berzerk_state::audio_w(offs_t offset, uint8_t data) case 1: { /* volume - 0 appears to be inaudible */ - m_s14001a->force_update(); - m_s14001a->set_output_gain(0, (data >> 3 & 7) / 7.0); + m_s14001a_volume->flt_volume_set_volume((data >> 3 & 7) / 7.0); /* clock control - the first LS161 divides the clock by 9 to 16, the 2nd by 8, giving a final clock from 19.5kHz to 34.7kHz */ @@ -645,7 +647,6 @@ uint8_t berzerk_state::audio_r(offs_t offset) } - void berzerk_state::sound_reset() { /* clears the flip-flop controlling the volume and freq on the speech chip */ @@ -995,7 +996,7 @@ uint8_t berzerk_state::moonwarp_p1_r() // one difference is it lacks the strobe input (does it?), which if not active causes // the dial input to go open bus. This is used in moon war 2 to switch between player 1 // and player 2 dials, which share a single port. moonwarp uses separate ports for the dials. - signed char dialread = ioport("P1_DIAL")->read(); + int8_t dialread = ioport("P1_DIAL")->read(); uint8_t ret; uint8_t buttons = (ioport("P1")->read()&0xe0); if (dialread < 0) m_p1_direction = 0; @@ -1010,7 +1011,7 @@ uint8_t berzerk_state::moonwarp_p1_r() uint8_t berzerk_state::moonwarp_p2_r() { // same as above, but for player 2 in cocktail mode - signed char dialread = ioport("P2_DIAL")->read(); + int8_t dialread = ioport("P2_DIAL")->read(); uint8_t ret; uint8_t buttons = (ioport("P2")->read()&0xe0); if (dialread < 0) m_p2_direction = 0; @@ -1187,7 +1188,10 @@ void berzerk_state::berzerk(machine_config &config) /* audio hardware */ SPEAKER(config, "mono").front_center(); - S14001A(config, m_s14001a, S14001_CLOCK/16/8).add_route(ALL_OUTPUTS, "mono", 1.00); /* placeholder - the clock is software controllable */ + S14001A(config, m_s14001a, S14001_CLOCK/16/8); // placeholder clock - it is software controllable + m_s14001a->add_route(ALL_OUTPUTS, "s14001a_volume", 0.5); + FILTER_VOLUME(config, m_s14001a_volume).add_route(ALL_OUTPUTS, "mono", 1.0); + EXIDY(config, m_custom, 0).add_route(ALL_OUTPUTS, "mono", 0.33); }