summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu
diff options
context:
space:
mode:
author Olivier Galibert <galibert@pobox.com>2025-04-14 11:31:53 +0200
committer Olivier Galibert <galibert@pobox.com>2025-04-14 22:28:31 +0200
commitcef6157803320544651bfc96457d2f8a6df0abd6 (patch)
treef8a64867e3d654cdcad5f4c24824ea82e2c77194 /src/devices/cpu
parent9473c027358e1a2d5c93d240a48052368f9d3b84 (diff)
New sound infrastructure.sound
Should be added soon: - mute - lua hookup (with documentation) - speaker/microphone resampling To be added a little later: - compression - reverb Needs to be added by someone else: - coreaudio - direct - portaudio - xaudio2 - js
Diffstat (limited to 'src/devices/cpu')
-rw-r--r--src/devices/cpu/h6280/h6280.cpp6
-rw-r--r--src/devices/cpu/h8/gt913.cpp6
-rw-r--r--src/devices/cpu/h8/swx00.cpp6
-rw-r--r--src/devices/cpu/m6502/gew12.cpp2
-rw-r--r--src/devices/cpu/m6502/gew7.cpp6
-rw-r--r--src/devices/cpu/m6502/rp2a03.cpp6
-rw-r--r--src/devices/cpu/m6502/st2205u.cpp14
-rw-r--r--src/devices/cpu/m6502/st2205u.h2
-rw-r--r--src/devices/cpu/tms57002/tms57002.cpp27
-rw-r--r--src/devices/cpu/tms57002/tms57002.h2
-rw-r--r--src/devices/cpu/upd177x/upd177x.cpp8
-rw-r--r--src/devices/cpu/upd177x/upd177x.h2
12 files changed, 39 insertions, 48 deletions
diff --git a/src/devices/cpu/h6280/h6280.cpp b/src/devices/cpu/h6280/h6280.cpp
index f725e6065a5..1261de78a78 100644
--- a/src/devices/cpu/h6280/h6280.cpp
+++ b/src/devices/cpu/h6280/h6280.cpp
@@ -169,7 +169,7 @@ DEFINE_DEVICE_TYPE(H6280, h6280_device, "h6280", "Hudson Soft HuC6280")
h6280_device::h6280_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: cpu_device(mconfig, H6280, tag, owner, clock)
- , device_mixer_interface(mconfig, *this, 2)
+ , device_mixer_interface(mconfig, *this)
, m_program_config("program", ENDIANNESS_LITTLE, 8, 21, 0, 16, 0, address_map_constructor(FUNC(h6280_device::internal_map), this))
, m_io_config("io", ENDIANNESS_LITTLE, 8, 2)
, m_port_in_cb(*this, 0)
@@ -232,8 +232,8 @@ const h6280_device::ophandler h6280_device::s_opcodetable[256] =
void h6280_device::device_add_mconfig(machine_config &config)
{
C6280(config, m_psg, DERIVED_CLOCK(1,2));
- m_psg->add_route(0, *this, 1.0, AUTO_ALLOC_INPUT, 0);
- m_psg->add_route(1, *this, 1.0, AUTO_ALLOC_INPUT, 1);
+ m_psg->add_route(0, *this, 1.0, 0);
+ m_psg->add_route(1, *this, 1.0, 1);
}
void h6280_device::device_start()
diff --git a/src/devices/cpu/h8/gt913.cpp b/src/devices/cpu/h8/gt913.cpp
index 8201ac9d66d..620f82173a4 100644
--- a/src/devices/cpu/h8/gt913.cpp
+++ b/src/devices/cpu/h8/gt913.cpp
@@ -28,7 +28,7 @@ DEFINE_DEVICE_TYPE(GT913, gt913_device, "gt913", "Casio GT913F")
gt913_device::gt913_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
h8_device(mconfig, GT913, tag, owner, clock, address_map_constructor(FUNC(gt913_device::map), this)),
- device_mixer_interface(mconfig, *this, 2),
+ device_mixer_interface(mconfig, *this),
m_rom(*this, DEVICE_SELF),
m_data_config("data", ENDIANNESS_BIG, 16, 22, 0),
m_write_ple(*this),
@@ -102,8 +102,8 @@ void gt913_device::device_add_mconfig(machine_config &config)
GT913_SOUND(config, m_sound, DERIVED_CLOCK(1, 1));
m_sound->set_device_rom_tag(m_rom);
- m_sound->add_route(0, *this, 1.0, AUTO_ALLOC_INPUT, 0);
- m_sound->add_route(1, *this, 1.0, AUTO_ALLOC_INPUT, 1);
+ m_sound->add_route(0, *this, 1.0, 0);
+ m_sound->add_route(1, *this, 1.0, 1);
GT913_KBD_HLE(config, m_kbd, 0);
m_kbd->irq_cb().set([this] (int val) {
diff --git a/src/devices/cpu/h8/swx00.cpp b/src/devices/cpu/h8/swx00.cpp
index 12ff74e9bbf..f626a8303ae 100644
--- a/src/devices/cpu/h8/swx00.cpp
+++ b/src/devices/cpu/h8/swx00.cpp
@@ -7,7 +7,7 @@ DEFINE_DEVICE_TYPE(SWX00, swx00_device, "swx00", "Yamaha SWX00")
swx00_device::swx00_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock, u8 mode) :
h8s2000_device(mconfig, SWX00, tag, owner, clock, address_map_constructor(FUNC(swx00_device::map), this)),
- device_mixer_interface(mconfig, *this, 2),
+ device_mixer_interface(mconfig, *this),
m_intc(*this, "intc"),
m_adc(*this, "adc"),
m_dma(*this, "dma"),
@@ -316,8 +316,8 @@ void swx00_device::device_add_mconfig(machine_config &config)
SWX00_SOUND(config, m_swx00);
m_swx00->set_space(DEVICE_SELF, AS_S);
- m_swx00->add_route(0, DEVICE_SELF, 1.0, AUTO_ALLOC_INPUT, 0);
- m_swx00->add_route(1, DEVICE_SELF, 1.0, AUTO_ALLOC_INPUT, 1);
+ m_swx00->add_route(0, DEVICE_SELF, 1.0, 0);
+ m_swx00->add_route(1, DEVICE_SELF, 1.0, 1);
}
device_memory_interface::space_config_vector swx00_device::memory_space_config() const
diff --git a/src/devices/cpu/m6502/gew12.cpp b/src/devices/cpu/m6502/gew12.cpp
index 2459bb13517..4d77abc7771 100644
--- a/src/devices/cpu/m6502/gew12.cpp
+++ b/src/devices/cpu/m6502/gew12.cpp
@@ -20,7 +20,7 @@ DEFINE_DEVICE_TYPE(GEW12, gew12_device, "gew12", "Yamaha YMW728-F (GEW12)")
gew12_device::gew12_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: m6502_mcu_device_base<w65c02_device>(mconfig, GEW12, tag, owner, clock)
- , device_mixer_interface(mconfig, *this, 2)
+ , device_mixer_interface(mconfig, *this)
, m_in_cb(*this, 0xff), m_out_cb(*this)
, m_rom(*this, DEVICE_SELF)
, m_bank(*this, "bank%u", 0U)
diff --git a/src/devices/cpu/m6502/gew7.cpp b/src/devices/cpu/m6502/gew7.cpp
index 2594a2166ef..76e1378d9e8 100644
--- a/src/devices/cpu/m6502/gew7.cpp
+++ b/src/devices/cpu/m6502/gew7.cpp
@@ -20,7 +20,7 @@ DEFINE_DEVICE_TYPE(GEW7, gew7_device, "gew7", "Yamaha YMW270-F (GEW7)")
gew7_device::gew7_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: m6502_mcu_device_base<w65c02_device>(mconfig, GEW7, tag, owner, clock)
- , device_mixer_interface(mconfig, *this, 2)
+ , device_mixer_interface(mconfig, *this)
, m_in_cb(*this, 0xff), m_out_cb(*this)
, m_rom(*this, DEVICE_SELF)
, m_bank(*this, "bank%u", 0U)
@@ -37,8 +37,8 @@ void gew7_device::device_add_mconfig(machine_config &config)
{
GEW7_PCM(config, m_pcm, DERIVED_CLOCK(1, 1));
m_pcm->set_device_rom_tag(m_rom);
- m_pcm->add_route(0, *this, 1.0, AUTO_ALLOC_INPUT, 0);
- m_pcm->add_route(1, *this, 1.0, AUTO_ALLOC_INPUT, 1);
+ m_pcm->add_route(0, *this, 1.0, 0);
+ m_pcm->add_route(1, *this, 1.0, 1);
}
void gew7_device::device_start()
diff --git a/src/devices/cpu/m6502/rp2a03.cpp b/src/devices/cpu/m6502/rp2a03.cpp
index 0d9153b42f7..4132e780d5a 100644
--- a/src/devices/cpu/m6502/rp2a03.cpp
+++ b/src/devices/cpu/m6502/rp2a03.cpp
@@ -45,7 +45,7 @@ rp2a03_core_device::rp2a03_core_device(const machine_config &mconfig, const char
rp2a03_device::rp2a03_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
: rp2a03_core_device(mconfig, type, tag, owner, clock)
- , device_mixer_interface(mconfig, *this, 1)
+ , device_mixer_interface(mconfig, *this)
, m_apu(*this, "nesapu")
{
program_config.m_internal_map = address_map_constructor(FUNC(rp2a03_device::rp2a03_map), this);
@@ -84,7 +84,7 @@ void rp2a03_device::device_add_mconfig(machine_config &config)
APU_2A03(config, m_apu, DERIVED_CLOCK(1,1));
m_apu->irq().set(FUNC(rp2a03_device::apu_irq));
m_apu->mem_read().set(FUNC(rp2a03_device::apu_read_mem));
- m_apu->add_route(ALL_OUTPUTS, *this, 1.0, AUTO_ALLOC_INPUT, 0);
+ m_apu->add_route(ALL_OUTPUTS, *this, 1.0, 0);
}
void rp2a03g_device::device_add_mconfig(machine_config &config)
@@ -92,7 +92,7 @@ void rp2a03g_device::device_add_mconfig(machine_config &config)
NES_APU(config, m_apu, DERIVED_CLOCK(1,1));
m_apu->irq().set(FUNC(rp2a03g_device::apu_irq));
m_apu->mem_read().set(FUNC(rp2a03g_device::apu_read_mem));
- m_apu->add_route(ALL_OUTPUTS, *this, 1.0, AUTO_ALLOC_INPUT, 0);
+ m_apu->add_route(ALL_OUTPUTS, *this, 1.0, 0);
}
diff --git a/src/devices/cpu/m6502/st2205u.cpp b/src/devices/cpu/m6502/st2205u.cpp
index 8e63a20fab4..cf7639b9aca 100644
--- a/src/devices/cpu/m6502/st2205u.cpp
+++ b/src/devices/cpu/m6502/st2205u.cpp
@@ -101,25 +101,19 @@ st2302u_device::st2302u_device(const machine_config &mconfig, const char *tag, d
{
}
-void st2205u_base_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void st2205u_base_device::sound_stream_update(sound_stream &stream)
{
- // reset the output stream
- outputs[0].fill(0);
- outputs[1].fill(0);
- outputs[2].fill(0);
- outputs[3].fill(0);
-
- int samples = outputs[0].samples();
+ int samples = stream.samples();
int outpos = 0;
while (samples-- != 0)
{
for (int channel = 0; channel < 4; channel++)
{
s16 adpcm_contribution = m_adpcm_level[channel];
- outputs[channel].add_int(outpos, adpcm_contribution * 0x10, 32768);
+ stream.add_int(channel, outpos, adpcm_contribution * 0x10, 32768);
auto psg_contribution = std::sin((double)m_psg_freqcntr[channel]/4096.0f);
- outputs[channel].add_int(outpos, psg_contribution * m_psg_amplitude[channel]*0x80,32768);
+ stream.add_int(channel, outpos, psg_contribution * m_psg_amplitude[channel]*0x80,32768);
}
outpos++;
diff --git a/src/devices/cpu/m6502/st2205u.h b/src/devices/cpu/m6502/st2205u.h
index 17cc7f18740..cad10f08b3b 100644
--- a/src/devices/cpu/m6502/st2205u.h
+++ b/src/devices/cpu/m6502/st2205u.h
@@ -64,7 +64,7 @@ protected:
virtual void device_reset() override ATTR_COLD;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
+ virtual void sound_stream_update(sound_stream &stream) override;
virtual unsigned st2xxx_bt_divider(int n) const override;
virtual u8 st2xxx_prs_mask() const override { return 0xc0; }
diff --git a/src/devices/cpu/tms57002/tms57002.cpp b/src/devices/cpu/tms57002/tms57002.cpp
index 593a74e3263..3485ba25695 100644
--- a/src/devices/cpu/tms57002/tms57002.cpp
+++ b/src/devices/cpu/tms57002/tms57002.cpp
@@ -920,21 +920,20 @@ void tms57002_device::execute_run()
icount = 0;
}
-void tms57002_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void tms57002_device::sound_stream_update(sound_stream &stream)
{
- assert(inputs[0].samples() == 1);
- assert(outputs[0].samples() == 1);
-
- stream_buffer::sample_t in_scale = 32767.0 * ((st0 & ST0_SIM) ? 256.0 : 1.0);
- si[0] = s32(inputs[0].get(0) * in_scale) & 0xffffff;
- si[1] = s32(inputs[1].get(0) * in_scale) & 0xffffff;
- si[2] = s32(inputs[2].get(0) * in_scale) & 0xffffff;
- si[3] = s32(inputs[3].get(0) * in_scale) & 0xffffff;
-
- outputs[0].put_int(0, s32(so[0] << 8) >> 1, 32768 * 32768);
- outputs[1].put_int(0, s32(so[1] << 8) >> 1, 32768 * 32768);
- outputs[2].put_int(0, s32(so[2] << 8) >> 1, 32768 * 32768);
- outputs[3].put_int(0, s32(so[3] << 8) >> 1, 32768 * 32768);
+ assert(stream.samples() == 1);
+
+ sound_stream::sample_t in_scale = 32768.0 * ((st0 & ST0_SIM) ? 256.0 : 1.0);
+ si[0] = s32(stream.get(0, 0) * in_scale) & 0xffffff;
+ si[1] = s32(stream.get(1, 0) * in_scale) & 0xffffff;
+ si[2] = s32(stream.get(2, 0) * in_scale) & 0xffffff;
+ si[3] = s32(stream.get(3, 0) * in_scale) & 0xffffff;
+
+ stream.put(0, 0, s32(so[0] << 8) / 2147483648.0);
+ stream.put(1, 0, s32(so[1] << 8) / 2147483648.0);
+ stream.put(2, 0, s32(so[2] << 8) / 2147483648.0);
+ stream.put(3, 0, s32(so[3] << 8) / 2147483648.0);
sync_w(1);
}
diff --git a/src/devices/cpu/tms57002/tms57002.h b/src/devices/cpu/tms57002/tms57002.h
index 7a6dce18416..547afff6d08 100644
--- a/src/devices/cpu/tms57002/tms57002.h
+++ b/src/devices/cpu/tms57002/tms57002.h
@@ -36,7 +36,7 @@ public:
protected:
virtual void device_start() override ATTR_COLD;
virtual void device_reset() override ATTR_COLD;
- virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
+ virtual void sound_stream_update(sound_stream &stream) override;
virtual space_config_vector memory_space_config() const override;
virtual u32 execute_min_cycles() const noexcept override;
virtual u32 execute_max_cycles() const noexcept override;
diff --git a/src/devices/cpu/upd177x/upd177x.cpp b/src/devices/cpu/upd177x/upd177x.cpp
index b5cd302312f..f8e9590f873 100644
--- a/src/devices/cpu/upd177x/upd177x.cpp
+++ b/src/devices/cpu/upd177x/upd177x.cpp
@@ -782,13 +782,11 @@ void upd177x_cpu_device::execute_run()
}
-void upd177x_cpu_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void upd177x_cpu_device::sound_stream_update(sound_stream &stream)
{
- auto &buffer = outputs[0];
-
const int smpl = m_dac_sign ? -m_dac : m_dac;
- for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
- buffer.put_int(sampindex, smpl, 256);
+ stream.put_int(0, sampindex, smpl, 256);
}
}
diff --git a/src/devices/cpu/upd177x/upd177x.h b/src/devices/cpu/upd177x/upd177x.h
index 70a186acc55..0dcb245a446 100644
--- a/src/devices/cpu/upd177x/upd177x.h
+++ b/src/devices/cpu/upd177x/upd177x.h
@@ -57,7 +57,7 @@ protected:
virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
- virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
+ virtual void sound_stream_update(sound_stream &stream) override;
void program_map(address_map &map) ATTR_COLD;