From 85228e6f917a19b530b206c063ed81281f71002b Mon Sep 17 00:00:00 2001 From: hap Date: Mon, 1 Jul 2019 02:45:22 +0200 Subject: hh*: deglobal speaker levels (nw) --- src/mame/drivers/hh_amis2k.cpp | 7 ++--- src/mame/drivers/hh_hmcs40.cpp | 12 ++++---- src/mame/drivers/hh_pic16.cpp | 15 ++++------ src/mame/drivers/hh_tms1k.cpp | 64 ++++++++++++++++++------------------------ src/mame/drivers/hh_ucom4.cpp | 14 ++++----- src/mame/drivers/tasc.cpp | 4 +-- 6 files changed, 50 insertions(+), 66 deletions(-) diff --git a/src/mame/drivers/hh_amis2k.cpp b/src/mame/drivers/hh_amis2k.cpp index 697214f2b8b..0030abd77c2 100644 --- a/src/mame/drivers/hh_amis2k.cpp +++ b/src/mame/drivers/hh_amis2k.cpp @@ -232,8 +232,6 @@ static const u8 wildfire_7seg_table[0x10] = 0x7f, 0x6f, 0x77, 0x73, 0x39, 0x38, 0x79, 0x40 // 8, 9, ?, P, ?, L, ?, - }; -static s16 wildfire_speaker_levels[0x8000]; - void wildfire_state::wildfire(machine_config &config) { /* basic machine hardware */ @@ -257,9 +255,10 @@ void wildfire_state::wildfire(machine_config &config) TIMER(config, "speaker_decay").configure_periodic(FUNC(wildfire_state::speaker_decay_sim), attotime::from_usec(100)); // set volume levels (set_output_gain is too slow for sub-frame intervals) + static s16 speaker_levels[0x8000]; for (int i = 0; i < 0x8000; i++) - wildfire_speaker_levels[i] = i; - m_speaker->set_levels(0x8000, wildfire_speaker_levels); + speaker_levels[i] = i; + m_speaker->set_levels(0x8000, speaker_levels); } // roms diff --git a/src/mame/drivers/hh_hmcs40.cpp b/src/mame/drivers/hh_hmcs40.cpp index 78180cfefef..f39ad9f24a1 100644 --- a/src/mame/drivers/hh_hmcs40.cpp +++ b/src/mame/drivers/hh_hmcs40.cpp @@ -1975,8 +1975,6 @@ static INPUT_PORTS_START( cdkong ) PORT_BIT( 0x7ff8, IP_ACTIVE_HIGH, IPT_UNUSED ) INPUT_PORTS_END -static s16 cdkong_speaker_levels[0x8000]; - void cdkong_state::cdkong(machine_config &config) { /* basic machine hardware */ @@ -2006,9 +2004,10 @@ void cdkong_state::cdkong(machine_config &config) TIMER(config, "speaker_decay").configure_periodic(FUNC(cdkong_state::speaker_decay_sim), attotime::from_msec(1)); // set volume levels (set_output_gain is too slow for sub-frame intervals) + static s16 speaker_levels[0x8000]; for (int i = 0; i < 0x8000; i++) - cdkong_speaker_levels[i] = i; - m_speaker->set_levels(0x8000, cdkong_speaker_levels); + speaker_levels[i] = i; + m_speaker->set_levels(0x8000, speaker_levels); } // roms @@ -3647,8 +3646,6 @@ static INPUT_PORTS_START( mwcbaseb ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("P1 1") INPUT_PORTS_END -static const s16 mwcbaseb_speaker_levels[] = { 0, 0x3fff, -0x4000, 0, -0x4000, 0, -0x8000, -0x4000 }; - void mwcbaseb_state::mwcbaseb(machine_config &config) { /* basic machine hardware */ @@ -3674,7 +3671,8 @@ void mwcbaseb_state::mwcbaseb(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.25); - m_speaker->set_levels(8, mwcbaseb_speaker_levels); + static const s16 speaker_levels[] = { 0, 0x3fff, -0x4000, 0, -0x4000, 0, -0x8000, -0x4000 }; + m_speaker->set_levels(8, speaker_levels); } // roms diff --git a/src/mame/drivers/hh_pic16.cpp b/src/mame/drivers/hh_pic16.cpp index 6f329b724ee..e637e04fc02 100644 --- a/src/mame/drivers/hh_pic16.cpp +++ b/src/mame/drivers/hh_pic16.cpp @@ -273,8 +273,6 @@ static INPUT_PORTS_START( touchme ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END -static const s16 touchme_speaker_levels[] = { 0, 0x7fff, -0x8000, 0 }; - void touchme_state::touchme(machine_config &config) { /* basic machine hardware */ @@ -295,7 +293,8 @@ void touchme_state::touchme(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - m_speaker->set_levels(4, touchme_speaker_levels); + static const s16 speaker_levels[] = { 0, 0x7fff, -0x8000, 0 }; + m_speaker->set_levels(4, speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); } @@ -609,8 +608,6 @@ static INPUT_PORTS_START( maniac ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4) INPUT_PORTS_END -static const s16 maniac_speaker_levels[] = { 0, 0x7fff, -0x8000, 0 }; - void maniac_state::maniac(machine_config &config) { /* basic machine hardware */ @@ -627,7 +624,8 @@ void maniac_state::maniac(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - m_speaker->set_levels(4, maniac_speaker_levels); + static const s16 speaker_levels[] = { 0, 0x7fff, -0x8000, 0 }; + m_speaker->set_levels(4, speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); } @@ -1158,8 +1156,6 @@ static INPUT_PORTS_START( rockpin ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Ball") INPUT_PORTS_END -static const s16 rockpin_speaker_levels[] = { 0, 0x7fff, -0x8000, 0 }; - void rockpin_state::rockpin(machine_config &config) { /* basic machine hardware */ @@ -1184,7 +1180,8 @@ void rockpin_state::rockpin(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - m_speaker->set_levels(4, rockpin_speaker_levels); + static const s16 speaker_levels[] = { 0, 0x7fff, -0x8000, 0 }; + m_speaker->set_levels(4, speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); } diff --git a/src/mame/drivers/hh_tms1k.cpp b/src/mame/drivers/hh_tms1k.cpp index 6a4e546a673..44a5afa9d19 100644 --- a/src/mame/drivers/hh_tms1k.cpp +++ b/src/mame/drivers/hh_tms1k.cpp @@ -470,8 +470,6 @@ static INPUT_PORTS_START( matchnum ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Square 1") INPUT_PORTS_END -static const s16 matchnum_speaker_levels[4] = { 0, 0x7fff, -0x8000, 0 }; - void matchnum_state::matchnum(machine_config &config) { /* basic machine hardware */ @@ -488,7 +486,8 @@ void matchnum_state::matchnum(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - m_speaker->set_levels(4, matchnum_speaker_levels); + static const s16 speaker_levels[4] = { 0, 0x7fff, -0x8000, 0 }; + m_speaker->set_levels(4, speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); } @@ -582,8 +581,6 @@ static INPUT_PORTS_START( arrball ) PORT_CONFSETTING( 0x08, "Fast" ) INPUT_PORTS_END -static const s16 arrball_speaker_levels[4] = { 0, 0x7fff, -0x8000, 0 }; - void arrball_state::arrball(machine_config &config) { /* basic machine hardware */ @@ -601,7 +598,8 @@ void arrball_state::arrball(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - m_speaker->set_levels(4, arrball_speaker_levels); + static const s16 speaker_levels[4] = { 0, 0x7fff, -0x8000, 0 }; + m_speaker->set_levels(4, speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); } @@ -2833,8 +2831,6 @@ static INPUT_PORTS_START( cnfball ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY PORT_NAME("P1 Left/Right") INPUT_PORTS_END -static const s16 cnfball_speaker_levels[4] = { 0, 0x7fff, -0x8000, 0 }; - void cnfball_state::cnfball(machine_config &config) { /* basic machine hardware */ @@ -2853,7 +2849,8 @@ void cnfball_state::cnfball(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - m_speaker->set_levels(4, cnfball_speaker_levels); + static const s16 speaker_levels[4] = { 0, 0x7fff, -0x8000, 0 }; + m_speaker->set_levels(4, speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); } @@ -5629,8 +5626,6 @@ static INPUT_PORTS_START( elecdet ) PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_POWER_OFF ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, false) INPUT_PORTS_END -static const s16 elecdet_speaker_levels[4] = { 0, 0x3fff, 0x3fff, 0x7fff }; - void elecdet_state::elecdet(machine_config &config) { /* basic machine hardware */ @@ -5648,7 +5643,8 @@ void elecdet_state::elecdet(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - m_speaker->set_levels(4, elecdet_speaker_levels); + static const s16 speaker_levels[4] = { 0, 0x3fff, 0x3fff, 0x7fff }; + m_speaker->set_levels(4, speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); } @@ -7344,8 +7340,6 @@ static INPUT_PORTS_START( bigtrak ) PORT_BIT( 0x0b, IP_ACTIVE_HIGH, IPT_UNUSED ) INPUT_PORTS_END -static const s16 bigtrak_speaker_levels[8] = { 0, 0x7fff/3, 0x7fff/3, 0x7fff/3*2, 0x7fff/3, 0x7fff/3*2, 0x7fff/3*2, 0x7fff }; - void bigtrak_state::bigtrak(machine_config &config) { /* basic machine hardware */ @@ -7363,7 +7357,8 @@ void bigtrak_state::bigtrak(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - m_speaker->set_levels(8, bigtrak_speaker_levels); + static const s16 speaker_levels[8] = { 0, 0x7fff/3, 0x7fff/3, 0x7fff/3*2, 0x7fff/3, 0x7fff/3*2, 0x7fff/3*2, 0x7fff }; + m_speaker->set_levels(8, speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); } @@ -7712,8 +7707,6 @@ static INPUT_PORTS_START( arcmania ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) INPUT_PORTS_END -static const s16 arcmania_speaker_levels[8] = { 0, 0x7fff/3, 0x7fff/3, 0x7fff/3*2, 0x7fff/3, 0x7fff/3*2, 0x7fff/3*2, 0x7fff }; - void arcmania_state::arcmania(machine_config &config) { /* basic machine hardware */ @@ -7729,7 +7722,8 @@ void arcmania_state::arcmania(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - m_speaker->set_levels(8, arcmania_speaker_levels); + static const s16 speaker_levels[8] = { 0, 0x7fff/3, 0x7fff/3, 0x7fff/3*2, 0x7fff/3, 0x7fff/3*2, 0x7fff/3*2, 0x7fff }; + m_speaker->set_levels(8, speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); } @@ -7975,8 +7969,6 @@ static INPUT_PORTS_START( merlin ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_N) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("New Game") INPUT_PORTS_END -static const s16 merlin_speaker_levels[8] = { 0, 0x7fff/3, 0x7fff/3, 0x7fff/3*2, 0x7fff/3, 0x7fff/3*2, 0x7fff/3*2, 0x7fff }; - void merlin_state::merlin(machine_config &config) { /* basic machine hardware */ @@ -7992,7 +7984,8 @@ void merlin_state::merlin(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - m_speaker->set_levels(8, merlin_speaker_levels); + static const s16 speaker_levels[8] = { 0, 0x7fff/3, 0x7fff/3, 0x7fff/3*2, 0x7fff/3, 0x7fff/3*2, 0x7fff/3*2, 0x7fff }; + m_speaker->set_levels(8, speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); } @@ -8175,8 +8168,6 @@ static INPUT_PORTS_START( stopthief ) PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_POWER_OFF ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, false) INPUT_PORTS_END -static const s16 stopthief_speaker_levels[7] = { 0, 0x7fff/6, 0x7fff/5, 0x7fff/4, 0x7fff/3, 0x7fff/2, 0x7fff }; - void stopthief_state::stopthief(machine_config &config) { /* basic machine hardware */ @@ -8194,7 +8185,8 @@ void stopthief_state::stopthief(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - m_speaker->set_levels(7, stopthief_speaker_levels); + static const s16 speaker_levels[7] = { 0x7fff/7, 0x7fff/6, 0x7fff/5, 0x7fff/4, 0x7fff/3, 0x7fff/2, 0x7fff/1 }; + m_speaker->set_levels(7, speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); } @@ -8582,12 +8574,6 @@ static INPUT_PORTS_START( lostreas ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_U) PORT_NAME("Up") INPUT_PORTS_END -static const s16 lostreas_speaker_levels[16] = -{ - 0, 0x7fff/15, 0x7fff/14, 0x7fff/13, 0x7fff/12, 0x7fff/11, 0x7fff/10, 0x7fff/9, - 0x7fff/8, 0x7fff/7, 0x7fff/6, 0x7fff/5, 0x7fff/4, 0x7fff/3, 0x7fff/2, 0x7fff/1 -}; - void lostreas_state::lostreas(machine_config &config) { /* basic machine hardware */ @@ -8603,8 +8589,13 @@ void lostreas_state::lostreas(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - m_speaker->set_levels(16, lostreas_speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); + + // set volume levels + static s16 speaker_levels[0x10]; + for (int i = 0; i < 0x10; i++) + speaker_levels[i] = 0x7fff / (0x10 - i); + m_speaker->set_levels(16, speaker_levels); } // roms @@ -11290,8 +11281,6 @@ static INPUT_PORTS_START( copycat ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) INPUT_PORTS_END -static const s16 copycat_speaker_levels[4] = { 0, 0x7fff, -0x8000, 0 }; - void copycat_state::copycat(machine_config &config) { /* basic machine hardware */ @@ -11307,7 +11296,8 @@ void copycat_state::copycat(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - m_speaker->set_levels(4, copycat_speaker_levels); + static const s16 speaker_levels[4] = { 0, 0x7fff, -0x8000, 0 }; + m_speaker->set_levels(4, speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); } @@ -11396,7 +11386,8 @@ void copycatm2_state::copycatm2(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - m_speaker->set_levels(4, copycat_speaker_levels); + static const s16 speaker_levels[4] = { 0, 0x7fff, -0x8000, 0 }; + m_speaker->set_levels(4, speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); } @@ -11480,7 +11471,8 @@ void ditto_state::ditto(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - m_speaker->set_levels(4, copycat_speaker_levels); + static const s16 speaker_levels[4] = { 0, 0x7fff, -0x8000, 0 }; + m_speaker->set_levels(4, speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); } diff --git a/src/mame/drivers/hh_ucom4.cpp b/src/mame/drivers/hh_ucom4.cpp index 159ee1a755b..2b3d208312a 100644 --- a/src/mame/drivers/hh_ucom4.cpp +++ b/src/mame/drivers/hh_ucom4.cpp @@ -298,8 +298,6 @@ static INPUT_PORTS_START( ufombs ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) INPUT_PORTS_END -static const s16 ufombs_speaker_levels[] = { 0, 0x7fff, -0x8000, 0 }; - void ufombs_state::ufombs(machine_config &config) { /* basic machine hardware */ @@ -325,7 +323,8 @@ void ufombs_state::ufombs(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - m_speaker->set_levels(4, ufombs_speaker_levels); + static const s16 speaker_levels[] = { 0, 0x7fff, -0x8000, 0 }; + m_speaker->set_levels(4, speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); } @@ -455,8 +454,6 @@ static INPUT_PORTS_START( ssfball ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY PORT_NAME("P1 Left/Right") INPUT_PORTS_END -static const s16 ssfball_speaker_levels[] = { 0, 0x7fff, -0x8000, 0 }; - void ssfball_state::ssfball(machine_config &config) { /* basic machine hardware */ @@ -482,7 +479,8 @@ void ssfball_state::ssfball(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - m_speaker->set_levels(4, ssfball_speaker_levels); + static const s16 speaker_levels[] = { 0, 0x7fff, -0x8000, 0 }; + m_speaker->set_levels(4, speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); } @@ -879,7 +877,6 @@ static INPUT_PORTS_START( splasfgt ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) INPUT_PORTS_END -static const s16 splasfgt_speaker_levels[] = { 0, 0x7fff, -0x8000, 0 }; void splasfgt_state::splasfgt(machine_config &config) { @@ -906,7 +903,8 @@ void splasfgt_state::splasfgt(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - m_speaker->set_levels(4, splasfgt_speaker_levels); + static const s16 speaker_levels[] = { 0, 0x7fff, -0x8000, 0 }; + m_speaker->set_levels(4, speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); } diff --git a/src/mame/drivers/tasc.cpp b/src/mame/drivers/tasc.cpp index a4ea39d29dd..012b0575c0f 100644 --- a/src/mame/drivers/tasc.cpp +++ b/src/mame/drivers/tasc.cpp @@ -228,9 +228,9 @@ void tasc_state::tasc(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); - static const int16_t speaker_levels[3] = { 0, 32767, -32768 }; + static const int16_t speaker_levels[4] = { 0, 32767, -32768, 0 }; SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.75); - m_speaker->set_levels(3, speaker_levels); + m_speaker->set_levels(4, speaker_levels); } -- cgit v1.2.3