Merge pull request #4846 from cam900/n2a03_devmix

n2a03.cpp : Add device_mixer_interface instead hardcoded tags
This commit is contained in:
R. Belmont 2019-04-02 14:54:41 -04:00 committed by GitHub
commit 14fbf641f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 42 additions and 36 deletions

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);

View File

@ -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();
}

View File

@ -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 )

View File

@ -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);
}

View File

@ -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)

View File

@ -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");

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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>);

View File

@ -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)

View File

@ -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;

View File

@ -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;