summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author R. Belmont <rb6502@users.noreply.github.com>2019-04-02 14:54:41 -0400
committer GitHub <noreply@github.com>2019-04-02 14:54:41 -0400
commit14fbf641f7a47e7519c40199aaca17049842d174 (patch)
treeb852fbc702b2e7d486b57c0ff709473f52fc60aa
parent901938e858fdda4ad8642a661bf9f3d7050d4b0a (diff)
parent3d0bb74c259f771c87c02bf8290183b05ff53b56 (diff)
Merge pull request #4846 from cam900/n2a03_devmix
n2a03.cpp : Add device_mixer_interface instead hardcoded tags
-rw-r--r--src/devices/bus/nes/mmc5.cpp2
-rw-r--r--src/devices/cpu/m6502/n2a03.cpp3
-rw-r--r--src/devices/cpu/m6502/n2a03.h2
-rw-r--r--src/mame/audio/dkong.cpp13
-rw-r--r--src/mame/drivers/cham24.cpp3
-rw-r--r--src/mame/drivers/famibox.cpp3
-rw-r--r--src/mame/drivers/multigam.cpp3
-rw-r--r--src/mame/drivers/nes.cpp7
-rw-r--r--src/mame/drivers/playch10.cpp2
-rw-r--r--src/mame/drivers/punchout.cpp5
-rw-r--r--src/mame/drivers/vgmplay.cpp14
-rw-r--r--src/mame/drivers/vsnes.cpp15
-rw-r--r--src/mame/includes/playch10.h3
-rw-r--r--src/mame/includes/punchout.h3
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<cpu_device> m_maincpu;
+ required_device<n2a03_device> m_maincpu;
required_device<ppu2c0x_device> m_ppu;
std::unique_ptr<uint8_t[]> 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<cpu_device> m_maincpu;
+ required_device<n2a03_device> m_maincpu;
required_device<ppu2c0x_device> m_ppu;
std::unique_ptr<uint8_t[]> 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<cpu_device> m_maincpu;
+ required_device<n2a03_device> m_maincpu;
required_device<ppu2c0x_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<device_sound_interface *>(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<device_sound_interface *>(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<cpu_device> m_maincpu;
- required_device<cpu_device> m_cartcpu;
+ required_device<n2a03_device> m_cartcpu;
required_device<ppu2c0x_device> m_ppu;
optional_device<rp5h01_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<cpu_device> m_maincpu;
- required_device<cpu_device> m_audiocpu;
+ required_device<n2a03_device> m_audiocpu;
optional_device<rp5c01_device> m_rtc;
optional_device<rp5h01_device> m_rp5h01;
required_device<vlm5030_device> m_vlm;