From 3d0bb74c259f771c87c02bf8290183b05ff53b56 Mon Sep 17 00:00:00 2001 From: cam900 Date: Tue, 2 Apr 2019 18:01:21 +0900 Subject: n2a03.cpp : Add device_mixer_interface instead hardcoded tags nes.cpp, mmc5.cpp : Fix sound volume --- src/devices/bus/nes/mmc5.cpp | 2 +- src/devices/cpu/m6502/n2a03.cpp | 3 ++- src/devices/cpu/m6502/n2a03.h | 2 +- src/mame/audio/dkong.cpp | 13 +++++++++---- src/mame/drivers/cham24.cpp | 3 ++- src/mame/drivers/famibox.cpp | 3 ++- src/mame/drivers/multigam.cpp | 3 ++- src/mame/drivers/nes.cpp | 7 +++---- src/mame/drivers/playch10.cpp | 2 +- src/mame/drivers/punchout.cpp | 5 ++--- src/mame/drivers/vgmplay.cpp | 14 ++++---------- src/mame/drivers/vsnes.cpp | 15 +++++++++------ src/mame/includes/playch10.h | 3 ++- src/mame/includes/punchout.h | 3 ++- 14 files changed, 42 insertions(+), 36 deletions(-) diff --git a/src/devices/bus/nes/mmc5.cpp b/src/devices/bus/nes/mmc5.cpp index 1feef95aa67..62660ef5394 100644 --- a/src/devices/bus/nes/mmc5.cpp +++ b/src/devices/bus/nes/mmc5.cpp @@ -689,5 +689,5 @@ void nes_exrom_device::device_add_mconfig(machine_config &config) SPEAKER(config, "addon").front_center(); // TODO: temporary; will be separated device - NES_APU(config, m_sound, XTAL(21'477'272)/12).add_route(ALL_OUTPUTS, "addon", 0.50); + NES_APU(config, m_sound, XTAL(21'477'272)/12).add_route(ALL_OUTPUTS, "addon", 0.90); } diff --git a/src/devices/cpu/m6502/n2a03.cpp b/src/devices/cpu/m6502/n2a03.cpp index 1a05dbbd73b..6bfbc2edc98 100644 --- a/src/devices/cpu/m6502/n2a03.cpp +++ b/src/devices/cpu/m6502/n2a03.cpp @@ -53,6 +53,7 @@ void n2a03_device::n2a03_map(address_map &map) n2a03_device::n2a03_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : m6502_device(mconfig, N2A03, tag, owner, clock) + , device_mixer_interface(mconfig, *this, 1) , m_apu(*this, "nesapu") { program_config.m_internal_map = address_map_constructor(FUNC(n2a03_device::n2a03_map), this); @@ -79,7 +80,7 @@ void n2a03_device::device_add_mconfig(machine_config &config) NES_APU(config, m_apu, DERIVED_CLOCK(1,1)); m_apu->irq().set(FUNC(n2a03_device::apu_irq)); m_apu->mem_read().set(FUNC(n2a03_device::apu_read_mem)); - m_apu->add_route(ALL_OUTPUTS, ":mono", 0.50); + m_apu->add_route(ALL_OUTPUTS, *this, 1.0, AUTO_ALLOC_INPUT, 0); } diff --git a/src/devices/cpu/m6502/n2a03.h b/src/devices/cpu/m6502/n2a03.h index bb5cbad8e69..d11d4d86a1c 100644 --- a/src/devices/cpu/m6502/n2a03.h +++ b/src/devices/cpu/m6502/n2a03.h @@ -15,7 +15,7 @@ #include "m6502.h" #include "sound/nes_apu.h" -class n2a03_device : public m6502_device { +class n2a03_device : public m6502_device, public device_mixer_interface { public: n2a03_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); diff --git a/src/mame/audio/dkong.cpp b/src/mame/audio/dkong.cpp index 7a1f37a9393..e0ccea40d29 100644 --- a/src/mame/audio/dkong.cpp +++ b/src/mame/audio/dkong.cpp @@ -1426,13 +1426,18 @@ void dkong_state::dkongjr_audio(machine_config &config) void dkong_state::dkong3_audio(machine_config &config) { - N2A03(config, "n2a03a", NTSC_APU_CLOCK).set_addrmap(AS_PROGRAM, &dkong_state::dkong3_sound1_map); - N2A03(config, "n2a03b", NTSC_APU_CLOCK).set_addrmap(AS_PROGRAM, &dkong_state::dkong3_sound2_map); + SPEAKER(config, "mono").front_center(); + + n2a03_device &n2a03a(N2A03(config, "n2a03a", NTSC_APU_CLOCK)); + n2a03a.set_addrmap(AS_PROGRAM, &dkong_state::dkong3_sound1_map); + n2a03a.add_route(ALL_OUTPUTS, "mono", 0.50); + + n2a03_device &n2a03b(N2A03(config, "n2a03b", NTSC_APU_CLOCK)); + n2a03b.set_addrmap(AS_PROGRAM, &dkong_state::dkong3_sound2_map); + n2a03b.add_route(ALL_OUTPUTS, "mono", 0.50); /* sound latches */ LATCH8(config, "latch1"); LATCH8(config, "latch2"); LATCH8(config, "latch3"); - - SPEAKER(config, "mono").front_center(); } diff --git a/src/mame/drivers/cham24.cpp b/src/mame/drivers/cham24.cpp index d1722d7b7ab..5255faf3b66 100644 --- a/src/mame/drivers/cham24.cpp +++ b/src/mame/drivers/cham24.cpp @@ -71,7 +71,7 @@ public: m_maincpu(*this, "maincpu"), m_ppu(*this, "ppu") { } - required_device m_maincpu; + required_device m_maincpu; required_device m_ppu; std::unique_ptr m_nt_ram; @@ -307,6 +307,7 @@ void cham24_state::cham24(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); + m_maincpu->add_route(ALL_OUTPUTS, "mono", 0.50); } ROM_START( cham24 ) diff --git a/src/mame/drivers/famibox.cpp b/src/mame/drivers/famibox.cpp index 8a7141d4581..5c01db664b9 100644 --- a/src/mame/drivers/famibox.cpp +++ b/src/mame/drivers/famibox.cpp @@ -82,7 +82,7 @@ public: DECLARE_INPUT_CHANGED_MEMBER(coin_inserted); private: - required_device m_maincpu; + required_device m_maincpu; required_device m_ppu; std::unique_ptr m_nt_ram; @@ -544,6 +544,7 @@ void famibox_state::famibox(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); + m_maincpu->add_route(ALL_OUTPUTS, "mono", 0.50); } diff --git a/src/mame/drivers/multigam.cpp b/src/mame/drivers/multigam.cpp index be652b261df..11034f792f3 100644 --- a/src/mame/drivers/multigam.cpp +++ b/src/mame/drivers/multigam.cpp @@ -143,7 +143,7 @@ protected: virtual void video_start() override; private: - required_device m_maincpu; + required_device m_maincpu; required_device m_ppu; required_ioport m_p1; required_ioport m_p2; @@ -1228,6 +1228,7 @@ void multigam_state::multigam(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); + m_maincpu->add_route(ALL_OUTPUTS, "mono", 0.50); } void multigam_state::multigm3(machine_config &config) diff --git a/src/mame/drivers/nes.cpp b/src/mame/drivers/nes.cpp index 916ef864af9..fc757d17824 100644 --- a/src/mame/drivers/nes.cpp +++ b/src/mame/drivers/nes.cpp @@ -51,8 +51,8 @@ INPUT_PORTS_END void nes_state::nes(machine_config &config) { /* basic machine hardware */ - N2A03(config, m_maincpu, NTSC_APU_CLOCK); - m_maincpu->set_addrmap(AS_PROGRAM, &nes_state::nes_map); + n2a03_device &maincpu(N2A03(config, m_maincpu, NTSC_APU_CLOCK)); + maincpu.set_addrmap(AS_PROGRAM, &nes_state::nes_map); SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_refresh_hz(60.0988); @@ -72,8 +72,7 @@ void nes_state::nes(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); - // note APU sound level here was specified as 0.90, not 0.50 like the others - // not sure how to adjust it when it's inside the CPU? + maincpu.add_route(ALL_OUTPUTS, "mono", 0.90); NES_CONTROL_PORT(config, m_ctrl1, nes_control_port1_devices, "joypad"); NES_CONTROL_PORT(config, m_ctrl2, nes_control_port2_devices, "joypad"); diff --git a/src/mame/drivers/playch10.cpp b/src/mame/drivers/playch10.cpp index 95c6e23bb36..51786fb2abc 100644 --- a/src/mame/drivers/playch10.cpp +++ b/src/mame/drivers/playch10.cpp @@ -294,7 +294,6 @@ Notes & Todo: #include "emu.h" #include "includes/playch10.h" -#include "cpu/m6502/n2a03.h" #include "cpu/z80/z80.h" #include "machine/74259.h" #include "machine/rp5h01.h" @@ -694,6 +693,7 @@ void playch10_state::playch10(machine_config &config) m_ppu->int_callback().append(FUNC(playch10_state::int_detect_w)); SPEAKER(config, "mono").front_center(); + m_cartcpu->add_route(ALL_OUTPUTS, "mono", 0.50); RP5H01(config, m_rp5h01, 0); } diff --git a/src/mame/drivers/punchout.cpp b/src/mame/drivers/punchout.cpp index b9faf70cad0..2eea40d1d90 100644 --- a/src/mame/drivers/punchout.cpp +++ b/src/mame/drivers/punchout.cpp @@ -118,7 +118,6 @@ DIP locations verified for: #include "includes/punchout.h" #include "cpu/z80/z80.h" -#include "cpu/m6502/n2a03.h" #include "machine/74259.h" #include "machine/gen_latch.h" #include "machine/nvram.h" @@ -668,9 +667,8 @@ void punchout_state::punchout(machine_config &config) bottom.set_palette(m_palette); /* sound hardware */ - // FIXME: this makes no sense - "lspeaker" on left and "mono" on right, with nothing routed to "mono" SPEAKER(config, "lspeaker").front_left(); - SPEAKER(config, "mono").front_right(); + SPEAKER(config, "rspeaker").front_right(); GENERIC_LATCH_8(config, "soundlatch"); GENERIC_LATCH_8(config, "soundlatch2"); @@ -678,6 +676,7 @@ void punchout_state::punchout(machine_config &config) VLM5030(config, m_vlm, N2A03_NTSC_XTAL/6); m_vlm->set_addrmap(0, &punchout_state::punchout_vlm_map); m_vlm->add_route(ALL_OUTPUTS, "lspeaker", 0.50); + m_audiocpu->add_route(ALL_OUTPUTS, "rspeaker", 0.50); } diff --git a/src/mame/drivers/vgmplay.cpp b/src/mame/drivers/vgmplay.cpp index 41596f9eecb..3bb02e22520 100644 --- a/src/mame/drivers/vgmplay.cpp +++ b/src/mame/drivers/vgmplay.cpp @@ -3654,20 +3654,14 @@ MACHINE_CONFIG_START(vgmplay_state::vgmplay) N2A03(config, m_nescpu[0], 0); m_nescpu[0]->set_addrmap(AS_PROGRAM, &vgmplay_state::nescpu_map<0>); m_nescpu[0]->set_disable(); - - auto *nesapu_0(dynamic_cast(config.device_find(m_nescpu[0], "nesapu"))); - nesapu_0->reset_routes(); - nesapu_0->add_route(ALL_OUTPUTS, ":lspeaker", 0.50); - nesapu_0->add_route(ALL_OUTPUTS, ":rspeaker", 0.50); + m_nescpu[0]->add_route(ALL_OUTPUTS, "lspeaker", 0.50); + m_nescpu[0]->add_route(ALL_OUTPUTS, "rspeaker", 0.50); N2A03(config, m_nescpu[1], 0); m_nescpu[1]->set_addrmap(AS_PROGRAM, &vgmplay_state::nescpu_map<1>); m_nescpu[1]->set_disable(); - - auto *nesapu_1(dynamic_cast(config.device_find(m_nescpu[1], "nesapu"))); - nesapu_1->reset_routes(); - nesapu_1->add_route(ALL_OUTPUTS, ":lspeaker", 0.50); - nesapu_1->add_route(ALL_OUTPUTS, ":rspeaker", 0.50); + m_nescpu[1]->add_route(ALL_OUTPUTS, "lspeaker", 0.50); + m_nescpu[1]->add_route(ALL_OUTPUTS, "rspeaker", 0.50); MULTIPCM(config, m_multipcm[0], 0); m_multipcm[0]->set_addrmap(0, &vgmplay_state::multipcm_map<0>); diff --git a/src/mame/drivers/vsnes.cpp b/src/mame/drivers/vsnes.cpp index 618e9df385a..923e5ca4e0d 100644 --- a/src/mame/drivers/vsnes.cpp +++ b/src/mame/drivers/vsnes.cpp @@ -1704,8 +1704,8 @@ INPUT_PORTS_END void vsnes_state::vsnes(machine_config &config) { /* basic machine hardware */ - N2A03(config, m_maincpu, NTSC_APU_CLOCK); - m_maincpu->set_addrmap(AS_PROGRAM, &vsnes_state::vsnes_cpu1_map); + n2a03_device &maincpu(N2A03(config, m_maincpu, NTSC_APU_CLOCK)); + maincpu.set_addrmap(AS_PROGRAM, &vsnes_state::vsnes_cpu1_map); /* some carts also trigger IRQs */ MCFG_MACHINE_RESET_OVERRIDE(vsnes_state,vsnes) MCFG_MACHINE_START_OVERRIDE(vsnes_state,vsnes) @@ -1724,6 +1724,7 @@ void vsnes_state::vsnes(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); + maincpu.add_route(ALL_OUTPUTS, "mono", 0.50); } void vsnes_state::jajamaru(machine_config &config) @@ -1769,11 +1770,11 @@ void vsnes_state::topgun(machine_config &config) void vsnes_state::vsdual(machine_config &config) { /* basic machine hardware */ - N2A03(config, m_maincpu, NTSC_APU_CLOCK); - m_maincpu->set_addrmap(AS_PROGRAM, &vsnes_state::vsnes_cpu1_map); + n2a03_device &maincpu(N2A03(config, m_maincpu, NTSC_APU_CLOCK)); + maincpu.set_addrmap(AS_PROGRAM, &vsnes_state::vsnes_cpu1_map); - N2A03(config, m_subcpu, NTSC_APU_CLOCK); - m_subcpu->set_addrmap(AS_PROGRAM, &vsnes_state::vsnes_cpu2_map); + n2a03_device &subcpu(N2A03(config, m_subcpu, NTSC_APU_CLOCK)); + subcpu.set_addrmap(AS_PROGRAM, &vsnes_state::vsnes_cpu2_map); MCFG_MACHINE_RESET_OVERRIDE(vsnes_state,vsdual) MCFG_MACHINE_START_OVERRIDE(vsnes_state,vsdual) @@ -1804,6 +1805,8 @@ void vsnes_state::vsdual(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); + maincpu.add_route(ALL_OUTPUTS, "mono", 0.50); + subcpu.add_route(ALL_OUTPUTS, "mono", 0.50); } void vsnes_state::vsdual_pi(machine_config &config) diff --git a/src/mame/includes/playch10.h b/src/mame/includes/playch10.h index cc04e5d7d9d..b844b5beb4a 100644 --- a/src/mame/includes/playch10.h +++ b/src/mame/includes/playch10.h @@ -5,6 +5,7 @@ #pragma once +#include "cpu/m6502/n2a03.h" #include "machine/rp5h01.h" #include "video/ppu2c0x.h" #include "emupal.h" @@ -119,7 +120,7 @@ private: uint32_t screen_update_playch10_single(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); required_device m_maincpu; - required_device m_cartcpu; + required_device m_cartcpu; required_device m_ppu; optional_device m_rp5h01; diff --git a/src/mame/includes/punchout.h b/src/mame/includes/punchout.h index 10df798bc52..1b5043de301 100644 --- a/src/mame/includes/punchout.h +++ b/src/mame/includes/punchout.h @@ -10,6 +10,7 @@ #pragma once +#include "cpu/m6502/n2a03.h" #include "machine/rp5c01.h" #include "machine/rp5h01.h" #include "sound/vlm5030.h" @@ -43,7 +44,7 @@ public: private: required_device m_maincpu; - required_device m_audiocpu; + required_device m_audiocpu; optional_device m_rtc; optional_device m_rp5h01; required_device m_vlm; -- cgit v1.2.3