summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--docs/man/mame.62
-rw-r--r--docs/source/commandline/commandline-all.rst2
-rw-r--r--docs/source/luascript/ref-common.rst6
-rw-r--r--docs/source/luascript/ref-core.rst5
-rw-r--r--docs/source/luascript/ref-devices.rst49
-rw-r--r--docs/source/techspecs/audio_effects.rst147
-rw-r--r--docs/source/techspecs/device_sound_interface.rst286
-rw-r--r--docs/source/techspecs/index.rst3
-rw-r--r--docs/source/techspecs/m6502.rst4
-rw-r--r--docs/source/techspecs/osd_audio.rst348
-rw-r--r--docs/source/usingmame/mamemenus.rst108
-rw-r--r--hash/a7800.xml664
-rw-r--r--makefile5
-rw-r--r--scripts/src/bus.lua14
-rw-r--r--scripts/src/emu.lua12
-rw-r--r--scripts/src/mame/frontend.lua8
-rw-r--r--scripts/src/osd/modules.lua42
-rw-r--r--scripts/src/sound.lua12
-rw-r--r--src/devices/bus/a2bus/a2mcms.cpp16
-rw-r--r--src/devices/bus/a2bus/a2mcms.h2
-rw-r--r--src/devices/bus/a2bus/a2mockingboard.cpp20
-rw-r--r--src/devices/bus/a2bus/a2scsi.cpp7
-rw-r--r--src/devices/bus/amiga/cpuslot/a570.cpp7
-rw-r--r--src/devices/bus/bbc/1mhzbus/m5000.cpp19
-rw-r--r--src/devices/bus/bbc/1mhzbus/m5000.h2
-rw-r--r--src/devices/bus/cbus/pc9801_118.cpp7
-rw-r--r--src/devices/bus/cbus/pc9801_86.cpp38
-rw-r--r--src/devices/bus/cbus/sb16_ct2720.cpp19
-rw-r--r--src/devices/bus/centronics/covox.cpp7
-rw-r--r--src/devices/bus/centronics/samdac.cpp7
-rw-r--r--src/devices/bus/coco/coco_orch90.cpp7
-rw-r--r--src/devices/bus/coco/coco_ssc.cpp13
-rw-r--r--src/devices/bus/coco/coco_stecomp.cpp7
-rw-r--r--src/devices/bus/cpc/playcity.cpp7
-rw-r--r--src/devices/bus/isa/gblaster.cpp11
-rw-r--r--src/devices/bus/isa/gus.cpp22
-rw-r--r--src/devices/bus/isa/gus.h2
-rw-r--r--src/devices/bus/isa/sb16.cpp19
-rw-r--r--src/devices/bus/isa/sblaster.cpp31
-rw-r--r--src/devices/bus/isa/stereo_fx.cpp11
-rw-r--r--src/devices/bus/msx/cart/moonsound.cpp15
-rw-r--r--src/devices/bus/msx/cart/video80.cpp80
-rw-r--r--src/devices/bus/msx/module/sfg.cpp11
-rw-r--r--src/devices/bus/pc8801/gsx8800.cpp4
-rw-r--r--src/devices/bus/pc8801/hmb20.cpp4
-rw-r--r--src/devices/bus/pc8801/jmbx1.cpp12
-rw-r--r--src/devices/bus/pc8801/pc8801_23.cpp8
-rw-r--r--src/devices/bus/pc8801/pcg8100.cpp4
-rw-r--r--src/devices/bus/pci/sonicvibes.cpp15
-rw-r--r--src/devices/bus/pci/sw1000xg.cpp7
-rw-r--r--src/devices/bus/plg1x0/plg100-vl.cpp4
-rw-r--r--src/devices/bus/plg1x0/plg1x0.cpp4
-rw-r--r--src/devices/bus/plg1x0/plg1x0.h2
-rw-r--r--src/devices/bus/psi_kbd/hle.cpp34
-rw-r--r--src/devices/bus/rc2014/sound.cpp22
-rw-r--r--src/devices/bus/rs232/mboardd.cpp7
-rw-r--r--src/devices/bus/segaai/soundbox.cpp7
-rw-r--r--src/devices/bus/spectrum/neogs.cpp7
-rw-r--r--src/devices/bus/spectrum/uslot.cpp2
-rw-r--r--src/devices/bus/spectrum/usource.cpp2
-rw-r--r--src/devices/bus/spectrum/uspeech.cpp2
-rw-r--r--src/devices/bus/st/replay.cpp100
-rw-r--r--src/devices/bus/st/replay.h15
-rw-r--r--src/devices/bus/st/stcart.cpp40
-rw-r--r--src/devices/bus/st/stcart.h50
-rw-r--r--src/devices/bus/svi3x8/expander/expander.cpp5
-rw-r--r--src/devices/bus/svi3x8/expander/expander.h2
-rw-r--r--src/devices/bus/uts_kbd/extw.cpp2
-rw-r--r--src/devices/bus/waveblaster/db50xg.cpp4
-rw-r--r--src/devices/bus/waveblaster/db60xg.cpp4
-rw-r--r--src/devices/bus/waveblaster/omniwave.cpp4
-rw-r--r--src/devices/bus/waveblaster/waveblaster.cpp4
-rw-r--r--src/devices/bus/waveblaster/waveblaster.h2
-rw-r--r--src/devices/bus/waveblaster/wg130.cpp4
-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/sh/sh3comn.cpp5
-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
-rw-r--r--src/devices/imagedev/cassette.cpp107
-rw-r--r--src/devices/imagedev/cassette.h8
-rw-r--r--src/devices/imagedev/floppy.cpp7
-rw-r--r--src/devices/imagedev/floppy.h2
-rw-r--r--src/devices/machine/acorn_vidc.cpp21
-rw-r--r--src/devices/machine/acorn_vidc.h3
-rw-r--r--src/devices/machine/cr511b.cpp6
-rw-r--r--src/devices/machine/generalplus_gpl16250soc.cpp6
-rw-r--r--src/devices/machine/gt913_snd.cpp8
-rw-r--r--src/devices/machine/gt913_snd.h2
-rw-r--r--src/devices/machine/k054321.cpp20
-rw-r--r--src/devices/machine/k054321.h19
-rw-r--r--src/devices/machine/laserdsc.cpp28
-rw-r--r--src/devices/machine/laserdsc.h2
-rw-r--r--src/devices/machine/mc6852.cpp7
-rw-r--r--src/devices/machine/netlist.cpp30
-rw-r--r--src/devices/machine/netlist.h21
-rw-r--r--src/devices/machine/pxa255.cpp7
-rw-r--r--src/devices/machine/s2636.cpp7
-rw-r--r--src/devices/machine/s2636.h2
-rw-r--r--src/devices/machine/spg110.cpp6
-rw-r--r--src/devices/machine/spg2xx.cpp6
-rw-r--r--src/devices/machine/spg2xx_audio.cpp11
-rw-r--r--src/devices/machine/spg2xx_audio.h2
-rw-r--r--src/devices/machine/vrender0.cpp10
-rw-r--r--src/devices/machine/vrender0.h3
-rw-r--r--src/devices/sound/ad1848.cpp7
-rw-r--r--src/devices/sound/adc.cpp66
-rw-r--r--src/devices/sound/adc.h42
-rw-r--r--src/devices/sound/aica.cpp14
-rw-r--r--src/devices/sound/aica.h4
-rw-r--r--src/devices/sound/ap2010pcm.cpp11
-rw-r--r--src/devices/sound/ap2010pcm.h2
-rw-r--r--src/devices/sound/asc.cpp20
-rw-r--r--src/devices/sound/asc.h2
-rw-r--r--src/devices/sound/astrocde.cpp11
-rw-r--r--src/devices/sound/astrocde.h2
-rw-r--r--src/devices/sound/awacs.cpp10
-rw-r--r--src/devices/sound/awacs.h2
-rw-r--r--src/devices/sound/ay8910.cpp43
-rw-r--r--src/devices/sound/ay8910.h10
-rw-r--r--src/devices/sound/bbd.cpp114
-rw-r--r--src/devices/sound/bbd.h31
-rw-r--r--src/devices/sound/beep.cpp13
-rw-r--r--src/devices/sound/beep.h4
-rw-r--r--src/devices/sound/bsmt2000.cpp8
-rw-r--r--src/devices/sound/bsmt2000.h2
-rw-r--r--src/devices/sound/c140.cpp20
-rw-r--r--src/devices/sound/c140.h4
-rw-r--r--src/devices/sound/c352.cpp17
-rw-r--r--src/devices/sound/c352.h2
-rw-r--r--src/devices/sound/c6280.cpp12
-rw-r--r--src/devices/sound/c6280.h2
-rw-r--r--src/devices/sound/cdda.cpp21
-rw-r--r--src/devices/sound/cdda.h4
-rw-r--r--src/devices/sound/cdp1863.cpp13
-rw-r--r--src/devices/sound/cdp1863.h4
-rw-r--r--src/devices/sound/cdp1864.cpp13
-rw-r--r--src/devices/sound/cdp1864.h4
-rw-r--r--src/devices/sound/cdp1869.cpp17
-rw-r--r--src/devices/sound/cdp1869.h4
-rw-r--r--src/devices/sound/cem3394.cpp13
-rw-r--r--src/devices/sound/cem3394.h4
-rw-r--r--src/devices/sound/cf61909.cpp6
-rw-r--r--src/devices/sound/cf61909.h2
-rw-r--r--src/devices/sound/ct1745.cpp2
-rw-r--r--src/devices/sound/dac.cpp41
-rw-r--r--src/devices/sound/dac.h36
-rw-r--r--src/devices/sound/dac3350a.cpp10
-rw-r--r--src/devices/sound/dac3350a.h2
-rw-r--r--src/devices/sound/dac76.cpp14
-rw-r--r--src/devices/sound/dac76.h2
-rw-r--r--src/devices/sound/digitalk.cpp18
-rw-r--r--src/devices/sound/digitalk.h2
-rw-r--r--src/devices/sound/disc_cls.h12
-rw-r--r--src/devices/sound/disc_inp.hxx15
-rw-r--r--src/devices/sound/discrete.cpp7
-rw-r--r--src/devices/sound/discrete.h12
-rw-r--r--src/devices/sound/dmadac.cpp14
-rw-r--r--src/devices/sound/dmadac.h10
-rw-r--r--src/devices/sound/dspv.cpp3
-rw-r--r--src/devices/sound/dspv.h2
-rw-r--r--src/devices/sound/es1373.cpp22
-rw-r--r--src/devices/sound/es1373.h4
-rw-r--r--src/devices/sound/es5503.cpp8
-rw-r--r--src/devices/sound/es5503.h2
-rw-r--r--src/devices/sound/es5506.cpp20
-rw-r--r--src/devices/sound/es5506.h8
-rw-r--r--src/devices/sound/esqpump.cpp38
-rw-r--r--src/devices/sound/esqpump.h4
-rw-r--r--src/devices/sound/flt_biquad.cpp15
-rw-r--r--src/devices/sound/flt_biquad.h6
-rw-r--r--src/devices/sound/flt_rc.cpp22
-rw-r--r--src/devices/sound/flt_rc.h6
-rw-r--r--src/devices/sound/flt_vol.cpp6
-rw-r--r--src/devices/sound/flt_vol.h2
-rw-r--r--src/devices/sound/gaelco.cpp8
-rw-r--r--src/devices/sound/gaelco.h2
-rw-r--r--src/devices/sound/gb.cpp10
-rw-r--r--src/devices/sound/gb.h2
-rw-r--r--src/devices/sound/gew.cpp8
-rw-r--r--src/devices/sound/gew.h2
-rw-r--r--src/devices/sound/gt155.cpp8
-rw-r--r--src/devices/sound/gt155.h2
-rw-r--r--src/devices/sound/hc55516.cpp37
-rw-r--r--src/devices/sound/hc55516.h12
-rw-r--r--src/devices/sound/huc6230.cpp12
-rw-r--r--src/devices/sound/huc6230.h2
-rw-r--r--src/devices/sound/i5000.cpp8
-rw-r--r--src/devices/sound/i5000.h2
-rw-r--r--src/devices/sound/ics2115.cpp33
-rw-r--r--src/devices/sound/ics2115.h4
-rw-r--r--src/devices/sound/iopspu.cpp3
-rw-r--r--src/devices/sound/iopspu.h2
-rw-r--r--src/devices/sound/iremga20.cpp11
-rw-r--r--src/devices/sound/iremga20.h2
-rw-r--r--src/devices/sound/k005289.cpp7
-rw-r--r--src/devices/sound/k005289.h2
-rw-r--r--src/devices/sound/k007232.cpp8
-rw-r--r--src/devices/sound/k007232.h2
-rw-r--r--src/devices/sound/k051649.cpp9
-rw-r--r--src/devices/sound/k051649.h2
-rw-r--r--src/devices/sound/k053260.cpp13
-rw-r--r--src/devices/sound/k053260.h2
-rw-r--r--src/devices/sound/k054539.cpp12
-rw-r--r--src/devices/sound/k054539.h2
-rw-r--r--src/devices/sound/ks0164.cpp8
-rw-r--r--src/devices/sound/ks0164.h2
-rw-r--r--src/devices/sound/l7a1045_l6028_dsp_a.cpp12
-rw-r--r--src/devices/sound/l7a1045_l6028_dsp_a.h2
-rw-r--r--src/devices/sound/lc78836m.cpp10
-rw-r--r--src/devices/sound/lc78836m.h4
-rw-r--r--src/devices/sound/lc82310.cpp16
-rw-r--r--src/devices/sound/lc82310.h4
-rw-r--r--src/devices/sound/lmc1992.cpp3
-rw-r--r--src/devices/sound/lmc1992.h2
-rw-r--r--src/devices/sound/lynx.cpp19
-rw-r--r--src/devices/sound/lynx.h4
-rw-r--r--src/devices/sound/mas3507d.cpp25
-rw-r--r--src/devices/sound/mas3507d.h4
-rw-r--r--src/devices/sound/mea8000.cpp4
-rw-r--r--src/devices/sound/mea8000.h2
-rw-r--r--src/devices/sound/mixer.cpp2
-rw-r--r--src/devices/sound/mixer.h2
-rw-r--r--src/devices/sound/mm5837.cpp6
-rw-r--r--src/devices/sound/mm5837.h2
-rw-r--r--src/devices/sound/mmc5.cpp13
-rw-r--r--src/devices/sound/mmc5.h4
-rw-r--r--src/devices/sound/mos6560.cpp13
-rw-r--r--src/devices/sound/mos6560.h2
-rw-r--r--src/devices/sound/mos6581.cpp4
-rw-r--r--src/devices/sound/mos6581.h2
-rw-r--r--src/devices/sound/mos7360.cpp7
-rw-r--r--src/devices/sound/mos7360.h2
-rw-r--r--src/devices/sound/msm5205.cpp16
-rw-r--r--src/devices/sound/msm5205.h4
-rw-r--r--src/devices/sound/msm5232.cpp39
-rw-r--r--src/devices/sound/msm5232.h2
-rw-r--r--src/devices/sound/n63701x.cpp15
-rw-r--r--src/devices/sound/n63701x.h2
-rw-r--r--src/devices/sound/namco.cpp53
-rw-r--r--src/devices/sound/namco.h10
-rw-r--r--src/devices/sound/namco_163.cpp9
-rw-r--r--src/devices/sound/namco_163.h2
-rw-r--r--src/devices/sound/nes_apu.cpp13
-rw-r--r--src/devices/sound/nes_apu.h6
-rw-r--r--src/devices/sound/nn71003f.cpp2
-rw-r--r--src/devices/sound/nn71003f.h2
-rw-r--r--src/devices/sound/okim6258.cpp12
-rw-r--r--src/devices/sound/okim6258.h2
-rw-r--r--src/devices/sound/okim6295.cpp50
-rw-r--r--src/devices/sound/okim6295.h8
-rw-r--r--src/devices/sound/okim6376.cpp18
-rw-r--r--src/devices/sound/okim6376.h2
-rw-r--r--src/devices/sound/okim6588.cpp4
-rw-r--r--src/devices/sound/okim6588.h2
-rw-r--r--src/devices/sound/okim9810.cpp26
-rw-r--r--src/devices/sound/okim9810.h4
-rw-r--r--src/devices/sound/pcd3311.cpp3
-rw-r--r--src/devices/sound/pcd3311.h2
-rw-r--r--src/devices/sound/pokey.cpp20
-rw-r--r--src/devices/sound/pokey.h4
-rw-r--r--src/devices/sound/qs1000.cpp18
-rw-r--r--src/devices/sound/qs1000.h2
-rw-r--r--src/devices/sound/qsound.cpp6
-rw-r--r--src/devices/sound/qsound.h2
-rw-r--r--src/devices/sound/qsoundhle.cpp8
-rw-r--r--src/devices/sound/qsoundhle.h2
-rw-r--r--src/devices/sound/rf5c400.cpp21
-rw-r--r--src/devices/sound/rf5c400.h2
-rw-r--r--src/devices/sound/rf5c68.cpp29
-rw-r--r--src/devices/sound/rf5c68.h2
-rw-r--r--src/devices/sound/roland_gp.cpp2
-rw-r--r--src/devices/sound/roland_gp.h2
-rw-r--r--src/devices/sound/roland_lp.cpp11
-rw-r--r--src/devices/sound/roland_lp.h2
-rw-r--r--src/devices/sound/roland_sa.cpp11
-rw-r--r--src/devices/sound/roland_sa.h2
-rw-r--r--src/devices/sound/rp2c33_snd.cpp6
-rw-r--r--src/devices/sound/rp2c33_snd.h2
-rw-r--r--src/devices/sound/s14001a.cpp6
-rw-r--r--src/devices/sound/s14001a.h2
-rw-r--r--src/devices/sound/s_dsp.cpp8
-rw-r--r--src/devices/sound/s_dsp.h2
-rw-r--r--src/devices/sound/saa1099.cpp13
-rw-r--r--src/devices/sound/saa1099.h2
-rw-r--r--src/devices/sound/samples.cpp18
-rw-r--r--src/devices/sound/samples.h2
-rw-r--r--src/devices/sound/scsp.cpp21
-rw-r--r--src/devices/sound/scsp.h4
-rw-r--r--src/devices/sound/segapcm.cpp12
-rw-r--r--src/devices/sound/segapcm.h2
-rw-r--r--src/devices/sound/setapcm.cpp11
-rw-r--r--src/devices/sound/setapcm.h2
-rw-r--r--src/devices/sound/sid.cpp10
-rw-r--r--src/devices/sound/sid.h2
-rw-r--r--src/devices/sound/sn76477.cpp8
-rw-r--r--src/devices/sound/sn76477.h2
-rw-r--r--src/devices/sound/sn76496.cpp10
-rw-r--r--src/devices/sound/sn76496.h2
-rw-r--r--src/devices/sound/snkwave.cpp11
-rw-r--r--src/devices/sound/snkwave.h2
-rw-r--r--src/devices/sound/sp0250.cpp18
-rw-r--r--src/devices/sound/sp0250.h2
-rw-r--r--src/devices/sound/sp0256.cpp13
-rw-r--r--src/devices/sound/sp0256.h2
-rw-r--r--src/devices/sound/spkrdev.cpp17
-rw-r--r--src/devices/sound/spkrdev.h2
-rw-r--r--src/devices/sound/spu.cpp13
-rw-r--r--src/devices/sound/spu.h2
-rw-r--r--src/devices/sound/ssi263hle.cpp4
-rw-r--r--src/devices/sound/st0016.cpp11
-rw-r--r--src/devices/sound/st0016.h2
-rw-r--r--src/devices/sound/stt_sa1.cpp11
-rw-r--r--src/devices/sound/stt_sa1.h2
-rw-r--r--src/devices/sound/swp00.cpp8
-rw-r--r--src/devices/sound/swp00.h2
-rw-r--r--src/devices/sound/swp20.cpp4
-rw-r--r--src/devices/sound/swp20.h2
-rw-r--r--src/devices/sound/swp30.cpp6
-rw-r--r--src/devices/sound/swp30.h2
-rw-r--r--src/devices/sound/swx00.cpp8
-rw-r--r--src/devices/sound/swx00.h2
-rw-r--r--src/devices/sound/t6721a.cpp3
-rw-r--r--src/devices/sound/t6721a.h2
-rw-r--r--src/devices/sound/t6w28.cpp21
-rw-r--r--src/devices/sound/t6w28.h2
-rw-r--r--src/devices/sound/tc8830f.cpp6
-rw-r--r--src/devices/sound/tc8830f.h2
-rw-r--r--src/devices/sound/tiaintf.cpp4
-rw-r--r--src/devices/sound/tiaintf.h2
-rw-r--r--src/devices/sound/tiasound.cpp10
-rw-r--r--src/devices/sound/tiasound.h2
-rw-r--r--src/devices/sound/tms3615.cpp17
-rw-r--r--src/devices/sound/tms3615.h2
-rw-r--r--src/devices/sound/tms36xx.cpp10
-rw-r--r--src/devices/sound/tms36xx.h2
-rw-r--r--src/devices/sound/tms5110.cpp9
-rw-r--r--src/devices/sound/tms5110.h2
-rw-r--r--src/devices/sound/tms5220.cpp9
-rw-r--r--src/devices/sound/tms5220.h2
-rw-r--r--src/devices/sound/tt5665.cpp45
-rw-r--r--src/devices/sound/tt5665.h6
-rw-r--r--src/devices/sound/uda1344.cpp18
-rw-r--r--src/devices/sound/uda1344.h6
-rw-r--r--src/devices/sound/upd65043gfu01.cpp6
-rw-r--r--src/devices/sound/upd65043gfu01.h2
-rw-r--r--src/devices/sound/upd7752.cpp3
-rw-r--r--src/devices/sound/upd7752.h2
-rw-r--r--src/devices/sound/upd7759.cpp16
-rw-r--r--src/devices/sound/upd7759.h2
-rw-r--r--src/devices/sound/upd931.cpp6
-rw-r--r--src/devices/sound/upd931.h2
-rw-r--r--src/devices/sound/upd933.cpp6
-rw-r--r--src/devices/sound/upd933.h2
-rw-r--r--src/devices/sound/upd934g.cpp9
-rw-r--r--src/devices/sound/upd934g.h2
-rw-r--r--src/devices/sound/va_eg.cpp15
-rw-r--r--src/devices/sound/va_eg.h12
-rw-r--r--src/devices/sound/va_vca.cpp10
-rw-r--r--src/devices/sound/va_vca.h2
-rw-r--r--src/devices/sound/vgm_visualizer.cpp18
-rw-r--r--src/devices/sound/vgm_visualizer.h4
-rw-r--r--src/devices/sound/vlm5030.cpp18
-rw-r--r--src/devices/sound/vlm5030.h2
-rw-r--r--src/devices/sound/votrax.cpp8
-rw-r--r--src/devices/sound/votrax.h4
-rw-r--r--src/devices/sound/vrc6.cpp9
-rw-r--r--src/devices/sound/vrc6.h2
-rw-r--r--src/devices/sound/vrender0.cpp12
-rw-r--r--src/devices/sound/vrender0.h4
-rw-r--r--src/devices/sound/wave.cpp19
-rw-r--r--src/devices/sound/wave.h2
-rw-r--r--src/devices/sound/x1_010.cpp26
-rw-r--r--src/devices/sound/x1_010.h2
-rw-r--r--src/devices/sound/xt446.cpp6
-rw-r--r--src/devices/sound/ym2154.cpp14
-rw-r--r--src/devices/sound/ym2154.h2
-rw-r--r--src/devices/sound/ymf271.cpp28
-rw-r--r--src/devices/sound/ymf271.h2
-rw-r--r--src/devices/sound/ymfm_mame.h16
-rw-r--r--src/devices/sound/ymopl.cpp4
-rw-r--r--src/devices/sound/ymopl.h2
-rw-r--r--src/devices/sound/ymz280b.cpp18
-rw-r--r--src/devices/sound/ymz280b.h2
-rw-r--r--src/devices/sound/ymz770.cpp11
-rw-r--r--src/devices/sound/ymz770.h2
-rw-r--r--src/devices/sound/zsg2.cpp6
-rw-r--r--src/devices/sound/zsg2.h2
-rw-r--r--src/devices/video/315_5124.cpp8
-rw-r--r--src/devices/video/315_5313.cpp2
-rw-r--r--src/devices/video/ef9345.cpp20
-rw-r--r--src/devices/video/i8244.cpp8
-rw-r--r--src/devices/video/i8244.h2
-rw-r--r--src/emu/audio_effects/aeffect.cpp46
-rw-r--r--src/emu/audio_effects/aeffect.h43
-rw-r--r--src/emu/audio_effects/compressor.cpp28
-rw-r--r--src/emu/audio_effects/compressor.h24
-rw-r--r--src/emu/audio_effects/eq.cpp331
-rw-r--r--src/emu/audio_effects/eq.h84
-rw-r--r--src/emu/audio_effects/filter.cpp259
-rw-r--r--src/emu/audio_effects/filter.h78
-rw-r--r--src/emu/audio_effects/reverb.cpp28
-rw-r--r--src/emu/audio_effects/reverb.h24
-rw-r--r--src/emu/device.cpp2
-rw-r--r--src/emu/disound.cpp458
-rw-r--r--src/emu/disound.h72
-rw-r--r--src/emu/emufwd.h2
-rw-r--r--src/emu/inpttype.h2
-rw-r--r--src/emu/inpttype.ipp2
-rw-r--r--src/emu/machine.cpp7
-rw-r--r--src/emu/main.h3
-rw-r--r--src/emu/recording.cpp13
-rw-r--r--src/emu/recording.h3
-rw-r--r--src/emu/resampler.cpp317
-rw-r--r--src/emu/resampler.h35
-rw-r--r--src/emu/sound.cpp3283
-rw-r--r--src/emu/sound.h1060
-rw-r--r--src/emu/speaker.cpp235
-rw-r--r--src/emu/speaker.h131
-rw-r--r--src/frontend/mame/infoxml.cpp2
-rw-r--r--src/frontend/mame/luaengine.cpp86
-rw-r--r--src/frontend/mame/luaengine.h4
-rw-r--r--src/frontend/mame/mame.cpp4
-rw-r--r--src/frontend/mame/ui/audio_effect_eq.cpp365
-rw-r--r--src/frontend/mame/ui/audio_effect_eq.h61
-rw-r--r--src/frontend/mame/ui/audio_effect_filter.cpp351
-rw-r--r--src/frontend/mame/ui/audio_effect_filter.h60
-rw-r--r--src/frontend/mame/ui/audioeffects.cpp95
-rw-r--r--src/frontend/mame/ui/audioeffects.h40
-rw-r--r--src/frontend/mame/ui/audiomix.cpp1053
-rw-r--r--src/frontend/mame/ui/audiomix.h95
-rw-r--r--src/frontend/mame/ui/devopt.cpp2
-rw-r--r--src/frontend/mame/ui/info.cpp2
-rw-r--r--src/frontend/mame/ui/mainmenu.cpp16
-rw-r--r--src/frontend/mame/ui/ui.cpp111
-rw-r--r--src/frontend/mame/ui/ui.h4
-rw-r--r--src/lib/util/aviio.cpp2
-rw-r--r--src/mame/access/acvirus.cpp3
-rw-r--r--src/mame/acorn/electron_ula.cpp13
-rw-r--r--src/mame/acorn/electron_ula.h4
-rw-r--r--src/mame/acorn/ssfindo.cpp7
-rw-r--r--src/mame/act/victor9k.cpp18
-rw-r--r--src/mame/akai/mpc3000.cpp7
-rw-r--r--src/mame/alesis/alesis_a.cpp8
-rw-r--r--src/mame/alesis/midiverb.cpp103
-rw-r--r--src/mame/amiga/akiko.cpp4
-rw-r--r--src/mame/amiga/alg.cpp15
-rw-r--r--src/mame/amiga/amiga.cpp15
-rw-r--r--src/mame/amiga/arsystems.cpp11
-rw-r--r--src/mame/amiga/cubo.cpp11
-rw-r--r--src/mame/amiga/mquake.cpp15
-rw-r--r--src/mame/amiga/paula.cpp10
-rw-r--r--src/mame/amiga/paula.h2
-rw-r--r--src/mame/amiga/upscope.cpp11
-rw-r--r--src/mame/apple/apple2gs.cpp9
-rw-r--r--src/mame/apple/awacs_macrisc.cpp10
-rw-r--r--src/mame/apple/awacs_macrisc.h2
-rw-r--r--src/mame/apple/burgundy.cpp10
-rw-r--r--src/mame/apple/burgundy.h2
-rw-r--r--src/mame/apple/dfac.cpp20
-rw-r--r--src/mame/apple/dfac.h2
-rw-r--r--src/mame/apple/f108.cpp4
-rw-r--r--src/mame/apple/imacg3.cpp7
-rw-r--r--src/mame/apple/iosb.cpp7
-rw-r--r--src/mame/apple/mac128.cpp7
-rw-r--r--src/mame/apple/macii.cpp11
-rw-r--r--src/mame/apple/maciici.cpp11
-rw-r--r--src/mame/apple/maciifx.cpp7
-rw-r--r--src/mame/apple/maciivx.cpp15
-rw-r--r--src/mame/apple/maclc.cpp27
-rw-r--r--src/mame/apple/maclc3.cpp19
-rw-r--r--src/mame/apple/macpdm.cpp11
-rw-r--r--src/mame/apple/macprtb.cpp11
-rw-r--r--src/mame/apple/macpwrbk030.cpp11
-rw-r--r--src/mame/apple/macpwrbkmsc.cpp15
-rw-r--r--src/mame/apple/macquadra605.cpp4
-rw-r--r--src/mame/apple/macquadra700.cpp11
-rw-r--r--src/mame/apple/macquadra800.cpp4
-rw-r--r--src/mame/apple/msc.cpp15
-rw-r--r--src/mame/apple/msc.h2
-rw-r--r--src/mame/apple/pippin.cpp7
-rw-r--r--src/mame/apple/powermacg3.cpp7
-rw-r--r--src/mame/apple/scsidma.cpp4
-rw-r--r--src/mame/apple/sonora.cpp18
-rw-r--r--src/mame/apple/sonora.h2
-rw-r--r--src/mame/apple/v8.cpp23
-rw-r--r--src/mame/apple/v8.h2
-rw-r--r--src/mame/apple/vasp.cpp15
-rw-r--r--src/mame/apple/vasp.h2
-rw-r--r--src/mame/arcadia/arcadia_a.cpp9
-rw-r--r--src/mame/arcadia/arcadia_a.h2
-rw-r--r--src/mame/atari/atarigt.cpp24
-rw-r--r--src/mame/atari/atarigx2.cpp7
-rw-r--r--src/mame/atari/atarijsa.cpp46
-rw-r--r--src/mame/atari/atarijsa.h6
-rw-r--r--src/mame/atari/atarisac.cpp10
-rw-r--r--src/mame/atari/atarist.cpp37
-rw-r--r--src/mame/atari/atarisy1.cpp15
-rw-r--r--src/mame/atari/atarisy2.cpp15
-rw-r--r--src/mame/atari/blstroid.cpp7
-rw-r--r--src/mame/atari/canyon.cpp7
-rw-r--r--src/mame/atari/cops.cpp8
-rw-r--r--src/mame/atari/copsnrob.cpp7
-rw-r--r--src/mame/atari/cyberbal.cpp7
-rw-r--r--src/mame/atari/cybstorm.cpp7
-rw-r--r--src/mame/atari/dragrace.cpp7
-rw-r--r--src/mame/atari/firefox.cpp15
-rw-r--r--src/mame/atari/gauntlet.cpp15
-rw-r--r--src/mame/atari/harddriv.cpp10
-rw-r--r--src/mame/atari/jaguar.cpp18
-rw-r--r--src/mame/atari/jedi.cpp19
-rw-r--r--src/mame/atari/lynx.cpp7
-rw-r--r--src/mame/atari/mediagx.cpp7
-rw-r--r--src/mame/atari/metalmx.cpp13
-rw-r--r--src/mame/atari/orbit.cpp7
-rw-r--r--src/mame/atari/redbaron.cpp7
-rw-r--r--src/mame/atari/redbaron.h2
-rw-r--r--src/mame/atari/sprint2.cpp10
-rw-r--r--src/mame/atari/sprint4.cpp7
-rw-r--r--src/mame/atari/subs.cpp5
-rw-r--r--src/mame/atari/tomcat.cpp13
-rw-r--r--src/mame/atari/toobin.cpp7
-rw-r--r--src/mame/atari/vindictr.cpp7
-rw-r--r--src/mame/atari/xybots.cpp7
-rw-r--r--src/mame/atlus/rallypnt.cpp7
-rw-r--r--src/mame/ausnz/applix.cpp9
-rw-r--r--src/mame/bandai/wswan.cpp7
-rw-r--r--src/mame/barcrest/mpu4vid.cpp15
-rw-r--r--src/mame/barcrest/mpu5.cpp3
-rw-r--r--src/mame/bfm/bfm_ad5.cpp3
-rw-r--r--src/mame/bfm/rastersp.cpp7
-rw-r--r--src/mame/bitcorp/gamate.cpp12
-rw-r--r--src/mame/bmc/bmcbowl.cpp15
-rw-r--r--src/mame/bmc/koftball.cpp11
-rw-r--r--src/mame/capcom/cps1.cpp7
-rw-r--r--src/mame/capcom/cps2.cpp11
-rw-r--r--src/mame/capcom/cps3.cpp7
-rw-r--r--src/mame/capcom/cps3_a.cpp19
-rw-r--r--src/mame/capcom/cps3_a.h2
-rw-r--r--src/mame/capcom/sf.cpp15
-rw-r--r--src/mame/casio/ct8000.cpp40
-rw-r--r--src/mame/casio/ctk551.cpp35
-rw-r--r--src/mame/casio/cz1.cpp7
-rw-r--r--src/mame/casio/pv1000.cpp10
-rw-r--r--src/mame/casio/wk1800.cpp7
-rw-r--r--src/mame/cinematronics/dlair.cpp26
-rw-r--r--src/mame/commodore/c65.cpp7
-rw-r--r--src/mame/dai/dai.cpp5
-rw-r--r--src/mame/dai/dai_snd.cpp11
-rw-r--r--src/mame/dai/dai_snd.h2
-rw-r--r--src/mame/dataeast/backfire.cpp7
-rw-r--r--src/mame/dataeast/boogwing.cpp21
-rw-r--r--src/mame/dataeast/dassault.cpp23
-rw-r--r--src/mame/dataeast/deco156.cpp7
-rw-r--r--src/mame/dataeast/deco32.cpp102
-rw-r--r--src/mame/dataeast/deco_ld.cpp11
-rw-r--r--src/mame/dataeast/deco_mlc.cpp18
-rw-r--r--src/mame/dataeast/funkyjet.cpp15
-rw-r--r--src/mame/dataeast/lemmings.cpp11
-rw-r--r--src/mame/dataeast/rohga.cpp21
-rw-r--r--src/mame/dgrm/blackt96.cpp11
-rw-r--r--src/mame/dynax/realbrk.cpp11
-rw-r--r--src/mame/edevices/mugsmash.cpp11
-rw-r--r--src/mame/elektron/elektronmono.cpp3
-rw-r--r--src/mame/ensoniq/esq1.cpp19
-rw-r--r--src/mame/ensoniq/esq5505.cpp14
-rw-r--r--src/mame/ensoniq/esqasr.cpp14
-rw-r--r--src/mame/ensoniq/esqkt.cpp30
-rw-r--r--src/mame/ensoniq/esqmr.cpp11
-rw-r--r--src/mame/enterprise/dave.cpp11
-rw-r--r--src/mame/enterprise/dave.h2
-rw-r--r--src/mame/enterprise/ep64.cpp11
-rw-r--r--src/mame/eolith/eolith.cpp7
-rw-r--r--src/mame/eolith/eolith16.cpp7
-rw-r--r--src/mame/eolith/ghosteo.cpp7
-rw-r--r--src/mame/eolith/vegaeo.cpp7
-rw-r--r--src/mame/excellent/aquarium.cpp11
-rw-r--r--src/mame/excellent/es9501.cpp11
-rw-r--r--src/mame/exidy/exidy440.cpp7
-rw-r--r--src/mame/exidy/exidy440_a.cpp26
-rw-r--r--src/mame/exidy/exidy440_a.h4
-rw-r--r--src/mame/exidy/starfire.cpp7
-rw-r--r--src/mame/exidy/vertigo.cpp7
-rw-r--r--src/mame/f32/f-32.cpp22
-rw-r--r--src/mame/fairchild/channelf_a.cpp10
-rw-r--r--src/mame/fairchild/channelf_a.h2
-rw-r--r--src/mame/fairlight/cmi01a.cpp9
-rw-r--r--src/mame/fairlight/cmi01a.h2
-rw-r--r--src/mame/fujitsu/fmtowns.cpp23
-rw-r--r--src/mame/fujitsu/fmtowns.h2
-rw-r--r--src/mame/funtech/supracan.cpp7
-rw-r--r--src/mame/funtech/umc6619_sound.cpp12
-rw-r--r--src/mame/funtech/umc6619_sound.h2
-rw-r--r--src/mame/fuuki/fuukifg3.cpp15
-rw-r--r--src/mame/gaelco/gaelco2.cpp70
-rw-r--r--src/mame/gamepark/gp2x.cpp3
-rw-r--r--src/mame/gamepark/gp32.cpp7
-rw-r--r--src/mame/hp/hp16500.cpp12
-rw-r--r--src/mame/hp/hp80.cpp4
-rw-r--r--src/mame/hp/hp_ipc.cpp2
-rw-r--r--src/mame/hp/jornada.cpp7
-rw-r--r--src/mame/ibm/thinkpad8xx.cpp3
-rw-r--r--src/mame/igs/goldstar.cpp124
-rw-r--r--src/mame/igs/igs017.cpp134
-rw-r--r--src/mame/igs/pgm.cpp64
-rw-r--r--src/mame/igs/pgm.h30
-rw-r--r--src/mame/igs/pgm2.cpp7
-rw-r--r--src/mame/igs/pgmprot_igs027a_type1.cpp2
-rw-r--r--src/mame/igs/pgmprot_igs027a_type1.h1
-rw-r--r--src/mame/interton/vc4000_a.cpp9
-rw-r--r--src/mame/interton/vc4000_a.h2
-rw-r--r--src/mame/irem/m107.cpp11
-rw-r--r--src/mame/irem/m119.cpp7
-rw-r--r--src/mame/irem/m78.cpp9
-rw-r--r--src/mame/irem/m80.cpp9
-rw-r--r--src/mame/irem/vigilant.cpp100
-rw-r--r--src/mame/itech/iteagle.cpp2
-rw-r--r--src/mame/itech/itech32.cpp7
-rw-r--r--src/mame/jaleco/acommand.cpp11
-rw-r--r--src/mame/jaleco/bestleag.cpp7
-rw-r--r--src/mame/jaleco/bigstrkb.cpp11
-rw-r--r--src/mame/jaleco/bnstars.cpp19
-rw-r--r--src/mame/jaleco/cischeat.cpp37
-rw-r--r--src/mame/jaleco/jaleco_vj_pc.cpp6
-rw-r--r--src/mame/jaleco/jaleco_vj_sound.cpp6
-rw-r--r--src/mame/jaleco/megasys1.cpp42
-rw-r--r--src/mame/jaleco/ms32.cpp11
-rw-r--r--src/mame/jaleco/tetrisp2.cpp42
-rw-r--r--src/mame/jpm/jpmsys7.cpp3
-rw-r--r--src/mame/jpm/pluto5.cpp3
-rw-r--r--src/mame/jpm/pluto6.cpp3
-rw-r--r--src/mame/kaneko/djboy.cpp11
-rw-r--r--src/mame/kaneko/galpani2.cpp7
-rw-r--r--src/mame/kaneko/jchan.cpp7
-rw-r--r--src/mame/kaneko/kaneko16.cpp7
-rw-r--r--src/mame/kaneko/suprnova.cpp7
-rw-r--r--src/mame/konami/ajax.cpp17
-rw-r--r--src/mame/konami/asterix.cpp9
-rw-r--r--src/mame/konami/bishi.cpp7
-rw-r--r--src/mame/konami/chqflag.cpp19
-rw-r--r--src/mame/konami/cobra.cpp11
-rw-r--r--src/mame/konami/contra.cpp5
-rw-r--r--src/mame/konami/cougar.cpp7
-rw-r--r--src/mame/konami/crimfght.cpp15
-rw-r--r--src/mame/konami/dbz.cpp11
-rw-r--r--src/mame/konami/djmain.cpp11
-rw-r--r--src/mame/konami/firebeat.cpp56
-rw-r--r--src/mame/konami/flkatck.cpp13
-rw-r--r--src/mame/konami/gijoe.cpp9
-rw-r--r--src/mame/konami/goldenregion.cpp7
-rw-r--r--src/mame/konami/gradius3.cpp13
-rw-r--r--src/mame/konami/gticlub.cpp14
-rw-r--r--src/mame/konami/gyruss.cpp7
-rw-r--r--src/mame/konami/hornet.cpp7
-rw-r--r--src/mame/konami/jackal.cpp5
-rw-r--r--src/mame/konami/k573dio.cpp4
-rw-r--r--src/mame/konami/konamigq.cpp11
-rw-r--r--src/mame/konami/konamigv.cpp11
-rw-r--r--src/mame/konami/konamigx.cpp19
-rw-r--r--src/mame/konami/konamigx.h15
-rw-r--r--src/mame/konami/konamigx_v.cpp42
-rw-r--r--src/mame/konami/konamim2.cpp15
-rw-r--r--src/mame/konami/konendev.cpp7
-rw-r--r--src/mame/konami/kongs470.cpp7
-rw-r--r--src/mame/konami/konmedal.cpp7
-rw-r--r--src/mame/konami/konmedal020.cpp7
-rw-r--r--src/mame/konami/konmedal68k.cpp7
-rw-r--r--src/mame/konami/konmedalppc.cpp7
-rw-r--r--src/mame/konami/kontest.cpp7
-rw-r--r--src/mame/konami/kpontoon.cpp7
-rw-r--r--src/mame/konami/ksys573.cpp11
-rw-r--r--src/mame/konami/lethal.cpp9
-rw-r--r--src/mame/konami/mogura.cpp7
-rw-r--r--src/mame/konami/moo.cpp18
-rw-r--r--src/mame/konami/mystwarr.cpp17
-rw-r--r--src/mame/konami/nemesis.cpp41
-rw-r--r--src/mame/konami/nwk-tr.cpp7
-rw-r--r--src/mame/konami/overdriv.cpp13
-rw-r--r--src/mame/konami/parodius.cpp9
-rw-r--r--src/mame/konami/piratesh.cpp7
-rw-r--r--src/mame/konami/plygonet.cpp9
-rw-r--r--src/mame/konami/qdrmfgp.cpp14
-rw-r--r--src/mame/konami/rockrage.cpp9
-rw-r--r--src/mame/konami/rungun.cpp13
-rw-r--r--src/mame/konami/simpsons.cpp15
-rw-r--r--src/mame/konami/stingnet.cpp7
-rw-r--r--src/mame/konami/surpratk.cpp7
-rw-r--r--src/mame/konami/tasman.cpp3
-rw-r--r--src/mame/konami/tmnt2.cpp68
-rw-r--r--src/mame/konami/twin16.cpp34
-rw-r--r--src/mame/konami/ultraman.cpp9
-rw-r--r--src/mame/konami/ultrsprt.cpp7
-rw-r--r--src/mame/konami/vendetta.cpp9
-rw-r--r--src/mame/konami/viper.cpp17
-rw-r--r--src/mame/konami/wecleman.cpp24
-rw-r--r--src/mame/konami/xexex.cpp23
-rw-r--r--src/mame/konami/xmen.cpp11
-rw-r--r--src/mame/konami/zr107.cpp11
-rw-r--r--src/mame/korg/korgds8.cpp7
-rw-r--r--src/mame/korg/korgz3.cpp7
-rw-r--r--src/mame/korg/polysix.cpp8
-rw-r--r--src/mame/kurzweil/krz2000.cpp3
-rw-r--r--src/mame/layout/moog_source.lay2
-rw-r--r--src/mame/leapfrog/leapster_explorer.cpp3
-rw-r--r--src/mame/linn/linndrum.cpp17
-rw-r--r--src/mame/mame.lst17
-rw-r--r--src/mame/maygay/maygay1b.cpp19
-rw-r--r--src/mame/metro/metro.cpp14
-rw-r--r--src/mame/metro/rabbit.cpp7
-rw-r--r--src/mame/metro/tmmjprd.cpp7
-rw-r--r--src/mame/midw8080/mw8080bw_a.cpp35
-rw-r--r--src/mame/midway/astrocde.cpp30
-rw-r--r--src/mame/midway/atlantis.cpp7
-rw-r--r--src/mame/midway/gridlee.h2
-rw-r--r--src/mame/midway/gridlee_a.cpp8
-rw-r--r--src/mame/midway/mcr.cpp23
-rw-r--r--src/mame/midway/mcr3.cpp19
-rw-r--r--src/mame/midway/midvunit.cpp7
-rw-r--r--src/mame/midway/midway.cpp6
-rw-r--r--src/mame/midway/midyunit.cpp7
-rw-r--r--src/mame/midway/midzeus.cpp14
-rw-r--r--src/mame/midway/pinball2k.cpp3
-rw-r--r--src/mame/midway/seattle.cpp96
-rw-r--r--src/mame/midway/vegas.cpp111
-rw-r--r--src/mame/midway/williams.cpp9
-rw-r--r--src/mame/miltonbradley/milton6805.cpp20
-rw-r--r--src/mame/misc/amspdwy.cpp7
-rw-r--r--src/mame/misc/amuzy.cpp7
-rw-r--r--src/mame/misc/belatra.cpp3
-rw-r--r--src/mame/misc/brglitz.cpp11
-rw-r--r--src/mame/misc/calomega.cpp22
-rw-r--r--src/mame/misc/cardline.cpp7
-rw-r--r--src/mame/misc/coinmvga.cpp7
-rw-r--r--src/mame/misc/cowtipping.cpp3
-rw-r--r--src/mame/misc/cubeqst.cpp11
-rw-r--r--src/mame/misc/cupidon.cpp3
-rw-r--r--src/mame/misc/cybertnk.cpp7
-rw-r--r--src/mame/misc/dcheese.cpp7
-rw-r--r--src/mame/misc/dgpix.cpp7
-rw-r--r--src/mame/misc/discoboy.cpp11
-rw-r--r--src/mame/misc/esh.cpp7
-rw-r--r--src/mame/misc/flower_a.cpp11
-rw-r--r--src/mame/misc/flower_a.h2
-rw-r--r--src/mame/misc/funkball.cpp7
-rw-r--r--src/mame/misc/gamtor.cpp3
-rw-r--r--src/mame/misc/gms.cpp15
-rw-r--r--src/mame/misc/good.cpp7
-rw-r--r--src/mame/misc/gumbo.cpp7
-rw-r--r--src/mame/misc/gunpey.cpp11
-rw-r--r--src/mame/misc/hapyfish.cpp7
-rw-r--r--src/mame/misc/hideseek.cpp3
-rw-r--r--src/mame/misc/inder_sb.cpp2
-rw-r--r--src/mame/misc/istellar.cpp7
-rw-r--r--src/mame/misc/jungleyo.cpp7
-rw-r--r--src/mame/misc/laz_ribrac.cpp7
-rw-r--r--src/mame/misc/limenko.cpp7
-rw-r--r--src/mame/misc/magictg.cpp7
-rw-r--r--src/mame/misc/micro3d.cpp19
-rw-r--r--src/mame/misc/micro3d_a.cpp15
-rw-r--r--src/mame/misc/micro3d_a.h2
-rw-r--r--src/mame/misc/mindset.cpp8
-rw-r--r--src/mame/misc/neoprint.cpp22
-rw-r--r--src/mame/misc/policetr.cpp7
-rw-r--r--src/mame/misc/policetr.h6
-rw-r--r--src/mame/misc/proconn.cpp5
-rw-r--r--src/mame/misc/skimaxx.cpp11
-rw-r--r--src/mame/misc/sliver.cpp7
-rw-r--r--src/mame/misc/spool99.cpp7
-rw-r--r--src/mame/misc/sshanghai.cpp592
-rw-r--r--src/mame/misc/sttechno.cpp7
-rw-r--r--src/mame/misc/tapatune.cpp7
-rw-r--r--src/mame/misc/thayers.cpp11
-rw-r--r--src/mame/misc/tomsadvs.cpp11
-rw-r--r--src/mame/misc/vamphalf.cpp38
-rw-r--r--src/mame/misc/vocalizer.cpp11
-rw-r--r--src/mame/misc/xtom3d.cpp7
-rw-r--r--src/mame/misc/yuvomz80.cpp7
-rw-r--r--src/mame/moog/nl_source.cpp102
-rw-r--r--src/mame/moog/source.cpp348
-rw-r--r--src/mame/namco/dkmb.cpp3
-rw-r--r--src/mame/namco/gal3.cpp11
-rw-r--r--src/mame/namco/geebee.cpp8
-rw-r--r--src/mame/namco/geebee.h2
-rw-r--r--src/mame/namco/namcofl.cpp11
-rw-r--r--src/mame/namco/namcona1.cpp7
-rw-r--r--src/mame/namco/namconb1.cpp11
-rw-r--r--src/mame/namco/namcond1.cpp11
-rw-r--r--src/mame/namco/namcos1.cpp19
-rw-r--r--src/mame/namco/namcos10.cpp11
-rw-r--r--src/mame/namco/namcos11.cpp11
-rw-r--r--src/mame/namco/namcos12.cpp15
-rw-r--r--src/mame/namco/namcos12_cdxa.cpp3
-rw-r--r--src/mame/namco/namcos2.cpp49
-rw-r--r--src/mame/namco/namcos21.cpp9
-rw-r--r--src/mame/namco/namcos21_c67.cpp9
-rw-r--r--src/mame/namco/namcos21_de.cpp9
-rw-r--r--src/mame/namco/namcos22.cpp7
-rw-r--r--src/mame/namco/namcos23.cpp22
-rw-r--r--src/mame/namco/polepos.cpp46
-rw-r--r--src/mame/namco/polepos_a.cpp53
-rw-r--r--src/mame/namco/polepos_a.h10
-rw-r--r--src/mame/namco/sweetland4.cpp14
-rw-r--r--src/mame/namco/tceptor.cpp15
-rw-r--r--src/mame/namco/turrett.cpp7
-rw-r--r--src/mame/namco/turrett.h2
-rw-r--r--src/mame/namco/turrett_a.cpp12
-rw-r--r--src/mame/namco/warpwarp_a.cpp8
-rw-r--r--src/mame/namco/warpwarp_a.h2
-rw-r--r--src/mame/nec/pc8801.cpp37
-rw-r--r--src/mame/nec/pc8801.h6
-rw-r--r--src/mame/nec/pc88va.cpp11
-rw-r--r--src/mame/nec/pc88va.h6
-rw-r--r--src/mame/nec/pc9801.cpp11
-rw-r--r--src/mame/nec/pc9821.cpp32
-rw-r--r--src/mame/nec/pce.cpp22
-rw-r--r--src/mame/nec/pce_cd.cpp10
-rw-r--r--src/mame/nec/pcfx.cpp7
-rw-r--r--src/mame/neogeo/midas.cpp7
-rw-r--r--src/mame/neogeo/neogeo.cpp11
-rw-r--r--src/mame/nichibutsu/gomoku_a.cpp14
-rw-r--r--src/mame/nichibutsu/gomoku_a.h2
-rw-r--r--src/mame/nichibutsu/hrdvd.cpp13
-rw-r--r--src/mame/nichibutsu/wiping_a.cpp14
-rw-r--r--src/mame/nichibutsu/wiping_a.h2
-rw-r--r--src/mame/nintendo/aleck64.cpp7
-rw-r--r--src/mame/nintendo/gb.cpp28
-rw-r--r--src/mame/nintendo/gba.cpp15
-rw-r--r--src/mame/nintendo/n64.cpp7
-rw-r--r--src/mame/nintendo/n64_gateway.cpp7
-rw-r--r--src/mame/nintendo/nss.cpp7
-rw-r--r--src/mame/nintendo/popeye_v.cpp89
-rw-r--r--src/mame/nintendo/punchout.cpp7
-rw-r--r--src/mame/nintendo/sfcbox.cpp7
-rw-r--r--src/mame/nintendo/snes.cpp7
-rw-r--r--src/mame/nintendo/snesb.cpp7
-rw-r--r--src/mame/nintendo/snesb51.cpp7
-rw-r--r--src/mame/nintendo/vboy.cpp7
-rw-r--r--src/mame/nintendo/vsnes.cpp7
-rw-r--r--src/mame/nintendo/vt1682.cpp22
-rw-r--r--src/mame/nmk/macrossp.cpp7
-rw-r--r--src/mame/nmk/nmkmedal.cpp7
-rw-r--r--src/mame/oberheim/dmx.cpp44
-rw-r--r--src/mame/pc/calchase.cpp7
-rw-r--r--src/mame/pce/ggconnie.cpp11
-rw-r--r--src/mame/pce/paranoia.cpp7
-rw-r--r--src/mame/pce/tourvis.cpp7
-rw-r--r--src/mame/pce/uapce.cpp9
-rw-r--r--src/mame/philips/cdi.cpp21
-rw-r--r--src/mame/phoenix/phoenix_a.cpp9
-rw-r--r--src/mame/phoenix/phoenix_a.h2
-rw-r--r--src/mame/phoenix/pleiads.cpp17
-rw-r--r--src/mame/phoenix/pleiads.h6
-rw-r--r--src/mame/pinball/alvg.cpp7
-rw-r--r--src/mame/pinball/de_3.cpp21
-rw-r--r--src/mame/pinball/idsa.cpp9
-rw-r--r--src/mame/pinball/lancelot.cpp12
-rw-r--r--src/mame/pinball/mrgame.cpp11
-rw-r--r--src/mame/pinball/nsm.cpp7
-rw-r--r--src/mame/pinball/pinsnd88.cpp10
-rw-r--r--src/mame/pinball/play_3.cpp13
-rw-r--r--src/mame/pinball/s11b.cpp8
-rw-r--r--src/mame/pinball/techno.cpp7
-rw-r--r--src/mame/pinball/vd.cpp7
-rw-r--r--src/mame/pinball/whitestar.cpp7
-rw-r--r--src/mame/psikyo/psikyo4.cpp15
-rw-r--r--src/mame/psion/psion3a.cpp6
-rw-r--r--src/mame/rare/btoads.cpp7
-rw-r--r--src/mame/roland/roland_cm32p.cpp7
-rw-r--r--src/mame/roland/roland_d70.cpp7
-rw-r--r--src/mame/roland/roland_r8.cpp14
-rw-r--r--src/mame/roland/roland_u20.cpp7
-rw-r--r--src/mame/sega/bingoc.cpp10
-rw-r--r--src/mame/sega/calcune.cpp15
-rw-r--r--src/mame/sega/coolridr.cpp11
-rw-r--r--src/mame/sega/dccons.cpp7
-rw-r--r--src/mame/sega/dsbz80.cpp21
-rw-r--r--src/mame/sega/dsbz80.h2
-rw-r--r--src/mame/sega/flashbeats.cpp7
-rw-r--r--src/mame/sega/gpworld.cpp7
-rw-r--r--src/mame/sega/hikaru.cpp7
-rw-r--r--src/mame/sega/mdconsole.cpp36
-rw-r--r--src/mame/sega/megacd.cpp4
-rw-r--r--src/mame/sega/megadriv.cpp30
-rw-r--r--src/mame/sega/megaplay.cpp4
-rw-r--r--src/mame/sega/megatech.cpp4
-rw-r--r--src/mame/sega/model2.cpp11
-rw-r--r--src/mame/sega/model2_v.cpp257
-rw-r--r--src/mame/sega/model3.cpp15
-rw-r--r--src/mame/sega/naomi.cpp7
-rw-r--r--src/mame/sega/puckpkmn.cpp15
-rw-r--r--src/mame/sega/saturn.cpp7
-rw-r--r--src/mame/sega/segaatom.cpp7
-rw-r--r--src/mame/sega/segafruit.cpp7
-rw-r--r--src/mame/sega/segag80r.cpp2
-rw-r--r--src/mame/sega/segag80r.h2
-rw-r--r--src/mame/sega/segag80r_a.cpp6
-rw-r--r--src/mame/sega/segag80v.cpp6
-rw-r--r--src/mame/sega/segahang.cpp73
-rw-r--r--src/mame/sega/segald.cpp7
-rw-r--r--src/mame/sega/segaorun.cpp9
-rw-r--r--src/mame/sega/segapico.cpp33
-rw-r--r--src/mame/sega/segas24.cpp9
-rw-r--r--src/mame/sega/segas32.cpp30
-rw-r--r--src/mame/sega/segasm1.cpp7
-rw-r--r--src/mame/sega/segausb.cpp8
-rw-r--r--src/mame/sega/segausb.h2
-rw-r--r--src/mame/sega/segaxbd.cpp22
-rw-r--r--src/mame/sega/segaybd.cpp11
-rw-r--r--src/mame/sega/sms.cpp7
-rw-r--r--src/mame/sega/stv.cpp11
-rw-r--r--src/mame/sega/stvcd.cpp6
-rw-r--r--src/mame/sega/system16.cpp46
-rw-r--r--src/mame/sega/turbo_a.cpp70
-rw-r--r--src/mame/sega/winclub.cpp7
-rw-r--r--src/mame/seibu/seibucats.cpp7
-rw-r--r--src/mame/seibu/seibuspi.cpp14
-rw-r--r--src/mame/seta/champbwl.cpp7
-rw-r--r--src/mame/seta/jclub2.cpp14
-rw-r--r--src/mame/seta/kiwame.cpp7
-rw-r--r--src/mame/seta/namcoeva.cpp11
-rw-r--r--src/mame/seta/seta.cpp49
-rw-r--r--src/mame/seta/seta2.cpp14
-rw-r--r--src/mame/seta/simple_st0016.cpp48
-rw-r--r--src/mame/seta/speglsht.cpp7
-rw-r--r--src/mame/seta/srmp5.cpp7
-rw-r--r--src/mame/seta/srmp6.cpp7
-rw-r--r--src/mame/seta/ssv.cpp7
-rw-r--r--src/mame/seta/st0016.cpp17
-rw-r--r--src/mame/sgi/hal2.cpp7
-rw-r--r--src/mame/sgi/ip4.cpp7
-rw-r--r--src/mame/sgi/kbd.cpp3
-rw-r--r--src/mame/shared/ballysound.cpp6
-rw-r--r--src/mame/shared/cage.cpp16
-rw-r--r--src/mame/shared/dcs.cpp54
-rw-r--r--src/mame/shared/dcs.h6
-rw-r--r--src/mame/shared/decobsmt.cpp6
-rw-r--r--src/mame/shared/exidysound.cpp7
-rw-r--r--src/mame/shared/exidysound.h2
-rw-r--r--src/mame/shared/gottlieb_a.cpp4
-rw-r--r--src/mame/shared/gottlieb_a.h4
-rw-r--r--src/mame/shared/mega32x.cpp6
-rw-r--r--src/mame/shared/mega32x.h2
-rw-r--r--src/mame/shared/megacdcd.cpp4
-rw-r--r--src/mame/shared/rax.cpp9
-rw-r--r--src/mame/shared/segam1audio.cpp15
-rw-r--r--src/mame/shared/vboysound.cpp11
-rw-r--r--src/mame/shared/vboysound.h2
-rw-r--r--src/mame/shared/williamssound.cpp8
-rw-r--r--src/mame/shared/williamssound.h8
-rw-r--r--src/mame/shared/wswansound.cpp18
-rw-r--r--src/mame/shared/wswansound.h2
-rw-r--r--src/mame/sharp/x1.cpp13
-rw-r--r--src/mame/sharp/x1twin.cpp3
-rw-r--r--src/mame/sharp/x68k.cpp11
-rw-r--r--src/mame/sigma/sigmab98.cpp21
-rw-r--r--src/mame/sinclair/chloe.cpp23
-rw-r--r--src/mame/sinclair/pentagon.cpp11
-rw-r--r--src/mame/sinclair/pentevo.cpp19
-rw-r--r--src/mame/sinclair/scorpion.cpp19
-rw-r--r--src/mame/sinclair/specnext.cpp19
-rw-r--r--src/mame/sinclair/sprinter.cpp15
-rw-r--r--src/mame/sinclair/tsconf.cpp19
-rw-r--r--src/mame/skeleton/banpresto_tomy_h8s.cpp7
-rw-r--r--src/mame/skeleton/biorhythm_fp.cpp128
-rw-r--r--src/mame/skeleton/ct909e_segadvd.cpp3
-rw-r--r--src/mame/skeleton/e100.cpp230
-rw-r--r--src/mame/skeleton/easy_karaoke.cpp3
-rw-r--r--src/mame/skeleton/epoch_tv_globe.cpp3
-rw-r--r--src/mame/skeleton/koto_zevio.cpp3
-rw-r--r--src/mame/skeleton/leadsinger2.cpp3
-rw-r--r--src/mame/skeleton/mini2440.cpp7
-rw-r--r--src/mame/skeleton/picno.cpp7
-rw-r--r--src/mame/skeleton/sartorius.cpp2
-rw-r--r--src/mame/snk/bbusters.cpp11
-rw-r--r--src/mame/snk/hng64_a.cpp7
-rw-r--r--src/mame/snk/mechatt.cpp11
-rw-r--r--src/mame/snk/ngp.cpp11
-rw-r--r--src/mame/snk/snk6502_a.cpp8
-rw-r--r--src/mame/snk/snk6502_a.h2
-rw-r--r--src/mame/sony/psx.cpp7
-rw-r--r--src/mame/sony/taito_zm.cpp6
-rw-r--r--src/mame/sony/taitogn.cpp8
-rw-r--r--src/mame/sony/zn.cpp53
-rw-r--r--src/mame/sony/zn.h2
-rw-r--r--src/mame/stern/cliffhgr.cpp9
-rw-r--r--src/mame/suna/suna16.cpp56
-rw-r--r--src/mame/svision/svis_snd.cpp11
-rw-r--r--src/mame/svision/svis_snd.h2
-rw-r--r--src/mame/svision/svision.cpp7
-rw-r--r--src/mame/taito/2mindril.cpp11
-rw-r--r--src/mame/taito/cpzodiac.cpp11
-rw-r--r--src/mame/taito/darius.cpp11
-rw-r--r--src/mame/taito/dinoking.cpp7
-rw-r--r--src/mame/taito/galastrm.cpp7
-rw-r--r--src/mame/taito/groundfx.cpp7
-rw-r--r--src/mame/taito/gunbustr.cpp7
-rw-r--r--src/mame/taito/heromem.cpp20
-rw-r--r--src/mame/taito/invqix.cpp7
-rw-r--r--src/mame/taito/lgp.cpp7
-rw-r--r--src/mame/taito/ninjaw.cpp27
-rw-r--r--src/mame/taito/opwolf.cpp7
-rw-r--r--src/mame/taito/qix_a.cpp7
-rw-r--r--src/mame/taito/rollrace.cpp9
-rw-r--r--src/mame/taito/slapshot.cpp22
-rw-r--r--src/mame/taito/superchs.cpp7
-rw-r--r--src/mame/taito/taito_en.cpp6
-rw-r--r--src/mame/taito/taito_f2.cpp11
-rw-r--r--src/mame/taito/taito_f3.cpp7
-rw-r--r--src/mame/taito/taito_x.cpp40
-rw-r--r--src/mame/taito/taito_z.cpp111
-rw-r--r--src/mame/taito/taitojc.cpp7
-rwxr-xr-xsrc/mame/taito/tc0060dca.cpp10
-rwxr-xr-xsrc/mame/taito/tc0060dca.h2
-rw-r--r--src/mame/taito/topspeed.cpp11
-rw-r--r--src/mame/taito/undrfire.cpp14
-rw-r--r--src/mame/taito/warriorb.cpp26
-rw-r--r--src/mame/taito/wgp.cpp11
-rw-r--r--src/mame/tatsumi/apache3.cpp11
-rw-r--r--src/mame/tatsumi/cyclwarr.cpp11
-rw-r--r--src/mame/tatsumi/lockon.cpp19
-rw-r--r--src/mame/tatsumi/roundup5.cpp11
-rw-r--r--src/mame/tatsumi/tx1_a.cpp22
-rw-r--r--src/mame/tatsumi/tx1_a.h4
-rw-r--r--src/mame/tch/littlerb.cpp7
-rw-r--r--src/mame/tch/wheelfir.cpp7
-rw-r--r--src/mame/technos/blockout.cpp11
-rw-r--r--src/mame/technos/ddragon3.cpp19
-rw-r--r--src/mame/technos/shadfrce.cpp11
-rw-r--r--src/mame/technos/spdodgeb.cpp15
-rw-r--r--src/mame/technos/vball.cpp11
-rw-r--r--src/mame/technos/wwfsstar.cpp11
-rw-r--r--src/mame/tecmo/tecmo16.cpp11
-rw-r--r--src/mame/tecmo/tecmosys.cpp19
-rw-r--r--src/mame/toaplan/dt7.cpp11
-rw-r--r--src/mame/toaplan/truxton2.cpp9
-rw-r--r--src/mame/trs/vis.cpp15
-rw-r--r--src/mame/tvgames/actions_atj2279b.cpp3
-rw-r--r--src/mame/tvgames/elan_eu3a05_a.cpp9
-rw-r--r--src/mame/tvgames/elan_eu3a05_a.h2
-rw-r--r--src/mame/tvgames/generalplus_gpl16250.cpp7
-rw-r--r--src/mame/tvgames/generalplus_gpl16250_mobigo.cpp7
-rw-r--r--src/mame/tvgames/generalplus_gpl16250_nand.cpp7
-rw-r--r--src/mame/tvgames/generalplus_gpl16250_spi.cpp7
-rw-r--r--src/mame/tvgames/generalplus_gpl16250_spi_direct.cpp7
-rw-r--r--src/mame/tvgames/generalplus_gpl32612.cpp6
-rw-r--r--src/mame/tvgames/generalplus_gpm453x_sdcard.cpp3
-rw-r--r--src/mame/tvgames/magiceyes_pollux_vr3520f.cpp3
-rw-r--r--src/mame/tvgames/spg110.cpp7
-rw-r--r--src/mame/tvgames/spg2xx.cpp25
-rw-r--r--src/mame/tvgames/xavix.cpp7
-rw-r--r--src/mame/tvgames/xavix.h2
-rw-r--r--src/mame/tvgames/xavix2.cpp3
-rw-r--r--src/mame/tvgames/xavix_a.cpp10
-rw-r--r--src/mame/unico/goori.cpp9
-rw-r--r--src/mame/unico/silkroad.cpp13
-rw-r--r--src/mame/unico/unico.cpp35
-rw-r--r--src/mame/unisonic/gic.cpp10
-rw-r--r--src/mame/unisonic/gic.h2
-rw-r--r--src/mame/universal/superdq.cpp9
-rw-r--r--src/mame/ussr/istrebiteli.cpp10
-rw-r--r--src/mame/ussr/specialsound.cpp14
-rw-r--r--src/mame/ussr/specialsound.h2
-rw-r--r--src/mame/ussr/tiamc1_a.cpp6
-rw-r--r--src/mame/ussr/tiamc1_a.h2
-rw-r--r--src/mame/videoton/tvc_a.cpp14
-rw-r--r--src/mame/videoton/tvc_a.h2
-rw-r--r--src/mame/virtual/ldplayer.cpp14
-rw-r--r--src/mame/virtual/vgmplay.cpp397
-rw-r--r--src/mame/virtual/wavesynth.cpp7
-rw-r--r--src/mame/vsystem/aerofgt.cpp11
-rw-r--r--src/mame/vsystem/crshrace.cpp11
-rw-r--r--src/mame/vsystem/f1gp.cpp11
-rw-r--r--src/mame/vsystem/gstriker.cpp11
-rw-r--r--src/mame/vsystem/pspikes.cpp55
-rw-r--r--src/mame/vsystem/suprslam.cpp11
-rw-r--r--src/mame/vsystem/tail2nos.cpp11
-rw-r--r--src/mame/vsystem/taotaido.cpp11
-rw-r--r--src/mame/vtech/clickstart.cpp7
-rw-r--r--src/mame/vtech/socrates_a.cpp6
-rw-r--r--src/mame/vtech/socrates_a.h2
-rw-r--r--src/mame/vtech/storio.cpp3
-rw-r--r--src/mame/vtech/vsmile.cpp7
-rw-r--r--src/mame/vtech/vsmileb.cpp4
-rw-r--r--src/mame/vtech/vtech_innotab.cpp3
-rw-r--r--src/mame/xerox/notetaker.cpp5
-rw-r--r--src/mame/yamaha/fb01.cpp7
-rw-r--r--src/mame/yamaha/tg100.cpp7
-rw-r--r--src/mame/yamaha/yman1x.cpp3
-rw-r--r--src/mame/yamaha/ymdx100.cpp7
-rw-r--r--src/mame/yamaha/ymdx11.cpp7
-rw-r--r--src/mame/yamaha/ymmu10.cpp7
-rw-r--r--src/mame/yamaha/ymmu100.cpp7
-rw-r--r--src/mame/yamaha/ymmu128.cpp11
-rw-r--r--src/mame/yamaha/ymmu15.cpp7
-rw-r--r--src/mame/yamaha/ymmu2000.cpp11
-rw-r--r--src/mame/yamaha/ymmu5.cpp7
-rw-r--r--src/mame/yamaha/ymmu50.cpp31
-rw-r--r--src/mame/yamaha/ymmu80.cpp11
-rw-r--r--src/mame/yamaha/ymmu90.cpp7
-rw-r--r--src/mame/yamaha/ympsr150.cpp21
-rw-r--r--src/mame/yamaha/ympsr2000.cpp3
-rw-r--r--src/mame/yamaha/ympsr340.cpp7
-rw-r--r--src/mame/yamaha/ympsr400.cpp7
-rw-r--r--src/mame/yamaha/ympsr540.cpp7
-rw-r--r--src/mame/yamaha/ympsr60.cpp30
-rw-r--r--src/mame/yamaha/ymqs300.cpp7
-rw-r--r--src/mame/yamaha/ymqy70.cpp3
-rw-r--r--src/mame/yamaha/ymrx15.cpp7
-rw-r--r--src/mame/yamaha/ymtx81z.cpp7
-rw-r--r--src/mame/yamaha/ymvl70.cpp3
-rw-r--r--src/mame/yunsung/yunsun16.cpp18
-rw-r--r--src/mame/yunsung/yunsung8.cpp11
-rw-r--r--src/mame/zaccaria/zaccaria_a.cpp10
-rw-r--r--src/osd/interface/audio.h52
-rw-r--r--src/osd/modules/lib/osdobj_common.cpp70
-rw-r--r--src/osd/modules/lib/osdobj_common.h12
-rw-r--r--src/osd/modules/render/aviwrite.cpp9
-rw-r--r--src/osd/modules/sound/coreaudio_sound.cpp27
-rw-r--r--src/osd/modules/sound/direct_sound.cpp42
-rw-r--r--src/osd/modules/sound/js_sound.cpp14
-rw-r--r--src/osd/modules/sound/js_sound.js31
-rw-r--r--src/osd/modules/sound/none.cpp5
-rw-r--r--src/osd/modules/sound/pa_sound.cpp31
-rw-r--r--src/osd/modules/sound/pipewire_sound.cpp823
-rw-r--r--src/osd/modules/sound/pulse_sound.cpp646
-rw-r--r--src/osd/modules/sound/sdl_sound.cpp521
-rw-r--r--src/osd/modules/sound/sound_module.cpp61
-rw-r--r--src/osd/modules/sound/sound_module.h62
-rw-r--r--src/osd/modules/sound/xaudio2_sound.cpp35
-rw-r--r--src/osd/osdepend.h16
-rw-r--r--src/zexall/main.cpp2
1139 files changed, 16690 insertions, 10868 deletions
diff --git a/docs/man/mame.6 b/docs/man/mame.6
index 3d83084e4c0..5d0123f486f 100644
--- a/docs/man/mame.6
+++ b/docs/man/mame.6
@@ -944,7 +944,7 @@ the audio output is overdriven. The default is ON (\-compressor).
.TP
.B \-volume, \-vol \fIvalue
Sets the startup volume. It can later be changed with the user interface
-(see Keys section). The volume is an attenuation in dB: e.g.,
+(see Keys section). The volume is in dB: e.g.,
"\-volume \-12" will start with \-12dB attenuation. The default is 0.
.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
.\" SDL specific
diff --git a/docs/source/commandline/commandline-all.rst b/docs/source/commandline/commandline-all.rst
index d83b401cc32..9f058e10dff 100644
--- a/docs/source/commandline/commandline-all.rst
+++ b/docs/source/commandline/commandline-all.rst
@@ -2969,7 +2969,7 @@ Core Sound Options
**-volume** / **-vol** *<value>*
Sets the initial sound volume. It can be changed later with the user
- interface (see Keys section). The volume is an attenuation in decibels:
+ interface (see Keys section). The volume is in decibels:
e.g. "**-volume -12**" will start with -12 dB attenuation. Note that if the
volume is changed in the user interface it will be saved to the
configuration file for the system. The value from the configuration file
diff --git a/docs/source/luascript/ref-common.rst b/docs/source/luascript/ref-common.rst
index c08d3676621..6a7c735951c 100644
--- a/docs/source/luascript/ref-common.rst
+++ b/docs/source/luascript/ref-common.rst
@@ -99,6 +99,12 @@ emu.add_machine_post_load_notifier(callback)
Add a callback to receive notification after the emulated system is restored
to a previously saved state. Returns a
:ref:`notifier subscription <luascript-ref-notifiersub>`.
+emu.register_sound_update(callback)
+ Add a callback to receive new samples that have been created. The samples
+ are coming from the sound devices for which the hook property has been set
+ to true. The callback gets one parameter which is a hash with device tag
+ as key and a (channel-sized) vector of (buffer-sized) vector of samples
+ in the -1..1 range.
emu.print_error(message)
Print an error message.
emu.print_warning(message)
diff --git a/docs/source/luascript/ref-core.rst b/docs/source/luascript/ref-core.rst
index 7b72d90ebdb..ad6dc24d330 100644
--- a/docs/source/luascript/ref-core.rst
+++ b/docs/source/luascript/ref-core.rst
@@ -404,9 +404,8 @@ sound.debugger_mute (read/write)
sound.system_mute (read/write)
A Boolean indicating whether sound output is muted at the request of the
emulated system.
-sound.attenuation (read/write)
- The output volume attenuation in decibels. Should generally be a negative
- integer or zero.
+sound.volume (read/write)
+ The output volume in decibels. Should generally be a negative or zero.
sound.recording (read-only)
A Boolean indicating whether sound output is currently being recorded to a
WAV file.
diff --git a/docs/source/luascript/ref-devices.rst b/docs/source/luascript/ref-devices.rst
index 1c3eabdbd2d..fe25e0b0591 100644
--- a/docs/source/luascript/ref-devices.rst
+++ b/docs/source/luascript/ref-devices.rst
@@ -67,6 +67,9 @@ manager.machine.images
manager.machine.slots
Returns a device enumerator that will iterate over
:ref:`slot devices <luascript-ref-dislot>` in the system.
+manager.machine.sounds
+ Returns a device enumerator that will iterate over
+ :ref:`sound devices <luascript-ref-disound>` in the system.
emu.device_enumerator(device, [depth])
Returns a device enumerator that will iterate over
:ref:`devices <luascript-ref-device>` in the sub-tree starting at the
@@ -624,6 +627,52 @@ image.device (read-only)
The underlying :ref:`device <luascript-ref-device>`.
+.. _luascript-ref-disound:
+
+Sound device interface
+---------------------
+
+Wraps MAME’s ``device_sound_interface`` class which is a mix-in implemented by
+devices that input and/or output sound.
+
+Instantiation
+~~~~~~~~~~~~~
+
+manager.machine.sounds[tag]
+ Gets an sound device by tag relative to the root machine device, or ``nil``
+ if no such device exists or it is not a slot device.
+
+Properties
+~~~~~~~~~~
+
+sound.inputs (read-only)
+ Number of sound inputs of the device.
+
+sound.outputs (read-only)
+ Number of sound outputs of the device.
+
+sound.microphone (read-only)
+ True if the device is a microphone, false otherwise
+
+sound.speaker (read-only)
+ True if the device is a speaker, false otherwise
+
+sound.io_positions[] (read-only)
+ Non-empty only for microphones and speakers, indicates the positions of
+ the inputs or outputs as (x, y, z) coordinates (e.g. [-0.2, 0.0, 1.0])
+
+sound.io_names[] (read-only)
+ Non-empty only for microphones and speakers, indicates the positions of
+ the inputs or outputs as strings (e.g. Front Left)
+
+sound.hook
+ A boolean indicating whether to tap the output samples of this device in
+ the global sound hook.
+
+sound.device (read-only)
+ The underlying :ref:`device <luascript-ref-device>`.
+
+
.. _luascript-ref-dislot:
Slot device interface
diff --git a/docs/source/techspecs/audio_effects.rst b/docs/source/techspecs/audio_effects.rst
new file mode 100644
index 00000000000..12228b97444
--- /dev/null
+++ b/docs/source/techspecs/audio_effects.rst
@@ -0,0 +1,147 @@
+Audio effects
+=============
+
+.. contents:: :local:
+
+
+1. Generalities
+---------------
+
+The audio effects are effects that are applied to the sound between
+the speaker devices and the actual sound output. In the current
+implementation the effect chain is fixed (but not the effect
+parameters), and the parameters are stored in the cfg files. They are
+honestly not really designed for extensibility yet, if ever.
+
+Adding an effect requires working on four parts:
+
+* audio_effects/aeffects.* for effect object creation and "publishing"
+* audio_effects/youreffect.* for the effect implementation
+* frontend/mame/ui/audioeffects.cpp to be able to instantiate the effect configuration menu
+* frontend/mame/ui/audioyoureffect.* to implement the effect configuration menu
+
+2. audio_effects/aeffects.*
+---------------------------
+
+The audio_effect class in the aeffect sources provides three things:
+
+* an enum value to designate the effect type and which must match its
+ position in the chain (iow, the effect chain follows the enum order),
+ in the .h
+* the effect name in the audio_effect::effect_names array in the .cpp
+* the creation of a correct effect object in audio_effect::create in the .cpp
+
+
+
+3. audio_effects/youreffect.*
+-----------------------------
+
+This is where you implement the effect. It takes the shape of an
+audio_effect_youreffect class which derives from audio_effect.
+
+The methods to implement are:
+
+.. code-block:: C++
+
+ audio_effect_youreffect(u32 sample_rate, audio_effect *def);
+
+ virtual int type() const override;
+ virtual void config_load(util::xml::data_node const *ef_node) override;
+ virtual void config_save(util::xml::data_node *ef_node) const override;
+ virtual void default_changed() override;
+ virtual u32 history_size() const; // optional
+
+The constructor must pass the parameters to ``audio_effect`` and
+initialize the effect parameters. ``type`` must return the enum value
+for the effect. ``config_load`` and ``config_save`` should load or
+save the effect parameters from/to the cfg file xml tree.
+``default_changed`` is called when the parameters in ``m_default`` are
+changed and the parameters may need to be updated. ``history_size``
+allows to tell how many samples should still be available of the
+previous input frame. Note that this number must not depend on the
+parameters and only on the sample rate.
+
+An effect has a number of parameters that can come from three sources:
+
+* fixed default value
+* equivalent effect object from the default effect chain
+* user setting through the UI
+
+The first two are recognized through the value of ``m_default`` which
+gets the value of ``def`` in the constructor. When it's nullptr, the
+value to use when not set by the user is the fixed one, otherwise it's
+the one in ``m_default``.
+
+At minimum an effect should have a parameter allowing to bypass it.
+
+Managing a parameter uses four methods:
+
+* ``type param() const;`` returns the current parameter value
+* ``void set_param(type value);`` sets the current parameter value and marks it as set by the user
+* ``bool isset_param() const;`` returns true is the parameter was set by the user
+* ``void reset_param();`` resets the parameter to the default value (from m_default or fixed) and marks it as not set by the user
+
+``config_save`` must only save the user-set parameters.
+``config_load`` must retrieve the parameters that are present and mark
+them as set by the user and reset all the others.
+
+Finally the actual implementation goes into the ``apply`` method:
+
+.. code-block:: C++
+
+ virtual void apply(const emu::detail::output_buffer_flat<sample_t> &src, emu::detail::output_buffer_flat<sample_t> &dest) override;
+
+That method takes two buffers with the same number of channels and has
+to apply the effect to ``src`` to produce ``dest``. The
+``output_buffer_flat`` is non-interleaved with independant per-channel
+buffers.
+
+To make bypassing easier, the ``copy(src, dest)`` method of
+audio_effect allows to copy the samples from ``src`` to ``dest``
+without changing them.
+
+The effect application part should looks like:
+
+.. code-block:: C++
+
+ u32 samples = src.available_samples();
+ dest.prepare_space(samples);
+ u32 channels = src.channels();
+
+ // generate channels * samples results and put them in dest
+
+ dest.commit(samples);
+
+To get pointers to the buffers, one uses:
+
+.. code-block:: C++
+
+ const sample_t *source = src.ptrs(channel, source_index); // source_index must be in [-history_size()..samples-1]
+ sample_t *destination = dest.ptrw(channel, destination_index); // destination_index must be in [0..samples-1]
+
+The samples pointed by source and destination are contiguous. The
+number of channels will not change from one apply call to another, the
+number of samples will vary though. Also the call happens in a
+different thread than the main thread and also in a different thread
+than the parameter setting calls are made from.
+
+
+
+
+4. frontend/mame/ui/audioeffects.cpp
+------------------------------------
+
+Here it suffices to add a creation of the menu
+menu_audio_effect_youreffect in menu_audio_effects::handle. The menu
+effect will pick the effect names from audio_effect (in aeffect.*).
+
+
+5. frontend/mame/ui/audioyoureffect.*
+-------------------------------------
+
+This is used to implement the configuration menu for the effect. It's
+a little complicated because it needs to generate the list of
+parameters and their values, set left or right arrow flags depending
+on the possible modifications, dim them (FLAG_INVERT) when not set by
+the user, and manage the arrows and clear keys to change them. Just
+copy an existing one and change it as needed.
diff --git a/docs/source/techspecs/device_sound_interface.rst b/docs/source/techspecs/device_sound_interface.rst
new file mode 100644
index 00000000000..859d2497477
--- /dev/null
+++ b/docs/source/techspecs/device_sound_interface.rst
@@ -0,0 +1,286 @@
+The device_sound_interface
+==========================
+
+.. contents:: :local:
+
+
+1. The sound system
+-------------------
+
+The device sound interface is the entry point for devices that handle
+sound input and/or output. The sound system is built on the concept
+of *streams* which connect devices together with resampling and mixing
+applied transparently as needed. Microphones (audio input) and
+speakers (audio output) are specific known devices which use the same
+interface.
+
+2. Devices using device_sound_interface
+---------------------------------------
+
+2.1 Initialisation
+~~~~~~~~~~~~~~~~~~
+
+Sound streams must be created in the device_start (or
+interface_pre_start) method.
+
+.. code-block:: C++
+
+ sound_stream *stream_alloc(int inputs, int outputs, int sample_rate, sound_stream_flags flags = STREAM_DEFAULT_FLAGS);
+
+A stream is created with ``stream_alloc``. It takes the number of
+input and output channels, the sample rate and optionally flags.
+
+The sample rate can be SAMPLE_RATE_INPUT_ADAPTIVE,
+SAMPLE_RATE_OUTPUT_ADAPTIVE or SAMPLE_RATE_ADAPTIVE. In that case the
+chosen sample rate is the highest one among the inputs, outputs or
+both respectively. In case of loop, the chosen sample rate is the
+configured global sample rate.
+
+The only available non-default flag is STREAM_SYNCHRONOUS. When set,
+the sound generation method will be called for every sample
+individually. It's necessary for DSPs that run a program on every
+sample. but on the other hand it's expensive, so only to be used when
+required.
+
+Devices can create multiple streams. It's rare though. Some Yamaha
+chips should but don't. Inputs and outputs are numbered from 0 and
+arrange all streams in the order they are created.
+
+
+2.2 Sound input/output
+~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: C++
+
+ virtual void sound_stream_update(sound_stream &stream);
+
+This method is required to be implemented to consume the input samples
+and/or compute the output ones. The stream to update for is passed as
+the parameter. See the streams section, specifically sample access,
+to see how to write the method.
+
+
+2.3 Stream information
+~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: C++
+
+ int inputs() const;
+ int outputs() const;
+ std::pair<sound_stream *, int> input_to_stream_input(int inputnum) const;
+ std::pair<sound_stream *, int> output_to_stream_output(int outputnum) const;
+
+The method ``inputs`` returns the total number of inputs in the
+streams created by the device. The method ``outputs`` similarly
+counts the outputs. The other two methods allow to grab the stream
+and channel number for the device corresponding to the global input or
+output number.
+
+
+2.4 Gain management
+~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: C++
+
+ float input_gain(int inputnum) const;
+ float output_gain(int outputnum) const;
+ void set_input_gain(int inputnum, float gain);
+ void set_output_gain(int outputnum, float gain);
+ void set_route_gain(int source_channel, device_sound_interface *target, int target_channel, float gain);
+
+ float user_output_gain() const;
+ float user_output_gain(int outputnum) const;
+ void set_user_output_gain(float gain);
+ void set_user_output_gain(int outputnum, float gain);
+
+Those methods allow to set the gain on every step of the routes
+between streams. All gains are multipliers, with default value 1.0.
+The steps are, from samples output in ``sound_stream_update`` to
+samples read in the next device's ``sound_stream_update``:
+
+* Per-channel output gain
+* Per-channel user output gain
+* Per-device user output gain
+* Per-route gain
+* Per-channel input gain
+
+The user gains must not be set from the driver, they're for use by the
+user interface (the sliders) and are saved in the game configuration.
+The other gains are for driver/device use, and are saved in save
+states.
+
+
+2.5 Routing setup
+~~~~~~~~~~~~~~~~~
+
+.. code-block:: C++
+
+ device_sound_interface &add_route(u32 output, const device_finder<T, R> &target, double gain, u32 channel = 0)
+ device_sound_interface &add_route(u32 output, const char *target, double gain, u32 channel = 0);
+ device_sound_interface &add_route(u32 output, device_sound_interface &target, double gain, u32 channel = 0);
+
+ device_sound_interface &reset_routes();
+
+Routes between devices, e.g. between streams, are set at configuration
+time. The method ``add_route`` must be called on the source device
+and gives the channel on the source device, the target device, the
+gain, and optionally the channel on the target device. The constant
+``ALL_OUTPUTS`` can be used to add a route from every channel of the
+source to a given channel of the destination.
+
+The method ``reset_routes`` is used to remove all the routes setup on
+a given source device.
+
+
+.. code-block:: C++
+
+ u32 get_sound_requested_inputs() const;
+ u32 get_sound_requested_outputs() const;
+ u64 get_sound_requested_inputs_mask() const;
+ u64 get_sound_requested_outputs_mask() const;
+
+Those methods are useful for devices which want to behave differently
+depending on what routes are set up on them. You get either the max
+number of requested channel plus one (which is the number of channels
+when all channels are routed, but is more useful when there are gaps)
+or a mask of use for channels 0-63. Note that ``ALL_OUTPUTS`` does
+not register any specific output or output count.
+
+
+
+3. Streams
+----------
+
+3.1 Generalities
+~~~~~~~~~~~~~~~~
+
+Streams are endpoints associated with devices and, when connected
+together, ensure the transmission of audio data between them. A
+stream has a number of inputs (which can be zero) and outputs (same)
+and one sample rate which is common to all inputs and outputs. The
+connections are set up at the machine configuration level and the sound
+system ensures mixing and resampling is done transparently.
+
+Samples in streams are encoded as sample_t. In the current
+implementation, this is a float. Nominal values are between -1 and 1,
+but clamping at the device level is not recommended (unless that's
+what happens in hardware of course) because the gain values, volume
+and effects can easily avoid saturation.
+
+They are implemented in the class ``sound_stream``.
+
+
+3.2 Characteristics
+~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: C++
+
+ device_t &device() const;
+ bool input_adaptive() const;
+ bool output_adaptive() const;
+ bool synchronous() const;
+ u32 input_count() const;
+ u32 output_count() const;
+ u32 sample_rate() const;
+ attotime sample_period() const;
+
+
+3.3 Sample access
+~~~~~~~~~~~~~~~~~
+
+.. code-block:: C++
+
+ s32 samples() const;
+
+ void put(s32 output, s32 index, sample_t sample);
+ void put_clamp(s32 output, s32 index, sample_t sample, sample_t clamp = 1.0);
+ void put_int(s32 output, s32 index, s32 sample, s32 max);
+ void put_int_clamp(s32 output, s32 index, s32 sample, s32 maxclamp);
+ void add(s32 output, s32 index, sample_t sample);
+ void add_int(s32 output, s32 index, s32 sample, s32 max);
+ void fill(s32 output, sample_t value, s32 start, s32 count);
+ void fill(s32 output, sample_t value, s32 start);
+ void fill(s32 output, sample_t value);
+ void copy(s32 output, s32 input, s32 start, s32 count);
+ void copy(s32 output, s32 input, s32 start);
+ void copy(s32 output, s32 input);
+ sample_t get(s32 input, s32 index) const;
+ sample_t get_output(s32 output, s32 index) const;
+
+Those are the methods used to implement ``sound_stream_update``.
+First ``samples`` tells how many samples to consume and/or generate.
+The to-generate samples, if any, are pre-cleared (e.g. set to zero).
+
+Input samples are retrieved with ``get``, where ``input`` is the
+stream channel number and ``index`` the sample number.
+
+Generated samples are written with the put variants. ``put`` sets a
+sample_t in channel ``output`` at position ``index``. ``put_clamp``
+does the same but first clamps the value to +/-``clamp``. ``put_int``
+does it with an integer ``sample`` but pre-divides it by ``max``.
+``put_int_clamp`` does the same but also pre-clamps within
+-``maxclamp`` and ``maxclamp``-1, which is the normal range for a
+2-complement value.
+
+``add`` and ``add_int`` are similar but add the value of the sample to
+what's there instead of replacing. ``get_output`` gets the currently
+stored output value.
+
+``fill`` sets a range of an output channel to a given ``value``.
+``start`` tells where to start (default index 0), ``count`` how many
+(default up to the end of the buffer).
+
+``copy`` does the same as fill but gets its value from the indentical
+position in an input channel.
+
+Note that clamping should not be used unless it actually happens in
+hardware. Between gains and effects there is a fair chance saturation
+can be avoided later in the chain.
+
+
+
+3.4 Gain management
+~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: C++
+
+ float user_output_gain() const;
+ void set_user_output_gain(float gain);
+ float user_output_gain(s32 output) const;
+ void set_user_output_gain(s32 output, float gain);
+
+ float input_gain(s32 input) const;
+ void set_input_gain(s32 input, float gain);
+ void apply_input_gain(s32 input, float gain);
+ float output_gain(s32 output) const;
+ void set_output_gain(s32 output, float gain);
+ void apply_output_gain(s32 output, float gain);
+
+
+This is similar to the device gain control, with a twist: apply
+multiplies the current gain by the given value.
+
+
+3.5 Misc. actions
+~~~~~~~~~~~~~~~~~
+
+.. code-block:: C++
+
+ void set_sample_rate(u32 sample_rate);
+ void update();
+
+The method ``set_sample_rate`` allows to change the sample rate of the
+stream. The method ``update`` triggers a call of
+``sound_stream_update`` on the stream and the ones it depends on to
+reach the current time in terms of samples.
+
+
+4. Devices using device_mixer_interface
+---------------------------------------
+
+The device mixer interface is used for devices that want to relay
+sound in the device tree without acting on it. It's very useful on
+for instance slot devices connectors, where the slot device may have
+an audio connection with the main system. They are routed like every
+other sound device, create the streams automatically and copy input to
+output. Nothing needs to be done in the device.
diff --git a/docs/source/techspecs/index.rst b/docs/source/techspecs/index.rst
index 71f74618965..72c678b4ca6 100644
--- a/docs/source/techspecs/index.rst
+++ b/docs/source/techspecs/index.rst
@@ -15,6 +15,7 @@ MAME’s source or working on scripts that run within the MAME framework.
device_memory_interface
device_rom_interface
device_disasm_interface
+ device_sound_interface
memory
cpu_device
floppy
@@ -22,3 +23,5 @@ MAME’s source or working on scripts that run within the MAME framework.
m6502
uml_instructions
poly_manager
+ audio_effects
+ osd_audio
diff --git a/docs/source/techspecs/m6502.rst b/docs/source/techspecs/m6502.rst
index 7d67423abb8..f5d55fc9af4 100644
--- a/docs/source/techspecs/m6502.rst
+++ b/docs/source/techspecs/m6502.rst
@@ -92,7 +92,7 @@ At a minimum, the class must include a constructor and an enum picking up the co
If the CPU has its own dispatch table, the class must also include the declaration (but not definition) of **disasm_entries**, **do_exec_full** and **do_exec_partial**, the declaration and definition of **disasm_disassemble** (identical for all classes but refers to the class-specific **disasm_entries** array) and include the .inc file (which provides the missing definitions). Support for the generation must also be added to CPU.mak.
-If the CPU has in addition its own opcodes, their declaration must be done through a macro, see f.i. m65c02. The .inc file will provide the definitions.
+If the CPU has in addition its own opcodes, their declaration must be done through a macro, see e.g. m65c02. The .inc file will provide the definitions.
Dispatch tables
@@ -365,7 +365,7 @@ A negative icount means that the CPU won't be able to do anything for some time
Multi-dispatch variants
-----------------------
-Some variants currently in the process of being supported change instruction set depending on an internal flag, either switching to a 16-bits mode or changing some register accesses to memory accesses. This is handled by having multiple dispatch tables for the CPU, the d<CPU>.lst not being 257 entries anymore but 256*n+1. The variable **inst_state_base** must select which instruction table to use at a given time. It must be a multiple of 256, and is in fact simply OR-ed to the first instruction byte to get the dispatch table index (aka inst_state).
+Some variants currently in the process of being supported change instruction set depending on an internal flag, either switching to a 16-bit mode or changing some register accesses to memory accesses. This is handled by having multiple dispatch tables for the CPU, the d<CPU>.lst not being 257 entries anymore but 256*n+1. The variable **inst_state_base** must select which instruction table to use at a given time. It must be a multiple of 256, and is in fact simply OR-ed to the first instruction byte to get the dispatch table index (aka inst_state).
Current TO-DO:
--------------
diff --git a/docs/source/techspecs/osd_audio.rst b/docs/source/techspecs/osd_audio.rst
new file mode 100644
index 00000000000..82e03d999ef
--- /dev/null
+++ b/docs/source/techspecs/osd_audio.rst
@@ -0,0 +1,348 @@
+OSD audio support
+=================
+
+Introduction
+------------
+
+The audio support in Mame tries to allow the user to freely map
+between the emulated system audio outputs (called speakers) and the
+host system audio. A part of it is the OSD support, where a
+host-specific module ensures the interface between Mame and the host.
+This is the documentation for that module.
+
+Note: this is currenty output-only, but input should follow.
+
+
+Capabitilies
+------------
+
+The OSD interface is designed to allow three levels of support,
+depending on what the API allows and the amount of effort to expend.
+Those are:
+
+* Level 1: One or more audio targets, only one stream allowed per target
+ (aka exclusive mode)
+* Level 2: One or more audio targets, multiple streams per target
+* Level 3: One or more audio targets, multiple streams per target, user-visible
+ per-stream-channel volume control
+
+In any case we support having the user use an external interface to
+change the target of a stream and, in level 3, change the volumes. By
+support we mean storing the information in the per-game configuration
+and keeping the internal UI in sync.
+
+
+Terminology
+-----------
+
+For this module, we use the terms:
+
+* node: some object we can send audio to. Can be physical, like speakers,
+ or virtual, like an effect system. It should have a unique, user-presentable
+ name for the UI.
+* port: a channel of a node, has a name (non-unique, like "front left") and a
+ 3D position
+* stream: a connection to a node with allows to send audio to it
+
+
+Reference documentation
+-----------------------
+
+Adding a module
+~~~~~~~~~~~~~~~
+
+Adding a module is done by adding a cpp file to src/osd/modules/sound
+which follows this structure,
+
+.. code-block:: C++
+
+ // License/copyright
+ #include "sound_module.h"
+ #include "modules/osdmodules.h"
+
+ #ifdef MODULE_SUPPORT_KEY
+
+ #include "modules/lib/osdobj_common.h"
+
+ // [...]
+ namespace osd {
+ namespace {
+
+ class sound_module_class : public osd_module, public sound_module
+ {
+ sound_module_class() : osd_module(OSD_SOUND_PROVIDER, "module_name"),
+ sound_module()
+ // ...
+ };
+
+ }
+ }
+ #else
+ namespace osd { namespace {
+ MODULE_NOT_SUPPORTED(sound_module_class, OSD_SOUND_PROVIDER, "module_name")
+ }}
+ #endif
+
+ MODULE_DEFINITION(SOUND_MODULE_KEY, osd::sound_module_class)
+
+In that code, four names must be chosen:
+
+* MODULE_SUPPORT_KEY some #define coming from the genie scripts to tell that
+ this particular module can be compiled (like NO_USE_PIPEWIRE or SDLMAME_MACOSX)
+* sound_module_class is the name of the class which makes up the module
+ (like sound_coreaudio)
+* module_name is the name to be used in -sound <xxx> to select that particular
+ module (like coreaudio)
+* SOUND_MODULE_KEY is a symbol that represents the module internally (like
+ SOUND_COREAUDIO)
+
+The file path needs to be added to scripts/src/osd/modules.lua in
+osdmodulesbuild() and the module reference to
+src/osd/modules/lib/osdobj_common.cpp in
+osd_common_t::register_options with the line:
+
+.. code-block:: C++
+
+ REGISTER_MODULE(m_mod_man, SOUND_MODULE_KEY);
+
+This should ensure that the module is reachable through -sound <xxx>
+on the appropriate hosts.
+
+
+Interface
+~~~~~~~~~
+
+The full interface is:
+
+.. code-block:: C++
+
+ virtual bool split_streams_per_source() const override;
+ virtual bool external_per_channel_volume() const override;
+
+ virtual int init(osd_interface &osd, osd_options const &options) override;
+ virtual void exit() override;
+
+ virtual uint32_t get_generation() override;
+ virtual osd::audio_info get_information() override;
+ virtual uint32_t stream_sink_open(uint32_t node, std::string name, uint32_t rate) override;
+ virtual uint32_t stream_source_open(uint32_t node, std::string name, uint32_t rate) override;
+ virtual void stream_set_volumes(uint32_t id, const std::vector<float> &db) override;
+ virtual void stream_close(uint32_t id) override;
+ virtual void stream_sink_update(uint32_t id, const int16_t *buffer, int samples_this_frame) override;
+ virtual void stream_source_update(uint32_t id, int16_t *buffer, int samples_this_frame) override;
+
+
+The class sound_module provides defaults for minimum capabilities: one
+stereo target and stream at default sample rate. To support that,
+only *init*, *exit* and *stream_update* need to be implemented.
+*init* is called at startup and *exit* when quitting and can do
+whatever they need to do. *stream_sink_update* will be called on a
+regular basis with a buffer of sample_this_frame * 2 * int16_t with the
+audio to play. From this point in the documentation we'll assume more
+than a single stereo channel is wanted.
+
+
+Capabilities
+~~~~~~~~~~~~
+
+Two methods are used by the module to indicate the level of capability
+of the module:
+
+* split_streams_per_source() should return true when having multiple streams
+ for one target is expected (e.g. Level 2 or 3)
+* external_per_channel_volume() should return true when the streams have
+ per-channel volume control that can be externally controlled (e.g. Level 3)
+
+
+Hardware information and generations
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The core runs on the assumption that the host hardware capabilities
+can change at any time (bluetooth devices coming and going, usb
+hot-plugging...) and that the module has some way to keep tabs on what
+is happening, possibly using multi-threading. To keep it
+lightweight-ish, we use the concept of a *generation* which is a
+32-bit number that is incremented by the module every time something
+changes. The core checks the current generation value at least once
+every update (once per frame, usually) and if it changed asks for the
+new state and detects and handles the differences. *generation*
+should be "eventually stable", e.g. it eventually stops changing when
+the user stops changing things all the time. A systematic increment
+every frame would be a bad idea.
+
+.. code-block:: C++
+
+ virtual uint32_t get_generation() override;
+
+That method returns the current generation number. It's called at a
+minimum once per update, which usually means per frame. It whould be
+reasonably lightweight when nothing special happens.
+
+.. code-block: C++
+
+ virtual osd::audio_info get_information() override;
+
+ struct audio_rate_range {
+ uint32_t m_default_rate;
+ uint32_t m_min_rate;
+ uint32_t m_max_rate;
+ };
+
+ struct audio_info {
+ struct node_info {
+ std::string m_name;
+ uint32_t m_id;
+ audio_rate_range m_rate;
+ std::vector<std::string> m_port_names;
+ std::vector<std::array<double, 3>> m_port_positions;
+ uint32_t m_sinks;
+ uint32_t m_sources;
+ };
+
+ struct stream_info {
+ uint32_t m_id;
+ uint32_t m_node;
+ std::vector<float> m_volumes;
+ };
+
+ uint32_t m_generation;
+ uint32_t m_default_sink;
+ uint32_t m_default_source;
+ std::vector<node_info> m_nodes;
+ std::vector<stream_info> m_streams;
+ };
+
+This method must provide all the information about the current state
+of the host and the module. This state is:
+
+* m_generation: The current generation number
+* m_nodes: The vector available nodes (*node_info*)
+
+ * m_name: The name of the node
+ * m_id: The numeric ID of the node
+ * m_rate: The minimum, maximum and preferred sample rate for the node
+ * m_port_names: The vector of port names
+ * m_port_positions: The vector of 3D position of the ports. Refer to
+ src/emu/speaker.h for the "standard" positions
+ * m_sinks: Number of sinks (inputs)
+ * m_sources: Number of sources (outputs)
+
+* m_default_sink: ID of the node that is the current "system default" for
+ audio output, 0 if there's no such concept
+* m_default_source: same for audio input (currently unused)
+* m_streams: The vector of active streams (*stream_info*)
+
+ * m_id: The numeric ID of the stream
+ * m_node: The target node of the stream
+ * m_volumes: empty if *external_per_channel_volume* is false, current volume
+ value per-channel otherwise
+
+IDs, for nodes and streams, are (independant) 32-bit unsigned non-zero
+values associated to respectively nodes and streams. IDs should not
+be reused. A node that goes away then comes back should get a new ID.
+A stream closing does not allow reuse of its ID.
+
+If a node has both sources and sinks, the sources are *monitors* of
+the sinks, e.g. they're loopbacks. They should have the same count in
+such a case.
+
+When external control exists, a module should change the value of
+*stream_info::m_node* when the user changes it, and same for
+*stream_info::m_volumes*. Generation number should be incremented
+when this happens, so that the core knows to look for changes.
+
+Volumes are floats in dB, where 0 means 100% and -96 means no sound.
+audio.h provides osd::db_to_linear and osd::linear_to_db if such a
+conversion is needed.
+
+There is an inherent race condition with this system, because things
+can change at any point after returning for the method. The idea is
+that the information returned must be internally consistent (a stream
+should not point to a node ID that does not exist in the structure,
+same for default sink) and that any external change from that state
+should increment the generation number, but that's it. Through the
+generation system the core will eventually be in sync with reality.
+
+
+Input and output streams
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: C++
+
+ virtual uint32_t stream_sink_open(uint32_t node, std::string name, uint32_t rate) override;
+ virtual uint32_t stream_source_open(uint32_t node, std::string name, uint32_t rate) override;
+ virtual void stream_set_volumes(uint32_t id, const std::vector<float> &db) override;
+ virtual void stream_close(uint32_t id) override;
+ virtual void stream_sink_update(uint32_t id, const int16_t *buffer, int samples_this_frame) override;
+ virtual void stream_source_update(uint32_t id, int16_t *buffer, int samples_this_frame) override;
+
+Streams are the concept used to send or receive audio from/to the host
+audio system. A stream is first opened through *stream_sink_open* for
+speakers and *stream_source_open* for microphones and targets a
+specific node at a specific sample rate. It is given a name for use
+by the host sound services for user UI purposes (currently the game
+name if split_streams_per_source is false, the
+speaker_device/microphone_device tag if true). The returned ID must
+be a non-zero, never-used-before for streams value in case of success.
+Failures, like when the node went away between the *get_information*
+call and the open one, should be silent and return zero.
+
+*stream_set_volumes* is used only when *external_per_channel_volume*
+is true and is used by the core to set the per-channel volume. The
+call should just be ignored if the stream ID does not exist (or is
+zero). Do not try to apply volumes in the module if the host API
+doesn't provide for it, let the core handle it.
+
+*stream_close* closes a stream, The call should just be ignored if the
+stream ID does not exist (or is zero).
+
+Opening a stream, closing a stream or changing the volume does not
+need to touch the generation number.
+
+*stream_sink_update* is the method used to send data to the node
+through a given stream. It provides a buffer of *samples_this_frame*
+* *node channel count* channel-interleaved int16_t values. The
+lifetime of the data in the buffer or the buffer pointer itself is
+undefined after return from the method call. The call should just be
+ignored if the stream ID does not exist (or is zero).
+
+*stream_source_update* is the equivalent to retrieve data from a node,
+writing to the buffer instead of reading from it. The constraints are
+identical.
+
+When a stream goes away because the target node is lost it should just
+be removed from the information, and the core will pick up the node
+departure and close the stream.
+
+Given the assumed raceness of the interface, all the methods should be
+tolerant of obsolete or zero IDs being used by the core, and that is
+why ID reuse must be avoided. Also the update methods and the
+open/close/volume ones may be called at the same time in different
+threads.
+
+
+Helper class *abuffer*
+~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: C++
+
+ class abuffer {
+ public:
+ abuffer(uint32_t channels);
+ void get(int16_t *data, uint32_t samples);
+ void push(const int16_t *data, uint32_t samples);
+ uint32_t channels() const;
+ };
+
+The class *abuffer* is a helper provided by *sound_module* to buffer
+audio input or output. It automatically drops data when there is
+an overflow and duplicates the last sample on underflow. It must
+first be initialized with the number of channels, which can be
+retrieved with *channels()* if needed. *push* sends
+*samples* * *channels* 16-bit samples in the buffer. *get* retrieves
+*samples* * *channels* 16-bit samples from the buffer, on a FIFO basis.
+
+It is not protected against multithreading, but uses no class
+variables. So just don't read and write from one specific abuffer
+instance at the same time. The system sound interface mandated
+locking should be enough to ensure that.
diff --git a/docs/source/usingmame/mamemenus.rst b/docs/source/usingmame/mamemenus.rst
index ebade1e5188..d58bfe3756e 100644
--- a/docs/source/usingmame/mamemenus.rst
+++ b/docs/source/usingmame/mamemenus.rst
@@ -110,6 +110,14 @@ Network Devices
Shows the Network Devices menu, where you can set up emulated network
adapters that support bridging to a host network. This item is not shown if
there are no network adaptors that support bridging in the running system.
+Audio Mixer
+ Shows the :ref:`Audio Mixer <menus-audiomixer>` menu, where you
+ decide how to connect your system audio inputs and outputs to the
+ emulated system's microphones and speakers.
+Audio Effects
+ Shows the :ref:`Audio Effects <menus-audioeffects>` menu, which
+ allows to configure the audio effects applied between the emulated
+ system's speakers and the actual system audio outputs.
Slider Controls
Shows the Slider Controls menu, where you can adjust various settings,
including video adjustments and individual sound channel levels.
@@ -285,3 +293,103 @@ graphical form below the menu. Digital control states are either zero
ID** to copy the device’s ID to the clipboard. This is useful for setting up
:ref:`stable controller IDs <devicemap>` in :ref:`controller configuration files
<ctrlrcfg>`.
+
+
+.. _menus-audiomixer:
+
+Audio Mixer menu
+----------------
+
+The Audio Mixer menu allows to establish connections between emulated
+speakers and microphones, and system audio inputs and outputs. It
+uses the standard up/down arrows to select a device and/or current
+mapping, left/right arrows to change a value (system audio port,
+level, channel...) and [ ] to change column. In addition the (by
+default) F key adds a full mapping, C a channel mapping, and Delete
+clears a mapping.
+
+A full mapping sends all channels of a speaker to the appropriate(s)
+channel(s) of the system output, and similarly retrieves all channels
+of a microphone from the appropriate(s) input(s) of a system input.
+For instance a mono speaker will send audio to both channels of a
+stereo system output.
+
+A channel mapping maps between one channel of speaker or a microphone
+and one channel of a system input or output. It can be a little
+tedious, but it allows for instance to take two mono speakers and turn
+it into the left and right channels of a system output, which is
+useful for some cabinets.
+
+Every mapping has a configurable volume associated. When changing the
+volume, optionally hold shift/ctrl/alt keys to adjust the step amount.
+
+The mapping configuration is saved in the system cfg file.
+
+Some OSes propose an external interface to change mappings and volumes
+dynamically, for instance pipewire on linux. Mame does its best to
+follow that and keep the information in the cfg file for future runs.
+
+
+.. _menus-audioeffects:
+
+Audio Effects menu
+------------------
+
+This menu allows to configure the audio effects that are applied to
+the speaker outputs between the speaker device and the audio mixer.
+In other words, the output channels as seen in the audio mixer are the
+outputs of the effect chains. Each speaker has an independant effect
+chain applied.
+
+The chain itself is not configurable it is always in order:
+
+* Filter
+* Compressor
+* Reverb
+* EQ
+
+The parameters of each are fully configurable though. A configured
+parameter shows as white, a default as grey, and Clear allows to go
+back to the default value. The default parameters for the chain of a
+given speaker are the parameters of the Default chain, and the default
+parameters of the Default chain are fixed. The default chain allows
+to create a global setup that one likes and have it applied everywhere
+by default.
+
+
+Filter effect
+~~~~~~~~~~~~~
+
+This effect proposes an order-2 high-pass and order-2 low-pass filter.
+The high-pass filter allows to remove the DC offset some emulated
+hardware has which can create saturation when not needed. The
+low-pass filter (defaulting to off) allows to reproduce how muffled
+the sound of a number of cabinets and TVs were.
+
+The Q factor defines how sharp the transition is, the higher the
+sharper. Over 0.7 the filter starts amplifying the frequencies around
+the cutoff though, which can be surprising.
+
+
+Compression effect
+~~~~~~~~~~~~~~~~~~
+
+Not implemented yet.
+
+
+Reverb effect
+~~~~~~~~~~~~~
+
+Not implemented yet.
+
+
+EQ effect
+~~~~~~~~~
+
+The 5-band parametric equalizer allows to amplify or reduce certain
+bands of frequency in the spectrum. The three middle filters, and
+also the extreme ones if configured as "Peak", change frequencies
+around the cutoff. The Q factor selects the sharpness of the peak,
+the higher the sharper. The extreme filters in "Shelf" mode move all
+the frequencies under (or over) the cutoff frequency.
+
diff --git a/hash/a7800.xml b/hash/a7800.xml
index e28d3b848dc..2cc8971cb69 100644
--- a/hash/a7800.xml
+++ b/hash/a7800.xml
@@ -182,8 +182,9 @@ Super Pacman (2008)
Wasp (2009)
Notes:
-The Atari 7800, like many early consoles, had cartridges with more than 1 chip on board. This list currently shows the older (all-in-1)
-type of rom dumps. Effort will be made at a later date to split them and document the chips/labels/markings on them.
+Most games contain only one ROM and only a small number contain more than one ROM,
+generally limited to early 32k games (2x 16k) and the 48k games (1x 16k + 1x 32k).
+Efforts are being made to document the chips/labels/markings on them.
-->
@@ -196,8 +197,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<info name="serial" value="C300358"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_pokey" />
- <dataarea name="rom" size="16384">
- <rom name="devcard.bin" size="16384" crc="3fbe74ce" sha1="4df3657f57e3086bee26fb5c6ea946c509d08553"/>
+ <dataarea name="rom" size="0x4000">
+ <rom name="devcard.bin" size="0x4000" crc="3fbe74ce" sha1="4df3657f57e3086bee26fb5c6ea946c509d08553"/>
</dataarea>
</part>
</software>
@@ -209,8 +210,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<info name="serial" value="CB101195"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="32768">
- <rom name="diagtest.bin" size="32768" crc="a1eaa7c1" sha1="76ec76c423d88bdf739e673c051c5b9c174881c6"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="diagtest.bin" size="0x8000" crc="a1eaa7c1" sha1="76ec76c423d88bdf739e673c051c5b9c174881c6"/>
</dataarea>
</part>
</software>
@@ -222,8 +223,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<publisher>Atari</publisher>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="16384">
- <rom name="testcart.bin" size="16384" crc="729dd769" sha1="ea4df28c6bedc09f7013013f257c984aed9b5319" />
+ <dataarea name="rom" size="0x4000">
+ <rom name="testcart.bin" size="0x4000" crc="729dd769" sha1="ea4df28c6bedc09f7013013f257c984aed9b5319" />
</dataarea>
</part>
</software>
@@ -236,8 +237,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="131072">
- <rom name="aceoface.bin" size="131072" crc="05a2b94c" sha1="efd20bd321a81d67fb6430d9ba93d23fb90d8029"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="aceoface.bin" size="0x20000" crc="05a2b94c" sha1="efd20bd321a81d67fb6430d9ba93d23fb90d8029"/>
</dataarea>
</part>
</software>
@@ -250,8 +251,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="131072">
- <rom name="aceofaeu.bin" size="131072" crc="20c5db80" sha1="c43249ba2d38441461e5ffe07ad2e0b46ab1c6df"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="aceofaeu.bin" size="0x20000" crc="20c5db80" sha1="c43249ba2d38441461e5ffe07ad2e0b46ab1c6df"/>
</dataarea>
</part>
</software>
@@ -266,8 +267,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg9" />
<feature name="peripheral" value="lightgun" />
- <dataarea name="rom" size="147456">
- <rom name="alienbrg.bin" size="147456" crc="c8849d36" sha1="a8629fac962cc20b263a60bb2d2386d605713387"/>
+ <dataarea name="rom" size="0x24000">
+ <rom name="alienbrg.bin" size="0x24000" crc="c8849d36" sha1="a8629fac962cc20b263a60bb2d2386d605713387"/>
</dataarea>
</part>
</software>
@@ -282,8 +283,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg9" />
<feature name="peripheral" value="lightgun" />
- <dataarea name="rom" size="147456">
- <rom name="alienbeu.bin" size="147456" crc="6a19f0fe" sha1="990711ae451d901a960af8ad9ae70813f16257b1"/>
+ <dataarea name="rom" size="0x24000">
+ <rom name="alienbeu.bin" size="0x24000" crc="6a19f0fe" sha1="990711ae451d901a960af8ad9ae70813f16257b1"/>
</dataarea>
</part>
</software>
@@ -312,8 +313,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="16384">
- <rom name="astroids.bin" size="16384" crc="dfb93f40" sha1="d96ec4e043fcdacab367d8a69d29904b3b2896f1"/>
+ <dataarea name="rom" size="0x4000">
+ <rom name="astroids.bin" size="0x4000" crc="dfb93f40" sha1="d96ec4e043fcdacab367d8a69d29904b3b2896f1"/>
</dataarea>
</part>
</software>
@@ -326,8 +327,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="32768">
- <rom name="asteroids deluxe (ntsc).bin" size="32768" crc="56239d62" sha1="514fb53dcd8c47251fcbe5047bb2d9d13ccf6aef"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="asteroids deluxe (ntsc).bin" size="0x8000" crc="56239d62" sha1="514fb53dcd8c47251fcbe5047bb2d9d13ccf6aef"/>
</dataarea>
</part>
</software>
@@ -340,8 +341,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="32768">
- <rom name="asteroids deluxe (pal).bin" size="32768" crc="ab72ea89" sha1="341c7be2823e69e95a61567cb79042c140278c4c"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="asteroids deluxe (pal).bin" size="0x8000" crc="ab72ea89" sha1="341c7be2823e69e95a61567cb79042c140278c4c"/>
</dataarea>
</part>
</software>
@@ -379,11 +380,12 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<year>1988</year>
<publisher>Atari / Lucasfilm</publisher>
<info name="serial" value="CX7815"/>
+ <info name="pcb" value="C026461 7800 POKEY CART REV A"/>
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_pokey" />
- <dataarea name="rom" size="32768">
- <rom name="ballblzr.bin" size="32768" crc="a4c4808b" sha1="4eb5424360691a38b199d91a0e2c9095d0862dbe"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="c300049-015a-01.u1" size="0x8000" crc="a4c4808b" sha1="4eb5424360691a38b199d91a0e2c9095d0862dbe"/>
</dataarea>
</part>
</software>
@@ -393,11 +395,12 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<year>1988?</year>
<publisher>Atari / Lucasfilm</publisher>
<info name="serial" value="CX7815"/>
+ <info name="pcb" value="C026461 7800 POKEY CART REV A"/>
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_pokey" />
- <dataarea name="rom" size="32768">
- <rom name="ballbleu.bin" size="32768" crc="aff85565" sha1="1aa1a508ada1521ae1d373a6860681093e3f851c"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="ballbleu.bin" size="0x8000" crc="aff85565" sha1="1aa1a508ada1521ae1d373a6860681093e3f851c"/>
</dataarea>
</part>
</software>
@@ -416,8 +419,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
<feature name="peripheral" value="lightgun" />
- <dataarea name="rom" size="131072">
- <rom name="barnyard.bin" size="131072" crc="ed0a587d" sha1="cbcde3d85c8778dea402394568677884cd781de3"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="barnyard.bin" size="0x20000" crc="ed0a587d" sha1="cbcde3d85c8778dea402394568677884cd781de3"/>
</dataarea>
</part>
</software>
@@ -431,8 +434,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
<feature name="peripheral" value="lightgun" />
- <dataarea name="rom" size="131072">
- <rom name="barnyaeu.bin" size="131072" crc="02764a86" sha1="a5797cf7e747bbd755c99fde6936caa15fbba6b1"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="barnyaeu.bin" size="0x20000" crc="02764a86" sha1="a5797cf7e747bbd755c99fde6936caa15fbba6b1"/>
</dataarea>
</part>
</software>
@@ -446,8 +449,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="32768">
- <rom name="bseblleu.bin" size="32768" crc="68d48fdc" sha1="c44fe244206590abc26fbbd520a5726353899e35"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="bseblleu.bin" size="0x8000" crc="68d48fdc" sha1="c44fe244206590abc26fbbd520a5726353899e35"/>
</dataarea>
</part>
</software>
@@ -460,8 +463,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_pokey" />
- <dataarea name="rom" size="32768">
- <rom name="bd7800demo.bin" size="32768" crc="7873b949" sha1="a3eaff991cec95040aff53e0c26a862c3dfcc05e"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="bd7800demo.bin" size="0x8000" crc="7873b949" sha1="a3eaff991cec95040aff53e0c26a862c3dfcc05e"/>
</dataarea>
</part>
</software>
@@ -488,8 +491,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="49152">
- <rom name="bonq.bin" size="49152" crc="3124b41c" sha1="379ae22a8c8a1c518ba5eb29ad0826dd2daca954"/>
+ <dataarea name="rom" size="0xc000">
+ <rom name="bonq.bin" size="0xc000" crc="3124b41c" sha1="379ae22a8c8a1c518ba5eb29ad0826dd2daca954"/>
</dataarea>
</part>
</software>
@@ -502,8 +505,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="131072">
- <rom name="bsktbrwl.bin" size="131072" crc="c8b9d7b5" sha1="39877a4c88498bf6656451e3d1acaf7e8638bdfd"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="bsktbrwl.bin" size="0x20000" crc="c8b9d7b5" sha1="39877a4c88498bf6656451e3d1acaf7e8638bdfd"/>
</dataarea>
</part>
</software>
@@ -516,8 +519,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="131072">
- <rom name="bsktbreu.bin" size="131072" crc="a4265d4b" sha1="e7ef6b11bb6836ff7d11a25f8d4e2c9361fa69b3"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="bsktbreu.bin" size="0x20000" crc="a4265d4b" sha1="e7ef6b11bb6836ff7d11a25f8d4e2c9361fa69b3"/>
</dataarea>
</part>
</software>
@@ -530,8 +533,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="16384">
- <rom name="centpede.bin" size="16384" crc="020efe25" sha1="c8377ad7fb6afec5c88c14a23a68e2ecebba4e5a"/>
+ <dataarea name="rom" size="0x4000">
+ <rom name="centpede.bin" size="0x4000" crc="020efe25" sha1="c8377ad7fb6afec5c88c14a23a68e2ecebba4e5a"/>
</dataarea>
</part>
</software>
@@ -544,8 +547,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="16384">
- <rom name="centpeeu.bin" size="16384" crc="33f8a8f6" sha1="323f9fc4fde9aa6fcbaac8ae300aaa06bafa745a"/>
+ <dataarea name="rom" size="0x4000">
+ <rom name="centpeeu.bin" size="0x4000" crc="33f8a8f6" sha1="323f9fc4fde9aa6fcbaac8ae300aaa06bafa745a"/>
</dataarea>
</part>
</software>
@@ -558,8 +561,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="32768">
- <rom name="choplift.bin" size="32768" crc="419bff61" sha1="6df15e73494d0a498dd044753a27544214210b14"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="choplift.bin" size="0x8000" crc="419bff61" sha1="6df15e73494d0a498dd044753a27544214210b14"/>
</dataarea>
</part>
</software>
@@ -572,8 +575,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="49152">
- <rom name="choplieu.bin" size="49152" crc="12efeb07" sha1="f2fe1c82e5b333f4c59f76a28a9d379228596d89"/>
+ <dataarea name="rom" size="0xc000">
+ <rom name="choplieu.bin" size="0xc000" crc="12efeb07" sha1="f2fe1c82e5b333f4c59f76a28a9d379228596d89"/>
</dataarea>
</part>
</software>
@@ -583,11 +586,12 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<year>1989</year>
<publisher>Atari / Data East</publisher>
<info name="serial" value="CX7838"/>
+ <info name="pcb" value="C301105-001 REV A"/>
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg_pokey" />
- <dataarea name="rom" size="131072">
- <rom name="commando.bin" size="131072" crc="cd1a98c5" sha1="f8ae7da650ad38675b81675b77096794a9cd52e8"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="c300051-038a.u1" size="0x20000" crc="cd1a98c5" sha1="f8ae7da650ad38675b81675b77096794a9cd52e8"/>
</dataarea>
</part>
</software>
@@ -597,11 +601,12 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<year>1989</year>
<publisher>Atari / Data East</publisher>
<info name="serial" value="CX7838"/>
+ <info name="pcb" value="C301105-001 REV A"/>
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg_pokey" />
- <dataarea name="rom" size="131072">
- <rom name="commaneu.bin" size="131072" crc="7c211612" sha1="2bdad24967fe4f5492ae294b1ccf8f148930a419"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="commaneu.bin" size="0x20000" crc="7c211612" sha1="2bdad24967fe4f5492ae294b1ccf8f148930a419"/>
</dataarea>
</part>
</software>
@@ -614,8 +619,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="131072">
- <rom name="cracked.bin" size="131072" crc="e645fd1f" sha1="664d267d1245d5698cbf6ff0622ee0d629da3a11"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="cracked.bin" size="0x20000" crc="e645fd1f" sha1="664d267d1245d5698cbf6ff0622ee0d629da3a11"/>
</dataarea>
</part>
</software>
@@ -628,8 +633,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="131072">
- <rom name="crackeu.bin" size="131072" crc="50fd19cb" sha1="0c1a7806e431efbf0c826a11b92d74eb45e08661"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="crackeu.bin" size="0x20000" crc="50fd19cb" sha1="0c1a7806e431efbf0c826a11b92d74eb45e08661"/>
</dataarea>
</part>
</software>
@@ -672,8 +677,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg9" />
<feature name="peripheral" value="lightgun" />
- <dataarea name="rom" size="147456">
- <rom name="crossbow.bin" size="147456" crc="d2ea5686" sha1="d5e47da88e232cd9ea059e133e7c0f13d921a04c"/>
+ <dataarea name="rom" size="0x24000">
+ <rom name="crossbow.bin" size="0x24000" crc="d2ea5686" sha1="d5e47da88e232cd9ea059e133e7c0f13d921a04c"/>
</dataarea>
</part>
</software>
@@ -688,8 +693,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg9" />
<feature name="peripheral" value="lightgun" />
- <dataarea name="rom" size="147456">
- <rom name="crossbeu.bin" size="147456" crc="e93d8894" sha1="f26d292210a91a714b4b87712ff53b8e49da611e"/>
+ <dataarea name="rom" size="0x24000">
+ <rom name="crossbeu.bin" size="0x24000" crc="e93d8894" sha1="f26d292210a91a714b4b87712ff53b8e49da611e"/>
</dataarea>
</part>
</software>
@@ -702,8 +707,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="131072">
- <rom name="darkchmb.bin" size="131072" crc="366777f1" sha1="848077f15114fec31f8290be2583566f4486fe65"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="darkchmb.bin" size="0x20000" crc="366777f1" sha1="848077f15114fec31f8290be2583566f4486fe65"/>
</dataarea>
</part>
</software>
@@ -716,8 +721,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="131072">
- <rom name="darkcheu.bin" size="131072" crc="c93a563e" sha1="2b888c95b31109ffd0441f586ba18f21a3a4f22e"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="darkcheu.bin" size="0x20000" crc="c93a563e" sha1="2b888c95b31109ffd0441f586ba18f21a3a4f22e"/>
</dataarea>
</part>
</software>
@@ -734,8 +739,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="49152">
- <rom name="dsrtflcn.bin" size="49152" crc="a1dc0899" sha1="725f893f9a98926c627ef37eacc3f241620c3ffc"/>
+ <dataarea name="rom" size="0xc000">
+ <rom name="dsrtflcn.bin" size="0xc000" crc="a1dc0899" sha1="725f893f9a98926c627ef37eacc3f241620c3ffc"/>
</dataarea>
</part>
</software>
@@ -748,8 +753,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="49152">
- <rom name="dsrtflcp.bin" size="49152" crc="53e277f6" sha1="bbb8aa88879f2ec6039673ccdbbebebc565346bc"/>
+ <dataarea name="rom" size="0xc000">
+ <rom name="dsrtflcp.bin" size="0xc000" crc="53e277f6" sha1="bbb8aa88879f2ec6039673ccdbbebebc565346bc"/>
</dataarea>
</part>
</software>
@@ -762,8 +767,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="49152">
- <rom name="dsrtfleu.bin" size="49152" crc="33991ee8" sha1="185d104614e23699e074e850d5ab8c36a159071c"/>
+ <dataarea name="rom" size="0xc000">
+ <rom name="dsrtfleu.bin" size="0xc000" crc="33991ee8" sha1="185d104614e23699e074e850d5ab8c36a159071c"/>
</dataarea>
</part>
</software>
@@ -779,8 +784,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="16384">
- <rom name="digdugp.bin" size="16384" crc="50cb13f3" sha1="19cee8dc40fabd7022bedc27e4896c09e3cadfdd"/>
+ <dataarea name="rom" size="0x4000">
+ <rom name="digdugp.bin" size="0x4000" crc="50cb13f3" sha1="19cee8dc40fabd7022bedc27e4896c09e3cadfdd"/>
</dataarea>
</part>
</software>
@@ -793,8 +798,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="32768">
- <rom name="digdugeu.bin" size="32768" crc="efab7077" sha1="ce05d3270b0e0d36d80a4f0731d0173cb5921bce"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="digdugeu.bin" size="0x8000" crc="efab7077" sha1="ce05d3270b0e0d36d80a4f0731d0173cb5921bce"/>
</dataarea>
</part>
</software>
@@ -807,8 +812,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="49152">
- <rom name="dnkykong.bin" size="49152" crc="065e063f" sha1="820c852caa7957179bf7d6faf2e6922dde5a1a8e"/>
+ <dataarea name="rom" size="0xc000">
+ <rom name="dnkykong.bin" size="0xc000" crc="065e063f" sha1="820c852caa7957179bf7d6faf2e6922dde5a1a8e"/>
</dataarea>
</part>
</software>
@@ -821,8 +826,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="49152">
- <rom name="dnkykoeu.bin" size="49152" crc="0a43d1c5" sha1="dc69fa8fdf3fcba8557195358b8d206463652e0f"/>
+ <dataarea name="rom" size="0xc000">
+ <rom name="dnkykoeu.bin" size="0xc000" crc="0a43d1c5" sha1="dc69fa8fdf3fcba8557195358b8d206463652e0f"/>
</dataarea>
</part>
</software>
@@ -835,8 +840,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="49152">
- <rom name="dnkykgjr.bin" size="49152" crc="1c5a1082" sha1="e9392259fff682fcc3476009771a3cfd7d5bdb6d"/>
+ <dataarea name="rom" size="0xc000">
+ <rom name="dnkykgjr.bin" size="0xc000" crc="1c5a1082" sha1="e9392259fff682fcc3476009771a3cfd7d5bdb6d"/>
</dataarea>
</part>
</software>
@@ -849,8 +854,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="49152">
- <rom name="dnkykjeu.bin" size="49152" crc="c784dbac" sha1="2626a9cd3326b8ce0ee0e834e17a0eedae005669"/>
+ <dataarea name="rom" size="0xc000">
+ <rom name="dnkykjeu.bin" size="0xc000" crc="c784dbac" sha1="2626a9cd3326b8ce0ee0e834e17a0eedae005669"/>
</dataarea>
</part>
</software>
@@ -905,8 +910,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_abs" />
- <dataarea name="rom" size="65536">
- <rom name="f18horeu.bin" size="65536" crc="e5d714b0" sha1="673d912b2f9ab7a43f95e0e90bd80249b360fe0d"/>
+ <dataarea name="rom" size="0x10000">
+ <rom name="f18horeu.bin" size="0x10000" crc="e5d714b0" sha1="673d912b2f9ab7a43f95e0e90bd80249b360fe0d"/>
</dataarea>
</part>
</software>
@@ -947,8 +952,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="131072">
- <rom name="fatalrun.bin" size="131072" crc="a44df354" sha1="69aab1e6ef332c6844c693ac41965e4c33ff822a"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="fatalrun.bin" size="0x20000" crc="a44df354" sha1="69aab1e6ef332c6844c693ac41965e4c33ff822a"/>
</dataarea>
</part>
</software>
@@ -961,8 +966,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="131072">
- <rom name="fatalreu.bin" size="131072" crc="2a0a93be" sha1="f23173d2e42bca0767f3d8ecb6bb1c0d23dde996"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="fatalreu.bin" size="0x20000" crc="2a0a93be" sha1="f23173d2e42bca0767f3d8ecb6bb1c0d23dde996"/>
</dataarea>
</part>
</software>
@@ -975,8 +980,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="131072">
- <rom name="fghtnght.bin" size="131072" crc="720ebc74" sha1="1e8a8704a77b15e70cbc72b0ae9bc25fb91d7c21"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="fghtnght.bin" size="0x20000" crc="720ebc74" sha1="1e8a8704a77b15e70cbc72b0ae9bc25fb91d7c21"/>
</dataarea>
</part>
</software>
@@ -989,8 +994,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="131072">
- <rom name="fghtngeu.bin" size="131072" crc="64d9c4be" sha1="ded89f3a4ac0d95aa158c98302b7939e5b89e4c6"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="fghtngeu.bin" size="0x20000" crc="64d9c4be" sha1="ded89f3a4ac0d95aa158c98302b7939e5b89e4c6"/>
</dataarea>
</part>
</software>
@@ -1000,11 +1005,12 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<year>1986</year>
<publisher>Atari</publisher>
<info name="serial" value="CX7804"/>
+ <info name="pcb" value="C024926-001 REV.B"/>
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="32768">
- <rom name="foodfght.bin" size="32768" crc="e64a5cde" sha1="3f5f42d5aaf6ccd4979658a1387aac5933549357"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="c300049-004a-01.u1" size="0x8000" crc="e64a5cde" sha1="3f5f42d5aaf6ccd4979658a1387aac5933549357"/>
</dataarea>
</part>
</software>
@@ -1017,7 +1023,7 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
<dataarea name="rom" size="0x8000">
- <rom name="ff lo 8 8-16-84 029e.u2" size="0x4000" crc="47d02bb1" sha1="48539447a5a247c57faadd7236281844609e8fc0" offset="0x0000"/>
+ <rom name="ff lo 8 8-16-84 029e.u2" size="0x4000" crc="47d02bb1" sha1="48539447a5a247c57faadd7236281844609e8fc0" offset="0"/>
<rom name="ff hi e 8-16-84 845f.u1" size="0x2000" crc="ea1f5502" sha1="fa2fa3c5aa20ebd5f55d8182dadc822bdbba1ac5" offset="0x4000"/>
<rom size="0x2000" offset="0x6000" loadflag="reload"/>
</dataarea>
@@ -1029,11 +1035,12 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<year>1986?</year>
<publisher>Atari</publisher>
<info name="serial" value="CX7804"/>
+ <info name="pcb" value="C024926-001 REV.B"/>
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="49152">
- <rom name="foodfgeu.bin" size="49152" crc="c64549ec" sha1="40b8e5eeb9e9ad7239963ed79dc085092ccbec4c"/>
+ <dataarea name="rom" size="0xc000">
+ <rom name="foodfgeu.bin" size="0xc000" crc="c64549ec" sha1="40b8e5eeb9e9ad7239963ed79dc085092ccbec4c"/>
</dataarea>
</part>
</software>
@@ -1059,8 +1066,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="32768">
- <rom name="galagap.bin" size="32768" crc="1a0a3eb3" sha1="33178d682564d70955e13d0633359e87b512253b"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="galagap.bin" size="0x8000" crc="1a0a3eb3" sha1="33178d682564d70955e13d0633359e87b512253b"/>
</dataarea>
</part>
</software>
@@ -1073,8 +1080,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="49152">
- <rom name="galagaeu.bin" size="49152" crc="5990a9f8" sha1="f1ae5df03cf90041380d77c1b49c94611443330b"/>
+ <dataarea name="rom" size="0xc000">
+ <rom name="galagaeu.bin" size="0xc000" crc="5990a9f8" sha1="f1ae5df03cf90041380d77c1b49c94611443330b"/>
</dataarea>
</part>
</software>
@@ -1087,8 +1094,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="49152">
- <rom name="gatop1.bin" size="49152" crc="715e1a2f" sha1="e153927b3463148d3fbeef2d28980c281562cc09"/>
+ <dataarea name="rom" size="0xc000">
+ <rom name="gatop1.bin" size="0xc000" crc="715e1a2f" sha1="e153927b3463148d3fbeef2d28980c281562cc09"/>
</dataarea>
</part>
</software>
@@ -1101,8 +1108,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="49152">
- <rom name="gatop2.bin" size="49152" crc="0f2f66f8" sha1="5784f40216dbc487e80dabd532ae89b2de4bdcc4"/>
+ <dataarea name="rom" size="0xc000">
+ <rom name="gatop2.bin" size="0xc000" crc="0f2f66f8" sha1="5784f40216dbc487e80dabd532ae89b2de4bdcc4"/>
</dataarea>
</part>
</software>
@@ -1115,8 +1122,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="49152">
- <rom name="gatop3.bin" size="49152" crc="3796705f" sha1="b365d2bf0a5b238eff5f1a4cdc9b7ece2cace38d"/>
+ <dataarea name="rom" size="0xc000">
+ <rom name="gatop3.bin" size="0xc000" crc="3796705f" sha1="b365d2bf0a5b238eff5f1a4cdc9b7ece2cace38d"/>
</dataarea>
</part>
</software>
@@ -1129,8 +1136,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="49152">
- <rom name="gatop4.bin" size="49152" crc="15de2327" sha1="c5793c362a69c7e82191caffa0a830e67fe21dc5"/>
+ <dataarea name="rom" size="0xc000">
+ <rom name="gatop4.bin" size="0xc000" crc="15de2327" sha1="c5793c362a69c7e82191caffa0a830e67fe21dc5"/>
</dataarea>
</part>
</software>
@@ -1143,8 +1150,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="49152">
- <rom name="gatop5.bin" size="49152" crc="9fa0fbda" sha1="1c536bb5870f315eecbdea6660beb7de9371f0f8"/>
+ <dataarea name="rom" size="0xc000">
+ <rom name="gatop5.bin" size="0xc000" crc="9fa0fbda" sha1="1c536bb5870f315eecbdea6660beb7de9371f0f8"/>
</dataarea>
</part>
</software>
@@ -1157,8 +1164,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="49152">
- <rom name="gatop6.bin" size="49152" crc="40b629a1" sha1="f644c5d071c49d75e1487cd06b91da778697ff23"/>
+ <dataarea name="rom" size="0xc000">
+ <rom name="gatop6.bin" size="0xc000" crc="40b629a1" sha1="f644c5d071c49d75e1487cd06b91da778697ff23"/>
</dataarea>
</part>
</software>
@@ -1172,8 +1179,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="49152">
- <rom name="gatop7.bin" size="49152" crc="b05cf8d2" sha1="78eaa5c8e89129596f2f9a7a4517e51eefbd857f"/>
+ <dataarea name="rom" size="0xc000">
+ <rom name="gatop7.bin" size="0xc000" crc="b05cf8d2" sha1="78eaa5c8e89129596f2f9a7a4517e51eefbd857f"/>
</dataarea>
</part>
</software>
@@ -1186,8 +1193,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="49152">
- <rom name="gatop8.bin" size="49152" crc="e51eb3bc" sha1="e8d29920fe466ea8bfe292e0f135c0e24a48aaad"/>
+ <dataarea name="rom" size="0xc000">
+ <rom name="gatop8.bin" size="0xc000" crc="e51eb3bc" sha1="e8d29920fe466ea8bfe292e0f135c0e24a48aaad"/>
</dataarea>
</part>
</software>
@@ -1200,8 +1207,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="16384">
- <rom name="hangly-man.bin" size="16384" crc="8560a801" sha1="f8654387ff648abbe1e6d8f49b8f8b33f803b917"/>
+ <dataarea name="rom" size="0x4000">
+ <rom name="hangly-man.bin" size="0x4000" crc="8560a801" sha1="f8654387ff648abbe1e6d8f49b8f8b33f803b917"/>
</dataarea>
</part>
</software>
@@ -1218,8 +1225,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="49152">
- <rom name="hattrick.bin" size="49152" crc="cf6f4a6c" sha1="14c0cfd01df1c725f399c23810e4854a639fce52"/>
+ <dataarea name="rom" size="0xc000">
+ <rom name="hattrick.bin" size="0xc000" crc="cf6f4a6c" sha1="14c0cfd01df1c725f399c23810e4854a639fce52"/>
</dataarea>
</part>
</software>
@@ -1232,8 +1239,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="49152">
- <rom name="hattrieu.bin" size="49152" crc="057d9c3c" sha1="0e9fa678bb4aedc7bb7cf5d38fe27556c4c2bbbd"/>
+ <dataarea name="rom" size="0xc000">
+ <rom name="hattrieu.bin" size="0xc000" crc="057d9c3c" sha1="0e9fa678bb4aedc7bb7cf5d38fe27556c4c2bbbd"/>
</dataarea>
</part>
</software>
@@ -1246,8 +1253,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="131072">
- <rom name="ikariwar.bin" size="131072" crc="8a6c1f15" sha1="e368c6c7ffca5ffac314dec1effea4e2c809519a"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="ikariwar.bin" size="0x20000" crc="8a6c1f15" sha1="e368c6c7ffca5ffac314dec1effea4e2c809519a"/>
</dataarea>
</part>
</software>
@@ -1260,8 +1267,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="131072">
- <rom name="ikariweu.bin" size="131072" crc="cb621cdc" sha1="275cae6c693d9bd1906fdc684460ec596869bbad"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="ikariweu.bin" size="0x20000" crc="cb621cdc" sha1="275cae6c693d9bd1906fdc684460ec596869bbad"/>
</dataarea>
</part>
</software>
@@ -1274,10 +1281,10 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg_ram" />
- <dataarea name="rom" size="131072">
- <rom name="impssble.bin" size="131072" crc="3b1f2f47" sha1="5437c0efb63a349953ec047efe6ec24144ed6914"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="impssble.bin" size="0x20000" crc="3b1f2f47" sha1="5437c0efb63a349953ec047efe6ec24144ed6914"/>
</dataarea>
- <dataarea name="ram" size="16384">
+ <dataarea name="ram" size="0x4000">
</dataarea>
</part>
</software>
@@ -1290,10 +1297,10 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg_ram" />
- <dataarea name="rom" size="131072">
- <rom name="impssbeu.bin" size="131072" crc="994af6e0" sha1="9770b61472510aba1cf3ea35ceca1859c3493676"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="impssbeu.bin" size="0x20000" crc="994af6e0" sha1="9770b61472510aba1cf3ea35ceca1859c3493676"/>
</dataarea>
- <dataarea name="ram" size="16384">
+ <dataarea name="ram" size="0x4000">
</dataarea>
</part>
</software>
@@ -1306,10 +1313,10 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg_ram" />
- <dataarea name="rom" size="131072">
- <rom name="jinks.bin" size="131072" crc="0818d8cd" sha1="472bc12c437b015a9e317bac092529f3295033b8"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="jinks.bin" size="0x20000" crc="0818d8cd" sha1="472bc12c437b015a9e317bac092529f3295033b8"/>
</dataarea>
- <dataarea name="ram" size="16384">
+ <dataarea name="ram" size="0x4000">
</dataarea>
</part>
</software>
@@ -1322,10 +1329,10 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg_ram" />
- <dataarea name="rom" size="131072">
- <rom name="jinkseu.bin" size="131072" crc="9207ed3b" sha1="eb16de0c3d5c4e769ae2314ba21c4dd3bca33c88"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="jinkseu.bin" size="0x20000" crc="9207ed3b" sha1="eb16de0c3d5c4e769ae2314ba21c4dd3bca33c88"/>
</dataarea>
- <dataarea name="ram" size="16384">
+ <dataarea name="ram" size="0x4000">
</dataarea>
</part>
</software>
@@ -1338,8 +1345,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="32768">
- <rom name="jr pac-man (ntsc).bin" size="32768" crc="0198aed4" sha1="f6d51d9c0eaf03c47e1e2d3774fd16c3ba3a59e3"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="jr pac-man (ntsc).bin" size="0x8000" crc="0198aed4" sha1="f6d51d9c0eaf03c47e1e2d3774fd16c3ba3a59e3"/>
</dataarea>
</part>
</software>
@@ -1352,8 +1359,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="32768">
- <rom name="joust.bin" size="32768" crc="2c430bce" sha1="1ccd7c232bcfd5a65d26b9decfe4eceadcbe314c"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="joust.bin" size="0x8000" crc="2c430bce" sha1="1ccd7c232bcfd5a65d26b9decfe4eceadcbe314c"/>
</dataarea>
</part>
</software>
@@ -1366,8 +1373,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="49152">
- <rom name="jousteu.bin" size="49152" crc="9b3be616" sha1="aae5b9ee00c39d577858aba9d1fd791194be2c0c"/>
+ <dataarea name="rom" size="0xc000">
+ <rom name="jousteu.bin" size="0xc000" crc="9b3be616" sha1="aae5b9ee00c39d577858aba9d1fd791194be2c0c"/>
</dataarea>
</part>
</software>
@@ -1397,11 +1404,13 @@ the buttons not work in emulators.
<year>1987</year>
<publisher>Atari / Brøderbund</publisher>
<info name="serial" value="CX7822"/>
+ <info name="pcb" value="C026445-001 7800 48K ROM REV A"/>
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="49152">
- <rom name="karateka.bin" size="49152" crc="fec21472" sha1="9fb97bbc7dcc610251cee1695c48b82a087f32d2"/>
+ <dataarea name="rom" size="0xc000">
+ <rom name="c300048-022a-01.u1" size="0x4000" crc="8a88d96d" sha1="40ccda4a0f7bc434c8823f3e60e2b9a9d60bb26f" offset="0"/>
+ <rom name="c300049-022a-01.u2" size="0x8000" crc="cee2324e" sha1="89f24abb4efb373d6b7e9ecf567ebf74436a5725" offset="0x4000"/>
</dataarea>
</part>
</software>
@@ -1411,11 +1420,12 @@ the buttons not work in emulators.
<year>1987</year>
<publisher>Atari / Brøderbund</publisher>
<info name="serial" value="CX7822"/>
+ <info name="pcb" value="C026445-001 7800 48K ROM REV A"/>
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="65536">
- <rom name="karateeu.bin" size="65536" crc="6c8d9e68" sha1="c5f25c88eefe0c7b3571ab3c3ec5185e537eb151"/>
+ <dataarea name="rom" size="0x10000">
+ <rom name="karateeu.bin" size="0x10000" crc="6c8d9e68" sha1="c5f25c88eefe0c7b3571ab3c3ec5185e537eb151"/>
</dataarea>
</part>
</software>
@@ -1435,8 +1445,8 @@ Saarna for debugging the problem)
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="131072">
- <rom name="klax.bin" size="131072" crc="f26621e3" sha1="0ea6a04b8f9713040ce57b6f23a6589f98409d46"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="klax.bin" size="0x20000" crc="f26621e3" sha1="0ea6a04b8f9713040ce57b6f23a6589f98409d46"/>
</dataarea>
</part>
</software>
@@ -1449,8 +1459,8 @@ Saarna for debugging the problem)
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="32768">
- <rom name="kungfums.bin" size="32768" crc="297899bb" sha1="8824bffdf4f30a8191e581752a75259a663092ca"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="kungfums.bin" size="0x8000" crc="297899bb" sha1="8824bffdf4f30a8191e581752a75259a663092ca"/>
</dataarea>
</part>
</software>
@@ -1463,8 +1473,8 @@ Saarna for debugging the problem)
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="32768">
- <rom name="kungfueu.bin" size="32768" crc="c1531fc4" sha1="0f0e24246d9e684b7f900a362fb08878b232580c"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="kungfueu.bin" size="0x8000" crc="c1531fc4" sha1="0f0e24246d9e684b7f900a362fb08878b232580c"/>
</dataarea>
</part>
</software>
@@ -1477,8 +1487,8 @@ Saarna for debugging the problem)
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="49152">
- <rom name="mariobro.bin" size="49152" crc="8021a13b" sha1="12e04b67094af622641c536379c69ecad2ee98ed"/>
+ <dataarea name="rom" size="0xc000">
+ <rom name="mariobro.bin" size="0xc000" crc="8021a13b" sha1="12e04b67094af622641c536379c69ecad2ee98ed"/>
</dataarea>
</part>
</software>
@@ -1491,8 +1501,8 @@ Saarna for debugging the problem)
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="49152">
- <rom name="mariobeu.bin" size="49152" crc="efad3d9d" sha1="881beff5103713e655fed80b32e0bbd774e78ee8"/>
+ <dataarea name="rom" size="0xc000">
+ <rom name="mariobeu.bin" size="0xc000" crc="efad3d9d" sha1="881beff5103713e655fed80b32e0bbd774e78ee8"/>
</dataarea>
</part>
</software>
@@ -1505,8 +1515,8 @@ Saarna for debugging the problem)
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="131072">
- <rom name="matmania.bin" size="131072" crc="aba91829" sha1="bb849b603cf1091e4f032936b209ff33fc3b714e"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="matmania.bin" size="0x20000" crc="aba91829" sha1="bb849b603cf1091e4f032936b209ff33fc3b714e"/>
</dataarea>
</part>
</software>
@@ -1519,8 +1529,8 @@ Saarna for debugging the problem)
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="131072">
- <rom name="matmaneu.bin" size="131072" crc="065f3873" sha1="119bb784f1a0638cc6778841131ca1766e94a112"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="matmaneu.bin" size="0x20000" crc="065f3873" sha1="119bb784f1a0638cc6778841131ca1766e94a112"/>
</dataarea>
</part>
</software>
@@ -1533,8 +1543,8 @@ Saarna for debugging the problem)
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="131072">
- <rom name="mean18.bin" size="131072" crc="cf21d9ac" sha1="a3e50c0e56c9675ffb1b6439f40789bc64c606b2"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="mean18.bin" size="0x20000" crc="cf21d9ac" sha1="a3e50c0e56c9675ffb1b6439f40789bc64c606b2"/>
</dataarea>
</part>
</software>
@@ -1547,8 +1557,8 @@ Saarna for debugging the problem)
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="131072">
- <rom name="mean18eu.bin" size="131072" crc="3cec4be8" sha1="47702ee71c64af4ada09cd41122c779c7d8d94f1"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="mean18eu.bin" size="0x20000" crc="3cec4be8" sha1="47702ee71c64af4ada09cd41122c779c7d8d94f1"/>
</dataarea>
</part>
</software>
@@ -1562,8 +1572,8 @@ Saarna for debugging the problem)
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
<feature name="peripheral" value="lightgun" />
- <dataarea name="rom" size="131072">
- <rom name="meltdown.bin" size="131072" crc="4a8f2171" sha1="e601c45aaa1cc25f01493867664c8b9fefeca70e"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="meltdown.bin" size="0x20000" crc="4a8f2171" sha1="e601c45aaa1cc25f01493867664c8b9fefeca70e"/>
</dataarea>
</part>
</software>
@@ -1577,8 +1587,8 @@ Saarna for debugging the problem)
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
<feature name="peripheral" value="lightgun" />
- <dataarea name="rom" size="131072">
- <rom name="meltdoeu.bin" size="131072" crc="177fc850" sha1="ac448f369c3c6334415095e4ff344fdd73b473be"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="meltdoeu.bin" size="0x20000" crc="177fc850" sha1="ac448f369c3c6334415095e4ff344fdd73b473be"/>
</dataarea>
</part>
</software>
@@ -1619,8 +1629,8 @@ Saarna for debugging the problem)
<info name="serial" value="CX7890"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg9" />
- <dataarea name="rom" size="147456">
- <rom name="miaproto.bin" size="147456" crc="ff7a4c60" sha1="26b0b187a43bf9a9397cb5e8b0033e8833f48f88"/>
+ <dataarea name="rom" size="0x24000">
+ <rom name="miaproto.bin" size="0x24000" crc="ff7a4c60" sha1="26b0b187a43bf9a9397cb5e8b0033e8833f48f88"/>
</dataarea>
</part>
</software>
@@ -1647,8 +1657,8 @@ Saarna for debugging the problem)
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="131072">
- <rom name="midmuteu.bin" size="131072" crc="7ca6d521" sha1="85f0e0556df65c0732f71ab3f2bbde3615355f72"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="midmuteu.bin" size="0x20000" crc="7ca6d521" sha1="85f0e0556df65c0732f71ab3f2bbde3615355f72"/>
</dataarea>
</part>
</software>
@@ -1698,8 +1708,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="131072">
- <rom name="mtrpsych.bin" size="131072" crc="1e219482" sha1="b9381f4d0413b6c48e27f26ed94c7a9eb1a49624"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="mtrpsych.bin" size="0x20000" crc="1e219482" sha1="b9381f4d0413b6c48e27f26ed94c7a9eb1a49624"/>
</dataarea>
</part>
</software>
@@ -1712,8 +1722,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="131072">
- <rom name="mtrpsyeu.bin" size="131072" crc="38bb45ba" sha1="3b72d6b3e28ca9182f1f25dc57115d2ec33aa63e"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="mtrpsyeu.bin" size="0x20000" crc="38bb45ba" sha1="3b72d6b3e28ca9182f1f25dc57115d2ec33aa63e"/>
</dataarea>
</part>
</software>
@@ -1726,8 +1736,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="16384">
- <rom name="miss pac-attack.bin" size="16384" crc="b4557dd7" sha1="446660edd243da39602d1b673ff13a84239b66d4"/>
+ <dataarea name="rom" size="0x4000">
+ <rom name="miss pac-attack.bin" size="0x4000" crc="b4557dd7" sha1="446660edd243da39602d1b673ff13a84239b66d4"/>
</dataarea>
</part>
</software>
@@ -1740,8 +1750,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="16384">
- <rom name="mspacman.bin" size="16384" crc="e42fc700" sha1="ff22e21fc953a288453c40eb6fc5378d42b871f6"/>
+ <dataarea name="rom" size="0x4000">
+ <rom name="mspacman.bin" size="0x4000" crc="e42fc700" sha1="ff22e21fc953a288453c40eb6fc5378d42b871f6"/>
</dataarea>
</part>
</software>
@@ -1754,8 +1764,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="32768">
- <rom name="mspacmeu.bin" size="32768" crc="8421033a" sha1="a5b0826a130acf8b8dbc59ef980d40b802c22b30"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="mspacmeu.bin" size="0x8000" crc="8421033a" sha1="a5b0826a130acf8b8dbc59ef980d40b802c22b30"/>
</dataarea>
</part>
</software>
@@ -1768,8 +1778,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="131072">
- <rom name="ninjaglf.bin" size="131072" crc="cb48e8dc" sha1="96d0e59e703770eea8d8d9c2c4e5a87ce6f2de76"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="ninjaglf.bin" size="0x20000" crc="cb48e8dc" sha1="96d0e59e703770eea8d8d9c2c4e5a87ce6f2de76"/>
</dataarea>
</part>
</software>
@@ -1782,8 +1792,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="131072">
- <rom name="ninjageu.bin" size="131072" crc="2b5382b7" sha1="99ce5711e38ff7ef3311216f954cf0ab70e289cf"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="ninjageu.bin" size="0x20000" crc="2b5382b7" sha1="99ce5711e38ff7ef3311216f954cf0ab70e289cf"/>
</dataarea>
</part>
</software>
@@ -1796,8 +1806,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="49152">
- <rom name="oneonone.bin" size="49152" crc="7d9370fb" sha1="5173f892a8d70aeca6c324c138c56208e0db2b98"/>
+ <dataarea name="rom" size="0xc000">
+ <rom name="oneonone.bin" size="0xc000" crc="7d9370fb" sha1="5173f892a8d70aeca6c324c138c56208e0db2b98"/>
</dataarea>
</part>
</software>
@@ -1810,8 +1820,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="49152">
- <rom name="oneonoeu.bin" size="49152" crc="7a628295" sha1="01dfc5e4e615cf20ee4f07245285f85684ee445d"/>
+ <dataarea name="rom" size="0xc000">
+ <rom name="oneonoeu.bin" size="0xc000" crc="7a628295" sha1="01dfc5e4e615cf20ee4f07245285f85684ee445d"/>
</dataarea>
</part>
</software>
@@ -1824,8 +1834,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="32768">
- <rom name="peterose.bin" size="32768" crc="f33d4dfa" sha1="ffb4fbed8d8f28ea71668542b7ebd019955c5a11"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="peterose.bin" size="0x8000" crc="f33d4dfa" sha1="ffb4fbed8d8f28ea71668542b7ebd019955c5a11"/>
</dataarea>
</part>
</software>
@@ -1838,8 +1848,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="16384">
- <rom name="pacman.bin" size="16384" crc="d5d08d7e" sha1="f427806eae13e3c4ab8afdbe366ab1ec219d0047"/>
+ <dataarea name="rom" size="0x4000">
+ <rom name="pacman.bin" size="0x4000" crc="d5d08d7e" sha1="f427806eae13e3c4ab8afdbe366ab1ec219d0047"/>
</dataarea>
</part>
</software>
@@ -1852,8 +1862,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="32768">
- <rom name="ultra pac-man.bin" size="32768" crc="4baeac35" sha1="63a98f74ada1ce08ee0137e437395cc17b67a4d9"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="ultra pac-man.bin" size="0x8000" crc="4baeac35" sha1="63a98f74ada1ce08ee0137e437395cc17b67a4d9"/>
</dataarea>
</part>
</software>
@@ -1866,8 +1876,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="32768">
- <rom name="pac-man collection (ntsc).bin" size="32768" crc="553ea894" sha1="3b579d8827898a94b16225632a9870d22224b6bc"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="pac-man collection (ntsc).bin" size="0x8000" crc="553ea894" sha1="3b579d8827898a94b16225632a9870d22224b6bc"/>
</dataarea>
</part>
</software>
@@ -1880,8 +1890,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="32768">
- <rom name="pac-man collection (pal).bin" size="32768" crc="74517c71" sha1="ed0414e4b7c5ac10b0d7a5e19ee9c8e9ee61442f"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="pac-man collection (pal).bin" size="0x8000" crc="74517c71" sha1="ed0414e4b7c5ac10b0d7a5e19ee9c8e9ee61442f"/>
</dataarea>
</part>
</software>
@@ -1894,8 +1904,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="16384">
- <rom name="pac-man plus.bin" size="16384" crc="e2dc056e" sha1="7dd18c8c7e82c813531f80ef2fe981c340f41c20"/>
+ <dataarea name="rom" size="0x4000">
+ <rom name="pac-man plus.bin" size="0x4000" crc="e2dc056e" sha1="7dd18c8c7e82c813531f80ef2fe981c340f41c20"/>
</dataarea>
</part>
</software>
@@ -1908,8 +1918,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="16384">
- <rom name="pac-pollux.bin" size="16384" crc="1b3dd167" sha1="2f079cd0fb6d92fd5261fe567ae0a6407a722f44"/>
+ <dataarea name="rom" size="0x4000">
+ <rom name="pac-pollux.bin" size="0x4000" crc="1b3dd167" sha1="2f079cd0fb6d92fd5261fe567ae0a6407a722f44"/>
</dataarea>
</part>
</software>
@@ -1921,8 +1931,8 @@ almost nothing like the prototype.
<info name="serial" value="CX7891"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="65536">
- <rom name="pitfghtr.bin" size="65536" crc="a5e75537" sha1="378addef67aca55500f0f5f9f0075dcb177406b5"/>
+ <dataarea name="rom" size="0x10000">
+ <rom name="pitfghtr.bin" size="0x10000" crc="a5e75537" sha1="378addef67aca55500f0f5f9f0075dcb177406b5"/>
</dataarea>
</part>
</software>
@@ -1935,8 +1945,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="131072">
- <rom name="planetsm.bin" size="131072" crc="4e3b9e64" sha1="503b975fc1f8edc16110ac2c5b884c4e8b2b6efb"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="planetsm.bin" size="0x20000" crc="4e3b9e64" sha1="503b975fc1f8edc16110ac2c5b884c4e8b2b6efb"/>
</dataarea>
</part>
</software>
@@ -1949,8 +1959,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="131072">
- <rom name="planeteu.bin" size="131072" crc="95dc7e96" sha1="f12cbb576607ec38d6111f4346412ccc5bfbcf42"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="planeteu.bin" size="0x20000" crc="95dc7e96" sha1="f12cbb576607ec38d6111f4346412ccc5bfbcf42"/>
</dataarea>
</part>
</software>
@@ -1961,10 +1971,10 @@ almost nothing like the prototype.
<publisher>Tynesoft</publisher>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg_ram" />
- <dataarea name="rom" size="131072">
- <rom name="plutos.bin" size="131072" crc="2f211f7f" sha1="fa55d6a366b237917f18487fc51817394839a3bc"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="plutos.bin" size="0x20000" crc="2f211f7f" sha1="fa55d6a366b237917f18487fc51817394839a3bc"/>
</dataarea>
- <dataarea name="ram" size="16384">
+ <dataarea name="ram" size="0x4000">
</dataarea>
</part>
</software>
@@ -1974,11 +1984,12 @@ almost nothing like the prototype.
<year>1986</year>
<publisher>Atari / Namco</publisher>
<info name="serial" value="CX7808"/>
+ <info name="pcb" value="C024926-001 REV.B"/>
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="32768">
- <rom name="polepos2.bin" size="32768" crc="a85fb962" sha1="ccfa6f3f83ddbed2a2fb32735fea316a718fbaaa"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="c028408-38.u1" size="0x8000" crc="a85fb962" sha1="ccfa6f3f83ddbed2a2fb32735fea316a718fbaaa"/>
</dataarea>
</part>
</software>
@@ -1988,11 +1999,12 @@ almost nothing like the prototype.
<year>1987</year>
<publisher>Atari / Namco</publisher>
<info name="serial" value="CX7808"/>
+ <info name="pcb" value="C024926-001 REV.B"/>
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="32768">
- <rom name="pleps2eu.bin" size="32768" crc="d751c7a6" sha1="268e53b5b2117bf853e0aae6adb0b2d3aad8ad5c"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="pleps2eu.bin" size="0x8000" crc="d751c7a6" sha1="268e53b5b2117bf853e0aae6adb0b2d3aad8ad5c"/>
</dataarea>
</part>
</software>
@@ -2005,7 +2017,7 @@ almost nothing like the prototype.
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
<dataarea name="rom" size="0x8000">
- <rom name="ppii lo.u2" size="0x4000" crc="ba6d7560" sha1="ae00f45eefd37d39ac26092b2a2c82d252714582" offset="0x0000"/>
+ <rom name="ppii lo.u2" size="0x4000" crc="ba6d7560" sha1="ae00f45eefd37d39ac26092b2a2c82d252714582" offset="0"/>
<rom name="pole position ii hi.u1" size="0x4000" crc="547b7906" sha1="f7122f917a37d176960e81bdb0d68e8877cfa5e6" offset="0x4000"/>
</dataarea>
</part>
@@ -2020,7 +2032,7 @@ almost nothing like the prototype.
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_act" />
<dataarea name="rom" size="0x20000">
- <rom name="rampage.bin" size="0x20000" crc="d2876ee2" sha1="17401f85fe8b453a6b43b3d0035d993b90568efc"/>
+ <rom name="dei-364nr-rmpgda1_(c)_ncr_a8928_609-2936005.u1" size="0x20000" crc="d2876ee2" sha1="17401f85fe8b453a6b43b3d0035d993b90568efc"/>
</dataarea>
</part>
</software>
@@ -2033,8 +2045,8 @@ almost nothing like the prototype.
<info name="serial" value="CX7892"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="131072">
- <rom name="rampart.bin" size="131072" crc="e8c2a662" sha1="53516794cb442208af5d54760324c006510553b3"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="rampart.bin" size="0x20000" crc="e8c2a662" sha1="53516794cb442208af5d54760324c006510553b3"/>
</dataarea>
</part>
</software>
@@ -2048,10 +2060,10 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_mram" />
- <dataarea name="rom" size="32768">
- <rom name="rescuefr.bin" size="32768" crc="9a74fbf2" sha1="6653022f38e553d475896a918850158eaf8f77ff"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="rescuefr.bin" size="0x8000" crc="9a74fbf2" sha1="6653022f38e553d475896a918850158eaf8f77ff"/>
</dataarea>
- <dataarea name="ram" size="16384">
+ <dataarea name="ram" size="0x4000">
</dataarea>
</part>
</software>
@@ -2092,8 +2104,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="32768">
- <rom name="robotron.bin" size="32768" crc="cb22305d" sha1="ccc9753cdcbd2a2f8cb7966b8227801ba0bfd41d"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="robotron.bin" size="0x8000" crc="cb22305d" sha1="ccc9753cdcbd2a2f8cb7966b8227801ba0bfd41d"/>
</dataarea>
</part>
</software>
@@ -2106,8 +2118,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="65536">
- <rom name="rsbsebll.bin" size="65536" crc="b1508030" sha1="9a9f60251d049630099f56d2d3efb013828b8a2c"/>
+ <dataarea name="rom" size="0x10000">
+ <rom name="rsbsebll.bin" size="0x10000" crc="b1508030" sha1="9a9f60251d049630099f56d2d3efb013828b8a2c"/>
</dataarea>
</part>
</software>
@@ -2120,8 +2132,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="49152">
- <rom name="santa simon.bin" size="49152" crc="30d641ff" sha1="610e08f226c66b15ff699b02c736ce5ce7a8a862"/>
+ <dataarea name="rom" size="0xc000">
+ <rom name="santa simon.bin" size="0xc000" crc="30d641ff" sha1="610e08f226c66b15ff699b02c736ce5ce7a8a862"/>
</dataarea>
</part>
</software>
@@ -2148,8 +2160,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="131072">
- <rom name="scrpyard.bin" size="131072" crc="5cc8c34f" sha1="f2249321d0cc296b9f9e516bbc5ecc9aab56ca22"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="scrpyard.bin" size="0x20000" crc="5cc8c34f" sha1="f2249321d0cc296b9f9e516bbc5ecc9aab56ca22"/>
</dataarea>
</part>
</software>
@@ -2162,8 +2174,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="131072">
- <rom name="scrpyrde.bin" size="131072" crc="46dd9662" sha1="ebfed67cfeebc6a558dbb087e4784e5e5258c2e1"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="scrpyrde.bin" size="0x20000" crc="46dd9662" sha1="ebfed67cfeebc6a558dbb087e4784e5e5258c2e1"/>
</dataarea>
</part>
</software>
@@ -2177,8 +2189,8 @@ almost nothing like the prototype.
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
<feature name="peripheral" value="lightgun" />
- <dataarea name="rom" size="131072">
- <rom name="sentinel.bin" size="131072" crc="2fddad78" sha1="bd7de03a28b168c992bcaa96539c2310f3bfe30c"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="sentinel.bin" size="0x20000" crc="2fddad78" sha1="bd7de03a28b168c992bcaa96539c2310f3bfe30c"/>
</dataarea>
</part>
</software>
@@ -2192,8 +2204,8 @@ almost nothing like the prototype.
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
<feature name="peripheral" value="lightgun" />
- <dataarea name="rom" size="131072">
- <rom name="sentineu.bin" size="131072" crc="47340df9" sha1="6d85a73a56d2f02ff439736eace86691aa613444"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="sentineu.bin" size="0x20000" crc="47340df9" sha1="6d85a73a56d2f02ff439736eace86691aa613444"/>
</dataarea>
</part>
</software>
@@ -2204,10 +2216,10 @@ almost nothing like the prototype.
<publisher>Tynesoft</publisher>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg_ram" />
- <dataarea name="rom" size="131072">
- <rom name="sirius.bin" size="131072" crc="65ae616e" sha1="cd9f6dea96f102262065d7472e73121b67f9e244"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="sirius.bin" size="0x20000" crc="65ae616e" sha1="cd9f6dea96f102262065d7472e73121b67f9e244"/>
</dataarea>
- <dataarea name="ram" size="16384">
+ <dataarea name="ram" size="0x4000">
</dataarea>
</part>
</software>
@@ -2219,8 +2231,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="32768">
- <rom name="space duel (ntsc).bin" size="32768" crc="ef2d2560" sha1="199d06cf7f54bb0a1fa328d3cff955f4bcf90450"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="space duel (ntsc).bin" size="0x8000" crc="ef2d2560" sha1="199d06cf7f54bb0a1fa328d3cff955f4bcf90450"/>
</dataarea>
</part>
</software>
@@ -2233,8 +2245,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="32768">
- <rom name="space duel (pal).bin" size="32768" crc="0e6a8443" sha1="03d3c7e6255fc6f1b8bbf6dc3ccdbaf51b7eabf7"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="space duel (pal).bin" size="0x8000" crc="0e6a8443" sha1="03d3c7e6255fc6f1b8bbf6dc3ccdbaf51b7eabf7"/>
</dataarea>
</part>
</software>
@@ -2247,8 +2259,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="16384">
- <rom name="spaceinvaders (ntsc).bin" size="16384" crc="9c3086eb" sha1="167c06a5d9364f3359bb531d5533f4ff49283d47"/>
+ <dataarea name="rom" size="0x4000">
+ <rom name="spaceinvaders (ntsc).bin" size="0x4000" crc="9c3086eb" sha1="167c06a5d9364f3359bb531d5533f4ff49283d47"/>
</dataarea>
</part>
</software>
@@ -2261,8 +2273,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="16384">
- <rom name="spaceinvaders (pal).bin" size="16384" crc="90d7aad3" sha1="0b17368b9f3328f41d29ca4f0d04ab25e1aad55e"/>
+ <dataarea name="rom" size="0x4000">
+ <rom name="spaceinvaders (pal).bin" size="0x4000" crc="90d7aad3" sha1="0b17368b9f3328f41d29ca4f0d04ab25e1aad55e"/>
</dataarea>
</part>
</software>
@@ -2275,8 +2287,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="32768">
- <rom name="xev78_signed.bin" size="32768" crc="67c8af57" sha1="f76f2a212747e06ac452da8dbeb0ad093b24d793"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="xev78_signed.bin" size="0x8000" crc="67c8af57" sha1="f76f2a212747e06ac452da8dbeb0ad093b24d793"/>
</dataarea>
</part>
</software>
@@ -2289,8 +2301,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="32768">
- <rom name="star wars 7800.bin" size="32768" crc="8678f1c0" sha1="9ac24aa0563be93d72bcf83c52a8acdbbfc63729"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="star wars 7800.bin" size="0x8000" crc="8678f1c0" sha1="9ac24aa0563be93d72bcf83c52a8acdbbfc63729"/>
</dataarea>
</part>
</software>
@@ -2303,10 +2315,10 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg_ram" />
- <dataarea name="rom" size="131072">
- <rom name="smmrgame.bin" size="131072" crc="65c6df3f" sha1="31d46b32a2aa8d5bd6028cff1f41037426b22409"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="smmrgame.bin" size="0x20000" crc="65c6df3f" sha1="31d46b32a2aa8d5bd6028cff1f41037426b22409"/>
</dataarea>
- <dataarea name="ram" size="16384">
+ <dataarea name="ram" size="0x4000">
</dataarea>
</part>
</software>
@@ -2319,8 +2331,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="49152">
- <rom name="suprhuey.bin" size="49152" crc="71846500" sha1="29aea9e90c446942001fd08d3c4c929f4ce048d7"/>
+ <dataarea name="rom" size="0xc000">
+ <rom name="suprhuey.bin" size="0xc000" crc="71846500" sha1="29aea9e90c446942001fd08d3c4c929f4ce048d7"/>
</dataarea>
</part>
</software>
@@ -2333,8 +2345,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="49152">
- <rom name="suprhueu.bin" size="49152" crc="6b27ea2c" sha1="469e03ee1e22ef0978c8095a38d662d34a413723"/>
+ <dataarea name="rom" size="0xc000">
+ <rom name="suprhueu.bin" size="0xc000" crc="6b27ea2c" sha1="469e03ee1e22ef0978c8095a38d662d34a413723"/>
</dataarea>
</part>
</software>
@@ -2375,8 +2387,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="32768">
- <rom name="sprskate.bin" size="32768" crc="13b68650" sha1="666d9383c112b66026898e6002b803801e269c51"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="sprskate.bin" size="0x8000" crc="13b68650" sha1="666d9383c112b66026898e6002b803801e269c51"/>
</dataarea>
</part>
</software>
@@ -2389,8 +2401,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="32768">
- <rom name="sprskaeu.bin" size="32768" crc="8f167ba9" sha1="fab349584af7b6b3f9b034af3034f43257e2c25f"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="sprskaeu.bin" size="0x8000" crc="8f167ba9" sha1="fab349584af7b6b3f9b034af3034f43257e2c25f"/>
</dataarea>
</part>
</software>
@@ -2403,8 +2415,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="65536">
- <rom name="tankcmnd.bin" size="65536" crc="db91b181" sha1="1d2975d754806416a25a821db6a9fe389bf5d946"/>
+ <dataarea name="rom" size="0x10000">
+ <rom name="tankcmnd.bin" size="0x10000" crc="db91b181" sha1="1d2975d754806416a25a821db6a9fe389bf5d946"/>
</dataarea>
</part>
</software>
@@ -2417,8 +2429,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="32768">
- <rom name="titlemat.bin" size="32768" crc="bc23c57b" sha1="80d11bcbb953ccd8bf3c3e64162711e7edb95090"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="titlemat.bin" size="0x8000" crc="bc23c57b" sha1="80d11bcbb953ccd8bf3c3e64162711e7edb95090"/>
</dataarea>
</part>
</software>
@@ -2431,8 +2443,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="32768">
- <rom name="titlemeu.bin" size="32768" crc="16b54d5b" sha1="7ab281c9b69692823b3b6b594856172363c507b5"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="titlemeu.bin" size="0x8000" crc="16b54d5b" sha1="7ab281c9b69692823b3b6b594856172363c507b5"/>
</dataarea>
</part>
</software>
@@ -2445,8 +2457,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="32768">
- <rom name="tomcat.bin" size="32768" crc="513cb9ee" sha1="80c615fb60d0004c1accde25e42759572e030928"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="tomcat.bin" size="0x8000" crc="513cb9ee" sha1="80c615fb60d0004c1accde25e42759572e030928"/>
</dataarea>
</part>
</software>
@@ -2459,8 +2471,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="32768">
- <rom name="tomcateu.bin" size="32768" crc="b01205bf" sha1="825381773593365b5ca7eeca968cca00879eee71"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="tomcateu.bin" size="0x8000" crc="b01205bf" sha1="825381773593365b5ca7eeca968cca00879eee71"/>
</dataarea>
</part>
</software>
@@ -2472,8 +2484,8 @@ almost nothing like the prototype.
<info name="serial" value="CX7823"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="131072">
- <rom name="tchdown.bin" size="131072" crc="aae12695" sha1="364bf0fef8a67f7e66761c76a3a6a0dd186f04aa"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="tchdown.bin" size="0x20000" crc="aae12695" sha1="364bf0fef8a67f7e66761c76a3a6a0dd186f04aa"/>
</dataarea>
</part>
</software>
@@ -2486,10 +2498,10 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg_ram" />
- <dataarea name="rom" size="65536">
- <rom name="twrtpllr.bin" size="65536" crc="4407ba04" sha1="53976013986e0ad3694ab9c021420b8172465de7"/>
+ <dataarea name="rom" size="0x10000">
+ <rom name="twrtpllr.bin" size="0x10000" crc="4407ba04" sha1="53976013986e0ad3694ab9c021420b8172465de7"/>
</dataarea>
- <dataarea name="ram" size="16384">
+ <dataarea name="ram" size="0x4000">
</dataarea>
</part>
</software>
@@ -2502,10 +2514,10 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg_ram" />
- <dataarea name="rom" size="65536">
- <rom name="twrtpleu.bin" size="65536" crc="0f87fd7b" sha1="56e1b795e80382edb376e4536d1dee539d4ac548"/>
+ <dataarea name="rom" size="0x10000">
+ <rom name="twrtpleu.bin" size="0x10000" crc="0f87fd7b" sha1="56e1b795e80382edb376e4536d1dee539d4ac548"/>
</dataarea>
- <dataarea name="ram" size="16384">
+ <dataarea name="ram" size="0x4000">
</dataarea>
</part>
</software>
@@ -2532,8 +2544,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="65536">
- <rom name="waterski.bin" size="65536" crc="930b30df" sha1="621c67c2228843405445222743ba3d7c1f04a3c4"/>
+ <dataarea name="rom" size="0x10000">
+ <rom name="waterski.bin" size="0x10000" crc="930b30df" sha1="621c67c2228843405445222743ba3d7c1f04a3c4"/>
</dataarea>
</part>
</software>
@@ -2546,10 +2558,10 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg_ram" />
- <dataarea name="rom" size="131072">
- <rom name="wingames.bin" size="131072" crc="8981b531" sha1="b3725d6f0834c68ac62ce13eb9eb0d01d1124e5e"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="wingames.bin" size="0x20000" crc="8981b531" sha1="b3725d6f0834c68ac62ce13eb9eb0d01d1124e5e"/>
</dataarea>
- <dataarea name="ram" size="16384">
+ <dataarea name="ram" size="0x4000">
</dataarea>
</part>
</software>
@@ -2557,7 +2569,7 @@ almost nothing like the prototype.
<!-- This version features a lot *LESS* sounds than the newer version:
e.g. no sound in bobsled ans ski jump games!
Dump is confirmed from multiple carts, and it was probably used in
- some erlier production run, until they found out the mistake and
+ some earlier production run, until they found out the mistake and
replaced it with the complete version -->
<software name="wingameso" cloneof="wingames">
<description>Winter Games (NTSC, older?)</description>
@@ -2567,10 +2579,10 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg_ram" />
- <dataarea name="rom" size="131072">
- <rom name="wingameso.bin" size="131072" crc="cf648e88" sha1="361501982f4795c2d79fb6519e5c56452ebc5774"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="wingameso.bin" size="0x20000" crc="cf648e88" sha1="361501982f4795c2d79fb6519e5c56452ebc5774"/>
</dataarea>
- <dataarea name="ram" size="16384">
+ <dataarea name="ram" size="0x4000">
</dataarea>
</part>
</software>
@@ -2596,8 +2608,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="131072">
- <rom name="xnophobe.bin" size="131072" crc="5fd9a141" sha1="867adbfd7539ff81e68726ed6f5ff7326409539f"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="xnophobe.bin" size="0x20000" crc="5fd9a141" sha1="867adbfd7539ff81e68726ed6f5ff7326409539f"/>
</dataarea>
</part>
</software>
@@ -2610,8 +2622,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg" />
- <dataarea name="rom" size="131072">
- <rom name="xnophoeu.bin" size="131072" crc="cf0e44f1" sha1="b2cf7d6164d6e5acd47e9f6d7cf60bb0f775b4a3"/>
+ <dataarea name="rom" size="0x20000">
+ <rom name="xnophoeu.bin" size="0x20000" crc="cf0e44f1" sha1="b2cf7d6164d6e5acd47e9f6d7cf60bb0f775b4a3"/>
</dataarea>
</part>
</software>
@@ -2624,8 +2636,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="32768">
- <rom name="xevious.bin" size="32768" crc="75fc124f" sha1="1d4f0335b152239553534fcbbacdca273802e3bd"/>
+ <dataarea name="rom" size="0x8000">
+ <rom name="xevious.bin" size="0x8000" crc="75fc124f" sha1="1d4f0335b152239553534fcbbacdca273802e3bd"/>
</dataarea>
</part>
</software>
@@ -2638,7 +2650,7 @@ almost nothing like the prototype.
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
<dataarea name="rom" size="0x8000">
- <rom name="xevious 5-10 lo.u2" size="0x4000" crc="b154c59a" sha1="b94959e60e84c97dabc002f39f03c781376c35f7" offset="0x0000"/>
+ <rom name="xevious 5-10 lo.u2" size="0x4000" crc="b154c59a" sha1="b94959e60e84c97dabc002f39f03c781376c35f7" offset="0"/>
<rom name="xevious 5-10 hi.u1" size="0x4000" crc="9d3622b5" sha1="5cc9585f8c3f5dd0106990fde24883756868f437" offset="0x4000"/>
</dataarea>
</part>
@@ -2652,8 +2664,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_rom" />
- <dataarea name="rom" size="49152">
- <rom name="xevioeu.bin" size="49152" crc="d5ac738b" sha1="81647c8ce432f891328631b57dd3268dd315f8e8"/>
+ <dataarea name="rom" size="0xc000">
+ <rom name="xevioeu.bin" size="0xc000" crc="d5ac738b" sha1="81647c8ce432f891328631b57dd3268dd315f8e8"/>
</dataarea>
</part>
</software>
@@ -2667,10 +2679,10 @@ almost nothing like the prototype.
<info name="serial" value="CX78HSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_hsc" />
- <dataarea name="rom" size="4096">
- <rom name="highscre.bin" size="4096" crc="9be408d3" sha1="a3af676991391a6dd716c79022d4947206b78164"/>
+ <dataarea name="rom" size="0x1000">
+ <rom name="highscre.bin" size="0x1000" crc="9be408d3" sha1="a3af676991391a6dd716c79022d4947206b78164"/>
</dataarea>
- <dataarea name="nvram" size="2048">
+ <dataarea name="nvram" size="0x800">
</dataarea>
</part>
</software>
@@ -2682,10 +2694,10 @@ almost nothing like the prototype.
<publisher>&lt;homebrew&gt;</publisher>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_xboard" />
- <dataarea name="rom" size="1">
+ <dataarea name="rom" size="0x1">
<!-- this entry behaves just as passthrough, even if in fact the chips shall be socketed on the PCB! -->
</dataarea>
- <dataarea name="ram" size="131072">
+ <dataarea name="ram" size="0x20000">
</dataarea>
</part>
</software>
@@ -2697,12 +2709,12 @@ almost nothing like the prototype.
<publisher>&lt;homebrew&gt;</publisher>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_xm" />
- <dataarea name="rom" size="4096">
- <rom name="highscre.bin" size="4096" crc="9be408d3" sha1="a3af676991391a6dd716c79022d4947206b78164"/>
+ <dataarea name="rom" size="0x1000">
+ <rom name="highscre.bin" size="0x1000" crc="9be408d3" sha1="a3af676991391a6dd716c79022d4947206b78164"/>
</dataarea>
- <dataarea name="ram" size="131072">
+ <dataarea name="ram" size="0x20000">
</dataarea>
- <dataarea name="nvram" size="2048">
+ <dataarea name="nvram" size="0x800">
</dataarea>
</part>
</software>
@@ -2719,8 +2731,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg9" />
- <dataarea name="rom" size="147456">
- <rom name="dkxm_demo_v12_pal.bin" size="147456" crc="9f6c0600" sha1="18409eace880dda3646792f9ec050a87a3b1b382"/>
+ <dataarea name="rom" size="0x24000">
+ <rom name="dkxm_demo_v12_pal.bin" size="0x24000" crc="9f6c0600" sha1="18409eace880dda3646792f9ec050a87a3b1b382"/>
</dataarea>
</part>
</software>
@@ -2733,8 +2745,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg9" />
- <dataarea name="rom" size="147456">
- <rom name="dkxm_demo_v12_ntsc.bin" size="147456" crc="8b06bb4b" sha1="3129cbc91dc8f223f00db5c3273a4a330320be99"/>
+ <dataarea name="rom" size="0x24000">
+ <rom name="dkxm_demo_v12_ntsc.bin" size="0x24000" crc="8b06bb4b" sha1="3129cbc91dc8f223f00db5c3273a4a330320be99"/>
</dataarea>
</part>
</software>
@@ -2750,8 +2762,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg9" />
- <dataarea name="rom" size="147456">
- <rom name="dkxm_final_demo_pal_hsc.bin" size="147456" crc="6510b674" sha1="65b723b470d287af51e9888813149c43fb11ac26"/>
+ <dataarea name="rom" size="0x24000">
+ <rom name="dkxm_final_demo_pal_hsc.bin" size="0x24000" crc="6510b674" sha1="65b723b470d287af51e9888813149c43fb11ac26"/>
</dataarea>
</part>
</software>
@@ -2764,8 +2776,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg9" />
- <dataarea name="rom" size="147456">
- <rom name="dkxm_final_demo_ntsc_hsc.bin" size="147456" crc="2c67fea7" sha1="7825c1946e3c7492fa9bbfae33029cd68c0d1135"/>
+ <dataarea name="rom" size="0x24000">
+ <rom name="dkxm_final_demo_ntsc_hsc.bin" size="0x24000" crc="2c67fea7" sha1="7825c1946e3c7492fa9bbfae33029cd68c0d1135"/>
</dataarea>
</part>
</software>
@@ -2781,8 +2793,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg9" />
- <dataarea name="rom" size="147456">
- <rom name="dkxm_final_demo_pal.bin" size="147456" crc="d362712e" sha1="118c462d6698bd23c378785f80062fdd7d65ca00"/>
+ <dataarea name="rom" size="0x24000">
+ <rom name="dkxm_final_demo_pal.bin" size="0x24000" crc="d362712e" sha1="118c462d6698bd23c378785f80062fdd7d65ca00"/>
</dataarea>
</part>
</software>
@@ -2795,8 +2807,8 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg9" />
- <dataarea name="rom" size="147456">
- <rom name="dkxm_final_demo_ntsc.bin" size="147456" crc="6e170055" sha1="f4da231312da06ff9e8af5681b5013b14886b455"/>
+ <dataarea name="rom" size="0x24000">
+ <rom name="dkxm_final_demo_ntsc.bin" size="0x24000" crc="6e170055" sha1="f4da231312da06ff9e8af5681b5013b14886b455"/>
</dataarea>
</part>
</software>
@@ -2809,9 +2821,9 @@ almost nothing like the prototype.
<info name="programmer" value="TEP392" />
<part name="cart" interface="a7800_cart">
<feature name="slot" value="a78_sg9" />
- <dataarea name="rom" size="147456">
+ <dataarea name="rom" size="0x24000">
<rom name="dkxm_final_demo.bin" size="0x20000" crc="fd503bd4" sha1="454d754a0c4603323e476d9418f343a6a1a0d017" offset="0x4000" />
- <rom size="0x4000" offset="0x0000" loadflag="continue" />
+ <rom size="0x4000" offset="0" loadflag="continue" />
</dataarea>
</part>
</software>
diff --git a/makefile b/makefile
index 78351e7896d..13b7b535989 100644
--- a/makefile
+++ b/makefile
@@ -34,6 +34,7 @@
# NO_USE_MIDI = 1
# NO_USE_PORTAUDIO = 1
# NO_USE_PULSEAUDIO = 1
+# NO_USE_PIPEWIRE = 1
# USE_TAPTUN = 1
# USE_PCAP = 1
# USE_QTDEBUG = 1
@@ -734,6 +735,10 @@ ifdef NO_USE_PULSEAUDIO
PARAMS += --NO_USE_PULSEAUDIO='$(NO_USE_PULSEAUDIO)'
endif
+ifdef NO_USE_PIPEWIRE
+PARAMS += --NO_USE_PIPEWIRE='$(NO_USE_PIPEWIRE)'
+endif
+
ifdef USE_QTDEBUG
PARAMS += --USE_QTDEBUG='$(USE_QTDEBUG)'
endif
diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua
index 7a7cd4f25c2..e5fc0680d78 100644
--- a/scripts/src/bus.lua
+++ b/scripts/src/bus.lua
@@ -5859,3 +5859,17 @@ if (BUSES["AMIGA_CPUSLOT"]~=null) then
MAME_DIR .. "src/devices/bus/amiga/cpuslot/megamix500.h",
}
end
+
+---------------------------------------------------
+--
+--@src/devices/bus/st/stcart.h,BUSES["STCART_CONNECTOR"] = true
+---------------------------------------------------
+
+if (BUSES["STCART_CONNECTOR"]~=null) then
+ files {
+ MAME_DIR .. "src/devices/bus/st/stcart.cpp",
+ MAME_DIR .. "src/devices/bus/st/stcart.h",
+ MAME_DIR .. "src/devices/bus/st/replay.cpp",
+ MAME_DIR .. "src/devices/bus/st/replay.h",
+ }
+end
diff --git a/scripts/src/emu.lua b/scripts/src/emu.lua
index 07ec7180412..b73d2cc61a6 100644
--- a/scripts/src/emu.lua
+++ b/scripts/src/emu.lua
@@ -194,6 +194,8 @@ files {
MAME_DIR .. "src/emu/rendlay.h",
MAME_DIR .. "src/emu/rendutil.cpp",
MAME_DIR .. "src/emu/rendutil.h",
+ MAME_DIR .. "src/emu/resampler.cpp",
+ MAME_DIR .. "src/emu/resampler.h",
MAME_DIR .. "src/emu/romload.cpp",
MAME_DIR .. "src/emu/romload.h",
MAME_DIR .. "src/emu/romentry.h",
@@ -272,6 +274,16 @@ files {
MAME_DIR .. "src/emu/video/rgbsse.h",
MAME_DIR .. "src/emu/video/rgbvmx.cpp",
MAME_DIR .. "src/emu/video/rgbvmx.h",
+ MAME_DIR .. "src/emu/audio_effects/aeffect.h",
+ MAME_DIR .. "src/emu/audio_effects/aeffect.cpp",
+ MAME_DIR .. "src/emu/audio_effects/filter.h",
+ MAME_DIR .. "src/emu/audio_effects/filter.cpp",
+ MAME_DIR .. "src/emu/audio_effects/compressor.h",
+ MAME_DIR .. "src/emu/audio_effects/compressor.cpp",
+ MAME_DIR .. "src/emu/audio_effects/reverb.h",
+ MAME_DIR .. "src/emu/audio_effects/reverb.cpp",
+ MAME_DIR .. "src/emu/audio_effects/eq.h",
+ MAME_DIR .. "src/emu/audio_effects/eq.cpp",
}
pchsource(MAME_DIR .. "src/emu/main.cpp")
diff --git a/scripts/src/mame/frontend.lua b/scripts/src/mame/frontend.lua
index 7e1653a10fa..749b46a3679 100644
--- a/scripts/src/mame/frontend.lua
+++ b/scripts/src/mame/frontend.lua
@@ -89,6 +89,14 @@ files {
MAME_DIR .. "src/frontend/mame/ui/about.h",
MAME_DIR .. "src/frontend/mame/ui/analogipt.cpp",
MAME_DIR .. "src/frontend/mame/ui/analogipt.cpp",
+ MAME_DIR .. "src/frontend/mame/ui/audioeffects.cpp",
+ MAME_DIR .. "src/frontend/mame/ui/audioeffects.h",
+ MAME_DIR .. "src/frontend/mame/ui/audiomix.cpp",
+ MAME_DIR .. "src/frontend/mame/ui/audiomix.h",
+ MAME_DIR .. "src/frontend/mame/ui/audio_effect_eq.cpp",
+ MAME_DIR .. "src/frontend/mame/ui/audio_effect_eq.h",
+ MAME_DIR .. "src/frontend/mame/ui/audio_effect_filter.cpp",
+ MAME_DIR .. "src/frontend/mame/ui/audio_effect_filter.h",
MAME_DIR .. "src/frontend/mame/ui/auditmenu.cpp",
MAME_DIR .. "src/frontend/mame/ui/auditmenu.h",
MAME_DIR .. "src/frontend/mame/ui/barcode.cpp",
diff --git a/scripts/src/osd/modules.lua b/scripts/src/osd/modules.lua
index ca49a2682ca..b532124302f 100644
--- a/scripts/src/osd/modules.lua
+++ b/scripts/src/osd/modules.lua
@@ -52,6 +52,7 @@ function osdmodulesbuild()
files {
MAME_DIR .. "src/osd/watchdog.cpp",
MAME_DIR .. "src/osd/watchdog.h",
+ MAME_DIR .. "src/osd/interface/audio.h",
MAME_DIR .. "src/osd/interface/inputcode.h",
MAME_DIR .. "src/osd/interface/inputdev.h",
MAME_DIR .. "src/osd/interface/inputfwd.h",
@@ -134,7 +135,9 @@ function osdmodulesbuild()
MAME_DIR .. "src/osd/modules/sound/none.cpp",
MAME_DIR .. "src/osd/modules/sound/pa_sound.cpp",
MAME_DIR .. "src/osd/modules/sound/pulse_sound.cpp",
+ MAME_DIR .. "src/osd/modules/sound/pipewire_sound.cpp",
MAME_DIR .. "src/osd/modules/sound/sdl_sound.cpp",
+ MAME_DIR .. "src/osd/modules/sound/sound_module.cpp",
MAME_DIR .. "src/osd/modules/sound/sound_module.h",
MAME_DIR .. "src/osd/modules/sound/xaudio2_sound.cpp",
}
@@ -302,6 +305,22 @@ function osdmodulesbuild()
}
end
+ err = os.execute(pkgconfigcmd() .. " --exists libpipewire-0.3")
+ if not err then
+ _OPTIONS["NO_USE_PIPEWIRE"] = "1"
+ end
+
+ if _OPTIONS["NO_USE_PIPEWIRE"]=="1" then
+ defines {
+ "NO_USE_PIPEWIRE",
+ }
+ else
+ buildoptions {
+ backtick(pkgconfigcmd() .. " --cflags libpipewire-0.3"),
+ }
+ end
+
+
if _OPTIONS["NO_USE_MIDI"]=="1" then
defines {
"NO_USE_MIDI",
@@ -564,6 +583,12 @@ function osdmodulestargetconf()
ext_lib("pulse"),
}
end
+
+ if _OPTIONS["NO_USE_PIPEWIRE"]=="0" then
+ local str = backtick(pkgconfigcmd() .. " --libs libpipewire-0.3")
+ addlibfromstring(str)
+ addoptionsfromstring(str)
+ end
end
@@ -667,6 +692,23 @@ if not _OPTIONS["NO_USE_PULSEAUDIO"] then
end
newoption {
+ trigger = "NO_USE_PIPEWIRE",
+ description = "Disable Pipewire interface",
+ allowed = {
+ { "0", "Enable Pipewire" },
+ { "1", "Disable Pipewire" },
+ },
+}
+
+if not _OPTIONS["NO_USE_PIPEWIRE"] then
+ if _OPTIONS["targetos"]=="linux" then
+ _OPTIONS["NO_USE_PIPEWIRE"] = "0"
+ else
+ _OPTIONS["NO_USE_PIPEWIRE"] = "1"
+ end
+end
+
+newoption {
trigger = "MODERN_WIN_API",
description = "Use Modern Windows APIs",
allowed = {
diff --git a/scripts/src/sound.lua b/scripts/src/sound.lua
index 53d5d6b7925..32c0d366a60 100644
--- a/scripts/src/sound.lua
+++ b/scripts/src/sound.lua
@@ -1811,3 +1811,15 @@ if (SOUNDS["MMC5"]~=null) then
MAME_DIR .. "src/devices/sound/mmc5.h",
}
end
+
+---------------------------------------------------
+-- ADCs
+--@src/devices/sound/adc.h,SOUNDS["ADC"] = true
+---------------------------------------------------
+
+if (SOUNDS["ADC"]~=null) then
+ files {
+ MAME_DIR .. "src/devices/sound/adc.cpp",
+ MAME_DIR .. "src/devices/sound/adc.h",
+ }
+end
diff --git a/src/devices/bus/a2bus/a2mcms.cpp b/src/devices/bus/a2bus/a2mcms.cpp
index 3455fa3d8fc..7ccf96376fa 100644
--- a/src/devices/bus/a2bus/a2mcms.cpp
+++ b/src/devices/bus/a2bus/a2mcms.cpp
@@ -249,19 +249,16 @@ TIMER_CALLBACK_MEMBER(mcms_device::clr_irq_tick)
m_write_irq(CLEAR_LINE);
}
-void mcms_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void mcms_device::sound_stream_update(sound_stream &stream)
{
int i, v;
uint16_t wptr;
int8_t sample;
int32_t mixL, mixR;
- auto &outL = outputs[1];
- auto &outR = outputs[0];
-
if (m_enabled)
{
- for (i = 0; i < outL.samples(); i++)
+ for (i = 0; i < stream.samples(); i++)
{
mixL = mixR = 0;
@@ -282,15 +279,10 @@ void mcms_device::sound_stream_update(sound_stream &stream, std::vector<read_str
}
}
- outL.put_int(i, mixL * m_mastervol, 32768 << 9);
- outR.put_int(i, mixR * m_mastervol, 32768 << 9);
+ stream.put_int(0, i, mixL * m_mastervol, 32768 << 9);
+ stream.put_int(1, i, mixR * m_mastervol, 32768 << 9);
}
}
- else
- {
- outL.fill(0);
- outR.fill(0);
- }
}
void mcms_device::voiceregs_w(offs_t offset, uint8_t data)
diff --git a/src/devices/bus/a2bus/a2mcms.h b/src/devices/bus/a2bus/a2mcms.h
index e05ad64f18e..0f8cd2e72fb 100644
--- a/src/devices/bus/a2bus/a2mcms.h
+++ b/src/devices/bus/a2bus/a2mcms.h
@@ -41,7 +41,7 @@ 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;
TIMER_CALLBACK_MEMBER(set_irq_tick);
TIMER_CALLBACK_MEMBER(clr_irq_tick);
diff --git a/src/devices/bus/a2bus/a2mockingboard.cpp b/src/devices/bus/a2bus/a2mockingboard.cpp
index f002e129136..dbe2463a4a8 100644
--- a/src/devices/bus/a2bus/a2mockingboard.cpp
+++ b/src/devices/bus/a2bus/a2mockingboard.cpp
@@ -154,14 +154,13 @@ void a2bus_ayboard_device::single_via_devices(machine_config &config)
m_via1->writepb_handler().set(FUNC(a2bus_ayboard_device::via1_out_b));
m_via1->irq_handler().set(FUNC(a2bus_ayboard_device::via1_irq_w));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
AY8913(config, m_ay1, 1022727);
- m_ay1->add_route(ALL_OUTPUTS, "lspeaker", 0.5);
+ m_ay1->add_route(ALL_OUTPUTS, "speaker", 0.5, 0);
AY8913(config, m_ay2, 1022727);
- m_ay2->add_route(ALL_OUTPUTS, "rspeaker", 0.5);
+ m_ay2->add_route(ALL_OUTPUTS, "speaker", 0.5, 1);
}
void a2bus_ayboard_device::device_add_mconfig(machine_config &config)
@@ -184,8 +183,8 @@ void a2bus_mockingboard_device::device_add_mconfig(machine_config &config)
VOTRAX_SC01A(config, m_sc01, 1022727);
m_sc01->ar_callback().set(m_via1, FUNC(via6522_device::write_cb1));
- m_sc01->add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- m_sc01->add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ m_sc01->add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ m_sc01->add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
}
void a2bus_phasor_device::device_add_mconfig(machine_config &config)
@@ -195,16 +194,15 @@ void a2bus_phasor_device::device_add_mconfig(machine_config &config)
m_via1->writepb_handler().set(FUNC(a2bus_phasor_device::via1_out_b));
m_via2->writepb_handler().set(FUNC(a2bus_phasor_device::via2_out_b));
- SPEAKER(config, "lspeaker2").front_left();
- SPEAKER(config, "rspeaker2").front_right();
+ SPEAKER(config, "speaker2", 2).front();
- m_ay2->reset_routes().add_route(ALL_OUTPUTS, "lspeaker2", 0.5);
+ m_ay2->reset_routes().add_route(ALL_OUTPUTS, "speaker2", 0.5, 0);
AY8913(config, m_ay3, 1022727);
- m_ay3->add_route(ALL_OUTPUTS, "rspeaker", 0.5);
+ m_ay3->add_route(ALL_OUTPUTS, "speaker", 0.5, 1);
AY8913(config, m_ay4, 1022727);
- m_ay4->add_route(ALL_OUTPUTS, "rspeaker2", 0.5);
+ m_ay4->add_route(ALL_OUTPUTS, "speaker2", 0.5, 1);
}
void a2bus_echoplus_device::device_add_mconfig(machine_config &config)
diff --git a/src/devices/bus/a2bus/a2scsi.cpp b/src/devices/bus/a2bus/a2scsi.cpp
index cebfbd31565..53aff96effa 100644
--- a/src/devices/bus/a2bus/a2scsi.cpp
+++ b/src/devices/bus/a2bus/a2scsi.cpp
@@ -68,16 +68,15 @@ void a2bus_scsi_device::device_add_mconfig(machine_config &config)
{
// These machines were strictly external CD-ROMs so sound didn't route back into them; the AppleCD SC had
// RCA jacks for connection to speakers/a stereo.
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
NSCSI_BUS(config, m_scsibus);
NSCSI_CONNECTOR(config, "scsibus:0", default_scsi_devices, nullptr, false);
NSCSI_CONNECTOR(config, "scsibus:1").option_set("cdrom", NSCSI_CDROM_APPLE).machine_config(
[](device_t *device)
{
- device->subdevice<cdda_device>("cdda")->add_route(0, "^^lspeaker", 1.0);
- device->subdevice<cdda_device>("cdda")->add_route(1, "^^rspeaker", 1.0);
+ device->subdevice<cdda_device>("cdda")->add_route(0, "^^speaker", 1.0, 0);
+ device->subdevice<cdda_device>("cdda")->add_route(1, "^^speaker", 1.0, 1);
});
NSCSI_CONNECTOR(config, "scsibus:2", default_scsi_devices, nullptr, false);
NSCSI_CONNECTOR(config, "scsibus:3", default_scsi_devices, nullptr, false);
diff --git a/src/devices/bus/amiga/cpuslot/a570.cpp b/src/devices/bus/amiga/cpuslot/a570.cpp
index 4e134004580..abd42370380 100644
--- a/src/devices/bus/amiga/cpuslot/a570.cpp
+++ b/src/devices/bus/amiga/cpuslot/a570.cpp
@@ -120,8 +120,8 @@ void a570_device::device_add_mconfig(machine_config &config)
m_tpi->out_pb_cb().set(FUNC(a570_device::tpi_portb_w));
CR511B(config, m_drive, 0);
- m_drive->add_route(0, "lspeaker", 1.0);
- m_drive->add_route(1, "rspeaker", 1.0);
+ m_drive->add_route(0, "speaker", 1.0, 0);
+ m_drive->add_route(1, "speaker", 1.0, 1);
m_drive->scor_cb().set(m_tpi, FUNC(tpi6525_device::i1_w)).invert();
m_drive->stch_cb().set(m_tpi, FUNC(tpi6525_device::i2_w)).invert();
m_drive->sten_cb().set(m_tpi, FUNC(tpi6525_device::i3_w));
@@ -129,8 +129,7 @@ void a570_device::device_add_mconfig(machine_config &config)
m_drive->drq_cb().set(m_tpi, FUNC(tpi6525_device::i4_w));
m_drive->drq_cb().append(FUNC(a570_device::drq_w));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
// TODO: Add stereo input for Amiga sound
}
diff --git a/src/devices/bus/bbc/1mhzbus/m5000.cpp b/src/devices/bus/bbc/1mhzbus/m5000.cpp
index ae3fd948969..758e3311491 100644
--- a/src/devices/bus/bbc/1mhzbus/m5000.cpp
+++ b/src/devices/bus/bbc/1mhzbus/m5000.cpp
@@ -63,12 +63,11 @@ DEFINE_DEVICE_TYPE(BBC_M87, bbc_m87_device, "bbc_m87", "Peartree Music 87
void bbc_m500_device::add_common_devices(machine_config &config)
{
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
HTMUSIC(config, m_hybrid, 12_MHz_XTAL / 2);
- m_hybrid->add_route(0, "lspeaker", 1.0);
- m_hybrid->add_route(1, "rspeaker", 1.0);
+ m_hybrid->add_route(0, "speaker", 1.0, 0);
+ m_hybrid->add_route(1, "speaker", 1.0, 1);
BBC_1MHZBUS_SLOT(config, m_1mhzbus, DERIVED_CLOCK(1, 1), bbc_1mhzbus_devices, nullptr);
m_1mhzbus->irq_handler().set(DEVICE_SELF_OWNER, FUNC(bbc_1mhzbus_slot_device::irq_w));
@@ -417,19 +416,15 @@ TIMER_CALLBACK_MEMBER(htmusic_device::dsp_tick)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void htmusic_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void htmusic_device::sound_stream_update(sound_stream &stream)
{
- // reset the output streams
- outputs[0].fill(0);
- outputs[1].fill(0);
-
// iterate over channels and accumulate sample data
for (int channel = 0; channel < 16; channel++)
{
- for (int sampindex = 0; sampindex < outputs[0].samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
- outputs[0].add_int(sampindex, m_sam_l[channel], 8031 * 16);
- outputs[1].add_int(sampindex, m_sam_r[channel], 8031 * 16);
+ stream.add_int(0, sampindex, m_sam_l[channel], 8031 * 16);
+ stream.add_int(1, sampindex, m_sam_r[channel], 8031 * 16);
}
}
}
diff --git a/src/devices/bus/bbc/1mhzbus/m5000.h b/src/devices/bus/bbc/1mhzbus/m5000.h
index 02b99fd12e3..44704a2b492 100644
--- a/src/devices/bus/bbc/1mhzbus/m5000.h
+++ b/src/devices/bus/bbc/1mhzbus/m5000.h
@@ -47,7 +47,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;
TIMER_CALLBACK_MEMBER(dsp_tick);
diff --git a/src/devices/bus/cbus/pc9801_118.cpp b/src/devices/bus/cbus/pc9801_118.cpp
index 5d3dc64d939..7a64ddbad17 100644
--- a/src/devices/bus/cbus/pc9801_118.cpp
+++ b/src/devices/bus/cbus/pc9801_118.cpp
@@ -45,8 +45,7 @@ void pc9801_118_device::device_add_mconfig(machine_config &config)
// TODO: "ANCHOR" & "MAZE" custom NEC chips
// sourced by 5D clock
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
// actually YMF297-F (YMF288 + OPL3 compatible FM sources), unknown clock / divider
// 5B is near both CS-4232 and this
@@ -54,8 +53,8 @@ void pc9801_118_device::device_add_mconfig(machine_config &config)
m_opn3->irq_handler().set([this] (int state) { m_bus->int_w<5>(state); });
// m_opn3->port_a_read_callback().set(FUNC(pc9801_118_device::opn_porta_r));
// m_opn3->port_b_write_callback().set(FUNC(pc9801_118_device::opn_portb_w));
- m_opn3->add_route(ALL_OUTPUTS, "lspeaker", 1.00);
- m_opn3->add_route(ALL_OUTPUTS, "rspeaker", 1.00);
+ m_opn3->add_route(ALL_OUTPUTS, "speaker", 1.00, 0);
+ m_opn3->add_route(ALL_OUTPUTS, "speaker", 1.00, 1);
// TODO: DA-15 PC gameport labeled "MIDI / Joystick"
}
diff --git a/src/devices/bus/cbus/pc9801_86.cpp b/src/devices/bus/cbus/pc9801_86.cpp
index 9106e22887b..16012f791ba 100644
--- a/src/devices/bus/cbus/pc9801_86.cpp
+++ b/src/devices/bus/cbus/pc9801_86.cpp
@@ -84,8 +84,7 @@ void pc9801_86_device::pc9801_86_config(machine_config &config)
INPUT_MERGER_ANY_HIGH(config, m_irqs).output_handler().set([this](int state) { m_bus->int_w<5>(state); });
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
YM2608(config, m_opna, 7.987_MHz_XTAL); // actually YM2608B
// shouldn't have one
// m_opna->set_addrmap(0, &pc9801_86_device::opna_map);
@@ -100,15 +99,16 @@ void pc9801_86_device::pc9801_86_config(machine_config &config)
m_joy_sel = data;
});
// TODO: confirm mixing
- m_opna->add_route(0, "lspeaker", 0.75);
- m_opna->add_route(0, "rspeaker", 0.75);
- m_opna->add_route(1, "lspeaker", 1.00);
- m_opna->add_route(2, "rspeaker", 1.00);
+ m_opna->add_route(0, "speaker", 0.75, 0);
+ m_opna->add_route(0, "speaker", 0.75, 1);
+ m_opna->add_route(1, "speaker", 1.00, 0);
+ m_opna->add_route(2, "speaker", 1.00, 1);
- DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_ldac, 0).add_route(ALL_OUTPUTS, "lspeaker", 1.0); // burr brown pcm61p
- DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_rdac, 0).add_route(ALL_OUTPUTS, "rspeaker", 1.0); // burr brown pcm61p
+ // 2x burr brown pcm61p
+ DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_ldac, 0).add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_rdac, 0).add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
- // NOTE: 1 DE-9 port only
+ // NOTE: 1x DE-9 port only
MSX_GENERAL_PURPOSE_PORT(config, m_joy, msx_general_purpose_port_devices, "joystick");
}
@@ -121,10 +121,10 @@ void pc9801_86_device::device_add_mconfig(machine_config &config)
void pc9801_86_device::opna_reset_routes_config(machine_config &config)
{
m_opna->reset_routes();
- m_opna->add_route(0, "lspeaker", 0.125);
- m_opna->add_route(0, "rspeaker", 0.125);
- m_opna->add_route(1, "lspeaker", 0.50);
- m_opna->add_route(2, "rspeaker", 0.50);
+ m_opna->add_route(0, "speaker", 0.125, 0);
+ m_opna->add_route(0, "speaker", 0.125, 1);
+ m_opna->add_route(1, "speaker", 0.50, 0);
+ m_opna->add_route(2, "speaker", 0.50, 1);
}
// to load a different bios for slots:
@@ -544,10 +544,10 @@ void pc9801_speakboard_device::device_add_mconfig(machine_config &config)
YM2608(config, m_opna_slave, 7.987_MHz_XTAL);
m_opna_slave->set_addrmap(0, &pc9801_speakboard_device::opna_map);
- m_opna_slave->add_route(0, "lspeaker", 0.50);
- m_opna_slave->add_route(0, "rspeaker", 0.50);
- m_opna_slave->add_route(1, "lspeaker", 0.50);
- m_opna_slave->add_route(2, "rspeaker", 0.50);
+ m_opna_slave->add_route(0, "speaker", 0.50, 0);
+ m_opna_slave->add_route(0, "speaker", 0.50, 1);
+ m_opna_slave->add_route(1, "speaker", 0.50, 0);
+ m_opna_slave->add_route(2, "speaker", 0.50, 1);
}
void pc9801_speakboard_device::device_start()
@@ -613,8 +613,8 @@ void otomichan_kai_device::device_add_mconfig(machine_config &config)
m_opna->set_addrmap(0, &otomichan_kai_device::opna_map);
YM3438(config, m_opn2c, 7.987_MHz_XTAL);
- m_opn2c->add_route(0, "lspeaker", 0.50);
- m_opn2c->add_route(1, "rspeaker", 0.50);
+ m_opn2c->add_route(0, "speaker", 0.50, 0);
+ m_opn2c->add_route(1, "speaker", 0.50, 1);
}
u8 otomichan_kai_device::id_r()
diff --git a/src/devices/bus/cbus/sb16_ct2720.cpp b/src/devices/bus/cbus/sb16_ct2720.cpp
index 3f77a83698c..cbe417c9960 100644
--- a/src/devices/bus/cbus/sb16_ct2720.cpp
+++ b/src/devices/bus/cbus/sb16_ct2720.cpp
@@ -39,15 +39,14 @@ sb16_ct2720_device::sb16_ct2720_device(const machine_config &mconfig, const char
void sb16_ct2720_device::device_add_mconfig(machine_config &config)
{
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
CT1745(config, m_mixer);
m_mixer->set_fm_tag(m_opl3);
m_mixer->set_ldac_tag(m_ldac);
m_mixer->set_rdac_tag(m_rdac);
- m_mixer->add_route(0, "lspeaker", 1.0);
- m_mixer->add_route(1, "rspeaker", 1.0);
+ m_mixer->add_route(0, "speaker", 1.0, 0);
+ m_mixer->add_route(1, "speaker", 1.0, 1);
m_mixer->irq_status_cb().set([this] () {
(void)this;
return 0;
@@ -59,14 +58,14 @@ void sb16_ct2720_device::device_add_mconfig(machine_config &config)
// MIDI_PORT(config, "mdin", midiin_slot, "midiin").rxd_handler().set(FUNC(sb_device::midi_rx_w));
// MIDI_PORT(config, "mdout", midiout_slot, "midiout");
- DAC_16BIT_R2R(config, m_ldac, 0).add_route(ALL_OUTPUTS, m_mixer, 0.5, AUTO_ALLOC_INPUT, 0); // unknown DAC
- DAC_16BIT_R2R(config, m_rdac, 0).add_route(ALL_OUTPUTS, m_mixer, 0.5, AUTO_ALLOC_INPUT, 1); // unknown DAC
+ DAC_16BIT_R2R(config, m_ldac, 0).add_route(ALL_OUTPUTS, m_mixer, 0.5, 0); // unknown DAC
+ DAC_16BIT_R2R(config, m_rdac, 0).add_route(ALL_OUTPUTS, m_mixer, 0.5, 1); // unknown DAC
YMF262(config, m_opl3, XTAL(14'318'181));
- m_opl3->add_route(0, m_mixer, 1.00, AUTO_ALLOC_INPUT, 0);
- m_opl3->add_route(1, m_mixer, 1.00, AUTO_ALLOC_INPUT, 1);
- m_opl3->add_route(2, m_mixer, 1.00, AUTO_ALLOC_INPUT, 0);
- m_opl3->add_route(3, m_mixer, 1.00, AUTO_ALLOC_INPUT, 1);
+ m_opl3->add_route(0, m_mixer, 1.00, 0);
+ m_opl3->add_route(1, m_mixer, 1.00, 1);
+ m_opl3->add_route(2, m_mixer, 1.00, 0);
+ m_opl3->add_route(3, m_mixer, 1.00, 1);
}
void sb16_ct2720_device::device_start()
diff --git a/src/devices/bus/centronics/covox.cpp b/src/devices/bus/centronics/covox.cpp
index 4b3521b5955..9989308f593 100644
--- a/src/devices/bus/centronics/covox.cpp
+++ b/src/devices/bus/centronics/covox.cpp
@@ -92,10 +92,9 @@ centronics_covox_stereo_device::centronics_covox_stereo_device(const machine_con
void centronics_covox_stereo_device::device_add_mconfig(machine_config &config)
{
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
- DAC_8BIT_R2R(config, m_ldac, 0).add_route(ALL_OUTPUTS, "lspeaker", 0.5); // unknown DAC
- DAC_8BIT_R2R(config, m_rdac, 0).add_route(ALL_OUTPUTS, "rspeaker", 0.5); // unknown DAC
+ SPEAKER(config, "speaker", 2).front();
+ DAC_8BIT_R2R(config, m_ldac, 0).add_route(ALL_OUTPUTS, "speaker", 0.5, 0); // unknown DAC
+ DAC_8BIT_R2R(config, m_rdac, 0).add_route(ALL_OUTPUTS, "speaker", 0.5, 1); // unknown DAC
}
void centronics_covox_stereo_device::device_start()
diff --git a/src/devices/bus/centronics/samdac.cpp b/src/devices/bus/centronics/samdac.cpp
index 46a7682f4ba..90afc8e8a7c 100644
--- a/src/devices/bus/centronics/samdac.cpp
+++ b/src/devices/bus/centronics/samdac.cpp
@@ -23,11 +23,10 @@ DEFINE_DEVICE_TYPE(CENTRONICS_SAMDAC, centronics_samdac_device, "centronics_samd
void centronics_samdac_device::device_add_mconfig(machine_config &config)
{
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- DAC_8BIT_R2R(config, m_dac[0], 0).add_route(ALL_OUTPUTS, "lspeaker", 0.5);
- DAC_8BIT_R2R(config, m_dac[1], 0).add_route(ALL_OUTPUTS, "rspeaker", 0.5);
+ DAC_8BIT_R2R(config, m_dac[0], 0).add_route(ALL_OUTPUTS, "speaker", 0.5, 0);
+ DAC_8BIT_R2R(config, m_dac[1], 0).add_route(ALL_OUTPUTS, "speaker", 0.5, 1);
}
diff --git a/src/devices/bus/coco/coco_orch90.cpp b/src/devices/bus/coco/coco_orch90.cpp
index 83595798916..33151fb5d73 100644
--- a/src/devices/bus/coco/coco_orch90.cpp
+++ b/src/devices/bus/coco/coco_orch90.cpp
@@ -116,10 +116,9 @@ namespace
void coco_orch90_device::device_add_mconfig(machine_config &config)
{
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
- DAC_8BIT_R2R(config, m_ldac, 0).add_route(ALL_OUTPUTS, "lspeaker", 0.5); // ls374.ic5 + r7 (8x20k) + r9 (8x10k)
- DAC_8BIT_R2R(config, m_rdac, 0).add_route(ALL_OUTPUTS, "rspeaker", 0.5); // ls374.ic4 + r6 (8x20k) + r8 (8x10k)
+ SPEAKER(config, "speaker", 2).front();
+ DAC_8BIT_R2R(config, m_ldac, 0).add_route(ALL_OUTPUTS, "speaker", 0.5, 0); // ls374.ic5 + r7 (8x20k) + r9 (8x10k)
+ DAC_8BIT_R2R(config, m_rdac, 0).add_route(ALL_OUTPUTS, "speaker", 0.5, 1); // ls374.ic4 + r6 (8x20k) + r8 (8x10k)
}
//-------------------------------------------------
diff --git a/src/devices/bus/coco/coco_ssc.cpp b/src/devices/bus/coco/coco_ssc.cpp
index 6f5ff8443a6..d6a0140d293 100644
--- a/src/devices/bus/coco/coco_ssc.cpp
+++ b/src/devices/bus/coco/coco_ssc.cpp
@@ -135,7 +135,7 @@ namespace
virtual void device_start() 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;
// Power of 2
static constexpr int BUFFER_SIZE = 4;
@@ -499,21 +499,18 @@ void cocossc_sac_device::device_start()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void cocossc_sac_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void cocossc_sac_device::sound_stream_update(sound_stream &stream)
{
- auto &src = inputs[0];
- auto &dst = outputs[0];
-
- int count = dst.samples();
+ int count = stream.samples();
m_rms[m_index] = 0;
if( count > 0 )
{
for( int sampindex = 0; sampindex < count; sampindex++ )
{
- auto source_sample = src.get(sampindex);
+ auto source_sample = stream.get(0, sampindex);
m_rms[m_index] += source_sample * source_sample;
- dst.put(sampindex, source_sample);
+ stream.put(0, sampindex, source_sample);
}
m_rms[m_index] = m_rms[m_index] / count;
diff --git a/src/devices/bus/coco/coco_stecomp.cpp b/src/devices/bus/coco/coco_stecomp.cpp
index 83477fd41fb..dc895555418 100644
--- a/src/devices/bus/coco/coco_stecomp.cpp
+++ b/src/devices/bus/coco/coco_stecomp.cpp
@@ -68,10 +68,9 @@ namespace
void coco_stereo_composer_device::device_add_mconfig(machine_config &config)
{
- SPEAKER(config, "sc_lspeaker").front_left();
- SPEAKER(config, "sc_rspeaker").front_right();
- DAC_8BIT_R2R(config, m_ldac).add_route(ALL_OUTPUTS, "sc_lspeaker", 0.5);
- DAC_8BIT_R2R(config, m_rdac).add_route(ALL_OUTPUTS, "sc_rspeaker", 0.5);
+ SPEAKER(config, "sc_speaker", 2).front();
+ DAC_8BIT_R2R(config, m_ldac).add_route(ALL_OUTPUTS, "sc_speaker", 0.5, 0);
+ DAC_8BIT_R2R(config, m_rdac).add_route(ALL_OUTPUTS, "sc_speaker", 0.5, 1);
pia6821_device &pia(PIA6821(config, "sc_pia"));
pia.writepa_handler().set("sc_ldac", FUNC(dac_byte_interface::data_w));
diff --git a/src/devices/bus/cpc/playcity.cpp b/src/devices/bus/cpc/playcity.cpp
index c6abaeed14e..a2429242f43 100644
--- a/src/devices/bus/cpc/playcity.cpp
+++ b/src/devices/bus/cpc/playcity.cpp
@@ -31,12 +31,11 @@ void cpc_playcity_device::device_add_mconfig(machine_config &config)
m_ctc->zc_callback<2>().set(m_ctc, FUNC(z80ctc_device::trg3));
m_ctc->intr_callback().set(FUNC(cpc_playcity_device::ctc_intr_cb));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
YMZ294(config, m_ymz1, DERIVED_CLOCK(1, 1)); // when timer is not set, operates at 4MHz (interally divided by 2, so equivalent to the ST)
- m_ymz1->add_route(ALL_OUTPUTS, "rspeaker", 0.30);
+ m_ymz1->add_route(ALL_OUTPUTS, "speaker", 0.30, 1);
YMZ294(config, m_ymz2, DERIVED_CLOCK(1, 1));
- m_ymz2->add_route(ALL_OUTPUTS, "lspeaker", 0.30);
+ m_ymz2->add_route(ALL_OUTPUTS, "speaker", 0.30, 0);
// pass-through
cpc_expansion_slot_device &exp(CPC_EXPANSION_SLOT(config, "exp", DERIVED_CLOCK(1, 1), cpc_exp_cards, nullptr));
diff --git a/src/devices/bus/isa/gblaster.cpp b/src/devices/bus/isa/gblaster.cpp
index 1cbd9458c04..3b6d66adb14 100644
--- a/src/devices/bus/isa/gblaster.cpp
+++ b/src/devices/bus/isa/gblaster.cpp
@@ -70,14 +70,13 @@ DEFINE_DEVICE_TYPE(ISA8_GAME_BLASTER, isa8_gblaster_device, "isa_gblaster", "Gam
void isa8_gblaster_device::device_add_mconfig(machine_config &config)
{
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
SAA1099(config, m_saa1099_1, XTAL(14'318'181) / 2); // or CMS-301, from OSC pin in ISA bus
- m_saa1099_1->add_route(0, "lspeaker", 0.50);
- m_saa1099_1->add_route(1, "rspeaker", 0.50);
+ m_saa1099_1->add_route(0, "speaker", 0.50, 0);
+ m_saa1099_1->add_route(1, "speaker", 0.50, 1);
SAA1099(config, m_saa1099_2, XTAL(14'318'181) / 2); // or CMS-301, from OSC pin in ISA bus
- m_saa1099_2->add_route(0, "lspeaker", 0.50);
- m_saa1099_2->add_route(1, "rspeaker", 0.50);
+ m_saa1099_2->add_route(0, "speaker", 0.50, 0);
+ m_saa1099_2->add_route(1, "speaker", 0.50, 1);
}
//**************************************************************************
diff --git a/src/devices/bus/isa/gus.cpp b/src/devices/bus/isa/gus.cpp
index 2017482fc96..3d9fd1c073f 100644
--- a/src/devices/bus/isa/gus.cpp
+++ b/src/devices/bus/isa/gus.cpp
@@ -242,26 +242,19 @@ TIMER_CALLBACK_MEMBER(gf1_device::dma_tick)
m_drq1_handler(1);
}
-void gf1_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void gf1_device::sound_stream_update(sound_stream &stream)
{
int x;
- //uint32_t count;
-
- auto &outputl = outputs[0];
- auto &outputr = outputs[1];
-
- outputl.fill(0);
- outputr.fill(0);
for(x=0;x<32;x++) // for each voice
{
uint16_t vol = (m_volume_table[(m_voice[x].current_vol & 0xfff0) >> 4]);
- for (int sampindex = 0; sampindex < outputl.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
uint32_t current = m_voice[x].current_addr >> 9;
// TODO: implement proper panning
- outputl.add_int(sampindex, m_voice[x].sample * vol, 32768 * 8192);
- outputr.add_int(sampindex, m_voice[x].sample * vol, 32768 * 8192);
+ stream.add_int(0, sampindex, m_voice[x].sample * vol, 32768 * 8192);
+ stream.add_int(1, sampindex, m_voice[x].sample * vol, 32768 * 8192);
if((!(m_voice[x].voice_ctrl & 0x40)) && (m_voice[x].current_addr >= m_voice[x].end_addr) && !m_voice[x].rollover && !(m_voice[x].voice_ctrl & 0x01))
{
if(m_voice[x].vol_ramp_ctrl & 0x04)
@@ -1238,11 +1231,10 @@ INPUT_PORTS_END
void isa16_gus_device::device_add_mconfig(machine_config &config)
{
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GGF1(config, m_gf1, GF1_CLOCK);
- m_gf1->add_route(0, "lspeaker", 0.50);
- m_gf1->add_route(1, "rspeaker", 0.50);
+ m_gf1->add_route(0, "speaker", 0.50, 0);
+ m_gf1->add_route(1, "speaker", 0.50, 1);
m_gf1->txd_handler().set("mdout", FUNC(midi_port_device::write_txd));
m_gf1->txirq_handler().set(FUNC(isa16_gus_device::midi_txirq));
diff --git a/src/devices/bus/isa/gus.h b/src/devices/bus/isa/gus.h
index cc86b2f088c..e58fea6c9fa 100644
--- a/src/devices/bus/isa/gus.h
+++ b/src/devices/bus/isa/gus.h
@@ -122,7 +122,7 @@ public:
void eop_w(int state);
// device_sound_interface 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;
protected:
// device-level overrides
diff --git a/src/devices/bus/isa/sb16.cpp b/src/devices/bus/isa/sb16.cpp
index 30d0a6f8950..b260edca7b9 100644
--- a/src/devices/bus/isa/sb16.cpp
+++ b/src/devices/bus/isa/sb16.cpp
@@ -434,27 +434,26 @@ void sb16_lle_device::device_add_mconfig(machine_config &config)
m_cpu->port_in_cb<2>().set(FUNC(sb16_lle_device::p2_r));
m_cpu->port_out_cb<2>().set(FUNC(sb16_lle_device::p2_w));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
CT1745(config, m_mixer);
m_mixer->set_fm_tag("ymf262");
m_mixer->set_ldac_tag(m_ldac);
m_mixer->set_rdac_tag(m_rdac);
- m_mixer->add_route(0, "lspeaker", 1.0);
- m_mixer->add_route(1, "rspeaker", 1.0);
+ m_mixer->add_route(0, "speaker", 1.0, 0);
+ m_mixer->add_route(1, "speaker", 1.0, 1);
m_mixer->irq_status_cb().set([this] () {
return (m_irq8 << 0) | (m_irq16 << 1) | (m_irq_midi << 2) | (0x8 << 4);
});
- DAC_16BIT_R2R(config, m_ldac, 0).add_route(ALL_OUTPUTS, m_mixer, 0.5, AUTO_ALLOC_INPUT, 0); // unknown DAC
- DAC_16BIT_R2R(config, m_rdac, 0).add_route(ALL_OUTPUTS, m_mixer, 0.5, AUTO_ALLOC_INPUT, 1); // unknown DAC
+ DAC_16BIT_R2R(config, m_ldac, 0).add_route(ALL_OUTPUTS, m_mixer, 0.5, 0); // unknown DAC
+ DAC_16BIT_R2R(config, m_rdac, 0).add_route(ALL_OUTPUTS, m_mixer, 0.5, 1); // unknown DAC
ymf262_device &ymf262(YMF262(config, "ymf262", XTAL(14'318'181)));
- ymf262.add_route(0, m_mixer, 1.00, AUTO_ALLOC_INPUT, 0);
- ymf262.add_route(1, m_mixer, 1.00, AUTO_ALLOC_INPUT, 1);
- ymf262.add_route(2, m_mixer, 1.00, AUTO_ALLOC_INPUT, 0);
- ymf262.add_route(3, m_mixer, 1.00, AUTO_ALLOC_INPUT, 1);
+ ymf262.add_route(0, m_mixer, 1.00, 0);
+ ymf262.add_route(1, m_mixer, 1.00, 1);
+ ymf262.add_route(2, m_mixer, 1.00, 0);
+ ymf262.add_route(3, m_mixer, 1.00, 1);
PC_JOY(config, m_joy);
}
diff --git a/src/devices/bus/isa/sblaster.cpp b/src/devices/bus/isa/sblaster.cpp
index 0f73dc7ec9f..a17d808cebd 100644
--- a/src/devices/bus/isa/sblaster.cpp
+++ b/src/devices/bus/isa/sblaster.cpp
@@ -1152,11 +1152,10 @@ DEFINE_DEVICE_TYPE(ISA16_SOUND_BLASTER_16, isa16_sblaster16_device, "isa_sblaste
void sb_device::common(machine_config &config)
{
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- DAC_16BIT_R2R(config, m_ldac, 0).add_route(ALL_OUTPUTS, "lspeaker", 0.5); // unknown DAC
- DAC_16BIT_R2R(config, m_rdac, 0).add_route(ALL_OUTPUTS, "rspeaker", 0.5); // unknown DAC
+ DAC_16BIT_R2R(config, m_ldac, 0).add_route(ALL_OUTPUTS, "speaker", 0.5, 0); // unknown DAC
+ DAC_16BIT_R2R(config, m_rdac, 0).add_route(ALL_OUTPUTS, "speaker", 0.5, 1); // unknown DAC
PC_JOY(config, m_joy);
@@ -1169,16 +1168,16 @@ void isa8_sblaster1_0_device::device_add_mconfig(machine_config &config)
common(config);
YM3812(config, m_ym3812, ym3812_StdClock);
- m_ym3812->add_route(ALL_OUTPUTS, "lspeaker", 3.0);
- m_ym3812->add_route(ALL_OUTPUTS, "rspeaker", 3.0);
+ m_ym3812->add_route(ALL_OUTPUTS, "speaker", 3.0, 0);
+ m_ym3812->add_route(ALL_OUTPUTS, "speaker", 3.0, 1);
SAA1099(config, m_saa1099_1, XTAL(14'318'181) / 2); // or CMS-301, from OSC pin in ISA bus
- m_saa1099_1->add_route(0, "lspeaker", 0.5);
- m_saa1099_1->add_route(1, "rspeaker", 0.5);
+ m_saa1099_1->add_route(0, "speaker", 0.5, 0);
+ m_saa1099_1->add_route(1, "speaker", 0.5, 1);
SAA1099(config, m_saa1099_2, XTAL(14'318'181) / 2); // or CMS-301, from OSC pin in ISA bus
- m_saa1099_2->add_route(0, "lspeaker", 0.5);
- m_saa1099_2->add_route(1, "rspeaker", 0.5);
+ m_saa1099_2->add_route(0, "speaker", 0.5, 0);
+ m_saa1099_2->add_route(1, "speaker", 0.5, 1);
}
void isa8_sblaster1_5_device::device_add_mconfig(machine_config &config)
@@ -1186,8 +1185,8 @@ void isa8_sblaster1_5_device::device_add_mconfig(machine_config &config)
common(config);
YM3812(config, m_ym3812, ym3812_StdClock);
- m_ym3812->add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- m_ym3812->add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ m_ym3812->add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ m_ym3812->add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
/* no CM/S support (empty sockets) */
}
@@ -1196,10 +1195,10 @@ void isa16_sblaster16_device::device_add_mconfig(machine_config &config)
common(config);
ymf262_device &ymf262(YMF262(config, "ymf262", ymf262_StdClock));
- ymf262.add_route(0, "lspeaker", 1.0);
- ymf262.add_route(1, "rspeaker", 1.0);
- ymf262.add_route(2, "lspeaker", 1.0);
- ymf262.add_route(3, "rspeaker", 1.0);
+ ymf262.add_route(0, "speaker", 1.0, 0);
+ ymf262.add_route(1, "speaker", 1.0, 1);
+ ymf262.add_route(2, "speaker", 1.0, 0);
+ ymf262.add_route(3, "speaker", 1.0, 1);
}
//**************************************************************************
diff --git a/src/devices/bus/isa/stereo_fx.cpp b/src/devices/bus/isa/stereo_fx.cpp
index 70f3c5160c7..bfd6eb6cfe5 100644
--- a/src/devices/bus/isa/stereo_fx.cpp
+++ b/src/devices/bus/isa/stereo_fx.cpp
@@ -124,15 +124,14 @@ void stereo_fx_device::device_add_mconfig(machine_config &config)
m_cpu->port_in_cb<3>().set(FUNC(stereo_fx_device::p3_r));
m_cpu->port_out_cb<3>().set(FUNC(stereo_fx_device::p3_w));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym3812_device &ym3812(YM3812(config, "ym3812", XTAL(3'579'545)));
- ym3812.add_route(ALL_OUTPUTS, "lspeaker", 1.00);
- ym3812.add_route(ALL_OUTPUTS, "rspeaker", 1.00);
+ ym3812.add_route(ALL_OUTPUTS, "speaker", 1.00, 0);
+ ym3812.add_route(ALL_OUTPUTS, "speaker", 1.00, 1);
/* no CM/S support (empty sockets) */
- DAC_8BIT_R2R(config, "ldac", 0).add_route(ALL_OUTPUTS, "lspeaker", 0.5); // unknown DAC
- DAC_8BIT_R2R(config, "rdac", 0).add_route(ALL_OUTPUTS, "rspeaker", 0.5); // unknown DAC
+ DAC_8BIT_R2R(config, "ldac", 0).add_route(ALL_OUTPUTS, "speaker", 0.5, 0); // unknown DAC
+ DAC_8BIT_R2R(config, "rdac", 0).add_route(ALL_OUTPUTS, "speaker", 0.5, 1); // unknown DAC
PC_JOY(config, m_joy);
}
diff --git a/src/devices/bus/msx/cart/moonsound.cpp b/src/devices/bus/msx/cart/moonsound.cpp
index 2251e0ac788..ba03a17d4d3 100644
--- a/src/devices/bus/msx/cart/moonsound.cpp
+++ b/src/devices/bus/msx/cart/moonsound.cpp
@@ -57,18 +57,17 @@ void msx_cart_moonsound_device::ymf278b_map(address_map &map)
void msx_cart_moonsound_device::device_add_mconfig(machine_config &config)
{
// The moonsound cartridge has a separate stereo output.
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
YMF278B(config, m_ymf278b, 33.8688_MHz_XTAL);
m_ymf278b->set_addrmap(0, &msx_cart_moonsound_device::ymf278b_map);
m_ymf278b->irq_handler().set(FUNC(msx_cart_moonsound_device::irq_w));
- m_ymf278b->add_route(0, "lspeaker", 0.50);
- m_ymf278b->add_route(1, "rspeaker", 0.50);
- m_ymf278b->add_route(2, "lspeaker", 0.40);
- m_ymf278b->add_route(3, "rspeaker", 0.40);
- m_ymf278b->add_route(4, "lspeaker", 0.50);
- m_ymf278b->add_route(5, "rspeaker", 0.50);
+ m_ymf278b->add_route(0, "speaker", 0.50, 0);
+ m_ymf278b->add_route(1, "speaker", 0.50, 1);
+ m_ymf278b->add_route(2, "speaker", 0.40, 0);
+ m_ymf278b->add_route(3, "speaker", 0.40, 1);
+ m_ymf278b->add_route(4, "speaker", 0.50, 0);
+ m_ymf278b->add_route(5, "speaker", 0.50, 1);
}
ROM_START(msx_cart_moonsound)
diff --git a/src/devices/bus/msx/cart/video80.cpp b/src/devices/bus/msx/cart/video80.cpp
index cac478bf88b..2bdfff855da 100644
--- a/src/devices/bus/msx/cart/video80.cpp
+++ b/src/devices/bus/msx/cart/video80.cpp
@@ -46,7 +46,8 @@ public:
, m_crtc(*this, "crtc")
, m_screen(*this, "screen1")
, m_cpu_waiting(false)
- {}
+ {
+ }
virtual std::error_condition initialize_cartridge(std::string &message) override;
@@ -67,7 +68,7 @@ private:
required_device<mc6845_device> m_crtc;
required_device<screen_device> m_screen;
- uint8_t m_vram[ VRAM_SIZE ];
+ uint8_t m_vram[VRAM_SIZE];
bool m_cpu_waiting;
MC6845_UPDATE_ROW(crtc_update_row);
@@ -75,12 +76,14 @@ private:
std::error_condition msx_cart_video80_device::initialize_cartridge(std::string &message)
{
- if (!cart_rom_region()) {
+ if (!cart_rom_region())
+ {
message = "msx_cart_video80_device: Required region 'rom' was not found.";
return image_error::INTERNAL;
}
- if (cart_rom_region()->bytes() != 0x1000) {
+ if (cart_rom_region()->bytes() != 0x1000)
+ {
message = "msx_cart_video80_device: Region 'rom' has invalid size.";
return image_error::INVALIDLENGTH;
}
@@ -118,7 +121,8 @@ void msx_cart_video80_device::device_add_mconfig(machine_config &config)
void msx_cart_video80_device::de_w(int state)
{
- if (m_cpu_waiting && !state) {
+ if (m_cpu_waiting && !state)
+ {
maincpu().set_input_line(Z80_INPUT_LINE_WAIT, CLEAR_LINE);
m_cpu_waiting = false;
}
@@ -126,26 +130,30 @@ void msx_cart_video80_device::de_w(int state)
uint8_t msx_cart_video80_device::vram_r(offs_t addr)
{
- uint8_t res = 0;
-
- if (!machine().side_effects_disabled() && m_crtc->de_r()) {
+ if (!machine().side_effects_disabled() && m_crtc->de_r())
+ {
maincpu().set_input_line(Z80_INPUT_LINE_WAIT, ASSERT_LINE);
maincpu().defer_access();
m_cpu_waiting = true;
- } else {
- res = m_vram[ addr ];
+ return 0;
+ }
+ else
+ {
+ return m_vram[addr];
}
- return res;
}
void msx_cart_video80_device::vram_w(offs_t addr, uint8_t data)
{
- if (!machine().side_effects_disabled() && m_crtc->de_r()) {
+ if (!machine().side_effects_disabled() && m_crtc->de_r())
+ {
maincpu().set_input_line(Z80_INPUT_LINE_WAIT, ASSERT_LINE);
maincpu().defer_access();
m_cpu_waiting = true;
- } else {
- m_vram[ addr ] = data;
+ }
+ else
+ {
+ m_vram[addr] = data;
}
}
@@ -153,13 +161,15 @@ uint8_t msx_cart_video80_device::crtc_r(offs_t addr)
{
uint8_t res = 0;
- if (BIT(addr, 1)) {
- if (BIT(addr, 0)) {
+ if (BIT(addr, 1))
+ {
+ if (BIT(addr, 0))
res = m_crtc->register_r();
- } else {
+ else
LOG("Reading from non-existing reg!\n");
- }
- } else {
+ }
+ else
+ {
LOG("Reading from a write-only address!\n");
}
@@ -168,30 +178,32 @@ uint8_t msx_cart_video80_device::crtc_r(offs_t addr)
void msx_cart_video80_device::crtc_w(offs_t addr, uint8_t data)
{
- if (BIT(addr, 1)) {
+ if (BIT(addr, 1))
+ {
LOG("Writing to a read-only address!\n");
- } else {
- if (BIT(addr, 0)) {
+ }
+ else
+ {
+ if (BIT(addr, 0))
m_crtc->register_w(data);
- } else {
+ else
m_crtc->address_w(data);
- }
}
}
MC6845_UPDATE_ROW(msx_cart_video80_device::crtc_update_row)
{
- const pen_t *pen = m_palette->pens();
- for (int i = 0; i < x_count; i++) {
- uint8_t char_code = m_vram[ (ma + i) & 0x7ff ];
- uint8_t pixels = m_vram[ (unsigned(char_code) << 3) | 0x800 | (ra & 7) ];
- bool cursor = cursor_x == i;
- if (cursor) {
+ pen_t const *const pen = m_palette->pens();
+ for (int i = 0; i < x_count; i++)
+ {
+ uint8_t const char_code = m_vram[(ma + i) & 0x7ff];
+ uint8_t pixels = m_vram[(unsigned(char_code) << 3) | 0x800 | (ra & 7)];
+ bool const cursor = cursor_x == i;
+ if (cursor)
pixels = ~pixels;
- }
- for (unsigned col = 0; col < 8; col++) {
- bitmap.pix(y, i * 8 + col) = pen[ BIT(pixels, 7 - col) ];
- }
+
+ for (unsigned col = 0; col < 8; col++)
+ bitmap.pix(y, i * 8 + col) = pen[BIT(pixels, 7 - col)];
}
}
diff --git a/src/devices/bus/msx/module/sfg.cpp b/src/devices/bus/msx/module/sfg.cpp
index 34657e59738..a9ba98068a5 100644
--- a/src/devices/bus/msx/module/sfg.cpp
+++ b/src/devices/bus/msx/module/sfg.cpp
@@ -63,12 +63,11 @@ void msx_cart_sfg_device::device_add_mconfig(machine_config &config)
// YM3012 (DAC)
// YM2148 (MKS)
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2151_device &ym2151(YM2151(config, m_ym2151, DERIVED_CLOCK(1, 1))); // The SFG01 uses a YM2151, the SFG05 uses a YM2164, input clock comes from the main cpu frequency
ym2151.irq_handler().set(FUNC(msx_cart_sfg_device::ym2151_irq_w));
- ym2151.add_route(0, "lspeaker", 0.80);
- ym2151.add_route(1, "rspeaker", 0.80);
+ ym2151.add_route(0, "speaker", 0.80, 0);
+ ym2151.add_route(1, "speaker", 0.80, 1);
YM2148(config, m_ym2148, XTAL(4'000'000));
m_ym2148->txd_handler().set("mdout", FUNC(midi_port_device::write_txd));
@@ -186,8 +185,8 @@ void msx_cart_sfg05_device::device_add_mconfig(machine_config &config)
ym2164_device &ym2164(YM2164(config.replace(), m_ym2151, DERIVED_CLOCK(1, 1)));
ym2164.irq_handler().set(FUNC(msx_cart_sfg05_device::ym2151_irq_w));
- ym2164.add_route(0, "lspeaker", 0.80);
- ym2164.add_route(1, "rspeaker", 0.80);
+ ym2164.add_route(0, "speaker", 0.80, 0);
+ ym2164.add_route(1, "speaker", 0.80, 1);
}
ROM_START(msx_sfg05)
diff --git a/src/devices/bus/pc8801/gsx8800.cpp b/src/devices/bus/pc8801/gsx8800.cpp
index 2e28c298136..df630cf83bf 100644
--- a/src/devices/bus/pc8801/gsx8800.cpp
+++ b/src/devices/bus/pc8801/gsx8800.cpp
@@ -44,10 +44,10 @@ void gsx8800_device::device_add_mconfig(machine_config &config)
// it's just known that one goes to the left and the other to the right
// cfr. http://mydocuments.g2.xrea.com/html/p8/soundinfo.html
YM2149(config, m_psg[0], psg_x1_clock);
- m_psg[0]->add_route(ALL_OUTPUTS, "^^lspeaker", 0.50);
+ m_psg[0]->add_route(ALL_OUTPUTS, "^^speaker", 0.50, 0);
YM2149(config, m_psg[1], psg_x1_clock);
- m_psg[1]->add_route(ALL_OUTPUTS, "^^rspeaker", 0.50);
+ m_psg[1]->add_route(ALL_OUTPUTS, "^^speaker", 0.50, 1);
// ...->irq_handler().set(FUNC(gsx8800_device::int3_w));
diff --git a/src/devices/bus/pc8801/hmb20.cpp b/src/devices/bus/pc8801/hmb20.cpp
index 82fd4081f48..6da14585d6e 100644
--- a/src/devices/bus/pc8801/hmb20.cpp
+++ b/src/devices/bus/pc8801/hmb20.cpp
@@ -37,6 +37,6 @@ void hmb20_device::device_add_mconfig(machine_config &config)
// TODO: OPM mixing
YM2151(config, m_opm, hmb20_x1_clock);
// m_opm->irq_handler().set(FUNC(hmb20_device::int4_w));
- m_opm->add_route(ALL_OUTPUTS, "^^lspeaker", 0.50);
- m_opm->add_route(ALL_OUTPUTS, "^^rspeaker", 0.50);
+ m_opm->add_route(ALL_OUTPUTS, "^^speaker", 0.50, 0);
+ m_opm->add_route(ALL_OUTPUTS, "^^speaker", 0.50, 1);
}
diff --git a/src/devices/bus/pc8801/jmbx1.cpp b/src/devices/bus/pc8801/jmbx1.cpp
index c868a7e2c7b..a5beb667a31 100644
--- a/src/devices/bus/pc8801/jmbx1.cpp
+++ b/src/devices/bus/pc8801/jmbx1.cpp
@@ -44,15 +44,15 @@ void jmbx1_device::device_add_mconfig(machine_config &config)
// doesn't seem to have irq mask
YM2151(config, m_opm1, jmb_x1_clock / 2);
m_opm1->irq_handler().set(FUNC(jmbx1_device::int4_w));
- m_opm1->add_route(ALL_OUTPUTS, "^^lspeaker", 0.25);
- m_opm1->add_route(ALL_OUTPUTS, "^^rspeaker", 0.25);
+ m_opm1->add_route(ALL_OUTPUTS, "^^speaker", 0.25, 0);
+ m_opm1->add_route(ALL_OUTPUTS, "^^speaker", 0.25, 1);
YM2151(config, m_opm2, jmb_x1_clock / 2);
- m_opm2->add_route(ALL_OUTPUTS, "^^lspeaker", 0.25);
- m_opm2->add_route(ALL_OUTPUTS, "^^rspeaker", 0.25);
+ m_opm2->add_route(ALL_OUTPUTS, "^^speaker", 0.25, 0);
+ m_opm2->add_route(ALL_OUTPUTS, "^^speaker", 0.25, 1);
YM2149(config, m_ssg, jmb_x1_clock / 4);
// TODO: adds a non-negligible DC offset, likely needs high pass filter
- m_ssg->add_route(ALL_OUTPUTS, "^^lspeaker", 0.20);
- m_ssg->add_route(ALL_OUTPUTS, "^^rspeaker", 0.20);
+ m_ssg->add_route(ALL_OUTPUTS, "^^speaker", 0.20, 0);
+ m_ssg->add_route(ALL_OUTPUTS, "^^speaker", 0.20, 1);
}
diff --git a/src/devices/bus/pc8801/pc8801_23.cpp b/src/devices/bus/pc8801/pc8801_23.cpp
index 2e171e2f914..6f73ca0ff76 100644
--- a/src/devices/bus/pc8801/pc8801_23.cpp
+++ b/src/devices/bus/pc8801/pc8801_23.cpp
@@ -50,10 +50,10 @@ void pc8801_23_device::device_add_mconfig(machine_config &config)
// m_opna->port_a_read_callback().set(FUNC(pc8801_23_device::opn_porta_r));
// m_opna->port_b_read_callback().set_ioport("OPN_PB");
// TODO: per-channel mixing is unconfirmed
- m_opna->add_route(0, "^^lspeaker", 0.75);
- m_opna->add_route(0, "^^rspeaker", 0.75);
- m_opna->add_route(1, "^^lspeaker", 0.75);
- m_opna->add_route(2, "^^rspeaker", 0.75);
+ m_opna->add_route(0, "^^speaker", 0.75, 0);
+ m_opna->add_route(0, "^^speaker", 0.75, 1);
+ m_opna->add_route(1, "^^speaker", 0.75, 0);
+ m_opna->add_route(2, "^^speaker", 0.75, 1);
}
void pc8801_23_device::device_start()
diff --git a/src/devices/bus/pc8801/pcg8100.cpp b/src/devices/bus/pc8801/pcg8100.cpp
index c2bf07c7f73..f97c6a36d9f 100644
--- a/src/devices/bus/pc8801/pcg8100.cpp
+++ b/src/devices/bus/pc8801/pcg8100.cpp
@@ -46,8 +46,8 @@ void pcg8100_device::device_add_mconfig(machine_config &config)
for (auto &dac1bit : m_dac1bit)
{
SPEAKER_SOUND(config, dac1bit);
- dac1bit->add_route(ALL_OUTPUTS, "^^lspeaker", 0.25);
- dac1bit->add_route(ALL_OUTPUTS, "^^rspeaker", 0.25);
+ dac1bit->add_route(ALL_OUTPUTS, "^^speaker", 0.25, 0);
+ dac1bit->add_route(ALL_OUTPUTS, "^^speaker", 0.25, 1);
}
}
diff --git a/src/devices/bus/pci/sonicvibes.cpp b/src/devices/bus/pci/sonicvibes.cpp
index 6b1f0398824..e17a6abe582 100644
--- a/src/devices/bus/pci/sonicvibes.cpp
+++ b/src/devices/bus/pci/sonicvibes.cpp
@@ -62,18 +62,17 @@ sonicvibes_device::sonicvibes_device(const machine_config &mconfig, const char *
void sonicvibes_device::device_add_mconfig(machine_config &config)
{
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
// TODO: (barely visible) only 24'576 xtal on a Turtle Beach PCB, is it really 12-ish MHz?
YMF262(config, m_opl3, XTAL(14'318'181));
- m_opl3->add_route(0, "lspeaker", 1.0);
- m_opl3->add_route(1, "rspeaker", 1.0);
- m_opl3->add_route(2, "lspeaker", 1.0);
- m_opl3->add_route(3, "rspeaker", 1.0);
+ m_opl3->add_route(0, "speaker", 1.0, 0);
+ m_opl3->add_route(1, "speaker", 1.0, 1);
+ m_opl3->add_route(2, "speaker", 1.0, 0);
+ m_opl3->add_route(3, "speaker", 1.0, 1);
-// DAC_16BIT_R2R(config, m_ldac, 0).add_route(ALL_OUTPUTS, "lspeaker", 0.5); // unknown DAC
-// DAC_16BIT_R2R(config, m_rdac, 0).add_route(ALL_OUTPUTS, "rspeaker", 0.5); // unknown DAC
+// DAC_16BIT_R2R(config, m_ldac, 0).add_route(ALL_OUTPUTS, "speaker", 0.5); // unknown DAC
+// DAC_16BIT_R2R(config, m_rdac, 0).add_route(ALL_OUTPUTS, "speaker", 0.5); // unknown DAC
PC_JOY(config, m_joy);
diff --git a/src/devices/bus/pci/sw1000xg.cpp b/src/devices/bus/pci/sw1000xg.cpp
index 99255915915..6b91069db92 100644
--- a/src/devices/bus/pci/sw1000xg.cpp
+++ b/src/devices/bus/pci/sw1000xg.cpp
@@ -83,12 +83,11 @@ void sw1000xg_device::device_add_mconfig(machine_config &config)
H83002(config, m_maincpu, 16_MHz_XTAL);
m_maincpu->set_addrmap(AS_PROGRAM, &sw1000xg_device::h8_map);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
SWP30(config, m_swp30);
m_swp30->set_addrmap(AS_DATA, &sw1000xg_device::swp30_map);
- m_swp30->add_route(0, "lspeaker", 1.0);
- m_swp30->add_route(1, "rspeaker", 1.0);
+ m_swp30->add_route(0, "speaker", 1.0, 0);
+ m_swp30->add_route(1, "speaker", 1.0, 1);
}
diff --git a/src/devices/bus/plg1x0/plg100-vl.cpp b/src/devices/bus/plg1x0/plg100-vl.cpp
index ae6f326c2bd..ee8a5050c14 100644
--- a/src/devices/bus/plg1x0/plg100-vl.cpp
+++ b/src/devices/bus/plg1x0/plg100-vl.cpp
@@ -67,8 +67,8 @@ void plg100_vl_device::device_add_mconfig(machine_config &config)
m_cpu->write_sci_tx<1>().set([this] (int state) { m_connector->do_midi_tx(state); });
DSPV(config, m_dspv, 22.5792_MHz_XTAL);
- m_dspv->add_route(0, DEVICE_SELF_OWNER, 1.0, AUTO_ALLOC_INPUT, 0);
- m_dspv->add_route(1, DEVICE_SELF_OWNER, 1.0, AUTO_ALLOC_INPUT, 1);
+ m_dspv->add_route(0, DEVICE_SELF_OWNER, 1.0, 0);
+ m_dspv->add_route(1, DEVICE_SELF_OWNER, 1.0, 1);
}
ROM_START( plg100_vl )
diff --git a/src/devices/bus/plg1x0/plg1x0.cpp b/src/devices/bus/plg1x0/plg1x0.cpp
index 6abd5100209..1bbded3ff18 100644
--- a/src/devices/bus/plg1x0/plg1x0.cpp
+++ b/src/devices/bus/plg1x0/plg1x0.cpp
@@ -12,14 +12,14 @@ DEFINE_DEVICE_TYPE(PLG1X0_CONNECTOR, plg1x0_connector, "plg1x0_connector", "PLG1
plg1x0_connector::plg1x0_connector(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, PLG1X0_CONNECTOR, tag, owner, clock),
device_single_card_slot_interface<device_plg1x0_interface>(mconfig, *this),
- device_mixer_interface(mconfig, *this, 2),
+ device_mixer_interface(mconfig, *this),
m_midi_tx(*this)
{
}
void plg1x0_connector::device_start()
{
- save_item(NAME(m_state_system_is_annoying));
+ save_item(NAME(m_dummy_save));
}
void plg1x0_connector::midi_rx(int state)
diff --git a/src/devices/bus/plg1x0/plg1x0.h b/src/devices/bus/plg1x0/plg1x0.h
index b4917ba9b39..dd7186a58b0 100644
--- a/src/devices/bus/plg1x0/plg1x0.h
+++ b/src/devices/bus/plg1x0/plg1x0.h
@@ -53,7 +53,7 @@ public:
void do_midi_tx(int state) { m_midi_tx(state); }
protected:
- bool m_state_system_is_annoying = true;
+ bool m_dummy_save = false; // needed for save-state support
devcb_write_line m_midi_tx;
virtual void device_start() override ATTR_COLD;
diff --git a/src/devices/bus/psi_kbd/hle.cpp b/src/devices/bus/psi_kbd/hle.cpp
index 7fd1b02677f..c041f5fae07 100644
--- a/src/devices/bus/psi_kbd/hle.cpp
+++ b/src/devices/bus/psi_kbd/hle.cpp
@@ -98,7 +98,7 @@ static INPUT_PORTS_START( keyboard )
PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_NAME("ESC/STOP") PORT_CHAR(UCHAR_MAMEKEY(ESC))
PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"')
- PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR(0xa7) // §
+ PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR(U'§')
PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$')
PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%')
PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&')
@@ -106,8 +106,8 @@ static INPUT_PORTS_START( keyboard )
PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(')
PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')')
PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=')
- PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR(0xdf) PORT_CHAR('?') // ß
- PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(0xb4) PORT_CHAR('`')
+ PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR(U'ß') PORT_CHAR('?')
+ PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(U'´') PORT_CHAR('`')
PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('|') PORT_CHAR('^')
PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("RUB OUT") PORT_CHAR(0x08)
PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_UNUSED)
@@ -124,7 +124,7 @@ static INPUT_PORTS_START( keyboard )
PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I')
PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O')
PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P')
- PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0xfc) PORT_CHAR(0xdc) // ü Ü
+ PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(U'ü') PORT_CHAR(U'Ü')
PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('+') PORT_CHAR('*')
PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_UNUSED) // LF, same code as cursor down
PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_UNUSED)
@@ -142,8 +142,8 @@ static INPUT_PORTS_START( keyboard )
PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J')
PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K')
PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L')
- PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(0xf6) PORT_CHAR(0xd6) // ö Ö
- PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0xe4) PORT_CHAR(0xc4) // ä Ä
+ PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(U'ö') PORT_CHAR(U'Ö')
+ PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(U'ä') PORT_CHAR(U'Ä')
PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('#') PORT_CHAR('\'')
PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_NAME("CR") PORT_CHAR(0x0d)
PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_UNUSED)
@@ -175,7 +175,7 @@ static INPUT_PORTS_START( keyboard )
PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME("] }") PORT_CHAR(']') PORT_CHAR('}')
PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("\\ |") PORT_CHAR('\\') PORT_CHAR('|')
PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL) PORT_NAME("DEL CHAR") PORT_CHAR(UCHAR_MAMEKEY(DEL))
- PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_NAME("ER \xe2\x87\xa5") // ER ⇥
+ PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_NAME(u8"ER \u21e5") // ER ⇥
PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("ER PAGE")
PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_UNUSED)
PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_UNUSED)
@@ -185,18 +185,18 @@ static INPUT_PORTS_START( keyboard )
PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_UNUSED)
PORT_START("row_6")
- PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("\xe2\x86\x96") // ↖
- PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CODE(KEYCODE_UP) PORT_NAME("\xe2\x86\x91") PORT_CHAR(UCHAR_MAMEKEY(UP))
- PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("\xe2\x86\x97") // ↗
- PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CODE(KEYCODE_LEFT) PORT_NAME("\xe2\x86\x90") PORT_CHAR(UCHAR_MAMEKEY(LEFT))
+ PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_NAME(u8"\u2196") // ↖
+ PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CODE(KEYCODE_UP) PORT_NAME(u8"\u2191") PORT_CHAR(UCHAR_MAMEKEY(UP))
+ PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_NAME(u8"\u2197") // ↗
+ PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CODE(KEYCODE_LEFT) PORT_NAME(u8"\u2190") PORT_CHAR(UCHAR_MAMEKEY(LEFT))
PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_NAME("HOME") PORT_CHAR(UCHAR_MAMEKEY(HOME))
- PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CODE(KEYCODE_RIGHT) PORT_NAME("\xe2\x86\x92") PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
- PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("\xe2\x86\x99") // ↙
- PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CODE(KEYCODE_DOWN) PORT_NAME("\xe2\x86\x93") PORT_CHAR(UCHAR_MAMEKEY(DOWN))
- PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("\xe2\x86\x98") // ↘
- PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGUP) PORT_NAME("\xe2\x87\xa7")
+ PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CODE(KEYCODE_RIGHT) PORT_NAME(u8"\u2192") PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
+ PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_NAME(u8"\u2199") // ↙
+ PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CODE(KEYCODE_DOWN) PORT_NAME(u8"\u2193") PORT_CHAR(UCHAR_MAMEKEY(DOWN))
+ PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_NAME(u8"\u2198") // ↘
+ PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGUP) PORT_NAME(u8"\u21e7") // ⇧
PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_INSERT) PORT_NAME("INS CHAR") PORT_CHAR(UCHAR_MAMEKEY(INSERT))
- PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGDN) PORT_NAME("\xe2\x87\xa9")
+ PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGDN) PORT_NAME(u8"\u21e9") // ⇩
PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_UNUSED)
PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_UNUSED)
PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_UNUSED)
diff --git a/src/devices/bus/rc2014/sound.cpp b/src/devices/bus/rc2014/sound.cpp
index acdb36e5442..3dafc5a7fb8 100644
--- a/src/devices/bus/rc2014/sound.cpp
+++ b/src/devices/bus/rc2014/sound.cpp
@@ -158,14 +158,13 @@ void rc2014_ym2149_device::device_reset()
void rc2014_ym2149_device::device_add_mconfig(machine_config &config)
{
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
YM2149(config, m_psg, 0);
- m_psg->add_route(0, "rspeaker", 0.25);
- m_psg->add_route(2, "rspeaker", 0.25);
- m_psg->add_route(1, "lspeaker", 0.25);
- m_psg->add_route(2, "lspeaker", 0.25);
+ m_psg->add_route(0, "speaker", 0.25, 1);
+ m_psg->add_route(2, "speaker", 0.25, 1);
+ m_psg->add_route(1, "speaker", 0.25, 0);
+ m_psg->add_route(2, "speaker", 0.25, 0);
}
//**************************************************************************
@@ -190,14 +189,13 @@ rc2014_ay8190_device::rc2014_ay8190_device(const machine_config &mconfig, const
void rc2014_ay8190_device::device_add_mconfig(machine_config &config)
{
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
AY8910(config, m_psg, 0);
- m_psg->add_route(0, "rspeaker", 0.25);
- m_psg->add_route(2, "rspeaker", 0.25);
- m_psg->add_route(1, "lspeaker", 0.25);
- m_psg->add_route(2, "lspeaker", 0.25);
+ m_psg->add_route(0, "speaker", 0.25, 1);
+ m_psg->add_route(2, "speaker", 0.25, 1);
+ m_psg->add_route(1, "speaker", 0.25, 0);
+ m_psg->add_route(2, "speaker", 0.25, 0);
}
}
diff --git a/src/devices/bus/rs232/mboardd.cpp b/src/devices/bus/rs232/mboardd.cpp
index 002f868c40a..1ec2bdc8c9b 100644
--- a/src/devices/bus/rs232/mboardd.cpp
+++ b/src/devices/bus/rs232/mboardd.cpp
@@ -78,12 +78,11 @@ void mockingboard_d_device::device_add_mconfig(machine_config &config)
m_cpu->out_p1_cb().set(FUNC(mockingboard_d_device::p1_w));
m_cpu->out_ser_tx_cb().set(FUNC(mockingboard_d_device::ser_tx_w));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
AY8913(config, m_ay1, 1022727);
- m_ay1->add_route(ALL_OUTPUTS, "lspeaker", 0.5);
+ m_ay1->add_route(ALL_OUTPUTS, "speaker", 0.5, 0);
AY8913(config, m_ay2, 1022727);
- m_ay2->add_route(ALL_OUTPUTS, "lspeaker", 0.5);
+ m_ay2->add_route(ALL_OUTPUTS, "speaker", 0.5, 0);
}
const tiny_rom_entry *mockingboard_d_device::device_rom_region() const
diff --git a/src/devices/bus/segaai/soundbox.cpp b/src/devices/bus/segaai/soundbox.cpp
index 3496f1ac479..230275da343 100644
--- a/src/devices/bus/segaai/soundbox.cpp
+++ b/src/devices/bus/segaai/soundbox.cpp
@@ -142,12 +142,11 @@ void segaai_soundbox_device::device_add_mconfig(machine_config &config)
m_tmp8255->out_pb_callback().set(FUNC(segaai_soundbox_device::tmp8255_portb_w));
m_tmp8255->out_pc_callback().set(FUNC(segaai_soundbox_device::tmp8255_portc_w));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
YM2151(config, m_ym2151, DERIVED_CLOCK(1,1)); // ~3.58MHz
m_ym2151->irq_handler().set(FUNC(segaai_soundbox_device::ym2151_irq_w));
- m_ym2151->add_route(0, "lspeaker", 1.00);
- m_ym2151->add_route(1, "rspeaker", 1.00);
+ m_ym2151->add_route(0, "speaker", 1.00, 0);
+ m_ym2151->add_route(1, "speaker", 1.00, 1);
}
ROM_START(soundbox)
diff --git a/src/devices/bus/spectrum/neogs.cpp b/src/devices/bus/spectrum/neogs.cpp
index 156c2e2895c..2848523a328 100644
--- a/src/devices/bus/spectrum/neogs.cpp
+++ b/src/devices/bus/spectrum/neogs.cpp
@@ -426,11 +426,10 @@ void neogs_device::device_add_mconfig(machine_config &config)
m_sdcard->set_prefer_sdhc();
m_sdcard->spi_miso_callback().set([this](int state) { m_spi_data_in_latch <<= 1; m_spi_data_in_latch |= state; });
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_dac[0], 0).add_route(ALL_OUTPUTS, "lspeaker", 0.75); // TDA1543
- DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_dac[1], 0).add_route(ALL_OUTPUTS, "rspeaker", 0.75);
+ DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_dac[0], 0).add_route(ALL_OUTPUTS, "speaker", 0.75, 0); // TDA1543
+ DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_dac[1], 0).add_route(ALL_OUTPUTS, "speaker", 0.75, 1);
}
const tiny_rom_entry *neogs_device::device_rom_region() const
diff --git a/src/devices/bus/spectrum/uslot.cpp b/src/devices/bus/spectrum/uslot.cpp
index d3955ec50d5..854006b1446 100644
--- a/src/devices/bus/spectrum/uslot.cpp
+++ b/src/devices/bus/spectrum/uslot.cpp
@@ -13,7 +13,7 @@
// DEVICE DEFINITIONS
//**************************************************************************
-DEFINE_DEVICE_TYPE(SPECTRUM_USLOT, spectrum_uslot_device, "spectrum_uslot", "Spectrum Currah \xC2\xB5Slot")
+DEFINE_DEVICE_TYPE(SPECTRUM_USLOT, spectrum_uslot_device, "spectrum_uslot", u8"Spectrum Currah µSlot")
//-------------------------------------------------
diff --git a/src/devices/bus/spectrum/usource.cpp b/src/devices/bus/spectrum/usource.cpp
index 6b9ffbbfbc0..eac47cf55ca 100644
--- a/src/devices/bus/spectrum/usource.cpp
+++ b/src/devices/bus/spectrum/usource.cpp
@@ -15,7 +15,7 @@
// DEVICE DEFINITIONS
//**************************************************************************
-DEFINE_DEVICE_TYPE(SPECTRUM_USOURCE, spectrum_usource_device, "spectrum_usource", "Spectrum Currah \xC2\xB5Source")
+DEFINE_DEVICE_TYPE(SPECTRUM_USOURCE, spectrum_usource_device, "spectrum_usource", u8"Spectrum Currah µSource")
//-------------------------------------------------
diff --git a/src/devices/bus/spectrum/uspeech.cpp b/src/devices/bus/spectrum/uspeech.cpp
index fd013dabacc..0e465a6f8b6 100644
--- a/src/devices/bus/spectrum/uspeech.cpp
+++ b/src/devices/bus/spectrum/uspeech.cpp
@@ -15,7 +15,7 @@
// DEVICE DEFINITIONS
//**************************************************************************
-DEFINE_DEVICE_TYPE(SPECTRUM_USPEECH, spectrum_uspeech_device, "spectrum_uspeech", "Spectrum Currah \xC2\xB5Speech")
+DEFINE_DEVICE_TYPE(SPECTRUM_USPEECH, spectrum_uspeech_device, "spectrum_uspeech", u8"Spectrum Currah µSpeech")
//-------------------------------------------------
diff --git a/src/devices/bus/st/replay.cpp b/src/devices/bus/st/replay.cpp
new file mode 100644
index 00000000000..15dc3aacf97
--- /dev/null
+++ b/src/devices/bus/st/replay.cpp
@@ -0,0 +1,100 @@
+// license:BSD-3-Clause
+// copyright-holders: Olivier Galibert
+
+// Microdeal ST Replay
+
+// A 8-bit mono DAC and a 8-bit mono ADC on a cartridge, with a vague
+// lowpass filter.
+
+// A peculiarity of the ST cartridge port is that it's readonly. So
+// writing to the DAC is done by reading at an appropriate address.
+
+#include "emu.h"
+#include "replay.h"
+
+#include "sound/adc.h"
+#include "sound/dac.h"
+#include "speaker.h"
+
+namespace {
+
+class st_replay_device : public device_t, public device_stcart_interface
+{
+public:
+ st_replay_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ virtual ~st_replay_device();
+
+ virtual void map(address_space_installer &space) override;
+
+protected:
+ virtual void device_start() override ATTR_COLD;
+ virtual void device_reset() override ATTR_COLD;
+ virtual void device_add_mconfig(machine_config &config) override ATTR_COLD;
+
+private:
+ required_device<zn449_device> m_adc;
+ required_device<zn429e_device> m_dac;
+ required_device<microphone_device> m_mic;
+ required_device<speaker_device> m_speaker;
+
+ void cartmap(address_map &map) ATTR_COLD;
+
+ u16 dac_w(offs_t data);
+};
+
+st_replay_device::st_replay_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ device_t(mconfig, ST_REPLAY, tag, owner, clock),
+ device_stcart_interface(mconfig, *this),
+ m_adc(*this, "adc"),
+ m_dac(*this, "dac"),
+ m_mic(*this, "mic"),
+ m_speaker(*this, "speaker")
+{
+}
+
+st_replay_device::~st_replay_device()
+{
+}
+
+u16 st_replay_device::dac_w(offs_t data)
+{
+ m_dac->write(data);
+ return 0xffff;
+}
+
+void st_replay_device::map(address_space_installer &space)
+{
+ space.install_device(0xfa0000, 0xfbffff, *this, &st_replay_device::cartmap);
+}
+
+void st_replay_device::cartmap(address_map &map)
+{
+ map(0x00000, 0x001ff).r(FUNC(st_replay_device::dac_w)).mirror(0xfe00);
+ map(0x10001, 0x10001).r(m_adc, FUNC(zn449_device::read)).mirror(0xfffe);
+}
+
+void st_replay_device::device_add_mconfig(machine_config &config)
+{
+ MICROPHONE(config, m_mic, 1).front_center();
+ m_mic->add_route(0, m_adc, 1.0, 0);
+
+ ZN449(config, m_adc);
+
+ // ZN429D the schematics say, not sure if any significant difference
+ ZN429E(config, m_dac);
+ m_dac->add_route(0, m_speaker, 1.0, 0);
+
+ SPEAKER(config, m_speaker, 1).front_center();
+}
+
+void st_replay_device::device_start()
+{
+}
+
+void st_replay_device::device_reset()
+{
+}
+
+} // anonymous namespace
+
+DEFINE_DEVICE_TYPE_PRIVATE(ST_REPLAY, device_stcart_interface, st_replay_device, "st_replay", "Microdeal ST Replay")
diff --git a/src/devices/bus/st/replay.h b/src/devices/bus/st/replay.h
new file mode 100644
index 00000000000..b6e2c73a062
--- /dev/null
+++ b/src/devices/bus/st/replay.h
@@ -0,0 +1,15 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+
+#ifndef MAME_BUS_ST_REPLAY_H
+#define MAME_BUS_ST_REPLAY_H
+
+// Microdeal ST Replay
+
+#pragma once
+
+#include "stcart.h"
+
+DECLARE_DEVICE_TYPE(ST_REPLAY, device_stcart_interface)
+
+#endif // MAME_BUS_ST_REPLAY_H
diff --git a/src/devices/bus/st/stcart.cpp b/src/devices/bus/st/stcart.cpp
new file mode 100644
index 00000000000..0e53093bf92
--- /dev/null
+++ b/src/devices/bus/st/stcart.cpp
@@ -0,0 +1,40 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+
+#include "emu.h"
+#include "stcart.h"
+
+#include "replay.h"
+
+DEFINE_DEVICE_TYPE(STCART_CONNECTOR, stcart_connector, "stcart_connector", "Atari ST cartridge connector")
+
+stcart_connector::stcart_connector(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ device_t(mconfig, STCART_CONNECTOR, tag, owner, clock),
+ device_single_card_slot_interface<device_stcart_interface>(mconfig, *this)
+{
+}
+
+void stcart_connector::device_start()
+{
+}
+
+void stcart_connector::map(address_space_installer &space)
+{
+ auto card = get_card_device();
+ if(card)
+ card->map(space);
+}
+
+void stcart_intf(device_slot_interface &device)
+{
+ device.option_add("replay", ST_REPLAY);
+}
+
+device_stcart_interface::device_stcart_interface(const machine_config &mconfig, device_t &device) :
+ device_interface(device, "stcart")
+{
+}
+
+device_stcart_interface::~device_stcart_interface()
+{
+}
diff --git a/src/devices/bus/st/stcart.h b/src/devices/bus/st/stcart.h
new file mode 100644
index 00000000000..49ccb78a2e6
--- /dev/null
+++ b/src/devices/bus/st/stcart.h
@@ -0,0 +1,50 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+
+// Atari ST cartridges
+
+#ifndef MAME_BUS_ST_STCART_H
+#define MAME_BUS_ST_STCART_H
+
+#pragma once
+
+class device_stcart_interface;
+
+class stcart_connector: public device_t, public device_single_card_slot_interface<device_stcart_interface>
+{
+public:
+ template <typename T>
+ stcart_connector(const machine_config &mconfig, const char *tag, device_t *owner, T &&opts, const char *dflt)
+ : stcart_connector(mconfig, tag, owner, (uint32_t)0)
+ {
+ option_reset();
+ opts(*this);
+ set_default_option(dflt);
+ set_fixed(false);
+ }
+
+ stcart_connector(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+ void map(address_space_installer &space);
+
+protected:
+ virtual void device_start() override ATTR_COLD;
+};
+
+class device_stcart_interface: public device_interface
+{
+public:
+ device_stcart_interface(const machine_config &mconfig, device_t &device);
+ virtual ~device_stcart_interface();
+
+ virtual void map(address_space_installer &space) = 0;
+
+protected:
+
+};
+
+DECLARE_DEVICE_TYPE(STCART_CONNECTOR, stcart_connector)
+
+void stcart_intf(device_slot_interface &device);
+
+#endif // MAME_BUS_ST_STCART_H
diff --git a/src/devices/bus/svi3x8/expander/expander.cpp b/src/devices/bus/svi3x8/expander/expander.cpp
index 652e32467b5..e75be84a7ba 100644
--- a/src/devices/bus/svi3x8/expander/expander.cpp
+++ b/src/devices/bus/svi3x8/expander/expander.cpp
@@ -38,8 +38,7 @@ svi_expander_device::svi_expander_device(const machine_config &mconfig, const ch
m_ctrl1_handler(*this),
m_ctrl2_handler(*this),
m_excsr_handler(*this, 0xff),
- m_excsw_handler(*this),
- m_dummy(0)
+ m_excsw_handler(*this)
{
}
@@ -61,7 +60,7 @@ void svi_expander_device::device_start()
m_module = get_card_device();
// register for save states
- save_item(NAME(m_dummy));
+ save_item(NAME(m_dummy_save));
}
//-------------------------------------------------
diff --git a/src/devices/bus/svi3x8/expander/expander.h b/src/devices/bus/svi3x8/expander/expander.h
index 393b0fb2761..997f10afc1e 100644
--- a/src/devices/bus/svi3x8/expander/expander.h
+++ b/src/devices/bus/svi3x8/expander/expander.h
@@ -113,7 +113,7 @@ private:
devcb_read8 m_excsr_handler;
devcb_write8 m_excsw_handler;
- uint8_t m_dummy; // needed for save-state support
+ bool m_dummy_save = false; // needed for save-state support
};
diff --git a/src/devices/bus/uts_kbd/extw.cpp b/src/devices/bus/uts_kbd/extw.cpp
index 344159485a5..2502e0a5feb 100644
--- a/src/devices/bus/uts_kbd/extw.cpp
+++ b/src/devices/bus/uts_kbd/extw.cpp
@@ -151,7 +151,7 @@ static INPUT_PORTS_START(uts_extw)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CHAR('b') PORT_CHAR('B') PORT_CODE(KEYCODE_B)
PORT_START("KEY4")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SOE \xe2\x96\xb6 Tab Set") PORT_CODE(KEYCODE_LALT) // ▶
+ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(u8"SOE \u25b6 Tab Set") PORT_CODE(KEYCODE_LALT) // ▶
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Insert in Line Insert in Disp") PORT_CHAR(UCHAR_MAMEKEY(INSERT)) PORT_CODE(KEYCODE_INSERT)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Delete in Line Delete in Disp") PORT_CHAR(UCHAR_MAMEKEY(DEL)) PORT_CODE(KEYCODE_DEL)
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cursor to Home") PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_CODE(KEYCODE_HOME) // ↖
diff --git a/src/devices/bus/waveblaster/db50xg.cpp b/src/devices/bus/waveblaster/db50xg.cpp
index 6d3c0f067d5..c105227dce5 100644
--- a/src/devices/bus/waveblaster/db50xg.cpp
+++ b/src/devices/bus/waveblaster/db50xg.cpp
@@ -71,8 +71,8 @@ void db50xg_device::device_add_mconfig(machine_config &config)
m_cpu->write_sci_tx<0>().set([this] (int state) { m_connector->do_midi_tx(state); });
SWP00(config, m_swp00);
- m_swp00->add_route(0, DEVICE_SELF_OWNER, 1.0, AUTO_ALLOC_INPUT, 0);
- m_swp00->add_route(1, DEVICE_SELF_OWNER, 1.0, AUTO_ALLOC_INPUT, 1);
+ m_swp00->add_route(0, DEVICE_SELF_OWNER, 1.0, 0);
+ m_swp00->add_route(1, DEVICE_SELF_OWNER, 1.0, 1);
}
ROM_START( db50xg )
diff --git a/src/devices/bus/waveblaster/db60xg.cpp b/src/devices/bus/waveblaster/db60xg.cpp
index 4f8ede66612..c194d5d0e6e 100644
--- a/src/devices/bus/waveblaster/db60xg.cpp
+++ b/src/devices/bus/waveblaster/db60xg.cpp
@@ -69,8 +69,8 @@ void db60xg_device::device_add_mconfig(machine_config &config)
m_cpu->write_sci_tx<0>().set([this] (int state) { m_connector->do_midi_tx(state); });
SWP00(config, m_swp00);
- m_swp00->add_route(0, DEVICE_SELF_OWNER, 1.0, AUTO_ALLOC_INPUT, 0);
- m_swp00->add_route(1, DEVICE_SELF_OWNER, 1.0, AUTO_ALLOC_INPUT, 1);
+ m_swp00->add_route(0, DEVICE_SELF_OWNER, 1.0, 0);
+ m_swp00->add_route(1, DEVICE_SELF_OWNER, 1.0, 1);
}
ROM_START( db60xg )
diff --git a/src/devices/bus/waveblaster/omniwave.cpp b/src/devices/bus/waveblaster/omniwave.cpp
index 54d5731029f..a83399c28f9 100644
--- a/src/devices/bus/waveblaster/omniwave.cpp
+++ b/src/devices/bus/waveblaster/omniwave.cpp
@@ -47,8 +47,8 @@ void omniwave_device::midi_rx(int state)
void omniwave_device::device_add_mconfig(machine_config &config)
{
KS0164(config, m_ks0164, 16.9344_MHz_XTAL);
- m_ks0164->add_route(0, DEVICE_SELF_OWNER, 1.0, AUTO_ALLOC_INPUT, 0);
- m_ks0164->add_route(1, DEVICE_SELF_OWNER, 1.0, AUTO_ALLOC_INPUT, 1);
+ m_ks0164->add_route(0, DEVICE_SELF_OWNER, 1.0, 0);
+ m_ks0164->add_route(1, DEVICE_SELF_OWNER, 1.0, 1);
m_ks0164->midi_tx().set([this] (int state) { m_connector->do_midi_tx(state); });
}
diff --git a/src/devices/bus/waveblaster/waveblaster.cpp b/src/devices/bus/waveblaster/waveblaster.cpp
index c280a2fd083..a1a12323879 100644
--- a/src/devices/bus/waveblaster/waveblaster.cpp
+++ b/src/devices/bus/waveblaster/waveblaster.cpp
@@ -15,14 +15,14 @@ DEFINE_DEVICE_TYPE(WAVEBLASTER_CONNECTOR, waveblaster_connector, "waveblaster_co
waveblaster_connector::waveblaster_connector(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, WAVEBLASTER_CONNECTOR, tag, owner, clock),
device_single_card_slot_interface<device_waveblaster_interface>(mconfig, *this),
- device_mixer_interface(mconfig, *this, 2),
+ device_mixer_interface(mconfig, *this),
m_midi_tx(*this)
{
}
void waveblaster_connector::device_start()
{
- save_item(NAME(m_state_system_is_annoying));
+ save_item(NAME(m_dummy_save));
}
void waveblaster_connector::midi_rx(int state)
diff --git a/src/devices/bus/waveblaster/waveblaster.h b/src/devices/bus/waveblaster/waveblaster.h
index 4276d8d31cc..47d6558f966 100644
--- a/src/devices/bus/waveblaster/waveblaster.h
+++ b/src/devices/bus/waveblaster/waveblaster.h
@@ -31,7 +31,7 @@ public:
void do_midi_tx(int state) { m_midi_tx(state); }
protected:
- bool m_state_system_is_annoying = true;
+ bool m_dummy_save = false; // needed for save-state support
devcb_write_line m_midi_tx;
virtual void device_start() override ATTR_COLD;
diff --git a/src/devices/bus/waveblaster/wg130.cpp b/src/devices/bus/waveblaster/wg130.cpp
index 32aeae3c8a3..8c44347c2b7 100644
--- a/src/devices/bus/waveblaster/wg130.cpp
+++ b/src/devices/bus/waveblaster/wg130.cpp
@@ -77,8 +77,8 @@ void wg130_device::device_add_mconfig(machine_config &config)
{
GT913(config, m_gt913, 30_MHz_XTAL / 2);
m_gt913->set_addrmap(AS_DATA, &wg130_device::map);
- m_gt913->add_route(0, DEVICE_SELF_OWNER, 1.0, AUTO_ALLOC_INPUT, 0);
- m_gt913->add_route(1, DEVICE_SELF_OWNER, 1.0, AUTO_ALLOC_INPUT, 1);
+ m_gt913->add_route(0, DEVICE_SELF_OWNER, 1.0, 0);
+ m_gt913->add_route(1, DEVICE_SELF_OWNER, 1.0, 1);
m_gt913->read_port1().set_constant(0xff);
m_gt913->write_port1().set_nop();
m_gt913->read_port2().set_constant(0xff);
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/sh/sh3comn.cpp b/src/devices/cpu/sh/sh3comn.cpp
index 7829097750b..3d5942aa363 100644
--- a/src/devices/cpu/sh/sh3comn.cpp
+++ b/src/devices/cpu/sh/sh3comn.cpp
@@ -1046,6 +1046,11 @@ uint8_t sh3_base_device::scssr_r(offs_t offset, uint8_t mem_mask)
void sh3_base_device::scssr_w(offs_t offset, uint8_t data, uint8_t mem_mask)
{
m_scssr = (m_scssr | (data & 1)) & (data | 6);
+ if (!(m_scssr & 0x80))
+ {
+ //printf("%c", m_sctdr);
+ m_scssr |= 0x80;
+ }
logerror("'%s' (%08x): SCI unmapped internal write %02x & %02x (SCSSR)\n", tag(), m_sh2_state->pc, data, mem_mask);
}
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;
diff --git a/src/devices/imagedev/cassette.cpp b/src/devices/imagedev/cassette.cpp
index 21cb7e8bd10..cef022b57a5 100644
--- a/src/devices/imagedev/cassette.cpp
+++ b/src/devices/imagedev/cassette.cpp
@@ -40,8 +40,8 @@ cassette_image_device::cassette_image_device(const machine_config &mconfig, cons
device_sound_interface(mconfig, *this),
m_cassette(nullptr),
m_state(CASSETTE_STOPPED),
- m_position(0),
- m_position_time(0),
+ m_position(0.0),
+ m_position_time(0.0),
m_value(0),
m_channel(0),
m_speed(0),
@@ -71,8 +71,8 @@ cassette_image_device::~cassette_image_device()
void cassette_image_device::device_config_complete()
{
m_extension_list[0] = '\0';
- for (int i = 0; m_formats[i]; i++ )
- image_specify_extension( m_extension_list, 256, m_formats[i]->extensions );
+ for (int i = 0; m_formats[i]; i++)
+ image_specify_extension(m_extension_list, 256, m_formats[i]->extensions);
}
@@ -86,9 +86,9 @@ void cassette_image_device::update()
if (!is_stopped() && motor_on())
{
- double new_position = m_position + (cur_time - m_position_time)*m_speed*m_direction;
+ double new_position = m_position + (cur_time - m_position_time) * m_speed * m_direction;
- switch (int(m_state & CASSETTE_MASK_UISTATE)) // cast to int to suppress unhandled enum value warning
+ switch (m_state & CASSETTE_MASK_UISTATE)
{
case CASSETTE_RECORD:
m_cassette->put_sample(m_channel, m_position, new_position - m_position, m_value);
@@ -105,13 +105,16 @@ void cassette_image_device::update()
m_state = (m_state & ~CASSETTE_MASK_UISTATE) | CASSETTE_STOPPED;
new_position = length;
}
- else if (new_position < 0)
+ else if (new_position < 0.0)
{
m_state = (m_state & ~CASSETTE_MASK_UISTATE) | CASSETTE_STOPPED;
- new_position = 0;
+ new_position = 0.0;
}
}
break;
+
+ default:
+ break;
}
m_position = new_position;
}
@@ -138,12 +141,11 @@ void cassette_image_device::change_state(cassette_state state, cassette_state ma
double cassette_image_device::input()
{
update();
- int32_t sample = m_value;
- double double_value = sample / (double(0x7FFFFFFF));
+ double value = m_value / (double(0x7fffffff));
- LOGMASKED(LOG_DETAIL, "cassette_input(): time_index=%g value=%g\n", m_position, double_value);
+ LOGMASKED(LOG_DETAIL, "cassette_input(): time_index=%g value=%g\n", m_position, value);
- return double_value;
+ return value;
}
@@ -154,10 +156,8 @@ void cassette_image_device::output(double value)
{
update();
- value = std::min(value, 1.0);
- value = std::max(value, -1.0);
-
- m_value = int32_t(value * 0x7FFFFFFF);
+ value = std::clamp(value, -1.0, 1.0);
+ m_value = int32_t(value * 0x7fffffff);
}
}
@@ -167,7 +167,7 @@ double cassette_image_device::get_position()
double position = m_position;
if (!is_stopped() && motor_on())
- position += (machine().time().as_double() - m_position_time)*m_speed*m_direction;
+ position += (machine().time().as_double() - m_position_time) * m_speed * m_direction;
return position;
}
@@ -206,7 +206,8 @@ void cassette_image_device::seek(double time, int origin)
double length = get_length();
- switch(origin) {
+ switch (origin)
+ {
case SEEK_SET:
break;
@@ -219,14 +220,8 @@ void cassette_image_device::seek(double time, int origin)
break;
}
- /* clip position into legal bounds */
- if (time < 0)
- time = 0;
- else
- if (time > length)
- time = length;
-
- m_position = time;
+ // clip position into legal bounds
+ m_position = std::clamp(time, 0.0, length);
}
@@ -235,14 +230,25 @@ void cassette_image_device::seek(double time, int origin)
cassette device init/load/unload/specify
*********************************************************************/
+// allow save_item on a non-fundamental type
+ALLOW_SAVE_TYPE(cassette_state);
+
void cassette_image_device::device_start()
{
- /* set to default state */
+ // set to default state
m_cassette = nullptr;
m_state = m_default_state;
m_value = 0;
- stream_alloc(0, m_stereo? 2:1, machine().sample_rate());
+ stream_alloc(0, m_stereo ? 2 : 1, machine().sample_rate());
+
+ save_item(NAME(m_state));
+ save_item(NAME(m_position));
+ save_item(NAME(m_position_time));
+ save_item(NAME(m_value));
+ save_item(NAME(m_channel));
+ save_item(NAME(m_speed));
+ save_item(NAME(m_direction));
}
const software_list_loader &cassette_image_device::get_software_list_loader() const
@@ -267,6 +273,7 @@ bool cassette_image_device::has_any_extension(std::string_view candidate_extensi
for (std::string extension; std::getline(extension_stream, extension, separator);)
if (is_filetype(extension))
return true;
+
return false;
}
@@ -277,7 +284,7 @@ std::error_condition cassette_image_device::internal_load(bool is_create)
interface(image);
check_for_file();
- if (is_create || (length()==0)) // empty existing images are fine to write over.
+ if (is_create || (length() == 0)) // empty existing images are fine to write over.
{
auto io = util::random_read_write_fill(image_core_file(), 0x00);
if (io)
@@ -329,19 +336,19 @@ std::error_condition cassette_image_device::internal_load(bool is_create)
retry = true;
}
}
- while(retry);
+ while (retry);
}
if (err == cassette_image::error::SUCCESS)
{
- /* set to default state, but only change the UI state */
+ // set to default state, but only change the UI state
change_state(m_default_state, CASSETTE_MASK_UISTATE);
- /* reset the position */
+ // reset the position
m_position = 0.0;
m_position_time = machine().time().as_double();
- /* default channel to 0, speed multiplier to 1 */
+ // default channel to 0, speed multiplier to 1
m_channel = 0;
m_speed = 1;
m_direction = 1;
@@ -377,14 +384,14 @@ std::error_condition cassette_image_device::internal_load(bool is_create)
void cassette_image_device::call_unload()
{
- /* if we are recording, write the value to the image */
+ // if we are recording, write the value to the image
if ((m_state & CASSETTE_MASK_UISTATE) == CASSETTE_RECORD)
update();
- /* close out the cassette */
+ // close out the cassette
m_cassette.reset();
- /* set to default state, but only change the UI state */
+ // set to default state, but only change the UI state
change_state(CASSETTE_STOPPED, CASSETTE_MASK_UISTATE);
}
@@ -415,8 +422,8 @@ std::string cassette_image_device::call_display()
// play or record
const char *status_icon = (uistate == CASSETTE_PLAY)
- ? u8"\u25BA"
- : u8"\u25CF";
+ ? u8"\u25ba"
+ : u8"\u25cf";
// create information string
result = string_format("%s %s %02d:%02d (%04d) [%02d:%02d (%04d)]",
@@ -448,33 +455,29 @@ std::string cassette_image_device::call_display()
// Cassette sound
//-------------------------------------------------
-void cassette_image_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void cassette_image_device::sound_stream_update(sound_stream &stream)
{
cassette_state state = get_state() & (CASSETTE_MASK_UISTATE | CASSETTE_MASK_MOTOR | CASSETTE_MASK_SPEAKER);
if (exists() && (state == (CASSETTE_PLAY | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED)))
{
+ int samples = stream.samples();
cassette_image *cassette = get_image();
double time_index = get_position();
- double duration = ((double) outputs[0].samples()) / outputs[0].sample_rate();
+ double duration = ((double) samples) / stream.sample_rate();
- if (m_samples.size() < outputs[0].samples())
- m_samples.resize(outputs[0].samples());
+ if (m_samples.size() < samples)
+ m_samples.resize(samples);
const cassette_image::Info info = cassette->get_info();
- for (int ch = 0; ch < outputs.size(); ch++)
+ for (int ch = 0; ch < stream.output_count(); ch++)
{
if (ch < info.channels)
- cassette->get_samples(ch, time_index, duration, outputs[0].samples(), 2, &m_samples[0], cassette_image::WAVEFORM_16BIT);
+ cassette->get_samples(ch, time_index, duration, samples, 2, &m_samples[0], cassette_image::WAVEFORM_16BIT);
else
- cassette->get_samples(0, time_index, duration, outputs[0].samples(), 2, &m_samples[0], cassette_image::WAVEFORM_16BIT);
- for (int sampindex = 0; sampindex < outputs[ch].samples(); sampindex++)
- outputs[ch].put_int(sampindex, m_samples[sampindex], 32768);
+ cassette->get_samples(0, time_index, duration, samples, 2, &m_samples[0], cassette_image::WAVEFORM_16BIT);
+ for (int sampindex = 0; sampindex < samples; sampindex++)
+ stream.put_int(ch, sampindex, m_samples[sampindex], 32768);
}
}
- else
- {
- for (int ch = 0; ch < outputs.size(); ch++)
- outputs[ch].fill(0);
- }
}
diff --git a/src/devices/imagedev/cassette.h b/src/devices/imagedev/cassette.h
index 60bd0357324..88b63caf38b 100644
--- a/src/devices/imagedev/cassette.h
+++ b/src/devices/imagedev/cassette.h
@@ -16,7 +16,7 @@
#include "formats/cassimg.h"
-enum cassette_state
+enum cassette_state : uint8_t
{
// this part of the state is controlled by the UI
CASSETTE_STOPPED = 0,
@@ -103,7 +103,7 @@ public:
void seek(double time, int origin);
// 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;
device_sound_interface& set_stereo() { m_stereo = true; return *this; }
protected:
@@ -129,8 +129,8 @@ private:
char m_extension_list[256];
const cassette_image::Format* const *m_formats;
const cassette_image::Options *m_create_opts;
- cassette_state m_default_state;
- const char * m_interface;
+ cassette_state m_default_state;
+ const char * m_interface;
std::error_condition internal_load(bool is_create);
bool has_any_extension(std::string_view candidate_extensions) const;
diff --git a/src/devices/imagedev/floppy.cpp b/src/devices/imagedev/floppy.cpp
index 8dd70d5fd62..b6f3e2b69b5 100644
--- a/src/devices/imagedev/floppy.cpp
+++ b/src/devices/imagedev/floppy.cpp
@@ -1595,18 +1595,17 @@ void floppy_sound_device::step(int zone)
// sound_stream_update - update the sound stream
//-------------------------------------------------
-void floppy_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void floppy_sound_device::sound_stream_update(sound_stream &stream)
{
// We are using only one stream, unlike the parent class
// Also, there is no need for interpolation, as we only expect
// one sample rate of 44100 for all samples
int16_t out;
- auto &samplebuffer = outputs[0];
int m_idx = 0;
int sampleend = 0;
- for (int sampindex = 0; sampindex < samplebuffer.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
out = 0;
@@ -1700,7 +1699,7 @@ void floppy_sound_device::sound_stream_update(sound_stream &stream, std::vector<
}
// Write to the stream buffer
- samplebuffer.put_int(sampindex, out, 32768);
+ stream.put_int(0, sampindex, out, 32768);
}
}
diff --git a/src/devices/imagedev/floppy.h b/src/devices/imagedev/floppy.h
index 8e03f9438a7..2e7b0de3b50 100644
--- a/src/devices/imagedev/floppy.h
+++ b/src/devices/imagedev/floppy.h
@@ -413,7 +413,7 @@ protected:
private:
// device_sound_interface 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;
sound_stream* m_sound;
int m_step_base;
diff --git a/src/devices/machine/acorn_vidc.cpp b/src/devices/machine/acorn_vidc.cpp
index cd428e3fc01..dd6137c75b9 100644
--- a/src/devices/machine/acorn_vidc.cpp
+++ b/src/devices/machine/acorn_vidc.cpp
@@ -65,8 +65,7 @@ acorn_vidc10_device::acorn_vidc10_device(const machine_config &mconfig, device_t
, m_sound_mode(false)
, m_dac(*this, "dac%u", 0)
, m_dac_type(dac_type)
- , m_lspeaker(*this, "lspeaker")
- , m_rspeaker(*this, "rspeaker")
+ , m_speaker(*this, "speaker")
, m_vblank_cb(*this)
, m_sound_drq_cb(*this)
, m_pixel_clock(0)
@@ -110,12 +109,11 @@ device_memory_interface::space_config_vector acorn_vidc10_device::memory_space_c
void acorn_vidc10_device::device_add_mconfig(machine_config &config)
{
- SPEAKER(config, m_lspeaker).front_left();
- SPEAKER(config, m_rspeaker).front_right();
+ SPEAKER(config, m_speaker, 2).front();
for (int i = 0; i < m_sound_max_channels; i++)
{
// custom DAC
- DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_dac[i], 0).add_route(0, m_lspeaker, m_sound_input_gain).add_route(0, m_rspeaker, m_sound_input_gain);
+ DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_dac[i], 0).add_route(0, m_speaker, m_sound_input_gain, 0).add_route(0, m_speaker, m_sound_input_gain, 1);
}
}
@@ -405,9 +403,8 @@ inline void acorn_vidc10_device::refresh_stereo_image(u8 channel)
const float left_gain[8] = { 1.0f, 2.0f, 1.66f, 1.34f, 1.0f, 0.66f, 0.34f, 0.0f };
const float right_gain[8] = { 1.0f, 0.0f, 0.34f, 0.66f, 1.0f, 1.34f, 1.66f, 2.0f };
- m_lspeaker->set_input_gain(channel, left_gain[m_stereo_image[channel]] * m_sound_input_gain);
- m_rspeaker->set_input_gain(channel, right_gain[m_stereo_image[channel]] * m_sound_input_gain);
- //printf("%d %f %f\n",channel,m_lspeaker->input(channel).gain(),m_rspeaker->input(channel).gain());
+ m_speaker->set_input_gain(0, left_gain[m_stereo_image[channel]] * m_sound_input_gain);
+ m_speaker->set_input_gain(1, right_gain[m_stereo_image[channel]] * m_sound_input_gain);
}
@@ -582,14 +579,14 @@ void arm_vidc20_device::device_add_mconfig(machine_config &config)
for (int i = 0; i < m_sound_max_channels; i++)
{
m_dac[i]->reset_routes();
- m_dac[i]->add_route(0, m_lspeaker, 0.0);
- m_dac[i]->add_route(0, m_rspeaker, 0.0);
+ m_dac[i]->add_route(0, m_speaker, 0.0, 0);
+ m_dac[i]->add_route(0, m_speaker, 0.0, 1);
}
// For simplicity we separate DACs for 32-bit mode
// TODO: how stereo image copes with this if at all?
- DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_dac32[0], 0).add_route(ALL_OUTPUTS, m_lspeaker, 0.25);
- DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_dac32[1], 0).add_route(ALL_OUTPUTS, m_rspeaker, 0.25);
+ DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_dac32[0], 0).add_route(ALL_OUTPUTS, m_speaker, 0.25, 0);
+ DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_dac32[1], 0).add_route(ALL_OUTPUTS, m_speaker, 0.25, 1);
}
void arm_vidc20_device::device_config_complete()
diff --git a/src/devices/machine/acorn_vidc.h b/src/devices/machine/acorn_vidc.h
index 23f8564f94a..49b5c0dca54 100644
--- a/src/devices/machine/acorn_vidc.h
+++ b/src/devices/machine/acorn_vidc.h
@@ -90,8 +90,7 @@ protected:
required_device_array<dac_16bit_r2r_twos_complement_device, 8> m_dac;
int m_dac_type;
- required_device<speaker_device> m_lspeaker;
- required_device<speaker_device> m_rspeaker;
+ required_device<speaker_device> m_speaker;
virtual void refresh_stereo_image(u8 channel);
const int m_sound_max_channels = 8;
diff --git a/src/devices/machine/cr511b.cpp b/src/devices/machine/cr511b.cpp
index dc3fa967ba5..7f52ced1e20 100644
--- a/src/devices/machine/cr511b.cpp
+++ b/src/devices/machine/cr511b.cpp
@@ -45,7 +45,7 @@ DEFINE_DEVICE_TYPE(CR511B, cr511b_device, "cr511b", "CR-511-B CD-ROM drive")
cr511b_device::cr511b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
cdrom_image_device(mconfig, CR511B, tag, owner, clock),
- device_mixer_interface(mconfig, *this, 2),
+ device_mixer_interface(mconfig, *this),
m_cdda(*this, "cdda"),
m_stch_cb(*this),
m_sten_cb(*this),
@@ -72,8 +72,8 @@ cr511b_device::cr511b_device(const machine_config &mconfig, const char *tag, dev
void cr511b_device::device_add_mconfig(machine_config &config)
{
CDDA(config, m_cdda);
- m_cdda->add_route(0, DEVICE_SELF, 1.0, AUTO_ALLOC_INPUT, 0);
- m_cdda->add_route(1, DEVICE_SELF, 1.0, AUTO_ALLOC_INPUT, 1);
+ m_cdda->add_route(0, DEVICE_SELF, 1.0, 0);
+ m_cdda->add_route(1, DEVICE_SELF, 1.0, 1);
m_cdda->set_cdrom_tag(*this);
m_cdda->audio_end_cb().set(FUNC(cr511b_device::audio_end_cb));
}
diff --git a/src/devices/machine/generalplus_gpl16250soc.cpp b/src/devices/machine/generalplus_gpl16250soc.cpp
index dc4505ce9ff..ec915385d99 100644
--- a/src/devices/machine/generalplus_gpl16250soc.cpp
+++ b/src/devices/machine/generalplus_gpl16250soc.cpp
@@ -27,7 +27,7 @@ DEFINE_DEVICE_TYPE(GCM394, sunplus_gcm394_device, "gcm394", "GeneralPlus GPL1625
sunplus_gcm394_base_device::sunplus_gcm394_base_device(const machine_config& mconfig, device_type type, const char* tag, device_t* owner, uint32_t clock, address_map_constructor internal) :
unsp_20_device(mconfig, type, tag, owner, clock, internal),
- device_mixer_interface(mconfig, *this, 2),
+ device_mixer_interface(mconfig, *this),
m_screen(*this, finder_base::DUMMY_TAG),
m_spg_video(*this, "spgvideo"),
m_spg_audio(*this, "spgaudio"),
@@ -1845,8 +1845,8 @@ void sunplus_gcm394_base_device::device_add_mconfig(machine_config &config)
m_spg_audio->write_irq_callback().set(FUNC(sunplus_gcm394_base_device::audioirq_w));
m_spg_audio->space_read_callback().set(FUNC(sunplus_gcm394_base_device::read_space));
- m_spg_audio->add_route(0, *this, 1.0, AUTO_ALLOC_INPUT, 0);
- m_spg_audio->add_route(1, *this, 1.0, AUTO_ALLOC_INPUT, 1);
+ m_spg_audio->add_route(0, *this, 1.0, 0);
+ m_spg_audio->add_route(1, *this, 1.0, 1);
GCM394_VIDEO(config, m_spg_video, DERIVED_CLOCK(1, 1), DEVICE_SELF, m_screen);
m_spg_video->write_video_irq_callback().set(FUNC(sunplus_gcm394_base_device::videoirq_w));
diff --git a/src/devices/machine/gt913_snd.cpp b/src/devices/machine/gt913_snd.cpp
index 803e6443278..1965b798432 100644
--- a/src/devices/machine/gt913_snd.cpp
+++ b/src/devices/machine/gt913_snd.cpp
@@ -102,9 +102,9 @@ void gt913_sound_device::device_reset()
std::memset(m_voices, 0, sizeof(m_voices));
}
-void gt913_sound_device::sound_stream_update(sound_stream& stream, std::vector<read_stream_view> const& inputs, std::vector<write_stream_view>& outputs)
+void gt913_sound_device::sound_stream_update(sound_stream& stream)
{
- for (int i = 0; i < outputs[0].samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
s64 left = 0, right = 0;
@@ -115,8 +115,8 @@ void gt913_sound_device::sound_stream_update(sound_stream& stream, std::vector<r
mix_sample(voice, left, right);
}
- outputs[0].put_int_clamp(i, (left * m_gain) >> 27, 32678);
- outputs[1].put_int_clamp(i, (right * m_gain) >> 27, 32768);
+ stream.put_int_clamp(0, i, (left * m_gain) >> 27, 32678);
+ stream.put_int_clamp(1, i, (right * m_gain) >> 27, 32768);
}
}
diff --git a/src/devices/machine/gt913_snd.h b/src/devices/machine/gt913_snd.h
index 790eca81196..ba05cabe470 100644
--- a/src/devices/machine/gt913_snd.h
+++ b/src/devices/machine/gt913_snd.h
@@ -38,7 +38,7 @@ protected:
virtual void device_reset() override ATTR_COLD;
// device_sound_interface 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;
// device_rom_interface overrides
virtual void rom_bank_pre_change() override;
diff --git a/src/devices/machine/k054321.cpp b/src/devices/machine/k054321.cpp
index 6a362f655b2..d53fd8d346f 100644
--- a/src/devices/machine/k054321.cpp
+++ b/src/devices/machine/k054321.cpp
@@ -59,8 +59,7 @@ void k054321_device::sound_map(address_map &map)
k054321_device::k054321_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, K054321, tag, owner, clock),
- m_left(*this, finder_base::DUMMY_TAG),
- m_right(*this, finder_base::DUMMY_TAG),
+ m_speaker(*this, finder_base::DUMMY_TAG),
m_soundlatch(*this, "soundlatch%u", 0)
{
}
@@ -68,17 +67,12 @@ k054321_device::k054321_device(const machine_config &mconfig, const char *tag, d
void k054321_device::device_start()
{
// make sure that device_sound_interface is configured
- if (!m_left->inputs() && !m_right->inputs())
+ if (!m_speaker->inputs())
throw device_missing_dependencies();
// remember initial input gains
- m_left_gains = std::make_unique<float[]>(m_left->inputs());
- m_right_gains = std::make_unique<float[]>(m_right->inputs());
-
- for (int i = 0; i < m_left->inputs(); i++)
- m_left_gains[i] = m_left->input_gain(i);
- for (int i = 0; i < m_right->inputs(); i++)
- m_right_gains[i] = m_right->input_gain(i);
+ m_left_gain = m_speaker->input_gain(0);
+ m_right_gain = m_speaker->input_gain(1);
// register for savestates
save_item(NAME(m_volume));
@@ -133,8 +127,6 @@ void k054321_device::propagate_volume()
{
double vol = pow(2, (m_volume - 40)/10.0);
- for (int i = 0; i < m_left->inputs(); i++)
- m_left->set_input_gain(i, m_active & 2 ? vol * m_left_gains[i] : 0.0);
- for (int i = 0; i < m_right->inputs(); i++)
- m_right->set_input_gain(i, m_active & 1 ? vol * m_right_gains[i] : 0.0);
+ m_speaker->set_input_gain(0, m_active & 2 ? vol * m_left_gain : 0.0);
+ m_speaker->set_input_gain(1, m_active & 1 ? vol * m_right_gain : 0.0);
}
diff --git a/src/devices/machine/k054321.h b/src/devices/machine/k054321.h
index 9fba2f93c18..3d4739bf1a1 100644
--- a/src/devices/machine/k054321.h
+++ b/src/devices/machine/k054321.h
@@ -11,16 +11,15 @@
class k054321_device : public device_t
{
public:
- template<typename T, typename U>
- k054321_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&left, U &&right) :
- k054321_device(mconfig, tag, owner, 0)
+ k054321_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+
+ template<typename T>
+ k054321_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&speaker) :
+ k054321_device(mconfig, tag, owner)
{
- m_left.set_tag(std::forward<T>(left));
- m_right.set_tag(std::forward<U>(right));
+ m_speaker.set_tag(std::forward<T>(speaker));
}
- k054321_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
void main_map(address_map &map) ATTR_COLD;
void sound_map(address_map &map) ATTR_COLD;
@@ -30,12 +29,10 @@ protected:
virtual void device_add_mconfig(machine_config &config) override ATTR_COLD;
private:
- required_device<device_sound_interface> m_left;
- required_device<device_sound_interface> m_right;
+ required_device<device_sound_interface> m_speaker;
required_device_array<generic_latch_8_device, 3> m_soundlatch;
- std::unique_ptr<float[]> m_left_gains;
- std::unique_ptr<float[]> m_right_gains;
+ float m_left_gain, m_right_gain;
u8 m_volume;
u8 m_active;
diff --git a/src/devices/machine/laserdsc.cpp b/src/devices/machine/laserdsc.cpp
index e1033518cb5..dc9fd2f5064 100644
--- a/src/devices/machine/laserdsc.cpp
+++ b/src/devices/machine/laserdsc.cpp
@@ -392,7 +392,7 @@ TIMER_CALLBACK_MEMBER(laserdisc_device::fetch_vbi_data)
// laserdiscs
//-------------------------------------------------
-void laserdisc_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void laserdisc_device::sound_stream_update(sound_stream &stream)
{
// compute AND values based on the squelch
int16_t leftand = (m_audiosquelch & 1) ? 0x0000 : 0xffff;
@@ -403,17 +403,7 @@ void laserdisc_device::sound_stream_update(sound_stream &stream, std::vector<rea
if (samples_avail < 0)
samples_avail += m_audiobufsize;
- // if no attached ld, just clear the buffers
- auto &dst0 = outputs[0];
- auto &dst1 = outputs[1];
- if (samples_avail < outputs[0].samples())
- {
- dst0.fill(0);
- dst1.fill(0);
- }
-
- // otherwise, stream from our buffer
- else
+ if (samples_avail >= stream.samples())
{
int16_t *buffer0 = &m_audiobuffer[0][0];
int16_t *buffer1 = &m_audiobuffer[1][0];
@@ -421,10 +411,10 @@ void laserdisc_device::sound_stream_update(sound_stream &stream, std::vector<rea
// copy samples, clearing behind us as we go
int sampindex;
- for (sampindex = 0; sampout != m_audiobufin && sampindex < outputs[0].samples(); sampindex++)
+ for (sampindex = 0; sampout != m_audiobufin && sampindex < stream.samples(); sampindex++)
{
- dst0.put_int(sampindex, buffer0[sampout] & leftand, 32768);
- dst1.put_int(sampindex, buffer1[sampout] & rightand, 32768);
+ stream.put_int(0, sampindex, buffer0[sampout] & leftand, 32768);
+ stream.put_int(1, sampindex, buffer1[sampout] & rightand, 32768);
buffer0[sampout] = 0;
buffer1[sampout] = 0;
sampout++;
@@ -434,16 +424,16 @@ void laserdisc_device::sound_stream_update(sound_stream &stream, std::vector<rea
m_audiobufout = sampout;
// clear out the rest of the buffer
- if (sampindex < outputs[0].samples())
+ if (sampindex < stream.samples())
{
sampout = (m_audiobufout == 0) ? m_audiobufsize - 1 : m_audiobufout - 1;
s32 fill0 = buffer0[sampout] & leftand;
s32 fill1 = buffer1[sampout] & rightand;
- for ( ; sampindex < outputs[0].samples(); sampindex++)
+ for ( ; sampindex < stream.samples(); sampindex++)
{
- dst0.put_int(sampindex, fill0, 32768);
- dst1.put_int(sampindex, fill1, 32768);
+ stream.put_int(0, sampindex, fill0, 32768);
+ stream.put_int(1, sampindex, fill1, 32768);
}
}
}
diff --git a/src/devices/machine/laserdsc.h b/src/devices/machine/laserdsc.h
index 04e980ae64e..f84cd47a06a 100644
--- a/src/devices/machine/laserdsc.h
+++ b/src/devices/machine/laserdsc.h
@@ -213,7 +213,7 @@ protected:
virtual void device_validity_check(validity_checker &valid) const override;
// device_sound_interface 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 TIMER_CALLBACK_MEMBER(fetch_vbi_data);
diff --git a/src/devices/machine/mc6852.cpp b/src/devices/machine/mc6852.cpp
index e54d5d3d4bf..9872e7dc93a 100644
--- a/src/devices/machine/mc6852.cpp
+++ b/src/devices/machine/mc6852.cpp
@@ -410,14 +410,17 @@ void mc6852_device::write(offs_t offset, uint8_t data)
if (available > 0)
{
LOG("MC6852 Transmit FIFO %02x\n", data);
- if (!m_tx_pull_mode && !m_tx_active) {
+ if (!m_tx_pull_mode && !m_tx_active)
+ {
// transfer is idle: this emulates moving the first byte
// into the shift register, and kicking off transmission.
// tra_complete() will be called when the byte has been
// sent.
m_tx_active = true;
transmit_register_setup(data);
- } else {
+ }
+ else
+ {
m_tx_fifo.push(data);
available--;
}
diff --git a/src/devices/machine/netlist.cpp b/src/devices/machine/netlist.cpp
index bba035194f3..c9d91704cce 100644
--- a/src/devices/machine/netlist.cpp
+++ b/src/devices/machine/netlist.cpp
@@ -813,16 +813,16 @@ void netlist_mame_stream_output_device::device_reset()
LOGDEVCALLS("reset %s\n", name());
}
-void netlist_mame_stream_output_device::sound_update_fill(write_stream_view &target)
+void netlist_mame_stream_output_device::sound_update_fill(sound_stream &stream, int output)
{
- if (target.samples() < m_buffer.size())
- osd_printf_warning("sound %s: samples %d less bufsize %d\n", name(), target.samples(), m_buffer.size());
+ if (stream.samples() < m_buffer.size())
+ osd_printf_warning("sound %s: samples %d less bufsize %d\n", name(), stream.samples(), m_buffer.size());
int sampindex;
for (sampindex = 0; sampindex < m_buffer.size(); sampindex++)
- target.put(sampindex, m_buffer[sampindex]);
- if (sampindex < target.samples())
- target.fill(m_cur, sampindex);
+ stream.put(output, sampindex, m_buffer[sampindex]);
+ if (sampindex < stream.samples())
+ stream.fill(output, m_cur, sampindex);
}
@@ -860,7 +860,7 @@ void netlist_mame_stream_output_device::process(netlist::netlist_time_ext tim, n
// throw emu_fatalerror("sound %s: pos %d exceeded bufsize %d\n", name().c_str(), pos, m_bufsize);
while (m_buffer.size() < pos )
{
- m_buffer.push_back(static_cast<stream_buffer::sample_t>(m_cur));
+ m_buffer.push_back(static_cast<sound_stream::sample_t>(m_cur));
}
m_cur = val;
@@ -1396,7 +1396,7 @@ void netlist_mame_sound_device::device_start()
m_inbuffer.resize(m_in.size());
/* initialize the stream(s) */
- m_stream = stream_alloc(m_in.size(), m_out.size(), m_sound_clock, STREAM_DISABLE_INPUT_RESAMPLING);
+ m_stream = stream_alloc(m_in.size(), m_out.size(), m_sound_clock);
LOGDEVCALLS("sound device_start exit\n");
}
@@ -1439,23 +1439,23 @@ void netlist_mame_sound_device::update_to_current_time()
LOGTIMING("%s : %f us before machine time\n", this->name(), (cur - mtime).as_double() * 1000000.0);
}
-void netlist_mame_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void netlist_mame_sound_device::sound_stream_update(sound_stream &stream)
{
for (auto &e : m_in)
{
- auto clock_period = inputs[e.first].sample_period();
+ auto clock_period = stream.sample_period();
auto sample_time = netlist::netlist_time::from_raw(static_cast<netlist::netlist_time::internal_type>(nltime_from_attotime(clock_period).as_raw()));
- m_inbuffer[e.first] = netlist_mame_sound_input_buffer(inputs[e.first]);
- e.second->buffer_reset(sample_time, m_inbuffer[e.first].samples(), &m_inbuffer[e.first]);
+ m_inbuffer[e.first] = netlist_mame_sound_input_buffer(stream, e.first);
+ e.second->buffer_reset(sample_time, stream.samples(), &m_inbuffer[e.first]);
}
- int samples = outputs[0].samples();
+ int samples = stream.samples();
LOGDEBUG("samples %d\n", samples);
// end_time() is the time at the END of the last sample we're generating
// however, the sample value is the value at the START of that last sample,
// so subtract one sample period so that we only process up to the minimum
- auto nl_target_time = nltime_from_attotime(outputs[0].end_time() - outputs[0].sample_period());
+ auto nl_target_time = nltime_from_attotime(stream.end_time() - stream.sample_period());
auto nltime(netlist().exec().time());
if (nltime < nl_target_time)
@@ -1465,7 +1465,7 @@ void netlist_mame_sound_device::sound_stream_update(sound_stream &stream, std::v
for (auto &e : m_out)
{
- e.second->sound_update_fill(outputs[e.first]);
+ e.second->sound_update_fill(stream, e.first);
e.second->buffer_reset(nl_target_time);
}
diff --git a/src/devices/machine/netlist.h b/src/devices/machine/netlist.h
index 51f5bdeb09f..67b6b7d143c 100644
--- a/src/devices/machine/netlist.h
+++ b/src/devices/machine/netlist.h
@@ -249,19 +249,20 @@ private:
// ----------------------------------------------------------------------------------------
// netlist_mame_sound_input_buffer
//
-// This is a wrapper device to provide operator[] on read_stream_view.
+// This is a wrapper device to provide operator[] on an input stream.
// ----------------------------------------------------------------------------------------
-class netlist_mame_sound_input_buffer : public read_stream_view
+class netlist_mame_sound_input_buffer
{
public:
- netlist_mame_sound_input_buffer() :
- read_stream_view() { }
+ sound_stream *m_stream = nullptr;
+ int m_stream_input = 0;
- netlist_mame_sound_input_buffer(read_stream_view const &src) :
- read_stream_view(src) { }
+ netlist_mame_sound_input_buffer() {}
- stream_buffer::sample_t operator[](std::size_t index) { return get(index); }
+ netlist_mame_sound_input_buffer(sound_stream &stream, int input) : m_stream(&stream), m_stream_input(input) { }
+
+ sound_stream::sample_t operator[](std::size_t index) { return m_stream->get(m_stream_input, index); }
};
// ----------------------------------------------------------------------------------------
@@ -302,7 +303,7 @@ protected:
// device_t overrides
virtual void device_start() override ATTR_COLD;
// device_sound_interface 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 void device_validity_check(validity_checker &valid) const override;
//virtual void device_reset() override ATTR_COLD;
@@ -634,7 +635,7 @@ public:
m_buffer.clear();
}
- void sound_update_fill(write_stream_view &target);
+ void sound_update_fill(sound_stream &stream, int output);
void set_sample_time(netlist::netlist_time t) { m_sample_time = t; }
@@ -649,7 +650,7 @@ private:
uint32_t m_channel;
const char * m_out_name;
- std::vector<stream_buffer::sample_t> m_buffer;
+ std::vector<sound_stream::sample_t> m_buffer;
double m_cur;
netlist::netlist_time m_sample_time;
diff --git a/src/devices/machine/pxa255.cpp b/src/devices/machine/pxa255.cpp
index f11043af4e0..2c06dd618a7 100644
--- a/src/devices/machine/pxa255.cpp
+++ b/src/devices/machine/pxa255.cpp
@@ -265,11 +265,10 @@ void pxa255_periphs_device::device_add_mconfig(machine_config &config)
PALETTE(config, m_palette).set_entries(256);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- DMADAC(config, m_dmadac[0]).add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- DMADAC(config, m_dmadac[1]).add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ DMADAC(config, m_dmadac[0]).add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ DMADAC(config, m_dmadac[1]).add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
}
/*
diff --git a/src/devices/machine/s2636.cpp b/src/devices/machine/s2636.cpp
index 10a5a2e2be8..d2576b07f1f 100644
--- a/src/devices/machine/s2636.cpp
+++ b/src/devices/machine/s2636.cpp
@@ -441,10 +441,9 @@ void s2636_device::write_intack(int state)
// sound_stream_update - generate audio output
//-------------------------------------------------
-void s2636_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void s2636_device::sound_stream_update(sound_stream &stream)
{
- auto &buffer = outputs[0];
- for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
if (!m_sample_cnt)
{
@@ -460,7 +459,7 @@ void s2636_device::sound_stream_update(sound_stream &stream, std::vector<read_st
}
}
- buffer.put(sampindex, m_sound_lvl ? 1.0 : 0.0);
+ stream.put(0, sampindex, m_sound_lvl ? 1.0 : 0.0);
m_sample_cnt--;
}
}
diff --git a/src/devices/machine/s2636.h b/src/devices/machine/s2636.h
index 25c3d89f761..4be53bc73b1 100644
--- a/src/devices/machine/s2636.h
+++ b/src/devices/machine/s2636.h
@@ -60,7 +60,7 @@ protected:
virtual void device_start() 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;
private:
enum
diff --git a/src/devices/machine/spg110.cpp b/src/devices/machine/spg110.cpp
index 6afa6e8a4d3..1d3ac8260a0 100644
--- a/src/devices/machine/spg110.cpp
+++ b/src/devices/machine/spg110.cpp
@@ -18,7 +18,7 @@ DEFINE_DEVICE_TYPE(SPG110, spg110_device, "spg110", "SPG110 System-on-a-Chip")
spg110_device::spg110_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, address_map_constructor internal) :
unsp_device(mconfig, type, tag, owner, clock, internal),
- device_mixer_interface(mconfig, *this, 2),
+ device_mixer_interface(mconfig, *this),
m_screen(*this, finder_base::DUMMY_TAG),
m_spg_io(*this, "spg_io"),
m_spg_video(*this, "spg_video"),
@@ -132,8 +132,8 @@ void spg110_device::device_add_mconfig(machine_config &config)
m_spg_audio->write_irq_callback().set(FUNC(spg110_device::audioirq_w));
m_spg_audio->space_read_callback().set(FUNC(spg110_device::space_r));
- m_spg_audio->add_route(0, *this, 1.0, AUTO_ALLOC_INPUT, 0);
- m_spg_audio->add_route(1, *this, 1.0, AUTO_ALLOC_INPUT, 1);
+ m_spg_audio->add_route(0, *this, 1.0, 0);
+ m_spg_audio->add_route(1, *this, 1.0, 1);
}
void spg110_device::internal_map(address_map &map)
diff --git a/src/devices/machine/spg2xx.cpp b/src/devices/machine/spg2xx.cpp
index 09e0e0c6f39..cf5988f995f 100644
--- a/src/devices/machine/spg2xx.cpp
+++ b/src/devices/machine/spg2xx.cpp
@@ -21,7 +21,7 @@ DEFINE_DEVICE_TYPE(SPG28X, spg28x_device, "spg28x", "SPG280-series Syste
spg2xx_device::spg2xx_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint16_t sprite_limit, address_map_constructor internal) :
unsp_device(mconfig, type, tag, owner, clock, internal),
- device_mixer_interface(mconfig, *this, 2),
+ device_mixer_interface(mconfig, *this),
m_spg_audio(*this, "spgaudio"),
m_spg_io(*this, "spgio"),
m_spg_sysdma(*this, "spgsysdma"),
@@ -193,8 +193,8 @@ void spg24x_device::device_add_mconfig(machine_config &config)
m_spg_audio->channel_irq_callback().set(FUNC(spg24x_device::audiochirq_w));
m_spg_audio->space_read_callback().set(FUNC(spg24x_device::space_r));
- m_spg_audio->add_route(0, *this, 1.0, AUTO_ALLOC_INPUT, 0);
- m_spg_audio->add_route(1, *this, 1.0, AUTO_ALLOC_INPUT, 1);
+ m_spg_audio->add_route(0, *this, 1.0, 0);
+ m_spg_audio->add_route(1, *this, 1.0, 1);
SPG24X_IO(config, m_spg_io, DERIVED_CLOCK(1, 1), DEVICE_SELF, m_screen);
diff --git a/src/devices/machine/spg2xx_audio.cpp b/src/devices/machine/spg2xx_audio.cpp
index c81aee592a6..05fea0b4724 100644
--- a/src/devices/machine/spg2xx_audio.cpp
+++ b/src/devices/machine/spg2xx_audio.cpp
@@ -871,12 +871,9 @@ void spg2xx_audio_device::audio_w(offs_t offset, uint16_t data)
}
}
-void spg2xx_audio_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void spg2xx_audio_device::sound_stream_update(sound_stream &stream)
{
- auto &out_l = outputs[0];
- auto &out_r = outputs[1];
-
- for (int i = 0; i < out_l.samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
int32_t left_total = 0;
int32_t right_total = 0;
@@ -976,8 +973,8 @@ void spg2xx_audio_device::sound_stream_update(sound_stream &stream, std::vector<
int32_t left_final = (int16_t)((left_total * (int16_t)m_audio_ctrl_regs[AUDIO_MAIN_VOLUME]) >> 7);
int32_t right_final = (int16_t)((right_total * (int16_t)m_audio_ctrl_regs[AUDIO_MAIN_VOLUME]) >> 7);
- out_l.put_int(i, int16_t(left_final), 32768);
- out_r.put_int(i, int16_t(right_final), 32768);
+ stream.put_int(0, i, int16_t(left_final), 32768);
+ stream.put_int(1, i, int16_t(right_final), 32768);
}
}
diff --git a/src/devices/machine/spg2xx_audio.h b/src/devices/machine/spg2xx_audio.h
index 4834d9b965d..955ebf45975 100644
--- a/src/devices/machine/spg2xx_audio.h
+++ b/src/devices/machine/spg2xx_audio.h
@@ -33,7 +33,7 @@ public:
protected:
// 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;
TIMER_CALLBACK_MEMBER(irq_tick);
TIMER_CALLBACK_MEMBER(audio_beat_tick);
diff --git a/src/devices/machine/vrender0.cpp b/src/devices/machine/vrender0.cpp
index 81ffdea1af0..34ba7fb31bb 100644
--- a/src/devices/machine/vrender0.cpp
+++ b/src/devices/machine/vrender0.cpp
@@ -42,8 +42,7 @@ vrender0soc_device::vrender0soc_device(const machine_config &mconfig, const char
m_palette(*this, "palette"),
m_vr0vid(*this, "vr0vid"),
m_vr0snd(*this, "vr0snd"),
- m_lspeaker(*this, "lspeaker"),
- m_rspeaker(*this, "rspeaker"),
+ m_speaker(*this, "speaker"),
m_uart(*this, "uart%u", 0),
m_crtcregs(*this, "crtcregs"),
write_tx(*this)
@@ -135,15 +134,14 @@ void vrender0soc_device::device_add_mconfig(machine_config &config)
PALETTE(config, m_palette, palette_device::RGB_565);
- SPEAKER(config, m_lspeaker).front_left();
- SPEAKER(config, m_rspeaker).front_right();
+ SPEAKER(config, m_speaker, 2).front();
SOUND_VRENDER0(config, m_vr0snd, DERIVED_CLOCK(1,1)); // Correct?
m_vr0snd->set_addrmap(vr0sound_device::AS_TEXTURE, &vrender0soc_device::texture_map);
m_vr0snd->set_addrmap(vr0sound_device::AS_FRAME, &vrender0soc_device::frame_map);
m_vr0snd->irq_callback().set(FUNC(vrender0soc_device::soundirq_cb));
- m_vr0snd->add_route(0, m_lspeaker, 1.0);
- m_vr0snd->add_route(1, m_rspeaker, 1.0);
+ m_vr0snd->add_route(0, m_speaker, 1.0, 0);
+ m_vr0snd->add_route(1, m_speaker, 1.0, 1);
}
diff --git a/src/devices/machine/vrender0.h b/src/devices/machine/vrender0.h
index 604966f2547..ca418101959 100644
--- a/src/devices/machine/vrender0.h
+++ b/src/devices/machine/vrender0.h
@@ -110,8 +110,7 @@ private:
required_device <palette_device> m_palette;
required_device <vr0video_device> m_vr0vid;
required_device <vr0sound_device> m_vr0snd;
- required_device <speaker_device> m_lspeaker;
- required_device <speaker_device> m_rspeaker;
+ required_device <speaker_device> m_speaker;
required_device_array <vr0uart_device, 2> m_uart;
required_shared_ptr <uint32_t> m_crtcregs;
std::unique_ptr<uint16_t []> m_textureram;
diff --git a/src/devices/sound/ad1848.cpp b/src/devices/sound/ad1848.cpp
index ac37b4cd05f..b9395d23360 100644
--- a/src/devices/sound/ad1848.cpp
+++ b/src/devices/sound/ad1848.cpp
@@ -23,10 +23,9 @@ ad1848_device::ad1848_device(const machine_config &mconfig, const char *tag, dev
void ad1848_device::device_add_mconfig(machine_config &config)
{
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
- DAC_16BIT_R2R(config, m_ldac, 0).add_route(ALL_OUTPUTS, "lspeaker", 0.5); // unknown DAC
- DAC_16BIT_R2R(config, m_rdac, 0).add_route(ALL_OUTPUTS, "rspeaker", 0.5); // unknown DAC
+ SPEAKER(config, "speaker", 2).front();
+ DAC_16BIT_R2R(config, m_ldac, 0).add_route(ALL_OUTPUTS, "speaker", 0.5, 0); // unknown DAC
+ DAC_16BIT_R2R(config, m_rdac, 0).add_route(ALL_OUTPUTS, "speaker", 0.5, 1); // unknown DAC
}
diff --git a/src/devices/sound/adc.cpp b/src/devices/sound/adc.cpp
new file mode 100644
index 00000000000..3f2ee0b3175
--- /dev/null
+++ b/src/devices/sound/adc.cpp
@@ -0,0 +1,66 @@
+// license:BSD-3-Clause
+// copyright-holders: Olivier Galibert
+
+// ADCs, unsigned or signed two-complement
+
+#include "emu.h"
+#include "adc.h"
+
+
+zn449_device::zn449_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, ZN449, tag, owner, clock),
+ device_sound_interface(mconfig, *this),
+ m_stream(nullptr),
+ m_current_value(0)
+{
+}
+
+u8 zn449_device::read()
+{
+ m_stream->update();
+ return m_current_value;
+}
+
+void zn449_device::device_start()
+{
+ save_item(NAME(m_current_value));
+ m_stream = stream_alloc(1, 0, SAMPLE_RATE_INPUT_ADAPTIVE);
+}
+
+void zn449_device::sound_stream_update(sound_stream &stream)
+{
+ sound_stream::sample_t last_sample = stream.get(0, stream.samples()-1);
+ m_current_value = 128 * last_sample + 128;
+}
+
+DEFINE_DEVICE_TYPE(ZN449, zn449_device, "zn449", "ZN449 ADC")
+
+
+
+adc10_device::adc10_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, ADC10, tag, owner, clock),
+ device_sound_interface(mconfig, *this),
+ m_stream(nullptr),
+ m_current_value(0)
+{
+}
+
+u16 adc10_device::read()
+{
+ m_stream->update();
+ return m_current_value;
+}
+
+void adc10_device::device_start()
+{
+ save_item(NAME(m_current_value));
+ m_stream = stream_alloc(1, 0, SAMPLE_RATE_INPUT_ADAPTIVE);
+}
+
+void adc10_device::sound_stream_update(sound_stream &stream)
+{
+ sound_stream::sample_t last_sample = stream.get(0, stream.samples()-1);
+ m_current_value = std::clamp(int(512 * last_sample), -512, 511);
+}
+
+DEFINE_DEVICE_TYPE(ADC10, adc10_device, "adc10", "10-bits signed ADC")
diff --git a/src/devices/sound/adc.h b/src/devices/sound/adc.h
new file mode 100644
index 00000000000..43903a930de
--- /dev/null
+++ b/src/devices/sound/adc.h
@@ -0,0 +1,42 @@
+// license:BSD-3-Clause
+// copyright-holders: Olivier Galibert
+
+// ADCs, unsigned or signed two-complement
+
+#ifndef MAME_SOUND_ADC_H
+#define MAME_SOUND_ADC_H
+
+#pragma once
+
+class zn449_device : public device_t, public device_sound_interface
+{
+public:
+ zn449_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ u8 read();
+
+protected:
+ sound_stream *m_stream;
+ u8 m_current_value;
+
+ virtual void device_start() override ATTR_COLD;
+ virtual void sound_stream_update(sound_stream &stream) override;
+};
+
+class adc10_device : public device_t, public device_sound_interface
+{
+public:
+ adc10_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ u16 read();
+
+protected:
+ sound_stream *m_stream;
+ u16 m_current_value;
+
+ virtual void device_start() override ATTR_COLD;
+ virtual void sound_stream_update(sound_stream &stream) override;
+};
+
+DECLARE_DEVICE_TYPE(ZN449, zn449_device);
+DECLARE_DEVICE_TYPE(ADC10, adc10_device);
+
+#endif // MAME_SOUND_ADC_H
diff --git a/src/devices/sound/aica.cpp b/src/devices/sound/aica.cpp
index f7cf5875e93..1e3eaac954e 100644
--- a/src/devices/sound/aica.cpp
+++ b/src/devices/sound/aica.cpp
@@ -1234,11 +1234,11 @@ s32 aica_device::UpdateSlot(AICA_SLOT *slot)
return sample;
}
-void aica_device::DoMasterSamples(std::vector<read_stream_view> const &inputs, write_stream_view &bufl, write_stream_view &bufr)
+void aica_device::DoMasterSamples(sound_stream &stream)
{
int i;
- for (int s = 0; s < bufl.samples(); ++s)
+ for (int s = 0; s < stream.samples(); ++s)
{
s32 smpl = 0, smpr = 0;
@@ -1279,7 +1279,7 @@ void aica_device::DoMasterSamples(std::vector<read_stream_view> const &inputs, w
{
if (EFSDL(i + 16)) // 16,17 for EXTS
{
- m_DSP.EXTS[i] = s16(inputs[i].get(s) * 32767.0);
+ m_DSP.EXTS[i] = s16(stream.get(i, s) * 32767.0);
u32 Enc = ((EFPAN(i + 16)) << 0x8) | ((EFSDL(i + 16)) << 0xd);
smpl += (m_DSP.EXTS[i] * m_LPANTABLE[Enc]) >> SHIFT;
smpr += (m_DSP.EXTS[i] * m_RPANTABLE[Enc]) >> SHIFT;
@@ -1297,9 +1297,9 @@ void aica_device::DoMasterSamples(std::vector<read_stream_view> const &inputs, w
smpr = clip16(smpr >> 3);
}
- bufl.put_int(s, smpl * m_LPANTABLE[MVOL() << 0xd], 32768 << SHIFT);
+ stream.put_int(0, s, smpl * m_LPANTABLE[MVOL() << 0xd], 32768 << SHIFT);
// TODO: diverges with SCSP, also wut?
- bufr.put_int(s, smpr * m_LPANTABLE[MVOL() << 0xd], 32768 << SHIFT);
+ stream.put_int(1, s, smpr * m_LPANTABLE[MVOL() << 0xd], 32768 << SHIFT);
}
}
@@ -1385,9 +1385,9 @@ void aica_device::exec_dma()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void aica_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void aica_device::sound_stream_update(sound_stream &stream)
{
- DoMasterSamples(inputs, outputs[0], outputs[1]);
+ DoMasterSamples(stream);
}
//-------------------------------------------------
diff --git a/src/devices/sound/aica.h b/src/devices/sound/aica.h
index 6e99346cd4f..afca6b17387 100644
--- a/src/devices/sound/aica.h
+++ b/src/devices/sound/aica.h
@@ -39,7 +39,7 @@ protected:
virtual void device_clock_changed() override;
// 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;
// device_memory_interface configuration
virtual space_config_vector memory_space_config() const override;
@@ -126,7 +126,7 @@ private:
u16 r16(u32 addr);
[[maybe_unused]] void TimersAddTicks(int ticks);
s32 UpdateSlot(AICA_SLOT *slot);
- void DoMasterSamples(std::vector<read_stream_view> const &inputs, write_stream_view &bufl, write_stream_view &bufr);
+ void DoMasterSamples(sound_stream &stream);
void exec_dma();
diff --git a/src/devices/sound/ap2010pcm.cpp b/src/devices/sound/ap2010pcm.cpp
index 234264f52f9..7a7d9442be1 100644
--- a/src/devices/sound/ap2010pcm.cpp
+++ b/src/devices/sound/ap2010pcm.cpp
@@ -59,16 +59,13 @@ void ap2010pcm_device::device_start()
save_item(NAME(m_fifo_fast_tail));
}
-void ap2010pcm_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void ap2010pcm_device::sound_stream_update(sound_stream &stream)
{
- auto &buffer = outputs[0];
- buffer.fill(0);
-
int16_t sample = 0;
uint16_t sample_empty_count = 0;
uint16_t fifo_size = m_fifo_size;
uint16_t fifo_fast_size = m_fifo_fast_size;
- for (size_t i = 0; i < buffer.samples(); i++) {
+ for (size_t i = 0; i < stream.samples(); i++) {
if (m_fifo_fast_size) {
sample = fifo_fast_pop();
} else if (m_fifo_size) {
@@ -78,10 +75,10 @@ void ap2010pcm_device::sound_stream_update(sound_stream &stream, std::vector<rea
sample_empty_count++;
}
- buffer.put_int(i, sample * m_volume, 32768);
+ stream.put_int(0, i, sample * m_volume, 32768);
}
if (fifo_size && sample_empty_count) {
- LOG("pcm 0s = %d (had %d + fast %d, needed %d)\n", sample_empty_count, fifo_size, fifo_fast_size, buffer.samples());
+ LOG("pcm 0s = %d (had %d + fast %d, needed %d)\n", sample_empty_count, fifo_size, fifo_fast_size, stream.samples());
}
}
diff --git a/src/devices/sound/ap2010pcm.h b/src/devices/sound/ap2010pcm.h
index bea50bc4424..c5be63bbddd 100644
--- a/src/devices/sound/ap2010pcm.h
+++ b/src/devices/sound/ap2010pcm.h
@@ -30,7 +30,7 @@ protected:
virtual void device_start() override ATTR_COLD;
// device_sound_interface implementation
- 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;
private:
// FIXME: Games check this against 0x1ff, but samples are lost with that limit
diff --git a/src/devices/sound/asc.cpp b/src/devices/sound/asc.cpp
index 231e6b2357f..347f9104649 100644
--- a/src/devices/sound/asc.cpp
+++ b/src/devices/sound/asc.cpp
@@ -123,20 +123,14 @@ TIMER_CALLBACK_MEMBER(asc_device::delayed_stream_update)
// our sound stream
//-------------------------------------------------
-void asc_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void asc_device::sound_stream_update(sound_stream &stream)
{
int i, ch;
static uint32_t wtoffs[2] = { 0, 0x200 };
- auto &outL = outputs[0];
- auto &outR = outputs[1];
-
switch (m_regs[R_MODE-0x800] & 3)
{
case 0: // chip off
- outL.fill(0);
- outR.fill(0);
-
// IIvx/IIvi bootrom indicates VASP updates this flag even when the chip is off
if (m_chip_type == asc_type::VASP)
{
@@ -154,7 +148,7 @@ void asc_device::sound_stream_update(sound_stream &stream, std::vector<read_stre
case 1: // FIFO mode
{
- for (i = 0; i < outL.samples(); i++)
+ for (i = 0; i < stream.samples(); i++)
{
int8_t smpll, smplr;
@@ -257,15 +251,15 @@ void asc_device::sound_stream_update(sound_stream &stream, std::vector<read_stre
break;
}
- outL.put_int(i, smpll, 32768 / 64);
- outR.put_int(i, smplr, 32768 / 64);
+ stream.put_int(0, i, smpll, 32768 / 64);
+ stream.put_int(1, i, smplr, 32768 / 64);
}
break;
}
case 2: // wavetable mode
{
- for (i = 0; i < outL.samples(); i++)
+ for (i = 0; i < stream.samples(); i++)
{
int32_t mixL, mixR;
int8_t smpl;
@@ -291,8 +285,8 @@ void asc_device::sound_stream_update(sound_stream &stream, std::vector<read_stre
mixR += smpl*256;
}
- outL.put_int(i, mixL, 32768 * 4);
- outR.put_int(i, mixR, 32768 * 4);
+ stream.put_int(0, i, mixL, 32768 * 4);
+ stream.put_int(1, i, mixR, 32768 * 4);
}
break;
}
diff --git a/src/devices/sound/asc.h b/src/devices/sound/asc.h
index 2f32b841c03..952f6bff8aa 100644
--- a/src/devices/sound/asc.h
+++ b/src/devices/sound/asc.h
@@ -77,7 +77,7 @@ 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;
TIMER_CALLBACK_MEMBER(delayed_stream_update);
diff --git a/src/devices/sound/astrocde.cpp b/src/devices/sound/astrocde.cpp
index e29b6f31617..be7b8a7946b 100644
--- a/src/devices/sound/astrocde.cpp
+++ b/src/devices/sound/astrocde.cpp
@@ -115,9 +115,8 @@ void astrocade_io_device::device_start()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void astrocade_io_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void astrocade_io_device::sound_stream_update(sound_stream &stream)
{
- auto &dest = outputs[0];
uint16_t noise_state;
uint8_t master_count;
uint8_t noise_clock;
@@ -129,14 +128,14 @@ void astrocade_io_device::sound_stream_update(sound_stream &stream, std::vector<
/* loop over samples */
int samples_this_time;
- constexpr stream_buffer::sample_t sample_scale = 1.0f / 60.0f;
- for (int sampindex = 0; sampindex < dest.samples(); sampindex += samples_this_time)
+ constexpr sound_stream::sample_t sample_scale = 1.0f / 60.0f;
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex += samples_this_time)
{
s32 cursample = 0;
/* compute the number of cycles until the next master oscillator reset */
/* or until the next noise boundary */
- samples_this_time = std::min<int>(dest.samples() - sampindex, 256 - master_count);
+ samples_this_time = std::min<int>(stream.samples() - sampindex, 256 - master_count);
samples_this_time = std::min(samples_this_time, 64 - noise_clock);
/* sum the output of the tone generators */
@@ -152,7 +151,7 @@ void astrocade_io_device::sound_stream_update(sound_stream &stream, std::vector<
cursample += m_reg[7] >> 4;
/* scale to max and output */
- dest.fill(stream_buffer::sample_t(cursample) * sample_scale, sampindex, samples_this_time);
+ stream.fill(0, sound_stream::sample_t(cursample) * sample_scale, sampindex, samples_this_time);
/* clock the noise; a 2-bit counter clocks a 4-bit counter which clocks the LFSR */
noise_clock += samples_this_time;
diff --git a/src/devices/sound/astrocde.h b/src/devices/sound/astrocde.h
index 7c623e0f1f2..1fbe7504e8e 100644
--- a/src/devices/sound/astrocde.h
+++ b/src/devices/sound/astrocde.h
@@ -57,7 +57,7 @@ protected:
virtual void device_reset() override ATTR_COLD;
// device_sound_interface implementation
- 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;
public:
void write(offs_t offset, uint8_t data);
diff --git a/src/devices/sound/awacs.cpp b/src/devices/sound/awacs.cpp
index 236852c854b..3ddb10e7007 100644
--- a/src/devices/sound/awacs.cpp
+++ b/src/devices/sound/awacs.cpp
@@ -103,7 +103,7 @@ void awacs_device::device_reset()
// our sound stream
//-------------------------------------------------
-void awacs_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void awacs_device::sound_stream_update(sound_stream &stream)
{
m_last_sample = machine().time();
@@ -119,14 +119,14 @@ void awacs_device::sound_stream_update(sound_stream &stream, std::vector<read_st
u32 data = m_output_cb(m_phase | (m_output_buffer ? 0x10000 : 0));
s16 left = data >> 16;
s16 right = data;
- outputs[0].put_int(0, left, 32768);
- outputs[1].put_int(0, right, 32768);
+ stream.put_int(0, 0, left, 32768);
+ stream.put_int(1, 0, right, 32768);
} else {
m_output_buffer = false;
- outputs[0].put_int(0, 0, 32768);
- outputs[1].put_int(0, 0, 32768);
+ stream.put_int(0, 0, 0, 32768);
+ stream.put_int(1, 0, 0, 32768);
}
if(m_active & ACTIVE_IN)
diff --git a/src/devices/sound/awacs.h b/src/devices/sound/awacs.h
index d46f3fcec29..89bb254eb3a 100644
--- a/src/devices/sound/awacs.h
+++ b/src/devices/sound/awacs.h
@@ -49,7 +49,7 @@ 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;
devcb_write_line m_irq_out_cb, m_irq_in_cb;
devcb_read32 m_output_cb;
diff --git a/src/devices/sound/ay8910.cpp b/src/devices/sound/ay8910.cpp
index b4ad9a01043..f93d0027a85 100644
--- a/src/devices/sound/ay8910.cpp
+++ b/src/devices/sound/ay8910.cpp
@@ -593,7 +593,7 @@ be induced by cutoff currents from the 15 FETs.
#define ENABLE_REGISTER_TEST (0) // Enable preprogrammed registers
-static constexpr stream_buffer::sample_t MAX_OUTPUT = 1.0;
+static constexpr sound_stream::sample_t MAX_OUTPUT = 1.0;
/*************************************
@@ -758,7 +758,7 @@ static const ay8910_device::mosfet_param ay8910_mosfet_param =
*
*************************************/
-static inline void build_3D_table(double rl, const ay8910_device::ay_ym_param *par, const ay8910_device::ay_ym_param *par_env, int normalize, double factor, int zero_is_off, stream_buffer::sample_t *tab)
+static inline void build_3D_table(double rl, const ay8910_device::ay_ym_param *par, const ay8910_device::ay_ym_param *par_env, int normalize, double factor, int zero_is_off, sound_stream::sample_t *tab)
{
double min = 10.0, max = 0.0;
@@ -817,7 +817,7 @@ static inline void build_3D_table(double rl, const ay8910_device::ay_ym_param *p
// for (e = 0;e<16;e++) printf("%d %d\n",e << 10, tab[e << 10]);
}
-static inline void build_single_table(double rl, const ay8910_device::ay_ym_param *par, int normalize, stream_buffer::sample_t *tab, int zero_is_off)
+static inline void build_single_table(double rl, const ay8910_device::ay_ym_param *par, int normalize, sound_stream::sample_t *tab, int zero_is_off)
{
double rt;
double rw;
@@ -855,7 +855,7 @@ static inline void build_single_table(double rl, const ay8910_device::ay_ym_para
}
-static inline void build_mosfet_resistor_table(const ay8910_device::mosfet_param &par, const double rd, stream_buffer::sample_t *tab)
+static inline void build_mosfet_resistor_table(const ay8910_device::mosfet_param &par, const double rd, sound_stream::sample_t *tab)
{
for (int j = 0; j < par.m_count; j++)
{
@@ -873,7 +873,7 @@ static inline void build_mosfet_resistor_table(const ay8910_device::mosfet_param
}
-stream_buffer::sample_t ay8910_device::mix_3D()
+sound_stream::sample_t ay8910_device::mix_3D()
{
int indx = 0;
@@ -1055,20 +1055,11 @@ void ay8910_device::ay8910_write_reg(int r, int v)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void ay8910_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void ay8910_device::sound_stream_update(sound_stream &stream)
{
tone_t *tone;
envelope_t *envelope;
- int samples = outputs[0].samples();
-
- // hack to prevent us from hanging when starting filtered outputs
- if (!m_ready)
- {
- for (int chan = 0; chan < m_streams; chan++)
- outputs[chan].fill(0);
- }
-
// The 8910 has three outputs, each output is the mix of one of the three
// tone generators and of the (single) noise generator. The two are mixed
// BEFORE going into the DAC. The formula to mix each channel is:
@@ -1077,7 +1068,7 @@ void ay8910_device::sound_stream_update(sound_stream &stream, std::vector<read_s
// is 1, not 0, and can be modulated changing the volume.
// buffering loop
- for (int sampindex = 0; sampindex < samples; sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
for (int chan = 0; chan < NUM_CHANNELS; chan++)
{
@@ -1172,38 +1163,38 @@ void ay8910_device::sound_stream_update(sound_stream &stream, std::vector<read_s
{
env_volume >>= 1;
if (m_feature & PSG_EXTENDED_ENVELOPE) // AY8914 Has a two bit tone_envelope field
- outputs[chan].put(sampindex, m_vol_table[chan][m_vol_enabled[chan] ? env_volume >> (3-tone_envelope(tone)) : 0]);
+ stream.put(chan, sampindex, m_vol_table[chan][m_vol_enabled[chan] ? env_volume >> (3-tone_envelope(tone)) : 0]);
else
- outputs[chan].put(sampindex, m_vol_table[chan][m_vol_enabled[chan] ? env_volume : 0]);
+ stream.put(chan, sampindex, m_vol_table[chan][m_vol_enabled[chan] ? env_volume : 0]);
}
else
{
if (m_feature & PSG_EXTENDED_ENVELOPE) // AY8914 Has a two bit tone_envelope field
- outputs[chan].put(sampindex, m_env_table[chan][m_vol_enabled[chan] ? env_volume >> (3-tone_envelope(tone)) : 0]);
+ stream.put(chan, sampindex, m_env_table[chan][m_vol_enabled[chan] ? env_volume >> (3-tone_envelope(tone)) : 0]);
else
- outputs[chan].put(sampindex, m_env_table[chan][m_vol_enabled[chan] ? env_volume : 0]);
+ stream.put(chan, sampindex, m_env_table[chan][m_vol_enabled[chan] ? env_volume : 0]);
}
}
else
{
if (m_feature & PSG_EXTENDED_ENVELOPE) // AY8914 Has a two bit tone_envelope field
- outputs[chan].put(sampindex, m_env_table[chan][m_vol_enabled[chan] ? env_volume >> (3-tone_envelope(tone)) : 0]);
+ stream.put(chan, sampindex, m_env_table[chan][m_vol_enabled[chan] ? env_volume >> (3-tone_envelope(tone)) : 0]);
else
- outputs[chan].put(sampindex, m_env_table[chan][m_vol_enabled[chan] ? env_volume : 0]);
+ stream.put(chan, sampindex, m_env_table[chan][m_vol_enabled[chan] ? env_volume : 0]);
}
}
else
{
if (is_expanded_mode())
- outputs[chan].put(sampindex, m_env_table[chan][m_vol_enabled[chan] ? tone_volume(tone) : 0]);
+ stream.put(chan, sampindex, m_env_table[chan][m_vol_enabled[chan] ? tone_volume(tone) : 0]);
else
- outputs[chan].put(sampindex, m_vol_table[chan][m_vol_enabled[chan] ? tone_volume(tone) : 0]);
+ stream.put(chan, sampindex, m_vol_table[chan][m_vol_enabled[chan] ? tone_volume(tone) : 0]);
}
}
}
else
{
- outputs[0].put(sampindex, mix_3D());
+ stream.put(0, sampindex, mix_3D());
}
}
}
@@ -1298,7 +1289,7 @@ void ay8910_device::device_start()
m_streams = 1;
}
- m_vol3d_table = make_unique_clear<stream_buffer::sample_t[]>(8*32*32*32);
+ m_vol3d_table = make_unique_clear<sound_stream::sample_t[]>(8*32*32*32);
build_mixer_table();
diff --git a/src/devices/sound/ay8910.h b/src/devices/sound/ay8910.h
index ca763dc754c..44ec39649c2 100644
--- a/src/devices/sound/ay8910.h
+++ b/src/devices/sound/ay8910.h
@@ -140,7 +140,7 @@ protected:
virtual void device_clock_changed() override;
// 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;
void ay8910_write_ym(int addr, u8 data);
u8 ay8910_read_ym();
@@ -294,7 +294,7 @@ private:
// internal helpers
void set_type(psg_type_t psg_type);
- inline stream_buffer::sample_t mix_3D();
+ inline sound_stream::sample_t mix_3D();
void ay8910_write_reg(int r, int v);
void build_mixer_table();
void ay8910_statesave();
@@ -324,9 +324,9 @@ private:
u8 m_vol_enabled[NUM_CHANNELS];
const ay_ym_param *m_par;
const ay_ym_param *m_par_env;
- stream_buffer::sample_t m_vol_table[NUM_CHANNELS][16];
- stream_buffer::sample_t m_env_table[NUM_CHANNELS][32];
- std::unique_ptr<stream_buffer::sample_t[]> m_vol3d_table;
+ sound_stream::sample_t m_vol_table[NUM_CHANNELS][16];
+ sound_stream::sample_t m_env_table[NUM_CHANNELS][32];
+ std::unique_ptr<sound_stream::sample_t[]> m_vol3d_table;
int m_flags; // Flags
int m_feature; // Chip specific features
int m_res_load[3]; // Load on channel in ohms
diff --git a/src/devices/sound/bbd.cpp b/src/devices/sound/bbd.cpp
index 5b694b6970c..f09a0e5ad3a 100644
--- a/src/devices/sound/bbd.cpp
+++ b/src/devices/sound/bbd.cpp
@@ -12,105 +12,48 @@
// bbd_device_base - constructor
//-------------------------------------------------
-template<int Entries, int Outputs>
-bbd_device_base<Entries, Outputs>::bbd_device_base(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, device_type type) :
+bbd_device_base::bbd_device_base(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, device_type type) :
device_t(mconfig, type, tag, owner, clock),
- device_sound_interface(mconfig, *this),
- m_stream(nullptr),
- m_curpos(0),
- m_cv_handler(*this),
- m_next_bbdtime(attotime::zero)
+ device_sound_interface(mconfig, *this)
{
- std::fill_n(&m_buffer[0], Entries, 0);
}
-
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
-template<int Entries, int Outputs>
-void bbd_device_base<Entries, Outputs>::device_start()
+void bbd_device_base::set_bucket_count(int buckets)
{
- m_cv_handler.resolve();
-
- if (m_cv_handler.isnull())
- m_stream = stream_alloc(1, Outputs, sample_rate());
- else
- m_stream = stream_alloc(1, Outputs, SAMPLE_RATE_OUTPUT_ADAPTIVE, STREAM_DISABLE_INPUT_RESAMPLING);
+ m_buffer.resize(buckets);
+}
+void bbd_device_base::device_start()
+{
+ m_stream = stream_alloc(1, 1, SAMPLE_RATE_OUTPUT_ADAPTIVE, STREAM_SYNCHRONOUS);
save_item(NAME(m_buffer));
save_item(NAME(m_curpos));
- save_item(NAME(m_next_bbdtime));
-}
-//-------------------------------------------------
-// device_clock_changed - handle a clock change
-//-------------------------------------------------
+}
-template<int Entries, int Outputs>
-void bbd_device_base<Entries, Outputs>::device_clock_changed()
+void bbd_device_base::device_reset()
{
- if (m_cv_handler.isnull())
- m_stream->set_sample_rate(sample_rate());
+ std::fill(m_buffer.begin(), m_buffer.end(), 0);
+ m_curpos = 0;
}
+void bbd_device_base::tick()
+{
+ u32 nextpos = m_curpos + 1;
+ if(nextpos == m_buffer.size())
+ nextpos = 0;
+ m_buffer[nextpos] = m_buffer[m_curpos];
+ m_curpos = nextpos;
+}
-//-------------------------------------------------
-// sound_stream_update - handle a stream update
-//-------------------------------------------------
-
-template<int Entries, int Outputs>
-void bbd_device_base<Entries, Outputs>::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void bbd_device_base::sound_stream_update(sound_stream &stream)
{
- // BBDs that I've seen so far typically have 2 outputs, with the first outputting
- // sample n-1 and the second outputting sampe n; if chips with more outputs
- // or other taps turn up, this logic will need to be made more flexible
- if (m_cv_handler.isnull())
- {
- for (int sampindex = 0; sampindex < outputs[0].samples(); sampindex++)
- {
- for (int outnum = 0; outnum < Outputs; outnum++)
- outputs[outnum].put(sampindex, m_buffer[(m_curpos + (Outputs - 1) - outnum) % Entries]);
- m_buffer[m_curpos] = inputs[0].get(sampindex);
- m_curpos = (m_curpos + 1) % Entries;
- }
- }
- else
- {
- read_stream_view in(inputs[0], m_next_bbdtime);
- attotime intime = in.start_time();
- attotime outtime = outputs[0].start_time();
- int inpos = 0;
-
- // loop until all outputs generated
- for (int sampindex = 0; sampindex < outputs[0].samples(); sampindex++)
- {
- // we need to process some more BBD input
- while (outtime >= m_next_bbdtime)
- {
- // find the input sample that overlaps our start time
- while (intime + in.sample_period() < m_next_bbdtime)
- {
- inpos++;
- intime += in.sample_period();
- }
-
- // copy that to the buffer
- m_buffer[m_curpos] = in.get(inpos);
- m_curpos = (m_curpos + 1) % std::size(m_buffer);
-
- // advance the end time of this BBD sample
- m_next_bbdtime += attotime(0, m_cv_handler(m_next_bbdtime));
- }
-
- // copy the most recently-generated BBD data
- for (int outnum = 0; outnum < Outputs; outnum++)
- outputs[outnum].put(sampindex, outputval(outnum - (Outputs - 1)));
- outtime += outputs[0].sample_period();
- }
- }
+ u32 nextpos = m_curpos + 1;
+ if(nextpos == m_buffer.size())
+ nextpos = 0;
+ stream.put(0, 0, m_buffer[nextpos]);
+ m_buffer[m_curpos] = stream.get(0, 0);
}
@@ -124,6 +67,7 @@ DEFINE_DEVICE_TYPE(MN3004, mn3004_device, "mn3004", "MN3004 BBD")
mn3004_device::mn3004_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
bbd_device_base(mconfig, tag, owner, clock, MN3004)
{
+ set_bucket_count(512);
}
@@ -137,6 +81,7 @@ DEFINE_DEVICE_TYPE(MN3005, mn3005_device, "mn3005", "MN3005 BBD")
mn3005_device::mn3005_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
bbd_device_base(mconfig, tag, owner, clock, MN3005)
{
+ set_bucket_count(4096);
}
@@ -150,6 +95,7 @@ DEFINE_DEVICE_TYPE(MN3006, mn3006_device, "mn3006", "MN3006 BBD")
mn3006_device::mn3006_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
bbd_device_base(mconfig, tag, owner, clock, MN3006)
{
+ set_bucket_count(128);
}
@@ -163,6 +109,7 @@ DEFINE_DEVICE_TYPE(MN3204P, mn3204p_device, "mn3204p", "MN3204P BBD")
mn3204p_device::mn3204p_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
bbd_device_base(mconfig, tag, owner, clock, MN3204P)
{
+ set_bucket_count(512);
}
@@ -176,4 +123,5 @@ DEFINE_DEVICE_TYPE(MN3207, mn3207_device, "mn3207", "MN3207 BBD")
mn3207_device::mn3207_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
bbd_device_base(mconfig, tag, owner, clock, MN3207)
{
+ set_bucket_count(1024);
}
diff --git a/src/devices/sound/bbd.h b/src/devices/sound/bbd.h
index 64394a90620..4b761a64904 100644
--- a/src/devices/sound/bbd.h
+++ b/src/devices/sound/bbd.h
@@ -11,45 +11,38 @@
// ======================> bbd_device_base
-template<int Entries, int Outputs>
class bbd_device_base : public device_t, public device_sound_interface
{
public:
- // configuration
- template <typename... T> void set_cv_handler(T &&... args)
- {
- m_cv_handler.set(std::forward<T>(args)...);
- }
+ void tick();
protected:
- using cv_delegate = device_delegate<attoseconds_t (attotime const &)>;
-
// internal constructor
bbd_device_base(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, device_type type);
+ void set_bucket_count(int buckets);
+
// device-level overrides
virtual void device_start() override ATTR_COLD;
- virtual void device_clock_changed() override;
+ 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;
protected:
// override to convert clock to sample rate
- stream_buffer::sample_t outputval(s32 index) const { return m_buffer[(m_curpos - index) % std::size(m_buffer)]; }
+ sound_stream::sample_t outputval(s32 index) const { return m_buffer[(m_curpos - index) % std::size(m_buffer)]; }
virtual u32 sample_rate() const { return clock(); }
sound_stream * m_stream;
u32 m_curpos;
- cv_delegate m_cv_handler;
- attotime m_next_bbdtime;
- stream_buffer::sample_t m_buffer[Entries + 1];
+ std::vector<sound_stream::sample_t> m_buffer;
};
// ======================> mn3004_device
-class mn3004_device : public bbd_device_base<512, 2>
+class mn3004_device : public bbd_device_base
{
public:
mn3004_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
@@ -60,7 +53,7 @@ DECLARE_DEVICE_TYPE(MN3004, mn3004_device)
// ======================> mn3005_device
-class mn3005_device : public bbd_device_base<4096, 2>
+class mn3005_device : public bbd_device_base
{
public:
mn3005_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
@@ -71,7 +64,7 @@ DECLARE_DEVICE_TYPE(MN3005, mn3005_device)
// ======================> mn3006_device
-class mn3006_device : public bbd_device_base<128, 2>
+class mn3006_device : public bbd_device_base
{
public:
mn3006_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
@@ -82,7 +75,7 @@ DECLARE_DEVICE_TYPE(MN3006, mn3006_device)
// ======================> mn3204p_device
-class mn3204p_device : public bbd_device_base<512, 2>
+class mn3204p_device : public bbd_device_base
{
public:
mn3204p_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
@@ -93,7 +86,7 @@ DECLARE_DEVICE_TYPE(MN3204P, mn3204p_device)
// ======================> mn3207_device
-class mn3207_device : public bbd_device_base<1024, 2>
+class mn3207_device : public bbd_device_base
{
public:
mn3207_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
diff --git a/src/devices/sound/beep.cpp b/src/devices/sound/beep.cpp
index fd4096c72eb..9a341a7a2d3 100644
--- a/src/devices/sound/beep.cpp
+++ b/src/devices/sound/beep.cpp
@@ -52,19 +52,14 @@ void beep_device::device_start()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void beep_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void beep_device::sound_stream_update(sound_stream &stream)
{
- auto &buffer = outputs[0];
-
- // if we're not enabled, just fill with 0
+ // if we're not enabled, just leave cleared
if (!m_enable || m_frequency == 0)
- {
- buffer.fill(0);
return;
- }
// fill in the sample
- for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
m_incr -= m_frequency;
while (m_incr < 0)
@@ -73,7 +68,7 @@ void beep_device::sound_stream_update(sound_stream &stream, std::vector<read_str
m_signal = -m_signal;
}
- buffer.put(sampindex, m_signal);
+ stream.put(0, sampindex, m_signal);
}
}
diff --git a/src/devices/sound/beep.h b/src/devices/sound/beep.h
index a33ab803020..651ad143985 100644
--- a/src/devices/sound/beep.h
+++ b/src/devices/sound/beep.h
@@ -28,14 +28,14 @@ protected:
virtual void device_start() 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;
private:
sound_stream *m_stream; // stream number
bool m_enable; // enable beep
uint32_t m_frequency; // set frequency - this can be changed using the appropriate function
int32_t m_incr; // initial wave state
- stream_buffer::sample_t m_signal; // current signal
+ sound_stream::sample_t m_signal; // current signal
};
DECLARE_DEVICE_TYPE(BEEP, beep_device)
diff --git a/src/devices/sound/bsmt2000.cpp b/src/devices/sound/bsmt2000.cpp
index 428009b1fc2..44f35c09ba5 100644
--- a/src/devices/sound/bsmt2000.cpp
+++ b/src/devices/sound/bsmt2000.cpp
@@ -186,12 +186,12 @@ TIMER_CALLBACK_MEMBER(bsmt2000_device::deferred_data_write)
// for our sound stream
//-------------------------------------------------
-void bsmt2000_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void bsmt2000_device::sound_stream_update(sound_stream &stream)
{
// just fill with current left/right values
- constexpr stream_buffer::sample_t sample_scale = 1.0 / 32768.0;
- outputs[0].fill(stream_buffer::sample_t(m_left_data) * sample_scale);
- outputs[1].fill(stream_buffer::sample_t(m_right_data) * sample_scale);
+ constexpr sound_stream::sample_t sample_scale = 1.0 / 32768.0;
+ stream.fill(0, sound_stream::sample_t(m_left_data) * sample_scale);
+ stream.fill(1, sound_stream::sample_t(m_right_data) * sample_scale);
}
diff --git a/src/devices/sound/bsmt2000.h b/src/devices/sound/bsmt2000.h
index dc9fc5751c2..e0c9fbabaec 100644
--- a/src/devices/sound/bsmt2000.h
+++ b/src/devices/sound/bsmt2000.h
@@ -52,7 +52,7 @@ protected:
virtual void device_reset() override ATTR_COLD;
// device_sound_interface 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;
// device_rom_interface overrides
virtual void rom_bank_pre_change() override;
diff --git a/src/devices/sound/c140.cpp b/src/devices/sound/c140.cpp
index 688ebec6459..9c83dac32db 100644
--- a/src/devices/sound/c140.cpp
+++ b/src/devices/sound/c140.cpp
@@ -215,12 +215,12 @@ void c140_device::rom_bank_pre_change()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void c140_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void c140_device::sound_stream_update(sound_stream &stream)
{
float pbase = (float)m_baserate * 2.0f / (float)m_sample_rate;
s16 *lmix, *rmix;
- int samples = outputs[0].samples();
+ int samples = stream.samples();
if (samples > m_sample_rate) samples = m_sample_rate;
/* zap the contents of the mixer buffer */
@@ -317,22 +317,20 @@ void c140_device::sound_stream_update(sound_stream &stream, std::vector<read_str
lmix = m_mixer_buffer_left.get();
rmix = m_mixer_buffer_right.get();
{
- auto &dest1 = outputs[0];
- auto &dest2 = outputs[1];
for (int i = 0; i < samples; i++)
{
- dest1.put_int_clamp(i, *lmix++, 32768 / 8);
- dest2.put_int_clamp(i, *rmix++, 32768 / 8);
+ stream.put_int_clamp(0, i, *lmix++, 32768 / 8);
+ stream.put_int_clamp(1, i, *rmix++, 32768 / 8);
}
}
}
-void c219_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void c219_device::sound_stream_update(sound_stream &stream)
{
float pbase = (float)m_baserate * 2.0f / (float)m_sample_rate;
s16 *lmix, *rmix;
- int samples = outputs[0].samples();
+ int samples = stream.samples();
if (samples > m_sample_rate) samples = m_sample_rate;
/* zap the contents of the mixer buffer */
@@ -448,12 +446,10 @@ void c219_device::sound_stream_update(sound_stream &stream, std::vector<read_str
lmix = m_mixer_buffer_left.get();
rmix = m_mixer_buffer_right.get();
{
- auto &dest1 = outputs[0];
- auto &dest2 = outputs[1];
for (int i = 0; i < samples; i++)
{
- dest1.put_int_clamp(i, *lmix++, 32768 / 8);
- dest2.put_int_clamp(i, *rmix++, 32768 / 8);
+ stream.put_int_clamp(0, i, *lmix++, 32768 / 8);
+ stream.put_int_clamp(1, i, *rmix++, 32768 / 8);
}
}
}
diff --git a/src/devices/sound/c140.h b/src/devices/sound/c140.h
index 2fda0526a82..9fd23b3b0a6 100644
--- a/src/devices/sound/c140.h
+++ b/src/devices/sound/c140.h
@@ -44,7 +44,7 @@ protected:
virtual void rom_bank_pre_change() override;
// 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 int find_sample(int adrs, int bank, int voice);
@@ -118,7 +118,7 @@ protected:
virtual void device_start() 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 int find_sample(int adrs, int bank, int voice) override;
diff --git a/src/devices/sound/c352.cpp b/src/devices/sound/c352.cpp
index dcbd58f3eb3..f4b21be2663 100644
--- a/src/devices/sound/c352.cpp
+++ b/src/devices/sound/c352.cpp
@@ -123,14 +123,9 @@ void c352_device::ramp_volume(c352_voice_t &v, int ch, u8 val)
v.curr_vol[ch] += (vol_delta > 0) ? -1 : 1;
}
-void c352_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void c352_device::sound_stream_update(sound_stream &stream)
{
- auto &buffer_fl = outputs[0];
- auto &buffer_fr = outputs[1];
- auto &buffer_rl = outputs[2];
- auto &buffer_rr = outputs[3];
-
- for (int i = 0; i < buffer_fl.samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
int out[4] = { 0, 0, 0, 0 };
@@ -174,10 +169,10 @@ void c352_device::sound_stream_update(sound_stream &stream, std::vector<read_str
out[3] += (((v.flags & C352_FLG_PHASEFR) ? -s : s) * v.curr_vol[3]) >> 8;
}
- buffer_fl.put_int(i, s16(out[0] >> 3), 32768);
- buffer_fr.put_int(i, s16(out[1] >> 3), 32768);
- buffer_rl.put_int(i, s16(out[2] >> 3), 32768);
- buffer_rr.put_int(i, s16(out[3] >> 3), 32768);
+ stream.put_int(0, i, s16(out[0] >> 3), 32768);
+ stream.put_int(1, i, s16(out[1] >> 3), 32768);
+ stream.put_int(2, i, s16(out[2] >> 3), 32768);
+ stream.put_int(3, i, s16(out[3] >> 3), 32768);
}
}
diff --git a/src/devices/sound/c352.h b/src/devices/sound/c352.h
index 321d5144879..b404952745a 100644
--- a/src/devices/sound/c352.h
+++ b/src/devices/sound/c352.h
@@ -39,7 +39,7 @@ protected:
virtual void device_clock_changed() override;
// device_sound_interface 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;
// device_rom_interface overrides
virtual void rom_bank_pre_change() override;
diff --git a/src/devices/sound/c6280.cpp b/src/devices/sound/c6280.cpp
index 474a3bf57a6..c156033dce8 100644
--- a/src/devices/sound/c6280.cpp
+++ b/src/devices/sound/c6280.cpp
@@ -42,15 +42,11 @@
#include <algorithm>
-void c6280_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void c6280_device::sound_stream_update(sound_stream &stream)
{
// Fast method if none of the channels are enabled (most Data East arcade games)
if (!(m_enabled & 0x3f))
- {
- outputs[0].fill(0);
- outputs[1].fill(0);
return;
- }
static const u8 scale_tab[16] =
{
@@ -61,7 +57,7 @@ void c6280_device::sound_stream_update(sound_stream &stream, std::vector<read_st
const u8 lmal = scale_tab[(m_balance >> 4) & 0x0f];
const u8 rmal = scale_tab[(m_balance >> 0) & 0x0f];
- for (int i = 0; i < outputs[0].samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
s32 lout = 0, rout = 0;
for (int ch = 0; ch < 6; ch++)
@@ -169,8 +165,8 @@ void c6280_device::sound_stream_update(sound_stream &stream, std::vector<read_st
}
}
}
- outputs[0].put_int(i, lout, 32768);
- outputs[1].put_int(i, rout, 32768);
+ stream.put_int(0, i, lout, 32768);
+ stream.put_int(1, i, rout, 32768);
}
}
diff --git a/src/devices/sound/c6280.h b/src/devices/sound/c6280.h
index dda6dbfa833..07c17447d62 100644
--- a/src/devices/sound/c6280.h
+++ b/src/devices/sound/c6280.h
@@ -22,7 +22,7 @@ protected:
virtual void device_clock_changed() override;
// 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;
private:
struct channel {
diff --git a/src/devices/sound/cdda.cpp b/src/devices/sound/cdda.cpp
index 5c39bbfe84e..281a625c0bf 100644
--- a/src/devices/sound/cdda.cpp
+++ b/src/devices/sound/cdda.cpp
@@ -15,9 +15,9 @@ static constexpr int MAX_SCAN_SECTORS = 2;
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void cdda_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void cdda_device::sound_stream_update(sound_stream &stream)
{
- get_audio_data(outputs[0], outputs[1]);
+ get_audio_data(stream);
}
//-------------------------------------------------
@@ -199,12 +199,11 @@ int cdda_device::audio_ended()
converts it to 2 16-bit 44.1 kHz streams
-------------------------------------------------*/
-void cdda_device::get_audio_data(write_stream_view &bufL, write_stream_view &bufR)
+void cdda_device::get_audio_data(sound_stream &stream)
{
- int i;
int16_t *audio_cache = (int16_t *) m_audio_cache.get();
- for (int sampindex = 0; sampindex < bufL.samples(); )
+ for (int sampindex = 0; sampindex < stream.samples(); )
{
/* if no file, audio not playing, audio paused, or out of disc data,
just zero fill */
@@ -219,25 +218,23 @@ void cdda_device::get_audio_data(write_stream_view &bufL, write_stream_view &buf
m_sequence_counter = m_disc->sequence_counter();
m_audio_data[0] = m_audio_data[1] = 0;
- bufL.fill(0, sampindex);
- bufR.fill(0, sampindex);
return;
}
- int samples = bufL.samples() - sampindex;
+ int samples = stream.samples() - sampindex;
if (samples > m_audio_samples)
{
samples = m_audio_samples;
}
- for (i = 0; i < samples; i++)
+ for (int i = 0; i < samples; i++)
{
/* CD-DA data on the disc is big-endian */
m_audio_data[0] = s16(big_endianize_int16( audio_cache[ m_audio_bptr ] ));
- bufL.put_int(sampindex + i, m_audio_data[0], 32768);
+ stream.put_int(0, sampindex + i, m_audio_data[0], 32768);
m_audio_bptr++;
m_audio_data[1] = s16(big_endianize_int16( audio_cache[ m_audio_bptr ] ));
- bufR.put_int(sampindex + i, m_audio_data[1], 32768);
+ stream.put_int(1, sampindex + i, m_audio_data[1], 32768);
m_audio_bptr++;
}
@@ -252,7 +249,7 @@ void cdda_device::get_audio_data(write_stream_view &bufL, write_stream_view &buf
sectors = MAX_SECTORS;
}
- for (i = 0; i < sectors; i++)
+ for (int i = 0; i < sectors; i++)
{
const auto adr_control = m_disc->get_adr_control(m_disc->get_track(m_audio_lba));
diff --git a/src/devices/sound/cdda.h b/src/devices/sound/cdda.h
index dcdea3cc5bf..5eadd5e315f 100644
--- a/src/devices/sound/cdda.h
+++ b/src/devices/sound/cdda.h
@@ -37,10 +37,10 @@ protected:
virtual void device_start() 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;
private:
- void get_audio_data(write_stream_view &bufL, write_stream_view &bufR);
+ void get_audio_data(sound_stream &stream);
required_device<cdrom_image_device> m_disc;
diff --git a/src/devices/sound/cdp1863.cpp b/src/devices/sound/cdp1863.cpp
index da9194b9a7e..31d135b5c78 100644
--- a/src/devices/sound/cdp1863.cpp
+++ b/src/devices/sound/cdp1863.cpp
@@ -85,15 +85,14 @@ void cdp1863_device::device_start()
// our sound stream
//-------------------------------------------------
-void cdp1863_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void cdp1863_device::sound_stream_update(sound_stream &stream)
{
- stream_buffer::sample_t signal = m_signal;
- auto &buffer = outputs[0];
+ sound_stream::sample_t signal = m_signal;
if (m_oe)
{
double frequency;
- int rate = buffer.sample_rate() / 2;
+ int rate = stream.sample_rate() / 2;
// get progress through wave
int incr = m_incr;
@@ -118,9 +117,9 @@ void cdp1863_device::sound_stream_update(sound_stream &stream, std::vector<read_
signal = 1.0;
}
- for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
- buffer.put(sampindex, signal);
+ stream.put(0, sampindex, signal);
incr -= frequency;
while( incr < 0 )
{
@@ -133,8 +132,6 @@ void cdp1863_device::sound_stream_update(sound_stream &stream, std::vector<read_
m_incr = incr;
m_signal = signal;
}
- else
- buffer.fill(0);
}
diff --git a/src/devices/sound/cdp1863.h b/src/devices/sound/cdp1863.h
index 4d6f4f295b3..15c9054f13f 100644
--- a/src/devices/sound/cdp1863.h
+++ b/src/devices/sound/cdp1863.h
@@ -54,7 +54,7 @@ protected:
virtual void device_start() override ATTR_COLD;
// internal callbacks
- 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;
private:
sound_stream *m_stream;
@@ -65,7 +65,7 @@ private:
// sound state
int m_oe; // output enable
int m_latch; // sound latch
- stream_buffer::sample_t m_signal;// current signal
+ sound_stream::sample_t m_signal;// current signal
int m_incr; // initial wave state
};
diff --git a/src/devices/sound/cdp1864.cpp b/src/devices/sound/cdp1864.cpp
index 2d8acb64358..c211dc451f4 100644
--- a/src/devices/sound/cdp1864.cpp
+++ b/src/devices/sound/cdp1864.cpp
@@ -243,15 +243,14 @@ TIMER_CALLBACK_MEMBER(cdp1864_device::dma_tick)
// our sound stream
//-------------------------------------------------
-void cdp1864_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void cdp1864_device::sound_stream_update(sound_stream &stream)
{
- stream_buffer::sample_t signal = m_signal;
- auto &buffer = outputs[0];
+ sound_stream::sample_t signal = m_signal;
if (m_aoe)
{
double frequency = unscaled_clock() / 8 / 4 / (m_latch + 1) / 2;
- int rate = buffer.sample_rate() / 2;
+ int rate = stream.sample_rate() / 2;
/* get progress through wave */
int incr = m_incr;
@@ -265,9 +264,9 @@ void cdp1864_device::sound_stream_update(sound_stream &stream, std::vector<read_
signal = 1.0;
}
- for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
- buffer.put(sampindex, signal);
+ stream.put(0, sampindex, signal);
incr -= frequency;
while( incr < 0 )
{
@@ -280,8 +279,6 @@ void cdp1864_device::sound_stream_update(sound_stream &stream, std::vector<read_
m_incr = incr;
m_signal = signal;
}
- else
- buffer.fill(0);
}
diff --git a/src/devices/sound/cdp1864.h b/src/devices/sound/cdp1864.h
index c1bb7b36797..09ab0f78730 100644
--- a/src/devices/sound/cdp1864.h
+++ b/src/devices/sound/cdp1864.h
@@ -114,7 +114,7 @@ protected:
virtual void device_reset() override ATTR_COLD;
// internal callbacks
- 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;
TIMER_CALLBACK_MEMBER(int_tick);
TIMER_CALLBACK_MEMBER(efx_tick);
@@ -152,7 +152,7 @@ private:
// sound state
int m_aoe; // audio on
int m_latch; // sound latch
- stream_buffer::sample_t m_signal; // current signal
+ sound_stream::sample_t m_signal; // current signal
int m_incr; // initial wave state
// timers
diff --git a/src/devices/sound/cdp1869.cpp b/src/devices/sound/cdp1869.cpp
index c0a54adaf99..531a95a065b 100644
--- a/src/devices/sound/cdp1869.cpp
+++ b/src/devices/sound/cdp1869.cpp
@@ -493,33 +493,32 @@ void cdp1869_device::cdp1869_palette(palette_device &palette) const
// our sound stream
//-------------------------------------------------
-void cdp1869_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void cdp1869_device::sound_stream_update(sound_stream &stream)
{
- stream_buffer::sample_t signal = m_signal;
- auto &buffer = outputs[0];
+ sound_stream::sample_t signal = m_signal;
if (!m_toneoff && m_toneamp)
{
double frequency = (clock() / 2) / (512 >> m_tonefreq) / (m_tonediv + 1);
// double amplitude = m_toneamp * ((0.78*5) / 15);
- int rate = buffer.sample_rate() / 2;
+ int rate = stream.sample_rate() / 2;
/* get progress through wave */
int incr = m_incr;
if (signal < 0)
{
- signal = -(stream_buffer::sample_t(m_toneamp) / 15.0);
+ signal = -(sound_stream::sample_t(m_toneamp) / 15.0);
}
else
{
- signal = stream_buffer::sample_t(m_toneamp) / 15.0;
+ signal = sound_stream::sample_t(m_toneamp) / 15.0;
}
- for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
- buffer.put(sampindex, signal);
+ stream.put(0, sampindex, signal);
incr -= frequency;
while( incr < 0 )
{
@@ -532,8 +531,6 @@ void cdp1869_device::sound_stream_update(sound_stream &stream, std::vector<read_
m_incr = incr;
m_signal = signal;
}
- else
- buffer.fill(0);
/*
if (!m_wnoff)
{
diff --git a/src/devices/sound/cdp1869.h b/src/devices/sound/cdp1869.h
index eb458ee3bd9..537e8814133 100644
--- a/src/devices/sound/cdp1869.h
+++ b/src/devices/sound/cdp1869.h
@@ -215,7 +215,7 @@ protected:
virtual space_config_vector memory_space_config() const override;
// device_sound_interface callbacks
- 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;
TIMER_CALLBACK_MEMBER(prd_update);
@@ -266,7 +266,7 @@ private:
uint16_t m_hma; // home memory address
// sound state
- stream_buffer::sample_t m_signal; // current signal
+ sound_stream::sample_t m_signal; // current signal
int m_incr; // initial wave state
int m_toneoff; // tone off
int m_wnoff; // white noise off
diff --git a/src/devices/sound/cem3394.cpp b/src/devices/sound/cem3394.cpp
index b047092e00b..d2920a333c6 100644
--- a/src/devices/sound/cem3394.cpp
+++ b/src/devices/sound/cem3394.cpp
@@ -296,16 +296,13 @@ double cem3394_device::filter(double input, double cutoff)
// buffer in mono
//-------------------------------------------------
-void cem3394_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void cem3394_device::sound_stream_update(sound_stream &stream)
{
- auto &external = inputs[0];
- auto &buffer = outputs[0];
-
if (m_wave_select == 0 && m_mixer_external == 0)
LOGMASKED(LOG_VALUES, "%f V didn't cut it\n", m_values[WAVE_SELECT]);
// loop over samples
- for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
// get the current VCO position and step it forward
double vco_position = m_vco_position;
@@ -336,7 +333,7 @@ void cem3394_device::sound_stream_update(sound_stream &stream, std::vector<read_
// compute extension input (for Bally/Sente this is the noise)
if (ENABLE_EXTERNAL)
- result += EXTERNAL_VOLUME * m_mixer_external * external.get(sampindex);
+ result += EXTERNAL_VOLUME * m_mixer_external * stream.get(0, sampindex);
// compute the modulated filter frequency and apply the filter
// modulation tracks the VCO triangle
@@ -344,7 +341,7 @@ void cem3394_device::sound_stream_update(sound_stream &stream, std::vector<read_
result = filter(result, filter_freq);
// write the sample
- buffer.put(sampindex, result * m_volume);
+ stream.put(0, sampindex, result * m_volume);
}
}
@@ -407,7 +404,7 @@ double cem3394_device::compute_db(double voltage)
}
-stream_buffer::sample_t cem3394_device::compute_db_volume(double voltage)
+sound_stream::sample_t cem3394_device::compute_db_volume(double voltage)
{
double temp;
diff --git a/src/devices/sound/cem3394.h b/src/devices/sound/cem3394.h
index e086ad7bf4b..bb109dbc2a2 100644
--- a/src/devices/sound/cem3394.h
+++ b/src/devices/sound/cem3394.h
@@ -32,7 +32,7 @@ protected:
virtual void device_start() 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;
public:
// Set the voltage going to a particular parameter
@@ -51,7 +51,7 @@ public:
private:
double compute_db(double voltage);
- stream_buffer::sample_t compute_db_volume(double voltage);
+ sound_stream::sample_t compute_db_volume(double voltage);
private:
double filter(double input, double cutoff);
diff --git a/src/devices/sound/cf61909.cpp b/src/devices/sound/cf61909.cpp
index 77b8af0b5de..136633079b2 100644
--- a/src/devices/sound/cf61909.cpp
+++ b/src/devices/sound/cf61909.cpp
@@ -132,9 +132,9 @@ void cf61909_device::write(offs_t offset, u8 data)
}
/**************************************************************************/
-void cf61909_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void cf61909_device::sound_stream_update(sound_stream &stream)
{
- for (int i = 0; i < outputs[0].samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
s32 sample = 0;
@@ -156,6 +156,6 @@ void cf61909_device::sound_stream_update(sound_stream &stream, std::vector<read_
}
// Jaminator patent shows 10-bit sampling, assume that's actually true
- outputs[0].put_int_clamp(i, sample >> 9, 1 << 9);
+ stream.put_int_clamp(0, i, sample >> 9, 1 << 9);
}
}
diff --git a/src/devices/sound/cf61909.h b/src/devices/sound/cf61909.h
index 0ccc6264c0b..c1aa58d889b 100644
--- a/src/devices/sound/cf61909.h
+++ b/src/devices/sound/cf61909.h
@@ -29,7 +29,7 @@ protected:
virtual void device_reset() override ATTR_COLD;
virtual void device_clock_changed() 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;
virtual void rom_bank_pre_change() override;
private:
diff --git a/src/devices/sound/ct1745.cpp b/src/devices/sound/ct1745.cpp
index 520274dd709..1ca962d1b49 100644
--- a/src/devices/sound/ct1745.cpp
+++ b/src/devices/sound/ct1745.cpp
@@ -29,7 +29,7 @@ DEFINE_DEVICE_TYPE(CT1745, ct1745_mixer_device, "ct1745", "Creative Labs CT1745
ct1745_mixer_device::ct1745_mixer_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, CT1745, tag, owner, clock)
, device_memory_interface(mconfig, *this)
- , device_mixer_interface(mconfig, *this, 2)
+ , device_mixer_interface(mconfig, *this)
, m_irq_status_cb(*this, 0)
, m_fm(*this, finder_base::DUMMY_TAG)
, m_ldac(*this, finder_base::DUMMY_TAG)
diff --git a/src/devices/sound/dac.cpp b/src/devices/sound/dac.cpp
index c831ab24ac4..26d70d308f3 100644
--- a/src/devices/sound/dac.cpp
+++ b/src/devices/sound/dac.cpp
@@ -25,11 +25,11 @@ DEFINE_DEVICE_TYPE(_dac_type, _dac_class, _dac_shortname, _dac_description)
// the given number of bits to a sample value
//-------------------------------------------------
-stream_buffer::sample_t dac_mapper_unsigned(u32 input, u8 bits)
+sound_stream::sample_t dac_mapper_unsigned(u32 input, u8 bits)
{
- stream_buffer::sample_t scale = 1.0 / stream_buffer::sample_t((bits > 1) ? (1 << bits) : 1);
+ sound_stream::sample_t scale = 1.0 / sound_stream::sample_t((bits > 1) ? (1 << bits) : 1);
input &= (1 << bits) - 1;
- return stream_buffer::sample_t(input) * scale;
+ return sound_stream::sample_t(input) * scale;
}
@@ -38,7 +38,7 @@ stream_buffer::sample_t dac_mapper_unsigned(u32 input, u8 bits)
// value of the given number of bits to a sample value
//-------------------------------------------------
-stream_buffer::sample_t dac_mapper_signed(u32 input, u8 bits)
+sound_stream::sample_t dac_mapper_signed(u32 input, u8 bits)
{
return dac_mapper_unsigned(input ^ (1 << (bits - 1)), bits);
}
@@ -50,7 +50,7 @@ stream_buffer::sample_t dac_mapper_signed(u32 input, u8 bits)
// treated as a negative 1s complement
//-------------------------------------------------
-stream_buffer::sample_t dac_mapper_ones_complement(u32 input, u8 bits)
+sound_stream::sample_t dac_mapper_ones_complement(u32 input, u8 bits)
{
// this mapping assumes symmetric reference voltages,
// which is true for all existing cases
@@ -65,7 +65,7 @@ stream_buffer::sample_t dac_mapper_ones_complement(u32 input, u8 bits)
// dac_device_base - constructor
//-------------------------------------------------
-dac_device_base::dac_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, u8 bits, dac_mapper_callback mapper, stream_buffer::sample_t gain) :
+dac_device_base::dac_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, u8 bits, dac_mapper_callback mapper, sound_stream::sample_t gain) :
device_t(mconfig, type, tag, owner, clock),
device_sound_interface(mconfig, *this),
m_stream(nullptr),
@@ -91,7 +91,7 @@ void dac_device_base::device_start()
m_value_map[code] = m_mapper(code, m_bits) * m_gain;
// determine the number of inputs
- int inputs = (m_specified_inputs_mask == 0) ? 0 : 2;
+ int inputs = (get_sound_requested_inputs_mask() == 0) ? 0 : 2;
// large stream buffer to favour emu/sound.cpp resample quality
m_stream = stream_alloc(inputs, 1, 48000 * 32);
@@ -105,38 +105,33 @@ void dac_device_base::device_start()
// sound_stream_update - stream updates
//-------------------------------------------------
-void dac_device_base::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void dac_device_base::sound_stream_update(sound_stream &stream)
{
- auto &out = outputs[0];
-
// rails are constant
- if (inputs.size() == 0)
+ if (stream.input_count() == 0)
{
- out.fill(m_range_min + m_curval * (m_range_max - m_range_min));
+ stream.fill(0, m_range_min + m_curval * (m_range_max - m_range_min));
return;
}
- auto &hi = inputs[DAC_INPUT_RANGE_HI];
- auto &lo = inputs[DAC_INPUT_RANGE_LO];
-
// constant lo, streaming hi
- if (!BIT(m_specified_inputs_mask, DAC_INPUT_RANGE_LO))
+ if (!BIT(get_sound_requested_inputs_mask(), DAC_INPUT_RANGE_LO))
{
- for (int sampindex = 0; sampindex < out.samples(); sampindex++)
- out.put(sampindex, m_range_min + m_curval * (hi.get(sampindex) - m_range_min));
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
+ stream.put(0, sampindex, m_range_min + m_curval * (stream.get(DAC_INPUT_RANGE_HI, sampindex) - m_range_min));
}
// constant hi, streaming lo
- else if (!BIT(m_specified_inputs_mask, DAC_INPUT_RANGE_HI))
+ else if (!BIT(get_sound_requested_inputs_mask(), DAC_INPUT_RANGE_HI))
{
- for (int sampindex = 0; sampindex < out.samples(); sampindex++)
- out.put(sampindex, lo.get(sampindex) + m_curval * (m_range_max - lo.get(sampindex)));
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
+ stream.put(0, sampindex, stream.get(DAC_INPUT_RANGE_LO, sampindex) + m_curval * (m_range_max - stream.get(DAC_INPUT_RANGE_LO, sampindex)));
}
// both streams provided
else
{
- for (int sampindex = 0; sampindex < out.samples(); sampindex++)
- out.put(sampindex, lo.get(sampindex) + m_curval * (hi.get(sampindex) - lo.get(sampindex)));
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
+ stream.put(0, sampindex, stream.get(DAC_INPUT_RANGE_LO, sampindex) + m_curval * (stream.get(DAC_INPUT_RANGE_HI, sampindex) - stream.get(DAC_INPUT_RANGE_LO, sampindex)));
}
}
diff --git a/src/devices/sound/dac.h b/src/devices/sound/dac.h
index 58fa5cd7864..1465ee94a2e 100644
--- a/src/devices/sound/dac.h
+++ b/src/devices/sound/dac.h
@@ -33,17 +33,17 @@
// TYPE DEFINITIONS
//**************************************************************************
-constexpr stream_buffer::sample_t dac_gain_r2r = 1.0;
-constexpr stream_buffer::sample_t dac_gain_bw = 2.0;
+constexpr sound_stream::sample_t dac_gain_r2r = 1.0;
+constexpr sound_stream::sample_t dac_gain_bw = 2.0;
// ======================> dac_mapper_callback
-using dac_mapper_callback = stream_buffer::sample_t (*)(u32 input, u8 bits);
+using dac_mapper_callback = sound_stream::sample_t (*)(u32 input, u8 bits);
-stream_buffer::sample_t dac_mapper_unsigned(u32 input, u8 bits);
-stream_buffer::sample_t dac_mapper_signed(u32 input, u8 bits);
-stream_buffer::sample_t dac_mapper_ones_complement(u32 input, u8 bits);
+sound_stream::sample_t dac_mapper_unsigned(u32 input, u8 bits);
+sound_stream::sample_t dac_mapper_signed(u32 input, u8 bits);
+sound_stream::sample_t dac_mapper_ones_complement(u32 input, u8 bits);
// ======================> dac_bit_interface
@@ -82,13 +82,13 @@ class dac_device_base : public device_t, public device_sound_interface
{
protected:
// constructor
- dac_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, u8 bits, dac_mapper_callback mapper, stream_buffer::sample_t gain);
+ dac_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, u8 bits, dac_mapper_callback mapper, sound_stream::sample_t gain);
// device startup
virtual void device_start() override ATTR_COLD;
// stream generation
- 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;
// set the current value
void set_value(u32 value)
@@ -100,26 +100,26 @@ protected:
public:
// configuration: default output range is -1..1 for all cases except
// for 1-bit DACs, which default to 0..1
- dac_device_base &set_output_range(stream_buffer::sample_t range_min, stream_buffer::sample_t range_max)
+ dac_device_base &set_output_range(sound_stream::sample_t range_min, sound_stream::sample_t range_max)
{
m_range_min = range_min;
m_range_max = range_max;
return *this;
}
- dac_device_base &set_output_range(stream_buffer::sample_t vref) { return set_output_range(-vref, vref); }
+ dac_device_base &set_output_range(sound_stream::sample_t vref) { return set_output_range(-vref, vref); }
private:
// internal state
sound_stream *m_stream;
- stream_buffer::sample_t m_curval;
- std::vector<stream_buffer::sample_t> m_value_map;
+ sound_stream::sample_t m_curval;
+ std::vector<sound_stream::sample_t> m_value_map;
// configuration state
u8 const m_bits;
dac_mapper_callback const m_mapper;
- stream_buffer::sample_t const m_gain;
- stream_buffer::sample_t m_range_min;
- stream_buffer::sample_t m_range_max;
+ sound_stream::sample_t const m_gain;
+ sound_stream::sample_t m_range_min;
+ sound_stream::sample_t m_range_max;
};
@@ -128,7 +128,7 @@ private:
class dac_bit_device_base : public dac_device_base, public dac_bit_interface
{
protected:
- dac_bit_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 bits, dac_mapper_callback mapper, stream_buffer::sample_t gain) :
+ dac_bit_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 bits, dac_mapper_callback mapper, sound_stream::sample_t gain) :
dac_device_base(mconfig, type, tag, owner, clock, bits, mapper, gain)
{
}
@@ -144,7 +144,7 @@ public:
class dac_byte_device_base : public dac_device_base, public dac_byte_interface
{
protected:
- dac_byte_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 bits, dac_mapper_callback mapper, stream_buffer::sample_t gain) :
+ dac_byte_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 bits, dac_mapper_callback mapper, sound_stream::sample_t gain) :
dac_device_base(mconfig, type, tag, owner, clock, bits, mapper, gain)
{
}
@@ -160,7 +160,7 @@ public:
class dac_word_device_base : public dac_device_base, public dac_word_interface
{
protected:
- dac_word_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 bits, dac_mapper_callback mapper, stream_buffer::sample_t gain) :
+ dac_word_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 bits, dac_mapper_callback mapper, sound_stream::sample_t gain) :
dac_device_base(mconfig, type, tag, owner, clock, bits, mapper, gain)
{
}
diff --git a/src/devices/sound/dac3350a.cpp b/src/devices/sound/dac3350a.cpp
index 77e91650a64..91e0593c358 100644
--- a/src/devices/sound/dac3350a.cpp
+++ b/src/devices/sound/dac3350a.cpp
@@ -320,13 +320,13 @@ float dac3350a_device::calculate_volume(int val)
return powf(10.0, db / 20.0);
}
-void dac3350a_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void dac3350a_device::sound_stream_update(sound_stream &stream)
{
- const stream_buffer::sample_t enable_scale = m_dac_enable ? 1.0 : 0.0;
+ const sound_stream::sample_t enable_scale = m_dac_enable ? 1.0 : 0.0;
- for (int channel = 0; channel < 2 && channel < outputs.size(); channel++)
+ for (int channel = 0; channel < 2 && channel < stream.output_count(); channel++)
{
- for (int sampindex = 0; sampindex < outputs[channel].samples(); sampindex++)
- outputs[channel].put(sampindex, inputs[channel].get(sampindex) * enable_scale * m_volume[channel]);
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
+ stream.put(channel, sampindex, stream.get(channel, sampindex) * enable_scale * m_volume[channel]);
}
}
diff --git a/src/devices/sound/dac3350a.h b/src/devices/sound/dac3350a.h
index f1a284e1cec..920c5e73f92 100644
--- a/src/devices/sound/dac3350a.h
+++ b/src/devices/sound/dac3350a.h
@@ -17,7 +17,7 @@ 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;
private:
void i2c_device_handle_write();
diff --git a/src/devices/sound/dac76.cpp b/src/devices/sound/dac76.cpp
index 6e2065dd2cc..cbd0530eb4a 100644
--- a/src/devices/sound/dac76.cpp
+++ b/src/devices/sound/dac76.cpp
@@ -103,7 +103,7 @@ void dac76_device::device_reset()
// our sound stream
//-------------------------------------------------
-void dac76_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void dac76_device::sound_stream_update(sound_stream &stream)
{
// get current output level
int step_size = (2 << m_chord);
@@ -113,24 +113,22 @@ void dac76_device::sound_stream_update(sound_stream &stream, std::vector<read_st
vout *= (m_sb ? +1 : -1);
// range is 0-8031, normalize to 0-1 range
- stream_buffer::sample_t y = stream_buffer::sample_t(vout) * (1.0 / 8031.0);
+ sound_stream::sample_t y = sound_stream::sample_t(vout) * (1.0 / 8031.0);
if (m_voltage_output)
{
- static constexpr const float FULL_SCALE_MULT = 3.8F; // From datasheet.
+ constexpr float FULL_SCALE_MULT = 3.8F; // From datasheet.
y *= ((y >= 0) ? m_r_pos : m_r_neg) * FULL_SCALE_MULT;
}
- write_stream_view &out = outputs[0];
if (m_streaming_iref)
{
- const read_stream_view &iref = inputs[0];
- const int n = out.samples();
+ const int n = stream.samples();
for (int i = 0; i < n; ++i)
- out.put(i, iref.get(i) * y);
+ stream.put(0, i, stream.get(0, i) * y);
}
else
{
- out.fill(m_fixed_iref * y);
+ stream.fill(0, m_fixed_iref * y);
}
}
diff --git a/src/devices/sound/dac76.h b/src/devices/sound/dac76.h
index 462355b0b8f..5f4edbd29f5 100644
--- a/src/devices/sound/dac76.h
+++ b/src/devices/sound/dac76.h
@@ -92,7 +92,7 @@ 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;
private:
static constexpr int m_level[8] = { 0, 33, 99, 231, 495, 1023, 2079, 4191 };
diff --git a/src/devices/sound/digitalk.cpp b/src/devices/sound/digitalk.cpp
index d41c267e798..ebe7fbb14da 100644
--- a/src/devices/sound/digitalk.cpp
+++ b/src/devices/sound/digitalk.cpp
@@ -544,28 +544,27 @@ void digitalker_device::digitalker_step()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void digitalker_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void digitalker_device::sound_stream_update(sound_stream &stream)
{
- auto &sout = outputs[0];
int cpos = 0;
- while(cpos != sout.samples()) {
+ while(cpos != stream.samples()) {
if(m_zero_count == 0 && m_dac_index == 128)
digitalker_step();
if(m_zero_count) {
- int n = sout.samples() - cpos;
+ int n = stream.samples() - cpos;
if(n > m_zero_count)
n = m_zero_count;
- sout.fill(0, cpos, n);
+ stream.fill(0, 0, cpos, n);
cpos += n;
m_zero_count -= n;
} else if(m_dac_index != 128) {
- while(cpos != sout.samples() && m_dac_index != 128) {
+ while(cpos != stream.samples() && m_dac_index != 128) {
s32 v = m_dac[m_dac_index];
int pp = m_pitch_pos;
- while(cpos != sout.samples() && pp != m_pitch) {
- sout.put_int(cpos++, v, 32768);
+ while(cpos != stream.samples() && pp != m_pitch) {
+ stream.put_int(0, cpos++, v, 32768);
pp++;
}
if(pp == m_pitch) {
@@ -575,9 +574,6 @@ void digitalker_device::sound_stream_update(sound_stream &stream, std::vector<re
m_pitch_pos = pp;
}
- } else {
- sout.fill(0, cpos);
- break;
}
}
}
diff --git a/src/devices/sound/digitalk.h b/src/devices/sound/digitalk.h
index 053c9a60018..a169a9bebe8 100644
--- a/src/devices/sound/digitalk.h
+++ b/src/devices/sound/digitalk.h
@@ -29,7 +29,7 @@ protected:
virtual void device_start() 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;
private:
void digitalker_write(uint8_t *adr, uint8_t vol, int8_t dac);
diff --git a/src/devices/sound/disc_cls.h b/src/devices/sound/disc_cls.h
index 6bd94631bde..2e301099b04 100644
--- a/src/devices/sound/disc_cls.h
+++ b/src/devices/sound/disc_cls.h
@@ -120,13 +120,14 @@ public:
/* Add gain to the output and put into the buffers */
/* Clipping will be handled by the main sound system */
double val = DISCRETE_INPUT(0) * DISCRETE_INPUT(1);
- m_outview->put(m_outview_sample++, val * (1.0 / 32768.0));
+ m_stream->put(m_stream_output, m_outview_sample++, val * (1.0 / 32768.0));
}
virtual int max_output() override { return 0; }
- virtual void set_output_ptr(write_stream_view &view) override { m_outview = &view; m_outview_sample = 0; }
+ virtual void set_output_ptr(sound_stream &stream, int output) override { m_stream = &stream; m_stream_output = output; m_outview_sample = 0; }
private:
- write_stream_view *m_outview = nullptr;
- u32 m_outview_sample = 0U;
+ sound_stream *m_stream = nullptr;
+ int m_stream_output = 0;
+ u32 m_outview_sample = 0U;
};
DISCRETE_CLASS(dso_csvlog, 0,
@@ -233,10 +234,9 @@ public:
//protected:
uint32_t m_stream_in_number = 0;
- read_stream_view const *m_inview = nullptr; /* current in ptr for stream */
uint32_t m_inview_sample = 0;
private:
- void stream_generate(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs);
+ void stream_generate(sound_stream &stream);
double m_gain = 0.0; /* node gain */
double m_offset = 0.0; /* node offset */
diff --git a/src/devices/sound/disc_inp.hxx b/src/devices/sound/disc_inp.hxx
index 1c6c9a6dba5..baf4088d024 100644
--- a/src/devices/sound/disc_inp.hxx
+++ b/src/devices/sound/disc_inp.hxx
@@ -242,16 +242,16 @@ void DISCRETE_CLASS_FUNC(dss_input_pulse, input_write)(int sub_node, uint8_t dat
#define DSS_INPUT_STREAM__GAIN DISCRETE_INPUT(1)
#define DSS_INPUT_STREAM__OFFSET DISCRETE_INPUT(2)
-void discrete_dss_input_stream_node::stream_generate(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void discrete_dss_input_stream_node::stream_generate(sound_stream &stream)
{
- outputs[0].fill(m_data * (1.0 / 32768.0));
+ stream.fill(0, m_data * (1.0 / 32768.0));
}
DISCRETE_STEP(dss_input_stream)
{
/* the context pointer is set to point to the current input stream data in discrete_stream_update */
- if (EXPECTED(m_inview))
+ if (EXPECTED(m_buffer_stream))
{
- set_output(0, m_inview->get(m_inview_sample) * 32768.0 * m_gain + m_offset);
+ set_output(0, m_buffer_stream->get(m_stream_in_number, m_inview_sample) * 32768.0 * m_gain + m_offset);
m_inview_sample++;
}
else
@@ -260,7 +260,6 @@ DISCRETE_STEP(dss_input_stream)
DISCRETE_RESET(dss_input_stream)
{
- m_inview = nullptr;
m_data = 0;
}
@@ -300,7 +299,6 @@ DISCRETE_START(dss_input_stream)
m_stream_in_number = DSS_INPUT_STREAM__STREAM;
m_gain = DSS_INPUT_STREAM__GAIN;
m_offset = DSS_INPUT_STREAM__OFFSET;
- m_inview = nullptr;
m_is_buffered = is_buffered();
m_buffer_stream = nullptr;
@@ -314,8 +312,9 @@ void DISCRETE_CLASS_NAME(dss_input_stream)::stream_start(void)
discrete_sound_device *snd_device = downcast<discrete_sound_device *>(m_device);
//assert(DSS_INPUT_STREAM__STREAM < snd_device->m_input_stream_list.count());
- m_buffer_stream = m_device->machine().sound().stream_alloc(*snd_device, 0, 1, this->sample_rate(), stream_update_delegate(&discrete_dss_input_stream_node::stream_generate,this), STREAM_DEFAULT_FLAGS);
+ m_buffer_stream = m_device->machine().sound().stream_alloc(*snd_device, 1, 1, this->sample_rate(), stream_update_delegate(&discrete_dss_input_stream_node::stream_generate,this), STREAM_DEFAULT_FLAGS);
- snd_device->get_stream()->set_input(m_stream_in_number, m_buffer_stream);
+ // WTF?
+ // snd_device->get_stream()->set_input(m_stream_in_number, m_buffer_stream);
}
}
diff --git a/src/devices/sound/discrete.cpp b/src/devices/sound/discrete.cpp
index ad5b89c8bd9..1a8b16602ac 100644
--- a/src/devices/sound/discrete.cpp
+++ b/src/devices/sound/discrete.cpp
@@ -1050,26 +1050,25 @@ void discrete_device::process(int samples)
// our sound stream
//-------------------------------------------------
-void discrete_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void discrete_sound_device::sound_stream_update(sound_stream &stream)
{
int outputnum = 0;
/* Setup any output streams */
for (discrete_sound_output_interface *node : m_output_list)
{
- node->set_output_ptr(outputs[outputnum]);
+ node->set_output_ptr(stream, outputnum);
outputnum++;
}
/* Setup any input streams */
for (discrete_dss_input_stream_node *node : m_input_stream_list)
{
- node->m_inview = &inputs[node->m_stream_in_number];
node->m_inview_sample = 0;
}
/* just process it */
- process(outputs[0].samples());
+ process(stream.samples());
}
//-------------------------------------------------
diff --git a/src/devices/sound/discrete.h b/src/devices/sound/discrete.h
index 5a850ffc340..2a5b34dfef6 100644
--- a/src/devices/sound/discrete.h
+++ b/src/devices/sound/discrete.h
@@ -203,8 +203,8 @@
* DISCRETE_INPUT_NOT(NODE)
* DISCRETE_INPUTX_NOT(NODE,GAIN,OFFSET,INIT)
* DISCRETE_INPUT_PULSE(NODE,INIT)
- * DISCRETE_INPUT_STREAM(NODE, NUM)
- * DISCRETE_INPUTX_STREAM(NODE,NUM, GAIN,OFFSET)
+ * DISCRETE_INPUT_STREAM(NODE,NUM)
+ * DISCRETE_INPUTX_STREAM(NODE,NUM,GAIN,OFFSET)
*
* DISCRETE_COUNTER(NODE,ENAB,RESET,CLK,MIN,MAX,DIR,INIT0,CLKTYPE)
* DISCRETE_COUNTER_7492(NODE,ENAB,RESET,CLK,CLKTYPE)
@@ -442,8 +442,8 @@
*
* Declaration syntax
*
- * DISCRETE_INPUT_STREAM (name of node, stream number, )
- * DISCRETE_INPUTX_STREAM(name of node, stream nubmer, gain, offset)
+ * DISCRETE_INPUT_STREAM (name of node, stream number)
+ * DISCRETE_INPUTX_STREAM(name of node, stream number, gain, offset)
*
* Note: The discrete system is floating point based. So when routing a stream
* set it's gain to 100% and then use DISCRETE_INPUTX_STREAM to adjust
@@ -4164,7 +4164,7 @@ class discrete_sound_output_interface
public:
virtual ~discrete_sound_output_interface() { }
- virtual void set_output_ptr(write_stream_view &view) = 0;
+ virtual void set_output_ptr(sound_stream &stream, int output) = 0;
};
//**************************************************************************
@@ -4305,7 +4305,7 @@ protected:
virtual void device_reset() override ATTR_COLD;
// device_sound_interface 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;
private:
typedef std::vector<discrete_dss_input_stream_node *> istream_node_list_t;
diff --git a/src/devices/sound/dmadac.cpp b/src/devices/sound/dmadac.cpp
index ae2ebce61ad..e1e937069b6 100644
--- a/src/devices/sound/dmadac.cpp
+++ b/src/devices/sound/dmadac.cpp
@@ -158,7 +158,7 @@ void dmadac_set_volume(dmadac_sound_device **devlist, uint8_t num_channels, uint
void dmadac_sound_device::set_volume(uint16_t volume)
{
m_channel->update();
- m_volume = stream_buffer::sample_t(volume) * (1.0 / 256.0);
+ m_volume = sound_stream::sample_t(volume) * (1.0 / 256.0);
}
DEFINE_DEVICE_TYPE(DMADAC, dmadac_sound_device, "dmadac", "DMA-driven DAC")
@@ -178,23 +178,19 @@ dmadac_sound_device::dmadac_sound_device(const machine_config &mconfig, const ch
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void dmadac_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void dmadac_sound_device::sound_stream_update(sound_stream &stream)
{
- auto &output = outputs[0];
uint32_t curout = m_bufout;
uint32_t curin = m_bufin;
- /* feed as much as we can */
+ /* feed as much as we can, leave the rest as silence */
int sampindex;
- for (sampindex = 0; curout != curin && sampindex < output.samples(); sampindex++)
+ for (sampindex = 0; curout != curin && sampindex < stream.samples(); sampindex++)
{
- output.put(sampindex, stream_buffer::sample_t(m_buffer[curout]) * m_volume);
+ stream.put(0, sampindex, sound_stream::sample_t(m_buffer[curout]) * m_volume);
curout = (curout + 1) % BUFFER_SIZE;
}
- /* fill the rest with silence */
- output.fill(0, sampindex);
-
/* save the new output pointer */
m_bufout = curout;
}
diff --git a/src/devices/sound/dmadac.h b/src/devices/sound/dmadac.h
index d221a7575e4..c05e967b59a 100644
--- a/src/devices/sound/dmadac.h
+++ b/src/devices/sound/dmadac.h
@@ -24,7 +24,7 @@ public:
template <typename T> void transfer(int channel, offs_t channel_spacing, offs_t frame_spacing, offs_t total_frames, T* data) {
int j;
- constexpr stream_buffer::sample_t sample_scale = 1.0 / double(std::numeric_limits<T>::max());
+ constexpr sound_stream::sample_t sample_scale = 1.0 / double(std::numeric_limits<T>::max());
if (m_enabled)
{
@@ -35,7 +35,7 @@ public:
/* copy the data */
for (j = 0; j < total_frames && curin != maxin; j++)
{
- m_buffer[curin] = stream_buffer::sample_t(*src) * sample_scale;
+ m_buffer[curin] = sound_stream::sample_t(*src) * sample_scale;
curin = (curin + 1) % BUFFER_SIZE;
src += frame_spacing;
}
@@ -56,18 +56,18 @@ protected:
virtual void device_start() 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;
private:
// internal state
/* sound stream and buffers */
sound_stream * m_channel;
- std::vector<stream_buffer::sample_t> m_buffer;
+ std::vector<sound_stream::sample_t> m_buffer;
uint32_t m_bufin;
uint32_t m_bufout;
/* per-channel parameters */
- stream_buffer::sample_t m_volume;
+ sound_stream::sample_t m_volume;
uint8_t m_enabled;
static constexpr int BUFFER_SIZE = 32768;
diff --git a/src/devices/sound/dspv.cpp b/src/devices/sound/dspv.cpp
index 9877cee3fb1..9ced7ba9ceb 100644
--- a/src/devices/sound/dspv.cpp
+++ b/src/devices/sound/dspv.cpp
@@ -113,9 +113,8 @@ void dspv_device::snd_w(offs_t offset, u16 data)
logerror("w %02x, %04x %s\n", offset, data, machine().describe_context());
}
-void dspv_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void dspv_device::sound_stream_update(sound_stream &stream)
{
- outputs[0].fill(0);
}
void dspv_device::device_start()
diff --git a/src/devices/sound/dspv.h b/src/devices/sound/dspv.h
index defc5343b32..ec6dab50c46 100644
--- a/src/devices/sound/dspv.h
+++ b/src/devices/sound/dspv.h
@@ -28,7 +28,7 @@ protected:
virtual void state_export(const device_state_entry &entry) override;
virtual void state_string_export(const device_state_entry &entry, std::string &str) const override;
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;
private:
address_space_config m_prg1_config, m_prg2_config, m_data_config;
diff --git a/src/devices/sound/es1373.cpp b/src/devices/sound/es1373.cpp
index 5ce753da4a7..c3b88ecac49 100644
--- a/src/devices/sound/es1373.cpp
+++ b/src/devices/sound/es1373.cpp
@@ -80,8 +80,7 @@
void es1373_device::device_add_mconfig(machine_config &config)
{
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
DEFINE_DEVICE_TYPE(ES1373, es1373_device, "es1373", "Creative Labs Ensoniq AudioPCI97 ES1373")
@@ -211,24 +210,21 @@ TIMER_CALLBACK_MEMBER(es1373_device::delayed_stream_update)
// sound_stream_update - handle update requests for
// our sound stream
//-------------------------------------------------
-void es1373_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void es1373_device::sound_stream_update(sound_stream &stream)
{
if (m_dac1.enable) {
LOGMASKED(LOG_UNIMPL, "%s: sound_stream_update DAC1 not implemented yet\n", tag());
}
if (m_dac2.enable) {
- send_audio_out(m_dac2, ICSTATUS_DAC2_INT_MASK, outputs[0], outputs[1]);
- } else {
- outputs[0].fill(0);
- outputs[1].fill(0);
+ send_audio_out(m_dac2, ICSTATUS_DAC2_INT_MASK, stream);
}
if (m_adc.enable) {
if (m_adc.format!=SCTRL_16BIT_MONO) {
LOGMASKED(LOG_UNIMPL, "%s: sound_stream_update Only SCTRL_16BIT_MONO recorded supported\n", tag());
} else {
- for (int i=0; i<outputs[0].samples(); i++) {
+ for (int i=0; i<stream.samples(); i++) {
if (m_adc.buf_count<=m_adc.buf_size) {
LOGMASKED(LOG_OTHER, "%s: ADC buf_count: %i buf_size: %i buf_rptr: %i buf_wptr: %i\n", machine().describe_context(),
m_adc.buf_count, m_adc.buf_size, m_adc.buf_rptr, m_adc.buf_wptr);
@@ -270,7 +266,7 @@ void es1373_device::sound_stream_update(sound_stream &stream, std::vector<read_s
//-------------------------------------------------
// send_audio_out - Sends channel audio output data
//-------------------------------------------------
-void es1373_device::send_audio_out(chan_info& chan, uint32_t intr_mask, write_stream_view &outL, write_stream_view &outR)
+void es1373_device::send_audio_out(chan_info& chan, uint32_t intr_mask, sound_stream &stream)
{
// Only transfer PCI data if bus mastering is enabled
// Fill initial half buffer
@@ -281,7 +277,7 @@ void es1373_device::send_audio_out(chan_info& chan, uint32_t intr_mask, write_st
//uint32_t sample_size = calc_size(chan.format);
// Send data to sound stream
bool buf_row_done;
- for (int i=0; i<outL.samples(); i++) {
+ for (int i=0; i<stream.samples(); i++) {
buf_row_done = false;
int16_t lsamp = 0, rsamp = 0;
if (chan.buf_count<=chan.buf_size) {
@@ -293,7 +289,7 @@ void es1373_device::send_audio_out(chan_info& chan, uint32_t intr_mask, write_st
}
if (i == 0)
LOGMASKED(LOG_OTHER, "%s: chan: %X samples: %i buf_count: %X buf_size: %X buf_rptr: %X buf_wptr: %X\n",
- machine().describe_context(), chan.number, outL.samples(), chan.buf_count, chan.buf_size, chan.buf_rptr, chan.buf_wptr);
+ machine().describe_context(), chan.number, stream.samples(), chan.buf_count, chan.buf_size, chan.buf_rptr, chan.buf_wptr);
// Buffer is 4 bytes per location, need to switch on sample mode
switch (chan.format) {
case SCTRL_8BIT_MONO:
@@ -340,8 +336,8 @@ void es1373_device::send_audio_out(chan_info& chan, uint32_t intr_mask, write_st
chan.buf_rptr -= 0x10;
}
}
- outL.put_int(i, lsamp, 32768);
- outR.put_int(i, rsamp, 32768);
+ stream.put_int(0, i, lsamp, 32768);
+ stream.put_int(1, i, rsamp, 32768);
}
}
diff --git a/src/devices/sound/es1373.h b/src/devices/sound/es1373.h
index 054a62901a3..b1c7739dde7 100644
--- a/src/devices/sound/es1373.h
+++ b/src/devices/sound/es1373.h
@@ -26,7 +26,7 @@ protected:
virtual void device_reset() override ATTR_COLD;
virtual void device_add_mconfig(machine_config &config) override ATTR_COLD;
virtual void device_post_load() 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;
TIMER_CALLBACK_MEMBER(delayed_stream_update);
@@ -52,7 +52,7 @@ private:
void transfer_pci_audio(chan_info& chan, int type);
uint32_t calc_size(const uint8_t &format);
- void send_audio_out(chan_info& chan, uint32_t intr_mask, write_stream_view &outL, write_stream_view &outR);
+ void send_audio_out(chan_info& chan, uint32_t intr_mask, sound_stream &stream);
emu_timer *m_timer;
address_space *m_memory_space;
diff --git a/src/devices/sound/es5503.cpp b/src/devices/sound/es5503.cpp
index fc23656d36b..d4d05545852 100644
--- a/src/devices/sound/es5503.cpp
+++ b/src/devices/sound/es5503.cpp
@@ -152,12 +152,12 @@ void es5503_device::halt_osc(int onum, int type, uint32_t *accumulator, int ress
m_irq_func(1);
}
}
-void es5503_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void es5503_device::sound_stream_update(sound_stream &stream)
{
int32_t *mixp;
int osc, snum, i;
uint32_t ramptr;
- int samples = outputs[0].samples();
+ int samples = stream.samples();
assert(samples < (44100/50));
std::fill_n(&m_mix_buffer[0], samples*output_channels, 0);
@@ -257,9 +257,9 @@ void es5503_device::sound_stream_update(sound_stream &stream, std::vector<read_s
mixp = &m_mix_buffer[0];
for (int chan = 0; chan < output_channels; chan++)
{
- for (i = 0; i < outputs[chan].samples(); i++)
+ for (i = 0; i < stream.samples(); i++)
{
- outputs[chan].put_int(i, *mixp++, 32768*8);
+ stream.put_int(chan, i, *mixp++, 32768*8);
}
}
}
diff --git a/src/devices/sound/es5503.h b/src/devices/sound/es5503.h
index ef22d476b42..e04d5018409 100644
--- a/src/devices/sound/es5503.h
+++ b/src/devices/sound/es5503.h
@@ -35,7 +35,7 @@ protected:
virtual void device_reset() override ATTR_COLD;
// device_sound_interface 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;
// device_rom_interface overrides
virtual void rom_bank_pre_change() override;
diff --git a/src/devices/sound/es5506.cpp b/src/devices/sound/es5506.cpp
index bc7412619f2..455c991b94b 100644
--- a/src/devices/sound/es5506.cpp
+++ b/src/devices/sound/es5506.cpp
@@ -1009,10 +1009,10 @@ inline void es550x_device::generate_irq(es550x_voice *voice, int v)
***********************************************************************************************/
-void es5506_device::generate_samples(std::vector<write_stream_view> &outputs)
+void es5506_device::generate_samples(sound_stream &stream)
{
// loop while we still have samples to generate
- for (int sampindex = 0; sampindex < outputs[0].samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
// loop over voices
s32 cursample[12] = { 0 };
@@ -1038,15 +1038,15 @@ void es5506_device::generate_samples(std::vector<write_stream_view> &outputs)
generate_irq(voice, v);
}
- for (int c = 0; c < outputs.size(); c++)
- outputs[c].put_int(sampindex, cursample[c], 32768);
+ for (int c = 0; c < stream.output_count(); c++)
+ stream.put_int(c, sampindex, cursample[c], 32768);
}
}
-void es5505_device::generate_samples(std::vector<write_stream_view> &outputs)
+void es5505_device::generate_samples(sound_stream &stream)
{
// loop while we still have samples to generate
- for (int sampindex = 0; sampindex < outputs[0].samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
// loop over voices
s32 cursample[12] = { 0 };
@@ -1076,8 +1076,8 @@ void es5505_device::generate_samples(std::vector<write_stream_view> &outputs)
generate_irq(voice, v);
}
- for (int c = 0; c < outputs.size(); c++)
- outputs[c].put_int(sampindex, cursample[c], 32768);
+ for (int c = 0; c < stream.output_count(); c++)
+ stream.put_int(c, sampindex, cursample[c], 32768);
}
}
@@ -2091,7 +2091,7 @@ u16 es5505_device::read(offs_t offset)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void es550x_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void es550x_device::sound_stream_update(sound_stream &stream)
{
#if ES5506_MAKE_WAVS
// start the logging once we have a sample rate
@@ -2103,7 +2103,7 @@ void es550x_device::sound_stream_update(sound_stream &stream, std::vector<read_s
#endif
// loop until all samples are output
- generate_samples(outputs);
+ generate_samples(stream);
#if ES5506_MAKE_WAVS
// log the raw data
diff --git a/src/devices/sound/es5506.h b/src/devices/sound/es5506.h
index cb4279165af..372849f0ddb 100644
--- a/src/devices/sound/es5506.h
+++ b/src/devices/sound/es5506.h
@@ -84,7 +84,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;
void update_irq_state();
void update_internal_irq_state();
@@ -114,7 +114,7 @@ protected:
void generate_ulaw(es550x_voice *voice, s32 *dest);
void generate_pcm(es550x_voice *voice, s32 *dest);
inline void generate_irq(es550x_voice *voice, int v);
- virtual void generate_samples(std::vector<write_stream_view> &outputs) {}
+ virtual void generate_samples(sound_stream &stream) {}
inline void update_index(es550x_voice *voice) { m_voice_index = voice->index; }
virtual inline u16 read_sample(es550x_voice *voice, offs_t addr) { return 0; }
@@ -189,7 +189,7 @@ protected:
virtual void update_envelopes(es550x_voice *voice) override;
virtual void check_for_end_forward(es550x_voice *voice, u64 &accum) override;
virtual void check_for_end_reverse(es550x_voice *voice, u64 &accum) override;
- virtual void generate_samples(std::vector<write_stream_view> &outputs) override;
+ virtual void generate_samples(sound_stream &stream) override;
virtual inline u16 read_sample(es550x_voice *voice, offs_t addr) override { update_index(voice); return m_cache[get_bank(voice->control)].read_word(addr); }
@@ -243,7 +243,7 @@ protected:
virtual void update_envelopes(es550x_voice *voice) override;
virtual void check_for_end_forward(es550x_voice *voice, u64 &accum) override;
virtual void check_for_end_reverse(es550x_voice *voice, u64 &accum) override;
- virtual void generate_samples(std::vector<write_stream_view> &outputs) override;
+ virtual void generate_samples(sound_stream &stream) override;
virtual inline u16 read_sample(es550x_voice *voice, offs_t addr) override { update_index(voice); return m_cache[get_bank(voice->control)].read_word(addr); }
diff --git a/src/devices/sound/esqpump.cpp b/src/devices/sound/esqpump.cpp
index af1a59db799..cda48b68eb0 100644
--- a/src/devices/sound/esqpump.cpp
+++ b/src/devices/sound/esqpump.cpp
@@ -53,26 +53,22 @@ void esq_5505_5510_pump_device::device_clock_changed()
m_stream->set_sample_rate(clock());
}
-void esq_5505_5510_pump_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void esq_5505_5510_pump_device::sound_stream_update(sound_stream &stream)
{
- sound_assert(outputs[0].samples() == 1);
-
- auto &left = outputs[0];
- auto &right = outputs[1];
#define SAMPLE_SHIFT 4
- constexpr stream_buffer::sample_t input_scale = 32768.0 / (1 << SAMPLE_SHIFT);
+ constexpr sound_stream::sample_t input_scale = 32768.0 / (1 << SAMPLE_SHIFT);
// anything for the 'aux' output?
- stream_buffer::sample_t l = inputs[0].get(0) * (1.0 / (1 << SAMPLE_SHIFT));
- stream_buffer::sample_t r = inputs[1].get(0) * (1.0 / (1 << SAMPLE_SHIFT));
+ sound_stream::sample_t l = stream.get(0, 0) * (1.0 / (1 << SAMPLE_SHIFT));
+ sound_stream::sample_t r = stream.get(1, 0) * (1.0 / (1 << SAMPLE_SHIFT));
// push the samples into the ESP
- m_esp->ser_w(0, s32(inputs[2].get(0) * input_scale));
- m_esp->ser_w(1, s32(inputs[3].get(0) * input_scale));
- m_esp->ser_w(2, s32(inputs[4].get(0) * input_scale));
- m_esp->ser_w(3, s32(inputs[5].get(0) * input_scale));
- m_esp->ser_w(4, s32(inputs[6].get(0) * input_scale));
- m_esp->ser_w(5, s32(inputs[7].get(0) * input_scale));
+ m_esp->ser_w(0, s32(stream.get(2, 0) * input_scale));
+ m_esp->ser_w(1, s32(stream.get(3, 0) * input_scale));
+ m_esp->ser_w(2, s32(stream.get(4, 0) * input_scale));
+ m_esp->ser_w(3, s32(stream.get(5, 0) * input_scale));
+ m_esp->ser_w(4, s32(stream.get(6, 0) * input_scale));
+ m_esp->ser_w(5, s32(stream.get(7, 0) * input_scale));
#if PUMP_FAKE_ESP_PROCESSING
m_esp->ser_w(6, m_esp->ser_r(0) + m_esp->ser_r(2) + m_esp->ser_r(4));
@@ -88,16 +84,16 @@ void esq_5505_5510_pump_device::sound_stream_update(sound_stream &stream, std::v
#endif
// read the processed result from the ESP and add to the saved AUX data
- stream_buffer::sample_t ll = stream_buffer::sample_t(m_esp->ser_r(6)) * (1.0 / 32768.0);
- stream_buffer::sample_t rr = stream_buffer::sample_t(m_esp->ser_r(7)) * (1.0 / 32768.0);
+ sound_stream::sample_t ll = sound_stream::sample_t(m_esp->ser_r(6)) * (1.0 / 32768.0);
+ sound_stream::sample_t rr = sound_stream::sample_t(m_esp->ser_r(7)) * (1.0 / 32768.0);
l += ll;
r += rr;
#if !PUMP_FAKE_ESP_PROCESSING && PUMP_REPLACE_ESP_PROGRAM
// if we're processing the fake program through the ESP, the result should just be that of adding the inputs
- stream_buffer::sample_t el = (inputs[2].get(0)) + (inputs[4].get(0)) + (inputs[6].get(0));
- stream_buffer::sample_t er = (inputs[3].get(0)) + (inputs[5].get(0)) + (inputs[7].get(0));
- stream_buffer::sample_t e_next = el + er;
+ sound_stream::sample_t el = (stream.get(2, 0)) + (stream.get(4, 0)) + (stream.get(6, 0));
+ sound_stream::sample_t er = (stream.get(3, 0)) + (stream.get(5, 0)) + (stream.get(7, 0));
+ sound_stream::sample_t e_next = el + er;
e[(ei + 0x1d0f) % 0x4000] = e_next;
if (fabs(l - e[ei]) > 1e-5) {
@@ -107,8 +103,8 @@ void esq_5505_5510_pump_device::sound_stream_update(sound_stream &stream, std::v
#endif
// write the combined data to the output
- left.put(0, l);
- right.put(0, r);
+ stream.put(0, 0, l);
+ stream.put(1, 0, r);
#if PUMP_DETECT_SILENCE
if (left.get(0) == 0 && right.get(0) == 0) {
diff --git a/src/devices/sound/esqpump.h b/src/devices/sound/esqpump.h
index dfbfe477770..e6257c1c977 100644
--- a/src/devices/sound/esqpump.h
+++ b/src/devices/sound/esqpump.h
@@ -73,7 +73,7 @@ protected:
virtual void device_clock_changed() override;
// 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;
private:
// internal state:
@@ -103,7 +103,7 @@ private:
#endif
#if !PUMP_FAKE_ESP_PROCESSING && PUMP_REPLACE_ESP_PROGRAM
- std::vector<stream_buffer::sample_t> e;
+ std::vector<sound_stream::sample_t> e;
int ei;
#endif
};
diff --git a/src/devices/sound/flt_biquad.cpp b/src/devices/sound/flt_biquad.cpp
index e56c355ac95..9f21f9e5c25 100644
--- a/src/devices/sound/flt_biquad.cpp
+++ b/src/devices/sound/flt_biquad.cpp
@@ -474,22 +474,19 @@ void filter_biquad_device::device_start()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void filter_biquad_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void filter_biquad_device::sound_stream_update(sound_stream &stream)
{
- auto &src = inputs[0];
- auto &dst = outputs[0];
-
- if (m_last_sample_rate != m_stream->sample_rate())
+ if (m_last_sample_rate != stream.sample_rate())
{
recalc();
- m_last_sample_rate = m_stream->sample_rate();
+ m_last_sample_rate = stream.sample_rate();
}
- for (int sampindex = 0; sampindex < dst.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
- m_input = src.get(sampindex);
+ m_input = stream.get(0, sampindex);
step();
- dst.put(sampindex, m_output);
+ stream.put(0, sampindex, m_output);
}
}
diff --git a/src/devices/sound/flt_biquad.h b/src/devices/sound/flt_biquad.h
index 702e42f9dac..d33c5f1db39 100644
--- a/src/devices/sound/flt_biquad.h
+++ b/src/devices/sound/flt_biquad.h
@@ -88,7 +88,7 @@ protected:
virtual void device_start() 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;
private:
void recalc();
@@ -101,9 +101,9 @@ private:
double m_q;
double m_gain;
- stream_buffer::sample_t m_input;
+ sound_stream::sample_t m_input;
double m_w0, m_w1, m_w2; /* w[k], w[k-1], w[k-2], current and previous intermediate values */
- stream_buffer::sample_t m_output;
+ sound_stream::sample_t m_output;
double m_a1, m_a2; /* digital filter coefficients, denominator */
double m_b0, m_b1, m_b2; /* digital filter coefficients, numerator */
};
diff --git a/src/devices/sound/flt_rc.cpp b/src/devices/sound/flt_rc.cpp
index 489cb01fb07..2a14aaabbd3 100644
--- a/src/devices/sound/flt_rc.cpp
+++ b/src/devices/sound/flt_rc.cpp
@@ -55,34 +55,32 @@ void filter_rc_device::device_start()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void filter_rc_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void filter_rc_device::sound_stream_update(sound_stream &stream)
{
- auto &src = inputs[0];
- auto &dst = outputs[0];
- stream_buffer::sample_t memory = m_memory;
+ sound_stream::sample_t memory = m_memory;
- if (m_last_sample_rate != m_stream->sample_rate())
+ if (m_last_sample_rate != stream.sample_rate())
{
recalc();
- m_last_sample_rate = m_stream->sample_rate();
+ m_last_sample_rate = stream.sample_rate();
}
switch (m_type)
{
case LOWPASS_3R:
case LOWPASS:
- for (int sampindex = 0; sampindex < dst.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
- memory += (src.get(sampindex) - memory) * m_k;
- dst.put(sampindex, memory);
+ memory += (stream.get(0, sampindex) - memory) * m_k;
+ stream.put(0, sampindex, memory);
}
break;
case HIGHPASS:
case AC:
- for (int sampindex = 0; sampindex < dst.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
- dst.put(sampindex, src.get(sampindex) - memory);
- memory += (src.get(sampindex) - memory) * m_k;
+ stream.put(0, sampindex, stream.get(0, sampindex) - memory);
+ memory += (stream.get(0, sampindex) - memory) * m_k;
}
break;
}
diff --git a/src/devices/sound/flt_rc.h b/src/devices/sound/flt_rc.h
index 9230da69a49..daabe4c11c7 100644
--- a/src/devices/sound/flt_rc.h
+++ b/src/devices/sound/flt_rc.h
@@ -110,15 +110,15 @@ protected:
virtual void device_start() 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;
private:
void recalc();
private:
sound_stream* m_stream;
- stream_buffer::sample_t m_k;
- stream_buffer::sample_t m_memory;
+ sound_stream::sample_t m_k;
+ sound_stream::sample_t m_memory;
int m_type;
int m_last_sample_rate;
double m_R1;
diff --git a/src/devices/sound/flt_vol.cpp b/src/devices/sound/flt_vol.cpp
index d5d92209cac..c3f8b5f0b2e 100644
--- a/src/devices/sound/flt_vol.cpp
+++ b/src/devices/sound/flt_vol.cpp
@@ -35,10 +35,10 @@ void filter_volume_device::device_start()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void filter_volume_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void filter_volume_device::sound_stream_update(sound_stream &stream)
{
- for (int i = 0; i < outputs[0].samples(); i++)
- outputs[0].put(i, inputs[0].get(i) * m_gain);
+ for (int i = 0; i < stream.samples(); i++)
+ stream.put(0, i, stream.get(0, i) * m_gain);
}
diff --git a/src/devices/sound/flt_vol.h b/src/devices/sound/flt_vol.h
index 2e2d665f257..96bc61af200 100644
--- a/src/devices/sound/flt_vol.h
+++ b/src/devices/sound/flt_vol.h
@@ -25,7 +25,7 @@ protected:
virtual void device_start() 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;
private:
sound_stream* m_stream;
diff --git a/src/devices/sound/gaelco.cpp b/src/devices/sound/gaelco.cpp
index 2c04678ff62..e40f35d1e7c 100644
--- a/src/devices/sound/gaelco.cpp
+++ b/src/devices/sound/gaelco.cpp
@@ -77,10 +77,10 @@ gaelco_gae1_device::gaelco_gae1_device(const machine_config &mconfig, device_typ
Writes length bytes to the sound buffer
============================================================================*/
-void gaelco_gae1_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void gaelco_gae1_device::sound_stream_update(sound_stream &stream)
{
/* fill all data needed */
- for (int j = 0; j < outputs[0].samples(); j++)
+ for (int j = 0; j < stream.samples(); j++)
{
int output_l = 0, output_r = 0;
@@ -178,8 +178,8 @@ void gaelco_gae1_device::sound_stream_update(sound_stream &stream, std::vector<r
#endif
/* now that we have computed all channels, save current data to the output buffer */
- outputs[0].put_int(j, output_l, 32768);
- outputs[1].put_int(j, output_r, 32768);
+ stream.put_int(0, j, output_l, 32768);
+ stream.put_int(1, j, output_r, 32768);
}
// if (wavraw)
diff --git a/src/devices/sound/gaelco.h b/src/devices/sound/gaelco.h
index 2fff2ca4bee..014472d73f9 100644
--- a/src/devices/sound/gaelco.h
+++ b/src/devices/sound/gaelco.h
@@ -43,7 +43,7 @@ protected:
virtual void device_clock_changed() override;
// 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;
// device_rom_interface overrides
virtual void rom_bank_pre_change() override;
diff --git a/src/devices/sound/gb.cpp b/src/devices/sound/gb.cpp
index 81541884162..d8a965e0aa1 100644
--- a/src/devices/sound/gb.cpp
+++ b/src/devices/sound/gb.cpp
@@ -1307,11 +1307,9 @@ constexpr s32 convert_output(s32 sample)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void gameboy_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void gameboy_sound_device::sound_stream_update(sound_stream &stream)
{
- auto &outputl = outputs[0];
- auto &outputr = outputs[1];
- for (int sampindex = 0; sampindex < outputl.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
s32 sample;
s32 left = 0;
@@ -1362,7 +1360,7 @@ void gameboy_sound_device::sound_stream_update(sound_stream &stream, std::vector
right *= 1 + m_snd_control.vol_right;
/* Update the buffers */
- outputl.put_int(sampindex, left, 15 * 4 * (1 + 7));
- outputr.put_int(sampindex, right, 15 * 4 * (1 + 7));
+ stream.put_int(0, sampindex, left, 15 * 4 * (1 + 7));
+ stream.put_int(1, sampindex, right, 15 * 4 * (1 + 7));
}
}
diff --git a/src/devices/sound/gb.h b/src/devices/sound/gb.h
index a4211e28133..d81a79b98b1 100644
--- a/src/devices/sound/gb.h
+++ b/src/devices/sound/gb.h
@@ -27,7 +27,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;
protected:
enum
diff --git a/src/devices/sound/gew.cpp b/src/devices/sound/gew.cpp
index c9d3ea3e500..274acbc2494 100644
--- a/src/devices/sound/gew.cpp
+++ b/src/devices/sound/gew.cpp
@@ -543,9 +543,9 @@ void gew_pcm_device::dump_sample(slot_t &slot)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void gew_pcm_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void gew_pcm_device::sound_stream_update(sound_stream &stream)
{
- for (int32_t i = 0; i < outputs[0].samples(); ++i)
+ for (int32_t i = 0; i < stream.samples(); ++i)
{
int32_t smpl = 0;
int32_t smpr = 0;
@@ -624,8 +624,8 @@ void gew_pcm_device::sound_stream_update(sound_stream &stream, std::vector<read_
}
}
- outputs[0].put_int_clamp(i, smpl, 32768);
- outputs[1].put_int_clamp(i, smpr, 32768);
+ stream.put_int_clamp(0, i, smpl, 32768);
+ stream.put_int_clamp(1, i, smpr, 32768);
}
}
diff --git a/src/devices/sound/gew.h b/src/devices/sound/gew.h
index ddee760d461..233a02227c5 100644
--- a/src/devices/sound/gew.h
+++ b/src/devices/sound/gew.h
@@ -29,7 +29,7 @@ protected:
virtual void device_clock_changed() override;
// 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;
// device_rom_interface overrides
virtual void rom_bank_pre_change() override;
diff --git a/src/devices/sound/gt155.cpp b/src/devices/sound/gt155.cpp
index 61faf1ac1e6..bdd71a074c5 100644
--- a/src/devices/sound/gt155.cpp
+++ b/src/devices/sound/gt155.cpp
@@ -93,9 +93,9 @@ void gt155_device::device_clock_changed()
}
/**************************************************************************/
-void gt155_device::sound_stream_update(sound_stream& stream, std::vector<read_stream_view> const& inputs, std::vector<write_stream_view>& outputs)
+void gt155_device::sound_stream_update(sound_stream& stream)
{
- for (int i = 0; i < outputs[0].samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
s64 left = 0, right = 0;
@@ -108,8 +108,8 @@ void gt155_device::sound_stream_update(sound_stream& stream, std::vector<read_st
}
}
- outputs[0].put_int_clamp(i, left >> 11, 32678);
- outputs[1].put_int_clamp(i, right >> 11, 32768);
+ stream.put_int_clamp(0, i, left >> 11, 32678);
+ stream.put_int_clamp(1, i, right >> 11, 32768);
}
}
diff --git a/src/devices/sound/gt155.h b/src/devices/sound/gt155.h
index 69dbe91121e..319ec1c2661 100644
--- a/src/devices/sound/gt155.h
+++ b/src/devices/sound/gt155.h
@@ -36,7 +36,7 @@ protected:
virtual void device_clock_changed() override;
// device_sound_interface 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;
// device_rom_interface overrides
virtual void rom_bank_pre_change() override;
diff --git a/src/devices/sound/hc55516.cpp b/src/devices/sound/hc55516.cpp
index 885751c1a6a..0bd36ae381f 100644
--- a/src/devices/sound/hc55516.cpp
+++ b/src/devices/sound/hc55516.cpp
@@ -197,15 +197,12 @@ void cvsd_device_base::process_bit(bool bit, bool clock_state)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void cvsd_device_base::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void cvsd_device_base::sound_stream_update(sound_stream &stream)
{
// Stub, just return silence
- auto &buffer = outputs[0];
-
- m_samples_generated += buffer.samples();
+ m_samples_generated += stream.samples();
if (m_samples_generated >= SAMPLE_RATE)
m_samples_generated -= SAMPLE_RATE;
- buffer.fill(0);
}
@@ -356,16 +353,14 @@ void hc55516_device::process_bit(bool bit, bool clock_state)
// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void hc55516_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void hc55516_device::sound_stream_update(sound_stream &stream)
{
- auto &buffer = outputs[0];
-
if (is_external_oscillator())
{
// external oscillator
- for (int i = 0; i < buffer.samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
- buffer.put_int(i, m_next_sample, 32768);
+ stream.put_int(0, i, m_next_sample, 32768);
m_samples_generated++;
@@ -384,8 +379,8 @@ void hc55516_device::sound_stream_update(sound_stream &stream, std::vector<read_
// software driven clock
else
{
- for (int i = 0; i < buffer.samples(); i++)
- buffer.put_int(i, m_next_sample, 32768);
+ for (int i = 0; i < stream.samples(); i++)
+ stream.put_int(0, i, m_next_sample, 32768);
}
}
@@ -493,14 +488,12 @@ void mc3417_device::process_bit(bool bit, bool clock_state)
}
}
-void mc3417_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void mc3417_device::sound_stream_update(sound_stream &stream)
{
- auto &buffer = outputs[0];
-
if (!is_external_oscillator())
{
// track how many samples we've updated without a clock; if it's been more than 1/32 of a second, output silence
- m_samples_generated += buffer.samples();
+ m_samples_generated += stream.samples();
if (m_samples_generated > SAMPLE_RATE / 32)
{
m_samples_generated = SAMPLE_RATE;
@@ -509,16 +502,16 @@ void mc3417_device::sound_stream_update(sound_stream &stream, std::vector<read_s
}
// compute the interpolation slope
- stream_buffer::sample_t sample = m_curr_sample;
- stream_buffer::sample_t slope = (m_next_sample - sample) / buffer.samples();
+ sound_stream::sample_t sample = m_curr_sample;
+ sound_stream::sample_t slope = (m_next_sample - sample) / stream.samples();
m_curr_sample = m_next_sample;
if (is_external_oscillator())
{
// external oscillator
- for (int i = 0; i < buffer.samples(); i++, sample += slope)
+ for (int i = 0; i < stream.samples(); i++, sample += slope)
{
- buffer.put(i, sample);
+ stream.put(0, i, sample);
m_samples_generated++;
@@ -537,8 +530,8 @@ void mc3417_device::sound_stream_update(sound_stream &stream, std::vector<read_s
// software driven clock
else
{
- for (int i = 0; i < buffer.samples(); i++, sample += slope)
- buffer.put(i, sample);
+ for (int i = 0; i < stream.samples(); i++, sample += slope)
+ stream.put(0, i, sample);
}
}
diff --git a/src/devices/sound/hc55516.h b/src/devices/sound/hc55516.h
index 9862e489b3f..ac1a56bf739 100644
--- a/src/devices/sound/hc55516.h
+++ b/src/devices/sound/hc55516.h
@@ -52,7 +52,7 @@ public:
// Audio In pin, an analog value of the audio waveform being pushed to the chip.
// TODO: this is not hooked up or implemented yet, and this should really be handled as an
// input stream from a separate DAC device, not a value push function at all.
- //void audio_in_w(stream_buffer::sample_t data);
+ //void audio_in_w(sound_stream::sample_t data);
// sets the buffered digit (0 or 1), common to all chips. TODO: replace all use of this with
// digin_cb once implemented
@@ -74,7 +74,7 @@ protected:
//virtual void device_clock_changed() override;
// 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;
// callbacks
devcb_write_line m_clock_state_push_cb; // TODO: get rid of this, if you use it you should feel bad
@@ -129,7 +129,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;
// callbacks
devcb_write_line m_agc_push_cb;
@@ -179,7 +179,7 @@ protected:
virtual void device_start() 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;
// const coefficients defined by constructor; should these be adjustable by the user or externally defined,
// as they are implemented using a set of two small lowpass filters outside the chip?
@@ -190,8 +190,8 @@ protected:
// internal state
double m_sylfilter;
double m_intfilter;
- stream_buffer::sample_t m_curr_sample;
- stream_buffer::sample_t m_next_sample;
+ sound_stream::sample_t m_curr_sample;
+ sound_stream::sample_t m_next_sample;
// internal handlers
virtual void process_bit(bool bit, bool clock_state) override;
diff --git a/src/devices/sound/huc6230.cpp b/src/devices/sound/huc6230.cpp
index ba969479cf2..33e59309f2b 100644
--- a/src/devices/sound/huc6230.cpp
+++ b/src/devices/sound/huc6230.cpp
@@ -19,16 +19,16 @@
#include "huc6230.h"
-void huc6230_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void huc6230_device::sound_stream_update(sound_stream &stream)
{
- for (int i = 0; i < outputs[0].samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
// TODO: this implies to read from the PSG inputs
// doesn't seem right at all, eventually causes extreme DC offset on BIOS main menu,
// possibly because adpcm_timer runs from a different thread,
// needs to be rechecked once we have better examples ...
- s32 samp0 = inputs[0].get(i) * 32768.0;
- s32 samp1 = inputs[1].get(i) * 32768.0;
+ s32 samp0 = stream.get(0, i) * 32768.0;
+ s32 samp1 = stream.get(1, i) * 32768.0;
for (int adpcm = 0; adpcm < 2; adpcm++)
{
@@ -42,8 +42,8 @@ void huc6230_device::sound_stream_update(sound_stream &stream, std::vector<read_
samp1 = std::clamp(samp1 + ((channel->m_output * channel->m_rvol) >> 4), -32768, 32767);
}
- outputs[0].put_int(i, samp0, 32768);
- outputs[1].put_int(i, samp1, 32768);
+ stream.put_int(0, i, samp0, 32768);
+ stream.put_int(1, i, samp1, 32768);
}
}
diff --git a/src/devices/sound/huc6230.h b/src/devices/sound/huc6230.h
index f71e746190c..4c0ba5dea0b 100644
--- a/src/devices/sound/huc6230.h
+++ b/src/devices/sound/huc6230.h
@@ -28,7 +28,7 @@ protected:
virtual void device_clock_changed() override;
// 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;
private:
struct adpcm_channel {
diff --git a/src/devices/sound/i5000.cpp b/src/devices/sound/i5000.cpp
index 3f194ef74c5..9c599651925 100644
--- a/src/devices/sound/i5000.cpp
+++ b/src/devices/sound/i5000.cpp
@@ -114,9 +114,9 @@ bool i5000snd_device::read_sample(int ch)
}
-void i5000snd_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void i5000snd_device::sound_stream_update(sound_stream &stream)
{
- for (int i = 0; i < outputs[0].samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
int32_t mix_l = 0;
int32_t mix_r = 0;
@@ -157,8 +157,8 @@ void i5000snd_device::sound_stream_update(sound_stream &stream, std::vector<read
mix_l += m_channels[ch].output_l;
}
- outputs[0].put_int(i, mix_r, 32768 * 16);
- outputs[1].put_int(i, mix_l, 32768 * 16);
+ stream.put_int(0, i, mix_r, 32768 * 16);
+ stream.put_int(1, i, mix_l, 32768 * 16);
}
}
diff --git a/src/devices/sound/i5000.h b/src/devices/sound/i5000.h
index 2769b58520c..7012e45cc5e 100644
--- a/src/devices/sound/i5000.h
+++ b/src/devices/sound/i5000.h
@@ -33,7 +33,7 @@ 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;
sound_stream *m_stream;
diff --git a/src/devices/sound/ics2115.cpp b/src/devices/sound/ics2115.cpp
index 2e93ab5b1da..bf52eb2a7a3 100644
--- a/src/devices/sound/ics2115.cpp
+++ b/src/devices/sound/ics2115.cpp
@@ -225,7 +225,6 @@ device_memory_interface::space_config_vector ics2115_device::memory_space_config
*/
int ics2115_device::ics2115_voice::update_volume_envelope()
{
-
// test for boundary cross
bool bc = false;
if (vol.acc >= vol.end || vol.acc <= vol.end)
@@ -422,13 +421,13 @@ void ics2115_device::ics2115_voice::update_ramp()
}
}
-int ics2115_device::fill_output(ics2115_voice& voice, std::vector<write_stream_view> &outputs)
+int ics2115_device::fill_output(ics2115_voice& voice, sound_stream &stream)
{
bool irq_invalid = false;
const u16 fine = 1 << (3*(voice.vol.incr >> 6));
voice.vol.add = (voice.vol.incr & 0x3f)<< (10 - fine);
- for (int i = 0; i < outputs[0].samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
constexpr int RAMP_SHIFT = 6;
const u32 volacc = (voice.vol.acc >> 14) & 0xfff;
@@ -449,8 +448,8 @@ int ics2115_device::fill_output(ics2115_voice& voice, std::vector<write_stream_v
//if (voice.playing())
if (!m_vmode || voice.playing())
{
- outputs[0].add_int(i, (sample * vleft) >> (5 + volume_bits), 32768);
- outputs[1].add_int(i, (sample * vright) >> (5 + volume_bits), 32768);
+ stream.add_int(0, i, (sample * vleft) >> (5 + volume_bits), 32768);
+ stream.add_int(1, i, (sample * vright) >> (5 + volume_bits), 32768);
}
voice.update_ramp();
@@ -465,11 +464,8 @@ int ics2115_device::fill_output(ics2115_voice& voice, std::vector<write_stream_v
return irq_invalid;
}
-void ics2115_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void ics2115_device::sound_stream_update(sound_stream &stream)
{
- outputs[0].fill(0);
- outputs[1].fill(0);
-
bool irq_invalid = false;
for (int osc = 0; osc <= m_active_osc; osc++)
{
@@ -486,7 +482,7 @@ void ics2115_device::sound_stream_update(sound_stream &stream, std::vector<read_
logerror("[%06x=%04x]", curaddr, (s16)sample);
#endif
*/
- if (fill_output(voice, outputs))
+ if (fill_output(voice, stream))
irq_invalid = true;
#ifdef ICS2115_DEBUG
@@ -520,12 +516,13 @@ void ics2115_device::sound_stream_update(sound_stream &stream, std::vector<read_
if (irq_invalid)
recalc_irq();
-
}
//Helper Function (Reads off current register)
u16 ics2115_device::reg_read()
{
+ m_stream->update();
+
u16 ret = 0;
ics2115_voice& voice = m_voice[m_osc_select];
@@ -632,9 +629,6 @@ u16 ics2115_device::reg_read()
if (v.osc_conf.bitflags.irq_pending || v.vol_ctrl.bitflags.irq_pending)
{
ret = i | 0xe0;
- ret &= v.vol_ctrl.bitflags.irq_pending ? (~0x40) : 0xff;
- ret &= v.osc_conf.bitflags.irq_pending ? (~0x80) : 0xff;
- recalc_irq();
if (v.osc_conf.bitflags.irq_pending)
{
v.osc_conf.bitflags.irq_pending = 0;
@@ -645,6 +639,7 @@ u16 ics2115_device::reg_read()
v.vol_ctrl.bitflags.irq_pending = 0;
ret &= ~0x40;
}
+ recalc_irq();
break;
}
}
@@ -710,6 +705,8 @@ u16 ics2115_device::reg_read()
void ics2115_device::reg_write(u16 data, u16 mem_mask)
{
+ m_stream->update();
+
ics2115_voice& voice = m_voice[m_osc_select];
if (m_reg_select < 0x20)
COMBINE_DATA(&voice.regs[m_reg_select]);
@@ -723,6 +720,7 @@ void ics2115_device::reg_write(u16 data, u16 mem_mask)
{
voice.osc_conf.value &= 0x80;
voice.osc_conf.value |= (data >> 8) & 0x7f;
+ recalc_irq();
}
break;
@@ -822,6 +820,7 @@ void ics2115_device::reg_write(u16 data, u16 mem_mask)
{
voice.vol_ctrl.value &= 0x80;
voice.vol_ctrl.value |= (data >> 8) & 0x7f;
+ recalc_irq();
}
break;
@@ -942,6 +941,7 @@ u8 ics2115_device::read(offs_t offset)
{
case 0:
//TODO: check this suspect code
+ m_stream->update();
if (m_irq_on)
{
ret |= 0x80;
@@ -1086,7 +1086,10 @@ void ics2115_device::recalc_irq()
//Suspect
bool irq = (m_irq_pending & m_irq_enabled);
for (int i = 0; (!irq) && (i < 32); i++)
- irq |= m_voice[i].vol_ctrl.bitflags.irq_pending || m_voice[i].osc_conf.bitflags.irq_pending;
+ {
+ irq |= m_voice[i].osc_conf.bitflags.irq && m_voice[i].osc_conf.bitflags.irq_pending;
+ irq |= m_voice[i].vol_ctrl.bitflags.irq && m_voice[i].vol_ctrl.bitflags.irq_pending;
+ }
m_irq_on = irq;
m_irq_cb(irq ? ASSERT_LINE : CLEAR_LINE);
}
diff --git a/src/devices/sound/ics2115.h b/src/devices/sound/ics2115.h
index a02a28075e3..8e99180ca53 100644
--- a/src/devices/sound/ics2115.h
+++ b/src/devices/sound/ics2115.h
@@ -39,7 +39,7 @@ protected:
virtual void device_clock_changed() override;
// device_sound_interface 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;
// device_memory_interface configuration
virtual space_config_vector memory_space_config() const override;
@@ -119,7 +119,7 @@ private:
void recalc_irq();
// stream helper functions
- int fill_output(ics2115_voice& voice, std::vector<write_stream_view> &outputs);
+ int fill_output(ics2115_voice& voice, sound_stream &stream);
s32 get_sample(ics2115_voice& voice);
u8 read_sample(ics2115_voice& voice, u32 addr) { return m_cache.read_byte((voice.osc.saddr << 20) | (addr & 0xfffff)); }
diff --git a/src/devices/sound/iopspu.cpp b/src/devices/sound/iopspu.cpp
index 55e6cd3b789..785d9a4f43b 100644
--- a/src/devices/sound/iopspu.cpp
+++ b/src/devices/sound/iopspu.cpp
@@ -89,10 +89,9 @@ void iop_spu_device::dma_done(int bank)
core.m_status &= ~STATUS_DMA_ACTIVE;
}
-void iop_spu_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void iop_spu_device::sound_stream_update(sound_stream &stream)
{
// TODO
- outputs[0].fill(0);
}
TIMER_CALLBACK_MEMBER(iop_spu_device::autodma_done_timer_hack)
diff --git a/src/devices/sound/iopspu.h b/src/devices/sound/iopspu.h
index d52d3f2d4a4..94ac7614055 100644
--- a/src/devices/sound/iopspu.h
+++ b/src/devices/sound/iopspu.h
@@ -48,7 +48,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;
// HACK: This timer is currently used to trigger an interrupt after the auto-DMA-transferred buffer would have been
// mixed and played back, as the PS2 BIOS pulls a null return address and crashes if we trigger the auto-DMA-complete
diff --git a/src/devices/sound/iremga20.cpp b/src/devices/sound/iremga20.cpp
index b87c9f26da0..99c7a823cf9 100644
--- a/src/devices/sound/iremga20.cpp
+++ b/src/devices/sound/iremga20.cpp
@@ -130,12 +130,9 @@ void iremga20_device::rom_bank_pre_change()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void iremga20_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void iremga20_device::sound_stream_update(sound_stream &stream)
{
- auto &outL = outputs[0];
- auto &outR = outputs[1];
-
- for (int i = 0; i < outL.samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
s32 sampleout = 0;
@@ -159,8 +156,8 @@ void iremga20_device::sound_stream_update(sound_stream &stream, std::vector<read
}
}
- outL.put_int(i, sampleout, 32768 * 4);
- outR.put_int(i, sampleout, 32768 * 4);
+ stream.put_int(0, i, sampleout, 32768 * 4);
+ stream.put_int(1, i, sampleout, 32768 * 4);
}
}
diff --git a/src/devices/sound/iremga20.h b/src/devices/sound/iremga20.h
index 2f854d8c55a..c397327ca76 100644
--- a/src/devices/sound/iremga20.h
+++ b/src/devices/sound/iremga20.h
@@ -36,7 +36,7 @@ protected:
virtual void device_clock_changed() override;
// 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;
// device_rom_interface overrides
virtual void rom_bank_pre_change() override;
diff --git a/src/devices/sound/k005289.cpp b/src/devices/sound/k005289.cpp
index 4202ce8207c..5a766ddc8af 100644
--- a/src/devices/sound/k005289.cpp
+++ b/src/devices/sound/k005289.cpp
@@ -85,10 +85,9 @@ void k005289_device::device_start()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void k005289_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void k005289_device::sound_stream_update(sound_stream &stream)
{
- outputs[0].fill(0);
- for (int sampid = 0; sampid < outputs[0].samples(); sampid++)
+ for (int sampid = 0; sampid < stream.samples(); sampid++)
{
for (int i = 0; i < 2; i++)
{
@@ -98,7 +97,7 @@ void k005289_device::sound_stream_update(sound_stream &stream, std::vector<read_
v.waveform = (v.waveform & ~0x1f) | ((v.waveform + 1) & 0x1f);
v.counter = v.frequency;
}
- outputs[0].add_int(sampid, ((m_sound_prom[((i & 1) << 8) | v.waveform] & 0xf) - 8) * v.volume, 512);
+ stream.add_int(0, sampid, ((m_sound_prom[((i & 1) << 8) | v.waveform] & 0xf) - 8) * v.volume, 512);
}
}
}
diff --git a/src/devices/sound/k005289.h b/src/devices/sound/k005289.h
index 1518202f13c..0cadc1182d5 100644
--- a/src/devices/sound/k005289.h
+++ b/src/devices/sound/k005289.h
@@ -26,7 +26,7 @@ protected:
virtual void device_start() 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;
private:
required_region_ptr<u8> m_sound_prom;
diff --git a/src/devices/sound/k007232.cpp b/src/devices/sound/k007232.cpp
index 2c31d8124a4..03f6f16eea0 100644
--- a/src/devices/sound/k007232.cpp
+++ b/src/devices/sound/k007232.cpp
@@ -214,7 +214,7 @@ void k007232_device::set_bank(int chan_a_bank, int chan_b_bank)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void k007232_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void k007232_device::sound_stream_update(sound_stream &stream)
{
if (K007232_LOG_PCM)
{
@@ -240,7 +240,7 @@ void k007232_device::sound_stream_update(sound_stream &stream, std::vector<read_
}
}
- for (int j = 0; j < outputs[0].samples(); j++)
+ for (int j = 0; j < stream.samples(); j++)
{
s32 lsum = 0, rsum = 0;
for (int i = 0; i < PCM_MAX; i++)
@@ -285,7 +285,7 @@ void k007232_device::sound_stream_update(sound_stream &stream, std::vector<read_
rsum += out * vol_b;
}
}
- outputs[0].put_int(j, lsum, 32768);
- outputs[1].put_int(j, rsum, 32768);
+ stream.put_int(0, j, lsum, 32768);
+ stream.put_int(1, j, rsum, 32768);
}
}
diff --git a/src/devices/sound/k007232.h b/src/devices/sound/k007232.h
index 7fd07f23645..d15b79f8c4a 100644
--- a/src/devices/sound/k007232.h
+++ b/src/devices/sound/k007232.h
@@ -37,7 +37,7 @@ protected:
virtual void device_clock_changed() override;
// 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;
// device_memory_interface configuration
virtual space_config_vector memory_space_config() const override;
diff --git a/src/devices/sound/k051649.cpp b/src/devices/sound/k051649.cpp
index 3afa41849d8..c4dd31c1ba7 100644
--- a/src/devices/sound/k051649.cpp
+++ b/src/devices/sound/k051649.cpp
@@ -133,12 +133,9 @@ void k051649_device::device_clock_changed()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void k051649_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void k051649_device::sound_stream_update(sound_stream &stream)
{
- // zap the contents of the mixer buffer
- outputs[0].fill(0);
-
- for (int i = 0; i < outputs[0].samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
for (sound_channel &voice : m_channel_list)
{
@@ -157,7 +154,7 @@ void k051649_device::sound_stream_update(sound_stream &stream, std::vector<read_
}
// scale to 11 bit digital output on chip
- outputs[0].add_int(i, voice.sample >> 4, 1024);
+ stream.add_int(0, i, voice.sample >> 4, 1024);
}
}
}
diff --git a/src/devices/sound/k051649.h b/src/devices/sound/k051649.h
index 3e0b60dfc86..c71d7ed8fd7 100644
--- a/src/devices/sound/k051649.h
+++ b/src/devices/sound/k051649.h
@@ -39,7 +39,7 @@ protected:
virtual void device_clock_changed() override;
// 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;
private:
// parameters for a channel
diff --git a/src/devices/sound/k053260.cpp b/src/devices/sound/k053260.cpp
index e08e385d8f8..d11ae99fcda 100644
--- a/src/devices/sound/k053260.cpp
+++ b/src/devices/sound/k053260.cpp
@@ -308,11 +308,11 @@ void k053260_device::write(offs_t offset, u8 data)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void k053260_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void k053260_device::sound_stream_update(sound_stream &stream)
{
if (m_mode & 2)
{
- for (int j = 0; j < outputs[0].samples(); j++)
+ for (int j = 0; j < stream.samples(); j++)
{
s32 buffer[2] = {0, 0};
@@ -322,15 +322,10 @@ void k053260_device::sound_stream_update(sound_stream &stream, std::vector<read_
voice.play(buffer);
}
- outputs[0].put_int_clamp(j, buffer[0], 32768);
- outputs[1].put_int_clamp(j, buffer[1], 32768);
+ stream.put_int_clamp(0, j, buffer[0], 32768);
+ stream.put_int_clamp(1, j, buffer[1], 32768);
}
}
- else
- {
- outputs[0].fill(0);
- outputs[1].fill(0);
- }
}
diff --git a/src/devices/sound/k053260.h b/src/devices/sound/k053260.h
index 7f9e963ea26..a1da89af19e 100644
--- a/src/devices/sound/k053260.h
+++ b/src/devices/sound/k053260.h
@@ -41,7 +41,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;
// device_rom_interface overrides
virtual void rom_bank_pre_change() override;
diff --git a/src/devices/sound/k054539.cpp b/src/devices/sound/k054539.cpp
index b7108e925f8..3bcadb703b7 100644
--- a/src/devices/sound/k054539.cpp
+++ b/src/devices/sound/k054539.cpp
@@ -103,7 +103,7 @@ void k054539_device::keyoff(int channel)
regs[0x22c] &= ~(1 << channel);
}
-void k054539_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void k054539_device::sound_stream_update(sound_stream &stream)
{
static constexpr double VOL_CAP = 1.80;
@@ -115,13 +115,9 @@ void k054539_device::sound_stream_update(sound_stream &stream, std::vector<read_
int16_t *rbase = (int16_t *)&ram[0];
if(!(regs[0x22f] & 1))
- {
- outputs[0].fill(0);
- outputs[1].fill(0);
return;
- }
- for(int sample = 0; sample != outputs[0].samples(); sample++) {
+ for(int sample = 0; sample != stream.samples(); sample++) {
double lval, rval;
if(!(flags & DISABLE_REVERB))
lval = rval = rbase[reverb_pos];
@@ -299,8 +295,8 @@ void k054539_device::sound_stream_update(sound_stream &stream, std::vector<read_
}
}
reverb_pos = (reverb_pos + 1) & 0x1fff;
- outputs[0].put_int(sample, lval, 32768);
- outputs[1].put_int(sample, rval, 32768);
+ stream.put_int(0, sample, lval, 32768);
+ stream.put_int(1, sample, rval, 32768);
}
}
diff --git a/src/devices/sound/k054539.h b/src/devices/sound/k054539.h
index 70df821dd2f..9e3ba6aa5f1 100644
--- a/src/devices/sound/k054539.h
+++ b/src/devices/sound/k054539.h
@@ -66,7 +66,7 @@ protected:
virtual void device_post_load() override;
// device_sound_interface 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;
// device_rom_interface overrides
virtual void rom_bank_pre_change() override;
diff --git a/src/devices/sound/ks0164.cpp b/src/devices/sound/ks0164.cpp
index 78b24423b2e..bad6b32c4f3 100644
--- a/src/devices/sound/ks0164.cpp
+++ b/src/devices/sound/ks0164.cpp
@@ -474,9 +474,9 @@ void ks0164_device::cpu_map(address_map &map)
map(0xe000, 0xffff).ram();
}
-void ks0164_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void ks0164_device::sound_stream_update(sound_stream &stream)
{
- for(int sample = 0; sample != outputs[0].samples(); sample++) {
+ for(int sample = 0; sample != stream.samples(); sample++) {
s32 suml = 0, sumr = 0;
for(int voice = 0; voice < 0x20; voice++) {
u16 *regs = m_sregs[voice];
@@ -537,7 +537,7 @@ void ks0164_device::sound_stream_update(sound_stream &stream, std::vector<read_s
}
}
}
- outputs[0].put_int(sample, suml, 32768 * 32);
- outputs[1].put_int(sample, sumr, 32768 * 32);
+ stream.put_int(0, sample, suml, 32768 * 32);
+ stream.put_int(1, sample, sumr, 32768 * 32);
}
}
diff --git a/src/devices/sound/ks0164.h b/src/devices/sound/ks0164.h
index cb7c0f5dff5..fde35585e93 100644
--- a/src/devices/sound/ks0164.h
+++ b/src/devices/sound/ks0164.h
@@ -27,7 +27,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 void device_add_mconfig(machine_config &config) override ATTR_COLD;
virtual space_config_vector memory_space_config() const override;
diff --git a/src/devices/sound/l7a1045_l6028_dsp_a.cpp b/src/devices/sound/l7a1045_l6028_dsp_a.cpp
index aeb87e47968..cd65ec51f6e 100644
--- a/src/devices/sound/l7a1045_l6028_dsp_a.cpp
+++ b/src/devices/sound/l7a1045_l6028_dsp_a.cpp
@@ -151,12 +151,8 @@ void l7a1045_sound_device::device_reset()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void l7a1045_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void l7a1045_sound_device::sound_stream_update(sound_stream &stream)
{
- /* Clear the buffers */
- outputs[0].fill(0);
- outputs[1].fill(0);
-
for (int i = 0; i < 32; i++)
{
if (m_key & (1 << i))
@@ -170,7 +166,7 @@ void l7a1045_sound_device::sound_stream_update(sound_stream &stream, std::vector
uint32_t pos = vptr->pos;
uint32_t frac = vptr->frac;
- for (int j = 0; j < outputs[0].samples(); j++)
+ for (int j = 0; j < stream.samples(); j++)
{
int32_t sample;
uint8_t data;
@@ -197,8 +193,8 @@ void l7a1045_sound_device::sound_stream_update(sound_stream &stream, std::vector
sample = int8_t(data & 0xfc) << (3 - (data & 3));
frac += step;
- outputs[0].add_int(j, sample * vptr->l_volume, 32768 * 512);
- outputs[1].add_int(j, sample * vptr->r_volume, 32768 * 512);
+ stream.add_int(0, j, sample * vptr->l_volume, 32768 * 512);
+ stream.add_int(1, j, sample * vptr->r_volume, 32768 * 512);
}
vptr->pos = pos;
diff --git a/src/devices/sound/l7a1045_l6028_dsp_a.h b/src/devices/sound/l7a1045_l6028_dsp_a.h
index 3115e1826bb..20a5348a779 100644
--- a/src/devices/sound/l7a1045_l6028_dsp_a.h
+++ b/src/devices/sound/l7a1045_l6028_dsp_a.h
@@ -34,7 +34,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;
private:
struct l7a1045_voice
diff --git a/src/devices/sound/lc78836m.cpp b/src/devices/sound/lc78836m.cpp
index 7b611e59cf7..ecb007ad081 100644
--- a/src/devices/sound/lc78836m.cpp
+++ b/src/devices/sound/lc78836m.cpp
@@ -88,14 +88,12 @@ void lc78836m_device::device_clock_changed()
update_clock();
}
-void lc78836m_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void lc78836m_device::sound_stream_update(sound_stream &stream)
{
- outputs[0].fill(0);
- outputs[0].put(0, m_sample_ch1 * m_att / 1024.0);
+ stream.put(0, 0, m_sample_ch1 * m_att / 1024.0);
m_sample_ch1 = 0;
- outputs[1].fill(0);
- outputs[1].put(0, m_sample_ch2 * m_att / 1024.0);
+ stream.put(1, 0, m_sample_ch2 * m_att / 1024.0);
m_sample_ch2 = 0;
if (m_mute && m_att > 0)
@@ -129,7 +127,7 @@ void lc78836m_device::bclk_w(int state)
m_sample_bit++;
if (m_sample_bit >= 16) {
- stream_buffer::sample_t sample = m_sample / double(std::numeric_limits<int16_t>::max());
+ sound_stream::sample_t sample = m_sample / double(std::numeric_limits<int16_t>::max());
if (m_lrck)
m_sample_ch1 = sample;
diff --git a/src/devices/sound/lc78836m.h b/src/devices/sound/lc78836m.h
index e2622fa3500..a1dc2d04ef7 100644
--- a/src/devices/sound/lc78836m.h
+++ b/src/devices/sound/lc78836m.h
@@ -38,7 +38,7 @@ protected:
virtual void device_reset() override ATTR_COLD;
virtual void device_clock_changed() 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;
private:
void update_clock();
@@ -56,7 +56,7 @@ private:
uint8_t m_sample_bit;
int16_t m_sample;
- stream_buffer::sample_t m_sample_ch1, m_sample_ch2;
+ sound_stream::sample_t m_sample_ch1, m_sample_ch2;
double m_att;
};
diff --git a/src/devices/sound/lc82310.cpp b/src/devices/sound/lc82310.cpp
index 3404a5c9629..87523d591d1 100644
--- a/src/devices/sound/lc82310.cpp
+++ b/src/devices/sound/lc82310.cpp
@@ -258,15 +258,15 @@ void lc82310_device::fill_buffer()
stream->set_sample_rate(frame_sample_rate);
}
-void lc82310_device::append_buffer(std::vector<write_stream_view> &outputs, int &pos, int scount)
+void lc82310_device::append_buffer(sound_stream &stream, int &pos, int scount)
{
int s1 = std::min(scount - pos, m_sample_count);
int words_per_sample = std::min(m_frame_channels, 2);
for (int i = 0; i < s1; i++)
{
- outputs[0].put_int(pos, samples[m_samples_idx * words_per_sample], 32768);
- outputs[1].put_int(pos, samples[m_samples_idx * words_per_sample + (words_per_sample >> 1)], 32768);
+ stream.put_int(0, pos, samples[m_samples_idx * words_per_sample], 32768);
+ stream.put_int(1, pos, samples[m_samples_idx * words_per_sample + (words_per_sample >> 1)], 32768);
m_samples_idx++;
pos++;
@@ -279,9 +279,9 @@ void lc82310_device::append_buffer(std::vector<write_stream_view> &outputs, int
}
}
-void lc82310_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void lc82310_device::sound_stream_update(sound_stream &stream)
{
- int csamples = outputs[0].samples();
+ int csamples = stream.samples();
int pos = 0;
while (pos < csamples)
@@ -290,12 +290,8 @@ void lc82310_device::sound_stream_update(sound_stream &stream, std::vector<read_
fill_buffer();
if (m_sample_count <= 0)
- {
- outputs[0].fill(0, pos);
- outputs[1].fill(0, pos);
return;
- }
- append_buffer(outputs, pos, csamples);
+ append_buffer(stream, pos, csamples);
}
}
diff --git a/src/devices/sound/lc82310.h b/src/devices/sound/lc82310.h
index 802c7bbe2e9..64a4372c3d4 100644
--- a/src/devices/sound/lc82310.h
+++ b/src/devices/sound/lc82310.h
@@ -33,7 +33,7 @@ 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;
private:
enum : uint8_t
@@ -63,7 +63,7 @@ private:
void handle_command(uint8_t cmd, uint8_t param);
void fill_buffer();
- void append_buffer(std::vector<write_stream_view> &outputs, int &pos, int scount);
+ void append_buffer(sound_stream &stream, int &pos, int scount);
sound_stream *stream;
std::unique_ptr<mp3_audio> mp3dec;
diff --git a/src/devices/sound/lmc1992.cpp b/src/devices/sound/lmc1992.cpp
index feaa0810226..313855ea6df 100644
--- a/src/devices/sound/lmc1992.cpp
+++ b/src/devices/sound/lmc1992.cpp
@@ -175,9 +175,8 @@ void lmc1992_device::device_start()
// our sound stream
//-------------------------------------------------
-void lmc1992_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void lmc1992_device::sound_stream_update(sound_stream &stream)
{
- outputs[0].fill(0);
}
diff --git a/src/devices/sound/lmc1992.h b/src/devices/sound/lmc1992.h
index dc9ea4d9806..371b241d2ff 100644
--- a/src/devices/sound/lmc1992.h
+++ b/src/devices/sound/lmc1992.h
@@ -71,7 +71,7 @@ protected:
virtual void device_start() override ATTR_COLD;
// internal callbacks
- 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;
private:
inline void execute_command(int addr, int data);
diff --git a/src/devices/sound/lynx.cpp b/src/devices/sound/lynx.cpp
index 1a1f20d0bda..8520804d07b 100644
--- a/src/devices/sound/lynx.cpp
+++ b/src/devices/sound/lynx.cpp
@@ -477,11 +477,9 @@ void lynx_sound_device::write(offs_t offset, u8 data)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void lynx_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void lynx_sound_device::sound_stream_update(sound_stream &stream)
{
- auto &buffer = outputs[0];
-
- for (int i = 0; i < buffer.samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
s32 result = 0;
for (int channel = 0; channel < LYNX_AUDIO_CHANNELS; channel++)
@@ -489,7 +487,7 @@ void lynx_sound_device::sound_stream_update(sound_stream &stream, std::vector<re
execute(channel);
result += m_audio[channel].reg.output * 15; // where does the *15 come from?
}
- buffer.put_int(i, result, 32768);
+ stream.put_int(0, i, result, 32768);
}
}
@@ -497,12 +495,9 @@ void lynx_sound_device::sound_stream_update(sound_stream &stream, std::vector<re
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void lynx2_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void lynx2_sound_device::sound_stream_update(sound_stream &stream)
{
- auto &left = outputs[0];
- auto &right = outputs[1];
-
- for (int i = 0; i < left.samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
s32 lsum = 0;
s32 rsum = 0;
@@ -525,7 +520,7 @@ void lynx2_sound_device::sound_stream_update(sound_stream &stream, std::vector<r
rsum += v * 15;
}
}
- left.put_int(i, lsum, 32768);
- right.put_int(i, rsum, 32768);
+ stream.put_int(0, i, lsum, 32768);
+ stream.put_int(1, i, rsum, 32768);
}
}
diff --git a/src/devices/sound/lynx.h b/src/devices/sound/lynx.h
index b729afe4ebe..d0b3b73c961 100644
--- a/src/devices/sound/lynx.h
+++ b/src/devices/sound/lynx.h
@@ -56,7 +56,7 @@ protected:
virtual void device_clock_changed() override;
// 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;
void reset_channel(LYNX_AUDIO *channel);
void shift(int chan_nr);
@@ -85,7 +85,7 @@ protected:
virtual void device_start() 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;
};
diff --git a/src/devices/sound/mas3507d.cpp b/src/devices/sound/mas3507d.cpp
index 25f9d2ab1af..ff9024dc60f 100644
--- a/src/devices/sound/mas3507d.cpp
+++ b/src/devices/sound/mas3507d.cpp
@@ -449,19 +449,19 @@ void mas3507d_device::fill_buffer()
cb_demand(mp3data_count < mp3data.size());
}
-void mas3507d_device::append_buffer(std::vector<write_stream_view> &outputs, int &pos, int scount)
+void mas3507d_device::append_buffer(sound_stream &stream, int &pos, int scount)
{
const int bytes_per_sample = std::min(frame_channels, 2); // More than 2 channels is unsupported here
const int s1 = std::min(scount - pos, sample_count);
- const stream_buffer::sample_t sample_scale = 1.0 / 32768.0;
- const stream_buffer::sample_t mute_scale = is_muted ? 0.0 : 1.0;
+ const sound_stream::sample_t sample_scale = 1.0 / 32768.0;
+ const sound_stream::sample_t mute_scale = is_muted ? 0.0 : 1.0;
for(int i = 0; i < s1; i++) {
- const stream_buffer::sample_t lsamp_mixed = stream_buffer::sample_t(samples[samples_idx * bytes_per_sample]) * sample_scale * mute_scale * gain_ll;
- const stream_buffer::sample_t rsamp_mixed = stream_buffer::sample_t(samples[samples_idx * bytes_per_sample + (bytes_per_sample >> 1)]) * sample_scale * mute_scale * gain_rr;
+ const sound_stream::sample_t lsamp_mixed = sound_stream::sample_t(samples[samples_idx * bytes_per_sample]) * sample_scale * mute_scale * gain_ll;
+ const sound_stream::sample_t rsamp_mixed = sound_stream::sample_t(samples[samples_idx * bytes_per_sample + (bytes_per_sample >> 1)]) * sample_scale * mute_scale * gain_rr;
- outputs[0].put(pos, lsamp_mixed);
- outputs[1].put(pos, rsamp_mixed);
+ stream.put(0, pos, lsamp_mixed);
+ stream.put(1, pos, rsamp_mixed);
samples_idx++;
pos++;
@@ -485,21 +485,18 @@ void mas3507d_device::reset_playback()
samples_idx = 0;
}
-void mas3507d_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void mas3507d_device::sound_stream_update(sound_stream &stream)
{
- int csamples = outputs[0].samples();
+ int csamples = stream.samples();
int pos = 0;
while(pos < csamples) {
if(sample_count == 0)
fill_buffer();
- if(sample_count <= 0) {
- outputs[0].fill(0, pos);
- outputs[1].fill(0, pos);
+ if(sample_count <= 0)
return;
- }
- append_buffer(outputs, pos, csamples);
+ append_buffer(stream, pos, csamples);
}
}
diff --git a/src/devices/sound/mas3507d.h b/src/devices/sound/mas3507d.h
index 5078c050863..c4f77aefc16 100644
--- a/src/devices/sound/mas3507d.h
+++ b/src/devices/sound/mas3507d.h
@@ -28,7 +28,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;
private:
void i2c_nak();
@@ -41,7 +41,7 @@ private:
void reg_write(uint32_t adr, uint32_t val);
void fill_buffer();
- void append_buffer(std::vector<write_stream_view> &outputs, int &pos, int scount);
+ void append_buffer(sound_stream &stream, int &pos, int scount);
int gain_to_db(double val);
float gain_to_percentage(int val);
diff --git a/src/devices/sound/mea8000.cpp b/src/devices/sound/mea8000.cpp
index 25381b9ae81..caa0aef5ea0 100644
--- a/src/devices/sound/mea8000.cpp
+++ b/src/devices/sound/mea8000.cpp
@@ -420,9 +420,9 @@ void mea8000_device::stop_frame()
-void mea8000_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void mea8000_device::sound_stream_update(sound_stream &stream)
{
- outputs[0].fill(stream_buffer::sample_t(m_output) * (1.0 / 32768.0));
+ stream.fill(0, sound_stream::sample_t(m_output) * (1.0 / 32768.0));
}
/* next sample in frame, sampling at 64 kHz */
diff --git a/src/devices/sound/mea8000.h b/src/devices/sound/mea8000.h
index 121b1866912..bcd96e161b0 100644
--- a/src/devices/sound/mea8000.h
+++ b/src/devices/sound/mea8000.h
@@ -29,7 +29,7 @@ public:
protected:
// device-level overrides
virtual void device_start() 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;
private:
/* filter coefficients from frequencies */
diff --git a/src/devices/sound/mixer.cpp b/src/devices/sound/mixer.cpp
index ba57be9b10c..e92dc8fbfe1 100644
--- a/src/devices/sound/mixer.cpp
+++ b/src/devices/sound/mixer.cpp
@@ -28,5 +28,5 @@ mixer_device::mixer_device(const machine_config &mconfig, const char *tag, devic
void mixer_device::device_start()
{
// register for save states
- save_item(NAME(m_dummy));
+ save_item(NAME(m_dummy_save));
}
diff --git a/src/devices/sound/mixer.h b/src/devices/sound/mixer.h
index f3a26030ea1..f467ec6d636 100644
--- a/src/devices/sound/mixer.h
+++ b/src/devices/sound/mixer.h
@@ -24,7 +24,7 @@ protected:
virtual void device_start() override ATTR_COLD;
private:
- u8 m_dummy = 0; // needed for save-state support
+ bool m_dummy_save = false; // needed for save-state support
};
#endif // MAME_SOUND_MIXER_H
diff --git a/src/devices/sound/mm5837.cpp b/src/devices/sound/mm5837.cpp
index 40bec2727b8..74f90d01599 100644
--- a/src/devices/sound/mm5837.cpp
+++ b/src/devices/sound/mm5837.cpp
@@ -109,8 +109,8 @@ void mm5837_stream_device::device_start()
// sound_stream_update - fill the sound buffer
//-------------------------------------------------
-void mm5837_stream_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void mm5837_stream_device::sound_stream_update(sound_stream &stream)
{
- for (int sampindex = 0; sampindex < outputs[0].samples(); sampindex++)
- outputs[0].put(sampindex, m_source.clock() ? 1.0 : 0.0);
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
+ stream.put(0, sampindex, m_source.clock() ? 1.0 : 0.0);
}
diff --git a/src/devices/sound/mm5837.h b/src/devices/sound/mm5837.h
index 2e8e5406506..169965ef1d5 100644
--- a/src/devices/sound/mm5837.h
+++ b/src/devices/sound/mm5837.h
@@ -196,7 +196,7 @@ protected:
virtual void device_start() 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;
private:
sound_stream *m_stream; // sound stream
diff --git a/src/devices/sound/mmc5.cpp b/src/devices/sound/mmc5.cpp
index 2659e36535c..48b976e588d 100644
--- a/src/devices/sound/mmc5.cpp
+++ b/src/devices/sound/mmc5.cpp
@@ -91,7 +91,7 @@ void mmc5_sound_device::device_start()
*/
for (int i = 0; i < 31; i++)
{
- stream_buffer::sample_t pulse_out = (i == 0) ? 0.0 : 95.88 / ((8128.0 / i) + 100.0);
+ sound_stream::sample_t pulse_out = (i == 0) ? 0.0 : 95.88 / ((8128.0 / i) + 100.0);
m_square_lut[i] = pulse_out;
}
@@ -297,19 +297,18 @@ void mmc5_sound_device::pcm_w(u8 data)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void mmc5_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void mmc5_sound_device::sound_stream_update(sound_stream &stream)
{
- stream_buffer::sample_t accum = 0.0;
- auto &output = outputs[0];
+ sound_stream::sample_t accum = 0.0;
- for (int sampindex = 0; sampindex < output.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
tick_square(m_core.squ[0]);
tick_square(m_core.squ[1]);
accum = m_square_lut[m_core.squ[0].output + m_core.squ[1].output];
- accum += stream_buffer::sample_t(m_core.pcm.output) / 255.0f;
+ accum += sound_stream::sample_t(m_core.pcm.output) / 255.0f;
- output.put(sampindex, -accum);
+ stream.put(0, sampindex, -accum);
}
}
diff --git a/src/devices/sound/mmc5.h b/src/devices/sound/mmc5.h
index a8f0ea9f406..a9fd920f63f 100644
--- a/src/devices/sound/mmc5.h
+++ b/src/devices/sound/mmc5.h
@@ -47,7 +47,7 @@ protected:
virtual void device_clock_changed() override;
// 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;
private:
/* GLOBAL CONSTANTS */
@@ -58,7 +58,7 @@ private:
u32 m_samps_per_sync; /* Number of samples per vsync */
u32 m_vbl_times[SYNCS_MAX1]; /* VBL durations in samples */
u32 m_sync_times1[SYNCS_MAX1]; /* Samples per sync table */
- stream_buffer::sample_t m_square_lut[31]; // Non-linear Square wave output LUT
+ sound_stream::sample_t m_square_lut[31]; // Non-linear Square wave output LUT
sound_stream *m_stream;
devcb_write_line m_irq_handler;
diff --git a/src/devices/sound/mos6560.cpp b/src/devices/sound/mos6560.cpp
index 6434621f13d..5f77f5e0781 100644
--- a/src/devices/sound/mos6560.cpp
+++ b/src/devices/sound/mos6560.cpp
@@ -865,12 +865,11 @@ void mos6560_device::device_reset()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void mos6560_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void mos6560_device::sound_stream_update(sound_stream &stream)
{
int i, v;
- auto &buffer = outputs[0];
- for (i = 0; i < buffer.samples(); i++)
+ for (i = 0; i < stream.samples(); i++)
{
v = 0;
if (TONE1_ON /*||(m_tone1pos != 0) */ )
@@ -883,7 +882,7 @@ void mos6560_device::sound_stream_update(sound_stream &stream, std::vector<read_
if (m_tone1pos >= m_tone1samples)
{
m_tone1pos = 0;
- m_tone1samples = buffer.sample_rate() / TONE1_FREQUENCY;
+ m_tone1samples = stream.sample_rate() / TONE1_FREQUENCY;
if (m_tone1samples == 0)
m_tone1samples = 1;
}
@@ -899,7 +898,7 @@ void mos6560_device::sound_stream_update(sound_stream &stream, std::vector<read_
if (m_tone2pos >= m_tone2samples)
{
m_tone2pos = 0;
- m_tone2samples = buffer.sample_rate() / TONE2_FREQUENCY;
+ m_tone2samples = stream.sample_rate() / TONE2_FREQUENCY;
if (m_tone2samples == 0)
m_tone2samples = 1;
}
@@ -915,7 +914,7 @@ void mos6560_device::sound_stream_update(sound_stream &stream, std::vector<read_
if (m_tone3pos >= m_tone3samples)
{
m_tone3pos = 0;
- m_tone3samples = buffer.sample_rate() / TONE3_FREQUENCY;
+ m_tone3samples = stream.sample_rate() / TONE3_FREQUENCY;
if (m_tone3samples == 0)
m_tone3samples = 1;
}
@@ -935,6 +934,6 @@ void mos6560_device::sound_stream_update(sound_stream &stream, std::vector<read_
v = 8191;
else if (v < -8191)
v = -8191;
- buffer.put_int(i, v, 8192);
+ stream.put_int(0, i, v, 8192);
}
}
diff --git a/src/devices/sound/mos6560.h b/src/devices/sound/mos6560.h
index 13b29ba363f..e48e4601466 100644
--- a/src/devices/sound/mos6560.h
+++ b/src/devices/sound/mos6560.h
@@ -118,7 +118,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;
inline uint8_t read_videoram(offs_t offset);
inline uint8_t read_colorram(offs_t offset);
diff --git a/src/devices/sound/mos6581.cpp b/src/devices/sound/mos6581.cpp
index 941472a58f0..af195f6fa0c 100644
--- a/src/devices/sound/mos6581.cpp
+++ b/src/devices/sound/mos6581.cpp
@@ -235,9 +235,9 @@ void mos6581_device::device_post_load()
// our sound stream
//-------------------------------------------------
-void mos6581_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void mos6581_device::sound_stream_update(sound_stream &stream)
{
- m_token->fill_buffer(outputs[0]);
+ m_token->fill_buffer(stream);
}
diff --git a/src/devices/sound/mos6581.h b/src/devices/sound/mos6581.h
index 6f9c87a5abb..d4868606768 100644
--- a/src/devices/sound/mos6581.h
+++ b/src/devices/sound/mos6581.h
@@ -65,7 +65,7 @@ protected:
virtual void device_post_load() override;
// device_sound_interface 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;
void save_state(SID6581_t *token);
private:
diff --git a/src/devices/sound/mos7360.cpp b/src/devices/sound/mos7360.cpp
index 51953d93ecd..6a3d5887b15 100644
--- a/src/devices/sound/mos7360.cpp
+++ b/src/devices/sound/mos7360.cpp
@@ -439,12 +439,11 @@ TIMER_CALLBACK_MEMBER(mos7360_device::timer_expired)
// our sound stream
//-------------------------------------------------
-void mos7360_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void mos7360_device::sound_stream_update(sound_stream &stream)
{
int i, v, a;
- auto &buffer = outputs[0];
- for (i = 0; i < buffer.samples(); i++)
+ for (i = 0; i < stream.samples(); i++)
{
v = 0;
@@ -487,7 +486,7 @@ void mos7360_device::sound_stream_update(sound_stream &stream, std::vector<read_
v = v * a;
- buffer.put_int(i, v, 32768);
+ stream.put_int(0, i, v, 32768);
}
}
diff --git a/src/devices/sound/mos7360.h b/src/devices/sound/mos7360.h
index 1b6c1a8f5b0..9288c752824 100644
--- a/src/devices/sound/mos7360.h
+++ b/src/devices/sound/mos7360.h
@@ -107,7 +107,7 @@ protected:
virtual void device_reset() override ATTR_COLD;
// device_sound_interface callbacks
- 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;
inline void set_interrupt(int mask);
inline void clear_interrupt(int mask);
diff --git a/src/devices/sound/msm5205.cpp b/src/devices/sound/msm5205.cpp
index f3f1f5e6302..814b3191342 100644
--- a/src/devices/sound/msm5205.cpp
+++ b/src/devices/sound/msm5205.cpp
@@ -347,20 +347,16 @@ void msm5205_device::device_clock_changed()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void msm5205_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void msm5205_device::sound_stream_update(sound_stream &stream)
{
- auto &output = outputs[0];
-
/* if this voice is active */
if (m_signal)
{
- constexpr stream_buffer::sample_t sample_scale = 1.0 / double(1 << 12);
+ constexpr sound_stream::sample_t sample_scale = 1.0 / double(1 << 12);
const int dac_mask = (m_dac_bits >= 12) ? 0 : (1 << (12 - m_dac_bits)) - 1;
- stream_buffer::sample_t val = stream_buffer::sample_t(m_signal & ~dac_mask) * sample_scale;
- output.fill(val);
+ sound_stream::sample_t val = sound_stream::sample_t(m_signal & ~dac_mask) * sample_scale;
+ stream.fill(0, val);
}
- else
- output.fill(0);
}
@@ -368,8 +364,8 @@ void msm5205_device::sound_stream_update(sound_stream &stream, std::vector<read_
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void msm6585_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void msm6585_device::sound_stream_update(sound_stream &stream)
{
// should this be different?
- msm5205_device::sound_stream_update(stream, inputs, outputs);
+ msm5205_device::sound_stream_update(stream);
}
diff --git a/src/devices/sound/msm5205.h b/src/devices/sound/msm5205.h
index d310c8d56fb..9aba7ea6f98 100644
--- a/src/devices/sound/msm5205.h
+++ b/src/devices/sound/msm5205.h
@@ -59,7 +59,7 @@ protected:
TIMER_CALLBACK_MEMBER(update_adpcm);
// 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;
void compute_tables();
virtual int get_prescaler() const;
@@ -101,7 +101,7 @@ protected:
virtual double adpcm_capture_divisor() const override { return 2.0; }
// 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;
};
diff --git a/src/devices/sound/msm5232.cpp b/src/devices/sound/msm5232.cpp
index e709b3af16b..1e05483b6e9 100644
--- a/src/devices/sound/msm5232.cpp
+++ b/src/devices/sound/msm5232.cpp
@@ -708,31 +708,18 @@ void msm5232_device::set_clock(int clock)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void msm5232_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void msm5232_device::sound_stream_update(sound_stream &stream)
{
- auto &buf1 = outputs[0];
- auto &buf2 = outputs[1];
- auto &buf3 = outputs[2];
- auto &buf4 = outputs[3];
- auto &buf5 = outputs[4];
- auto &buf6 = outputs[5];
- auto &buf7 = outputs[6];
- auto &buf8 = outputs[7];
- auto &bufsolo1 = outputs[8];
- auto &bufsolo2 = outputs[9];
- auto &bufnoise = outputs[10];
- int i;
-
- for (i=0; i<buf1.samples(); i++)
+ for (int i=0; i<stream.samples(); i++)
{
/* calculate all voices' envelopes */
EG_voices_advance();
TG_group_advance(0); /* calculate tones group 1 */
- buf1.put_int(i, o2, 32768);
- buf2.put_int(i, o4, 32768);
- buf3.put_int(i, o8, 32768);
- buf4.put_int(i, o16, 32768);
+ stream.put_int(0, i, o2, 32768);
+ stream.put_int(1, i, o4, 32768);
+ stream.put_int(2, i, o8, 32768);
+ stream.put_int(3, i, o16, 32768);
SAVE_SINGLE_CHANNEL(0,o2)
SAVE_SINGLE_CHANNEL(1,o4)
@@ -740,13 +727,13 @@ void msm5232_device::sound_stream_update(sound_stream &stream, std::vector<read_
SAVE_SINGLE_CHANNEL(3,o16)
TG_group_advance(1); /* calculate tones group 2 */
- buf5.put_int(i, o2, 32768);
- buf6.put_int(i, o4, 32768);
- buf7.put_int(i, o8, 32768);
- buf8.put_int(i, o16, 32768);
+ stream.put_int(4, i, o2, 32768);
+ stream.put_int(5, i, o4, 32768);
+ stream.put_int(6, i, o8, 32768);
+ stream.put_int(7, i, o16, 32768);
- bufsolo1.put_int(i, solo8, 32768);
- bufsolo2.put_int(i, solo16, 32768);
+ stream.put_int(8, i, solo8, 32768);
+ stream.put_int(9, i, solo16, 32768);
SAVE_SINGLE_CHANNEL(4,o2)
SAVE_SINGLE_CHANNEL(5,o4)
@@ -774,6 +761,6 @@ void msm5232_device::sound_stream_update(sound_stream &stream, std::vector<read_
}
}
- bufnoise.put(i, (m_noise_rng & (1<<16)) ? 1.0 : 0.0);
+ stream.put(10, i, (m_noise_rng & (1<<16)) ? 1.0 : 0.0);
}
}
diff --git a/src/devices/sound/msm5232.h b/src/devices/sound/msm5232.h
index a79314b89fd..44ab63e46e3 100644
--- a/src/devices/sound/msm5232.h
+++ b/src/devices/sound/msm5232.h
@@ -25,7 +25,7 @@ protected:
virtual void device_post_load() override;
// 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;
private:
struct VOICE {
diff --git a/src/devices/sound/n63701x.cpp b/src/devices/sound/n63701x.cpp
index 6f16c988d8e..c6f09efae72 100644
--- a/src/devices/sound/n63701x.cpp
+++ b/src/devices/sound/n63701x.cpp
@@ -64,13 +64,12 @@ void namco_63701x_device::device_start()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void namco_63701x_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void namco_63701x_device::sound_stream_update(sound_stream &stream)
{
int ch;
for (ch = 0;ch < 2;ch++)
{
- auto &buf = outputs[ch];
voice_63701x *v = &m_voices[ch];
if (v->playing)
@@ -80,12 +79,12 @@ void namco_63701x_device::sound_stream_update(sound_stream &stream, std::vector<
int vol = vol_table[v->volume];
int p;
- for (p = 0;p < buf.samples();p++)
+ for (p = 0;p < stream.samples();p++)
{
if (v->silence_counter)
{
v->silence_counter--;
- buf.put(p, 0);
+ stream.put(0, p, 0);
}
else
{
@@ -94,26 +93,24 @@ void namco_63701x_device::sound_stream_update(sound_stream &stream, std::vector<
if (data == 0xff) /* end of sample */
{
v->playing = 0;
- buf.fill(0, p);
+ stream.fill(0, 0, p);
break;
}
else if (data == 0x00) /* silence compression */
{
data = base[(pos++) & 0xffff];
v->silence_counter = data;
- buf.put(p, 0);
+ stream.put(0, p, 0);
}
else
{
- buf.put_int(p, vol * (data - 0x80), 32768);
+ stream.put_int(0, p, vol * (data - 0x80), 32768);
}
}
}
v->position = pos;
}
- else
- buf.fill(0);
}
}
diff --git a/src/devices/sound/n63701x.h b/src/devices/sound/n63701x.h
index f4d24173e1c..cd66519e0c1 100644
--- a/src/devices/sound/n63701x.h
+++ b/src/devices/sound/n63701x.h
@@ -25,7 +25,7 @@ protected:
virtual void device_start() 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;
private:
struct voice_63701x
diff --git a/src/devices/sound/namco.cpp b/src/devices/sound/namco.cpp
index 5842c7ada83..688f1ce98ec 100644
--- a/src/devices/sound/namco.cpp
+++ b/src/devices/sound/namco.cpp
@@ -233,11 +233,11 @@ void namco_audio_device::build_decoded_waveform(uint8_t *rgnbase)
// generate sound by oversampling
-uint32_t namco_audio_device::namco_update_one(write_stream_view &buffer, const int16_t *wave, uint32_t counter, uint32_t freq)
+uint32_t namco_audio_device::namco_update_one(sound_stream &stream, int output, const int16_t *wave, uint32_t counter, uint32_t freq)
{
- for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
- buffer.add_int(sampindex, wave[WAVEFORM_POSITION(counter)], 32768);
+ stream.add_int(output, sampindex, wave[WAVEFORM_POSITION(counter)], 32768);
counter += freq;
}
@@ -679,14 +679,10 @@ void namco_15xx_device::sharedram_w(offs_t offset, uint8_t data)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void namco_audio_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void namco_audio_device::sound_stream_update(sound_stream &stream)
{
if (m_stereo)
{
- // zap the contents of the buffers
- outputs[0].fill(0);
- outputs[1].fill(0);
-
// if no sound, we're done
if (!m_sound_enable)
return;
@@ -694,8 +690,6 @@ void namco_audio_device::sound_stream_update(sound_stream &stream, std::vector<r
// loop over each voice and add its contribution
for (sound_channel *voice = m_channel_list; voice < m_last_channel; voice++)
{
- auto &lmix = outputs[0];
- auto &rmix = outputs[1];
int lv = voice->volume[0];
int rv = voice->volume[1];
@@ -714,17 +708,17 @@ void namco_audio_device::sound_stream_update(sound_stream &stream, std::vector<r
int16_t r_noise_data = OUTPUT_LEVEL(0x07 * (rv >> 1));
// add our contribution
- for (int i = 0; i < lmix.samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
if (voice->noise_state)
{
- lmix.add_int(i, l_noise_data, 32768);
- rmix.add_int(i, r_noise_data, 32768);
+ stream.add_int(0, i, l_noise_data, 32768);
+ stream.add_int(1, i, r_noise_data, 32768);
}
else
{
- lmix.add_int(i, -l_noise_data, 32768);
- rmix.add_int(i, -r_noise_data, 32768);
+ stream.add_int(0, i, -l_noise_data, 32768);
+ stream.add_int(1, i, -r_noise_data, 32768);
}
if (hold)
@@ -762,7 +756,7 @@ void namco_audio_device::sound_stream_update(sound_stream &stream, std::vector<r
const int16_t *lw = &m_waveform[lv][voice->waveform_select * 32];
// generate sound into the buffer
- c = namco_update_one(lmix, lw, voice->counter, voice->frequency);
+ c = namco_update_one(stream, 0, lw, voice->counter, voice->frequency);
}
// only update if we have non-zero right volume
@@ -771,7 +765,7 @@ void namco_audio_device::sound_stream_update(sound_stream &stream, std::vector<r
const int16_t *rw = &m_waveform[rv][voice->waveform_select * 32];
// generate sound into the buffer
- c = namco_update_one(rmix, rw, voice->counter, voice->frequency);
+ c = namco_update_one(stream, 1, rw, voice->counter, voice->frequency);
}
// update the counter for this voice
@@ -783,11 +777,6 @@ void namco_audio_device::sound_stream_update(sound_stream &stream, std::vector<r
{
sound_channel *voice;
- auto &buffer = outputs[0];
-
- // zap the contents of the buffer
- buffer.fill(0);
-
// if no sound, we're done
if (!m_sound_enable)
return;
@@ -810,12 +799,12 @@ void namco_audio_device::sound_stream_update(sound_stream &stream, std::vector<r
int16_t noise_data = OUTPUT_LEVEL(0x07 * (v >> 1));
// add our contribution
- for (int i = 0; i < buffer.samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
if (voice->noise_state)
- buffer.add_int(i, noise_data, 32768);
+ stream.add_int(0, i, noise_data, 32768);
else
- buffer.add_int(i, -noise_data, 32768);
+ stream.add_int(1, i, -noise_data, 32768);
if (hold)
{
@@ -849,24 +838,24 @@ void namco_audio_device::sound_stream_update(sound_stream &stream, std::vector<r
const int16_t *w = &m_waveform[v][voice->waveform_select * 32];
// generate sound into buffer and update the counter for this voice
- voice->counter = namco_update_one(buffer, w, voice->counter, voice->frequency);
+ voice->counter = namco_update_one(stream, 0, w, voice->counter, voice->frequency);
}
}
}
}
}
-void namco_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void namco_device::sound_stream_update(sound_stream &stream)
{
- namco_audio_device::sound_stream_update(stream, inputs, outputs);
+ namco_audio_device::sound_stream_update(stream);
}
-void namco_15xx_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void namco_15xx_device::sound_stream_update(sound_stream &stream)
{
- namco_audio_device::sound_stream_update(stream, inputs, outputs);
+ namco_audio_device::sound_stream_update(stream);
}
-void namco_cus30_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void namco_cus30_device::sound_stream_update(sound_stream &stream)
{
- namco_audio_device::sound_stream_update(stream, inputs, outputs);
+ namco_audio_device::sound_stream_update(stream);
}
diff --git a/src/devices/sound/namco.h b/src/devices/sound/namco.h
index a5ce6814402..ac37d4d4aa3 100644
--- a/src/devices/sound/namco.h
+++ b/src/devices/sound/namco.h
@@ -43,7 +43,7 @@ protected:
// internal state
void build_decoded_waveform( uint8_t *rgnbase );
void update_namco_waveform(int offset, uint8_t data);
- uint32_t namco_update_one(write_stream_view &buffer, const int16_t *wave, uint32_t counter, uint32_t freq);
+ uint32_t namco_update_one(sound_stream &stream, int output, const int16_t *wave, uint32_t counter, uint32_t freq);
// waveform region
optional_region_ptr<uint8_t> m_wave_ptr;
@@ -69,7 +69,7 @@ protected:
// decoded waveform table
std::unique_ptr<int16_t[]> m_waveform[MAX_VOLUME];
- 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;
};
class namco_device : public namco_audio_device
@@ -86,7 +86,7 @@ protected:
// device-level overrides
virtual void device_start() 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;
private:
std::unique_ptr<uint8_t[]> m_soundregs;
@@ -106,7 +106,7 @@ protected:
// device-level overrides
virtual void device_start() 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;
private:
std::unique_ptr<uint8_t[]> m_soundregs;
@@ -125,7 +125,7 @@ public:
void pacman_sound_w(offs_t offset, uint8_t data);
protected:
- 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;
};
diff --git a/src/devices/sound/namco_163.cpp b/src/devices/sound/namco_163.cpp
index 3735e3147df..7f20a25928c 100644
--- a/src/devices/sound/namco_163.cpp
+++ b/src/devices/sound/namco_163.cpp
@@ -145,16 +145,13 @@ u8 namco_163_sound_device::data_r()
}
-void namco_163_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void namco_163_sound_device::sound_stream_update(sound_stream &stream)
{
if (m_disable)
- {
- outputs[0].fill(0);
return;
- }
// Slightly noisy but closer to real hardware behavior
- for (int s = 0; s < outputs[0].samples(); s++)
+ for (int s = 0; s < stream.samples(); s++)
{
u32 phase = (m_ram[m_reg_addr + 5] << 16) | (m_ram[m_reg_addr + 3] << 8) | m_ram[m_reg_addr + 1];
const u32 freq = ((m_ram[m_reg_addr + 4] & 0x3) << 16) | (m_ram[m_reg_addr + 2] << 8) | m_ram[m_reg_addr + 0];
@@ -174,6 +171,6 @@ void namco_163_sound_device::sound_stream_update(sound_stream &stream, std::vect
{
m_reg_addr = 0x78 - ((m_ram[0x7f] & 0x70) >> 1);
}
- outputs[0].put_int(s, output, 128);
+ stream.put_int(0, s, output, 128);
}
}
diff --git a/src/devices/sound/namco_163.h b/src/devices/sound/namco_163.h
index 953110194c9..61b3af8fe0e 100644
--- a/src/devices/sound/namco_163.h
+++ b/src/devices/sound/namco_163.h
@@ -34,7 +34,7 @@ protected:
// internals
inline s8 get_sample(u16 addr);
- 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;
};
DECLARE_DEVICE_TYPE(NAMCO_163, namco_163_sound_device)
diff --git a/src/devices/sound/nes_apu.cpp b/src/devices/sound/nes_apu.cpp
index 86c8a8c8934..3f8755398bc 100644
--- a/src/devices/sound/nes_apu.cpp
+++ b/src/devices/sound/nes_apu.cpp
@@ -131,7 +131,7 @@ void nesapu_device::device_start()
*/
for (int i = 0; i < 31; i++)
{
- stream_buffer::sample_t pulse_out = (i == 0) ? 0.0 : 95.88 / ((8128.0 / i) + 100.0);
+ sound_stream::sample_t pulse_out = (i == 0) ? 0.0 : 95.88 / ((8128.0 / i) + 100.0);
m_square_lut[i] = pulse_out;
}
@@ -153,7 +153,7 @@ void nesapu_device::device_start()
{
for (int d = 0; d < 128; d++)
{
- stream_buffer::sample_t tnd_out = (t / 8227.0) + (n / 12241.0) + (d / 22638.0);
+ sound_stream::sample_t tnd_out = (t / 8227.0) + (n / 12241.0) + (d / 22638.0);
tnd_out = (tnd_out == 0.0) ? 0.0 : 159.79 / ((1.0 / tnd_out) + 100.0);
m_tnd_lut[t][n][d] = tnd_out;
}
@@ -766,12 +766,11 @@ u8 nesapu_device::status_r()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void nesapu_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void nesapu_device::sound_stream_update(sound_stream &stream)
{
- stream_buffer::sample_t accum = 0.0;
- auto &output = outputs[0];
+ sound_stream::sample_t accum = 0.0;
- for (int sampindex = 0; sampindex < output.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
apu_square(&m_APU.squ[0]);
apu_square(&m_APU.squ[1]);
@@ -782,6 +781,6 @@ void nesapu_device::sound_stream_update(sound_stream &stream, std::vector<read_s
accum = m_square_lut[m_APU.squ[0].output + m_APU.squ[1].output];
accum += m_tnd_lut[m_APU.tri.output][m_APU.noi.output][m_APU.dpcm.output];
- output.put(sampindex, accum);
+ stream.put(0, sampindex, accum);
}
}
diff --git a/src/devices/sound/nes_apu.h b/src/devices/sound/nes_apu.h
index d5004d99bfb..d43c50cb3d4 100644
--- a/src/devices/sound/nes_apu.h
+++ b/src/devices/sound/nes_apu.h
@@ -58,7 +58,7 @@ protected:
virtual void device_start() 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 void update_lfsr(apu_t::noise_t &chan);
@@ -76,8 +76,8 @@ private:
u32 m_vbl_times[SYNCS_MAX1]; /* VBL durations in samples */
u32 m_sync_times1[SYNCS_MAX1]; /* Samples per sync table */
u32 m_sync_times2[SYNCS_MAX2]; /* Samples per sync table */
- stream_buffer::sample_t m_square_lut[31]; // Non-linear Square wave output LUT
- stream_buffer::sample_t m_tnd_lut[16][16][128]; // Non-linear Triangle, Noise, DMC output LUT
+ sound_stream::sample_t m_square_lut[31]; // Non-linear Square wave output LUT
+ sound_stream::sample_t m_tnd_lut[16][16][128]; // Non-linear Triangle, Noise, DMC output LUT
sound_stream *m_stream;
devcb_write_line m_irq_handler;
diff --git a/src/devices/sound/nn71003f.cpp b/src/devices/sound/nn71003f.cpp
index b9d926a9855..a0bb5e21ccc 100644
--- a/src/devices/sound/nn71003f.cpp
+++ b/src/devices/sound/nn71003f.cpp
@@ -78,7 +78,7 @@ void nn71003f_device::clk_w(int state)
logerror("clk_w %d\n", state);
}
-void nn71003f_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void nn71003f_device::sound_stream_update(sound_stream &stream)
{
}
diff --git a/src/devices/sound/nn71003f.h b/src/devices/sound/nn71003f.h
index bdf1803cf54..55b72707d6d 100644
--- a/src/devices/sound/nn71003f.h
+++ b/src/devices/sound/nn71003f.h
@@ -29,7 +29,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;
private:
devcb_write_line m_miso;
diff --git a/src/devices/sound/okim6258.cpp b/src/devices/sound/okim6258.cpp
index 171100e2080..712b3269f36 100644
--- a/src/devices/sound/okim6258.cpp
+++ b/src/devices/sound/okim6258.cpp
@@ -147,15 +147,13 @@ void okim6258_device::device_reset()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void okim6258_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void okim6258_device::sound_stream_update(sound_stream &stream)
{
- auto &buffer = outputs[0];
-
if (m_status & STATUS_PLAYING)
{
int nibble_shift = m_nibble_shift;
- for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
/* Compute the new amplitude and update the current step */
int nibble = (m_data_in >> nibble_shift) & 0xf;
@@ -165,16 +163,12 @@ void okim6258_device::sound_stream_update(sound_stream &stream, std::vector<read
nibble_shift ^= 4;
- buffer.put_int(sampindex, sample, 32768);
+ stream.put_int(0, sampindex, sample, 32768);
}
/* Update the parameters */
m_nibble_shift = nibble_shift;
}
- else
- {
- buffer.fill(0);
- }
}
int16_t okim6258_device::clock_adpcm(uint8_t nibble)
diff --git a/src/devices/sound/okim6258.h b/src/devices/sound/okim6258.h
index 0efb74d6fb9..e20b4ec4553 100644
--- a/src/devices/sound/okim6258.h
+++ b/src/devices/sound/okim6258.h
@@ -47,7 +47,7 @@ protected:
virtual void device_clock_changed() override;
// 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;
private:
int16_t clock_adpcm(uint8_t nibble);
diff --git a/src/devices/sound/okim6295.cpp b/src/devices/sound/okim6295.cpp
index d4006fea1da..1101cbdfa2f 100644
--- a/src/devices/sound/okim6295.cpp
+++ b/src/devices/sound/okim6295.cpp
@@ -56,24 +56,24 @@ DEFINE_DEVICE_TYPE(OKIM6295, okim6295_device, "okim6295", "OKI MSM6295 ADPCM")
// volume lookup table. The manual lists only 9 steps, ~3dB per step. Given the dB values,
// that seems to map to a 5-bit volume control. Any volume parameter beyond the 9th index
// results in silent playback.
-const stream_buffer::sample_t okim6295_device::s_volume_table[16] =
+const sound_stream::sample_t okim6295_device::s_volume_table[16] =
{
- stream_buffer::sample_t(0x20) / stream_buffer::sample_t(0x20), // 0 dB
- stream_buffer::sample_t(0x16) / stream_buffer::sample_t(0x20), // -3.2 dB
- stream_buffer::sample_t(0x10) / stream_buffer::sample_t(0x20), // -6.0 dB
- stream_buffer::sample_t(0x0b) / stream_buffer::sample_t(0x20), // -9.2 dB
- stream_buffer::sample_t(0x08) / stream_buffer::sample_t(0x20), // -12.0 dB
- stream_buffer::sample_t(0x06) / stream_buffer::sample_t(0x20), // -14.5 dB
- stream_buffer::sample_t(0x04) / stream_buffer::sample_t(0x20), // -18.0 dB
- stream_buffer::sample_t(0x03) / stream_buffer::sample_t(0x20), // -20.5 dB
- stream_buffer::sample_t(0x02) / stream_buffer::sample_t(0x20), // -24.0 dB
- stream_buffer::sample_t(0x00) / stream_buffer::sample_t(0x20),
- stream_buffer::sample_t(0x00) / stream_buffer::sample_t(0x20),
- stream_buffer::sample_t(0x00) / stream_buffer::sample_t(0x20),
- stream_buffer::sample_t(0x00) / stream_buffer::sample_t(0x20),
- stream_buffer::sample_t(0x00) / stream_buffer::sample_t(0x20),
- stream_buffer::sample_t(0x00) / stream_buffer::sample_t(0x20),
- stream_buffer::sample_t(0x00) / stream_buffer::sample_t(0x20),
+ sound_stream::sample_t(0x20) / sound_stream::sample_t(0x20), // 0 dB
+ sound_stream::sample_t(0x16) / sound_stream::sample_t(0x20), // -3.2 dB
+ sound_stream::sample_t(0x10) / sound_stream::sample_t(0x20), // -6.0 dB
+ sound_stream::sample_t(0x0b) / sound_stream::sample_t(0x20), // -9.2 dB
+ sound_stream::sample_t(0x08) / sound_stream::sample_t(0x20), // -12.0 dB
+ sound_stream::sample_t(0x06) / sound_stream::sample_t(0x20), // -14.5 dB
+ sound_stream::sample_t(0x04) / sound_stream::sample_t(0x20), // -18.0 dB
+ sound_stream::sample_t(0x03) / sound_stream::sample_t(0x20), // -20.5 dB
+ sound_stream::sample_t(0x02) / sound_stream::sample_t(0x20), // -24.0 dB
+ sound_stream::sample_t(0x00) / sound_stream::sample_t(0x20),
+ sound_stream::sample_t(0x00) / sound_stream::sample_t(0x20),
+ sound_stream::sample_t(0x00) / sound_stream::sample_t(0x20),
+ sound_stream::sample_t(0x00) / sound_stream::sample_t(0x20),
+ sound_stream::sample_t(0x00) / sound_stream::sample_t(0x20),
+ sound_stream::sample_t(0x00) / sound_stream::sample_t(0x20),
+ sound_stream::sample_t(0x00) / sound_stream::sample_t(0x20),
};
@@ -175,17 +175,11 @@ void okim6295_device::device_clock_changed()
// our sound stream
//-------------------------------------------------
-void okim6295_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void okim6295_device::sound_stream_update(sound_stream &stream)
{
- // reset the output stream
- outputs[0].fill(0);
-
// iterate over voices and accumulate sample data
for (auto & elem : m_voice)
- elem.generate_adpcm(*this, outputs[0]);
-
- for (int i = 0; i < outputs[0].samples(); i++)
- outputs[0].put(i, std::clamp(outputs[0].getraw(i), -1.0f, 1.0f));
+ elem.generate_adpcm(*this, stream);
}
@@ -341,21 +335,21 @@ okim6295_device::okim_voice::okim_voice() :
// add them to an output stream
//-------------------------------------------------
-void okim6295_device::okim_voice::generate_adpcm(device_rom_interface &rom, write_stream_view &buffer)
+void okim6295_device::okim_voice::generate_adpcm(device_rom_interface &rom, sound_stream &stream)
{
// skip if not active
if (!m_playing)
return;
// loop while we still have samples to generate
- for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
// fetch the next sample byte
int nibble = rom.read_byte(m_base_offset + m_sample / 2) >> (((m_sample & 1) << 2) ^ 4);
// output to the buffer, scaling by the volume
// signal in range -2048..2047
- buffer.add_int(sampindex, m_adpcm.clock(nibble) * m_volume, 2048);
+ stream.add_int(0, sampindex, m_adpcm.clock(nibble) * m_volume, 2048);
// next!
if (++m_sample >= m_count)
diff --git a/src/devices/sound/okim6295.h b/src/devices/sound/okim6295.h
index ccf8f39f8a4..11a42f84aa1 100644
--- a/src/devices/sound/okim6295.h
+++ b/src/devices/sound/okim6295.h
@@ -60,7 +60,7 @@ protected:
virtual void device_clock_changed() override;
// device_sound_interface 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;
// device_rom_interface overrides
virtual void rom_bank_pre_change() override;
@@ -70,14 +70,14 @@ protected:
{
public:
okim_voice();
- void generate_adpcm(device_rom_interface &rom, write_stream_view &buffer);
+ void generate_adpcm(device_rom_interface &rom, sound_stream &stream);
oki_adpcm_state m_adpcm; // current ADPCM state
bool m_playing;
offs_t m_base_offset; // pointer to the base memory location
uint32_t m_sample; // current sample number
uint32_t m_count; // total samples to play
- stream_buffer::sample_t m_volume; // output volume
+ sound_stream::sample_t m_volume; // output volume
};
// configuration state
@@ -91,7 +91,7 @@ protected:
sound_stream * m_stream;
uint8_t m_pin7_state;
- static const stream_buffer::sample_t s_volume_table[16];
+ static const sound_stream::sample_t s_volume_table[16];
};
diff --git a/src/devices/sound/okim6376.cpp b/src/devices/sound/okim6376.cpp
index 7807a163e71..383c4a17e1d 100644
--- a/src/devices/sound/okim6376.cpp
+++ b/src/devices/sound/okim6376.cpp
@@ -386,10 +386,6 @@ void okim6376_device::generate_adpcm(struct ADPCMVoice *voice, int16_t *buffer,
voice->count = count;
}
- /* fill the rest with silence */
- while (samples--)
- *buffer++ = 0;
-
if ((!voice->playing)&&(m_stage[channel]))//end of samples, load anything staged in
{
m_stage[channel] = 0;
@@ -581,14 +577,11 @@ void okim6376_device::write(uint8_t data)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void okim6376_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void okim6376_device::sound_stream_update(sound_stream &stream)
{
- outputs[0].fill(0);
-
for (int i = 0; i < OKIM6376_VOICES; i++)
{
struct ADPCMVoice *voice = &m_voice[i];
- auto &buffer = outputs[0];
int16_t sample_data[MAX_SAMPLE_CHUNK];
if (i == 0) //channel 1 is the only channel to affect NAR
{
@@ -603,19 +596,16 @@ void okim6376_device::sound_stream_update(sound_stream &stream, std::vector<read
}
/* loop while we have samples remaining */
- for (int sampindex = 0; sampindex < buffer.samples(); )
+ for (int sampindex = 0; sampindex < stream.samples(); )
{
- int remaining = buffer.samples() - sampindex;
+ int remaining = stream.samples() - sampindex;
int samples = (remaining > MAX_SAMPLE_CHUNK) ? MAX_SAMPLE_CHUNK : remaining;
generate_adpcm(voice, sample_data, samples,i);
for (int samp = 0; samp < samples; samp++)
- buffer.add_int(sampindex + samp, sample_data[samp], 32768);
+ stream.add_int(0, sampindex + samp, sample_data[samp], 32768);
sampindex += samples;
}
}
-
- for (int i = 0; i < outputs[0].samples(); i++)
- outputs[0].put(i, std::clamp(outputs[0].getraw(i), -1.0f, 1.0f));
}
diff --git a/src/devices/sound/okim6376.h b/src/devices/sound/okim6376.h
index d7c334a4321..57b188fdf3f 100644
--- a/src/devices/sound/okim6376.h
+++ b/src/devices/sound/okim6376.h
@@ -32,7 +32,7 @@ protected:
virtual void device_post_load() override;
// 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;
// device_rom_interface overrides
virtual void rom_bank_pre_change() override;
diff --git a/src/devices/sound/okim6588.cpp b/src/devices/sound/okim6588.cpp
index de12b18664b..c745b42e555 100644
--- a/src/devices/sound/okim6588.cpp
+++ b/src/devices/sound/okim6588.cpp
@@ -88,10 +88,10 @@ void okim6588_device::device_reset()
// internal handlers
//-------------------------------------------------
-void okim6588_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void okim6588_device::sound_stream_update(sound_stream &stream)
{
// simply fill the buffer with the current sample
- outputs[0].fill(m_adpcm.output() / 2048.0);
+ stream.fill(0, m_adpcm.output() / 2048.0);
}
TIMER_CALLBACK_MEMBER(okim6588_device::clock_adpcm)
diff --git a/src/devices/sound/okim6588.h b/src/devices/sound/okim6588.h
index 12f66f08c1e..c94ac32393a 100644
--- a/src/devices/sound/okim6588.h
+++ b/src/devices/sound/okim6588.h
@@ -32,7 +32,7 @@ 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;
private:
enum chip_mode : u8
diff --git a/src/devices/sound/okim9810.cpp b/src/devices/sound/okim9810.cpp
index eba777cf227..f9d0d6e26c6 100644
--- a/src/devices/sound/okim9810.cpp
+++ b/src/devices/sound/okim9810.cpp
@@ -219,21 +219,11 @@ void okim9810_device::rom_bank_pre_change()
// our sound stream
//-------------------------------------------------
-void okim9810_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void okim9810_device::sound_stream_update(sound_stream &stream)
{
- // reset the output streams
- outputs[0].fill(0);
- outputs[1].fill(0);
-
// iterate over voices and accumulate sample data
for (auto & elem : m_voice)
- elem.generate_audio(*this, outputs, m_global_volume, m_filter_type);
-
- for (int i = 0; i < outputs[0].samples(); i++)
- {
- outputs[0].put(i, std::clamp(outputs[0].getraw(i), -1.0f, 1.0f));
- outputs[1].put(i, std::clamp(outputs[1].getraw(i), -1.0f, 1.0f));
- }
+ elem.generate_audio(*this, stream, m_global_volume, m_filter_type);
}
@@ -627,7 +617,7 @@ okim9810_device::okim_voice::okim_voice()
//-------------------------------------------------
void okim9810_device::okim_voice::generate_audio(device_rom_interface &rom,
- std::vector<write_stream_view> &outputs,
+ sound_stream &stream,
const uint8_t global_volume,
const uint8_t filter_type)
{
@@ -635,10 +625,6 @@ void okim9810_device::okim_voice::generate_audio(device_rom_interface &rom,
if (!m_playing)
return;
- // separate out left and right channels
- auto &outL = outputs[0];
- auto &outR = outputs[1];
-
// get left and right volumes
uint8_t volume_scale_left = volume_scale(global_volume, m_channel_volume, m_pan_volume_left);
uint8_t volume_scale_right = volume_scale(global_volume, m_channel_volume, m_pan_volume_right);
@@ -649,7 +635,7 @@ void okim9810_device::okim_voice::generate_audio(device_rom_interface &rom,
return;
// loop while we still have samples to generate
- for (int sampindex = 0; sampindex < outL.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
if (m_phrase_state == SEQ_PAUSE)
{
@@ -814,10 +800,10 @@ void okim9810_device::okim_voice::generate_audio(device_rom_interface &rom,
// output to the stereo buffers, scaling by the volume
// signal in range -2048..2047, volume in range 2..128 => signal * volume / 8 in range -32768..32767
int32_t interpValueL = (interpValue * (int32_t)volume_scale_left);
- outL.add_int(sampindex, interpValueL, 32768 * 8);
+ stream.add_int(0, sampindex, interpValueL, 32768 * 8);
int32_t interpValueR = (interpValue * (int32_t)volume_scale_right);
- outR.add_int(sampindex, interpValueR, 32768 * 8);
+ stream.add_int(1, sampindex, interpValueR, 32768 * 8);
// if the interpsample has reached its end, move on to the next sample
m_interpSampleNum++;
diff --git a/src/devices/sound/okim9810.h b/src/devices/sound/okim9810.h
index f5407702271..d44dcd5f12a 100644
--- a/src/devices/sound/okim9810.h
+++ b/src/devices/sound/okim9810.h
@@ -95,7 +95,7 @@ protected:
virtual void device_clock_changed() override;
// device_sound_interface 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;
// device_rom_interface overrides
virtual void rom_bank_pre_change() override;
@@ -106,7 +106,7 @@ protected:
public:
okim_voice();
void generate_audio(device_rom_interface &rom,
- std::vector<write_stream_view> &buffers,
+ sound_stream &stream,
const uint8_t global_volume,
const uint8_t filter_type);
diff --git a/src/devices/sound/pcd3311.cpp b/src/devices/sound/pcd3311.cpp
index 4b5a4fb87f5..03e5cd2aa81 100644
--- a/src/devices/sound/pcd3311.cpp
+++ b/src/devices/sound/pcd3311.cpp
@@ -52,7 +52,6 @@ void pcd3311_device::device_start()
// our sound stream
//-------------------------------------------------
-void pcd3311_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void pcd3311_device::sound_stream_update(sound_stream &stream)
{
- outputs[0].fill(0);
}
diff --git a/src/devices/sound/pcd3311.h b/src/devices/sound/pcd3311.h
index 29f6c49650a..840b9da69ad 100644
--- a/src/devices/sound/pcd3311.h
+++ b/src/devices/sound/pcd3311.h
@@ -48,7 +48,7 @@ protected:
virtual void device_start() override ATTR_COLD;
// internal callbacks
- 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;
private:
int m_a0;
diff --git a/src/devices/sound/pokey.cpp b/src/devices/sound/pokey.cpp
index 35f389fcd58..8b1125495b5 100644
--- a/src/devices/sound/pokey.cpp
+++ b/src/devices/sound/pokey.cpp
@@ -724,10 +724,8 @@ void pokey_device::step_one_clock()
// our sound stream
//-------------------------------------------------
-void pokey_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void pokey_device::sound_stream_update(sound_stream &stream)
{
- auto &buffer = outputs[0];
-
if (m_output_type == LEGACY_LINEAR)
{
int32_t out = 0;
@@ -735,8 +733,8 @@ void pokey_device::sound_stream_update(sound_stream &stream, std::vector<read_st
out += ((m_out_raw >> (4*i)) & 0x0f);
out *= POKEY_DEFAULT_GAIN;
out = (out > 0x7fff) ? 0x7fff : out;
- stream_buffer::sample_t outsamp = out * stream_buffer::sample_t(1.0 / 32768.0);
- buffer.fill(outsamp);
+ sound_stream::sample_t outsamp = out * sound_stream::sample_t(1.0 / 32768.0);
+ stream.fill(0, outsamp);
}
else if (m_output_type == RC_LOWPASS)
{
@@ -745,11 +743,11 @@ void pokey_device::sound_stream_update(sound_stream &stream, std::vector<read_st
double V0 = rTot / (rTot+m_r_pullup) * m_v_ref / 5.0;
double mult = (m_cap == 0.0) ? 1.0 : 1.0 - exp(-(rTot + m_r_pullup) / (m_cap * m_r_pullup * rTot) * m_clock_period.as_double());
- for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
/* store sum of output signals into the buffer */
m_out_filter += (V0 - m_out_filter) * mult;
- buffer.put(sampindex, m_out_filter);
+ stream.put(0, sampindex, m_out_filter);
}
}
else if (m_output_type == OPAMP_C_TO_GROUND)
@@ -765,7 +763,7 @@ void pokey_device::sound_stream_update(sound_stream &stream, std::vector<read_st
*/
double V0 = ((rTot+m_r_pullup) / rTot - 1.0) * m_v_ref / 5.0;
- buffer.fill(V0);
+ stream.fill(0, V0);
}
else if (m_output_type == OPAMP_LOW_PASS)
{
@@ -777,16 +775,16 @@ void pokey_device::sound_stream_update(sound_stream &stream, std::vector<read_st
double V0 = (m_r_pullup / rTot) * m_v_ref / 5.0;
double mult = (m_cap == 0.0) ? 1.0 : 1.0 - exp(-1.0 / (m_cap * m_r_pullup) * m_clock_period.as_double());
- for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
/* store sum of output signals into the buffer */
m_out_filter += (V0 - m_out_filter) * mult;
- buffer.put(sampindex, m_out_filter);
+ stream.put(0, sampindex, m_out_filter);
}
}
else if (m_output_type == DISCRETE_VAR_R)
{
- buffer.fill(m_voltab[m_out_raw]);
+ stream.fill(0, m_voltab[m_out_raw]);
}
}
diff --git a/src/devices/sound/pokey.h b/src/devices/sound/pokey.h
index 065a98082be..f198b5820fb 100644
--- a/src/devices/sound/pokey.h
+++ b/src/devices/sound/pokey.h
@@ -182,7 +182,7 @@ protected:
virtual void device_clock_changed() override;
// device_sound_interface 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 void execute_run() override;
@@ -302,7 +302,7 @@ private:
uint32_t m_poly5[0x1f];
uint32_t m_poly9[0x1ff];
uint32_t m_poly17[0x1ffff];
- stream_buffer::sample_t m_voltab[0x10000];
+ sound_stream::sample_t m_voltab[0x10000];
output_type m_output_type;
double m_r_pullup;
diff --git a/src/devices/sound/qs1000.cpp b/src/devices/sound/qs1000.cpp
index b3f494890b4..b3e87b1515a 100644
--- a/src/devices/sound/qs1000.cpp
+++ b/src/devices/sound/qs1000.cpp
@@ -423,12 +423,8 @@ void qs1000_device::wave_w(offs_t offset, uint8_t data)
//-------------------------------------------------
// sound_stream_update -
//-------------------------------------------------
-void qs1000_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void qs1000_device::sound_stream_update(sound_stream &stream)
{
- // Rset the output stream
- outputs[0].fill(0);
- outputs[1].fill(0);
-
// Iterate over voices and accumulate sample data
for (auto & chan : m_channels)
{
@@ -440,7 +436,7 @@ void qs1000_device::sound_stream_update(sound_stream &stream, std::vector<read_s
{
if (chan.m_flags & QS1000_ADPCM)
{
- for (int samp = 0; samp < outputs[0].samples(); samp++)
+ for (int samp = 0; samp < stream.samples(); samp++)
{
if (chan.m_addr >= chan.m_loop_end)
{
@@ -484,13 +480,13 @@ void qs1000_device::sound_stream_update(sound_stream &stream, std::vector<read_s
chan.m_addr = (chan.m_addr + (chan.m_acc >> 18)) & QS1000_ADDRESS_MASK;
chan.m_acc &= ((1 << 18) - 1);
- outputs[0].add_int(samp, result * 4 * lvol * vol, 32768 << 12);
- outputs[1].add_int(samp, result * 4 * rvol * vol, 32768 << 12);
+ stream.add_int(0, samp, result * 4 * lvol * vol, 32768 << 12);
+ stream.add_int(1, samp, result * 4 * rvol * vol, 32768 << 12);
}
}
else
{
- for (int samp = 0; samp < outputs[0].samples(); samp++)
+ for (int samp = 0; samp < stream.samples(); samp++)
{
if (chan.m_addr >= chan.m_loop_end)
{
@@ -513,8 +509,8 @@ void qs1000_device::sound_stream_update(sound_stream &stream, std::vector<read_s
chan.m_addr = (chan.m_addr + (chan.m_acc >> 18)) & QS1000_ADDRESS_MASK;
chan.m_acc &= ((1 << 18) - 1);
- outputs[0].add_int(samp, result * lvol * vol, 32768 << 12);
- outputs[1].add_int(samp, result * rvol * vol, 32768 << 12);
+ stream.add_int(0, samp, result * lvol * vol, 32768 << 12);
+ stream.add_int(1, samp, result * rvol * vol, 32768 << 12);
}
}
}
diff --git a/src/devices/sound/qs1000.h b/src/devices/sound/qs1000.h
index 8f8e83355bf..6a45ce83f6b 100644
--- a/src/devices/sound/qs1000.h
+++ b/src/devices/sound/qs1000.h
@@ -70,7 +70,7 @@ protected:
virtual void device_reset() override ATTR_COLD;
// device_sound_interface 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;
// device_rom_interface overrides
virtual void rom_bank_pre_change() override;
diff --git a/src/devices/sound/qsound.cpp b/src/devices/sound/qsound.cpp
index e1b4966a78a..306b22d9c0b 100644
--- a/src/devices/sound/qsound.cpp
+++ b/src/devices/sound/qsound.cpp
@@ -257,10 +257,10 @@ void qsound_device::device_reset()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void qsound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void qsound_device::sound_stream_update(sound_stream &stream)
{
- outputs[0].fill(stream_buffer::sample_t(m_samples[0]) * (1.0 / 32768.0));
- outputs[1].fill(stream_buffer::sample_t(m_samples[1]) * (1.0 / 32768.0));
+ stream.fill(0, sound_stream::sample_t(m_samples[0]) * (1.0 / 32768.0));
+ stream.fill(1, sound_stream::sample_t(m_samples[1]) * (1.0 / 32768.0));
}
diff --git a/src/devices/sound/qsound.h b/src/devices/sound/qsound.h
index bb69f26bbdd..c26f78a405b 100644
--- a/src/devices/sound/qsound.h
+++ b/src/devices/sound/qsound.h
@@ -33,7 +33,7 @@ protected:
virtual void device_reset() override ATTR_COLD;
// device_sound_interface implementation
- 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;
// device_rom_interface implementation
virtual void rom_bank_post_change() override;
diff --git a/src/devices/sound/qsoundhle.cpp b/src/devices/sound/qsoundhle.cpp
index ed69b569cb5..f1f5684038e 100644
--- a/src/devices/sound/qsoundhle.cpp
+++ b/src/devices/sound/qsoundhle.cpp
@@ -162,13 +162,13 @@ void qsound_hle_device::device_reset()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void qsound_hle_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void qsound_hle_device::sound_stream_update(sound_stream &stream)
{
- for (int i = 0; i < outputs[0].samples(); i ++)
+ for (int i = 0; i < stream.samples(); i ++)
{
update_sample();
- outputs[0].put_int(i, m_out[0], 32768);
- outputs[1].put_int(i, m_out[1], 32768);
+ stream.put_int(0, i, m_out[0], 32768);
+ stream.put_int(1, i, m_out[1], 32768);
}
}
diff --git a/src/devices/sound/qsoundhle.h b/src/devices/sound/qsoundhle.h
index c978ddf1719..166a01aabfe 100644
--- a/src/devices/sound/qsoundhle.h
+++ b/src/devices/sound/qsoundhle.h
@@ -30,7 +30,7 @@ protected:
virtual void device_reset() override ATTR_COLD;
// device_sound_interface implementation
- 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;
// device_rom_interface implementation
virtual void rom_bank_pre_change() override;
diff --git a/src/devices/sound/rf5c400.cpp b/src/devices/sound/rf5c400.cpp
index fc466fb0a0f..b4311fc7c57 100644
--- a/src/devices/sound/rf5c400.cpp
+++ b/src/devices/sound/rf5c400.cpp
@@ -205,7 +205,7 @@ void rf5c400_device::device_clock_changed()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void rf5c400_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void rf5c400_device::sound_stream_update(sound_stream &stream)
{
int i, ch;
uint64_t start, end, loop;
@@ -214,18 +214,9 @@ void rf5c400_device::sound_stream_update(sound_stream &stream, std::vector<read_
uint8_t env_phase;
double env_level, env_step, env_rstep;
- outputs[0].fill(0);
- outputs[1].fill(0);
- outputs[2].fill(0);
- outputs[3].fill(0);
-
for (ch=0; ch < 32; ch++)
{
rf5c400_channel *channel = &m_channels[ch];
- auto &buf0 = outputs[0];
- auto &buf1 = outputs[1];
- auto &buf2 = outputs[2];
- auto &buf3 = outputs[3];
start = ((uint32_t)(channel->startH & 0xFF00) << 8) | channel->startL;
end = ((uint32_t)(channel->endHloopH & 0xFF) << 16) | channel->endL;
@@ -249,7 +240,7 @@ void rf5c400_device::sound_stream_update(sound_stream &stream, std::vector<read_
continue;
}
- for (i=0; i < buf0.samples(); i++)
+ for (i=0; i < stream.samples(); i++)
{
int16_t tmp;
int32_t sample;
@@ -319,10 +310,10 @@ void rf5c400_device::sound_stream_update(sound_stream &stream, std::vector<read_
sample *= volume_table[vol];
sample = (sample >> 9) * env_level;
- buf0.add_int(i, sample * pan_table[lvol], 32768);
- buf1.add_int(i, sample * pan_table[rvol], 32768);
- buf2.add_int(i, sample * pan_table[effect_lvol], 32768);
- buf3.add_int(i, sample * pan_table[effect_rvol], 32768);
+ stream.add_int(0, i, sample * pan_table[lvol], 32768);
+ stream.add_int(1, i, sample * pan_table[rvol], 32768);
+ stream.add_int(2, i, sample * pan_table[effect_lvol], 32768);
+ stream.add_int(3, i, sample * pan_table[effect_rvol], 32768);
pos += channel->step;
if ((pos>>16) > end)
diff --git a/src/devices/sound/rf5c400.h b/src/devices/sound/rf5c400.h
index e7789817903..bc380571086 100644
--- a/src/devices/sound/rf5c400.h
+++ b/src/devices/sound/rf5c400.h
@@ -34,7 +34,7 @@ protected:
virtual void device_clock_changed() override;
// 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;
// device_rom_interface overrides
virtual void rom_bank_pre_change() override;
diff --git a/src/devices/sound/rf5c68.cpp b/src/devices/sound/rf5c68.cpp
index 09fd397d4fb..c7c062ddbd8 100644
--- a/src/devices/sound/rf5c68.cpp
+++ b/src/devices/sound/rf5c68.cpp
@@ -119,26 +119,19 @@ device_memory_interface::space_config_vector rf5c68_device::memory_space_config(
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void rf5c68_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void rf5c68_device::sound_stream_update(sound_stream &stream)
{
- auto &left = outputs[0];
- auto &right = outputs[1];
-
/* bail if not enabled */
if (!m_enable)
- {
- left.fill(0);
- right.fill(0);
return;
- }
- if (m_mixleft.size() < left.samples())
- m_mixleft.resize(left.samples());
- if (m_mixright.size() < right.samples())
- m_mixright.resize(right.samples());
+ if (m_mixleft.size() < stream.samples())
+ m_mixleft.resize(stream.samples());
+ if (m_mixright.size() < stream.samples())
+ m_mixright.resize(stream.samples());
- std::fill_n(&m_mixleft[0], left.samples(), 0);
- std::fill_n(&m_mixright[0], right.samples(), 0);
+ std::fill_n(&m_mixleft[0], stream.samples(), 0);
+ std::fill_n(&m_mixright[0], stream.samples(), 0);
/* loop over channels */
for (pcm_channel &chan : m_chan)
@@ -150,7 +143,7 @@ void rf5c68_device::sound_stream_update(sound_stream &stream, std::vector<read_s
int rv = ((chan.pan >> 4) & 0x0f) * chan.env;
/* loop over the sample buffer */
- for (int j = 0; j < left.samples(); j++)
+ for (int j = 0; j < stream.samples(); j++)
{
int sample;
@@ -196,10 +189,10 @@ void rf5c68_device::sound_stream_update(sound_stream &stream, std::vector<read_s
*/
const u8 output_shift = (m_output_bits > 16) ? 0 : (16 - m_output_bits);
const s32 output_nandmask = (1 << output_shift) - 1;
- for (int j = 0; j < left.samples(); j++)
+ for (int j = 0; j < stream.samples(); j++)
{
- left.put_int_clamp(j, m_mixleft[j] & ~output_nandmask, 32768);
- right.put_int_clamp(j, m_mixright[j] & ~output_nandmask, 32768);
+ stream.put_int_clamp(0, j, m_mixleft[j] & ~output_nandmask, 32768);
+ stream.put_int_clamp(1, j, m_mixright[j] & ~output_nandmask, 32768);
}
}
diff --git a/src/devices/sound/rf5c68.h b/src/devices/sound/rf5c68.h
index 5b67e2e65b5..f95dc124650 100644
--- a/src/devices/sound/rf5c68.h
+++ b/src/devices/sound/rf5c68.h
@@ -45,7 +45,7 @@ protected:
virtual void device_clock_changed() override;
// 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;
// device_memory_interface configuration
virtual space_config_vector memory_space_config() const override;
diff --git a/src/devices/sound/roland_gp.cpp b/src/devices/sound/roland_gp.cpp
index fb6c4f208c2..9ae0d449ae7 100644
--- a/src/devices/sound/roland_gp.cpp
+++ b/src/devices/sound/roland_gp.cpp
@@ -73,6 +73,6 @@ void tc6116_device::write(offs_t offset, u8 data)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void tc6116_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void tc6116_device::sound_stream_update(sound_stream &stream)
{
}
diff --git a/src/devices/sound/roland_gp.h b/src/devices/sound/roland_gp.h
index 555d814bb07..48854950817 100644
--- a/src/devices/sound/roland_gp.h
+++ b/src/devices/sound/roland_gp.h
@@ -25,7 +25,7 @@ protected:
virtual void device_reset() override ATTR_COLD;
// device_sound_interface implementation
- 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;
// device_rom_interface implementation
virtual void rom_bank_pre_change() override;
diff --git a/src/devices/sound/roland_lp.cpp b/src/devices/sound/roland_lp.cpp
index fd63f56cf76..fe918d080f0 100644
--- a/src/devices/sound/roland_lp.cpp
+++ b/src/devices/sound/roland_lp.cpp
@@ -256,17 +256,14 @@ void mb87419_mb87420_device::write(offs_t offset, u8 data)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void mb87419_mb87420_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void mb87419_mb87420_device::sound_stream_update(sound_stream &stream)
{
- outputs[0].fill(0);
- outputs[1].fill(0);
-
for (auto& chn : m_chns)
{
if (! chn.enable || chn.play_dir == 0)
continue;
- for (int smpl = 0; smpl < outputs[0].samples(); smpl ++)
+ for (int smpl = 0; smpl < stream.samples(); smpl ++)
{
s32 smp_data;
if (chn.play_dir > 0)
@@ -274,8 +271,8 @@ void mb87419_mb87420_device::sound_stream_update(sound_stream &stream, std::vect
else
smp_data = sample_interpolate(chn.smpl_nxt, chn.smpl_cur, chn.addr & 0x3FFF);
smp_data = smp_data * chn.volume;
- outputs[0].add_int(smpl, smp_data, 32768 << 14); // >>14 results in a good overall volume
- outputs[1].add_int(smpl, smp_data, 32768 << 14);
+ stream.add_int(0, smpl, smp_data, 32768 << 14); // >>14 results in a good overall volume
+ stream.add_int(1, smpl, smp_data, 32768 << 14);
uint32_t old_addr = chn.addr;
if (chn.play_dir > 0)
diff --git a/src/devices/sound/roland_lp.h b/src/devices/sound/roland_lp.h
index 3d9ced433d2..cc40a33d8c5 100644
--- a/src/devices/sound/roland_lp.h
+++ b/src/devices/sound/roland_lp.h
@@ -23,7 +23,7 @@ protected:
virtual void device_reset() override ATTR_COLD;
// device_sound_interface implementation
- 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;
// device_rom_interface implementation
virtual void rom_bank_pre_change() override;
diff --git a/src/devices/sound/roland_sa.cpp b/src/devices/sound/roland_sa.cpp
index 9802d371368..2c365e2552d 100644
--- a/src/devices/sound/roland_sa.cpp
+++ b/src/devices/sound/roland_sa.cpp
@@ -264,12 +264,8 @@ void roland_sa_device::write(offs_t offset, u8 data)
m_ctrl_mem[offset] = data;
}
-void roland_sa_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void roland_sa_device::sound_stream_update(sound_stream &stream)
{
- outputs[0].fill(0);
-
- std::unique_ptr<int32_t []> int_buffer = make_unique_clear<int32_t []>(outputs[0].samples());
-
for (size_t voiceI = 0; voiceI < NUM_VOICES; voiceI++)
{
for (size_t partI = 0; partI < PARTS_PER_VOICE; partI++)
@@ -393,7 +389,7 @@ void roland_sa_device::sound_stream_update(sound_stream &stream, std::vector<rea
exp_val2 = exp_val2 - 0x8000;
int32_t exp_val = exp_val1 + exp_val2;
- int_buffer[i] += exp_val;
+ stream.add_int(0, i, exp_val, 0x10000);
}
}
@@ -405,7 +401,4 @@ void roland_sa_device::sound_stream_update(sound_stream &stream, std::vector<rea
}
}
}
-
- for (size_t i = 0; i < outputs[0].samples(); i++)
- outputs[0].put_int(i, int_buffer[i], 0xffff);
}
diff --git a/src/devices/sound/roland_sa.h b/src/devices/sound/roland_sa.h
index 21c6440722c..3f88e910625 100644
--- a/src/devices/sound/roland_sa.h
+++ b/src/devices/sound/roland_sa.h
@@ -24,7 +24,7 @@ protected:
virtual void device_reset() override ATTR_COLD;
// device_sound_interface implementation
- 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;
private:
static constexpr unsigned NUM_VOICES = 16;
diff --git a/src/devices/sound/rp2c33_snd.cpp b/src/devices/sound/rp2c33_snd.cpp
index e50ce857f89..43cfbf46049 100644
--- a/src/devices/sound/rp2c33_snd.cpp
+++ b/src/devices/sound/rp2c33_snd.cpp
@@ -221,9 +221,9 @@ void rp2c33_sound_device::write(offs_t offset, u8 data)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void rp2c33_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void rp2c33_sound_device::sound_stream_update(sound_stream &stream)
{
- for (int i = 0; i < outputs[0].samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
m_output = 0;
if (!m_env_halt && !m_wave_halt)
@@ -234,7 +234,7 @@ void rp2c33_sound_device::sound_stream_update(sound_stream &stream, std::vector<
exec_mod();
exec_wave();
/* Update the buffers */
- outputs[0].put_int(i, m_output * m_mvol_table[m_mvol], 32768);
+ stream.put_int(0, i, m_output * m_mvol_table[m_mvol], 32768);
}
}
diff --git a/src/devices/sound/rp2c33_snd.h b/src/devices/sound/rp2c33_snd.h
index fb125b56747..f6005092344 100644
--- a/src/devices/sound/rp2c33_snd.h
+++ b/src/devices/sound/rp2c33_snd.h
@@ -43,7 +43,7 @@ protected:
virtual void device_clock_changed() override;
// 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;
private:
sound_stream *m_stream = nullptr;
diff --git a/src/devices/sound/s14001a.cpp b/src/devices/sound/s14001a.cpp
index 64e23033206..6e8c871d6f5 100644
--- a/src/devices/sound/s14001a.cpp
+++ b/src/devices/sound/s14001a.cpp
@@ -297,13 +297,13 @@ void s14001a_device::device_start()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void s14001a_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void s14001a_device::sound_stream_update(sound_stream &stream)
{
- for (int i = 0; i < outputs[0].samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
Clock();
s16 sample = m_uOutputP2 - 7; // range -7..8
- outputs[0].put_int(i, sample, 8);
+ stream.put_int(0, i, sample, 8);
}
}
diff --git a/src/devices/sound/s14001a.h b/src/devices/sound/s14001a.h
index 814f0a7795c..c430963f4e4 100644
--- a/src/devices/sound/s14001a.h
+++ b/src/devices/sound/s14001a.h
@@ -32,7 +32,7 @@ protected:
virtual void rom_bank_pre_change() override { m_stream->update(); }
// 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;
private:
u8 ReadMem(u16 offset, bool phase);
diff --git a/src/devices/sound/s_dsp.cpp b/src/devices/sound/s_dsp.cpp
index cb29aa52eb2..b2248b4ef71 100644
--- a/src/devices/sound/s_dsp.cpp
+++ b/src/devices/sound/s_dsp.cpp
@@ -979,17 +979,17 @@ void s_dsp_device::state_register()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void s_dsp_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void s_dsp_device::sound_stream_update(sound_stream &stream)
{
s16 mix[2];
- for (int i = 0; i < outputs[0].samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
mix[0] = mix[1] = 0;
dsp_update(mix);
/* Update the buffers */
- outputs[0].put_int_clamp(i, (s32)mix[0], 32768);
- outputs[1].put_int_clamp(i, (s32)mix[1], 32768);
+ stream.put_int(0, i, (s32)mix[0], 32768);
+ stream.put_int(1, i, (s32)mix[1], 32768);
}
}
diff --git a/src/devices/sound/s_dsp.h b/src/devices/sound/s_dsp.h
index 568c5c51fe3..7102d077b47 100644
--- a/src/devices/sound/s_dsp.h
+++ b/src/devices/sound/s_dsp.h
@@ -30,7 +30,7 @@ protected:
virtual void device_clock_changed() override;
// 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;
// device_memory_interface configuration
virtual space_config_vector memory_space_config() const override;
diff --git a/src/devices/sound/saa1099.cpp b/src/devices/sound/saa1099.cpp
index 682cbb5873f..dd5f6154afd 100644
--- a/src/devices/sound/saa1099.cpp
+++ b/src/devices/sound/saa1099.cpp
@@ -203,17 +203,12 @@ void saa1099_device::device_clock_changed()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void saa1099_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void saa1099_device::sound_stream_update(sound_stream &stream)
{
int j, ch;
/* if the channels are disabled we're done */
if (!m_all_ch_enable)
- {
- /* init output data */
- outputs[LEFT].fill(0);
- outputs[RIGHT].fill(0);
return;
- }
for (ch = 0; ch < 2; ch++)
{
@@ -227,7 +222,7 @@ void saa1099_device::sound_stream_update(sound_stream &stream, std::vector<read_
}
/* fill all data needed */
- for( j = 0; j < outputs[0].samples(); j++ )
+ for( j = 0; j < stream.samples(); j++ )
{
int output_l = 0, output_r = 0;
@@ -300,8 +295,8 @@ void saa1099_device::sound_stream_update(sound_stream &stream, std::vector<read_
m_noise[ch].counter -= clock_divider;
}
/* write sound data to the buffer */
- outputs[LEFT].put_int(j, output_l, 32768 * 6);
- outputs[RIGHT].put_int(j, output_r, 32768 * 6);
+ stream.put_int(LEFT, j, output_l, 32768 * 6);
+ stream.put_int(RIGHT, j, output_r, 32768 * 6);
}
}
diff --git a/src/devices/sound/saa1099.h b/src/devices/sound/saa1099.h
index fec5ccdc692..25433940c99 100644
--- a/src/devices/sound/saa1099.h
+++ b/src/devices/sound/saa1099.h
@@ -32,7 +32,7 @@ protected:
virtual void device_clock_changed() override;
// 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;
private:
struct saa1099_channel
diff --git a/src/devices/sound/samples.cpp b/src/devices/sound/samples.cpp
index afd72f5391a..4a1d527a958 100644
--- a/src/devices/sound/samples.cpp
+++ b/src/devices/sound/samples.cpp
@@ -315,34 +315,33 @@ void samples_device::device_post_load()
// sound_stream_update - update a sound stream
//-------------------------------------------------
-void samples_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void samples_device::sound_stream_update(sound_stream &stream)
{
// find the channel with this stream
- constexpr stream_buffer::sample_t sample_scale = 1.0 / 32768.0;
+ constexpr sound_stream::sample_t sample_scale = 1.0 / 32768.0;
for (int channel = 0; channel < m_channels; channel++)
if (&stream == m_channel[channel].stream)
{
channel_t &chan = m_channel[channel];
- auto &buffer = outputs[0];
// process if we still have a source and we're not paused
if (chan.source != nullptr && !chan.paused)
{
// load some info locally
- double step = double(chan.curfreq) / double(buffer.sample_rate());
+ double step = double(chan.curfreq) / double(stream.sample_rate());
double endpos = chan.source_len;
const int16_t *sample = chan.source;
- for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
// do a linear interp on the sample
double pos_floor = floor(chan.pos);
double frac = chan.pos - pos_floor;
int32_t ipos = int32_t(pos_floor);
- stream_buffer::sample_t sample1 = stream_buffer::sample_t(sample[ipos++]);
- stream_buffer::sample_t sample2 = stream_buffer::sample_t(sample[(ipos + 1) % chan.source_len]);
- buffer.put(sampindex, sample_scale * ((1.0 - frac) * sample1 + frac * sample2));
+ sound_stream::sample_t sample1 = sound_stream::sample_t(sample[ipos++]);
+ sound_stream::sample_t sample2 = sound_stream::sample_t(sample[(ipos + 1) % chan.source_len]);
+ stream.put(0, sampindex, sample_scale * ((1.0 - frac) * sample1 + frac * sample2));
// advance
chan.pos += step;
@@ -356,14 +355,11 @@ void samples_device::sound_stream_update(sound_stream &stream, std::vector<read_
{
chan.source = nullptr;
chan.source_num = -1;
- buffer.fill(0, sampindex);
break;
}
}
}
}
- else
- buffer.fill(0);
break;
}
}
diff --git a/src/devices/sound/samples.h b/src/devices/sound/samples.h
index dae042016c6..975b85e5bdf 100644
--- a/src/devices/sound/samples.h
+++ b/src/devices/sound/samples.h
@@ -78,7 +78,7 @@ protected:
virtual void device_post_load() override;
// device_sound_interface 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;
// internal classes
struct channel_t
diff --git a/src/devices/sound/scsp.cpp b/src/devices/sound/scsp.cpp
index 4d8379f89a3..e471d35a811 100644
--- a/src/devices/sound/scsp.cpp
+++ b/src/devices/sound/scsp.cpp
@@ -310,9 +310,9 @@ void scsp_device::rom_bank_pre_change()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void scsp_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void scsp_device::sound_stream_update(sound_stream &stream)
{
- DoMasterSamples(inputs, outputs);
+ DoMasterSamples(stream);
}
u8 scsp_device::DecodeSCI(u8 irq)
@@ -1264,12 +1264,9 @@ inline s32 scsp_device::UpdateSlot(SCSP_SLOT *slot)
return sample;
}
-void scsp_device::DoMasterSamples(std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void scsp_device::DoMasterSamples(sound_stream &stream)
{
- auto &bufr = outputs[1];
- auto &bufl = outputs[0];
-
- for (int s = 0; s < bufl.samples(); ++s)
+ for (int s = 0; s < stream.samples(); ++s)
{
s32 smpl = 0, smpr = 0;
@@ -1325,7 +1322,7 @@ void scsp_device::DoMasterSamples(std::vector<read_stream_view> const &inputs, s
SCSP_SLOT *slot = m_Slots + i + 16; // 100217, 100237 EFSDL, EFPAN for EXTS0/1
if (EFSDL(slot))
{
- m_DSP.EXTS[i] = s32(inputs[i].get(s) * 32768.0);
+ m_DSP.EXTS[i] = s32(stream.get(i, s) * 32768.0);
u16 Enc = ((EFPAN(slot)) << 0x8) | ((EFSDL(slot)) << 0xd);
smpl += (m_DSP.EXTS[i] * m_LPANTABLE[Enc]) >> SHIFT;
smpr += (m_DSP.EXTS[i] * m_RPANTABLE[Enc]) >> SHIFT;
@@ -1334,13 +1331,13 @@ void scsp_device::DoMasterSamples(std::vector<read_stream_view> const &inputs, s
if (DAC18B())
{
- bufl.put_int_clamp(s, smpl, 131072);
- bufr.put_int_clamp(s, smpr, 131072);
+ stream.put_int_clamp(0, s, smpl, 131072);
+ stream.put_int_clamp(1, s, smpr, 131072);
}
else
{
- bufl.put_int_clamp(s, smpl >> 2, 32768);
- bufr.put_int_clamp(s, smpr >> 2, 32768);
+ stream.put_int_clamp(0, s, smpl >> 2, 32768);
+ stream.put_int_clamp(1, s, smpr >> 2, 32768);
}
}
}
diff --git a/src/devices/sound/scsp.h b/src/devices/sound/scsp.h
index 9b02afd4767..4ec5d60f44b 100644
--- a/src/devices/sound/scsp.h
+++ b/src/devices/sound/scsp.h
@@ -48,7 +48,7 @@ protected:
virtual void rom_bank_pre_change() override;
// 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;
private:
enum SCSP_STATE { SCSP_ATTACK, SCSP_DECAY1, SCSP_DECAY2, SCSP_RELEASE };
@@ -184,7 +184,7 @@ private:
void w16(u32 addr, u16 val);
u16 r16(u32 addr);
inline s32 UpdateSlot(SCSP_SLOT *slot);
- void DoMasterSamples(std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs);
+ void DoMasterSamples(sound_stream &stream);
//LFO
void LFO_Init();
diff --git a/src/devices/sound/segapcm.cpp b/src/devices/sound/segapcm.cpp
index 9f7a9b6fc63..81f6ceffec9 100644
--- a/src/devices/sound/segapcm.cpp
+++ b/src/devices/sound/segapcm.cpp
@@ -72,12 +72,8 @@ void segapcm_device::rom_bank_pre_change()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void segapcm_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void segapcm_device::sound_stream_update(sound_stream &stream)
{
- /* clear the buffers */
- outputs[0].fill(0);
- outputs[1].fill(0);
-
// reg function
// ------------------------------------------------
// 0x00 ?
@@ -114,7 +110,7 @@ void segapcm_device::sound_stream_update(sound_stream &stream, std::vector<read_
int i;
/* loop over samples on this channel */
- for (i = 0; i < outputs[0].samples(); i++)
+ for (i = 0; i < stream.samples(); i++)
{
int8_t v;
@@ -133,8 +129,8 @@ void segapcm_device::sound_stream_update(sound_stream &stream, std::vector<read_
v = read_byte(offset + (addr >> 8)) - 0x80;
/* apply panning and advance */
- outputs[0].add_int(i, v * (regs[2] & 0x7f), 32768);
- outputs[1].add_int(i, v * (regs[3] & 0x7f), 32768);
+ stream.add_int(0, i, v * (regs[2] & 0x7f), 32768);
+ stream.add_int(1, i, v * (regs[3] & 0x7f), 32768);
addr = (addr + regs[7]) & 0xffffff;
}
diff --git a/src/devices/sound/segapcm.h b/src/devices/sound/segapcm.h
index c89ab3e1859..673c8075f27 100644
--- a/src/devices/sound/segapcm.h
+++ b/src/devices/sound/segapcm.h
@@ -41,7 +41,7 @@ protected:
virtual void device_clock_changed() override;
// 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;
// device_rom_interface overrides
virtual void rom_bank_pre_change() override;
diff --git a/src/devices/sound/setapcm.cpp b/src/devices/sound/setapcm.cpp
index ab002f68f10..c2eba36d31d 100644
--- a/src/devices/sound/setapcm.cpp
+++ b/src/devices/sound/setapcm.cpp
@@ -142,20 +142,17 @@ void setapcm_device<MaxVoices, Divider>::device_clock_changed()
//-------------------------------------------------
template<unsigned MaxVoices, unsigned Divider>
-void setapcm_device<MaxVoices, Divider>::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void setapcm_device<MaxVoices, Divider>::sound_stream_update(sound_stream &stream)
{
- outputs[0].fill(0);
- outputs[1].fill(0);
-
- for (int sampleind = 0; sampleind < outputs[0].samples(); sampleind++)
+ for (int sampleind = 0; sampleind < stream.samples(); sampleind++)
{
for (int v = 0; v < MAX_VOICES; v++)
{
// check if voice is activated
if (m_voice[v].update())
{
- outputs[0].add_int(sampleind, (m_voice[v].m_out * m_voice[v].m_vol_l) >> 16, 32768 * MAX_VOICES);
- outputs[1].add_int(sampleind, (m_voice[v].m_out * m_voice[v].m_vol_r) >> 16, 32768 * MAX_VOICES);
+ stream.add_int(0, sampleind, (m_voice[v].m_out * m_voice[v].m_vol_l) >> 16, 32768 * MAX_VOICES);
+ stream.add_int(1, sampleind, (m_voice[v].m_out * m_voice[v].m_vol_r) >> 16, 32768 * MAX_VOICES);
}
}
}
diff --git a/src/devices/sound/setapcm.h b/src/devices/sound/setapcm.h
index bf55b14d460..fbd809cab9e 100644
--- a/src/devices/sound/setapcm.h
+++ b/src/devices/sound/setapcm.h
@@ -38,7 +38,7 @@ protected:
virtual void device_clock_changed() override;
// 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;
// device_rom_interface implementation
virtual void rom_bank_pre_change() override;
diff --git a/src/devices/sound/sid.cpp b/src/devices/sound/sid.cpp
index 86264810fda..7f7292a57be 100644
--- a/src/devices/sound/sid.cpp
+++ b/src/devices/sound/sid.cpp
@@ -29,9 +29,9 @@ float filterResTable[16];
#define maxLogicalVoices 4
-inline stream_buffer::sample_t mix_mono(uint16_t usum)
+inline sound_stream::sample_t mix_mono(uint16_t usum)
{
- return stream_buffer::sample_t(int16_t(usum - maxLogicalVoices*128)) * (1.0 / (256 * maxLogicalVoices));
+ return sound_stream::sample_t(int16_t(usum - maxLogicalVoices*128)) * (1.0 / (256 * maxLogicalVoices));
}
} // anonymous namespace
@@ -61,13 +61,13 @@ inline void SID6581_t::syncEm()
}
-void SID6581_t::fill_buffer(write_stream_view &buffer)
+void SID6581_t::fill_buffer(sound_stream &stream)
{
//void* SID6581_t::fill16bitMono(void* buffer, uint32_t numberOfSamples)
- for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
- buffer.put(sampindex, mix_mono(
+ stream.put(0, sampindex, mix_mono(
(*optr[0].outProc)(&optr[0])
+(*optr[1].outProc)(&optr[1])
+((*optr[2].outProc)(&optr[2])&optr3_outputmask)
diff --git a/src/devices/sound/sid.h b/src/devices/sound/sid.h
index 0b0af441879..45f900758f5 100644
--- a/src/devices/sound/sid.h
+++ b/src/devices/sound/sid.h
@@ -63,7 +63,7 @@ struct SID6581_t
int port_r(running_machine &machine, int offset);
void port_w(int offset, int data);
- void fill_buffer(write_stream_view &buffer);
+ void fill_buffer(sound_stream &stream);
private:
void syncEm();
diff --git a/src/devices/sound/sn76477.cpp b/src/devices/sound/sn76477.cpp
index 1ed2f8b57fe..ec855769be6 100644
--- a/src/devices/sound/sn76477.cpp
+++ b/src/devices/sound/sn76477.cpp
@@ -1700,7 +1700,7 @@ void sn76477_device::state_save_register()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void sn76477_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void sn76477_device::sound_stream_update(sound_stream &stream)
{
double one_shot_cap_charging_step;
double one_shot_cap_discharging_step;
@@ -1719,8 +1719,6 @@ void sn76477_device::sound_stream_update(sound_stream &stream, std::vector<read_
double voltage_out;
double center_to_peak_voltage_out;
- auto &buffer = outputs[0];
-
/* compute charging values, doing it here ensures that we always use the latest values */
one_shot_cap_charging_step = compute_one_shot_cap_charging_rate() / m_our_sample_rate;
one_shot_cap_discharging_step = compute_one_shot_cap_discharging_rate() / m_our_sample_rate;
@@ -1743,7 +1741,7 @@ void sn76477_device::sound_stream_update(sound_stream &stream, std::vector<read_
/* process 'samples' number of samples */
- for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
/* update the one-shot cap voltage */
if (!m_one_shot_cap_voltage_ext)
@@ -1995,7 +1993,7 @@ void sn76477_device::sound_stream_update(sound_stream &stream, std::vector<read_
sample = | ----------- - 1 |
\ Vcen - Vmin /
*/
- buffer.put(sampindex, ((voltage_out - OUT_LOW_CLIP_THRESHOLD) / (OUT_CENTER_LEVEL_VOLTAGE - OUT_LOW_CLIP_THRESHOLD)) - 1);
+ stream.put(0, sampindex, ((voltage_out - OUT_LOW_CLIP_THRESHOLD) / (OUT_CENTER_LEVEL_VOLTAGE - OUT_LOW_CLIP_THRESHOLD)) - 1);
if (LOG_WAV && (!m_enable || !LOG_WAV_ENABLED_ONLY))
{
diff --git a/src/devices/sound/sn76477.h b/src/devices/sound/sn76477.h
index c37a7326b4c..dd4e89a50e2 100644
--- a/src/devices/sound/sn76477.h
+++ b/src/devices/sound/sn76477.h
@@ -149,7 +149,7 @@ protected:
virtual void device_stop() 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;
private:
/* chip's external interface */
diff --git a/src/devices/sound/sn76496.cpp b/src/devices/sound/sn76496.cpp
index 923a1d890d8..38a0c71faf5 100644
--- a/src/devices/sound/sn76496.cpp
+++ b/src/devices/sound/sn76496.cpp
@@ -365,16 +365,14 @@ inline bool sn76496_base_device::in_noise_mode()
return ((m_register[6] & 4)!=0);
}
-void sn76496_base_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void sn76496_base_device::sound_stream_update(sound_stream &stream)
{
int i;
- auto *lbuffer = &outputs[0];
- auto *rbuffer = m_stereo ? &outputs[1] : nullptr;
int16_t out;
int16_t out2 = 0;
- for (int sampindex = 0; sampindex < lbuffer->samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
// clock chip once
if (m_current_clock > 0) // not ready for new divided clock
@@ -440,9 +438,9 @@ void sn76496_base_device::sound_stream_update(sound_stream &stream, std::vector<
if (m_negate) { out = -out; out2 = -out2; }
- lbuffer->put_int(sampindex, out, 32768);
+ stream.put_int(0, sampindex, out, 32768);
if (m_stereo)
- rbuffer->put_int(sampindex, out2, 32768);
+ stream.put_int(1, sampindex, out2, 32768);
}
}
diff --git a/src/devices/sound/sn76496.h b/src/devices/sound/sn76496.h
index cbe73e7e6e7..46471398f02 100644
--- a/src/devices/sound/sn76496.h
+++ b/src/devices/sound/sn76496.h
@@ -33,7 +33,7 @@ protected:
virtual void device_start() override ATTR_COLD;
virtual void device_clock_changed() 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;
TIMER_CALLBACK_MEMBER(delayed_ready);
diff --git a/src/devices/sound/snkwave.cpp b/src/devices/sound/snkwave.cpp
index 9bd3ac62053..d11db0dc957 100644
--- a/src/devices/sound/snkwave.cpp
+++ b/src/devices/sound/snkwave.cpp
@@ -64,22 +64,17 @@ void snkwave_device::device_start()
// for our sound stream
//-------------------------------------------------
-void snkwave_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void snkwave_device::sound_stream_update(sound_stream &stream)
{
- auto &buffer = outputs[0];
-
assert(m_counter < 0x1000);
assert(m_frequency < 0x1000);
/* if no sound, we're done */
if (m_frequency == 0xfff)
- {
- buffer.fill(0);
return;
- }
/* generate sound into buffer while updating the counter */
- for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
int loops;
int16_t out = 0;
@@ -104,7 +99,7 @@ void snkwave_device::sound_stream_update(sound_stream &stream, std::vector<read_
}
}
- buffer.put_int(sampindex, out, 32768);
+ stream.put_int(0, sampindex, out, 32768);
}
}
diff --git a/src/devices/sound/snkwave.h b/src/devices/sound/snkwave.h
index 091bd4e12e8..75b8c88e5b5 100644
--- a/src/devices/sound/snkwave.h
+++ b/src/devices/sound/snkwave.h
@@ -26,7 +26,7 @@ protected:
virtual void device_start() 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;
private:
static constexpr unsigned WAVEFORM_LENGTH = 16;
diff --git a/src/devices/sound/sp0250.cpp b/src/devices/sound/sp0250.cpp
index 2c4384888e9..763fc5b11e0 100644
--- a/src/devices/sound/sp0250.cpp
+++ b/src/devices/sound/sp0250.cpp
@@ -257,18 +257,16 @@ int8_t sp0250_device::next()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void sp0250_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void sp0250_device::sound_stream_update(sound_stream &stream)
{
- auto &output = outputs[0];
-
if (!m_pwm_mode)
{
- for (int sampindex = 0; sampindex < output.samples(); sampindex++)
- output.put_int(sampindex, next(), 128);
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
+ stream.put_int(0, sampindex, next(), 128);
}
else
{
- for (int sampindex = 0; sampindex < output.samples(); )
+ for (int sampindex = 0; sampindex < stream.samples(); )
{
// see where we're at in the current PWM cycle
if (m_pwm_index >= PWM_CLOCKS)
@@ -282,7 +280,7 @@ void sp0250_device::sound_stream_update(sound_stream &stream, std::vector<read_s
// determine the value to fill and the number of samples remaining
// until it changes
- stream_buffer::sample_t value;
+ sound_stream::sample_t value;
int remaining;
if (m_pwm_index < m_pwm_count)
{
@@ -296,13 +294,13 @@ void sp0250_device::sound_stream_update(sound_stream &stream, std::vector<read_s
}
// clamp to the number of samples requested and advance the counters
- if (remaining > output.samples() - sampindex)
- remaining = output.samples() - sampindex;
+ if (remaining > stream.samples() - sampindex)
+ remaining = stream.samples() - sampindex;
m_pwm_index += remaining;
// fill the output
while (remaining-- != 0)
- outputs[0].put(sampindex++, value);
+ stream.put(0, sampindex++, value);
}
}
}
diff --git a/src/devices/sound/sp0250.h b/src/devices/sound/sp0250.h
index fdba7710007..0becd7c93e6 100644
--- a/src/devices/sound/sp0250.h
+++ b/src/devices/sound/sp0250.h
@@ -22,7 +22,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;
TIMER_CALLBACK_MEMBER(delayed_stream_update) { m_stream->update(); }
private:
diff --git a/src/devices/sound/sp0256.cpp b/src/devices/sound/sp0256.cpp
index 3486f710be3..ba84d002eb5 100644
--- a/src/devices/sound/sp0256.cpp
+++ b/src/devices/sound/sp0256.cpp
@@ -1259,12 +1259,11 @@ void sp0256_device::set_clock(int clock)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void sp0256_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void sp0256_device::sound_stream_update(sound_stream &stream)
{
- auto &output = outputs[0];
int output_index = 0;
- while (output_index < output.samples())
+ while (output_index < stream.samples())
{
/* ---------------------------------------------------------------- */
/* First, drain as much of our scratch buffer as we can into the */
@@ -1272,20 +1271,20 @@ void sp0256_device::sound_stream_update(sound_stream &stream, std::vector<read_s
/* ---------------------------------------------------------------- */
while (m_sc_tail != m_sc_head)
{
- output.put_int(output_index++, m_scratch[m_sc_tail++ & SCBUF_MASK], 32768);
+ stream.put_int(0, output_index++, m_scratch[m_sc_tail++ & SCBUF_MASK], 32768);
m_sc_tail &= SCBUF_MASK;
- if (output_index >= output.samples())
+ if (output_index >= stream.samples())
break;
}
/* ---------------------------------------------------------------- */
/* If output outputs is full, then we're done. */
/* ---------------------------------------------------------------- */
- if (output_index > output.samples())
+ if (output_index > stream.samples())
break;
- int length = output.samples() - output_index;
+ int length = stream.samples() - output_index;
/* ---------------------------------------------------------------- */
/* Process the current set of filter coefficients as long as the */
diff --git a/src/devices/sound/sp0256.h b/src/devices/sound/sp0256.h
index bc7beda7433..eee0a3c05a5 100644
--- a/src/devices/sound/sp0256.h
+++ b/src/devices/sound/sp0256.h
@@ -60,7 +60,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;
TIMER_CALLBACK_MEMBER(delayed_stream_update) { m_stream->update(); }
private:
diff --git a/src/devices/sound/spkrdev.cpp b/src/devices/sound/spkrdev.cpp
index 19d1f1813d6..841656ab4ac 100644
--- a/src/devices/sound/spkrdev.cpp
+++ b/src/devices/sound/spkrdev.cpp
@@ -187,19 +187,18 @@ void speaker_sound_device::device_post_load()
//-------------------------------------------------
// This can be triggered by the core (based on emulated time) or via level_w().
-void speaker_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void speaker_sound_device::sound_stream_update(sound_stream &stream)
{
- auto &buffer = outputs[0];
double volume = m_levels[m_level];
double filtered_volume;
attotime sampled_time = attotime::zero;
- if (buffer.samples() > 0)
+ if (stream.samples() > 0)
{
/* Prepare to update time state */
sampled_time = attotime(0, m_channel_sample_period);
- if (buffer.samples() > 1)
- sampled_time *= buffer.samples();
+ if (stream.samples() > 1)
+ sampled_time *= stream.samples();
/* Note: since the stream is in the process of being updated,
* stream->sample_time() will return the time before the update! (MAME 0.130)
@@ -207,19 +206,19 @@ void speaker_sound_device::sound_stream_update(sound_stream &stream, std::vector
*/
}
- for (int sampindex = 0; sampindex < buffer.samples(); )
+ for (int sampindex = 0; sampindex < stream.samples(); )
{
/* Note that first intermediate sample may be composed... */
filtered_volume = update_interm_samples_get_filtered_volume(volume);
/* Composite volume is now quantized to the stream resolution */
- buffer.put(sampindex++, filtered_volume);
+ stream.put(0, sampindex++, filtered_volume);
/* Any additional samples will be homogeneous, however may need filtering across samples: */
- while (sampindex < buffer.samples())
+ while (sampindex < stream.samples())
{
filtered_volume = update_interm_samples_get_filtered_volume(volume);
- buffer.put(sampindex++, filtered_volume);
+ stream.put(0, sampindex++, filtered_volume);
}
/* Update the time state */
diff --git a/src/devices/sound/spkrdev.h b/src/devices/sound/spkrdev.h
index 24a76d78c4c..175cc1f5996 100644
--- a/src/devices/sound/spkrdev.h
+++ b/src/devices/sound/spkrdev.h
@@ -32,7 +32,7 @@ protected:
virtual void device_post_load() override;
// 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;
private:
// Length of anti-aliasing filter kernel, measured in number of intermediate samples
diff --git a/src/devices/sound/spu.cpp b/src/devices/sound/spu.cpp
index 848e432cb02..e6b5d2e5fa3 100644
--- a/src/devices/sound/spu.cpp
+++ b/src/devices/sound/spu.cpp
@@ -2769,20 +2769,17 @@ void spu_device::update_timing()
//
//
-void spu_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void spu_device::sound_stream_update(sound_stream &stream)
{
int16_t temp[44100], *src;
- auto &outL = outputs[0];
- auto &outR = outputs[1];
-
- generate(temp, outputs[0].samples()*4); // second parameter is bytes, * 2 (size of int16_t) * 2 (stereo)
+ generate(temp, stream.samples()*4); // second parameter is bytes, * 2 (size of int16_t) * 2 (stereo)
src = &temp[0];
- for (int i = 0; i < outputs[0].samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
- outL.put_int(i, *src++, 32768);
- outR.put_int(i, *src++, 32768);
+ stream.put_int(0, i, *src++, 32768);
+ stream.put_int(1, i, *src++, 32768);
}
}
diff --git a/src/devices/sound/spu.h b/src/devices/sound/spu.h
index e2641cd5a49..ff51c9c378d 100644
--- a/src/devices/sound/spu.h
+++ b/src/devices/sound/spu.h
@@ -36,7 +36,7 @@ protected:
virtual void device_post_load() override;
virtual void device_stop() 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;
float spu_base_frequency_hz;
float linear_rate[108];
diff --git a/src/devices/sound/ssi263hle.cpp b/src/devices/sound/ssi263hle.cpp
index 738b6c61084..8ae56fa93f4 100644
--- a/src/devices/sound/ssi263hle.cpp
+++ b/src/devices/sound/ssi263hle.cpp
@@ -41,7 +41,7 @@ static const u8 PHONEMES_TO_SC01[0x40] =
ssi263hle_device::ssi263hle_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, SSI263HLE, tag, owner, clock)
- , device_mixer_interface(mconfig, *this, 1)
+ , device_mixer_interface(mconfig, *this)
, m_votrax(*this, "votrax")
, m_ar_cb(*this)
, m_phoneme_timer(nullptr)
@@ -116,7 +116,7 @@ void ssi263hle_device::device_add_mconfig(machine_config &config)
{
VOTRAX_SC01(config, m_votrax, DERIVED_CLOCK(1, 1));
m_votrax->ar_callback().set(FUNC(ssi263hle_device::votrax_request));
- m_votrax->add_route(ALL_OUTPUTS, *this, 1.0, AUTO_ALLOC_INPUT, 0);
+ m_votrax->add_route(ALL_OUTPUTS, *this, 1.0, 0);
}
TIMER_CALLBACK_MEMBER(ssi263hle_device::phoneme_tick)
diff --git a/src/devices/sound/st0016.cpp b/src/devices/sound/st0016.cpp
index 39d85aed58b..420ff9955bc 100644
--- a/src/devices/sound/st0016.cpp
+++ b/src/devices/sound/st0016.cpp
@@ -70,20 +70,17 @@ void st0016_device::device_start()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void st0016_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void st0016_device::sound_stream_update(sound_stream &stream)
{
- outputs[0].fill(0);
- outputs[1].fill(0);
-
- for (int sampleind = 0; sampleind < outputs[0].samples(); sampleind++)
+ for (int sampleind = 0; sampleind < stream.samples(); sampleind++)
{
for (int v = 0; v < 8; v++)
{
// check if voice is activated
if (m_voice[v].update())
{
- outputs[0].add_int(sampleind, (m_voice[v].m_out * m_voice[v].m_vol_l) >> 8, 32768 << 4);
- outputs[1].add_int(sampleind, (m_voice[v].m_out * m_voice[v].m_vol_r) >> 8, 32768 << 4);
+ stream.add_int(0, sampleind, (m_voice[v].m_out * m_voice[v].m_vol_l) >> 8, 32768 << 4);
+ stream.add_int(1, sampleind, (m_voice[v].m_out * m_voice[v].m_vol_r) >> 8, 32768 << 4);
}
}
}
diff --git a/src/devices/sound/st0016.h b/src/devices/sound/st0016.h
index 8153e14a288..d40e07b5c6a 100644
--- a/src/devices/sound/st0016.h
+++ b/src/devices/sound/st0016.h
@@ -25,7 +25,7 @@ protected:
virtual void device_start() 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;
// device_memory_interface configuration
virtual space_config_vector memory_space_config() const override;
diff --git a/src/devices/sound/stt_sa1.cpp b/src/devices/sound/stt_sa1.cpp
index efd9e49e163..29cd61e61ff 100644
--- a/src/devices/sound/stt_sa1.cpp
+++ b/src/devices/sound/stt_sa1.cpp
@@ -160,22 +160,19 @@ void stt_sa1_device::device_reset()
}
}
-void stt_sa1_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void stt_sa1_device::sound_stream_update(sound_stream &stream)
{
- outputs[0].fill(0);
- outputs[1].fill(0);
-
for (int v = 0; v < 8; v++) {
voice_t &voice = m_voice[v];
- for (int i = 0; i < outputs[0].samples() && voice.enabled; i++) {
+ for (int i = 0; i < stream.samples() && voice.enabled; i++) {
const offs_t offset = voice.addr_cur >> 12;
const int sample = s8(read_byte(offset)) << 8;
voice.addr_cur += voice.freq;
- outputs[0].add_int(i, (sample * voice.vol_l) >> 16, 32768 * 8);
- outputs[1].add_int(i, (sample * voice.vol_r) >> 16, 32768 * 8);
+ stream.add_int(0, i, (sample * voice.vol_l) >> 16, 32768 * 8);
+ stream.add_int(1, i, (sample * voice.vol_r) >> 16, 32768 * 8);
if (voice.addr_cur >= voice.addr_end) {
if (!voice.is_looped) {
diff --git a/src/devices/sound/stt_sa1.h b/src/devices/sound/stt_sa1.h
index 15b41f79a3a..66bc93a4480 100644
--- a/src/devices/sound/stt_sa1.h
+++ b/src/devices/sound/stt_sa1.h
@@ -28,7 +28,7 @@ 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;
private:
struct voice_t {
diff --git a/src/devices/sound/swp00.cpp b/src/devices/sound/swp00.cpp
index 17bbfd45ae3..f04161b22b3 100644
--- a/src/devices/sound/swp00.cpp
+++ b/src/devices/sound/swp00.cpp
@@ -1259,13 +1259,13 @@ double v2f2(s32 value)
return (1.0 - (value & 0xffffff) / 33554432.0) / (1 << (value >> 24));
}
-void swp00_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void swp00_device::sound_stream_update(sound_stream &stream)
{
const delay_block brev(this, m_rev_buffer);
const delay_block bcho(this, m_cho_buffer);
const delay_block bvar(this, m_var_buffer);
- for(int i=0; i != outputs[0].samples(); i++) {
+ for(int i=0; i != stream.samples(); i++) {
s32 dry_l = 0, dry_r = 0;
s32 rev = 0;
s32 cho_l = 0, cho_r = 0;
@@ -1838,8 +1838,8 @@ void swp00_device::sound_stream_update(sound_stream &stream, std::vector<read_st
dry_l += m9v(rev_out_l, m_rev_vol) + m9v(m9(cho_out_l, 0x17), m_cho_vol) + m9v(m9(var_out_l, 0x18), m_var_vol);
dry_r += m9v(rev_out_r, m_rev_vol) + m9v(m9(cho_out_r, 0x0e), m_cho_vol) + m9v(m9(var_out_r, 0x0f), m_var_vol);
- outputs[0].put_int(i, dry_l, 32768);
- outputs[1].put_int(i, dry_r, 32768);
+ stream.put_int(0, i, dry_l, 32768);
+ stream.put_int(1, i, dry_r, 32768);
m_buffer_offset --;
}
diff --git a/src/devices/sound/swp00.h b/src/devices/sound/swp00.h
index 22d8bc60db4..72730798e8a 100644
--- a/src/devices/sound/swp00.h
+++ b/src/devices/sound/swp00.h
@@ -21,7 +21,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 void rom_bank_pre_change() override;
virtual void device_add_mconfig(machine_config &config) override ATTR_COLD;
diff --git a/src/devices/sound/swp20.cpp b/src/devices/sound/swp20.cpp
index 947d2bb8b0a..ed22a0b74ff 100644
--- a/src/devices/sound/swp20.cpp
+++ b/src/devices/sound/swp20.cpp
@@ -220,9 +220,7 @@ void swp20_device::snd_w(offs_t offset, u8 data)
}
}
-void swp20_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void swp20_device::sound_stream_update(sound_stream &stream)
{
- outputs[0].fill(0);
- outputs[1].fill(0);
}
diff --git a/src/devices/sound/swp20.h b/src/devices/sound/swp20.h
index 5d02a24f8cf..1086fd8b792 100644
--- a/src/devices/sound/swp20.h
+++ b/src/devices/sound/swp20.h
@@ -20,7 +20,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;
private:
sound_stream *m_stream;
diff --git a/src/devices/sound/swp30.cpp b/src/devices/sound/swp30.cpp
index 15d87e4233f..d135a77f16c 100644
--- a/src/devices/sound/swp30.cpp
+++ b/src/devices/sound/swp30.cpp
@@ -1285,10 +1285,10 @@ void swp30_device::state_string_export(const device_state_entry &entry, std::str
{
}
-void swp30_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void swp30_device::sound_stream_update(sound_stream &stream)
{
- outputs[0].put_int_clamp(0, m_meg_output[0], 32768);
- outputs[1].put_int_clamp(0, m_meg_output[1], 32768);
+ stream.put_int_clamp(0, 0, m_meg_output[0], 32768);
+ stream.put_int_clamp(1, 0, m_meg_output[1], 32768);
}
void swp30_device::change_mode_attack_decay1(int chan)
diff --git a/src/devices/sound/swp30.h b/src/devices/sound/swp30.h
index e6b9d8be03e..eb34fb13eec 100644
--- a/src/devices/sound/swp30.h
+++ b/src/devices/sound/swp30.h
@@ -22,7 +22,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 uint32_t execute_min_cycles() const noexcept override;
virtual uint32_t execute_max_cycles() const noexcept override;
virtual uint64_t execute_clocks_to_cycles(uint64_t clocks) const noexcept override { return (clocks + 1) / 2; }
diff --git a/src/devices/sound/swx00.cpp b/src/devices/sound/swx00.cpp
index 1e0bc782777..4643e8e5058 100644
--- a/src/devices/sound/swx00.cpp
+++ b/src/devices/sound/swx00.cpp
@@ -549,9 +549,9 @@ s32 swx00_sound_device::fpapply(s32 value, s32 sample)
return (s64(sample) - ((s64(sample) * ((value >> 9) & 0x7fff)) >> 16)) >> (value >> 24);
}
-void swx00_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void swx00_sound_device::sound_stream_update(sound_stream &stream)
{
- for(int i=0; i != outputs[0].samples(); i++) {
+ for(int i=0; i != stream.samples(); i++) {
s32 dry_l = 0, dry_r = 0;
s32 rev = 0;
s32 cho_l = 0, cho_r = 0;
@@ -715,7 +715,7 @@ void swx00_sound_device::sound_stream_update(sound_stream &stream, std::vector<r
(void)var_l;
(void)var_r;
- outputs[0].put_int(i, dry_l, 32768);
- outputs[1].put_int(i, dry_r, 32768);
+ stream.put_int(0, i, dry_l, 32768);
+ stream.put_int(1, i, dry_r, 32768);
}
}
diff --git a/src/devices/sound/swx00.h b/src/devices/sound/swx00.h
index e35ddd0a63a..5e7b78808a6 100644
--- a/src/devices/sound/swx00.h
+++ b/src/devices/sound/swx00.h
@@ -21,7 +21,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 void device_add_mconfig(machine_config &config) override ATTR_COLD;
private:
diff --git a/src/devices/sound/t6721a.cpp b/src/devices/sound/t6721a.cpp
index a094d4dc783..ae4ee8551eb 100644
--- a/src/devices/sound/t6721a.cpp
+++ b/src/devices/sound/t6721a.cpp
@@ -59,9 +59,8 @@ void t6721a_device::device_start()
// our sound stream
//-------------------------------------------------
-void t6721a_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void t6721a_device::sound_stream_update(sound_stream &stream)
{
- outputs[0].fill(0);
}
diff --git a/src/devices/sound/t6721a.h b/src/devices/sound/t6721a.h
index 861c03967da..ed680c0424a 100644
--- a/src/devices/sound/t6721a.h
+++ b/src/devices/sound/t6721a.h
@@ -65,7 +65,7 @@ protected:
virtual void device_start() override ATTR_COLD;
// device_sound_interface 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;
private:
enum
diff --git a/src/devices/sound/t6w28.cpp b/src/devices/sound/t6w28.cpp
index 9525794e489..bbb483557d8 100644
--- a/src/devices/sound/t6w28.cpp
+++ b/src/devices/sound/t6w28.cpp
@@ -104,26 +104,21 @@ void t6w28_device::write(offs_t offset, uint8_t data)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void t6w28_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void t6w28_device::sound_stream_update(sound_stream &stream)
{
- int i;
- auto &buffer0 = outputs[0];
- auto &buffer1 = outputs[1];
-
-
/* If the volume is 0, increase the counter */
- for (i = 0;i < 8;i++)
+ for (int i = 0;i < 8;i++)
{
if (m_volume[i] == 0)
{
/* note that I do count += samples, NOT count = samples + 1. You might think */
/* it's the same since the volume is 0, but doing the latter could cause */
/* interferencies when the program is rapidly modulating the volume. */
- if (m_count[i] <= buffer0.samples()*STEP) m_count[i] += buffer0.samples()*STEP;
+ if (m_count[i] <= stream.samples()*STEP) m_count[i] += stream.samples()*STEP;
}
}
- for (int sampindex = 0; sampindex < buffer0.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
int vol[8];
unsigned int out0, out1;
@@ -134,7 +129,7 @@ void t6w28_device::sound_stream_update(sound_stream &stream, std::vector<read_st
/* in the 1 position during the sample period. */
vol[0] = vol[1] = vol[2] = vol[3] = vol[4] = vol[5] = vol[6] = vol[7] = 0;
- for (i = 2;i < 3;i++)
+ for (int i = 2;i < 3;i++)
{
if (m_output[i]) vol[i] += m_count[i];
m_count[i] -= STEP;
@@ -161,7 +156,7 @@ void t6w28_device::sound_stream_update(sound_stream &stream, std::vector<read_st
if (m_output[i]) vol[i] -= m_count[i];
}
- for (i = 4;i < 7;i++)
+ for (int i = 4;i < 7;i++)
{
if (m_output[i]) vol[i] += m_count[i];
m_count[i] -= STEP;
@@ -252,8 +247,8 @@ void t6w28_device::sound_stream_update(sound_stream &stream, std::vector<read_st
if (out0 > MAX_OUTPUT * STEP) out0 = MAX_OUTPUT * STEP;
if (out1 > MAX_OUTPUT * STEP) out1 = MAX_OUTPUT * STEP;
- buffer0.put_int(sampindex, out0 / STEP, 32768);
- buffer1.put_int(sampindex, out1 / STEP, 32768);
+ stream.put_int(0, sampindex, out0 / STEP, 32768);
+ stream.put_int(1, sampindex, out1 / STEP, 32768);
}
}
diff --git a/src/devices/sound/t6w28.h b/src/devices/sound/t6w28.h
index 8d90c05bbe6..c0cff413c56 100644
--- a/src/devices/sound/t6w28.h
+++ b/src/devices/sound/t6w28.h
@@ -18,7 +18,7 @@ protected:
virtual void device_start() 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;
void set_gain(int gain);
diff --git a/src/devices/sound/tc8830f.cpp b/src/devices/sound/tc8830f.cpp
index f9f65975347..db60e255f0b 100644
--- a/src/devices/sound/tc8830f.cpp
+++ b/src/devices/sound/tc8830f.cpp
@@ -82,11 +82,11 @@ void tc8830f_device::device_clock_changed()
-void tc8830f_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void tc8830f_device::sound_stream_update(sound_stream &stream)
{
int32_t mix = 0;
- for (int i = 0; i < outputs[0].samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
if (m_playing)
{
@@ -128,7 +128,7 @@ void tc8830f_device::sound_stream_update(sound_stream &stream, std::vector<read_
mix = m_output;
}
- outputs[0].put_int(i, mix, 32768);
+ stream.put_int(0, i, mix, 32768);
}
}
diff --git a/src/devices/sound/tc8830f.h b/src/devices/sound/tc8830f.h
index fa1a3c8f938..808608e6e64 100644
--- a/src/devices/sound/tc8830f.h
+++ b/src/devices/sound/tc8830f.h
@@ -32,7 +32,7 @@ protected:
virtual void device_post_load() override;
virtual void device_clock_changed() 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;
private:
sound_stream *m_stream;
diff --git a/src/devices/sound/tiaintf.cpp b/src/devices/sound/tiaintf.cpp
index 5a64db7bb4c..d2db180b2b2 100644
--- a/src/devices/sound/tiaintf.cpp
+++ b/src/devices/sound/tiaintf.cpp
@@ -52,9 +52,9 @@ void tia_device::device_stop()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void tia_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void tia_device::sound_stream_update(sound_stream &stream)
{
- tia_process(m_chip, outputs[0]);
+ tia_process(m_chip, stream);
}
diff --git a/src/devices/sound/tiaintf.h b/src/devices/sound/tiaintf.h
index 94e8c8510e9..0ebc0d50433 100644
--- a/src/devices/sound/tiaintf.h
+++ b/src/devices/sound/tiaintf.h
@@ -24,7 +24,7 @@ protected:
virtual void device_stop() 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;
private:
sound_stream *m_channel;
diff --git a/src/devices/sound/tiasound.cpp b/src/devices/sound/tiasound.cpp
index 87fa657bfab..31679c71efb 100644
--- a/src/devices/sound/tiasound.cpp
+++ b/src/devices/sound/tiasound.cpp
@@ -314,7 +314,7 @@ void tia_write(void *chip, offs_t offset, uint8_t data)
/* */
/*****************************************************************************/
-void tia_process(void *_chip, write_stream_view &buffer)
+void tia_process(void *_chip, sound_stream &stream)
{
tia *chip = (tia *)_chip;
uint8_t audc0, audc1;
@@ -336,7 +336,7 @@ void tia_process(void *_chip, write_stream_view &buffer)
div_n_cnt1 = chip->Div_n_cnt[1];
/* loop until the buffer is filled */
- for (int sampindex = 0; sampindex < buffer.samples(); )
+ for (int sampindex = 0; sampindex < stream.samples(); )
{
/* Process channel 0 */
if (div_n_cnt0 > 1)
@@ -532,7 +532,7 @@ void tia_process(void *_chip, write_stream_view &buffer)
chip->Samp_n_cnt += chip->Samp_n_max;
/* calculate the latest output value and place in buffer */
- buffer.put_int(sampindex++, outvol_0 + outvol_1, 32768);
+ stream.put_int(0, sampindex++, outvol_0 + outvol_1, 32768);
}
}
else
@@ -543,9 +543,9 @@ void tia_process(void *_chip, write_stream_view &buffer)
* byte contains the fractional part */
chip->Samp_n_cnt -= 256;
/* calculate the latest output value and place in buffer */
- buffer.put_int(sampindex++, outvol_0 + outvol_1, 32768);
+ stream.put_int(0, sampindex++, outvol_0 + outvol_1, 32768);
}
- while ((chip->Samp_n_cnt >= 256) && (sampindex < buffer.samples()));
+ while ((chip->Samp_n_cnt >= 256) && (sampindex < stream.samples()));
/* adjust the sample counter if necessary */
if (chip->Samp_n_cnt < 256)
diff --git a/src/devices/sound/tiasound.h b/src/devices/sound/tiasound.h
index 2edafdda912..856a06cc1b4 100644
--- a/src/devices/sound/tiasound.h
+++ b/src/devices/sound/tiasound.h
@@ -41,7 +41,7 @@
void *tia_sound_init(device_t *device, int clock, int sample_rate, int gain);
void tia_sound_free(void *chip);
-void tia_process(void *chip, write_stream_view &buffer);
+void tia_process(void *chip, sound_stream &stream);
void tia_write(void *chip, offs_t offset, uint8_t data);
#endif // MAME_SOUND_TIASOUND_H
diff --git a/src/devices/sound/tms3615.cpp b/src/devices/sound/tms3615.cpp
index 3f595c8a97b..5cdf269f77e 100644
--- a/src/devices/sound/tms3615.cpp
+++ b/src/devices/sound/tms3615.cpp
@@ -49,17 +49,14 @@ void tms3615_device::device_start()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void tms3615_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void tms3615_device::sound_stream_update(sound_stream &stream)
{
- auto &buffer8 = outputs[FOOTAGE_8];
- auto &buffer16 = outputs[FOOTAGE_16];
+ int samplerate = stream.sample_rate();
- int samplerate = buffer8.sample_rate();
-
- constexpr stream_buffer::sample_t VMAX = 1.0f / stream_buffer::sample_t(TMS3615_TONES);
- for (int sampindex = 0; sampindex < buffer8.samples(); sampindex++)
+ constexpr sound_stream::sample_t VMAX = 1.0f / sound_stream::sample_t(TMS3615_TONES);
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
- stream_buffer::sample_t sum8 = 0, sum16 = 0;
+ sound_stream::sample_t sum8 = 0, sum16 = 0;
for (int tone = 0; tone < TMS3615_TONES; tone++)
{
@@ -94,8 +91,8 @@ void tms3615_device::sound_stream_update(sound_stream &stream, std::vector<read_
}
}
- buffer8.put(sampindex, sum8);
- buffer16.put(sampindex, sum16);
+ stream.put(FOOTAGE_8, sampindex, sum8);
+ stream.put(FOOTAGE_16, sampindex, sum16);
}
}
diff --git a/src/devices/sound/tms3615.h b/src/devices/sound/tms3615.h
index bf29b32b9dd..bad0bfa8950 100644
--- a/src/devices/sound/tms3615.h
+++ b/src/devices/sound/tms3615.h
@@ -28,7 +28,7 @@ protected:
virtual void device_start() 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;
private:
static constexpr unsigned TMS3615_TONES = 13;
diff --git a/src/devices/sound/tms36xx.cpp b/src/devices/sound/tms36xx.cpp
index 08df1d03f51..e969987d129 100644
--- a/src/devices/sound/tms36xx.cpp
+++ b/src/devices/sound/tms36xx.cpp
@@ -397,19 +397,15 @@ void tms36xx_device::device_start()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void tms36xx_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void tms36xx_device::sound_stream_update(sound_stream &stream)
{
int samplerate = m_samplerate;
- auto &buffer = outputs[0];
/* no tune played? */
if( !tunes[m_tune_num] || m_voices == 0 )
- {
- buffer.fill(0);
return;
- }
- for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
int sum = 0;
@@ -443,7 +439,7 @@ void tms36xx_device::sound_stream_update(sound_stream &stream, std::vector<read_
TONE( 0) TONE( 1) TONE( 2) TONE( 3) TONE( 4) TONE( 5)
TONE( 6) TONE( 7) TONE( 8) TONE( 9) TONE(10) TONE(11)
- buffer.put_int(sampindex, sum, 32768 * m_voices);
+ stream.put_int(0, sampindex, sum, 32768 * m_voices);
}
}
diff --git a/src/devices/sound/tms36xx.h b/src/devices/sound/tms36xx.h
index 307e6787afa..c18d0554615 100644
--- a/src/devices/sound/tms36xx.h
+++ b/src/devices/sound/tms36xx.h
@@ -63,7 +63,7 @@ protected:
virtual void device_start() 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;
public:
// MM6221AA interface functions
diff --git a/src/devices/sound/tms5110.cpp b/src/devices/sound/tms5110.cpp
index eb09016a035..e2d77d130fc 100644
--- a/src/devices/sound/tms5110.cpp
+++ b/src/devices/sound/tms5110.cpp
@@ -1192,22 +1192,21 @@ int tms5110_device::romclk_hack_r()
******************************************************************************/
-void tms5110_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void tms5110_device::sound_stream_update(sound_stream &stream)
{
int16_t sample_data[MAX_SAMPLE_CHUNK];
- auto &buffer = outputs[0];
/* loop while we still have samples to generate */
- for (int sampindex = 0; sampindex < buffer.samples(); )
+ for (int sampindex = 0; sampindex < stream.samples(); )
{
- int length = buffer.samples() - sampindex;
+ int length = stream.samples() - sampindex;
if (length > MAX_SAMPLE_CHUNK)
length = MAX_SAMPLE_CHUNK;
/* generate the samples and copy to the target buffer */
process(sample_data, length);
for (int index = 0; index < length; index++)
- buffer.put_int(sampindex++, sample_data[index], 32768);
+ stream.put_int(0, sampindex++, sample_data[index], 32768);
}
}
diff --git a/src/devices/sound/tms5110.h b/src/devices/sound/tms5110.h
index 2c9628c3338..0f367323f6d 100644
--- a/src/devices/sound/tms5110.h
+++ b/src/devices/sound/tms5110.h
@@ -60,7 +60,7 @@ protected:
TIMER_CALLBACK_MEMBER(romclk_hack_toggle);
// 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;
uint8_t TALK_STATUS() const { return m_SPEN | m_TALKD; }
diff --git a/src/devices/sound/tms5220.cpp b/src/devices/sound/tms5220.cpp
index f472e9aa86e..77869045bea 100644
--- a/src/devices/sound/tms5220.cpp
+++ b/src/devices/sound/tms5220.cpp
@@ -2140,20 +2140,19 @@ int tms5220_device::intq_r()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void tms5220_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void tms5220_device::sound_stream_update(sound_stream &stream)
{
int16_t sample_data[MAX_SAMPLE_CHUNK];
- auto &output = outputs[0];
/* loop while we still have samples to generate */
- for (int sampindex = 0; sampindex < output.samples(); )
+ for (int sampindex = 0; sampindex < stream.samples(); )
{
- int length = (output.samples() > MAX_SAMPLE_CHUNK) ? MAX_SAMPLE_CHUNK : output.samples();
+ int length = (stream.samples() > MAX_SAMPLE_CHUNK) ? MAX_SAMPLE_CHUNK : stream.samples();
/* generate the samples and copy to the target buffer */
process(sample_data, length);
for (int index = 0; index < length; index++)
- output.put_int(sampindex++, sample_data[index], 32768);
+ stream.put_int(0, sampindex++, sample_data[index], 32768);
}
}
diff --git a/src/devices/sound/tms5220.h b/src/devices/sound/tms5220.h
index 6aa0494164b..1dee49d8f1f 100644
--- a/src/devices/sound/tms5220.h
+++ b/src/devices/sound/tms5220.h
@@ -68,7 +68,7 @@ protected:
virtual void device_clock_changed() override;
// 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;
TIMER_CALLBACK_MEMBER(set_io_ready);
diff --git a/src/devices/sound/tt5665.cpp b/src/devices/sound/tt5665.cpp
index 363481669ff..1949c90e36c 100644
--- a/src/devices/sound/tt5665.cpp
+++ b/src/devices/sound/tt5665.cpp
@@ -88,24 +88,24 @@
DEFINE_DEVICE_TYPE(TT5665, tt5665_device, "tt5665", "Tontek TT5665 ADPCM Voice Synthesis LSI")
// same as MSM6295
-const stream_buffer::sample_t tt5665_device::s_volume_table[16] =
+const sound_stream::sample_t tt5665_device::s_volume_table[16] =
{
- stream_buffer::sample_t(0x20) / stream_buffer::sample_t(0x20), // 0 dB
- stream_buffer::sample_t(0x16) / stream_buffer::sample_t(0x20), // -3.2 dB
- stream_buffer::sample_t(0x10) / stream_buffer::sample_t(0x20), // -6.0 dB
- stream_buffer::sample_t(0x0b) / stream_buffer::sample_t(0x20), // -9.2 dB
- stream_buffer::sample_t(0x08) / stream_buffer::sample_t(0x20), // -12.0 dB
- stream_buffer::sample_t(0x06) / stream_buffer::sample_t(0x20), // -14.5 dB
- stream_buffer::sample_t(0x04) / stream_buffer::sample_t(0x20), // -18.0 dB
- stream_buffer::sample_t(0x03) / stream_buffer::sample_t(0x20), // -20.5 dB
- stream_buffer::sample_t(0x02) / stream_buffer::sample_t(0x20), // -24.0 dB
- stream_buffer::sample_t(0x00) / stream_buffer::sample_t(0x20),
- stream_buffer::sample_t(0x00) / stream_buffer::sample_t(0x20),
- stream_buffer::sample_t(0x00) / stream_buffer::sample_t(0x20),
- stream_buffer::sample_t(0x00) / stream_buffer::sample_t(0x20),
- stream_buffer::sample_t(0x00) / stream_buffer::sample_t(0x20),
- stream_buffer::sample_t(0x00) / stream_buffer::sample_t(0x20),
- stream_buffer::sample_t(0x00) / stream_buffer::sample_t(0x20),
+ sound_stream::sample_t(0x20) / sound_stream::sample_t(0x20), // 0 dB
+ sound_stream::sample_t(0x16) / sound_stream::sample_t(0x20), // -3.2 dB
+ sound_stream::sample_t(0x10) / sound_stream::sample_t(0x20), // -6.0 dB
+ sound_stream::sample_t(0x0b) / sound_stream::sample_t(0x20), // -9.2 dB
+ sound_stream::sample_t(0x08) / sound_stream::sample_t(0x20), // -12.0 dB
+ sound_stream::sample_t(0x06) / sound_stream::sample_t(0x20), // -14.5 dB
+ sound_stream::sample_t(0x04) / sound_stream::sample_t(0x20), // -18.0 dB
+ sound_stream::sample_t(0x03) / sound_stream::sample_t(0x20), // -20.5 dB
+ sound_stream::sample_t(0x02) / sound_stream::sample_t(0x20), // -24.0 dB
+ sound_stream::sample_t(0x00) / sound_stream::sample_t(0x20),
+ sound_stream::sample_t(0x00) / sound_stream::sample_t(0x20),
+ sound_stream::sample_t(0x00) / sound_stream::sample_t(0x20),
+ sound_stream::sample_t(0x00) / sound_stream::sample_t(0x20),
+ sound_stream::sample_t(0x00) / sound_stream::sample_t(0x20),
+ sound_stream::sample_t(0x00) / sound_stream::sample_t(0x20),
+ sound_stream::sample_t(0x00) / sound_stream::sample_t(0x20),
};
@@ -210,16 +210,13 @@ void tt5665_device::device_clock_changed()
// our sound stream
//-------------------------------------------------
-void tt5665_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void tt5665_device::sound_stream_update(sound_stream &stream)
{
- // reset the output stream
- outputs[0].fill(0);
- outputs[1].fill(0);
bool update_daol = false;
// iterate over voices and accumulate sample data
// loop while we still have samples to generate
- for (int s = 0; s < outputs[0].samples(); s++)
+ for (int s = 0; s < stream.samples(); s++)
{
// adjust DAOL clock timing
m_daol_timing--;
@@ -239,8 +236,8 @@ void tt5665_device::sound_stream_update(sound_stream &stream, std::vector<read_s
// refresh DAOR output
m_voice[b + 4].generate_adpcm(*this, &daor_output);
}
- outputs[0].put_int(s, m_daol_output, 2048);
- outputs[1].put_int(s, daor_output, 2048);
+ stream.put_int(0, s, m_daol_output, 2048);
+ stream.put_int(1, s, daor_output, 2048);
if (update_daol)
{
update_daol = false;
diff --git a/src/devices/sound/tt5665.h b/src/devices/sound/tt5665.h
index 2bbd1c73822..811e2f278e2 100644
--- a/src/devices/sound/tt5665.h
+++ b/src/devices/sound/tt5665.h
@@ -69,7 +69,7 @@ protected:
virtual void device_clock_changed() override;
// device_sound_interface 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;
// device_rom_interface overrides
virtual void rom_bank_pre_change() override;
@@ -87,7 +87,7 @@ private:
offs_t m_base_offset; // pointer to the base memory location
u32 m_sample; // current sample number
u32 m_count; // total samples to play
- stream_buffer::sample_t m_volume; // output volume
+ sound_stream::sample_t m_volume; // output volume
};
// configuration state
@@ -105,7 +105,7 @@ private:
inline int freq_divider() const { return m_ss_state ? 136 : 170; }
- static const stream_buffer::sample_t s_volume_table[16];
+ static const sound_stream::sample_t s_volume_table[16];
};
diff --git a/src/devices/sound/uda1344.cpp b/src/devices/sound/uda1344.cpp
index b8d445ef3b8..3031ea2e75d 100644
--- a/src/devices/sound/uda1344.cpp
+++ b/src/devices/sound/uda1344.cpp
@@ -88,25 +88,21 @@ void uda1344_device::device_reset()
memset(m_bufout, 0, sizeof(uint32_t) * 2);
}
-void uda1344_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void uda1344_device::sound_stream_update(sound_stream &stream)
{
- for (int channel = 0; channel < 2 && channel < outputs.size(); channel++)
+ for (int channel = 0; channel < 2 && channel < stream.output_count(); channel++)
{
- auto &output = outputs[channel];
uint32_t curout = m_bufout[channel];
uint32_t curin = m_bufin[channel];
// feed as much as we can
int sampindex;
- for (sampindex = 0; curout != curin && sampindex < output.samples(); sampindex++)
+ for (sampindex = 0; curout != curin && sampindex < stream.samples(); sampindex++)
{
- output.put(sampindex, stream_buffer::sample_t(m_buffer[channel][curout]) * m_volume);
+ stream.put(channel, sampindex, sound_stream::sample_t(m_buffer[channel][curout]) * m_volume);
curout = (curout + 1) % BUFFER_SIZE;
}
- // fill the rest with silence
- output.fill(0, sampindex);
-
// save the new output pointer
m_bufout[channel] = curout;
}
@@ -116,8 +112,8 @@ void uda1344_device::ingest_samples(int16_t left, int16_t right)
{
const int16_t samples[2] = { left, right };
- const stream_buffer::sample_t sample_scale = 1.0 / 32768.0;
- const stream_buffer::sample_t enable_scale = m_dac_enable ? 1.0 : 0.0;
+ const sound_stream::sample_t sample_scale = 1.0 / 32768.0;
+ const sound_stream::sample_t enable_scale = m_dac_enable ? 1.0 : 0.0;
m_stream->update();
@@ -126,7 +122,7 @@ void uda1344_device::ingest_samples(int16_t left, int16_t right)
int maxin = (m_bufout[channel] + BUFFER_SIZE - 1) % BUFFER_SIZE;
if (m_bufin[channel] != maxin)
{
- m_buffer[channel][m_bufin[channel]] = stream_buffer::sample_t(samples[channel]) * sample_scale * enable_scale;
+ m_buffer[channel][m_bufin[channel]] = sound_stream::sample_t(samples[channel]) * sample_scale * enable_scale;
m_bufin[channel] = (m_bufin[channel] + 1) % BUFFER_SIZE;
}
else
diff --git a/src/devices/sound/uda1344.h b/src/devices/sound/uda1344.h
index 5ba1df90cdf..6cc895e2245 100644
--- a/src/devices/sound/uda1344.h
+++ b/src/devices/sound/uda1344.h
@@ -30,7 +30,7 @@ protected:
virtual void device_clock_changed() override;
// 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;
void ingest_samples(int16_t left, int16_t right);
@@ -79,10 +79,10 @@ protected:
};
sound_stream *m_stream;
- std::vector<stream_buffer::sample_t> m_buffer[2];
+ std::vector<sound_stream::sample_t> m_buffer[2];
uint32_t m_bufin[2];
uint32_t m_bufout[2];
- stream_buffer::sample_t m_volume;
+ sound_stream::sample_t m_volume;
double m_frequency;
uint8_t m_data_transfer_mode;
diff --git a/src/devices/sound/upd65043gfu01.cpp b/src/devices/sound/upd65043gfu01.cpp
index 7ef6c9d98de..f8f517b746f 100644
--- a/src/devices/sound/upd65043gfu01.cpp
+++ b/src/devices/sound/upd65043gfu01.cpp
@@ -205,9 +205,9 @@ void upd65043gfu01_device::update_noise()
}
//**************************************************************************
-void upd65043gfu01_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void upd65043gfu01_device::sound_stream_update(sound_stream &stream)
{
- for (int i = 0; i < outputs[0].samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
s16 sample = 0;
@@ -244,6 +244,6 @@ void upd65043gfu01_device::sound_stream_update(sound_stream &stream, std::vector
if (!BIT(m_control, 4))
sample += m_pcm_buffer[m_pcm_buffer_read & 0x1ff];
- outputs[0].put_int_clamp(i, sample, 1 << 10);
+ stream.put_int_clamp(0, i, sample, 1 << 10);
}
}
diff --git a/src/devices/sound/upd65043gfu01.h b/src/devices/sound/upd65043gfu01.h
index 29c1a74e3a8..482771d9471 100644
--- a/src/devices/sound/upd65043gfu01.h
+++ b/src/devices/sound/upd65043gfu01.h
@@ -23,7 +23,7 @@ protected:
virtual void device_reset() override ATTR_COLD;
virtual void device_clock_changed() 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;
private:
TIMER_CALLBACK_MEMBER(irq_timer);
diff --git a/src/devices/sound/upd7752.cpp b/src/devices/sound/upd7752.cpp
index 8f8a3a6f9a3..ca0f47c46ea 100644
--- a/src/devices/sound/upd7752.cpp
+++ b/src/devices/sound/upd7752.cpp
@@ -98,9 +98,8 @@ void upd7752_device::device_stop()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void upd7752_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void upd7752_device::sound_stream_update(sound_stream &stream)
{
- outputs[0].fill(0);
}
//**************************************************************************
diff --git a/src/devices/sound/upd7752.h b/src/devices/sound/upd7752.h
index c9890e19588..30c663d8fb5 100644
--- a/src/devices/sound/upd7752.h
+++ b/src/devices/sound/upd7752.h
@@ -30,7 +30,7 @@ protected:
virtual void device_stop() 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;
private:
diff --git a/src/devices/sound/upd7759.cpp b/src/devices/sound/upd7759.cpp
index 1579fd8ee39..ff23e9dd6ec 100644
--- a/src/devices/sound/upd7759.cpp
+++ b/src/devices/sound/upd7759.cpp
@@ -684,19 +684,19 @@ int upd775x_device::busy_r()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void upd775x_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void upd775x_device::sound_stream_update(sound_stream &stream)
{
- constexpr stream_buffer::sample_t sample_scale = 128.0 / 32768.0;
- stream_buffer::sample_t sample = stream_buffer::sample_t(m_sample) * sample_scale;
+ constexpr sound_stream::sample_t sample_scale = 128.0 / 32768.0;
+ sound_stream::sample_t sample = sound_stream::sample_t(m_sample) * sample_scale;
int32_t clocks_left = m_clocks_left;
uint32_t step = m_step;
uint32_t pos = m_pos;
u32 index = 0;
if (m_state != STATE_IDLE)
- for ( ; index < outputs[0].samples(); index++)
+ for ( ; index < stream.samples(); index++)
{
- outputs[0].put(index, sample);
+ stream.put(0, index, sample);
pos += step;
@@ -716,14 +716,14 @@ void upd775x_device::sound_stream_update(sound_stream &stream, std::vector<read_
break;
clocks_left = m_clocks_left;
- sample = stream_buffer::sample_t(m_sample) * sample_scale;
+ sample = sound_stream::sample_t(m_sample) * sample_scale;
}
}
}
// if we got out early, just zap the rest of the buffer
- for (; index < outputs[0].samples(); index++)
- outputs[0].put(index, 0);
+ for (; index < stream.samples(); index++)
+ stream.put(0, index, 0);
m_clocks_left = clocks_left;
m_pos = pos;
diff --git a/src/devices/sound/upd7759.h b/src/devices/sound/upd7759.h
index b45fff6d95e..99720af5983 100644
--- a/src/devices/sound/upd7759.h
+++ b/src/devices/sound/upd7759.h
@@ -74,7 +74,7 @@ protected:
virtual void rom_bank_pre_change() override;
// 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;
void update_adpcm(int data);
virtual void advance_state();
diff --git a/src/devices/sound/upd931.cpp b/src/devices/sound/upd931.cpp
index f2986ed68cd..9f3d3efad40 100644
--- a/src/devices/sound/upd931.cpp
+++ b/src/devices/sound/upd931.cpp
@@ -159,9 +159,9 @@ void upd931_device::device_clock_changed()
}
/**************************************************************************/
-void upd931_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void upd931_device::sound_stream_update(sound_stream &stream)
{
- for (int i = 0; i < outputs[0].samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
s32 sample = 0;
for (voice_t &voice : m_voice)
@@ -172,7 +172,7 @@ void upd931_device::sound_stream_update(sound_stream &stream, std::vector<read_s
sample += voice.m_wave_out[0] * (voice.m_env_level[0] >> VOLUME_SHIFT);
sample += voice.m_wave_out[1] * (voice.m_env_level[1] >> VOLUME_SHIFT);
}
- outputs[0].put_int_clamp(i, sample, 1 << 16);
+ stream.put_int_clamp(0, i, sample, 1 << 16);
}
}
diff --git a/src/devices/sound/upd931.h b/src/devices/sound/upd931.h
index a97397fc11b..ea982ac5b58 100644
--- a/src/devices/sound/upd931.h
+++ b/src/devices/sound/upd931.h
@@ -40,7 +40,7 @@ protected:
virtual void device_reset() override ATTR_COLD;
virtual void device_clock_changed() 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;
private:
static constexpr unsigned PITCH_SHIFT = 15;
diff --git a/src/devices/sound/upd933.cpp b/src/devices/sound/upd933.cpp
index fa96a241120..3d6e2a22a9d 100644
--- a/src/devices/sound/upd933.cpp
+++ b/src/devices/sound/upd933.cpp
@@ -371,9 +371,9 @@ u32 upd933_device::env_rate(u8 data) const
}
/**************************************************************************/
-void upd933_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void upd933_device::sound_stream_update(sound_stream &stream)
{
- for (int i = 0; i < outputs[0].samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
s32 sample = 0;
@@ -385,7 +385,7 @@ void upd933_device::sound_stream_update(sound_stream &stream, std::vector<read_s
for (int j : voice_map)
sample += update(j);
- outputs[0].put_int_clamp(i, sample, 1 << 15);
+ stream.put_int_clamp(0, i, sample, 1 << 15);
m_sample_count++;
}
}
diff --git a/src/devices/sound/upd933.h b/src/devices/sound/upd933.h
index b29c2f2c879..1f8049d0dfd 100644
--- a/src/devices/sound/upd933.h
+++ b/src/devices/sound/upd933.h
@@ -31,7 +31,7 @@ protected:
virtual void device_reset() override ATTR_COLD;
virtual void device_clock_changed() 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;
private:
static constexpr unsigned NOTE_SHIFT = 9;
diff --git a/src/devices/sound/upd934g.cpp b/src/devices/sound/upd934g.cpp
index 106d16dec6f..0a4e663c6c0 100644
--- a/src/devices/sound/upd934g.cpp
+++ b/src/devices/sound/upd934g.cpp
@@ -88,7 +88,7 @@ void upd934g_device::device_reset()
// our sound stream
//-------------------------------------------------
-void upd934g_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void upd934g_device::sound_stream_update(sound_stream &stream)
{
for (unsigned ch = 0; ch < 4; ch++)
{
@@ -96,7 +96,7 @@ void upd934g_device::sound_stream_update(sound_stream &stream, std::vector<read_
{
uint16_t end = m_addr[(m_channel[ch].playing + 1) & 0xf] - 1;
- for (unsigned i = 0; i < outputs[ch].samples(); i++)
+ for (unsigned i = 0; i < stream.samples(); i++)
{
int16_t raw = static_cast<int8_t>(read_byte(m_channel[ch].pos)) * 4;
@@ -105,18 +105,15 @@ void upd934g_device::sound_stream_update(sound_stream &stream, std::vector<read_
const double adjust[] = { 0.4, 0.7, 0.4, 1.0 };
raw *= adjust[m_channel[ch].effect];
- outputs[ch].put_int(i, raw, 32768 / 64);
+ stream.put_int(ch, i, raw, 32768 / 64);
if (++m_channel[ch].pos >= end)
{
m_channel[ch].playing = -1;
- outputs[ch].fill(0, i + 1);
break;
}
}
}
- else
- outputs[ch].fill(0);
}
}
diff --git a/src/devices/sound/upd934g.h b/src/devices/sound/upd934g.h
index 41bcd038e08..40f081aa9c1 100644
--- a/src/devices/sound/upd934g.h
+++ b/src/devices/sound/upd934g.h
@@ -34,7 +34,7 @@ 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;
private:
sound_stream *m_stream;
diff --git a/src/devices/sound/va_eg.cpp b/src/devices/sound/va_eg.cpp
index 401d5c34197..341d7c71ac8 100644
--- a/src/devices/sound/va_eg.cpp
+++ b/src/devices/sound/va_eg.cpp
@@ -99,23 +99,22 @@ void va_rc_eg_device::device_start()
save_item(NAME(m_t_end_approx));
}
-void va_rc_eg_device::sound_stream_update(sound_stream &stream, const std::vector<read_stream_view> &inputs, std::vector<write_stream_view> &outputs)
+void va_rc_eg_device::sound_stream_update(sound_stream &stream)
{
- assert(inputs.size() == 0 && outputs.size() == 1);
- write_stream_view &out = outputs[0];
- attotime t = out.start_time();
+ assert(stream.input_count() == 0 && stream.output_count() == 1);
+ attotime t = stream.start_time();
if (t >= m_t_end_approx)
{
// Avoid expensive get_v() calls if the envelope stage has completed.
- out.fill(m_v_end);
+ stream.fill(0, m_v_end);
return;
}
- const int n = out.samples();
- const attotime dt = out.sample_period();
+ const int n = stream.samples();
+ const attotime dt = stream.sample_period();
for (int i = 0; i < n; ++i, t += dt)
- out.put(i, get_v(t));
+ stream.put(0, i, get_v(t));
}
void va_rc_eg_device::snapshot()
diff --git a/src/devices/sound/va_eg.h b/src/devices/sound/va_eg.h
index bd8c00cd722..66bf8a9c99e 100644
--- a/src/devices/sound/va_eg.h
+++ b/src/devices/sound/va_eg.h
@@ -17,6 +17,16 @@
// - Start decay: rc_eg.set_r(decay_r).set_target_v(sustain_v);
// - Start release: rc_eg.set_r(release_r).set_target_v(0);
//
+// The set_*() methods expect a monotonically increasing machine time, and will
+// assert()-fail if that's not the case.
+// If a single instance is used by multiple CPUs, this requirement can be met by
+// calling set_*() from within timer callbacks invoked with:
+// machine().scheduler().synchronize(timer_expired_delegate(...)).
+// See src/mame/moog/source.cpp for examples.
+//
+// Depending on the details of the multi-CPU system being emulated, additional
+// synchronization mitigations may be warranted, such as add_quantum(),
+// set_perfect_quantum(), etc.
class va_rc_eg_device : public device_t, public device_sound_interface
{
public:
@@ -39,7 +49,7 @@ public:
protected:
void device_start() override ATTR_COLD;
- void sound_stream_update(sound_stream &stream, const std::vector<read_stream_view> &inputs, std::vector<write_stream_view> &outputs) override;
+ void sound_stream_update(sound_stream &stream) override;
private:
// Takes a snapshot of the current voltage into m_v_start and m_t_start.
diff --git a/src/devices/sound/va_vca.cpp b/src/devices/sound/va_vca.cpp
index d918dd25fba..63ba220ae86 100644
--- a/src/devices/sound/va_vca.cpp
+++ b/src/devices/sound/va_vca.cpp
@@ -55,17 +55,17 @@ void va_vca_device::device_start()
save_item(NAME(m_fixed_gain));
}
-void va_vca_device::sound_stream_update(sound_stream &stream, const std::vector<read_stream_view> &inputs, std::vector<write_stream_view> &outputs)
+void va_vca_device::sound_stream_update(sound_stream &stream)
{
if (m_has_cv_stream)
{
- for (int i = 0; i < outputs[0].samples(); i++)
- outputs[0].put(i, inputs[0].get(i) * cv_to_gain(inputs[1].get(i)));
+ for (int i = 0; i < stream.samples(); i++)
+ stream.put(0, i, stream.get(0, i) * cv_to_gain(stream.get(1, i)));
}
else
{
- for (int i = 0; i < outputs[0].samples(); i++)
- outputs[0].put(i, inputs[0].get(i) * m_fixed_gain);
+ for (int i = 0; i < stream.samples(); i++)
+ stream.put(0, i, stream.get(0, i) * m_fixed_gain);
}
}
diff --git a/src/devices/sound/va_vca.h b/src/devices/sound/va_vca.h
index ee155426019..9d9c3963ce1 100644
--- a/src/devices/sound/va_vca.h
+++ b/src/devices/sound/va_vca.h
@@ -37,7 +37,7 @@ public:
protected:
void device_start() override ATTR_COLD;
- void sound_stream_update(sound_stream &stream, const std::vector<read_stream_view> &inputs, std::vector<write_stream_view> &outputs) override;
+ void sound_stream_update(sound_stream &stream) override;
private:
float cv_to_gain(float cv) const;
diff --git a/src/devices/sound/vgm_visualizer.cpp b/src/devices/sound/vgm_visualizer.cpp
index e62ffe07785..13d25bcb6ca 100644
--- a/src/devices/sound/vgm_visualizer.cpp
+++ b/src/devices/sound/vgm_visualizer.cpp
@@ -54,7 +54,7 @@ DEFINE_DEVICE_TYPE(VGMVIZ, vgmviz_device, "vgmviz", "VGM Visualizer")
vgmviz_device::vgmviz_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, VGMVIZ, tag, owner, clock)
- , device_mixer_interface(mconfig, *this, 2)
+ , device_sound_interface(mconfig, *this)
, m_screen(*this, "screen")
, m_palette(*this, "palette")
{
@@ -76,6 +76,7 @@ vgmviz_device::~vgmviz_device()
void vgmviz_device::device_start()
{
+ stream_alloc(2, 2, machine().sample_rate());
WDL_fft_init();
fill_window();
m_bitmap.resize(SCREEN_WIDTH, SCREEN_HEIGHT);
@@ -283,18 +284,19 @@ void vgmviz_device::cycle_viz_mode()
// audio stream and process as necessary
//-------------------------------------------------
-void vgmviz_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void vgmviz_device::sound_stream_update(sound_stream &stream)
{
- // call the normal interface to actually mix
- device_mixer_interface::sound_stream_update(stream, inputs, outputs);
+ // Passthrough the audio
+ stream.copy(0, 0);
+ stream.copy(1, 1);
- // now consume the outputs
- for (int pos = 0; pos < outputs[0].samples(); pos++)
+ // now consume the inputs
+ for (int pos = 0; pos < stream.samples(); pos++)
{
- for (int i = 0; i < outputs.size(); i++)
+ for (int i = 0; i < stream.output_count(); i++)
{
// Original code took 16-bit sample / 65536.0 instead of 32768.0, so multiply by 0.5 here but is it necessary?
- const float sample = outputs[i].get(pos) * 0.5f;
+ const float sample = stream.get(i, pos) * 0.5f;
m_audio_buf[m_audio_fill_index][i][m_audio_count[m_audio_fill_index]] = sample + 0.5f;
}
diff --git a/src/devices/sound/vgm_visualizer.h b/src/devices/sound/vgm_visualizer.h
index f201b117461..ee671535a24 100644
--- a/src/devices/sound/vgm_visualizer.h
+++ b/src/devices/sound/vgm_visualizer.h
@@ -35,7 +35,7 @@ DECLARE_DEVICE_TYPE(VGMVIZ, vgmviz_device)
// ======================> vgmviz_device
-class vgmviz_device : public device_t, public device_mixer_interface
+class vgmviz_device : public device_t, public device_sound_interface
{
public:
// construction/destruction
@@ -91,7 +91,7 @@ protected:
virtual void device_reset() override ATTR_COLD;
// device_sound_interface-level overrides
- void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
+ void sound_stream_update(sound_stream &stream) override;
void update_waveform();
void update_fft();
diff --git a/src/devices/sound/vlm5030.cpp b/src/devices/sound/vlm5030.cpp
index 03381d3460f..8f6e3715360 100644
--- a/src/devices/sound/vlm5030.cpp
+++ b/src/devices/sound/vlm5030.cpp
@@ -498,19 +498,18 @@ void vlm5030_device::st(int state)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void vlm5030_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void vlm5030_device::sound_stream_update(sound_stream &stream)
{
int interp_effect;
int i;
int u[11];
- auto &buffer = outputs[0];
/* running */
int sampindex = 0;
if (m_phase == PH_RUN || m_phase == PH_STOP)
{
/* playing speech */
- for ( ; sampindex < buffer.samples(); sampindex++)
+ for ( ; sampindex < stream.samples(); sampindex++)
{
int current_val;
@@ -603,7 +602,7 @@ void vlm5030_device::sound_stream_update(sound_stream &stream, std::vector<read_
m_x[0] = u[0];
/* clipping, buffering */
- buffer.put_int_clamp(sampindex, u[0], 512);
+ stream.put_int_clamp(0, sampindex, u[0], 512);
/* sample count */
m_sample_count--;
@@ -622,7 +621,7 @@ phase_stop:
switch (m_phase)
{
case PH_SETUP:
- if (m_sample_count <= buffer.samples())
+ if (m_sample_count <= stream.samples())
{
m_sample_count = 0;
/* logerror("VLM5030 BSY=H\n"); */
@@ -631,11 +630,11 @@ phase_stop:
}
else
{
- m_sample_count -= buffer.samples();
+ m_sample_count -= stream.samples();
}
break;
case PH_END:
- if (m_sample_count <= buffer.samples())
+ if (m_sample_count <= stream.samples())
{
m_sample_count = 0;
/* logerror("VLM5030 BSY=L\n"); */
@@ -644,10 +643,7 @@ phase_stop:
}
else
{
- m_sample_count -= buffer.samples();
+ m_sample_count -= stream.samples();
}
}
-
- /* silent buffering */
- buffer.fill(0, sampindex);
}
diff --git a/src/devices/sound/vlm5030.h b/src/devices/sound/vlm5030.h
index ca34110b285..f9d05749882 100644
--- a/src/devices/sound/vlm5030.h
+++ b/src/devices/sound/vlm5030.h
@@ -34,7 +34,7 @@ protected:
virtual void device_post_load() override;
// 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;
// device_rom_interface overrides
virtual void rom_bank_pre_change() override;
diff --git a/src/devices/sound/votrax.cpp b/src/devices/sound/votrax.cpp
index f1da1134415..3ad167f9145 100644
--- a/src/devices/sound/votrax.cpp
+++ b/src/devices/sound/votrax.cpp
@@ -157,13 +157,13 @@ void votrax_sc01_device::inflection_w(uint8_t data)
// for our sound stream
//-------------------------------------------------
-void votrax_sc01_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void votrax_sc01_device::sound_stream_update(sound_stream &stream)
{
- for(int i=0; i<outputs[0].samples(); i++) {
+ for(int i=0; i<stream.samples(); i++) {
m_sample_count++;
if(m_sample_count & 1)
chip_update();
- outputs[0].put(i, analog_calc());
+ stream.put(0, i, analog_calc());
}
}
@@ -596,7 +596,7 @@ void votrax_sc01_device::filters_commit(bool force)
LOGMASKED(LOG_FILTER, "filter fa=%x va=%x fc=%x f1=%x f2=%02x f2q=%x f3=%x\n", m_filt_fa, m_filt_va, m_filt_fc, m_filt_f1, m_filt_f2, m_filt_f2q, m_filt_f3);
}
-stream_buffer::sample_t votrax_sc01_device::analog_calc()
+sound_stream::sample_t votrax_sc01_device::analog_calc()
{
// Voice-only path.
// 1. Pick up the pitch wave
diff --git a/src/devices/sound/votrax.h b/src/devices/sound/votrax.h
index a3b2ab12114..498d6ed36eb 100644
--- a/src/devices/sound/votrax.h
+++ b/src/devices/sound/votrax.h
@@ -36,7 +36,7 @@ protected:
virtual void device_clock_changed() override;
// device_sound_interface 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;
TIMER_CALLBACK_MEMBER(phone_tick);
@@ -178,7 +178,7 @@ private:
void chip_update(); // Global update called at 20KHz (main/36)
void filters_commit(bool force); // Commit the currently computed interpolation values to the filters
void phone_commit(); // Commit the current phone id
- stream_buffer::sample_t analog_calc(); // Compute one more sample
+ sound_stream::sample_t analog_calc(); // Compute one more sample
};
class votrax_sc01a_device : public votrax_sc01_device
diff --git a/src/devices/sound/vrc6.cpp b/src/devices/sound/vrc6.cpp
index d9b36f5b8a6..40f2ddf8946 100644
--- a/src/devices/sound/vrc6.cpp
+++ b/src/devices/sound/vrc6.cpp
@@ -93,16 +93,13 @@ void vrc6snd_device::device_reset()
// our sound stream
//-------------------------------------------------
-void vrc6snd_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void vrc6snd_device::sound_stream_update(sound_stream &stream)
{
// check global halt bit
if (m_freqctrl & 1)
- {
- outputs[0].fill(0);
return;
- }
- for (int i = 0; i < outputs[0].samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
// update pulse1
if (m_pulsefrqh[0] & 0x80)
@@ -200,7 +197,7 @@ void vrc6snd_device::sound_stream_update(sound_stream &stream, std::vector<read_
// sum 2 4-bit pulses, 1 5-bit saw = unsigned 6 bit output
s16 tmp = (s16)(u8)(m_output[0] + m_output[1] + m_output[2]);
- outputs[0].put_int(i, tmp, 128);
+ stream.put_int(0, i, tmp, 128);
}
}
diff --git a/src/devices/sound/vrc6.h b/src/devices/sound/vrc6.h
index 9dcc2fa1cee..8ca9102bc2d 100644
--- a/src/devices/sound/vrc6.h
+++ b/src/devices/sound/vrc6.h
@@ -31,7 +31,7 @@ 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;
private:
u8 m_freqctrl, m_pulsectrl[2], m_sawrate, m_master_freq;
diff --git a/src/devices/sound/vrender0.cpp b/src/devices/sound/vrender0.cpp
index a364ed8ef67..e91fea403b0 100644
--- a/src/devices/sound/vrender0.cpp
+++ b/src/devices/sound/vrender0.cpp
@@ -205,9 +205,9 @@ device_memory_interface::space_config_vector vr0sound_device::memory_space_confi
// for our sound stream
//-------------------------------------------------
-void vr0sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void vr0sound_device::sound_stream_update(sound_stream &stream)
{
- VR0_RenderAudio(outputs[0], outputs[1]);
+ VR0_RenderAudio(stream);
}
u16 vr0sound_device::channel_r(offs_t offset)
@@ -493,7 +493,7 @@ void vr0sound_device::channel_t::write(offs_t offset, u16 data, u16 mem_mask)
}
}
-void vr0sound_device::VR0_RenderAudio(write_stream_view &l, write_stream_view &r)
+void vr0sound_device::VR0_RenderAudio(sound_stream &stream)
{
int div;
if (m_ChnClkNum)
@@ -501,7 +501,7 @@ void vr0sound_device::VR0_RenderAudio(write_stream_view &l, write_stream_view &r
else
div = 1 << 16;
- for (int s = 0; s < l.samples(); s++)
+ for (int s = 0; s < stream.samples(); s++)
{
s32 lsample = 0, rsample = 0;
for (int i = 0; i <= m_MaxChn; i++)
@@ -583,7 +583,7 @@ void vr0sound_device::VR0_RenderAudio(write_stream_view &l, write_stream_view &r
lsample += (sample * channel->LChnVol) >> 8;
rsample += (sample * channel->RChnVol) >> 8;
}
- l.put_int_clamp(s, lsample, 32768);
- r.put_int_clamp(s, rsample, 32768);
+ stream.put_int_clamp(0, s, lsample, 32768);
+ stream.put_int_clamp(1, s, rsample, 32768);
}
}
diff --git a/src/devices/sound/vrender0.h b/src/devices/sound/vrender0.h
index 87f16302cf3..5a2d64183f0 100644
--- a/src/devices/sound/vrender0.h
+++ b/src/devices/sound/vrender0.h
@@ -78,7 +78,7 @@ protected:
virtual void device_clock_changed() override;
// 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;
// device_memory_interface configuration
virtual space_config_vector memory_space_config() const override;
@@ -151,7 +151,7 @@ private:
u8 m_MaxChn = 0x1f; // Max Channels - 1
u8 m_ChnClkNum = 0; // Clock Number per Channel
u16 m_Ctrl = 0; // 0x602 Control Functions
- void VR0_RenderAudio(write_stream_view &l, write_stream_view &r);
+ void VR0_RenderAudio(sound_stream &stream);
};
DECLARE_DEVICE_TYPE(SOUND_VRENDER0, vr0sound_device)
diff --git a/src/devices/sound/wave.cpp b/src/devices/sound/wave.cpp
index 1a53aaa95f7..3540d3a08fa 100644
--- a/src/devices/sound/wave.cpp
+++ b/src/devices/sound/wave.cpp
@@ -45,7 +45,7 @@ void wave_device::device_start()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void wave_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void wave_device::sound_stream_update(sound_stream &stream)
{
cassette_state state = m_cass->get_state() & (CASSETTE_MASK_UISTATE | CASSETTE_MASK_MOTOR | CASSETTE_MASK_SPEAKER);
@@ -53,21 +53,16 @@ void wave_device::sound_stream_update(sound_stream &stream, std::vector<read_str
{
cassette_image *cassette = m_cass->get_image();
double time_index = m_cass->get_position();
- double duration = double(outputs[0].samples()) / outputs[0].sample_rate();
+ double duration = double(stream.samples()) / stream.sample_rate();
- if (m_sample_buf.size() < outputs[0].samples())
- m_sample_buf.resize(outputs[0].samples());
+ if (m_sample_buf.size() < stream.samples())
+ m_sample_buf.resize(stream.samples());
for (int ch = 0; ch < 2; ch++)
{
- cassette->get_samples(ch, time_index, duration, outputs[ch].samples(), 2, &m_sample_buf[0], cassette_image::WAVEFORM_16BIT);
- for (int sampindex = 0; sampindex < outputs[0].samples(); sampindex++)
- outputs[ch].put_int(sampindex, m_sample_buf[sampindex], 32768);
+ cassette->get_samples(ch, time_index, duration, stream.samples(), 2, &m_sample_buf[0], cassette_image::WAVEFORM_16BIT);
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
+ stream.put_int(ch, sampindex, m_sample_buf[sampindex], 32768);
}
}
- else
- {
- outputs[0].fill(0);
- outputs[1].fill(0);
- }
}
diff --git a/src/devices/sound/wave.h b/src/devices/sound/wave.h
index 0d2db370f66..723c0b93fb6 100644
--- a/src/devices/sound/wave.h
+++ b/src/devices/sound/wave.h
@@ -36,7 +36,7 @@ protected:
virtual void device_start() 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;
private:
required_device<cassette_image_device> m_cass;
diff --git a/src/devices/sound/x1_010.cpp b/src/devices/sound/x1_010.cpp
index 2947ed66654..0c5a4accfaa 100644
--- a/src/devices/sound/x1_010.cpp
+++ b/src/devices/sound/x1_010.cpp
@@ -206,16 +206,10 @@ void x1_010_device::word_w(offs_t offset, u16 data)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void x1_010_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void x1_010_device::sound_stream_update(sound_stream &stream)
{
- // mixer buffer zero clear
- outputs[0].fill(0);
- outputs[1].fill(0);
-
// if (m_sound_enable == 0) return;
- auto &bufL = outputs[0];
- auto &bufR = outputs[1];
for (int ch = 0; ch < NUM_CHANNELS; ch++)
{
X1_010_CHANNEL *reg = (X1_010_CHANNEL *)&(m_reg[ch*sizeof(X1_010_CHANNEL)]);
@@ -239,7 +233,7 @@ void x1_010_device::sound_stream_update(sound_stream &stream, std::vector<read_s
LOGMASKED(LOG_SOUND, "Play sample %p - %p, channel %X volume %d:%d freq %X step %X offset %X\n",
start, end, ch, volL, volR, freq, smp_step, smp_offs);
}
- for (int i = 0; i < bufL.samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
const u32 delta = smp_offs >> 4;
// sample ended?
@@ -249,8 +243,8 @@ void x1_010_device::sound_stream_update(sound_stream &stream, std::vector<read_s
break;
}
const s8 data = (s8)(read_byte(start+delta));
- bufL.add_int(i, data * volL, 32768 * 256);
- bufR.add_int(i, data * volR, 32768 * 256);
+ stream.add_int(0, i, data * volL, 32768 * 256);
+ stream.add_int(1, i, data * volR, 32768 * 256);
smp_offs += smp_step;
}
m_smp_offset[ch] = smp_offs;
@@ -271,7 +265,7 @@ void x1_010_device::sound_stream_update(sound_stream &stream, std::vector<read_s
LOGMASKED(LOG_SOUND, "Play waveform %X, channel %X volume %X freq %4X step %X offset %X\n",
reg->volume, ch, reg->end, freq, smp_step, smp_offs);
}
- for (int i = 0; i < bufL.samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
const u32 delta = env_offs >> 10;
// Envelope one shot mode
@@ -284,8 +278,8 @@ void x1_010_device::sound_stream_update(sound_stream &stream, std::vector<read_s
const int volL = ((vol >> 4) & 0xf) * VOL_BASE;
const int volR = ((vol >> 0) & 0xf) * VOL_BASE;
const s8 data = (s8)(m_reg[start + ((smp_offs >> 10) & 0x7f)]);
- bufL.add_int(i, data * volL, 32768 * 256);
- bufR.add_int(i, data * volR, 32768 * 256);
+ stream.add_int(0, i, data * volL, 32768 * 256);
+ stream.add_int(1, i, data * volR, 32768 * 256);
smp_offs += smp_step;
env_offs += env_step;
}
@@ -294,10 +288,4 @@ void x1_010_device::sound_stream_update(sound_stream &stream, std::vector<read_s
}
}
}
-
- for (int i = 0; i < bufL.samples(); i++)
- {
- bufL.put(i, std::clamp(bufL.getraw(i), -1.0f, 1.0f));
- bufR.put(i, std::clamp(bufR.getraw(i), -1.0f, 1.0f));
- }
}
diff --git a/src/devices/sound/x1_010.h b/src/devices/sound/x1_010.h
index 2b206210dd6..1c636d0bd98 100644
--- a/src/devices/sound/x1_010.h
+++ b/src/devices/sound/x1_010.h
@@ -26,7 +26,7 @@ protected:
virtual void device_clock_changed() override;
// 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;
// device_rom_interface overrides
virtual void rom_bank_pre_change() override;
diff --git a/src/devices/sound/xt446.cpp b/src/devices/sound/xt446.cpp
index 8136f43ed90..93a7c9687fa 100644
--- a/src/devices/sound/xt446.cpp
+++ b/src/devices/sound/xt446.cpp
@@ -37,7 +37,7 @@ ROM_END
xt446_device::xt446_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, XT446, tag, owner, clock)
- , device_mixer_interface(mconfig, *this, 2)
+ , device_mixer_interface(mconfig, *this)
, m_maincpu(*this, "maincpu")
, m_swp30(*this, "swp30")
{
@@ -91,7 +91,7 @@ void xt446_device::device_add_mconfig(machine_config &config)
SWP30(config, m_swp30);
m_swp30->set_addrmap(AS_DATA, &xt446_device::swp30_map);
- m_swp30->add_route(0, *this, 1.0, AUTO_ALLOC_INPUT, 0);
- m_swp30->add_route(1, *this, 1.0, AUTO_ALLOC_INPUT, 1);
+ m_swp30->add_route(0, *this, 1.0, 0);
+ m_swp30->add_route(1, *this, 1.0, 1);
}
diff --git a/src/devices/sound/ym2154.cpp b/src/devices/sound/ym2154.cpp
index b52c4e49532..7d7c8bdd420 100644
--- a/src/devices/sound/ym2154.cpp
+++ b/src/devices/sound/ym2154.cpp
@@ -245,16 +245,10 @@ TIMER_CALLBACK_MEMBER(ym2154_device::delayed_irq)
// sound_stream_update - generate sound data
//-------------------------------------------------
-void ym2154_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void ym2154_device::sound_stream_update(sound_stream &stream)
{
static const uint16_t voltable[8] = { 0x7fa,0x751,0x6b5,0x627,0x5a4,0x52c,0x4be,0x45a };
- auto &outl = outputs[0];
- auto &outr = outputs[1];
-
- outl.fill(0);
- outr.fill(0);
-
for (int chan = 0; chan < 12; chan++)
{
auto &channel = m_channel[chan];
@@ -279,7 +273,7 @@ void ym2154_device::sound_stream_update(sound_stream &stream, std::vector<read_s
rvol = voltable[rvol & 7] >> (rvol >> 3);
auto &source = space(chan / 6);
- for (int sampindex = 0; sampindex < outl.samples() && (channel.m_pos >> ADDR_SHIFT) <= channel.m_end; sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples() && (channel.m_pos >> ADDR_SHIFT) <= channel.m_end; sampindex++)
{
uint8_t raw = source.read_byte(channel.m_pos++);
@@ -291,8 +285,8 @@ void ym2154_device::sound_stream_update(sound_stream &stream, std::vector<read_s
if (BIT(raw, 7))
sample = -sample;
- outl.add_int(sampindex, sample * lvol, 0x2000 * 0x800);
- outr.add_int(sampindex, sample * rvol, 0x2000 * 0x800);
+ stream.add_int(0, sampindex, sample * lvol, 0x2000 * 0x800);
+ stream.add_int(1, sampindex, sample * rvol, 0x2000 * 0x800);
}
}
}
diff --git a/src/devices/sound/ym2154.h b/src/devices/sound/ym2154.h
index 65eeb8d3a0c..f74225dd3d3 100644
--- a/src/devices/sound/ym2154.h
+++ b/src/devices/sound/ym2154.h
@@ -39,7 +39,7 @@ protected:
virtual void device_clock_changed() override;
// sound 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;
// memory space configuration
virtual space_config_vector memory_space_config() const override;
diff --git a/src/devices/sound/ymf271.cpp b/src/devices/sound/ymf271.cpp
index 3f748656d91..aaa11319381 100644
--- a/src/devices/sound/ymf271.cpp
+++ b/src/devices/sound/ymf271.cpp
@@ -566,7 +566,7 @@ void ymf271_device::set_feedback(int slotnum, int64_t inp)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void ymf271_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void ymf271_device::sound_stream_update(sound_stream &stream)
{
int i, j;
int op;
@@ -599,7 +599,7 @@ void ymf271_device::sound_stream_update(sound_stream &stream, std::vector<read_s
if (m_slots[slot1].active)
{
- for (i = 0; i < outputs[0].samples(); i++)
+ for (i = 0; i < stream.samples(); i++)
{
int64_t output1 = 0, output2 = 0, output3 = 0, output4 = 0;
int64_t phase_mod1, phase_mod2, phase_mod3;
@@ -833,7 +833,7 @@ void ymf271_device::sound_stream_update(sound_stream &stream, std::vector<read_s
mixp = &m_mix_buffer[0];
if (m_slots[slot1].active)
{
- for (i = 0; i < outputs[0].samples(); i++)
+ for (i = 0; i < stream.samples(); i++)
{
int64_t output1 = 0, output3 = 0;
int64_t phase_mod1, phase_mod3;
@@ -900,7 +900,7 @@ void ymf271_device::sound_stream_update(sound_stream &stream, std::vector<read_s
if (m_slots[slot1].active)
{
- for (i = 0; i < outputs[0].samples(); i++)
+ for (i = 0; i < stream.samples(); i++)
{
int64_t output1 = 0, output2 = 0, output3 = 0;
int64_t phase_mod1, phase_mod3;
@@ -1006,29 +1006,29 @@ void ymf271_device::sound_stream_update(sound_stream &stream, std::vector<read_s
}
mixp = &m_mix_buffer[0];
- update_pcm(j + (3*12), mixp, outputs[0].samples());
+ update_pcm(j + (3*12), mixp, stream.samples());
break;
}
// PCM
case 3:
{
- update_pcm(j + (0*12), mixp, outputs[0].samples());
- update_pcm(j + (1*12), mixp, outputs[0].samples());
- update_pcm(j + (2*12), mixp, outputs[0].samples());
- update_pcm(j + (3*12), mixp, outputs[0].samples());
+ update_pcm(j + (0*12), mixp, stream.samples());
+ update_pcm(j + (1*12), mixp, stream.samples());
+ update_pcm(j + (2*12), mixp, stream.samples());
+ update_pcm(j + (3*12), mixp, stream.samples());
break;
}
}
}
mixp = &m_mix_buffer[0];
- for (i = 0; i < outputs[0].samples(); i++)
+ for (i = 0; i < stream.samples(); i++)
{
- outputs[0].put_int(i, *mixp++, 32768 << 2);
- outputs[1].put_int(i, *mixp++, 32768 << 2);
- outputs[2].put_int(i, *mixp++, 32768 << 2);
- outputs[3].put_int(i, *mixp++, 32768 << 2);
+ stream.put_int(0, i, *mixp++, 32768 << 2);
+ stream.put_int(1, i, *mixp++, 32768 << 2);
+ stream.put_int(2, i, *mixp++, 32768 << 2);
+ stream.put_int(3, i, *mixp++, 32768 << 2);
}
}
diff --git a/src/devices/sound/ymf271.h b/src/devices/sound/ymf271.h
index 535631d664b..489e0f87143 100644
--- a/src/devices/sound/ymf271.h
+++ b/src/devices/sound/ymf271.h
@@ -27,7 +27,7 @@ protected:
virtual void device_clock_changed() override;
// 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;
// device_rom_interface overrides
virtual void rom_bank_pre_change() override;
diff --git a/src/devices/sound/ymfm_mame.h b/src/devices/sound/ymfm_mame.h
index 740ebe51361..867534a03f5 100644
--- a/src/devices/sound/ymfm_mame.h
+++ b/src/devices/sound/ymfm_mame.h
@@ -240,9 +240,9 @@ protected:
}
// sound 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
{
- update_internal(outputs);
+ update_internal(stream);
}
// update streams
@@ -253,15 +253,15 @@ protected:
}
// internal update helper
- void update_internal(std::vector<write_stream_view> &outputs, int output_shift = 0)
+ void update_internal(sound_stream &stream, int output_shift = 0)
{
// local buffer to hold samples
constexpr int MAX_SAMPLES = 256;
typename ChipClass::output_data output[MAX_SAMPLES];
// parameters
- int const outcount = std::min(outputs.size(), std::size(output[0].data));
- int const numsamples = outputs[0].samples();
+ int const outcount = std::min(stream.output_count(), u32(std::size(output[0].data)));
+ int const numsamples = stream.samples();
// generate the FM/ADPCM stream
for (int sampindex = 0; sampindex < numsamples; sampindex += MAX_SAMPLES)
@@ -272,7 +272,7 @@ protected:
{
int eff_outnum = (outnum + output_shift) % OUTPUTS;
for (int index = 0; index < cursamples; index++)
- outputs[eff_outnum].put_int(sampindex + index, output[index].data[outnum], 32768);
+ stream.put_int(eff_outnum, sampindex + index, output[index].data[outnum], 32768);
}
}
}
@@ -302,12 +302,12 @@ public:
protected:
// sound 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
{
// ymfm outputs FM first, then SSG, while MAME traditionally
// wants SSG streams first; to do this, we rotate the outputs
// by the number of SSG output channels
- parent::update_internal(outputs, ChipClass::SSG_OUTPUTS);
+ parent::update_internal(stream, ChipClass::SSG_OUTPUTS);
}
};
diff --git a/src/devices/sound/ymopl.cpp b/src/devices/sound/ymopl.cpp
index 92e9eb99928..e6c1c588734 100644
--- a/src/devices/sound/ymopl.cpp
+++ b/src/devices/sound/ymopl.cpp
@@ -174,10 +174,10 @@ void ymf278b_device::ymfm_external_write(ymfm::access_class type, uint32_t offse
// default address space
//-------------------------------------------------
-void ymf278b_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void ymf278b_device::sound_stream_update(sound_stream &stream)
{
// rotate the outputs so that the DO2 outputs are first
- parent::update_internal(outputs, 2);
+ parent::update_internal(stream, 2);
}
diff --git a/src/devices/sound/ymopl.h b/src/devices/sound/ymopl.h
index f0f44e9b5ac..a3831364175 100644
--- a/src/devices/sound/ymopl.h
+++ b/src/devices/sound/ymopl.h
@@ -109,7 +109,7 @@ protected:
virtual void rom_bank_pre_change() override;
// sound 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;
private:
// ADPCM read/write callbacks
diff --git a/src/devices/sound/ymz280b.cpp b/src/devices/sound/ymz280b.cpp
index 8eced2f7fa8..6873048624f 100644
--- a/src/devices/sound/ymz280b.cpp
+++ b/src/devices/sound/ymz280b.cpp
@@ -417,16 +417,10 @@ int ymz280b_device::generate_pcm16(YMZ280BVoice *voice, s16 *buffer, int samples
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void ymz280b_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void ymz280b_device::sound_stream_update(sound_stream &stream)
{
- auto &lacc = outputs[0];
- auto &racc = outputs[1];
int v;
- /* clear out the accumulator */
- lacc.fill(0);
- racc.fill(0);
-
/* loop over voices */
for (v = 0; v < 8; v++)
{
@@ -437,7 +431,7 @@ void ymz280b_device::sound_stream_update(sound_stream &stream, std::vector<read_
s32 sampindex = 0;
u32 new_samples, samples_left;
u32 final_pos;
- int remaining = lacc.samples();
+ int remaining = stream.samples();
int lvol = voice->output_left;
int rvol = voice->output_right;
@@ -454,8 +448,8 @@ void ymz280b_device::sound_stream_update(sound_stream &stream, std::vector<read_
while (remaining > 0 && voice->output_pos < FRAC_ONE)
{
int interp_sample = ((s32(prev) * (FRAC_ONE - voice->output_pos)) + (s32(curr) * voice->output_pos)) >> FRAC_BITS;
- lacc.add_int(sampindex, interp_sample * lvol / 2, 32768 * 256);
- racc.add_int(sampindex, interp_sample * rvol / 2, 32768 * 256);
+ stream.add_int(0, sampindex, interp_sample * lvol / 2, 32768 * 256);
+ stream.add_int(1, sampindex, interp_sample * rvol / 2, 32768 * 256);
sampindex++;
voice->output_pos += voice->output_step;
remaining--;
@@ -519,8 +513,8 @@ void ymz280b_device::sound_stream_update(sound_stream &stream, std::vector<read_
while (remaining > 0 && voice->output_pos < FRAC_ONE)
{
int interp_sample = ((s32(prev) * (FRAC_ONE - voice->output_pos)) + (s32(curr) * voice->output_pos)) >> FRAC_BITS;
- lacc.add_int(sampindex, interp_sample * lvol / 2, 32768 * 256);
- racc.add_int(sampindex, interp_sample * rvol / 2, 32768 * 256);
+ stream.add_int(0, sampindex, interp_sample * lvol / 2, 32768 * 256);
+ stream.add_int(1, sampindex, interp_sample * rvol / 2, 32768 * 256);
sampindex++;
voice->output_pos += voice->output_step;
remaining--;
diff --git a/src/devices/sound/ymz280b.h b/src/devices/sound/ymz280b.h
index 1d6f95b1b17..a5c3d754ac9 100644
--- a/src/devices/sound/ymz280b.h
+++ b/src/devices/sound/ymz280b.h
@@ -35,7 +35,7 @@ protected:
virtual void device_clock_changed() override;
// 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;
// device_rom_interface overrides
virtual void rom_bank_pre_change() override;
diff --git a/src/devices/sound/ymz770.cpp b/src/devices/sound/ymz770.cpp
index 9c3abac4a17..f175cac853d 100644
--- a/src/devices/sound/ymz770.cpp
+++ b/src/devices/sound/ymz770.cpp
@@ -182,12 +182,9 @@ void ymz770_device::device_reset()
// our sound stream
//-------------------------------------------------
-void ymz770_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void ymz770_device::sound_stream_update(sound_stream &stream)
{
- auto &outL = outputs[0];
- auto &outR = outputs[1];
-
- for (int i = 0; i < outL.samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
sequencer();
@@ -280,8 +277,8 @@ retry:
}
if (m_mute)
mixr = mixl = 0;
- outL.put_int(i, mixl, 32768);
- outR.put_int(i, mixr, 32768);
+ stream.put_int(0, i, mixl, 32768);
+ stream.put_int(1, i, mixr, 32768);
}
}
diff --git a/src/devices/sound/ymz770.h b/src/devices/sound/ymz770.h
index f9bf1eab823..70b110029b9 100644
--- a/src/devices/sound/ymz770.h
+++ b/src/devices/sound/ymz770.h
@@ -33,7 +33,7 @@ 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 void internal_reg_write(uint8_t reg, uint8_t data);
virtual uint32_t get_phrase_offs(int phrase) { return m_rom[(4 * phrase) + 1] << 16 | m_rom[(4 * phrase) + 2] << 8 | m_rom[(4 * phrase) + 3]; }
diff --git a/src/devices/sound/zsg2.cpp b/src/devices/sound/zsg2.cpp
index 786afbd475e..c1a93d874ca 100644
--- a/src/devices/sound/zsg2.cpp
+++ b/src/devices/sound/zsg2.cpp
@@ -283,9 +283,9 @@ void zsg2_device::filter_samples(zchan *ch)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void zsg2_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void zsg2_device::sound_stream_update(sound_stream &stream)
{
- for (int i = 0; i < outputs[0].samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
int32_t mix[4] = {};
@@ -355,7 +355,7 @@ void zsg2_device::sound_stream_update(sound_stream &stream, std::vector<read_str
}
for (int output = 0; output < 4; output++)
- outputs[output].put_int_clamp(i, mix[output], 32768);
+ stream.put_int_clamp(output, i, mix[output], 32768);
}
m_sample_count++;
}
diff --git a/src/devices/sound/zsg2.h b/src/devices/sound/zsg2.h
index 91a06e27a2e..0595208a142 100644
--- a/src/devices/sound/zsg2.h
+++ b/src/devices/sound/zsg2.h
@@ -29,7 +29,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;
private:
const uint16_t STATUS_ACTIVE = 0x8000;
diff --git a/src/devices/video/315_5124.cpp b/src/devices/video/315_5124.cpp
index 8bfef88e451..3d4f2817ffd 100644
--- a/src/devices/video/315_5124.cpp
+++ b/src/devices/video/315_5124.cpp
@@ -257,7 +257,7 @@ sega315_5124_device::sega315_5124_device(const machine_config &mconfig, device_t
: device_t(mconfig, type, tag, owner, clock)
, device_memory_interface(mconfig, *this)
, device_video_interface(mconfig, *this)
- , device_mixer_interface(mconfig, *this, 2)
+ , device_mixer_interface(mconfig, *this)
, m_hcounter_divide(1)
, m_cram_size(cram_size)
, m_line_timing(line_timing)
@@ -2094,7 +2094,7 @@ void sega315_5124_device::device_add_mconfig(machine_config &config)
{
PALETTE(config, m_palette_lut, FUNC(sega315_5124_device::sega315_5124_palette), SEGA315_5124_PALETTE_SIZE);
- SEGAPSG(config, m_snsnd, DERIVED_CLOCK(1, 3)).add_route(ALL_OUTPUTS, *this, 1.0, AUTO_ALLOC_INPUT, 0);
+ SEGAPSG(config, m_snsnd, DERIVED_CLOCK(1, 3)).add_route(ALL_OUTPUTS, *this, 1.0, 0);
}
void sega315_5246_device::device_add_mconfig(machine_config &config)
@@ -2121,8 +2121,8 @@ void sega315_5377_device::device_add_mconfig(machine_config &config)
m_palette_lut->set_init(FUNC(sega315_5377_device::sega315_5377_palette));
GAMEGEAR(config.replace(), m_snsnd, DERIVED_CLOCK(1, 3));
- m_snsnd->add_route(0, *this, 1.0, AUTO_ALLOC_INPUT, 0);
- m_snsnd->add_route(1, *this, 1.0, AUTO_ALLOC_INPUT, 1);
+ m_snsnd->add_route(0, *this, 1.0, 0);
+ m_snsnd->add_route(1, *this, 1.0, 1);
}
//-------------------------------------------------
diff --git a/src/devices/video/315_5313.cpp b/src/devices/video/315_5313.cpp
index f48468963be..86c3436de01 100644
--- a/src/devices/video/315_5313.cpp
+++ b/src/devices/video/315_5313.cpp
@@ -245,7 +245,7 @@ void sega315_5313_device::device_add_mconfig(machine_config &config)
{
sega315_5313_mode4_device::device_add_mconfig(config);
- SEGAPSG(config.replace(), m_snsnd, DERIVED_CLOCK(1, 15)).add_route(ALL_OUTPUTS, *this, 0.5, AUTO_ALLOC_INPUT, 0);
+ SEGAPSG(config.replace(), m_snsnd, DERIVED_CLOCK(1, 15)).add_route(ALL_OUTPUTS, *this, 0.5, 0);
PALETTE(config, m_gfx_palette, palette_device::BLACK).set_entries(PALETTE_PER_FRAME);
PALETTE(config, m_gfx_palette_shadow, palette_device::BLACK).set_entries(PALETTE_PER_FRAME);
diff --git a/src/devices/video/ef9345.cpp b/src/devices/video/ef9345.cpp
index 16436fe72f4..279feb0d030 100644
--- a/src/devices/video/ef9345.cpp
+++ b/src/devices/video/ef9345.cpp
@@ -352,25 +352,25 @@ uint8_t ef9345_device::get_dial(uint8_t x, uint8_t attrib)
void ef9345_device::zoom(uint8_t *pix, uint16_t n)
{
uint8_t i, j;
- if ((n & 0x0a) == 0)
- for(i = 0; i < 80; i += 8) // 1, 4, 5
+ if ((n & 0x0a) == 0) // n = 1, 4, 5 (left side)
+ for(i = 0; i < 80; i += 8)
for(j = 7; j > 0; j--)
pix[i + j] = pix[i + j / 2];
- if ((n & 0x05) == 0)
- for(i = 0; i < 80; i += 8) // 2, 8, 10
+ if ((n & 0x05) == 0) // n = 2, 8, 10 (right side)
+ for(i = 0; i < 80; i += 8)
for(j =0 ; j < 7; j++)
pix[i + j] = pix[i + 4 + j / 2];
- if ((n & 0x0c) == 0)
- for(i = 0; i < 8; i++) // 1, 2, 3
+ if ((n & 0x0c) == 0) // n = 1, 2, 3 (top side)
+ for(i = 0; i < 8; i++)
for(j = 9; j > 0; j--)
- pix[i + 8 * j] = pix[i + 8 * (j / 2)];
+ pix[i + 8 * j] = pix[i + 8 * ((j-1) / 2)];
- if ((n & 0x03) == 0)
- for(i = 0; i < 8; i++) // 4, 8, 12
+ if ((n & 0x03) == 0) // n = 4, 8, 12 (bottom side)
+ for(i = 0; i < 8; i++)
for(j = 0; j < 9; j++)
- pix[i + 8 * j] = pix[i + 40 + 8 * (j / 2)];
+ pix[i + 8 * j] = pix[i + 32 + 8 * ((j+1) / 2)];
}
diff --git a/src/devices/video/i8244.cpp b/src/devices/video/i8244.cpp
index 3a1fb8c696f..b92b7ce9c56 100644
--- a/src/devices/video/i8244.cpp
+++ b/src/devices/video/i8244.cpp
@@ -769,16 +769,16 @@ u32 i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, con
SOUND
***************************************************************************/
-void i8244_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void i8244_device::sound_stream_update(sound_stream &stream)
{
u8 volume = m_vdc.s.sound & 0xf;
- stream_buffer::sample_t sample_on = (m_sh_output & m_vdc.s.sound >> 7) * 0.5;
+ sound_stream::sample_t sample_on = (m_sh_output & m_vdc.s.sound >> 7) * 0.5;
- for (int i = 0; i < outputs[0].samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
// clock duty cycle
m_sh_duty = (m_sh_duty + 1) & 0xf;
- outputs[0].put(i, (m_sh_duty < volume) ? sample_on : 0.0);
+ stream.put(0, i, (m_sh_duty < volume) ? sample_on : 0.0);
}
}
diff --git a/src/devices/video/i8244.h b/src/devices/video/i8244.h
index 5b631e9b2b5..a231eff3030 100644
--- a/src/devices/video/i8244.h
+++ b/src/devices/video/i8244.h
@@ -112,7 +112,7 @@ protected:
virtual const tiny_rom_entry *device_rom_region() const override ATTR_COLD;
// device_sound_interface 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;
TIMER_CALLBACK_MEMBER(hblank_start);
TIMER_CALLBACK_MEMBER(vblank_start);
diff --git a/src/emu/audio_effects/aeffect.cpp b/src/emu/audio_effects/aeffect.cpp
new file mode 100644
index 00000000000..dcff278099f
--- /dev/null
+++ b/src/emu/audio_effects/aeffect.cpp
@@ -0,0 +1,46 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+
+#include "emu.h"
+#include "aeffect.h"
+#include "filter.h"
+#include "compressor.h"
+#include "reverb.h"
+#include "eq.h"
+
+const char *const audio_effect::effect_names[COUNT] = {
+ "Filters",
+ "Compressor",
+ "Reverb",
+ "Equalizer"
+};
+
+audio_effect *audio_effect::create(int type, u32 sample_rate, audio_effect *def)
+{
+ switch(type) {
+ case FILTER: return new audio_effect_filter (sample_rate, def);
+ case COMPRESSOR: return new audio_effect_compressor(sample_rate, def);
+ case REVERB: return new audio_effect_reverb (sample_rate, def);
+ case EQ: return new audio_effect_eq (sample_rate, def);
+ }
+ return nullptr;
+}
+
+
+void audio_effect::copy(const emu::detail::output_buffer_flat<sample_t> &src, emu::detail::output_buffer_flat<sample_t> &dest) const
+{
+ u32 samples = src.available_samples();
+ dest.prepare_space(samples);
+ u32 channels = src.channels();
+ for(u32 channel = 0; channel != channels; channel++) {
+ const sample_t *srcd = src.ptrs(channel, 0);
+ sample_t *destd = dest.ptrw(channel, 0);
+ std::copy(srcd, srcd + samples, destd);
+ }
+ dest.commit(samples);
+}
+
+u32 audio_effect::history_size() const
+{
+ return 0;
+}
diff --git a/src/emu/audio_effects/aeffect.h b/src/emu/audio_effects/aeffect.h
new file mode 100644
index 00000000000..72e6279f1e6
--- /dev/null
+++ b/src/emu/audio_effects/aeffect.h
@@ -0,0 +1,43 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+
+#pragma once
+
+#ifndef MAME_EMU_AUDIO_EFFECTS_AEFFECT_H
+#define MAME_EMU_AUDIO_EFFECTS_AEFFECT_H
+
+class audio_effect
+{
+public:
+ using sample_t = sound_stream::sample_t;
+
+ enum {
+ FILTER,
+ COMPRESSOR,
+ REVERB,
+ EQ,
+ COUNT
+ };
+
+ static const char *const effect_names[COUNT];
+
+ static audio_effect *create(int type, u32 sample_rate, audio_effect *def = nullptr);
+
+ audio_effect(u32 sample_rate, audio_effect *def) : m_default(def), m_sample_rate(sample_rate) {}
+ virtual ~audio_effect() = default;
+
+ void copy(const emu::detail::output_buffer_flat<sample_t> &src, emu::detail::output_buffer_flat<sample_t> &dest) const;
+
+ virtual int type() const = 0;
+ virtual u32 history_size() const;
+ virtual void apply(const emu::detail::output_buffer_flat<sample_t> &src, emu::detail::output_buffer_flat<sample_t> &dest) = 0;
+ virtual void config_load(util::xml::data_node const *ef_node) = 0;
+ virtual void config_save(util::xml::data_node *ef_node) const = 0;
+ virtual void default_changed() = 0;
+
+protected:
+ audio_effect *m_default;
+ u32 m_sample_rate;
+};
+
+#endif
diff --git a/src/emu/audio_effects/compressor.cpp b/src/emu/audio_effects/compressor.cpp
new file mode 100644
index 00000000000..06c054a4837
--- /dev/null
+++ b/src/emu/audio_effects/compressor.cpp
@@ -0,0 +1,28 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+
+#include "emu.h"
+#include "compressor.h"
+#include "xmlfile.h"
+
+audio_effect_compressor::audio_effect_compressor(u32 sample_rate, audio_effect *def) : audio_effect(sample_rate, def)
+{
+}
+
+
+void audio_effect_compressor::config_load(util::xml::data_node const *ef_node)
+{
+}
+
+void audio_effect_compressor::config_save(util::xml::data_node *ef_node) const
+{
+}
+
+void audio_effect_compressor::default_changed()
+{
+}
+
+void audio_effect_compressor::apply(const emu::detail::output_buffer_flat<sample_t> &src, emu::detail::output_buffer_flat<sample_t> &dest)
+{
+ copy(src, dest);
+}
diff --git a/src/emu/audio_effects/compressor.h b/src/emu/audio_effects/compressor.h
new file mode 100644
index 00000000000..551212f34e5
--- /dev/null
+++ b/src/emu/audio_effects/compressor.h
@@ -0,0 +1,24 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+
+#pragma once
+
+#ifndef MAME_EMU_AUDIO_EFFECTS_COMPRESSOR_H
+#define MAME_EMU_AUDIO_EFFECTS_COMPRESSOR_H
+
+#include "aeffect.h"
+
+class audio_effect_compressor : public audio_effect
+{
+public:
+ audio_effect_compressor(u32 sample_rate, audio_effect *def);
+ virtual ~audio_effect_compressor() = default;
+
+ virtual int type() const override { return COMPRESSOR; }
+ virtual void apply(const emu::detail::output_buffer_flat<sample_t> &src, emu::detail::output_buffer_flat<sample_t> &dest) override;
+ virtual void config_load(util::xml::data_node const *ef_node) override;
+ virtual void config_save(util::xml::data_node *ef_node) const override;
+ virtual void default_changed() override;
+};
+
+#endif
diff --git a/src/emu/audio_effects/eq.cpp b/src/emu/audio_effects/eq.cpp
new file mode 100644
index 00000000000..799b2f8c9b5
--- /dev/null
+++ b/src/emu/audio_effects/eq.cpp
@@ -0,0 +1,331 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+
+#include "emu.h"
+#include "eq.h"
+#include "xmlfile.h"
+
+// This effect implements a parametric EQ using peak and shelf filters
+
+// Formulas taken from (with some fixes):
+
+// [Zölzer 2011] "DAFX: Digital Audio Effects", Udo Zölzer, Second Edition, Wiley publishing, 2011 (Tables 2.3 and 2.4)
+// [Zölzer 2008] "Digital Audio Signal Processing", Udo Zölzer, Second Edition, Wiley publishing, 2008 (Tables 5.3, 5.4 and 5.5)
+
+audio_effect_eq::audio_effect_eq(u32 sample_rate, audio_effect *def) : audio_effect(sample_rate, def)
+{
+ // Minimal init to avoid using uninitialized values when reset_*
+ // recomputes filters
+
+ for(u32 band = 0; band != BANDS; band++) {
+ m_q[band] = 0.7;
+ m_f[band] = 1000;
+ m_db[band] = 0;
+ }
+
+ reset_mode();
+ reset_low_shelf();
+ reset_high_shelf();
+ for(u32 band = 0; band != BANDS; band++) {
+ reset_q(band);
+ reset_f(band);
+ reset_db(band);
+ }
+}
+
+void audio_effect_eq::reset_mode()
+{
+ audio_effect_eq *d = static_cast<audio_effect_eq *>(m_default);
+ m_isset_mode = false;
+ m_mode = d ? d->mode() : 1;
+}
+
+void audio_effect_eq::reset_q(u32 band)
+{
+ audio_effect_eq *d = static_cast<audio_effect_eq *>(m_default);
+ m_isset_q[band] = false;
+ m_q[band] = d ? d->q(band) : 0.7;
+ build_filter(band);
+}
+
+void audio_effect_eq::reset_f(u32 band)
+{
+ static const u32 defs[BANDS] = { 80, 200, 500, 3200, 8000 };
+ audio_effect_eq *d = static_cast<audio_effect_eq *>(m_default);
+ m_isset_f[band] = false;
+ m_f[band] = d ? d->f(band) : defs[band];
+ build_filter(band);
+}
+
+void audio_effect_eq::reset_db(u32 band)
+{
+ audio_effect_eq *d = static_cast<audio_effect_eq *>(m_default);
+ m_isset_db[band] = false;
+ m_db[band] = d ? d->db(band) : 0;
+ build_filter(band);
+}
+
+void audio_effect_eq::reset_low_shelf()
+{
+ audio_effect_eq *d = static_cast<audio_effect_eq *>(m_default);
+ m_isset_low_shelf = false;
+ m_low_shelf = d ? d->low_shelf() : true;
+ build_filter(0);
+}
+
+void audio_effect_eq::reset_high_shelf()
+{
+ audio_effect_eq *d = static_cast<audio_effect_eq *>(m_default);
+ m_isset_high_shelf = false;
+ m_high_shelf = d ? d->high_shelf() : true;
+ build_filter(BANDS-1);
+}
+
+void audio_effect_eq::config_load(util::xml::data_node const *ef_node)
+{
+ if(ef_node->has_attribute("mode")) {
+ m_mode = ef_node->get_attribute_int("mode", 0);
+ m_isset_mode = true;
+ } else
+ reset_mode();
+
+ if(ef_node->has_attribute("low_shelf")) {
+ m_low_shelf = ef_node->get_attribute_int("low_shelf", 0);
+ m_isset_low_shelf = true;
+ } else
+ reset_low_shelf();
+
+ if(ef_node->has_attribute("high_shelf")) {
+ m_high_shelf = ef_node->get_attribute_int("high_shelf", 0);
+ m_isset_high_shelf = true;
+ } else
+ reset_high_shelf();
+
+ for(u32 band = 0; band != BANDS; band++) {
+ if(ef_node->has_attribute(util::string_format("q%d", band+1).c_str())) {
+ m_q[band] = ef_node->get_attribute_float(util::string_format("q%d", band+1).c_str(), 0);
+ m_isset_q[band] = true;
+ } else
+ reset_q(band);
+
+ if(ef_node->has_attribute(util::string_format("f%d", band+1).c_str())) {
+ m_f[band] = ef_node->get_attribute_float(util::string_format("f%d", band+1).c_str(), 0);
+ m_isset_f[band] = true;
+ } else
+ reset_f(band);
+
+ if(ef_node->has_attribute(util::string_format("db%d", band+1).c_str())) {
+ m_db[band] = ef_node->get_attribute_float(util::string_format("db%d", band+1).c_str(), 0);
+ m_isset_db[band] = true;
+ } else
+ reset_db(band);
+ }
+}
+
+void audio_effect_eq::config_save(util::xml::data_node *ef_node) const
+{
+ if(m_isset_mode)
+ ef_node->set_attribute_int("mode", m_mode);
+ if(m_isset_low_shelf)
+ ef_node->set_attribute_int("low_shelf", m_low_shelf);
+ if(m_isset_high_shelf)
+ ef_node->set_attribute_int("high_shelf", m_high_shelf);
+ for(u32 band = 0; band != BANDS; band++) {
+ if(m_isset_q[band])
+ ef_node->set_attribute_float(util::string_format("q%d", band+1).c_str(), m_q[band]);
+ if(m_isset_f[band])
+ ef_node->set_attribute_float(util::string_format("f%d", band+1).c_str(), m_f[band]);
+ if(m_isset_db[band])
+ ef_node->set_attribute_float(util::string_format("db%d", band+1).c_str(), m_db[band]);
+ }
+}
+
+void audio_effect_eq::default_changed()
+{
+ if(!m_default)
+ return;
+ if(!m_isset_mode)
+ reset_mode();
+ if(!m_isset_low_shelf)
+ reset_low_shelf();
+ if(!m_isset_high_shelf)
+ reset_high_shelf();
+ for(u32 band = 0; band != BANDS; band++) {
+ if(!m_isset_q[band])
+ reset_q(band);
+ if(!m_isset_f[band])
+ reset_f(band);
+ if(!m_isset_db[band])
+ reset_db(band);
+ }
+}
+
+void audio_effect_eq::set_mode(u32 mode)
+{
+ m_isset_mode = true;
+ m_mode = mode;
+}
+
+void audio_effect_eq::set_q(u32 band, float q)
+{
+ m_isset_q[band] = true;
+ m_q[band] = q;
+ build_filter(band);
+}
+
+void audio_effect_eq::set_f(u32 band, float f)
+{
+ m_isset_f[band] = true;
+ m_f[band] = f;
+ build_filter(band);
+}
+
+void audio_effect_eq::set_db(u32 band, float db)
+{
+ m_isset_db[band] = true;
+ m_db[band] = db;
+ build_filter(band);
+}
+
+void audio_effect_eq::set_low_shelf(bool active)
+{
+ m_isset_low_shelf = true;
+ m_low_shelf = active;
+ build_filter(0);
+}
+
+void audio_effect_eq::set_high_shelf(bool active)
+{
+ m_isset_high_shelf = true;
+ m_high_shelf = active;
+ build_filter(BANDS-1);
+}
+
+void audio_effect_eq::build_filter(u32 band)
+{
+ if(band == 0 && m_low_shelf) {
+ build_low_shelf(band);
+ return;
+ }
+ if(band == BANDS-1 && m_high_shelf) {
+ build_high_shelf(band);
+ return;
+ }
+ build_peak(band);
+}
+
+void audio_effect_eq::build_low_shelf(u32 band)
+{
+ auto &fi = m_filter[band];
+ if(m_db[band] == 0) {
+ fi.clear();
+ return;
+ }
+
+ float V = pow(10, abs(m_db[band])/20);
+ float K = tan(M_PI*m_f[band]/m_sample_rate);
+ float K2 = K*K;
+
+ if(m_db[band] > 0) {
+ float d = 1 + sqrt(2)*K + K2;
+ fi.m_b0 = (1 + sqrt(2*V)*K + V*K2)/d;
+ fi.m_b1 = 2*(V*K2-1)/d;
+ fi.m_b2 = (1 - sqrt(2*V)*K + V*K2)/d;
+ fi.m_a1 = 2*(K2-1)/d;
+ fi.m_a2 = (1 - sqrt(2)*K + K2)/d;
+ } else {
+ float d = 1 + sqrt(2*V)*K + V*K2;
+ fi.m_b0 = (1 + sqrt(2)*K + K2)/d;
+ fi.m_b1 = 2*(K2-1)/d;
+ fi.m_b2 = (1 - sqrt(2)*K + K2)/d;
+ fi.m_a1 = 2*(V*K2-1)/d;
+ fi.m_a2 = (1 - sqrt(2*V)*K + V*K2)/d;
+ }
+}
+
+void audio_effect_eq::build_high_shelf(u32 band)
+{
+ auto &fi = m_filter[band];
+ if(m_db[band] == 0) {
+ fi.clear();
+ return;
+ }
+
+ float V = pow(10, m_db[band]/20);
+ float K = tan(M_PI*m_f[band]/m_sample_rate);
+ float K2 = K*K;
+
+ if(m_db[band] > 0) {
+ float d = 1 + sqrt(2)*K + K2;
+ fi.m_b0 = (V + sqrt(2*V)*K + K2)/d;
+ fi.m_b1 = 2*(K2-V)/d;
+ fi.m_b2 = (V - sqrt(2*V)*K + K2)/d;
+ fi.m_a1 = 2*(K2-1)/d;
+ fi.m_a2 = (1 - sqrt(2)*K + K2)/d;
+ } else {
+ float d = 1 + sqrt(2*V)*K + V*K2;
+ fi.m_b0 = V*(1 + sqrt(2)*K + K2)/d;
+ fi.m_b1 = 2*V*(K2-1)/d;
+ fi.m_b2 = V*(1 - sqrt(2)*K + K2)/d;
+ fi.m_a1 = 2*(V*K2-1)/d;
+ fi.m_a2 = (1 - sqrt(2*V)*K + V*K2)/d;
+ }
+}
+
+void audio_effect_eq::build_peak(u32 band)
+{
+ auto &fi = m_filter[band];
+ if(m_db[band] == 0) {
+ fi.clear();
+ return;
+ }
+
+ float V = pow(10, m_db[band]/20);
+ float K = tan(M_PI*m_f[band]/m_sample_rate);
+ float K2 = K*K;
+ float Q = m_q[band];
+
+ if(m_db[band] > 0) {
+ float d = 1 + K/Q + K2;
+ fi.m_b0 = (1 + V*K/Q + K2)/d;
+ fi.m_b1 = 2*(K2-1)/d;
+ fi.m_b2 = (1 - V*K/Q + K2)/d;
+ fi.m_a1 = fi.m_b1;
+ fi.m_a2 = (1 - K/Q + K2)/d;
+ } else {
+ float d = 1 + K/(V*Q) + K2;
+ fi.m_b0 = (1 + K/Q + K2)/d;
+ fi.m_b1 = 2*(K2-1)/d;
+ fi.m_b2 = (1 - K/Q + K2)/d;
+ fi.m_a1 = fi.m_b1;
+ fi.m_a2 = (1 - K/(V*Q) + K2)/d;
+ }
+}
+
+
+void audio_effect_eq::apply(const emu::detail::output_buffer_flat<sample_t> &src, emu::detail::output_buffer_flat<sample_t> &dest)
+{
+ if(m_mode == 0) {
+ copy(src, dest);
+ return;
+ }
+
+ u32 samples = src.available_samples();
+ dest.prepare_space(samples);
+ u32 channels = src.channels();
+ if(m_history.empty())
+ m_history.resize(channels);
+
+ for(u32 channel = 0; channel != channels; channel++) {
+ const sample_t *srcd = src.ptrs(channel, 0);
+ sample_t *destd = dest.ptrw(channel, 0);
+ for(u32 sample = 0; sample != samples; sample++) {
+ m_history[channel][0].push(*srcd++);
+ for(u32 band = 0; band != BANDS; band++)
+ m_filter[band].apply(m_history[channel][band], m_history[channel][band+1]);
+ *destd++ = m_history[channel][BANDS].m_v0;
+ }
+ }
+
+ dest.commit(samples);
+}
diff --git a/src/emu/audio_effects/eq.h b/src/emu/audio_effects/eq.h
new file mode 100644
index 00000000000..919d5292837
--- /dev/null
+++ b/src/emu/audio_effects/eq.h
@@ -0,0 +1,84 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+
+#pragma once
+
+#ifndef MAME_EMU_AUDIO_EFFECTS_EQ_H
+#define MAME_EMU_AUDIO_EFFECTS_EQ_H
+
+#include "aeffect.h"
+
+class audio_effect_eq : public audio_effect
+{
+public:
+ enum { BANDS = 5 };
+
+ audio_effect_eq(u32 sample_rate, audio_effect *def);
+ virtual ~audio_effect_eq() = default;
+
+ virtual int type() const override { return EQ; }
+ virtual void apply(const emu::detail::output_buffer_flat<sample_t> &src, emu::detail::output_buffer_flat<sample_t> &dest) override;
+ virtual void config_load(util::xml::data_node const *ef_node) override;
+ virtual void config_save(util::xml::data_node *ef_node) const override;
+ virtual void default_changed() override;
+
+ void set_mode(u32 mode);
+ void set_q(u32 band, float q);
+ void set_f(u32 band, float f);
+ void set_db(u32 band, float db);
+ void set_low_shelf(bool active);
+ void set_high_shelf(bool active);
+
+ u32 mode() const { return m_mode; }
+ float q(u32 band) const { return m_q[band]; }
+ float f(u32 band) const { return m_f[band]; }
+ float db(u32 band) const { return m_db[band]; }
+ bool low_shelf() const { return m_low_shelf; }
+ bool high_shelf() const { return m_high_shelf; }
+
+ bool isset_mode() const { return m_isset_mode; }
+ bool isset_q(u32 band) const { return m_isset_q[band]; }
+ bool isset_f(u32 band) const { return m_isset_f[band]; }
+ bool isset_db(u32 band) const { return m_isset_db[band]; }
+ bool isset_low_shelf() const { return m_isset_low_shelf; }
+ bool isset_high_shelf() const { return m_isset_high_shelf; }
+
+ void reset_mode();
+ void reset_q(u32 band);
+ void reset_f(u32 band);
+ void reset_db(u32 band);
+ void reset_low_shelf();
+ void reset_high_shelf();
+
+private:
+ struct history {
+ float m_v0, m_v1, m_v2;
+ history() { m_v0 = m_v1 = m_v2 = 0; }
+ void push(float v) { m_v2 = m_v1; m_v1 = m_v0; m_v0 = v; }
+ };
+
+ struct filter {
+ float m_a1, m_a2, m_b0, m_b1, m_b2;
+ void clear() { m_a1 = 0; m_a2 = 0; m_b0 = 1; m_b1 = 0; m_b2 = 0; }
+ void apply(history &x, history &y) const {
+ y.push(m_b0 * x.m_v0 + m_b1 * x.m_v1 + m_b2 * x.m_v2 - m_a1 * y.m_v0 - m_a2 * y.m_v1);
+ }
+ };
+
+ u32 m_mode;
+ float m_q[BANDS], m_f[BANDS], m_db[BANDS];
+ bool m_low_shelf, m_high_shelf;
+ std::array<filter, BANDS> m_filter;
+ std::vector<std::array<history, BANDS+1>> m_history;
+
+ bool m_isset_mode, m_isset_low_shelf, m_isset_high_shelf;
+ bool m_isset_q[BANDS], m_isset_f[BANDS], m_isset_db[BANDS];
+
+ void build_filter(u32 band);
+
+ void build_low_shelf(u32 band);
+ void build_high_shelf(u32 band);
+ void build_peak(u32 band);
+};
+
+#endif
diff --git a/src/emu/audio_effects/filter.cpp b/src/emu/audio_effects/filter.cpp
new file mode 100644
index 00000000000..70cf7ddc967
--- /dev/null
+++ b/src/emu/audio_effects/filter.cpp
@@ -0,0 +1,259 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+
+#include "emu.h"
+#include "filter.h"
+#include "xmlfile.h"
+
+// This effect implements a couple of very standard biquad filters,
+// one lowpass and one highpass.
+
+// Formulas taken from:
+
+// [Zölzer 2011] "DAFX: Digital Audio Effects", Udo Zölzer, Second Edition, Wiley publishing, 2011 (Table 2.2)
+
+
+audio_effect_filter::audio_effect_filter(u32 sample_rate, audio_effect *def) : audio_effect(sample_rate, def)
+{
+ // Minimal init to avoid using uninitialized values when reset_*
+ // recomputes filters
+ m_fl = m_fh = 1000;
+ m_ql = m_qh = 0.7;
+
+ reset_lowpass_active();
+ reset_highpass_active();
+ reset_fl();
+ reset_fh();
+ reset_ql();
+ reset_qh();
+}
+
+void audio_effect_filter::reset_lowpass_active()
+{
+ audio_effect_filter *d = static_cast<audio_effect_filter *>(m_default);
+ m_isset_lowpass_active = false;
+ m_lowpass_active = d ? d->lowpass_active() : false;
+ build_lowpass();
+}
+
+void audio_effect_filter::reset_highpass_active()
+{
+ audio_effect_filter *d = static_cast<audio_effect_filter *>(m_default);
+ m_isset_highpass_active = false;
+ m_highpass_active = d ? d->highpass_active() : true;
+ build_highpass();
+}
+
+void audio_effect_filter::reset_fl()
+{
+ audio_effect_filter *d = static_cast<audio_effect_filter *>(m_default);
+ m_isset_fl = false;
+ m_fl = d ? d->fl() : 8000;
+ build_lowpass();
+}
+
+void audio_effect_filter::reset_ql()
+{
+ audio_effect_filter *d = static_cast<audio_effect_filter *>(m_default);
+ m_isset_ql = false;
+ m_ql = d ? d->ql() : 0.7;
+ build_lowpass();
+}
+
+void audio_effect_filter::reset_fh()
+{
+ audio_effect_filter *d = static_cast<audio_effect_filter *>(m_default);
+ m_isset_fh = false;
+ m_fh = d ? d->fh() : 40;
+ build_highpass();
+}
+
+void audio_effect_filter::reset_qh()
+{
+ audio_effect_filter *d = static_cast<audio_effect_filter *>(m_default);
+ m_isset_qh = false;
+ m_qh = d ? d->qh() : 0.7;
+ build_highpass();
+}
+
+void audio_effect_filter::config_load(util::xml::data_node const *ef_node)
+{
+ if(ef_node->has_attribute("lowpass_active")) {
+ m_lowpass_active = ef_node->get_attribute_int("lowpass_active", 0);
+ m_isset_lowpass_active = true;
+ } else
+ reset_lowpass_active();
+
+ if(ef_node->has_attribute("fl")) {
+ m_fl = ef_node->get_attribute_float("fl", 0);
+ m_isset_fl = true;
+ } else
+ reset_fl();
+
+ if(ef_node->has_attribute("ql")) {
+ m_ql = ef_node->get_attribute_float("ql", 0);
+ m_isset_ql = true;
+ } else
+ reset_ql();
+
+ if(ef_node->has_attribute("highpass_active")) {
+ m_highpass_active = ef_node->get_attribute_int("highpass_active", 0);
+ m_isset_highpass_active = true;
+ } else
+ reset_highpass_active();
+
+ if(ef_node->has_attribute("fh")) {
+ m_fh = ef_node->get_attribute_float("fh", 0);
+ m_isset_fh = true;
+ } else
+ reset_fh();
+
+ if(ef_node->has_attribute("qh")) {
+ m_qh = ef_node->get_attribute_float("qh", 0);
+ m_isset_qh = true;
+ } else
+ reset_qh();
+}
+
+void audio_effect_filter::config_save(util::xml::data_node *ef_node) const
+{
+ if(m_isset_lowpass_active)
+ ef_node->set_attribute_int("lowpass_active", m_lowpass_active);
+ if(m_isset_fl)
+ ef_node->set_attribute_float("fl", m_fl);
+ if(m_isset_ql)
+ ef_node->set_attribute_float("ql", m_ql);
+ if(m_isset_highpass_active)
+ ef_node->set_attribute_int("highpass_active", m_highpass_active);
+ if(m_isset_fh)
+ ef_node->set_attribute_float("fh", m_fh);
+ if(m_isset_qh)
+ ef_node->set_attribute_float("qh", m_qh);
+}
+
+void audio_effect_filter::default_changed()
+{
+ if(!m_isset_lowpass_active)
+ reset_lowpass_active();
+ if(!m_isset_highpass_active)
+ reset_highpass_active();
+ if(!m_isset_fl)
+ reset_fl();
+ if(!m_isset_fh)
+ reset_fh();
+ if(!m_isset_ql)
+ reset_ql();
+ if(!m_isset_qh)
+ reset_qh();
+}
+
+void audio_effect_filter::apply(const emu::detail::output_buffer_flat<sample_t> &src, emu::detail::output_buffer_flat<sample_t> &dest)
+{
+ if(!m_lowpass_active && !m_highpass_active) {
+ copy(src, dest);
+ return;
+ }
+
+ u32 samples = src.available_samples();
+ dest.prepare_space(samples);
+ u32 channels = src.channels();
+ if(m_history.empty())
+ m_history.resize(channels);
+
+ for(u32 channel = 0; channel != channels; channel++) {
+ const sample_t *srcd = src.ptrs(channel, 0);
+ sample_t *destd = dest.ptrw(channel, 0);
+ for(u32 sample = 0; sample != samples; sample++) {
+ m_history[channel][0].push(*srcd++);
+ m_filter[0].apply(m_history[channel][0], m_history[channel][1]);
+ m_filter[1].apply(m_history[channel][1], m_history[channel][2]);
+ *destd++ = m_history[channel][2].m_v0;
+ }
+ }
+
+ dest.commit(samples);
+
+}
+
+void audio_effect_filter::set_lowpass_active(bool active)
+{
+ m_isset_lowpass_active = true;
+ m_lowpass_active = active;
+ build_lowpass();
+}
+
+void audio_effect_filter::set_highpass_active(bool active)
+{
+ m_isset_highpass_active = true;
+ m_highpass_active = active;
+ build_highpass();
+}
+
+void audio_effect_filter::set_fl(float f)
+{
+ m_isset_fl = true;
+ m_fl = f;
+ build_lowpass();
+}
+
+void audio_effect_filter::set_fh(float f)
+{
+ m_isset_fh = true;
+ m_fh = f;
+ build_highpass();
+}
+
+void audio_effect_filter::set_ql(float q)
+{
+ m_isset_ql = true;
+ m_ql = q;
+ build_lowpass();
+}
+
+void audio_effect_filter::set_qh(float q)
+{
+ m_isset_qh = true;
+ m_qh = q;
+ build_highpass();
+}
+
+void audio_effect_filter::build_highpass()
+{
+ auto &fi = m_filter[0];
+ if(!m_highpass_active) {
+ fi.clear();
+ return;
+ }
+
+ float K = tan(M_PI*m_fh/m_sample_rate);
+ float K2 = K*K;
+ float Q = m_qh;
+
+ float d = K2*Q + K + Q;
+ fi.m_b0 = Q/d;
+ fi.m_b1 = -2*Q/d;
+ fi.m_b2 = fi.m_b0;
+ fi.m_a1 = 2*Q*(K2-1)/d;
+ fi.m_a2 = (K2*Q - K + Q)/d;
+}
+
+void audio_effect_filter::build_lowpass()
+{
+ auto &fi = m_filter[1];
+ if(!m_lowpass_active) {
+ fi.clear();
+ return;
+ }
+
+ float K = tan(M_PI*m_fl/m_sample_rate);
+ float K2 = K*K;
+ float Q = m_ql;
+
+ float d = K2*Q + K + Q;
+ fi.m_b0 = K2*Q/d;
+ fi.m_b1 = 2*K2*Q /d;
+ fi.m_b2 = fi.m_b0;
+ fi.m_a1 = 2*Q*(K2-1)/d;
+ fi.m_a2 = (K2*Q - K + Q)/d;
+}
+
diff --git a/src/emu/audio_effects/filter.h b/src/emu/audio_effects/filter.h
new file mode 100644
index 00000000000..13463bd6b4b
--- /dev/null
+++ b/src/emu/audio_effects/filter.h
@@ -0,0 +1,78 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+
+#pragma once
+
+#ifndef MAME_EMU_AUDIO_EFFECTS_FILTER_H
+#define MAME_EMU_AUDIO_EFFECTS_FILTER_H
+
+#include "aeffect.h"
+
+class audio_effect_filter : public audio_effect
+{
+public:
+ audio_effect_filter(u32 sample_rate, audio_effect *def);
+ virtual ~audio_effect_filter() = default;
+
+ virtual int type() const override { return FILTER; }
+ virtual void apply(const emu::detail::output_buffer_flat<sample_t> &src, emu::detail::output_buffer_flat<sample_t> &dest) override;
+ virtual void config_load(util::xml::data_node const *ef_node) override;
+ virtual void config_save(util::xml::data_node *ef_node) const override;
+ virtual void default_changed() override;
+
+ void set_lowpass_active(bool active);
+ void set_highpass_active(bool active);
+ void set_fl(float f);
+ void set_fh(float f);
+ void set_ql(float q);
+ void set_qh(float q);
+
+ bool lowpass_active() const { return m_lowpass_active; }
+ bool highpass_active() const { return m_highpass_active; }
+ float fl() const { return m_fl; }
+ float fh() const { return m_fh; }
+ float ql() const { return m_ql; }
+ float qh() const { return m_qh; }
+
+ bool isset_lowpass_active() const { return m_isset_lowpass_active; }
+ bool isset_highpass_active() const { return m_isset_highpass_active; }
+ bool isset_fl() const { return m_isset_fl; }
+ bool isset_fh() const { return m_isset_fh; }
+ bool isset_ql() const { return m_isset_ql; }
+ bool isset_qh() const { return m_isset_qh; }
+
+ void reset_lowpass_active();
+ void reset_highpass_active();
+ void reset_fl();
+ void reset_fh();
+ void reset_ql();
+ void reset_qh();
+
+private:
+ struct history {
+ float m_v0, m_v1, m_v2;
+ history() { m_v0 = m_v1 = m_v2 = 0; }
+ void push(float v) { m_v2 = m_v1; m_v1 = m_v0; m_v0 = v; }
+ };
+
+ struct filter {
+ float m_a1, m_a2, m_b0, m_b1, m_b2;
+ void clear() { m_a1 = 0; m_a2 = 0; m_b0 = 1; m_b1 = 0; m_b2 = 0; }
+ void apply(history &x, history &y) const {
+ y.push(m_b0 * x.m_v0 + m_b1 * x.m_v1 + m_b2 * x.m_v2 - m_a1 * y.m_v0 - m_a2 * y.m_v1);
+ }
+ };
+
+ bool m_isset_lowpass_active, m_isset_highpass_active;
+ bool m_isset_fl, m_isset_fh, m_isset_ql, m_isset_qh;
+
+ bool m_lowpass_active, m_highpass_active;
+ float m_fl, m_fh, m_ql, m_qh;
+ std::array<filter, 2> m_filter;
+ std::vector<std::array<history, 3>> m_history;
+
+ void build_lowpass();
+ void build_highpass();
+};
+
+#endif
diff --git a/src/emu/audio_effects/reverb.cpp b/src/emu/audio_effects/reverb.cpp
new file mode 100644
index 00000000000..c7f231a9d92
--- /dev/null
+++ b/src/emu/audio_effects/reverb.cpp
@@ -0,0 +1,28 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+
+#include "emu.h"
+#include "reverb.h"
+#include "xmlfile.h"
+
+audio_effect_reverb::audio_effect_reverb(u32 sample_rate, audio_effect *def) : audio_effect(sample_rate, def)
+{
+}
+
+
+void audio_effect_reverb::config_load(util::xml::data_node const *ef_node)
+{
+}
+
+void audio_effect_reverb::config_save(util::xml::data_node *ef_node) const
+{
+}
+
+void audio_effect_reverb::default_changed()
+{
+}
+
+void audio_effect_reverb::apply(const emu::detail::output_buffer_flat<sample_t> &src, emu::detail::output_buffer_flat<sample_t> &dest)
+{
+ copy(src, dest);
+}
diff --git a/src/emu/audio_effects/reverb.h b/src/emu/audio_effects/reverb.h
new file mode 100644
index 00000000000..36aaabb697b
--- /dev/null
+++ b/src/emu/audio_effects/reverb.h
@@ -0,0 +1,24 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+
+#pragma once
+
+#ifndef MAME_EMU_AUDIO_EFFECTS_REVERB_H
+#define MAME_EMU_AUDIO_EFFECTS_REVERB_H
+
+#include "aeffect.h"
+
+class audio_effect_reverb : public audio_effect
+{
+public:
+ audio_effect_reverb(u32 sample_rate, audio_effect *def);
+ virtual ~audio_effect_reverb() = default;
+
+ virtual int type() const override { return REVERB; }
+ virtual void apply(const emu::detail::output_buffer_flat<sample_t> &src, emu::detail::output_buffer_flat<sample_t> &dest) override;
+ virtual void config_load(util::xml::data_node const *ef_node) override;
+ virtual void config_save(util::xml::data_node *ef_node) const override;
+ virtual void default_changed() override;
+};
+
+#endif
diff --git a/src/emu/device.cpp b/src/emu/device.cpp
index 7239e798be2..1a66094bde9 100644
--- a/src/emu/device.cpp
+++ b/src/emu/device.cpp
@@ -545,7 +545,7 @@ void device_t::start()
state_registrations = machine().save().registration_count() - state_registrations;
device_execute_interface *exec;
device_sound_interface *sound;
- if (state_registrations == 0 && (interface(exec) || interface(sound)) && type() != SPEAKER)
+ if (state_registrations == 0 && (interface(exec) || interface(sound)) && type() != SPEAKER && type() != MICROPHONE)
{
logerror("Device did not register any state to save!\n");
if ((machine().system().flags & MACHINE_SUPPORTS_SAVE) != 0)
diff --git a/src/emu/disound.cpp b/src/emu/disound.cpp
index 83d2c2bf084..57fd6a9c030 100644
--- a/src/emu/disound.cpp
+++ b/src/emu/disound.cpp
@@ -23,9 +23,11 @@
device_sound_interface::device_sound_interface(const machine_config &mconfig, device_t &device) :
device_interface(device, "sound"),
- m_outputs(0),
- m_auto_allocated_inputs(0),
- m_specified_inputs_mask(0)
+ m_sound_requested_inputs_mask(0),
+ m_sound_requested_outputs_mask(0),
+ m_sound_requested_inputs(0),
+ m_sound_requested_outputs(0),
+ m_sound_hook(false)
{
}
@@ -43,25 +45,20 @@ device_sound_interface::~device_sound_interface()
// add_route - send sound output to a consumer
//-------------------------------------------------
-device_sound_interface &device_sound_interface::add_route(u32 output, const char *target, double gain, u32 input, u32 mixoutput)
+device_sound_interface &device_sound_interface::add_route(u32 output, const char *target, double gain, u32 channel)
{
- return add_route(output, device().mconfig().current_device(), target, gain, input, mixoutput);
+ return add_route(output, device().mconfig().current_device(), target, gain, channel);
}
-device_sound_interface &device_sound_interface::add_route(u32 output, device_sound_interface &target, double gain, u32 input, u32 mixoutput)
+device_sound_interface &device_sound_interface::add_route(u32 output, device_sound_interface &target, double gain, u32 channel)
{
- return add_route(output, target.device(), DEVICE_SELF, gain, input, mixoutput);
+ return add_route(output, target.device(), DEVICE_SELF, gain, channel);
}
-device_sound_interface &device_sound_interface::add_route(u32 output, speaker_device &target, double gain, u32 input, u32 mixoutput)
-{
- return add_route(output, target, DEVICE_SELF, gain, input, mixoutput);
-}
-
-device_sound_interface &device_sound_interface::add_route(u32 output, device_t &base, const char *target, double gain, u32 input, u32 mixoutput)
+device_sound_interface &device_sound_interface::add_route(u32 output, device_t &base, const char *target, double gain, u32 channel)
{
assert(!device().started());
- m_route_list.emplace_back(sound_route{ output, input, mixoutput, float(gain), base, target });
+ m_route_list.emplace_back(sound_route{ output, channel, float(gain), base, target, nullptr });
return *this;
}
@@ -71,45 +68,41 @@ device_sound_interface &device_sound_interface::add_route(u32 output, device_t &
// associated with this device
//-------------------------------------------------
-sound_stream *device_sound_interface::stream_alloc(int inputs, int outputs, int sample_rate)
-{
- return device().machine().sound().stream_alloc(*this, inputs, outputs, sample_rate, stream_update_delegate(&device_sound_interface::sound_stream_update, this), STREAM_DEFAULT_FLAGS);
-}
-
sound_stream *device_sound_interface::stream_alloc(int inputs, int outputs, int sample_rate, sound_stream_flags flags)
{
- return device().machine().sound().stream_alloc(*this, inputs, outputs, sample_rate, stream_update_delegate(&device_sound_interface::sound_stream_update, this), flags);
+ sound_stream *stream = device().machine().sound().stream_alloc(*this, inputs, outputs, sample_rate, stream_update_delegate(&device_sound_interface::sound_stream_update, this), flags);
+ m_sound_streams.push_back(stream);
+ return stream;
}
+
//-------------------------------------------------
// inputs - return the total number of inputs
-// for the given device
+// forthe given device
//-------------------------------------------------
int device_sound_interface::inputs() const
{
// scan the list counting streams we own and summing their inputs
int inputs = 0;
- for (auto &stream : device().machine().sound().streams())
- if (&stream->device() == &device())
- inputs += stream->input_count();
+ for(sound_stream *stream : m_sound_streams)
+ inputs += stream->input_count();
return inputs;
}
//-------------------------------------------------
// outputs - return the total number of outputs
-// for the given device
+// forthe given device
//-------------------------------------------------
int device_sound_interface::outputs() const
{
// scan the list counting streams we own and summing their outputs
int outputs = 0;
- for (auto &stream : device().machine().sound().streams())
- if (&stream->device() == &device())
- outputs += stream->output_count();
+ for(auto *stream : m_sound_streams)
+ outputs += stream->output_count();
return outputs;
}
@@ -120,24 +113,19 @@ int device_sound_interface::outputs() const
// on that stream
//-------------------------------------------------
-sound_stream *device_sound_interface::input_to_stream_input(int inputnum, int &stream_inputnum) const
+std::pair<sound_stream *, int> device_sound_interface::input_to_stream_input(int inputnum) const
{
assert(inputnum >= 0);
+ int orig_inputnum = inputnum;
- // scan the list looking for streams owned by this device
- for (auto &stream : device().machine().sound().streams())
- if (&stream->device() == &device())
- {
- if (inputnum < stream->input_count())
- {
- stream_inputnum = inputnum;
- return stream.get();
- }
- inputnum -= stream->input_count();
- }
+ // scan the list looking forstreams owned by this device
+ for(auto *stream : m_sound_streams) {
+ if(inputnum < stream->input_count())
+ return std::make_pair(stream, inputnum);
+ inputnum -= stream->input_count();
+ }
- // not found
- return nullptr;
+ fatalerror("Requested input %d on sound device %s which only has %d.", orig_inputnum, device().tag(), inputs());
}
@@ -147,24 +135,19 @@ sound_stream *device_sound_interface::input_to_stream_input(int inputnum, int &s
// on that stream
//-------------------------------------------------
-sound_stream *device_sound_interface::output_to_stream_output(int outputnum, int &stream_outputnum) const
+std::pair<sound_stream *, int> device_sound_interface::output_to_stream_output(int outputnum) const
{
assert(outputnum >= 0);
+ int orig_outputnum = outputnum;
- // scan the list looking for streams owned by this device
- for (auto &stream : device().machine().sound().streams())
- if (&stream->device() == &device())
- {
- if (outputnum < stream->output_count())
- {
- stream_outputnum = outputnum;
- return stream.get();
- }
- outputnum -= stream->output_count();
- }
+ // scan the list looking forstreams owned by this device
+ for(auto *stream : m_sound_streams) {
+ if(outputnum < stream->output_count())
+ return std::make_pair(stream, outputnum);
+ outputnum -= stream->output_count();
+ }
- // not found
- return nullptr;
+ fatalerror("Requested output %d on sound device %s which only has %d.", orig_outputnum, device().tag(), outputs());
}
@@ -175,9 +158,8 @@ sound_stream *device_sound_interface::output_to_stream_output(int outputnum, int
float device_sound_interface::input_gain(int inputnum) const
{
- int stream_inputnum;
- sound_stream *stream = input_to_stream_input(inputnum, stream_inputnum);
- return (stream != nullptr) ? stream->input(stream_inputnum).gain() : 0.0f;
+ auto [stream, input] = input_to_stream_input(inputnum);
+ return stream->input_gain(input);
}
@@ -188,9 +170,32 @@ float device_sound_interface::input_gain(int inputnum) const
float device_sound_interface::output_gain(int outputnum) const
{
- int stream_outputnum;
- sound_stream *stream = output_to_stream_output(outputnum, stream_outputnum);
- return (stream != nullptr) ? stream->output(stream_outputnum).gain() : 0.0f;
+ auto [stream, output] = output_to_stream_output(outputnum);
+ return stream->output_gain(output);
+}
+
+
+//-------------------------------------------------
+// user_output_gain - return the user gain for the device
+//-------------------------------------------------
+
+float device_sound_interface::user_output_gain() const
+{
+ if(!outputs())
+ fatalerror("Requested user output gain on sound device %s which has no outputs.", device().tag());
+ return m_sound_streams.front()->user_output_gain();
+}
+
+
+//-------------------------------------------------
+// user_output_gain - return the user gain on the given
+// output index of the device
+//-------------------------------------------------
+
+float device_sound_interface::user_output_gain(int outputnum) const
+{
+ auto [stream, output] = output_to_stream_output(outputnum);
+ return stream->user_output_gain(output);
}
@@ -201,10 +206,8 @@ float device_sound_interface::output_gain(int outputnum) const
void device_sound_interface::set_input_gain(int inputnum, float gain)
{
- int stream_inputnum;
- sound_stream *stream = input_to_stream_input(inputnum, stream_inputnum);
- if (stream != nullptr)
- stream->input(stream_inputnum).set_gain(gain);
+ auto [stream, input] = input_to_stream_input(inputnum);
+ stream->set_input_gain(input, gain);
}
@@ -216,45 +219,66 @@ void device_sound_interface::set_input_gain(int inputnum, float gain)
void device_sound_interface::set_output_gain(int outputnum, float gain)
{
// handle ALL_OUTPUTS as a special case
- if (outputnum == ALL_OUTPUTS)
+ if(outputnum == ALL_OUTPUTS)
{
- for (auto &stream : device().machine().sound().streams())
- if (&stream->device() == &device())
- for (int num = 0; num < stream->output_count(); num++)
- stream->output(num).set_gain(gain);
+ if(!outputs())
+ fatalerror("Requested setting output gain on sound device %s which has no outputs.", device().tag());
+ for(auto *stream : m_sound_streams)
+ for(int num = 0; num < stream->output_count(); num++)
+ stream->set_output_gain(num, gain);
}
// look up the stream and stream output index
else
{
- int stream_outputnum;
- sound_stream *stream = output_to_stream_output(outputnum, stream_outputnum);
- if (stream != nullptr)
- stream->output(stream_outputnum).set_gain(gain);
+ auto [stream, output] = output_to_stream_output(outputnum);
+ stream->set_output_gain(output, gain);
}
}
+//-------------------------------------------------
+// user_set_output_gain - set the user gain on the device
+//-------------------------------------------------
+
+void device_sound_interface::set_user_output_gain(float gain)
+{
+ if(!outputs())
+ fatalerror("Requested setting user output gain on sound device %s which has no outputs.", device().tag());
+ for(auto *stream : m_sound_streams)
+ stream->set_user_output_gain(gain);
+}
+
+
+
+//-------------------------------------------------
+// set_user_output_gain - set the user gain on the given
+// output index of the device
+//-------------------------------------------------
+
+void device_sound_interface::set_user_output_gain(int outputnum, float gain)
+{
+ auto [stream, output] = output_to_stream_output(outputnum);
+ stream->set_user_output_gain(output, gain);
+}
+
//-------------------------------------------------
-// inputnum_from_device - return the input number
-// that is connected to the given device's output
+// set_route_gain - set the gain on a route
//-------------------------------------------------
-int device_sound_interface::inputnum_from_device(device_t &source_device, int outputnum) const
+void device_sound_interface::set_route_gain(int source_channel, device_sound_interface *target, int target_channel, float gain)
{
- int overall = 0;
- for (auto &stream : device().machine().sound().streams())
- if (&stream->device() == &device())
- for (int inputnum = 0; inputnum < stream->input_count(); inputnum++, overall++)
- {
- auto &input = stream->input(inputnum);
- if (input.valid() && &input.source().stream().device() == &source_device && input.source().index() == outputnum)
- return overall;
- }
- return -1;
+ auto [sstream, schan] = output_to_stream_output(source_channel);
+ auto [tstream, tchan] = target->input_to_stream_input(target_channel);
+ tstream->update();
+ if(tstream->set_route_gain(sstream, schan, tchan, gain))
+ return;
+
+ fatalerror("Trying to change the gain on a non-existant route between %s channel %d and %s channel %d\n", device().tag(), source_channel, target->device().tag(), target_channel);
}
+
//-------------------------------------------------
// interface_validity_check - validation for a
// device after the configuration has been
@@ -264,16 +288,16 @@ int device_sound_interface::inputnum_from_device(device_t &source_device, int ou
void device_sound_interface::interface_validity_check(validity_checker &valid) const
{
// loop over all the routes
- for (sound_route const &route : routes())
+ for(sound_route const &route : routes())
{
// find a device with the requested tag
device_t const *const target = route.m_base.get().subdevice(route.m_target);
- if (!target)
+ if(!target)
osd_printf_error("Attempting to route sound to non-existent device '%s'\n", route.m_base.get().subtag(route.m_target));
- // if it's not a speaker or a sound device, error
+ // ifit's not a speaker or a sound device, error
device_sound_interface const *sound;
- if (target && (target->type() != SPEAKER) && !target->interface(sound))
+ if(target && !target->interface(sound))
osd_printf_error("Attempting to route sound to a non-sound device '%s' (%s)\n", target->tag(), target->name());
}
}
@@ -284,240 +308,68 @@ void device_sound_interface::interface_validity_check(validity_checker &valid) c
// devices are started
//-------------------------------------------------
-void device_sound_interface::interface_pre_start()
+void device_sound_interface::sound_before_devices_init()
{
- // scan all the sound devices
- sound_interface_enumerator iter(device().machine().root_device());
- for (device_sound_interface const &sound : iter)
- {
- // scan each route on the device
- for (sound_route const &route : sound.routes())
- {
- device_t *const target_device = route.m_base.get().subdevice(route.m_target);
- if (target_device == &device())
- {
- // see if we are the target of this route; if we are, make sure the source device is started
- if (!sound.device().started())
- throw device_missing_dependencies();
- if (route.m_input != AUTO_ALLOC_INPUT)
- m_specified_inputs_mask |= 1 << route.m_input;
- }
- }
- }
-
- // now iterate through devices again and assign any auto-allocated inputs
- m_auto_allocated_inputs = 0;
- for (device_sound_interface &sound : iter)
- {
- // scan each route on the device
- for (sound_route &route : sound.routes())
- {
- // see if we are the target of this route
- device_t *const target_device = route.m_base.get().subdevice(route.m_target);
- if (target_device == &device() && route.m_input == AUTO_ALLOC_INPUT)
- {
- route.m_input = m_auto_allocated_inputs;
- m_auto_allocated_inputs += (route.m_output == ALL_OUTPUTS) ? sound.outputs() : 1;
- }
+ for(sound_route &route : routes()) {
+ device_t *dev = route.m_base.get().subdevice(route.m_target);
+ dev->interface(route.m_interface);
+ if(route.m_output != ALL_OUTPUTS && m_sound_requested_outputs <= route.m_output) {
+ m_sound_requested_outputs_mask |= u64(1) << route.m_output;
+ m_sound_requested_outputs = route.m_output + 1;
}
+ route.m_interface->sound_request_input(route.m_input);
}
}
-
-//-------------------------------------------------
-// interface_post_start - verify that state was
-// properly set up
-//-------------------------------------------------
-
-void device_sound_interface::interface_post_start()
+void device_sound_interface::sound_after_devices_init()
{
- // iterate over all the sound devices
- for (device_sound_interface &sound : sound_interface_enumerator(device().machine().root_device()))
- {
- // scan each route on the device
- for (sound_route const &route : sound.routes())
- {
- // if we are the target of this route, hook it up
- device_t *const target_device = route.m_base.get().subdevice(route.m_target);
- if (target_device == &device())
- {
- // iterate over all outputs, matching any that apply
- int inputnum = route.m_input;
- int const numoutputs = sound.outputs();
- for (int outputnum = 0; outputnum < numoutputs; outputnum++)
- if (route.m_output == outputnum || route.m_output == ALL_OUTPUTS)
- {
- // find the output stream to connect from
- int streamoutputnum;
- sound_stream *const outputstream = sound.output_to_stream_output(outputnum, streamoutputnum);
- if (!outputstream)
- fatalerror("Sound device '%s' specifies route for nonexistent output #%d\n", sound.device().tag(), outputnum);
-
- // find the input stream to connect to
- int streaminputnum;
- sound_stream *const inputstream = input_to_stream_input(inputnum++, streaminputnum);
- if (!inputstream)
- fatalerror("Sound device '%s' targeted output #%d to nonexistent device '%s' input %d\n", sound.device().tag(), outputnum, device().tag(), inputnum - 1);
-
- // set the input
- inputstream->set_input(streaminputnum, outputstream, streamoutputnum, route.m_gain);
- }
- }
+ for(sound_route &route : routes()) {
+ auto [si, ii] = route.m_interface->input_to_stream_input(route.m_input);
+ if(!si)
+ fatalerror("Requesting sound route to device %s input %d which doesn't exist\n", route.m_interface->device().tag(), route.m_input);
+ if(route.m_output != ALL_OUTPUTS) {
+ auto [so, io] = output_to_stream_output(route.m_output);
+ if(!so)
+ fatalerror("Requesting sound route from device %s output %d which doesn't exist\n", device().tag(), route.m_output);
+ si->add_bw_route(so, io, ii, route.m_gain);
+ so->add_fw_route(si, ii, io);
+
+ } else {
+ for(sound_stream *so : m_sound_streams)
+ for(int io = 0; io != so->output_count(); io ++) {
+ si->add_bw_route(so, io, ii, route.m_gain);
+ so->add_fw_route(si, ii, io);
+ }
}
}
}
-
-//-------------------------------------------------
-// interface_pre_reset - called prior to
-// resetting the device
-//-------------------------------------------------
-
-void device_sound_interface::interface_pre_reset()
-{
- // update all streams on this device prior to reset
- for (auto &stream : device().machine().sound().streams())
- if (&stream->device() == &device())
- stream->update();
-}
-
-
-//-------------------------------------------------
-// sound_stream_update - default implementation
-// that should be overridden
-//-------------------------------------------------
-
-void device_sound_interface::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void device_sound_interface::sound_request_input(u32 input)
{
- throw emu_fatalerror("sound_stream_update called but not overridden by owning class");
+ m_sound_requested_inputs_mask |= u64(1) << input;
+ if(m_sound_requested_inputs <= input)
+ m_sound_requested_inputs = input + 1;
}
-
-
-//**************************************************************************
-// SIMPLE DERIVED MIXER INTERFACE
-//**************************************************************************
-
-//-------------------------------------------------
-// device_mixer_interface - constructor
-//-------------------------------------------------
-
-device_mixer_interface::device_mixer_interface(const machine_config &mconfig, device_t &device, int outputs)
- : device_sound_interface(mconfig, device),
- m_outputs(outputs),
- m_mixer_stream(nullptr)
+device_mixer_interface::device_mixer_interface(const machine_config &mconfig, device_t &device) :
+ device_sound_interface(mconfig, device)
{
}
-
-//-------------------------------------------------
-// ~device_mixer_interface - destructor
-//-------------------------------------------------
-
device_mixer_interface::~device_mixer_interface()
{
}
-
-//-------------------------------------------------
-// interface_pre_start - perform startup prior
-// to the device startup
-//-------------------------------------------------
-
void device_mixer_interface::interface_pre_start()
{
- // call our parent
- device_sound_interface::interface_pre_start();
-
- // no inputs? that's weird
- if (m_auto_allocated_inputs == 0)
- {
- device().logerror("Warning: mixer \"%s\" has no inputs\n", device().tag());
- return;
- }
-
- // generate the output map
- m_outputmap.resize(m_auto_allocated_inputs);
-
- // iterate through all routes that point to us and note their mixer output
- for (device_sound_interface const &sound : sound_interface_enumerator(device().machine().root_device()))
- {
- for (sound_route const &route : sound.routes())
- {
- // see if we are the target of this route
- device_t *const target_device = route.m_base.get().subdevice(route.m_target);
- if (target_device == &device() && route.m_input < m_auto_allocated_inputs)
- {
- int const count = (route.m_output == ALL_OUTPUTS) ? sound.outputs() : 1;
- for (int output = 0; output < count; output++)
- m_outputmap[route.m_input + output] = route.m_mixoutput;
- }
- }
- }
-
- // keep a small buffer handy for tracking cleared buffers
- m_output_clear.resize(m_outputs);
-
- // allocate the mixer stream
- m_mixer_stream = stream_alloc(m_auto_allocated_inputs, m_outputs, device().machine().sample_rate(), STREAM_DEFAULT_FLAGS);
-}
-
-
-//-------------------------------------------------
-// interface_post_load - after we load a save
-// state be sure to update the mixer stream's
-// output sample rate
-//-------------------------------------------------
-
-void device_mixer_interface::interface_post_load()
-{
- // mixer stream could be null if no inputs were specified
- if (m_mixer_stream != nullptr)
- m_mixer_stream->set_sample_rate(device().machine().sample_rate());
-
- // call our parent
- device_sound_interface::interface_post_load();
+ u32 ni = get_sound_requested_inputs();
+ u32 no = get_sound_requested_outputs();
+ u32 nc = ni > no ? ni : no;
+ for(u32 i = 0; i != nc; i++)
+ stream_alloc(1, 1, SAMPLE_RATE_ADAPTIVE);
}
-
-//-------------------------------------------------
-// sound_stream_update - mix all inputs to one
-// output
-//-------------------------------------------------
-
-void device_mixer_interface::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void device_mixer_interface::sound_stream_update(sound_stream &stream)
{
- // special case: single input, single output, same rate
- if (inputs.size() == 1 && outputs.size() == 1 && inputs[0].sample_rate() == outputs[0].sample_rate())
- {
- outputs[0] = inputs[0];
- return;
- }
-
- // reset the clear flags
- std::fill(std::begin(m_output_clear), std::end(m_output_clear), false);
-
- // loop over inputs
- for (int inputnum = 0; inputnum < m_auto_allocated_inputs; inputnum++)
- {
- // skip if the gain is 0
- auto &input = inputs[inputnum];
- if (input.gain() == 0)
- continue;
-
- // either store or accumulate
- int outputnum = m_outputmap[inputnum];
- auto &output = outputs[outputnum];
- if (!m_output_clear[outputnum])
- output.copy(input);
- else
- output.add(input);
-
- m_output_clear[outputnum] = true;
- }
-
- // clear anything unused
- for (int outputnum = 0; outputnum < m_outputs; outputnum++)
- if (!m_output_clear[outputnum])
- outputs[outputnum].fill(0);
+ stream.copy(0, 0);
}
diff --git a/src/emu/disound.h b/src/emu/disound.h
index e48ba290bc6..eefe1197784 100644
--- a/src/emu/disound.h
+++ b/src/emu/disound.h
@@ -26,7 +26,6 @@
//**************************************************************************
constexpr int ALL_OUTPUTS = 65535; // special value indicating all outputs for the current chip
-constexpr int AUTO_ALLOC_INPUT = 65535;
@@ -34,8 +33,6 @@ constexpr int AUTO_ALLOC_INPUT = 65535;
// TYPE DEFINITIONS
//**************************************************************************
-class read_stream_view;
-class write_stream_view;
enum sound_stream_flags : u32;
@@ -43,73 +40,89 @@ enum sound_stream_flags : u32;
class device_sound_interface : public device_interface
{
+ friend class sound_manager;
+
public:
class sound_route
{
public:
u32 m_output; // output index, or ALL_OUTPUTS
u32 m_input; // target input index
- u32 m_mixoutput; // target mixer output
float m_gain; // gain
std::reference_wrapper<device_t> m_base; // target search base
std::string m_target; // target tag
+ device_sound_interface *m_interface; // target device interface
};
// construction/destruction
device_sound_interface(const machine_config &mconfig, device_t &device);
virtual ~device_sound_interface();
- virtual bool issound() { return true; } /// HACK: allow devices to hide from the ui
-
// configuration access
std::vector<sound_route> const &routes() const { return m_route_list; }
// configuration helpers
template <typename T, bool R>
- device_sound_interface &add_route(u32 output, const device_finder<T, R> &target, double gain, u32 input = AUTO_ALLOC_INPUT, u32 mixoutput = 0)
+ device_sound_interface &add_route(u32 output, const device_finder<T, R> &target, double gain, u32 channel = 0)
{
const std::pair<device_t &, const char *> ft(target.finder_target());
- return add_route(output, ft.first, ft.second, gain, input, mixoutput);
+ return add_route(output, ft.first, ft.second, gain, channel);
}
- device_sound_interface &add_route(u32 output, const char *target, double gain, u32 input = AUTO_ALLOC_INPUT, u32 mixoutput = 0);
- device_sound_interface &add_route(u32 output, device_sound_interface &target, double gain, u32 input = AUTO_ALLOC_INPUT, u32 mixoutput = 0);
- device_sound_interface &add_route(u32 output, speaker_device &target, double gain, u32 input = AUTO_ALLOC_INPUT, u32 mixoutput = 0);
+ device_sound_interface &add_route(u32 output, const char *target, double gain, u32 channel = 0);
+ device_sound_interface &add_route(u32 output, device_sound_interface &target, double gain, u32 channel = 0);
device_sound_interface &reset_routes() { m_route_list.clear(); return *this; }
// 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);
+ virtual void sound_stream_update(sound_stream &stream) = 0;
// stream creation
- sound_stream *stream_alloc(int inputs, int outputs, int sample_rate);
- sound_stream *stream_alloc(int inputs, int outputs, int sample_rate, sound_stream_flags flags);
+ sound_stream *stream_alloc(int inputs, int outputs, int sample_rate, sound_stream_flags flags = sound_stream_flags(0));
// helpers
int inputs() const;
int outputs() const;
- sound_stream *input_to_stream_input(int inputnum, int &stream_inputnum) const;
- sound_stream *output_to_stream_output(int outputnum, int &stream_outputnum) const;
+ std::pair<sound_stream *, int> input_to_stream_input(int inputnum) const;
+ std::pair<sound_stream *, int> output_to_stream_output(int outputnum) const;
float input_gain(int inputnum) const;
float output_gain(int outputnum) const;
+ float user_output_gain() const;
+ float user_output_gain(int outputnum) const;
void set_input_gain(int inputnum, float gain);
void set_output_gain(int outputnum, float gain);
- int inputnum_from_device(device_t &device, int outputnum = 0) const;
+ void set_user_output_gain(float gain);
+ void set_user_output_gain(int outputnum, float gain);
+ void set_route_gain(int source_channel, device_sound_interface *target, int target_channel, float gain);
+ void set_sound_hook(bool enable) { m_sound_hook = enable; }
+ bool get_sound_hook() const { return m_sound_hook; }
+
protected:
// configuration access
std::vector<sound_route> &routes() { return m_route_list; }
- device_sound_interface &add_route(u32 output, device_t &base, const char *tag, double gain, u32 input, u32 mixoutput);
+ device_sound_interface &add_route(u32 output, device_t &base, const char *tag, double gain, u32 channel);
// optional operation overrides
virtual void interface_validity_check(validity_checker &valid) const override;
- virtual void interface_pre_start() override;
- virtual void interface_post_start() override;
- virtual void interface_pre_reset() override;
+
+ u32 get_sound_requested_inputs() const { return m_sound_requested_inputs; }
+ u32 get_sound_requested_outputs() const { return m_sound_requested_outputs; }
+ u64 get_sound_requested_inputs_mask() const { return m_sound_requested_inputs_mask; }
+ u64 get_sound_requested_outputs_mask() const { return m_sound_requested_outputs_mask; }
+
+private:
+ void sound_request_input(u32 input);
// internal state
std::vector<sound_route> m_route_list; // list of sound routes
- int m_outputs; // number of outputs from this instance
- int m_auto_allocated_inputs; // number of auto-allocated inputs targeting us
- u32 m_specified_inputs_mask; // mask of inputs explicitly specified (not counting auto-allocated)
+ std::vector<sound_stream *> m_sound_streams;
+ u64 m_sound_requested_inputs_mask;
+ u64 m_sound_requested_outputs_mask;
+ u32 m_sound_requested_inputs;
+ u32 m_sound_requested_outputs;
+ bool m_sound_hook;
+
+ void sound_before_devices_init();
+ void sound_after_devices_init();
};
// iterator
@@ -123,22 +136,15 @@ class device_mixer_interface : public device_sound_interface
{
public:
// construction/destruction
- device_mixer_interface(const machine_config &mconfig, device_t &device, int outputs = 1);
+ device_mixer_interface(const machine_config &mconfig, device_t &device);
virtual ~device_mixer_interface();
protected:
// optional operation overrides
virtual void interface_pre_start() override;
- virtual void interface_post_load() override;
// sound interface overrides
- virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
-
- // internal state
- u8 m_outputs; // number of outputs
- std::vector<u8> m_outputmap; // map of inputs to outputs
- std::vector<bool> m_output_clear; // flag for tracking cleared buffers
- sound_stream *m_mixer_stream; // mixing stream
+ virtual void sound_stream_update(sound_stream &stream) override;
};
// iterator
diff --git a/src/emu/emufwd.h b/src/emu/emufwd.h
index 89e15e4c541..cf14dcb8163 100644
--- a/src/emu/emufwd.h
+++ b/src/emu/emufwd.h
@@ -235,7 +235,9 @@ class sound_manager;
class sound_stream;
// declared in speaker.h
+class sound_io_device;
class speaker_device;
+class microphone_device;
// declared in tilemap.h
class tilemap_device;
diff --git a/src/emu/inpttype.h b/src/emu/inpttype.h
index 22aaf0258bc..92d4cbd2be1 100644
--- a/src/emu/inpttype.h
+++ b/src/emu/inpttype.h
@@ -300,6 +300,8 @@ enum ioport_type : osd::u32
IPT_UI_FAVORITES,
IPT_UI_EXPORT,
IPT_UI_AUDIT,
+ IPT_UI_MIXER_ADD_FULL,
+ IPT_UI_MIXER_ADD_CHANNEL,
// additional OSD-specified UI port types (up to 16)
IPT_OSD_1,
diff --git a/src/emu/inpttype.ipp b/src/emu/inpttype.ipp
index 4749827c3d5..c51afa8ce31 100644
--- a/src/emu/inpttype.ipp
+++ b/src/emu/inpttype.ipp
@@ -926,6 +926,8 @@ namespace {
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_FAVORITES, N_p("input-name", "UI Add/Remove Favorite"), input_seq(KEYCODE_LALT, KEYCODE_F) ) \
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_EXPORT, N_p("input-name", "UI Export List"), input_seq(KEYCODE_LALT, KEYCODE_E) ) \
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_AUDIT, N_p("input-name", "UI Audit Media"), input_seq(KEYCODE_F1, input_seq::not_code, KEYCODE_LSHIFT, input_seq::not_code, KEYCODE_RSHIFT) ) \
+ INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_MIXER_ADD_FULL, N_p("input-name", "UI Audio add full mapping"), input_seq(KEYCODE_F) ) \
+ INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_MIXER_ADD_CHANNEL, N_p("input-name", "UI Audio add channel mapping"), input_seq(KEYCODE_C) ) \
CORE_INPUT_TYPES_END()
#define CORE_INPUT_TYPES_OSD \
diff --git a/src/emu/machine.cpp b/src/emu/machine.cpp
index 573c1b9e095..859e6b4506f 100644
--- a/src/emu/machine.cpp
+++ b/src/emu/machine.cpp
@@ -212,7 +212,9 @@ void running_machine::start()
add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(&running_machine::reset_all_devices, this));
add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(&running_machine::stop_all_devices, this));
save().register_presave(save_prepost_delegate(FUNC(running_machine::presave_all_devices), this));
+ m_sound->before_devices_init();
start_all_devices();
+ m_sound->after_devices_init();
save().register_postload(save_prepost_delegate(FUNC(running_machine::postload_all_devices), this));
// save outputs created before start time
@@ -331,9 +333,12 @@ int running_machine::run(bool quiet)
// execute CPUs if not paused
if (!m_paused)
m_scheduler.timeslice();
- // otherwise, just pump video updates through
+ // otherwise, just pump video updates and sound mapping updates through
else
+ {
m_video->frame_update();
+ sound().mapping_update();
+ }
// handle save/load
if (m_saveload_schedule != saveload_schedule::NONE)
diff --git a/src/emu/main.h b/src/emu/main.h
index 78553ca5236..a62ccb46211 100644
--- a/src/emu/main.h
+++ b/src/emu/main.h
@@ -13,6 +13,7 @@
#include "emufwd.h"
+#include <map>
#include <memory>
#include <string>
#include <vector>
@@ -57,7 +58,7 @@ public:
static bool draw_user_interface(running_machine& machine);
static void periodic_check();
static bool frame_hook();
- static void sound_hook();
+ static void sound_hook(const std::map<std::string, std::vector<std::pair<const float *, int>>> &sound); // Can't use sound_stream::sample_t sadly
static void layout_script_cb(layout_file &file, const char *script);
static bool standalone();
};
diff --git a/src/emu/recording.cpp b/src/emu/recording.cpp
index d9c25c57767..91bc0e58bf7 100644
--- a/src/emu/recording.cpp
+++ b/src/emu/recording.cpp
@@ -146,7 +146,10 @@ movie_recording::ptr movie_recording::create(running_machine &machine, screen_de
// if we successfully create a recording, set the current time and return it
if (result)
+ {
result->set_next_frame_time(machine.time());
+ result->set_channel_count(machine.sound().outputs_count());
+ }
return result;
}
@@ -190,10 +193,12 @@ bool avi_movie_recording::initialize(running_machine &machine, std::unique_ptr<e
info.audio_timescale = machine.sample_rate();
info.audio_sampletime = 1;
info.audio_numsamples = 0;
- info.audio_channels = 2;
+ info.audio_channels = machine.sound().outputs_count();
info.audio_samplebits = 16;
info.audio_samplerate = machine.sample_rate();
+ m_channels = info.audio_channels;
+
// compute the frame time
set_frame_period(attotime::from_ticks(info.video_sampletime, info.video_timescale));
@@ -225,9 +230,9 @@ bool avi_movie_recording::add_sound_to_recording(const s16 *sound, int numsample
auto profile = g_profiler.start(PROFILER_MOVIE_REC);
// write the next frame
- avi_file::error avierr = m_avi_file->append_sound_samples(0, sound + 0, numsamples, 1);
- if (avierr == avi_file::error::NONE)
- avierr = m_avi_file->append_sound_samples(1, sound + 1, numsamples, 1);
+ avi_file::error avierr = avi_file::error::NONE;
+ for (int channel = 0; channel != m_channels && avierr == avi_file::error::NONE; channel ++)
+ avierr = m_avi_file->append_sound_samples(channel, sound + channel, numsamples, m_channels-1);
return avierr == avi_file::error::NONE;
}
diff --git a/src/emu/recording.h b/src/emu/recording.h
index 0a26c5c7db8..98798063a73 100644
--- a/src/emu/recording.h
+++ b/src/emu/recording.h
@@ -50,6 +50,7 @@ public:
screen_device *screen() { return m_screen; }
attotime frame_period() { return m_frame_period; }
void set_next_frame_time(attotime time) { m_next_frame_time = time; }
+ void set_channel_count(int channels) { m_channels = channels; }
attotime next_frame_time() const { return m_next_frame_time; }
// methods
@@ -63,6 +64,8 @@ public:
static const char *format_file_extension(format fmt);
protected:
+ int m_channels; // count of audio channels
+
// ctor
movie_recording(screen_device *screen);
movie_recording(const movie_recording &) = delete;
diff --git a/src/emu/resampler.cpp b/src/emu/resampler.cpp
new file mode 100644
index 00000000000..b95fe80dfba
--- /dev/null
+++ b/src/emu/resampler.cpp
@@ -0,0 +1,317 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+
+// Audio resampler
+
+#include "emu.h"
+#include "resampler.h"
+
+// How an accurate resampler works ?
+
+// Resampling uses a number of well-known theorems we are not trying
+// to prove here.
+
+// Samping theorem. A digital signal sampled at frequency fs is
+// equivalent to an analog signal where all frequencies are between 0
+// and fs/2. Equivalent here means that the samples are unique given
+// the analog signal, the analog sugnal is unique given the samples,
+// and going analog -> digital -> analog is perfect.
+
+// That gives us point one: resampling from fs to ft is, semantically,
+// reconstructing the analog signal from the fs sampling, removing all
+// frequencies over ft/2, then sampling at ft.
+
+
+// Up-sampling theorem. Take a digital signal at frequency fs, and k
+// an integer > 1. Create a new digital signal at frequency fs*k by
+// alternatively taking one sample from the original signal and adding
+// k-1 zeroes. If one recreates the corresponding analog signal and
+// removes all frequencies over fs/2, then it will be identical to the
+// original analog signal, up to a constant multiplier on the
+// amplitude. For the curious the frequencies over fs/2 get copies of
+// the original spectrum with inversions, e.g. the frequency fs/2-a is
+// copied at fs/2+a, then it's not inverted at fs..fs*1.5, inverted
+// again between fs*1.5 and fs*2, etc.
+
+// A corollary is that if one starts for an analog signal with no
+// frequencies over fs/2, samples it at fs, then up-samples to fs*k by
+// adding zeroes, remove (filter) from the upsampled signal all
+// frequencies over fs/2 then reconstruct the analog signal you get a
+// result identical to the original signal. It's a perfect
+// upsampling, assuming the filtering is perfect.
+
+
+// Down-sampling theorem. Take a digital signal at frequency ft*k,
+// with k and integer > 1. Create a new digital signal at frequency
+// ft by alternatively taking one sample from the original signal and
+// dropping k-1 samples. If the original signal had no frequency over
+// ft/2, then the reconstructed analog signal is identical to the
+// original one, up to a constant multiplier on the amplitude. So it
+// is a perfect downsampling assuming the original signal has nothing
+// over ft/2. For the curious if there are frequencies over ft/2,
+// they end up added to the lower frequencies with inversions. The
+// frequency ft/2+a is added to ft/2-a, etc (signal to upsampling,
+// only the other way around).
+
+// The corollary there is that if one starts with a ft*k digital
+// signal, filters out everything over ft/2, then keeps only one
+// sample every k, then reconstruct the analog signal, you get the
+// original analog signal with frequencies over ft/2 removed, which is
+// reasonable given they are not representable at sampling frequency
+// ft anyway. As such it is called perfect because it's the best
+// possible result in any case.
+
+// Incidentally, the parasite audible frequencies added with the
+// wrapping when the original is insufficiently filtered before
+// dropping the samples are called aliasing, as in the high barely
+// audible frequencies that was there but not noticed gets aliased to
+// a very audible and annoying lower frequency.
+
+
+// As a result, the recipe to go from frequency fs to ft for a digital
+// signal is:
+
+// - find a frequency fm = ks*fs = kt*ft with ks and kt integers.
+// When fs and ft are integers (our case), the easy solution is
+// fm = fs * ft / gcd(fs, ft)
+
+// - up-sample the original signal x(t) into xm(t) with:
+// xm(ks*t) = x(t)
+// xm(other) = 0
+
+// - filter the resulting fm Hz signal to remove all frequencies above
+// fs/2. This is also called "lowpass at fs/2"
+
+// - lowpass at ft/2
+
+// - down-sample the fm signal into the resulting y(t) signal by:
+// y(t) = xm(kt*t)
+
+// And, assuming the filtering is perfect (it isn't, of course), the
+// result is a perfect resampling.
+
+// Now to optimize all that. The first point is that an ideal lowpass
+// at fs/2 followed by an ideal lowpass at ft/2 is strictly equivalent
+// to an ideal lowpass at min(fs/2, ft/2). So only one filter is
+// needed.
+
+// The second point depends on the type of filter used. In our case
+// the filter type known as FIR has a big advantage. A FIR filter
+// computes the output signal as a finite ponderated sum on the values
+// of the input signal only (also called a convolution). E.g.
+// y(t) = sum(k=0, n-1) a[k] * x[t-k]
+// where a[0..n-1] are constants called the coefficients of the filter.
+
+// Why this type of filter is pertinent shows up when building the
+// complete computation:
+
+// y(t) = filter(xm)[kt*t]
+// = sum(k=0, n-1) a[k] * xm[kt*t - k]
+// = sum(k=0, n-1) a[k] * | x[(kt*t-k)/ks] when kt*t-k is divisible by ks
+// | 0 otherwise
+// = sum(k=(kt*t) mod ks, n-1, step=ks) a[k] * x[(kt*t-k)/ks]
+
+// (noting p = (kt*t) mode ks, and a // b integer divide of a by b)
+// = sum(k=0, (n-1 - p))//ks) a[k*ks + p] x[(kt*t) // ks) - k]
+
+// Splitting the filter coefficients in ks phases ap[0..ks-1] where
+// ap[p][k] = a[p + ks*k], and noting t0 = (k*kt) // ks:
+
+// y(t) = sum(k=0, len(ap[p])-1) ap[p][k] * x[t0-k]
+
+// So we can take a big FIR filter and split it into ks interpolation
+// filters and just apply the correct one at each sample. We can make
+// things even easier by ensuring that the size of every interpolation
+// filter is the same.
+
+// The art of creating the big FIR filter so that it doesn't change
+// the signal too much is complicated enough that entire books have
+// been written on the topic. We use here a simple solution which is
+// to use a so-called zero-phase filter, which is a symmetrical filter
+// which looks into the future to filter out the frequencies without
+// changing the phases, and shift it in the past by half its length,
+// making it causal (e.g. not looking into the future anymore). It is
+// then called linear-phase, and has a latency of exactly half its
+// length. The filter itself is made very traditionally, by
+// multiplying a sinc by a Hann window.
+
+// The filter size is selected by maximizing the latency to 5ms and
+// capping the length at 400, which experimentally seems to ensure a
+// sharp rejection of more than 100dB in every case.
+
+// Finally, remember that up and downsampling steps multiply the
+// amplitude by a constant (upsampling divides by k, downsamply
+// multiply by k in fact). To compensate for that and numerical
+// errors the easiest way to to normalize each phase-filter
+// independently to ensure the sum of their coefficients is 1. It is
+// easy to see why it works: a constant input signal must be
+// transformed into a constant output signal at the exact same level.
+// Having the sum of coefficients being 1 ensures that.
+
+
+audio_resampler::audio_resampler(u32 fs, u32 ft)
+{
+ m_ft = ft;
+ m_fs = fs;
+
+ // Compute the multiplier for fs and ft to reach the common frequency
+ u32 gcd = compute_gcd(fs, ft);
+ m_ftm = fs / gcd;
+ m_fsm = ft / gcd;
+
+ // Compute the per-phase filter length to limit the latency to 5ms and capping it
+ m_order_per_lane = u32(fs * 0.005 * 2);
+ if(m_order_per_lane > 400)
+ m_order_per_lane = 400;
+
+ // Reduce the number of phases to be less than 200
+ m_phase_shift = 0;
+ while(((m_fsm - 1) >> m_phase_shift) >= 200)
+ m_phase_shift ++;
+
+ m_phases = ((m_fsm - 1) >> m_phase_shift) + 1;
+
+ // Compute the global filter length
+ u32 filter_length = m_order_per_lane * m_phases;
+ if((filter_length & 1) == 0)
+ filter_length --;
+ u32 hlen = filter_length / 2;
+
+ // Prepare the per-phase filters
+ m_coefficients.resize(m_phases);
+ for(u32 i = 0; i != m_phases; i++)
+ m_coefficients[i].resize(m_order_per_lane, 0.0);
+
+ // Select the filter cutoff. Keep it in audible range.
+ double cutoff = std::min(fs/2.0, ft/2.0);
+ if(cutoff > 20000)
+ cutoff = 20000;
+
+ // Compute the filter and send the coefficients to the appropriate phase
+ auto set_filter = [this](u32 i, float v) { m_coefficients[i % m_phases][i / m_phases] = v; };
+
+ double wc = 2 * M_PI * cutoff / (double(fs) * m_fsm / (1 << m_phase_shift));
+ double a = wc / M_PI;
+ for(u32 i = 1; i != hlen; i++) {
+ double win = cos(i*M_PI/hlen/2);
+ win = win*win;
+ double s = a * sin(i*wc)/(i*wc) * win;
+
+ set_filter(hlen-1+i, s);
+ set_filter(hlen-1-i, s);
+ }
+ set_filter(hlen-1, a);
+
+ // Normalize the per-phase filters
+ for(u32 i = 0; i != m_phases; i++) {
+ float s = 0;
+ for(u32 j = 0; j != m_order_per_lane; j++)
+ s += m_coefficients[i][j];
+ s = 1/s;
+ for(u32 j = 0; j != m_order_per_lane; j++)
+ m_coefficients[i][j] *= s;
+ }
+
+ // Compute the phase shift from one sample to the next
+ m_delta = m_ftm % m_fsm;
+ m_skip = m_ftm / m_fsm;
+}
+
+u32 audio_resampler::compute_gcd(u32 fs, u32 ft)
+{
+ u32 v1 = fs > ft ? fs : ft;
+ u32 v2 = fs > ft ? ft : fs;
+ while(v2) {
+ u32 v3 = v1 % v2;
+ v1 = v2;
+ v2 = v3;
+ }
+ return v1;
+}
+
+void audio_resampler::apply(const emu::detail::output_buffer_flat<sample_t> &src, std::vector<sample_t> &dest, u64 dest_sample, u32 srcc, float gain, u32 samples) const
+{
+ u32 seconds = dest_sample / m_ft;
+ u32 dsamp = dest_sample % m_ft;
+ u32 ssamp = (u64(dsamp) * m_fs) / m_ft;
+ u64 ssample = ssamp + u64(m_fs) * seconds;
+ u32 phase = (dsamp * m_ftm) % m_fsm;
+
+ const sample_t *s = src.ptrs(srcc, ssample - src.sync_sample());
+ sample_t *d = dest.data();
+ for(u32 sample = 0; sample != samples; sample++) {
+ sample_t acc = 0;
+ const sample_t *s1 = s;
+ const float *filter = m_coefficients[phase >> m_phase_shift].data();
+ for(u32 k = 0; k != m_order_per_lane; k++)
+ acc += *filter++ * *s1--;
+ *d++ += acc * gain;
+ phase += m_delta;
+ s += m_skip;
+ while(phase >= m_fsm) {
+ phase -= m_fsm;
+ s ++;
+ }
+ }
+}
+
+void audio_resampler::apply(const emu::detail::output_buffer_interleaved<s16> &src, std::vector<sample_t> &dest, u64 dest_sample, u32 srcc, float gain, u32 samples) const
+{
+ u32 seconds = dest_sample / m_ft;
+ u32 dsamp = dest_sample % m_ft;
+ u32 ssamp = (u64(dsamp) * m_fs) / m_ft;
+ u64 ssample = ssamp + u64(m_fs) * seconds;
+ u32 phase = (dsamp * m_ftm) % m_fsm;
+
+ gain /= 32768;
+
+ const s16 *s = src.ptrs(srcc, ssample - src.sync_sample());
+ sample_t *d = dest.data();
+ int step = src.channels();
+ for(u32 sample = 0; sample != samples; sample++) {
+ sample_t acc = 0;
+ const s16 *s1 = s;
+ const float *filter = m_coefficients[phase >> m_phase_shift].data();
+ for(u32 k = 0; k != m_order_per_lane; k++) {
+ acc += *filter++ * *s1;
+ s1 -= step;
+ }
+ *d++ += acc * gain;
+ phase += m_delta;
+ s += m_skip * step;
+ while(phase >= m_fsm) {
+ phase -= m_fsm;
+ s += step;
+ }
+ }
+}
+
+
+void audio_resampler::apply(const emu::detail::output_buffer_flat<sample_t> &src, std::vector<s16> &dest, u32 destc, int dchannels, u64 dest_sample, u32 srcc, float gain, u32 samples) const
+{
+ u32 seconds = dest_sample / m_ft;
+ u32 dsamp = dest_sample % m_ft;
+ u32 ssamp = (u64(dsamp) * m_fs) / m_ft;
+ u64 ssample = ssamp + u64(m_fs) * seconds;
+ u32 phase = (dsamp * m_ftm) % m_fsm;
+
+ gain *= 32768;
+
+ const sample_t *s = src.ptrs(srcc, ssample - src.sync_sample());
+ s16 *d = dest.data() + destc;
+ for(u32 sample = 0; sample != samples; sample++) {
+ sample_t acc = 0;
+ const sample_t *s1 = s;
+ const float *filter = m_coefficients[phase >> m_phase_shift].data();
+ for(u32 k = 0; k != m_order_per_lane; k++)
+ acc += *filter++ * *s1--;
+ *d += acc * gain;
+ d += dchannels;
+ phase += m_delta;
+ s += m_skip;
+ while(phase >= m_fsm) {
+ phase -= m_fsm;
+ s ++;
+ }
+ }
+}
diff --git a/src/emu/resampler.h b/src/emu/resampler.h
new file mode 100644
index 00000000000..c1b2f88f3e9
--- /dev/null
+++ b/src/emu/resampler.h
@@ -0,0 +1,35 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+
+// Audio resampler
+
+#pragma once
+
+#ifndef MAME_EMU_RESAMPLER_H
+#define MAME_EMU_RESAMPLER_H
+
+#include "sound.h"
+
+class audio_resampler
+{
+public:
+ using sample_t = sound_stream::sample_t;
+
+ audio_resampler(u32 fs, u32 ft);
+
+ u32 history_size() const { return m_order_per_lane; }
+
+ void apply(const emu::detail::output_buffer_flat<sample_t> &src, std::vector<sample_t> &dest, u64 dest_sample, u32 srcc, float gain, u32 samples) const;
+ void apply(const emu::detail::output_buffer_interleaved<s16> &src, std::vector<sample_t> &dest, u64 dest_sample, u32 srcc, float gain, u32 samples) const;
+ void apply(const emu::detail::output_buffer_flat<sample_t> &src, std::vector<s16> &dest, u32 destc, int dchannels, u64 dest_sample, u32 srcc, float gain, u32 samples) const;
+
+private:
+ u32 m_order_per_lane, m_ftm, m_fsm, m_ft, m_fs, m_delta, m_skip, m_phases, m_phase_shift;
+
+ std::vector<std::vector<float>> m_coefficients;
+
+ static u32 compute_gcd(u32 fs, u32 ft);
+};
+
+#endif
+
diff --git a/src/emu/sound.cpp b/src/emu/sound.cpp
index c9626855197..f1d93e026bb 100644
--- a/src/emu/sound.cpp
+++ b/src/emu/sound.cpp
@@ -10,6 +10,9 @@
#include "emu.h"
+#include "audio_effects/aeffect.h"
+#include "resampler.h"
+
#include "config.h"
#include "emuopts.h"
#include "main.h"
@@ -20,1632 +23,2454 @@
#include "osdepend.h"
+#include <algorithm>
//**************************************************************************
// DEBUGGING
//**************************************************************************
-//#define VERBOSE 1
-#define LOG_OUTPUT_FUNC osd_printf_debug
+#define LOG_OUTPUT_FUNC m_machine.logerror
-#include "logmacro.h"
+#define LOG_OSD_INFO (1U << 1)
+#define LOG_MAPPING (1U << 2)
+#define LOG_OSD_STREAMS (1U << 3)
+#define LOG_ORDER (1U << 4)
+
+#define VERBOSE 0
-#define LOG_OUTPUT_WAV (0)
+#include "logmacro.h"
-//**************************************************************************
-// GLOBAL VARIABLES
-//**************************************************************************
const attotime sound_manager::STREAMS_UPDATE_ATTOTIME = attotime::from_hz(STREAMS_UPDATE_FREQUENCY);
-//**************************************************************************
-// STREAM BUFFER
-//**************************************************************************
+//**// Output buffer management
+
+// Output buffers store samples produced every system-wide update.
+// They give access to a window of samples produced before the update,
+// and ensure that enough space is available to fit the update.
-//-------------------------------------------------
-// stream_buffer - constructor
-//-------------------------------------------------
-stream_buffer::stream_buffer(u32 sample_rate) :
- m_end_second(0),
- m_end_sample(0),
- m_sample_rate(sample_rate),
- m_sample_attos((sample_rate == 0) ? ATTOSECONDS_PER_SECOND : ((ATTOSECONDS_PER_SECOND + sample_rate - 1) / sample_rate)),
- m_buffer(sample_rate)
+template<typename S> emu::detail::output_buffer_interleaved<S>::output_buffer_interleaved(u32 buffer_size, u32 channels) :
+ m_buffer(channels*buffer_size, 0),
+ m_sync_sample(0),
+ m_write_position(0),
+ m_sync_position(0),
+ m_history(0),
+ m_channels(channels)
{
}
-
-//-------------------------------------------------
-// stream_buffer - destructor
-//-------------------------------------------------
-
-stream_buffer::~stream_buffer()
+template<typename S> void emu::detail::output_buffer_interleaved<S>::set_buffer_size(u32 buffer_size)
{
-#if (SOUND_DEBUG)
- if (m_wav_file)
- flush_wav();
-#endif
+ m_buffer.resize(m_channels*buffer_size, 0);
}
-
-//-------------------------------------------------
-// set_sample_rate - set a new sample rate for
-// this buffer
-//-------------------------------------------------
-
-void stream_buffer::set_sample_rate(u32 rate, bool resample)
+template<typename S> void emu::detail::output_buffer_interleaved<S>::prepare_space(u32 samples)
{
- // skip if nothing is actually changing
- if (rate == m_sample_rate)
+ if(!m_channels)
return;
- // force resampling off if coming to or from an invalid rate, or if we're at time 0 (startup)
- sound_assert(rate >= SAMPLE_RATE_MINIMUM - 1);
- if (rate < SAMPLE_RATE_MINIMUM || m_sample_rate < SAMPLE_RATE_MINIMUM || (m_end_second == 0 && m_end_sample == 0))
- resample = false;
-
- // note the time and period of the current buffer (end_time is AFTER the final sample)
- attotime prevperiod = sample_period();
- attotime prevend = end_time();
-
- // compute the time and period of the new buffer
- attotime newperiod = attotime(0, (ATTOSECONDS_PER_SECOND + rate - 1) / rate);
- attotime newend = attotime(prevend.seconds(), (prevend.attoseconds() / newperiod.attoseconds()) * newperiod.attoseconds());
-
- // buffer a short runway of previous samples; in order to support smooth
- // sample rate changes (needed by, e.g., Q*Bert's Votrax), we buffer a few
- // samples at the previous rate, and then reconstitute them resampled
- // (via simple point sampling) at the new rate. The litmus test is the
- // voice when jumping off the edge in Q*Bert; without this extra effort
- // it is crackly and/or glitchy at times
- sample_t buffer[64];
- int buffered_samples = std::min(m_sample_rate, std::min(rate, u32(std::size(buffer))));
-
- // if the new rate is lower, downsample into our holding buffer;
- // otherwise just copy into our holding buffer for later upsampling
- bool new_rate_higher = (rate > m_sample_rate);
- if (resample)
- {
- if (!new_rate_higher)
- backfill_downsample(&buffer[0], buffered_samples, newend, newperiod);
- else
- {
- u32 end = m_end_sample;
- for (int index = 0; index < buffered_samples; index++)
- {
- end = prev_index(end);
-#if (SOUND_DEBUG)
- // multiple resamples can occur before clearing out old NaNs so
- // neuter them for this specific case
- if (std::isnan(m_buffer[end]))
- buffer[index] = 0;
- else
-#endif
- buffer[index] = get(end);
- }
- }
- }
-
- // ensure our buffer is large enough to hold a full second at the new rate
- if (m_buffer.size() < rate)
- m_buffer.resize(rate);
-
- // set the new rate
- m_sample_rate = rate;
- m_sample_attos = newperiod.attoseconds();
-
- // compute the new end sample index based on the buffer time
- m_end_sample = time_to_buffer_index(prevend, false, true);
-
- // if the new rate is higher, upsample from our temporary buffer;
- // otherwise just copy our previously-downsampled data
- if (resample)
- {
-#if (SOUND_DEBUG)
- // for aggressive debugging, fill the buffer with NANs to catch anyone
- // reading beyond what we resample below
- fill(NAN);
-#endif
-
- if (new_rate_higher)
- backfill_upsample(&buffer[0], buffered_samples, prevend, prevperiod);
- else
- {
- u32 end = m_end_sample;
- for (int index = 0; index < buffered_samples; index++)
- {
- end = prev_index(end);
- put(end, buffer[index]);
- }
- }
+ // Check if potential overflow, bring data back up front if needed
+ u32 buffer_size = m_buffer.size() / m_channels;
+ if(m_write_position + samples > buffer_size) {
+ u32 source_start = (m_sync_position - m_history) * m_channels;
+ u32 source_end = m_write_position * m_channels;
+ std::copy(m_buffer.begin() + source_start, m_buffer.begin() + source_end, m_buffer.begin());
+ m_write_position -= m_sync_position - m_history;
+ m_sync_position = m_history;
}
- // if not resampling, clear the buffer
- else
- fill(0);
+ // Clear the destination range
+ u32 fill_start = m_write_position * m_channels;
+ u32 fill_end = (m_write_position + samples) * m_channels;
+ std::fill(m_buffer.begin() + fill_start, m_buffer.begin() + fill_end, 0.0);
}
-
-//-------------------------------------------------
-// open_wav - open a WAV file for logging purposes
-//-------------------------------------------------
-
-#if (SOUND_DEBUG)
-void stream_buffer::open_wav(char const *filename)
+template<typename S> void emu::detail::output_buffer_interleaved<S>::commit(u32 samples)
{
- // always open at 48k so that sound programs can handle it
- // re-sample as needed
- m_wav_file = util::wav_open(filename, 48000, 1);
+ m_write_position += samples;
}
-#endif
-
-//-------------------------------------------------
-// flush_wav - flush data to the WAV file
-//-------------------------------------------------
+template<typename S> void emu::detail::output_buffer_interleaved<S>::sync()
+{
+ m_sync_sample += m_write_position - m_sync_position;
+ m_sync_position = m_write_position;
+}
-#if (SOUND_DEBUG)
-void stream_buffer::flush_wav()
+template<typename S> emu::detail::output_buffer_flat<S>::output_buffer_flat(u32 buffer_size, u32 channels) :
+ m_buffer(channels),
+ m_sync_sample(0),
+ m_write_position(0),
+ m_sync_position(0),
+ m_history(0),
+ m_channels(channels)
{
- // skip if no file
- if (!m_wav_file)
- return;
+ for(auto &b : m_buffer)
+ b.resize(buffer_size, 0);
+}
- // grab a view of the data from the last-written point
- read_stream_view view(this, m_last_written, m_end_sample, 1.0f);
- m_last_written = m_end_sample;
+template<typename S> void emu::detail::output_buffer_flat<S>::register_save_state(device_t &device, const char *id1, const char *id2)
+{
+ auto &save = device.machine().save();
- // iterate over chunks for conversion
- s16 buffer[1024];
- for (int samplebase = 0; samplebase < view.samples(); samplebase += std::size(buffer))
- {
- // clamp to the buffer size
- int cursamples = view.samples() - samplebase;
- if (cursamples > std::size(buffer))
- cursamples = std::size(buffer);
+ for(unsigned int i=0; i != m_buffer.size(); i++)
+ save.save_item(&device, id1, id2, i, NAME(m_buffer[i]));
- // convert and fill
- for (int sampindex = 0; sampindex < cursamples; sampindex++)
- buffer[sampindex] = s16(view.get(samplebase + sampindex) * 32768.0);
+ save.save_item(&device, id1, id2, 0, NAME(m_sync_sample));
+ save.save_item(&device, id1, id2, 0, NAME(m_write_position));
+ save.save_item(&device, id1, id2, 0, NAME(m_sync_position));
+ save.save_item(&device, id1, id2, 0, NAME(m_history));
- // write to the WAV
- util::wav_add_data_16(*m_wav_file, buffer, cursamples);
- }
}
-#endif
-
-//-------------------------------------------------
-// index_time - return the attotime of a given
-// index within the buffer
-//-------------------------------------------------
-
-attotime stream_buffer::index_time(s32 index) const
+template<typename S> void emu::detail::output_buffer_flat<S>::set_buffer_size(u32 buffer_size)
{
- index = clamp_index(index);
- return attotime(m_end_second - ((index > m_end_sample) ? 1 : 0), index * m_sample_attos);
+ for(auto &b : m_buffer)
+ b.resize(buffer_size, 0);
}
-
-//-------------------------------------------------
-// time_to_buffer_index - given an attotime,
-// return the buffer index corresponding to it
-//-------------------------------------------------
-
-u32 stream_buffer::time_to_buffer_index(attotime time, bool round_up, bool allow_expansion)
+template<typename S> void emu::detail::output_buffer_flat<S>::prepare_space(u32 samples)
{
- // compute the sample index within the second
- int sample = (time.attoseconds() + (round_up ? (m_sample_attos - 1) : 0)) / m_sample_attos;
- sound_assert(sample >= 0 && sample <= size());
-
- // if the time is past the current end, make it the end
- if (time.seconds() > m_end_second || (time.seconds() == m_end_second && sample > m_end_sample))
- {
- sound_assert(allow_expansion);
-
- m_end_sample = sample;
- m_end_second = time.m_seconds;
+ if(!m_channels)
+ return;
- // due to round_up, we could tweak over the line into the next second
- if (sample >= size())
- {
- m_end_sample -= size();
- m_end_second++;
- }
+ // Check if potential overflow, bring data back up front if needed
+ u32 buffer_size = m_buffer[0].size();
+ if(m_write_position + samples > buffer_size) {
+ u32 source_start = m_sync_position - m_history;
+ u32 source_end = m_write_position;
+ for(u32 channel = 0; channel != m_channels; channel++)
+ std::copy(m_buffer[channel].begin() + source_start, m_buffer[channel].begin() + source_end, m_buffer[channel].begin());
+ m_write_position -= source_start;
+ m_sync_position = m_history;
}
- // if the time is before the start, fail
- if (time.seconds() + 1 < m_end_second || (time.seconds() + 1 == m_end_second && sample < m_end_sample))
- throw emu_fatalerror("Attempt to create an out-of-bounds view");
-
- return clamp_index(sample);
+ // Clear the destination range
+ u32 fill_start = m_write_position;
+ u32 fill_end = m_write_position + samples;
+ for(u32 channel = 0; channel != m_channels; channel++)
+ std::fill(m_buffer[channel].begin() + fill_start, m_buffer[channel].begin() + fill_end, 0.0);
}
+template<typename S> void emu::detail::output_buffer_flat<S>::commit(u32 samples)
+{
+ m_write_position += samples;
+}
-//-------------------------------------------------
-// backfill_downsample - this is called BEFORE
-// the sample rate change to downsample from the
-// end of the current buffer into a temporary
-// holding location
-//-------------------------------------------------
-
-void stream_buffer::backfill_downsample(sample_t *dest, int samples, attotime newend, attotime newperiod)
+template<typename S> void emu::detail::output_buffer_flat<S>::sync()
{
- // compute the time of the first sample to be backfilled; start one period before
- attotime time = newend - newperiod;
+ m_sync_sample += m_write_position - m_sync_position;
+ m_sync_position = m_write_position;
+}
- // loop until we run out of buffered data
- int dstindex;
- for (dstindex = 0; dstindex < samples && time.seconds() >= 0; dstindex++)
- {
- u32 srcindex = time_to_buffer_index(time, false);
-#if (SOUND_DEBUG)
- // multiple resamples can occur before clearing out old NaNs so
- // neuter them for this specific case
- if (std::isnan(m_buffer[srcindex]))
- dest[dstindex] = 0;
+template<typename S> void emu::detail::output_buffer_flat<S>::set_history(u32 history)
+{
+ m_history = history;
+ if(m_sync_position < m_history) {
+ u32 delta = m_history - m_sync_position;
+ if(m_write_position)
+ for(u32 channel = 0; channel != m_channels; channel++) {
+ std::copy_backward(m_buffer[channel].begin(), m_buffer[channel].begin() + m_write_position, m_buffer[channel].begin() + m_write_position + delta);
+ std::fill(m_buffer[channel].begin() + 1, m_buffer[channel].begin() + delta, m_buffer[channel][0]);
+ }
else
-#endif
- dest[dstindex] = get(srcindex);
- time -= newperiod;
+ for(u32 channel = 0; channel != m_channels; channel++)
+ std::fill(m_buffer[channel].begin(), m_buffer[channel].begin() + m_history, 0.0);
+
+ m_write_position += delta;
+ m_sync_position = m_history;
}
- for ( ; dstindex < samples; dstindex++)
- dest[dstindex] = 0;
}
+template<typename S> void emu::detail::output_buffer_flat<S>::resample(u32 previous_rate, u32 next_rate, attotime sync_time, attotime now)
+{
+ if(!m_write_position)
+ return;
-//-------------------------------------------------
-// backfill_upsample - this is called AFTER the
-// sample rate change to take a copied buffer
-// of samples at the old rate and upsample them
-// to the new (current) rate
-//-------------------------------------------------
+ auto si = [](attotime time, u32 rate) -> s64 {
+ return time.m_seconds * rate + ((time.m_attoseconds / 100'000'000) * rate) / 10'000'000'000LL;
+ };
+
+ auto cv = [](u32 source_rate, u32 dest_rate, s64 time) -> std::pair<s64, double> {
+ s64 sec = time / source_rate;
+ s64 prem = time % source_rate;
+ double nrem = double(prem * dest_rate) / double(source_rate);
+ s64 cyc = s64(nrem);
+ return std::make_pair(sec * dest_rate + cyc, nrem - cyc);
+ };
+
+ // Compute what will be the new start, sync and write positions (if it fits)
+ s64 nsync = si(sync_time, next_rate);
+ s64 nwrite = si(now, next_rate);
+ s64 pbase = m_sync_sample - m_sync_position; // Beware, pbase can be negative at startup due to history size
+ auto [nbase, nbase_dec] = cv(previous_rate, next_rate, pbase < 0 ? 0 : pbase);
+ nbase += 1;
+ if(nbase > nsync)
+ nbase = nsync;
+
+ u32 space = m_buffer[0].size();
+ if(nwrite - nbase > space) {
+ nbase = nwrite - space;
+ if(nbase > nsync)
+ fatalerror("Stream buffer too small, can't proceed, rate change %d -> %d, space=%d\n", previous_rate, next_rate, space);
+ }
-void stream_buffer::backfill_upsample(sample_t const *src, int samples, attotime prevend, attotime prevperiod)
-{
- // compute the time of the first sample to be backfilled; start one period before
- attotime time = end_time() - sample_period();
+ auto [ppos, pdec] = cv(next_rate, previous_rate, nbase);
+ if(ppos < pbase || ppos > pbase + m_write_position)
+ fatalerror("Something went very wrong, ppos=%d, pbase=%d, pbase+wp=%d\n", ppos, pbase, pbase + m_write_position);
- // also adjust the buffered sample end time to point to the sample time of the
- // final sample captured
- prevend -= prevperiod;
+ double step = double(previous_rate) / double(next_rate);
+ u32 pindex = ppos - pbase;
+ u32 nend = nwrite - nbase;
- // loop until we run out of buffered data
- u32 end = m_end_sample;
- int srcindex = 0;
- while (1)
- {
- // if our backfill time is before the current buffered sample time,
- // back up until we have a sample that covers this time
- while (time < prevend && srcindex < samples)
- {
- prevend -= prevperiod;
- srcindex++;
- }
+ // Warning: don't try to be too clever, the m_buffer storage is
+ // registered in the save state system, so it must not move or
+ // change size
- // stop when we run out of source
- if (srcindex >= samples)
- break;
+ std::vector<S> copy(m_write_position);
+ for(u32 channel = 0; channel != m_channels; channel++) {
+ std::copy(m_buffer[channel].begin(), m_buffer[channel].begin() + m_write_position, copy.begin());
+
+ // Interpolate the buffer contents
- // write this sample at the pevious position
- end = prev_index(end);
- put(end, src[srcindex]);
+ for(u32 nindex = 0; nindex != nend; nindex++) {
+ u32 pi0 = std::clamp(pindex, 0U, m_write_position - 1);
+ u32 pi1 = std::clamp(pindex + 1, 0U, m_write_position - 1);
+ m_buffer[channel][nindex] = copy[pi0] * (1-pdec) + copy[pi1] * pdec;
- // back up to the next sample time
- time -= sample_period();
+ pdec += step;
+ if(pdec >= 1) {
+ int s = s32(pdec);
+ pindex += s;
+ pdec -= s;
+ }
+ }
}
-}
+ m_sync_sample = nsync;
+ m_sync_position = m_sync_sample - nbase;
+ m_write_position = nend;
+ // history and the associated resizes are taken into account later
+}
-//**************************************************************************
-// SOUND STREAM OUTPUT
-//**************************************************************************
+template class emu::detail::output_buffer_flat<sound_stream::sample_t>;
+template class emu::detail::output_buffer_interleaved<s16>;
-//-------------------------------------------------
-// sound_stream_output - constructor
-//-------------------------------------------------
-sound_stream_output::sound_stream_output() :
- m_stream(nullptr),
- m_index(0),
- m_gain(1.0)
+// Not inline because with the unique_ptr it would require audio_effect in emu.h
+
+sound_manager::effect_step::effect_step(u32 buffer_size, u32 channels) : m_buffer(buffer_size, channels)
{
}
-//-------------------------------------------------
-// init - initialization
-//-------------------------------------------------
+//**// Streams and routes
-void sound_stream_output::init(sound_stream &stream, u32 index, char const *tag)
+sound_stream::sound_stream(device_t &device, u32 inputs, u32 outputs, u32 sample_rate, stream_update_delegate callback, sound_stream_flags flags) :
+ m_device(device),
+ m_output_buffer(0, outputs),
+ m_sample_rate(sample_rate == SAMPLE_RATE_INPUT_ADAPTIVE || sample_rate == SAMPLE_RATE_OUTPUT_ADAPTIVE || sample_rate == SAMPLE_RATE_ADAPTIVE ? 0 : sample_rate),
+ m_input_count(inputs),
+ m_output_count(outputs),
+ m_input_adaptive(sample_rate == SAMPLE_RATE_INPUT_ADAPTIVE || sample_rate == SAMPLE_RATE_ADAPTIVE),
+ m_output_adaptive(sample_rate == SAMPLE_RATE_OUTPUT_ADAPTIVE || sample_rate == SAMPLE_RATE_ADAPTIVE),
+ m_synchronous((flags & STREAM_SYNCHRONOUS) != 0),
+ m_started(false),
+ m_in_update(false),
+ m_sync_timer(nullptr),
+ m_callback(std::move(callback))
{
- // set the passed-in data
- m_stream = &stream;
- m_index = index;
+ sound_assert(outputs > 0 || inputs > 0);
- // save our state
- auto &save = stream.device().machine().save();
- save.save_item(&stream.device(), "stream.output", tag, index, NAME(m_gain));
+ // create a name
+ m_name = m_device.name();
+ m_name += " '";
+ m_name += m_device.tag();
+ m_name += "'";
-#if (LOG_OUTPUT_WAV)
- std::string filename = stream.device().machine().basename();
- filename += stream.device().tag();
- for (int index = 0; index < filename.size(); index++)
- if (filename[index] == ':')
- filename[index] = '_';
- if (dynamic_cast<default_resampler_stream *>(&stream) != nullptr)
- filename += "_resampler";
- filename += "_OUT_";
- char buf[10];
- sprintf(buf, "%d", index);
- filename += buf;
- filename += ".wav";
- m_buffer.open_wav(filename.c_str());
-#endif
-}
+ // create an update timer for synchronous streams
+ if(synchronous())
+ m_sync_timer = m_device.timer_alloc(FUNC(sound_stream::sync_update), this);
+ // create the gain vectors
+ m_input_channel_gain.resize(m_input_count, 1.0);
+ m_output_channel_gain.resize(m_output_count, 1.0);
+ m_user_output_channel_gain.resize(m_output_count, 1.0);
+ m_user_output_gain = 1.0;
-//-------------------------------------------------
-// name - return the friendly name of this output
-//-------------------------------------------------
+}
-std::string sound_stream_output::name() const
+sound_stream::~sound_stream()
{
- // start with our owning stream's name
- std::ostringstream str;
- util::stream_format(str, "%s Ch.%d", m_stream->name(), m_stream->output_base() + m_index);
- return str.str();
}
+void sound_stream::add_bw_route(sound_stream *source, int output, int input, float gain)
+{
+ m_bw_routes.emplace_back(route_bw(source, output, input, gain));
+}
-//-------------------------------------------------
-// optimize_resampler - optimize resamplers by
-// either returning the native rate or another
-// input's resampler if they can be reused
-//-------------------------------------------------
-
-sound_stream_output &sound_stream_output::optimize_resampler(sound_stream_output *input_resampler)
+void sound_stream::add_fw_route(sound_stream *target, int input, int output)
{
- // if no resampler, or if the resampler rate matches our rate, return ourself
- if (input_resampler == nullptr || buffer_sample_rate() == input_resampler->buffer_sample_rate())
- return *this;
+ m_fw_routes.emplace_back(route_fw(target, input, output));
+}
- // scan our list of resamplers to see if there's another match
- for (auto &resampler : m_resampler_list)
- if (resampler->buffer_sample_rate() == input_resampler->buffer_sample_rate())
- return *resampler;
+bool sound_stream::set_route_gain(sound_stream *source, int source_channel, int target_channel, float gain)
+{
+ for(auto &r : m_bw_routes)
+ if(r.m_source == source && r.m_output == source_channel && r.m_input == target_channel) {
+ r.m_gain = gain;
+ return true;
+ }
+ return false;
+}
- // add the input to our list and return the one we were given back
- m_resampler_list.push_back(input_resampler);
- return *input_resampler;
+std::vector<sound_stream *> sound_stream::sources() const
+{
+ std::vector<sound_stream *> streams;
+ for(const route_bw &route : m_bw_routes) {
+ sound_stream *stream = route.m_source;
+ for(const sound_stream *s : streams)
+ if(s == stream)
+ goto already;
+ streams.push_back(stream);
+ already:;
+ }
+ return streams;
}
+std::vector<sound_stream *> sound_stream::targets() const
+{
+ std::vector<sound_stream *> streams;
+ for(const route_fw &route : m_fw_routes) {
+ sound_stream *stream = route.m_target;
+ for(const sound_stream *s : streams)
+ if(s == stream)
+ goto already;
+ streams.push_back(stream);
+ already:;
+ }
+ return streams;
+}
+void sound_stream::register_state()
+{
+ // create a unique tag for saving
+ m_state_tag = string_format("%d", m_device.machine().sound().unique_id());
+ auto &save = m_device.machine().save();
-//**************************************************************************
-// SOUND STREAM INPUT
-//**************************************************************************
+ save.save_item(&m_device, "stream.sound_stream", m_state_tag.c_str(), 0, NAME(m_sample_rate));
+ if(m_input_count)
+ save.save_item(&m_device, "stream.sound_stream", m_state_tag.c_str(), 0, NAME(m_input_channel_gain));
+ if(m_output_count)
+ save.save_item(&m_device, "stream.sound_stream", m_state_tag.c_str(), 0, NAME(m_output_channel_gain));
+ // user gains go to .cfg files, not state files
-//-------------------------------------------------
-// sound_stream_input - constructor
-//-------------------------------------------------
+ m_output_buffer.register_save_state(m_device, "stream.sound_stream.output_buffer", m_state_tag.c_str());
-sound_stream_input::sound_stream_input() :
- m_owner(nullptr),
- m_native_source(nullptr),
- m_resampler_source(nullptr),
- m_index(0),
- m_gain(1.0),
- m_user_gain(1.0)
-{
+ for(unsigned int i=0; i != m_bw_routes.size(); i++)
+ save.save_item(&m_device, "stream.sound_stream", m_state_tag.c_str(), i, m_bw_routes[i].m_gain, "route_gain");
}
-//-------------------------------------------------
-// init - initialization
-//-------------------------------------------------
-
-void sound_stream_input::init(sound_stream &stream, u32 index, char const *tag, sound_stream_output *resampler)
+void sound_stream::compute_dependants()
{
- // set the passed-in values
- m_owner = &stream;
- m_index = index;
- m_resampler_source = resampler;
+ m_dependant_streams.clear();
+ for(const route_bw &r : m_bw_routes)
+ r.m_source->add_dependants(m_dependant_streams);
+}
- // save our state
- auto &save = stream.device().machine().save();
- save.save_item(&stream.device(), "stream.input", tag, index, NAME(m_gain));
- save.save_item(&stream.device(), "stream.input", tag, index, NAME(m_user_gain));
+void sound_stream::add_dependants(std::vector<sound_stream *> &deps)
+{
+ for(const route_bw &r : m_bw_routes)
+ r.m_source->add_dependants(deps);
+ for(sound_stream *dep : deps)
+ if(dep == this)
+ return;
+ deps.push_back(this);
}
-//-------------------------------------------------
-// name - return the friendly name of this input
-//-------------------------------------------------
+//**// Stream sample rate
-std::string sound_stream_input::name() const
+void sound_stream::set_sample_rate(u32 new_rate)
{
- // start with our owning stream's name
- std::ostringstream str;
- util::stream_format(str, "%s", m_owner->name());
-
- // if we have a source, indicate where the sound comes from by device name and tag
- if (valid())
- util::stream_format(str, " <- %s", m_native_source->name());
- return str.str();
+ m_input_adaptive = m_output_adaptive = false;
+ internal_set_sample_rate(new_rate);
}
+void sound_stream::internal_set_sample_rate(u32 new_rate)
+{
+ if(m_started) {
+ update();
+ m_output_buffer.resample(m_sample_rate, new_rate, m_sync_time, m_device.machine().time());
+ m_sample_rate = new_rate;
+ for(const route_fw &r : m_fw_routes)
+ r.m_target->create_resamplers();
+ create_resamplers();
+ lookup_history_sizes();
-//-------------------------------------------------
-// set_source - wire up the output source for
-// our consumption
-//-------------------------------------------------
+ } else
+ m_sample_rate = new_rate;
+}
-void sound_stream_input::set_source(sound_stream_output *source)
+bool sound_stream::try_solving_frequency()
{
- m_native_source = source;
- if (m_resampler_source != nullptr)
- m_resampler_source->stream().set_input(0, &source->stream(), source->index());
+ if(frequency_is_solved())
+ return false;
+
+ if(input_adaptive() && !output_adaptive()) {
+ u32 freq = 0;
+ for(const route_bw &r : m_bw_routes) {
+ if(!r.m_source->frequency_is_solved())
+ return false;
+ if(freq < r.m_source->sample_rate())
+ freq = r.m_source->sample_rate();
+ }
+ m_sample_rate = freq;
+ return true;
+
+ } else if(output_adaptive() && !input_adaptive()) {
+ u32 freq = 0;
+ for(const route_fw &r : m_fw_routes) {
+ if(!r.m_target->frequency_is_solved())
+ return false;
+ if(freq < r.m_target->sample_rate())
+ freq = r.m_target->sample_rate();
+ }
+ m_sample_rate = freq;
+ return true;
+
+ } else {
+ u32 freqbw = 0;
+ for(const route_bw &r : m_bw_routes) {
+ if(!r.m_source->frequency_is_solved()) {
+ freqbw = 0;
+ break;
+ }
+ if(freqbw < r.m_source->sample_rate())
+ freqbw = r.m_source->sample_rate();
+ }
+ u32 freqfw = 0;
+ for(const route_fw &r : m_fw_routes) {
+ if(!r.m_target->frequency_is_solved()) {
+ freqfw = 0;
+ break;
+ }
+ if(freqfw < r.m_target->sample_rate())
+ freqfw = r.m_target->sample_rate();
+ }
+ if(!freqbw && !freqfw)
+ return false;
+
+ m_sample_rate = freqfw > freqbw ? freqfw : freqbw;
+ return true;
+ }
}
-//-------------------------------------------------
-// update - update our source's stream to the
-// current end time and return a view to its
-// contents
-//-------------------------------------------------
+//**// Stream flow and updates
-read_stream_view sound_stream_input::update(attotime start, attotime end)
+void sound_stream::init()
{
- // shouldn't get here unless valid
- sound_assert(valid());
+ // Ensure the buffer size is non-zero, since a stream can be started at any time
+ u32 bsize = m_sample_rate ? m_sample_rate : 48000;
+ m_input_buffer.resize(m_input_count);
+ for(auto &b : m_input_buffer)
+ b.resize(bsize);
- // pick an optimized resampler
- sound_stream_output &source = m_native_source->optimize_resampler(m_resampler_source);
+ m_output_buffer.set_buffer_size(bsize);
- // if not using our own resampler, keep it up to date in case we need to invoke it later
- if (m_resampler_source != nullptr && &source != m_resampler_source)
- m_resampler_source->set_end_time(end);
+ m_samples_to_update = 0;
+ m_started = true;
+ if(synchronous())
+ reprime_sync_timer();
+}
- // update the source, returning a view of the needed output over the start and end times
- return source.stream().update_view(start, end, source.index()).apply_gain(m_gain * m_user_gain * source.gain());
+u64 sound_stream::get_current_sample_index() const
+{
+ attotime now = m_device.machine().time();
+ return now.m_seconds * m_sample_rate + ((now.m_attoseconds / 1'000'000'000) * m_sample_rate) / 1'000'000'000;
}
+void sound_stream::update()
+{
+ if(!is_active() || m_in_update)
+ return;
-//-------------------------------------------------
-// apply_sample_rate_changes - tell our sources
-// to apply any sample rate changes, informing
-// them of our current rate
-//-------------------------------------------------
+ // Find out where we are and how much we have to do
+ u64 idx = get_current_sample_index();
+ m_samples_to_update = idx - m_output_buffer.write_sample();
-void sound_stream_input::apply_sample_rate_changes(u32 updatenum, u32 downstream_rate)
-{
- // shouldn't get here unless valid
- sound_assert(valid());
+ if(m_samples_to_update > 0) {
+ m_in_update = true;
- // if we have a resampler, tell it (and it will tell the native source)
- if (m_resampler_source != nullptr)
- m_resampler_source->stream().apply_sample_rate_changes(updatenum, downstream_rate);
+ // If there's anything to do, well, do it, starting with the dependencies
+ for(auto &stream : m_dependant_streams)
+ stream->update_nodeps();
- // otherwise, just tell the native source directly
- else
- m_native_source->stream().apply_sample_rate_changes(updatenum, downstream_rate);
+ do_update();
+ m_in_update = false;
+ }
+ m_samples_to_update = 0;
}
+void sound_stream::update_nodeps()
+{
+ if(!is_active() || m_in_update)
+ return;
+ // Find out where we are and how much we have to do
+ u64 idx = get_current_sample_index();
+ m_samples_to_update = idx - m_output_buffer.write_sample();
-//**************************************************************************
-// SOUND STREAM
-//**************************************************************************
+ if(m_samples_to_update > 0) {
+ m_in_update = true;
-//-------------------------------------------------
-// sound_stream - private common constructor
-//-------------------------------------------------
+ // If there's anything to do, well, do it
+ do_update();
+ m_in_update = false;
+ }
+ m_samples_to_update = 0;
+}
-sound_stream::sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output_base, u32 sample_rate, sound_stream_flags flags) :
- m_device(device),
- m_next(nullptr),
- m_sample_rate((sample_rate < SAMPLE_RATE_MINIMUM) ? (SAMPLE_RATE_MINIMUM - 1) : (sample_rate < SAMPLE_RATE_OUTPUT_ADAPTIVE) ? sample_rate : 48000),
- m_pending_sample_rate(SAMPLE_RATE_INVALID),
- m_last_sample_rate_update(0),
- m_input_adaptive(sample_rate == SAMPLE_RATE_INPUT_ADAPTIVE),
- m_output_adaptive(sample_rate == SAMPLE_RATE_OUTPUT_ADAPTIVE),
- m_synchronous((flags & STREAM_SYNCHRONOUS) != 0),
- m_resampling_disabled((flags & STREAM_DISABLE_INPUT_RESAMPLING) != 0),
- m_sync_timer(nullptr),
- m_last_update_end_time(attotime::zero),
- m_input(inputs),
- m_input_view(inputs),
- m_empty_buffer(100),
- m_output_base(output_base),
- m_output(outputs),
- m_output_view(outputs)
+void sound_stream::create_resamplers()
{
- sound_assert(outputs > 0);
+ if(!is_active()) {
+ for(auto &r : m_bw_routes)
+ r.m_resampler = nullptr;
+ return;
+ }
- // create a name
- m_name = m_device.name();
- m_name += " '";
- m_name += m_device.tag();
- m_name += "'";
+ for(auto &r : m_bw_routes)
+ if(r.m_source->is_active() && r.m_source->sample_rate() != m_sample_rate)
+ r.m_resampler = m_device.machine().sound().get_resampler(r.m_source->sample_rate(), m_sample_rate);
+ else
+ r.m_resampler = nullptr;
+}
- // create a unique tag for saving
- std::string state_tag = string_format("%d", m_device.machine().sound().unique_id());
- auto &save = m_device.machine().save();
- save.save_item(&m_device, "stream.sound_stream", state_tag.c_str(), 0, NAME(m_sample_rate));
- save.save_item(&m_device, "stream.sound_stream", state_tag.c_str(), 0, NAME(m_last_update_end_time));
- save.register_postload(save_prepost_delegate(FUNC(sound_stream::postload), this));
- save.register_presave(save_prepost_delegate(FUNC(sound_stream::presave), this));
+void sound_stream::lookup_history_sizes()
+{
+ u32 history = 0;
+ for(auto &r : m_fw_routes) {
+ u32 h = r.m_target->get_history_for_bw_route(this, r.m_output);
+ if(h > history)
+ history = h;
+ }
- // initialize all inputs
- for (unsigned int inputnum = 0; inputnum < m_input.size(); inputnum++)
- {
- // allocate a resampler stream if needed, and get a pointer to its output
- sound_stream_output *resampler = nullptr;
- if (!m_resampling_disabled)
- {
- m_resampler_list.push_back(std::make_unique<default_resampler_stream>(m_device));
- resampler = &m_resampler_list.back()->m_output[0];
+ m_output_buffer.set_history(history);
+}
+
+u32 sound_stream::get_history_for_bw_route(const sound_stream *source, u32 channel) const
+{
+ u32 history = 0;
+ for(auto &r : m_bw_routes)
+ if(r.m_source == source && r.m_output == channel && r.m_resampler) {
+ u32 h = r.m_resampler->history_size();
+ if(h > history)
+ history = h;
}
+ return history;
+}
- // add the new input
- m_input[inputnum].init(*this, inputnum, state_tag.c_str(), resampler);
+void sound_stream::do_update()
+{
+ // Mix in all the inputs (if any)
+ if(m_input_count) {
+ for(auto &b : m_input_buffer)
+ std::fill(b.begin(), b.begin() + m_samples_to_update, 0.0);
+ for(const auto &r : m_bw_routes) {
+ if(!r.m_source->is_active())
+ continue;
+
+ float gain = r.m_source->m_user_output_gain * r.m_source->m_output_channel_gain[r.m_output] * r.m_source->m_user_output_channel_gain[r.m_output] * r.m_gain * m_input_channel_gain[r.m_input];
+ auto &db = m_input_buffer[r.m_input];
+ if(r.m_resampler)
+ r.m_resampler->apply(r.m_source->m_output_buffer, db, m_output_buffer.write_sample(), r.m_output, gain, m_samples_to_update);
+
+ else {
+ const sample_t *sb = r.m_source->m_output_buffer.ptrs(r.m_output, m_output_buffer.write_sample() - r.m_source->m_output_buffer.sync_sample());
+ for(u32 i = 0; i != m_samples_to_update; i++)
+ db[i] += sb[i] * gain;
+ }
+ }
}
- // initialize all outputs
- for (unsigned int outputnum = 0; outputnum < m_output.size(); outputnum++)
- m_output[outputnum].init(*this, outputnum, state_tag.c_str());
+ // Prepare the output space (if any)
+ m_output_buffer.prepare_space(m_samples_to_update);
- // create an update timer for synchronous streams
- if (synchronous())
- m_sync_timer = m_device.timer_alloc(FUNC(sound_stream::sync_update), this);
+ // Call the callback
+ m_callback(*this);
- // force an update to the sample rates
- sample_rate_changed();
+ // Update the indexes
+ m_output_buffer.commit(m_samples_to_update);
}
-
-//-------------------------------------------------
-// sound_stream - constructor
-//-------------------------------------------------
-
-sound_stream::sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output_base, u32 sample_rate, stream_update_delegate callback, sound_stream_flags flags) :
- sound_stream(device, inputs, outputs, output_base, sample_rate, flags)
+void sound_stream::sync(attotime now)
{
- m_callback_ex = std::move(callback);
+ m_sync_time = now;
+ m_output_buffer.sync();
}
-//-------------------------------------------------
-// ~sound_stream - destructor
-//-------------------------------------------------
-sound_stream::~sound_stream()
+
+attotime sound_stream::sample_to_time(u64 index) const
{
+ attotime res = attotime::zero;
+ res.m_seconds = index / m_sample_rate;
+ u64 remain = index % m_sample_rate;
+ res.m_attoseconds = ((remain * 1000000000) / m_sample_rate) * 1000000000;
+ return res;
}
-//-------------------------------------------------
-// set_sample_rate - set the sample rate on a
-// given stream
-//-------------------------------------------------
+//**// Synchronous stream updating
-void sound_stream::set_sample_rate(u32 new_rate)
+void sound_stream::reprime_sync_timer()
{
- // we will update this on the next global update
- if (new_rate != sample_rate())
- m_pending_sample_rate = new_rate;
+ if(!is_active())
+ return;
+
+ u64 next_sample = m_output_buffer.write_sample() + 1;
+ attotime next_time = sample_to_time(next_sample);
+ next_time.m_attoseconds += 1000000000; // Go to the next nanosecond
+ m_sync_timer->adjust(next_time - m_device.machine().time());
}
+void sound_stream::sync_update(s32)
+{
+ update();
+ reprime_sync_timer();
+}
-//-------------------------------------------------
-// set_input - configure a stream's input
-//-------------------------------------------------
-void sound_stream::set_input(int index, sound_stream *input_stream, int output_index, float gain)
+//**// Sound manager and stream allocation
+sound_manager::sound_manager(running_machine &machine) :
+ m_machine(machine),
+ m_update_timer(nullptr),
+ m_last_sync_time(attotime::zero),
+ m_effects_thread(nullptr),
+ m_effects_done(false),
+ m_master_gain(1.0),
+ m_muted(0),
+ m_nosound_mode(machine.osd().no_sound()),
+ m_unique_id(0),
+ m_wavfile()
{
- LOG("stream_set_input(%p, '%s', %d, %p, %d, %f)\n", (void *)this, m_device.tag(),
- index, (void *)input_stream, output_index, gain);
+ // register callbacks
+ machine.configuration().config_register(
+ "mixer",
+ configuration_manager::load_delegate(&sound_manager::config_load, this),
+ configuration_manager::save_delegate(&sound_manager::config_save, this));
+ machine.add_notifier(MACHINE_NOTIFY_PAUSE, machine_notify_delegate(&sound_manager::pause, this));
+ machine.add_notifier(MACHINE_NOTIFY_RESUME, machine_notify_delegate(&sound_manager::resume, this));
+ machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(&sound_manager::reset, this));
+ machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(&sound_manager::stop_recording, this));
- // make sure it's a valid input
- if (index >= m_input.size())
- fatalerror("stream_set_input attempted to configure nonexistent input %d (%d max)\n", index, int(m_input.size()));
+ // register global states
+ // machine.save().save_item(NAME(m_last_update));
+
+ // start the periodic update flushing timer
+ m_update_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(sound_manager::update), this));
+ m_update_timer->adjust(STREAMS_UPDATE_ATTOTIME, 0, STREAMS_UPDATE_ATTOTIME);
- // make sure it's a valid output
- if (input_stream != nullptr && output_index >= input_stream->m_output.size())
- fatalerror("stream_set_input attempted to use a nonexistent output %d (%d max)\n", output_index, int(m_output.size()));
+ // mark the generation as "just starting"
+ m_osd_info.m_generation = 0xffffffff;
+}
- // wire it up
- m_input[index].set_source((input_stream != nullptr) ? &input_stream->m_output[output_index] : nullptr);
- m_input[index].set_gain(gain);
+sound_manager::~sound_manager()
+{
+ if(m_effects_thread) {
+ m_effects_done = true;
+ m_effects_condition.notify_all();
+ m_effects_thread->join();
+ m_effects_thread = nullptr;
+ }
+}
- // update sample rates now that we know the input
- sample_rate_changed();
+sound_stream *sound_manager::stream_alloc(device_t &device, u32 inputs, u32 outputs, u32 sample_rate, stream_update_delegate callback, sound_stream_flags flags)
+{
+ m_stream_list.push_back(std::make_unique<sound_stream>(device, inputs, outputs, sample_rate, callback, flags));
+ return m_stream_list.back().get();
}
-//-------------------------------------------------
-// update - force a stream to update to
-// the current emulated time
-//-------------------------------------------------
+//**// Sound system initialization
-void sound_stream::update()
+void sound_manager::before_devices_init()
{
- // ignore any update requests if we're already up to date
- attotime start = m_output[0].end_time();
- attotime end = m_device.machine().time();
- if (start >= end)
- return;
+ // Inform the targets of the existence of the routes
+ for(device_sound_interface &sound : sound_interface_enumerator(machine().root_device()))
+ sound.sound_before_devices_init();
- // regular update then
- update_view(start, end);
+ m_machine.save().register_postload(save_prepost_delegate(FUNC(sound_manager::postload), this));
}
-
-//-------------------------------------------------
-// update_view - force a stream to update to
-// the current emulated time and return a view
-// to the generated samples from the given
-// output number
-//-------------------------------------------------
-
-read_stream_view sound_stream::update_view(attotime start, attotime end, u32 outputnum)
+void sound_manager::postload()
{
- sound_assert(start <= end);
- sound_assert(outputnum < m_output.size());
+ std::unique_lock<std::mutex> lock(m_effects_mutex);
+ attotime now = machine().time();
+ for(osd_output_stream &stream : m_osd_output_streams) {
+ stream.m_last_sync = rate_and_time_to_index(now, stream.m_rate);
+ stream.m_samples = 0;
+ }
+}
- // clean up parameters for when the asserts go away
- if (outputnum >= m_output.size())
- outputnum = 0;
- if (start > end)
- start = end;
+void sound_manager::after_devices_init()
+{
+ // Link all the streams together
+ for(device_sound_interface &sound : sound_interface_enumerator(machine().root_device()))
+ sound.sound_after_devices_init();
+
+ // Resolve the frequencies
+ int need_to_solve = 0;
+ for(auto &stream : m_stream_list)
+ if(!stream->frequency_is_solved())
+ need_to_solve ++;
+
+ while(need_to_solve) {
+ int prev_need_to_solve = need_to_solve;
+ for(auto &stream : m_stream_list)
+ if(!stream->frequency_is_solved() && stream->try_solving_frequency())
+ need_to_solve --;
+ if(need_to_solve == prev_need_to_solve)
+ break;
+ }
- auto profile = g_profiler.start(PROFILER_SOUND);
+ if(need_to_solve) {
+ u32 def = machine().sample_rate();
+ for(auto &stream : m_stream_list)
+ if(!stream->frequency_is_solved())
+ stream->internal_set_sample_rate(def);
+ }
- // reposition our start to coincide with the current buffer end
- attotime update_start = m_output[outputnum].end_time();
- if (update_start <= end)
- {
- // create views for all the outputs
- for (unsigned int outindex = 0; outindex < m_output.size(); outindex++)
- m_output_view[outindex] = m_output[outindex].view(update_start, end);
-
- // skip if nothing to do
- u32 samples = m_output_view[0].samples();
- sound_assert(samples >= 0);
- if (samples != 0 && m_sample_rate >= SAMPLE_RATE_MINIMUM)
- {
- sound_assert(!synchronous() || samples == 1);
-
- // ensure all input streams are up to date, and create views for them as well
- for (unsigned int inputnum = 0; inputnum < m_input.size(); inputnum++)
- {
- if (m_input[inputnum].valid())
- m_input_view[inputnum] = m_input[inputnum].update(update_start, end);
- else
- m_input_view[inputnum] = empty_view(update_start, end);
- sound_assert(m_input_view[inputnum].samples() > 0);
- sound_assert(m_resampling_disabled || m_input_view[inputnum].sample_rate() == m_sample_rate);
- }
+ // Have all streams create their buffers and other initializations
+ for(auto &stream : m_stream_list)
+ stream->init();
+
+ // Detect loops and order streams for full update at the same time
+ // Check the number of sources for each stream
+ std::map<sound_stream *, int> depcounts;
+ for(auto &stream : m_stream_list)
+ depcounts[stream.get()] = stream->sources().size();
+
+ // Start from all the ones that don't depend on anything
+ std::vector<sound_stream *> ready_streams;
+ for(auto &dpc : depcounts)
+ if(dpc.second == 0)
+ ready_streams.push_back(dpc.first);
+
+ // Handle all the ready streams in a lifo matter (better for cache when generating sound)
+ while(!ready_streams.empty()) {
+ sound_stream *stream = ready_streams.back();
+ // add the stream to the update order
+ m_ordered_streams.push_back(stream);
+ ready_streams.resize(ready_streams.size() - 1);
+ // reduce the depcount for all the streams that depend on the updated stream
+ for(sound_stream *target : stream->targets())
+ if(!--depcounts[target])
+ // when the depcount is zero, a stream is ready to be updated
+ ready_streams.push_back(target);
+ }
-#if (SOUND_DEBUG)
- // clear each output view to NANs before we call the callback
- for (unsigned int outindex = 0; outindex < m_output.size(); outindex++)
- m_output_view[outindex].fill(NAN);
-#endif
+ // If not all streams ended up in the sorted list, we have a loop
+ if(m_ordered_streams.size() != m_stream_list.size()) {
+ // Apply the same algorithm from the other side to the
+ // remaining streams to only keep the ones in the loop
+
+ std::map<sound_stream *, int> inverted_depcounts;
+ for(auto &dpc : depcounts)
+ if(dpc.second)
+ inverted_depcounts[dpc.first] = dpc.first->targets().size();
+ for(auto &dpc : inverted_depcounts)
+ if(dpc.second == 0)
+ ready_streams.push_back(dpc.first);
+ while(!ready_streams.empty()) {
+ sound_stream *stream = ready_streams.back();
+ ready_streams.resize(ready_streams.size() - 1);
+ for(sound_stream *source : stream->sources())
+ if(!--inverted_depcounts[source])
+ ready_streams.push_back(source);
+ }
+ std::string stream_names;
+ for(auto &dpc : inverted_depcounts)
+ if(dpc.second)
+ stream_names += ' ' + dpc.first->name();
+ fatalerror("Loop detected in stream routes:%s", stream_names);
+ }
- // if we have an extended callback, that's all we need
- m_callback_ex(*this, m_input_view, m_output_view);
+ if(VERBOSE & LOG_ORDER) {
+ LOG_OUTPUT_FUNC("Order:\n");
+ for(sound_stream *s : m_ordered_streams)
+ LOG_OUTPUT_FUNC("- %s (%d)\n", s->name().c_str(), s->sample_rate());
+ }
-#if (SOUND_DEBUG)
- // make sure everything was overwritten
- for (unsigned int outindex = 0; outindex < m_output.size(); outindex++)
- for (int sampindex = 0; sampindex < m_output_view[outindex].samples(); sampindex++)
- m_output_view[outindex].get(sampindex);
+ // Registrations for state saving
+ for(auto &stream : m_stream_list)
+ stream->register_state();
+
+ // Compute all the per-stream orders for update()
+ for(auto &stream : m_stream_list)
+ stream->compute_dependants();
+
+ // Create the default effect chain
+ for(u32 effect = 0; effect != audio_effect::COUNT; effect++)
+ m_default_effects.emplace_back(audio_effect::create(effect, machine().sample_rate(), nullptr));
+
+ // Inventory speakers and microphones
+ m_outputs_count = 0;
+ for(speaker_device &dev : speaker_device_enumerator(machine().root_device())) {
+ dev.set_id(m_speakers.size());
+ m_speakers.emplace_back(speaker_info(dev, machine().sample_rate(), m_outputs_count));
+ for(u32 effect = 0; effect != audio_effect::COUNT; effect++)
+ m_speakers.back().m_effects[effect].m_effect.reset(audio_effect::create(effect, machine().sample_rate(), m_default_effects[effect].get()));
+ m_outputs_count += dev.inputs();
+ }
- for (unsigned int outindex = 0; outindex < m_output.size(); outindex++)
- m_output[outindex].m_buffer.flush_wav();
-#endif
- }
+ for(microphone_device &dev : microphone_device_enumerator(machine().root_device())) {
+ dev.set_id(m_microphones.size());
+ m_microphones.emplace_back(microphone_info(dev));
}
- // return the requested view
- return read_stream_view(m_output_view[outputnum], start);
-}
+ // Allocate the buffer to pass for recording
+ m_record_buffer.resize(m_outputs_count * machine().sample_rate(), 0);
+ m_record_samples = 0;
+ // Have all streams create their initial resamplers
+ for(auto &stream : m_stream_list)
+ stream->create_resamplers();
-//-------------------------------------------------
-// apply_sample_rate_changes - if there is a
-// pending sample rate change, apply it now
-//-------------------------------------------------
+ // Then get the initial history sizes
+ for(auto &stream : m_stream_list)
+ stream->lookup_history_sizes();
-void sound_stream::apply_sample_rate_changes(u32 updatenum, u32 downstream_rate)
-{
- // grab the new rate and invalidate
- u32 new_rate = (m_pending_sample_rate != SAMPLE_RATE_INVALID) ? m_pending_sample_rate : m_sample_rate;
- m_pending_sample_rate = SAMPLE_RATE_INVALID;
+ m_effects_done = false;
- // clamp to the minimum - 1 (anything below minimum means "off" and
- // will not call the sound callback at all)
- if (new_rate < SAMPLE_RATE_MINIMUM)
- new_rate = SAMPLE_RATE_MINIMUM - 1;
+ m_effects_thread = std::make_unique<std::thread>(
+ [this]{ run_effects(); });
+}
- // if we're input adaptive, override with the rate of our input
- if (input_adaptive() && m_input.size() > 0 && m_input[0].valid())
- new_rate = m_input[0].source().stream().sample_rate();
- // if we're output adaptive, override with the rate of our output
- if (output_adaptive())
- {
- if (m_last_sample_rate_update == updatenum)
- sound_assert(new_rate == m_sample_rate);
- else
- m_last_sample_rate_update = updatenum;
- new_rate = downstream_rate;
- }
+//**// Effects, input and output management
- // if something is different, process the change
- if (new_rate != SAMPLE_RATE_INVALID && new_rate != m_sample_rate)
- {
- // update to the new rate and notify everyone
-#if (SOUND_DEBUG)
- printf("stream %s changing rates %d -> %d\n", name().c_str(), m_sample_rate, new_rate);
-#endif
- m_sample_rate = new_rate;
- sample_rate_changed();
+void sound_manager::input_get(int id, sound_stream &stream)
+{
+ u32 samples = stream.samples();
+ u64 end_pos = stream.sample_index();
+ u32 skip = stream.output_count();
+
+ for(const auto &step : m_microphones[id].m_input_mixing_steps) {
+ auto get_source = [&istream = m_osd_input_streams[step.m_osd_index], this](u32 samples, u64 end_pos, u32 channel) -> const s16 * {
+ if(istream.m_buffer.write_sample() < end_pos) {
+ u32 needed = end_pos - istream.m_buffer.write_sample();
+ istream.m_buffer.prepare_space(needed);
+ machine().osd().sound_stream_source_update(istream.m_id, istream.m_buffer.ptrw(0, 0), needed);
+ istream.m_buffer.commit(needed);
+ }
+ return istream.m_buffer.ptrs(channel, end_pos - samples - istream.m_buffer.sync_sample());
+ };
+
+ switch(step.m_mode) {
+ case mixing_step::CLEAR:
+ case mixing_step::COPY:
+ fatalerror("Impossible step encountered in input\n");
+
+ case mixing_step::ADD: {
+ const s16 *src = get_source(samples, end_pos, step.m_osd_channel);
+ float gain = step.m_linear_volume / 32768.0;
+ for(u32 sample = 0; sample != samples; sample++) {
+ stream.add(step.m_device_channel, sample, *src * gain);
+ src += skip;
+ }
+ break;
+ }
+ }
}
+}
- // now call through our inputs and apply the rate change there
- for (auto &input : m_input)
- if (input.valid())
- input.apply_sample_rate_changes(updatenum, m_sample_rate);
+void sound_manager::output_push(int id, sound_stream &stream)
+{
+ auto &spk = m_speakers[id];
+ auto &out = spk.m_buffer;
+ auto &inp = stream.m_input_buffer;
+ int samples = stream.samples();
+ int channels = stream.input_count();
+ out.prepare_space(samples);
+ for(int channel = 0; channel != channels; channel ++)
+ std::copy(inp[channel].begin(), inp[channel].begin() + samples, out.ptrw(channel, 0));
+ out.commit(samples);
+
+ m_record_samples = samples;
+ s16 *outb = m_record_buffer.data() + spk.m_first_output;
+ for(int channel = 0; channel != channels; channel ++) {
+ s16 *outb1 = outb;
+ const float *inb = inp[channel].data();
+ for(int sample = 0; sample != samples; sample++) {
+ *outb1 = std::clamp(int(*inb++ * 32768), -32768, 32767);
+ outb1 += m_outputs_count;
+ }
+ }
}
+void sound_manager::run_effects()
+{
+ std::unique_lock<std::mutex> lock(m_effects_mutex);
+ for(;;) {
+ m_effects_condition.wait(lock);
+ if(m_effects_done)
+ return;
+
+ // Apply the effects
+ for(auto &si : m_speakers)
+ for(u32 i=0; i != si.m_effects.size(); i++) {
+ auto &source = i ? si.m_effects[i-1].m_buffer : si.m_buffer;
+ si.m_effects[i].m_effect->apply(source, si.m_effects[i].m_buffer);
+ source.sync();
+ }
-//-------------------------------------------------
-// print_graph_recursive - helper for debugging;
-// prints info on this stream and then recursively
-// prints info on all inputs
-//-------------------------------------------------
+ // Apply the mixing steps
+ for(const auto &step : m_output_mixing_steps) {
+ const sample_t *src = step.m_mode == mixing_step::CLEAR ? nullptr : m_speakers[step.m_device_index].m_effects.back().m_buffer.ptrs(step.m_device_channel, 0);
-#if (SOUND_DEBUG)
-void sound_stream::print_graph_recursive(int indent, int index)
-{
- osd_printf_info("%*s%s Ch.%d @ %d\n", indent, "", name(), index + m_output_base, sample_rate());
- for (int index = 0; index < m_input.size(); index++)
- if (m_input[index].valid())
- {
- if (m_input[index].m_resampler_source != nullptr)
- m_input[index].m_resampler_source->stream().print_graph_recursive(indent + 2, m_input[index].m_resampler_source->index());
- else
- m_input[index].m_native_source->stream().print_graph_recursive(indent + 2, m_input[index].m_native_source->index());
- }
-}
-#endif
+ auto &ostream = m_osd_output_streams[step.m_osd_index];
+ u32 samples = ostream.m_samples;
+ s16 *dest = ostream.m_buffer.data() + step.m_osd_channel;
+ u32 skip = ostream.m_channels;
+ switch(step.m_mode) {
+ case mixing_step::CLEAR:
+ for(u32 sample = 0; sample != samples; sample++) {
+ *dest = 0;
+ dest += skip;
+ }
+ break;
-//-------------------------------------------------
-// sample_rate_changed - recompute sample
-// rate data, and all streams that are affected
-// by this stream
-//-------------------------------------------------
+ case mixing_step::COPY: {
+ float gain = 32768 * step.m_linear_volume * m_master_gain;
+ for(u32 sample = 0; sample != samples; sample++) {
+ *dest = std::clamp(int(*src++ * gain), -32768, 32767);
+ dest += skip;
+ }
+ break;
+ }
-void sound_stream::sample_rate_changed()
-{
- // if invalid, just punt
- if (m_sample_rate == SAMPLE_RATE_INVALID)
- return;
+ case mixing_step::ADD: {
+ float gain = 32768 * step.m_linear_volume * m_master_gain;
+ for(u32 sample = 0; sample != samples; sample++) {
+ *dest = std::clamp(int(*src++ * gain) + *dest, -32768, 32767);
+ dest += skip;
+ }
+ break;
+ }
+ }
+ }
- // update all output buffers
- for (auto &output : m_output)
- output.sample_rate_changed(m_sample_rate);
+ for(auto &si : m_speakers)
+ si.m_effects.back().m_buffer.sync();
- // if synchronous, prime the timer
- if (synchronous())
- reprime_sync_timer();
+ // Send the result to the osd
+ for(auto &stream : m_osd_output_streams)
+ if(stream.m_samples)
+ machine().osd().sound_stream_sink_update(stream.m_id, stream.m_buffer.data(), stream.m_samples);
+ }
}
+std::string sound_manager::effect_chain_tag(s32 index) const
+{
+ return m_speakers[index].m_dev.tag();
+}
-//-------------------------------------------------
-// postload - save/restore callback
-//-------------------------------------------------
+std::vector<audio_effect *> sound_manager::effect_chain(s32 index) const
+{
+ std::vector<audio_effect *> res;
+ for(const auto &e : m_speakers[index].m_effects)
+ res.push_back(e.m_effect.get());
+ return res;
+}
-void sound_stream::postload()
+std::vector<audio_effect *> sound_manager::default_effect_chain() const
{
- // set the end time of all of our streams to the value saved in m_last_update_end_time
- for (auto &output : m_output)
- output.set_end_time(m_last_update_end_time);
+ std::vector<audio_effect *> res;
+ for(const auto &e : m_default_effects)
+ res.push_back(e.get());
+ return res;
+}
- // recompute the sample rate information
- sample_rate_changed();
+void sound_manager::default_effect_changed(u32 entry)
+{
+ u32 type = m_default_effects[entry]->type();
+ for(const auto &s : m_speakers)
+ for(const auto &e : s.m_effects)
+ if(e.m_effect->type() == type)
+ e.m_effect->default_changed();
}
+
+
+
//-------------------------------------------------
-// presave - save/restore callback
+// start_recording - begin audio recording
//-------------------------------------------------
-void sound_stream::presave()
+bool sound_manager::start_recording(std::string_view filename)
+{
+ if(m_wavfile)
+ return false;
+ m_wavfile = util::wav_open(filename, machine().sample_rate(), m_outputs_count);
+ return bool(m_wavfile);
+}
+
+bool sound_manager::start_recording()
{
- // save the stream end time
- m_last_update_end_time = m_output[0].end_time();
+ // open the output WAV file if specified
+ char const *const filename = machine().options().wav_write();
+ return *filename ? start_recording(filename) : false;
}
//-------------------------------------------------
-// reprime_sync_timer - set up the next sync
-// timer to go off just a hair after the end of
-// the current sample period
+// stop_recording - end audio recording
//-------------------------------------------------
-void sound_stream::reprime_sync_timer()
+void sound_manager::stop_recording()
{
- attotime curtime = m_device.machine().time();
- attotime target = m_output[0].end_time() + attotime(0, 1);
- m_sync_timer->adjust(target - curtime);
+ // close any open WAV file
+ m_wavfile.reset();
}
//-------------------------------------------------
-// sync_update - timer callback to handle a
-// synchronous stream
+// mute - mute sound output
//-------------------------------------------------
-void sound_stream::sync_update(s32)
+void sound_manager::mute(bool mute, u8 reason)
{
- update();
- reprime_sync_timer();
+ if(mute)
+ m_muted |= reason;
+ else
+ m_muted &= ~reason;
}
//-------------------------------------------------
-// empty_view - return an empty view covering the
-// given time period as a substitute for invalid
-// inputs
+// reset - reset all sound chips
//-------------------------------------------------
-read_stream_view sound_stream::empty_view(attotime start, attotime end)
+sound_manager::speaker_info::speaker_info(speaker_device &dev, u32 rate, u32 first_output) : m_dev(dev), m_first_output(first_output), m_buffer(rate, dev.inputs())
{
- // if our dummy buffer doesn't match our sample rate, update and clear it
- if (m_empty_buffer.sample_rate() != m_sample_rate)
- m_empty_buffer.set_sample_rate(m_sample_rate, false);
-
- // allocate a write view so that it can expand, and convert back to a read view
- // on the return
- return write_stream_view(m_empty_buffer, start, end);
+ m_channels = dev.inputs();
+ m_stream = dev.stream();
+ for(u32 i=0; i != audio_effect::COUNT; i++)
+ m_effects.emplace_back(effect_step(rate, dev.inputs()));
}
+sound_manager::microphone_info::microphone_info(microphone_device &dev) : m_dev(dev)
+{
+ m_channels = dev.outputs();
+}
+void sound_manager::reset()
+{
+ LOG_OUTPUT_FUNC("Sound reset\n");
+}
-//**************************************************************************
-// RESAMPLER STREAM
-//**************************************************************************
//-------------------------------------------------
-// default_resampler_stream - derived sound_stream
-// class that handles resampling
+// pause - pause sound output
//-------------------------------------------------
-default_resampler_stream::default_resampler_stream(device_t &device) :
- sound_stream(device, 1, 1, 0, SAMPLE_RATE_OUTPUT_ADAPTIVE, stream_update_delegate(&default_resampler_stream::resampler_sound_update, this), STREAM_DISABLE_INPUT_RESAMPLING),
- m_max_latency(0)
+void sound_manager::pause()
{
- // create a name
- m_name = "Default Resampler '";
- m_name += device.tag();
- m_name += "'";
+ mute(true, MUTE_REASON_PAUSE);
}
//-------------------------------------------------
-// resampler_sound_update - stream callback
-// handler for resampling an input stream to the
-// target sample rate of the output
+// resume - resume sound output
//-------------------------------------------------
-void default_resampler_stream::resampler_sound_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void sound_manager::resume()
{
- sound_assert(inputs.size() == 1);
- sound_assert(outputs.size() == 1);
+ mute(false, MUTE_REASON_PAUSE);
+}
- auto &input = inputs[0];
- auto &output = outputs[0];
- // if the input has an invalid rate, just fill with zeros
- if (input.sample_rate() <= 1)
- {
- output.fill(0);
+//**// Configuration management
+
+void sound_manager::config_load(config_type cfg_type, config_level cfg_level, util::xml::data_node const *parentnode)
+{
+ // If no config file, ignore
+ if(!parentnode)
return;
- }
- // optimize_resampler ensures we should not have equal sample rates
- sound_assert(input.sample_rate() != output.sample_rate());
+ switch(cfg_type) {
+ case config_type::INIT:
+ break;
- // compute the stepping value and the inverse
- stream_buffer::sample_t step = stream_buffer::sample_t(input.sample_rate()) / stream_buffer::sample_t(output.sample_rate());
- stream_buffer::sample_t stepinv = 1.0 / step;
+ case config_type::CONTROLLER:
+ break;
- // determine the latency we need to introduce, in input samples:
- // 1 input sample for undersampled inputs
- // 1 + step input samples for oversampled inputs
- s64 latency_samples = 1 + ((step < 1.0) ? 0 : s32(step));
- if (latency_samples <= m_max_latency)
- latency_samples = m_max_latency;
- else
- m_max_latency = latency_samples;
- attotime latency = latency_samples * input.sample_period();
-
- // clamp the latency to the start (only relevant at the beginning)
- s32 dstindex = 0;
- attotime output_start = output.start_time();
- auto numsamples = output.samples();
- while (latency > output_start && dstindex < numsamples)
- {
- output.put(dstindex++, 0);
- output_start += output.sample_period();
+ case config_type::DEFAULT: {
+ // In the global config, get the default effect chain configuration
+
+ util::xml::data_node const *efl_node = parentnode->get_child("default_audio_effects");
+ for(util::xml::data_node const *ef_node = efl_node->get_child("effect"); ef_node != nullptr; ef_node = ef_node->get_next_sibling("effect")) {
+ unsigned int id = ef_node->get_attribute_int("step", 0);
+ std::string type = ef_node->get_attribute_string("type", "");
+ if(id >= 1 && id <= m_default_effects.size() && audio_effect::effect_names[m_default_effects[id-1]->type()] == type)
+ m_default_effects[id-1]->config_load(ef_node);
+ }
+ break;
}
- if (dstindex >= numsamples)
- return;
- // create a rebased input buffer around the adjusted start time
- read_stream_view rebased(input, output_start - latency);
- sound_assert(rebased.start_time() + latency <= output_start);
+ case config_type::SYSTEM: {
+ // In the per-driver file, get the specific configuration for everything
+
+ // Effects configuration
+ for(util::xml::data_node const *efl_node = parentnode->get_child("audio_effects"); efl_node != nullptr; efl_node = efl_node->get_next_sibling("audio_effects")) {
+ std::string speaker_tag = efl_node->get_attribute_string("tag", "");
+ for(auto &speaker : m_speakers)
+ if(speaker.m_dev.tag() == speaker_tag) {
+ auto &eff = speaker.m_effects;
+ for(util::xml::data_node const *ef_node = efl_node->get_child("effect"); ef_node != nullptr; ef_node = ef_node->get_next_sibling("effect")) {
+ unsigned int id = ef_node->get_attribute_int("step", 0);
+ std::string type = ef_node->get_attribute_string("type", "");
+ if(id >= 1 && id <= m_default_effects.size() && audio_effect::effect_names[eff[id-1].m_effect->type()] == type)
+ eff[id-1].m_effect->config_load(ef_node);
+ }
+ break;
+ }
+ }
- // compute the fractional input start position
- attotime delta = output_start - (rebased.start_time() + latency);
- sound_assert(delta.seconds() == 0);
- stream_buffer::sample_t srcpos = stream_buffer::sample_t(double(delta.attoseconds()) / double(rebased.sample_period_attoseconds()));
- sound_assert(srcpos <= 1.0f);
+ // All levels
+ const util::xml::data_node *lv_node = parentnode->get_child("master_volume");
+ if(lv_node)
+ m_master_gain = lv_node->get_attribute_float("gain", 1.0);
- // input is undersampled: point sample except where our sample period covers a boundary
- s32 srcindex = 0;
- if (step < 1.0)
- {
- stream_buffer::sample_t cursample = rebased.get(srcindex++);
- for ( ; dstindex < numsamples; dstindex++)
- {
- // if still within the current sample, just replicate
- srcpos += step;
- if (srcpos <= 1.0)
- output.put(dstindex, cursample);
-
- // if crossing a sample boundary, blend with the neighbor
- else
- {
- srcpos -= 1.0;
- sound_assert(srcpos <= step + 1e-5);
- stream_buffer::sample_t prevsample = cursample;
- cursample = rebased.get(srcindex++);
- output.put(dstindex, stepinv * (prevsample * (step - srcpos) + srcpos * cursample));
- }
+ for(lv_node = parentnode->get_child("device_volume"); lv_node != nullptr; lv_node = lv_node->get_next_sibling("device_volume")) {
+ std::string device_tag = lv_node->get_attribute_string("device", "");
+ device_sound_interface *intf = dynamic_cast<device_sound_interface *>(m_machine.root_device().subdevice(device_tag));
+ if(intf)
+ intf->set_user_output_gain(lv_node->get_attribute_float("gain", 1.0));
}
- sound_assert(srcindex <= rebased.samples());
- }
- // input is oversampled: sum the energy
- else
- {
- float cursample = rebased.get(srcindex++);
- for ( ; dstindex < numsamples; dstindex++)
- {
- // compute the partial first sample and advance
- stream_buffer::sample_t scale = 1.0 - srcpos;
- stream_buffer::sample_t sample = cursample * scale;
-
- // add in complete samples until we only have a fraction left
- stream_buffer::sample_t remaining = step - scale;
- while (remaining >= 1.0)
- {
- sample += rebased.get(srcindex++);
- remaining -= 1.0;
- }
+ for(lv_node = parentnode->get_child("device_channel_volume"); lv_node != nullptr; lv_node = lv_node->get_next_sibling("device_channel_volume")) {
+ std::string device_tag = lv_node->get_attribute_string("device", "");
+ int channel = lv_node->get_attribute_int("channel", -1);
+ device_sound_interface *intf = dynamic_cast<device_sound_interface *>(m_machine.root_device().subdevice(device_tag));
+ if(intf && channel >= 0 && channel < intf->outputs())
+ intf->set_user_output_gain(channel, lv_node->get_attribute_float("gain", 1.0));
+ }
- // add in the final partial sample
- cursample = rebased.get(srcindex++);
- sample += cursample * remaining;
- output.put(dstindex, sample * stepinv);
- // our position is now the remainder
- srcpos = remaining;
- sound_assert(srcindex <= rebased.samples());
+ // Mapping configuration
+ m_configs.clear();
+ for(util::xml::data_node const *node = parentnode->get_child("sound_map"); node != nullptr; node = node->get_next_sibling("sound_map")) {
+ m_configs.emplace_back(config_mapping { node->get_attribute_string("tag", "") });
+ auto &config = m_configs.back();
+ for(util::xml::data_node const *nmap = node->get_child("node_mapping"); nmap != nullptr; nmap = nmap->get_next_sibling("node_mapping"))
+ config.m_node_mappings.emplace_back(std::pair<std::string, float>(nmap->get_attribute_string("node", ""), nmap->get_attribute_float("db", 0)));
+ for(util::xml::data_node const *cmap = node->get_child("channel_mapping"); cmap != nullptr; cmap = cmap->get_next_sibling("channel_mapping"))
+ config.m_channel_mappings.emplace_back(std::tuple<u32, std::string, u32, float>(cmap->get_attribute_int("guest_channel", 0),
+ cmap->get_attribute_string("node", ""),
+ cmap->get_attribute_int("node_channel", 0),
+ cmap->get_attribute_float("db", 0)));
}
+ break;
}
-}
-
+ case config_type::FINAL:
+ break;
+ }
+}
-//**************************************************************************
-// SOUND MANAGER
-//**************************************************************************
//-------------------------------------------------
-// sound_manager - constructor
+// config_save - save data to the configuration
+// file
//-------------------------------------------------
-sound_manager::sound_manager(running_machine &machine) :
- m_machine(machine),
- m_update_timer(nullptr),
- m_update_number(0),
- m_last_update(attotime::zero),
- m_finalmix_leftover(0),
- m_samples_this_update(0),
- m_finalmix(machine.sample_rate()),
- m_leftmix(machine.sample_rate()),
- m_rightmix(machine.sample_rate()),
- m_compressor_scale(1.0),
- m_compressor_counter(0),
- m_compressor_enabled(machine.options().compressor()),
- m_muted(0),
- m_nosound_mode(machine.osd().no_sound()),
- m_attenuation(0),
- m_unique_id(0),
- m_wavfile(),
- m_first_reset(true)
+void sound_manager::config_save(config_type cfg_type, util::xml::data_node *parentnode)
{
- // count the mixers
-#if VERBOSE
- mixer_interface_enumerator iter(machine.root_device());
- LOG("total mixers = %d\n", iter.count());
-#endif
+ switch(cfg_type) {
+ case config_type::INIT:
+ break;
+
+ case config_type::CONTROLLER:
+ break;
+
+ case config_type::DEFAULT: {
+ // In the global config, save the default effect chain configuration
+ util::xml::data_node *const efl_node = parentnode->add_child("default_audio_effects", nullptr);
+ for(u32 ei = 0; ei != m_default_effects.size(); ei++) {
+ const audio_effect *e = m_default_effects[ei].get();
+ util::xml::data_node *const ef_node = efl_node->add_child("effect", nullptr);
+ ef_node->set_attribute_int("step", ei+1);
+ ef_node->set_attribute("type", audio_effect::effect_names[e->type()]);
+ e->config_save(ef_node);
+ }
+ break;
+ }
- // register callbacks
- machine.configuration().config_register(
- "mixer",
- configuration_manager::load_delegate(&sound_manager::config_load, this),
- configuration_manager::save_delegate(&sound_manager::config_save, this));
- machine.add_notifier(MACHINE_NOTIFY_PAUSE, machine_notify_delegate(&sound_manager::pause, this));
- machine.add_notifier(MACHINE_NOTIFY_RESUME, machine_notify_delegate(&sound_manager::resume, this));
- machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(&sound_manager::reset, this));
- machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(&sound_manager::stop_recording, this));
+ case config_type::SYSTEM: {
+ // In the per-driver file, save the specific configuration for everything
+
+ // Effects configuration
+ for(const auto &speaker : m_speakers) {
+ util::xml::data_node *const efl_node = parentnode->add_child("audio_effects", nullptr);
+ efl_node->set_attribute("tag", speaker.m_dev.tag());
+ for(u32 ei = 0; ei != speaker.m_effects.size(); ei++) {
+ const audio_effect *e = speaker.m_effects[ei].m_effect.get();
+ util::xml::data_node *const ef_node = efl_node->add_child("effect", nullptr);
+ ef_node->set_attribute_int("step", ei+1);
+ ef_node->set_attribute("type", audio_effect::effect_names[e->type()]);
+ e->config_save(ef_node);
+ }
+ }
- // register global states
- machine.save().save_item(NAME(m_last_update));
+ // All levels
+ if(m_master_gain != 1.0) {
+ util::xml::data_node *const lv_node = parentnode->add_child("master_volume", nullptr);
+ lv_node->set_attribute_float("gain", m_master_gain);
+ }
+ for(device_sound_interface &snd : sound_interface_enumerator(m_machine.root_device())) {
+ // Don't add microphones, speakers or devices without outputs
+ if(dynamic_cast<sound_io_device *>(&snd) || !snd.outputs())
+ continue;
+ if(snd.user_output_gain() != 1.0) {
+ util::xml::data_node *const lv_node = parentnode->add_child("device_volume", nullptr);
+ lv_node->set_attribute("device", snd.device().tag());
+ lv_node->set_attribute_float("gain", snd.user_output_gain());
+ }
+ for(int channel = 0; channel != snd.outputs(); channel ++)
+ if(snd.user_output_gain(channel) != 1.0) {
+ util::xml::data_node *const lv_node = parentnode->add_child("device_channel_volume", nullptr);
+ lv_node->set_attribute("device", snd.device().tag());
+ lv_node->set_attribute_int("channel", channel);
+ lv_node->set_attribute_float("gain", snd.user_output_gain(channel));
+ }
+ }
- // set the starting attenuation
- set_attenuation(machine.options().volume());
+ // Mapping configuration
+ auto output_one = [this, parentnode](sound_io_device &dev) {
+ for(const auto &config : m_configs)
+ if(config.m_name == dev.tag()) {
+ util::xml::data_node *const sp_node = parentnode->add_child("sound_map", nullptr);
+ sp_node->set_attribute("tag", dev.tag());
+ for(const auto &nmap : config.m_node_mappings) {
+ util::xml::data_node *const node = sp_node->add_child("node_mapping", nullptr);
+ node->set_attribute("node", nmap.first.c_str());
+ node->set_attribute_float("db", nmap.second);
+ }
+ for(const auto &cmap : config.m_channel_mappings) {
+ util::xml::data_node *const node = sp_node->add_child("channel_mapping", nullptr);
+ node->set_attribute_int("guest_channel", std::get<0>(cmap));
+ node->set_attribute("node", std::get<1>(cmap).c_str());
+ node->set_attribute_int("node_channel", std::get<2>(cmap));
+ node->set_attribute_float("db", std::get<3>(cmap));
+ }
+ return;
+ }
+ };
- // start the periodic update flushing timer
- m_update_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(sound_manager::update), this));
- m_update_timer->adjust(STREAMS_UPDATE_ATTOTIME, 0, STREAMS_UPDATE_ATTOTIME);
+ for(auto &spk : m_speakers)
+ output_one(spk.m_dev);
+ for(auto &mic : m_microphones)
+ output_one(mic.m_dev);
+ break;
+ }
+
+ case config_type::FINAL:
+ break;
+ }
}
-//-------------------------------------------------
-// sound_manager - destructor
-//-------------------------------------------------
-sound_manager::~sound_manager()
+//**// Mapping between speakers/microphones and OSD endpoints
+
+sound_manager::config_mapping &sound_manager::config_get_sound_io(sound_io_device *dev)
{
+ for(auto &config : m_configs)
+ if(config.m_name == dev->tag())
+ return config;
+ m_configs.emplace_back(config_mapping { dev->tag() });
+ return m_configs.back();
}
-
-//-------------------------------------------------
-// stream_alloc - allocate a new stream with the
-// new-style callback and flags
-//-------------------------------------------------
-
-sound_stream *sound_manager::stream_alloc(device_t &device, u32 inputs, u32 outputs, u32 sample_rate, stream_update_delegate callback, sound_stream_flags flags)
+void sound_manager::config_add_sound_io_connection_node(sound_io_device *dev, std::string name, float db)
{
- // determine output base
- u32 output_base = 0;
- for (auto &stream : m_stream_list)
- if (&stream->device() == &device)
- output_base += stream->output_count();
+ internal_config_add_sound_io_connection_node(dev, name, db);
+ m_osd_info.m_generation --;
+}
- m_stream_list.push_back(std::make_unique<sound_stream>(device, inputs, outputs, output_base, sample_rate, callback, flags));
- return m_stream_list.back().get();
+void sound_manager::internal_config_add_sound_io_connection_node(sound_io_device *dev, std::string name, float db)
+{
+ auto &config = config_get_sound_io(dev);
+ for(auto &nmap : config.m_node_mappings)
+ if(nmap.first == name)
+ return;
+ config.m_node_mappings.emplace_back(std::pair<std::string, float>(name, db));
}
+void sound_manager::config_add_sound_io_connection_default(sound_io_device *dev, float db)
+{
+ internal_config_add_sound_io_connection_default(dev, db);
+ m_osd_info.m_generation --;
+}
-//-------------------------------------------------
-// start_recording - begin audio recording
-//-------------------------------------------------
+void sound_manager::internal_config_add_sound_io_connection_default(sound_io_device *dev, float db)
+{
+ auto &config = config_get_sound_io(dev);
+ for(auto &nmap : config.m_node_mappings)
+ if(nmap.first == "")
+ return;
+ config.m_node_mappings.emplace_back(std::pair<std::string, float>("", db));
+}
-bool sound_manager::start_recording(std::string_view filename)
+void sound_manager::config_remove_sound_io_connection_node(sound_io_device *dev, std::string name)
{
- if (m_wavfile)
- return false;
- m_wavfile = util::wav_open(filename, machine().sample_rate(), 2);
- return bool(m_wavfile);
+ internal_config_remove_sound_io_connection_node(dev, name);
+ m_osd_info.m_generation --;
}
-bool sound_manager::start_recording()
+void sound_manager::internal_config_remove_sound_io_connection_node(sound_io_device *dev, std::string name)
{
- // open the output WAV file if specified
- char const *const filename = machine().options().wav_write();
- return *filename ? start_recording(filename) : false;
+ auto &config = config_get_sound_io(dev);
+ for(auto i = config.m_node_mappings.begin(); i != config.m_node_mappings.end(); i++)
+ if(i->first == name) {
+ config.m_node_mappings.erase(i);
+ return;
+ }
}
+void sound_manager::config_remove_sound_io_connection_default(sound_io_device *dev)
+{
+ internal_config_remove_sound_io_connection_default(dev);
+ m_osd_info.m_generation --;
+}
-//-------------------------------------------------
-// stop_recording - end audio recording
-//-------------------------------------------------
+void sound_manager::internal_config_remove_sound_io_connection_default(sound_io_device *dev)
+{
+ auto &config = config_get_sound_io(dev);
+ for(auto i = config.m_node_mappings.begin(); i != config.m_node_mappings.end(); i++)
+ if(i->first == "") {
+ config.m_node_mappings.erase(i);
+ return;
+ }
+}
-void sound_manager::stop_recording()
+void sound_manager::config_set_volume_sound_io_connection_node(sound_io_device *dev, std::string name, float db)
{
- // close any open WAV file
- m_wavfile.reset();
+ internal_config_set_volume_sound_io_connection_node(dev, name, db);
+ m_osd_info.m_generation --;
}
+void sound_manager::internal_config_set_volume_sound_io_connection_node(sound_io_device *dev, std::string name, float db)
+{
+ auto &config = config_get_sound_io(dev);
+ for(auto &nmap : config.m_node_mappings)
+ if(nmap.first == name) {
+ nmap.second = db;
+ return;
+ }
+}
-//-------------------------------------------------
-// set_attenuation - set the global volume
-//-------------------------------------------------
+void sound_manager::config_set_volume_sound_io_connection_default(sound_io_device *dev, float db)
+{
+ internal_config_set_volume_sound_io_connection_default(dev, db);
+ m_osd_info.m_generation --;
+}
-void sound_manager::set_attenuation(float attenuation)
+void sound_manager::internal_config_set_volume_sound_io_connection_default(sound_io_device *dev, float db)
{
- // currently OSD only supports integral attenuation
- m_attenuation = int(attenuation);
- machine().osd().set_mastervolume(m_muted ? -32 : m_attenuation);
+ auto &config = config_get_sound_io(dev);
+ for(auto &nmap : config.m_node_mappings)
+ if(nmap.first == "") {
+ nmap.second = db;
+ return;
+ }
}
-//-------------------------------------------------
-// indexed_mixer_input - return the mixer
-// device and input index of the global mixer
-// input
-//-------------------------------------------------
+void sound_manager::config_add_sound_io_channel_connection_node(sound_io_device *dev, u32 guest_channel, std::string name, u32 node_channel, float db)
+{
+ internal_config_add_sound_io_channel_connection_node(dev, guest_channel, name, node_channel, db);
+ m_osd_info.m_generation --;
+}
-bool sound_manager::indexed_mixer_input(int index, mixer_input &info) const
+void sound_manager::internal_config_add_sound_io_channel_connection_node(sound_io_device *dev, u32 guest_channel, std::string name, u32 node_channel, float db)
{
- // scan through the mixers until we find the indexed input
- for (device_mixer_interface &mixer : mixer_interface_enumerator(machine().root_device()))
- {
- if (index < mixer.inputs())
- {
- info.mixer = &mixer;
- info.stream = mixer.input_to_stream_input(index, info.inputnum);
- sound_assert(info.stream != nullptr);
- return true;
- }
- index -= mixer.inputs();
- }
+ auto &config = config_get_sound_io(dev);
+ for(auto &cmap : config.m_channel_mappings)
+ if(std::get<0>(cmap) == guest_channel && std::get<1>(cmap) == name && std::get<2>(cmap) == node_channel)
+ return;
+ config.m_channel_mappings.emplace_back(std::tuple<u32, std::string, u32, float>(guest_channel, name, node_channel, db));
+}
- // didn't locate
- info.mixer = nullptr;
- return false;
+void sound_manager::config_add_sound_io_channel_connection_default(sound_io_device *dev, u32 guest_channel, u32 node_channel, float db)
+{
+ internal_config_add_sound_io_channel_connection_default(dev, guest_channel, node_channel, db);
+ m_osd_info.m_generation --;
}
+void sound_manager::internal_config_add_sound_io_channel_connection_default(sound_io_device *dev, u32 guest_channel, u32 node_channel, float db)
+{
+ auto &config = config_get_sound_io(dev);
+ for(auto &cmap : config.m_channel_mappings)
+ if(std::get<0>(cmap) == guest_channel && std::get<1>(cmap) == "" && std::get<2>(cmap) == node_channel)
+ return;
+ config.m_channel_mappings.emplace_back(std::tuple<u32, std::string, u32, float>(guest_channel, "", node_channel, db));
+}
-//-------------------------------------------------
-// samples - fills the specified buffer with
-// 16-bit stereo audio samples generated during
-// the current frame
-//-------------------------------------------------
+void sound_manager::config_remove_sound_io_channel_connection_node(sound_io_device *dev, u32 guest_channel, std::string name, u32 node_channel)
+{
+ internal_config_remove_sound_io_channel_connection_node(dev, guest_channel, name, node_channel);
+ m_osd_info.m_generation --;
+}
-void sound_manager::samples(s16 *buffer)
+void sound_manager::internal_config_remove_sound_io_channel_connection_node(sound_io_device *dev, u32 guest_channel, std::string name, u32 node_channel)
{
- for (int sample = 0; sample < m_samples_this_update * 2; sample++)
- *buffer++ = m_finalmix[sample];
+ auto &config = config_get_sound_io(dev);
+ for(auto i = config.m_channel_mappings.begin(); i != config.m_channel_mappings.end(); i++)
+ if(std::get<0>(*i) == guest_channel && std::get<1>(*i) == name && std::get<2>(*i) == node_channel) {
+ config.m_channel_mappings.erase(i);
+ return;
+ }
}
+void sound_manager::config_remove_sound_io_channel_connection_default(sound_io_device *dev, u32 guest_channel, u32 node_channel)
+{
+ internal_config_remove_sound_io_channel_connection_default(dev, guest_channel, node_channel);
+ m_osd_info.m_generation --;
+}
-//-------------------------------------------------
-// mute - mute sound output
-//-------------------------------------------------
+void sound_manager::internal_config_remove_sound_io_channel_connection_default(sound_io_device *dev, u32 guest_channel, u32 node_channel)
+{
+ auto &config = config_get_sound_io(dev);
+ for(auto i = config.m_channel_mappings.begin(); i != config.m_channel_mappings.end(); i++)
+ if(std::get<0>(*i) == guest_channel && std::get<1>(*i) == "" && std::get<2>(*i) == node_channel) {
+ config.m_channel_mappings.erase(i);
+ return;
+ }
+}
-void sound_manager::mute(bool mute, u8 reason)
+void sound_manager::config_set_volume_sound_io_channel_connection_node(sound_io_device *dev, u32 guest_channel, std::string name, u32 node_channel, float db)
{
- bool old_muted = m_muted;
- if (mute)
- m_muted |= reason;
- else
- m_muted &= ~reason;
+ internal_config_set_volume_sound_io_channel_connection_node(dev, guest_channel, name, node_channel, db);
+ m_osd_info.m_generation --;
+}
- if(old_muted != (m_muted != 0))
- set_attenuation(m_attenuation);
+void sound_manager::internal_config_set_volume_sound_io_channel_connection_node(sound_io_device *dev, u32 guest_channel, std::string name, u32 node_channel, float db)
+{
+ auto &config = config_get_sound_io(dev);
+ for(auto &cmap : config.m_channel_mappings)
+ if(std::get<0>(cmap) == guest_channel && std::get<1>(cmap) == name && std::get<2>(cmap) == node_channel) {
+ std::get<3>(cmap) = db;
+ return;
+ }
}
+void sound_manager::config_set_volume_sound_io_channel_connection_default(sound_io_device *dev, u32 guest_channel, u32 node_channel, float db)
+{
+ internal_config_set_volume_sound_io_channel_connection_default(dev, guest_channel, node_channel, db);
+ m_osd_info.m_generation --;
+}
-//-------------------------------------------------
-// recursive_remove_stream_from_orphan_list -
-// remove the given stream from the orphan list
-// and recursively remove all our inputs
-//-------------------------------------------------
+void sound_manager::internal_config_set_volume_sound_io_channel_connection_default(sound_io_device *dev, u32 guest_channel, u32 node_channel, float db)
+{
+ auto &config = config_get_sound_io(dev);
+ for(auto &cmap : config.m_channel_mappings)
+ if(std::get<0>(cmap) == guest_channel && std::get<1>(cmap) == "" && std::get<2>(cmap) == node_channel) {
+ std::get<3>(cmap) = db;
+ return;
+ }
+}
-void sound_manager::recursive_remove_stream_from_orphan_list(sound_stream *which)
+void sound_manager::startup_cleanups()
{
- m_orphan_stream_list.erase(which);
- for (int inputnum = 0; inputnum < which->input_count(); inputnum++)
- {
- auto &input = which->input(inputnum);
- if (input.valid())
- recursive_remove_stream_from_orphan_list(&input.source().stream());
+ auto osd_info = machine().osd().sound_get_information();
+
+ // for every sound_io device that does not have a configuration entry, add a
+ // mapping to default
+ auto default_one = [this](sound_io_device &dev) {
+ for(const auto &config : m_configs)
+ if(config.m_name == dev.tag())
+ return;
+ m_configs.emplace_back(config_mapping { dev.tag() });
+ m_configs.back().m_node_mappings.emplace_back(std::pair<std::string, float>("", 0.0));
+ };
+
+ for(sound_io_device &dev : speaker_device_enumerator(machine().root_device()))
+ default_one(dev);
+ for(sound_io_device &dev : microphone_device_enumerator(machine().root_device()))
+ default_one(dev);
+
+ // If there's no default sink replace all the default sink config
+ // entries into the first sink available
+ if(!osd_info.m_default_sink) {
+ std::string first_sink_name;
+ for(const auto &node : osd_info.m_nodes)
+ if(node.m_sinks) {
+ first_sink_name = node.name();
+ break;
+ }
+
+ if(first_sink_name != "")
+ for(auto &config : m_configs) {
+ for(auto &nmap : config.m_node_mappings)
+ if(nmap.first == "")
+ nmap.first = first_sink_name;
+ for(auto &cmap : config.m_channel_mappings)
+ if(std::get<1>(cmap) == "")
+ std::get<1>(cmap) = first_sink_name;
+ }
}
-}
-//-------------------------------------------------
-// apply_sample_rate_changes - recursively
-// update sample rates throughout the system
-//-------------------------------------------------
+ // If there's no default source replace all the default source config
+ // entries into the first source available
+ if(!osd_info.m_default_source) {
+ std::string first_source_name;
+ for(const auto &node : osd_info.m_nodes)
+ if(node.m_sources) {
+ first_source_name = node.name();
+ break;
+ }
-void sound_manager::apply_sample_rate_changes()
-{
- // update sample rates if they have changed
- for (speaker_device &speaker : speaker_device_enumerator(machine().root_device()))
- {
- int stream_out;
- sound_stream *stream = speaker.output_to_stream_output(0, stream_out);
-
- // due to device removal, some speakers may end up with no outputs; just skip those
- if (stream != nullptr)
- {
- sound_assert(speaker.outputs() == 1);
- stream->apply_sample_rate_changes(m_update_number, machine().sample_rate());
- }
+ if(first_source_name != "")
+ for(auto &config : m_configs) {
+ for(auto &nmap : config.m_node_mappings)
+ if(nmap.first == "")
+ nmap.first = first_source_name;
+ for(auto &cmap : config.m_channel_mappings)
+ if(std::get<1>(cmap) == "")
+ std::get<1>(cmap) = first_source_name;
+ }
}
}
+template<bool is_output, typename S> void sound_manager::apply_osd_changes(std::vector<S> &streams)
+{
+ // Apply host system volume and routing changes to the internal structures
+ for(S &stream : streams) {
+ u32 sidx;
+ for(sidx = 0; sidx != m_osd_info.m_streams.size() && m_osd_info.m_streams[sidx].m_id != stream.m_id; sidx++);
+ // If the stream has been lost, continue. It will be cleared in update_osd_streams.
+ if(sidx == m_osd_info.m_streams.size())
+ continue;
+
+ // Check if the target and/or the volumes changed
+ bool node_changed = stream.m_node != m_osd_info.m_streams[sidx].m_node;
+ bool volume_changed = !std::equal(stream.m_volumes.begin(), stream.m_volumes.end(), m_osd_info.m_streams[sidx].m_volumes.begin(), m_osd_info.m_streams[sidx].m_volumes.end());
+
+ if(node_changed || volume_changed) {
+ // Check if a node change is just tracking the system default
+ bool system_default_tracking = node_changed && stream.m_is_system_default && m_osd_info.m_streams[sidx].m_node == (is_output ? m_osd_info.m_default_sink : m_osd_info.m_default_source);
+
+ // Find the config entry for the sound_io
+ config_mapping *config = nullptr;
+ for(auto &conf : m_configs)
+ if(conf.m_name == stream.m_dev->tag()) {
+ config = &conf;
+ break;
+ }
+ if(!config)
+ continue;
+
+ // Retrieve the old node name, and, if it's different, the new node name
+ std::string old_node_name = stream.m_node_name;
+ std::string new_node_name;
+ if(node_changed) {
+ for(const auto &node : m_osd_info.m_nodes)
+ if(node.m_id == m_osd_info.m_streams[sidx].m_node) {
+ new_node_name = node.name();
+ break;
+ }
+ // That's really, really not supposed to happen
+ if(new_node_name.empty())
+ continue;
+ } else
+ new_node_name = old_node_name;
+
+ // Separate the cases on full mapping vs. channel mapping
+ if(!stream.m_is_channel_mapping) {
+ // Full mapping
+ // Find the index of the config mapping entry that generated the stream, if there's still one.
+ // Note that a default system stream has the empty string as a name
+ u32 index;
+ for(index = 0; index != config->m_node_mappings.size(); index++)
+ if(config->m_node_mappings[index].first == old_node_name)
+ break;
+ if(index == config->m_node_mappings.size())
+ continue;
+
+ // If the target node changed, write it down
+ if(node_changed) {
+ if(!system_default_tracking) {
+ config->m_node_mappings[index].first = new_node_name;
+ stream.m_node_name = new_node_name;
+ stream.m_is_system_default = false;
+ }
+ stream.m_node = m_osd_info.m_streams[sidx].m_node;
+ }
-//-------------------------------------------------
-// reset - reset all sound chips
-//-------------------------------------------------
+ // If the volume changed, there are two
+ // possibilities: either the channels split, or
+ // they didn't.
+ if(volume_changed) {
+ // Check is all the channel volumes are the same
+ float new_volume = m_osd_info.m_streams[sidx].m_volumes[0];
+ bool same = true;
+ for(u32 i = 1; i != m_osd_info.m_streams[sidx].m_volumes.size(); i++)
+ if(m_osd_info.m_streams[sidx].m_volumes[i] != new_volume) {
+ same = false;
+ break;
+ }
+ if(same) {
+ // All the same volume, just note down the new volume
+ stream.m_volumes = m_osd_info.m_streams[sidx].m_volumes;
+ config->m_node_mappings[index].second = new_volume;
+
+ } else {
+ const osd::audio_info::node_info *node = nullptr;
+ for(const auto &n : m_osd_info.m_nodes)
+ if(n.m_id == stream.m_node) {
+ node = &n;
+ break;
+ }
+ for(u32 channel = 0; channel != stream.m_channels; channel++) {
+ std::vector<u32> targets = find_channel_mapping(stream.m_dev->get_position(channel), node);
+ for(u32 tchannel : targets)
+ if(stream.m_node_name == "")
+ internal_config_add_sound_io_channel_connection_default(stream.m_dev, channel, tchannel, m_osd_info.m_streams[sidx].m_volumes[tchannel]);
+ else
+ internal_config_add_sound_io_channel_connection_node(stream.m_dev, channel, stream.m_node_name, tchannel, m_osd_info.m_streams[sidx].m_volumes[tchannel]);
+ }
+ config->m_node_mappings.erase(config->m_node_mappings.begin() + index);
+ }
+ }
+ } else {
+ // Channel mapping
+ for(u32 channel = 0; channel != stream.m_channels; channel++) {
+ if(stream.m_unused_channels_mask & (1 << channel))
+ continue;
+
+ // Find the index of the config mapping entry that generated the stream channel, if there's still one.
+ // Note that a default system stream has the empty string as a name
+ u32 index;
+ for(index = 0; index != config->m_channel_mappings.size(); index++)
+ if(std::get<1>(config->m_channel_mappings[index]) == old_node_name &&
+ std::get<2>(config->m_channel_mappings[index]) == channel)
+ break;
+ if(index == config->m_channel_mappings.size())
+ continue;
+
+ // If the target node changed, write it down
+ if(node_changed) {
+ if(!system_default_tracking) {
+ std::get<1>(config->m_channel_mappings[index]) = new_node_name;
+ stream.m_node_name = new_node_name;
+ stream.m_is_system_default = false;
+ }
+ stream.m_node = m_osd_info.m_streams[sidx].m_node;
+ }
+
+ // If the volume changed, write in down too
+ if(volume_changed) {
+ std::get<3>(config->m_channel_mappings[index]) = m_osd_info.m_streams[sidx].m_volumes[channel];
+ stream.m_volumes[channel] = m_osd_info.m_streams[sidx].m_volumes[channel];
+ }
+ }
+ }
+ }
+ }
+}
-void sound_manager::reset()
+void sound_manager::osd_information_update()
{
- // reset all the sound chips
- for (device_sound_interface &sound : sound_interface_enumerator(machine().root_device()))
- sound.device().reset();
-
- // apply any sample rate changes now
- apply_sample_rate_changes();
+ // Get a snapshot of the current information
+ m_osd_info = machine().osd().sound_get_information();
+
+ // Analyze the streams to see if anything changed, but only in the
+ // split stream case.
+ if(machine().osd().sound_split_streams_per_source()) {
+ apply_osd_changes<false, osd_input_stream >(m_osd_input_streams );
+ apply_osd_changes<false, osd_output_stream>(m_osd_output_streams);
+ }
+}
- // on first reset, identify any orphaned streams
- if (m_first_reset)
- {
- m_first_reset = false;
+void sound_manager::generate_mapping()
+{
+ auto find_node = [this](std::string name) -> u32 {
+ for(const auto &node : m_osd_info.m_nodes)
+ if(node.name() == name)
+ return node.m_id;
+ return 0;
+ };
+
+ m_mappings.clear();
+ for(speaker_info &speaker : m_speakers) {
+ auto &config = config_get_sound_io(&speaker.m_dev);
+ m_mappings.emplace_back(mapping { &speaker.m_dev });
+ auto &omap = m_mappings.back();
+
+ std::vector<std::string> node_to_remove;
+ for(auto &nmap : config.m_node_mappings) {
+ if(nmap.first == "") {
+ if(m_osd_info.m_default_sink)
+ omap.m_node_mappings.emplace_back(mapping::node_mapping { m_osd_info.m_default_sink, nmap.second, true });
+ } else {
+ u32 node_id = find_node(nmap.first);
+ if(node_id != 0)
+ omap.m_node_mappings.emplace_back(mapping::node_mapping { node_id, nmap.second, false });
+ else
+ node_to_remove.push_back(nmap.first);
+ }
+ }
- // put all the streams on the orphan list to start
- for (auto &stream : m_stream_list)
- m_orphan_stream_list[stream.get()] = 0;
+ for(auto &nmap: node_to_remove)
+ internal_config_remove_sound_io_connection_node(&speaker.m_dev, nmap);
+
+ std::vector<std::tuple<u32, std::string, u32>> channel_map_to_remove;
+ for(auto &cmap : config.m_channel_mappings) {
+ if(std::get<1>(cmap) == "") {
+ if(m_osd_info.m_default_sink)
+ omap.m_channel_mappings.emplace_back(mapping::channel_mapping { std::get<0>(cmap), m_osd_info.m_default_sink, std::get<2>(cmap), std::get<3>(cmap), true });
+ } else {
+ u32 node_id = find_node(std::get<1>(cmap));
+ if(node_id != 0)
+ omap.m_channel_mappings.emplace_back(mapping::channel_mapping { std::get<0>(cmap), node_id, std::get<2>(cmap), std::get<3>(cmap), false });
+ else
+ channel_map_to_remove.push_back(std::tuple<u32, std::string, u32>(std::get<0>(cmap), std::get<1>(cmap), std::get<2>(cmap)));
+ }
+ }
- // then walk the graph like we do on update and remove any we touch
- for (speaker_device &speaker : speaker_device_enumerator(machine().root_device()))
- {
- int dummy;
- sound_stream *const output = speaker.output_to_stream_output(0, dummy);
- if (output)
- recursive_remove_stream_from_orphan_list(output);
+ for(auto &cmap : channel_map_to_remove)
+ internal_config_remove_sound_io_channel_connection_node(&speaker.m_dev, std::get<0>(cmap), std::get<1>(cmap), std::get<2>(cmap));
+ }
- m_speakers.emplace_back(speaker);
+ for(microphone_info &mic : m_microphones) {
+ auto &config = config_get_sound_io(&mic.m_dev);
+ m_mappings.emplace_back(mapping { &mic.m_dev });
+ auto &omap = m_mappings.back();
+
+ std::vector<std::string> node_to_remove;
+ for(auto &nmap : config.m_node_mappings) {
+ if(nmap.first == "") {
+ if(m_osd_info.m_default_source)
+ omap.m_node_mappings.emplace_back(mapping::node_mapping { m_osd_info.m_default_source, nmap.second, true });
+ } else {
+ u32 node_id = find_node(nmap.first);
+ if(node_id != 0)
+ omap.m_node_mappings.emplace_back(mapping::node_mapping { node_id, nmap.second, false });
+ else
+ node_to_remove.push_back(nmap.first);
+ }
}
-#if (SOUND_DEBUG)
- // dump the sound graph when we start up
- for (speaker_device &speaker : speaker_device_enumerator(machine().root_device()))
- {
- int index;
- sound_stream *output = speaker.output_to_stream_output(0, index);
- if (output != nullptr)
- output->print_graph_recursive(0, index);
+ for(auto &nmap: node_to_remove)
+ internal_config_remove_sound_io_connection_node(&mic.m_dev, nmap);
+
+ std::vector<std::tuple<u32, std::string, u32>> channel_map_to_remove;
+ for(auto &cmap : config.m_channel_mappings) {
+ if(std::get<1>(cmap) == "") {
+ if(m_osd_info.m_default_source)
+ omap.m_channel_mappings.emplace_back(mapping::channel_mapping { std::get<0>(cmap), m_osd_info.m_default_source, std::get<2>(cmap), std::get<3>(cmap), true });
+ } else {
+ u32 node_id = find_node(std::get<1>(cmap));
+ if(node_id != 0)
+ omap.m_channel_mappings.emplace_back(mapping::channel_mapping { std::get<0>(cmap), node_id, std::get<2>(cmap), std::get<3>(cmap), false });
+ else
+ channel_map_to_remove.push_back(std::tuple<u32, std::string, u32>(std::get<0>(cmap), std::get<1>(cmap), std::get<2>(cmap)));
+ }
}
- // dump the orphan list as well
- if (m_orphan_stream_list.size() != 0)
- {
- osd_printf_info("\nOrphaned streams:\n");
- for (auto &stream : m_orphan_stream_list)
- osd_printf_info(" %s\n", stream.first->name());
- }
-#endif
+ for(auto &cmap : channel_map_to_remove)
+ internal_config_remove_sound_io_channel_connection_node(&mic.m_dev, std::get<0>(cmap), std::get<1>(cmap), std::get<2>(cmap));
}
}
+// Find where to map a sound_io channel into a node's channels depending on their positions
-//-------------------------------------------------
-// pause - pause sound output
-//-------------------------------------------------
-
-void sound_manager::pause()
+std::vector<u32> sound_manager::find_channel_mapping(const std::array<double, 3> &position, const osd::audio_info::node_info *node)
{
- mute(true, MUTE_REASON_PAUSE);
+ std::vector<u32> result;
+ if(position[0] == 0 && position[1] == 0 && position[2] == 0)
+ return result;
+ double best_dist = -1;
+ for(u32 port = 0; port != node->m_port_positions.size(); port++)
+ if(node->m_port_positions[port][0] || node->m_port_positions[port][1] || node->m_port_positions[port][2]) {
+ double dx = position[0] - node->m_port_positions[port][0];
+ double dy = position[1] - node->m_port_positions[port][1];
+ double dz = position[2] - node->m_port_positions[port][2];
+ double dist = dx*dx + dy*dy + dz*dz;
+ if(best_dist == -1 || dist < best_dist) {
+ best_dist = dist;
+ result.clear();
+ result.push_back(port);
+ } else if(best_dist == dist)
+ result.push_back(port);
+ }
+ return result;
}
-//-------------------------------------------------
-// resume - resume sound output
-//-------------------------------------------------
-
-void sound_manager::resume()
+void sound_manager::update_osd_streams()
{
- mute(false, MUTE_REASON_PAUSE);
-}
+ std::unique_lock<std::mutex> lock(m_effects_mutex);
+ auto current_input_streams = std::move(m_osd_input_streams);
+ auto current_output_streams = std::move(m_osd_output_streams);
+ m_osd_input_streams.clear();
+ m_osd_output_streams.clear();
+
+ // Find the index of a sound_io_device in the speaker_info vector or the microphone_info vector
+
+ auto find_sound_io_index = [this](sound_io_device *dev) -> u32 {
+ for(u32 si = 0; si != m_speakers.size(); si++)
+ if(&m_speakers[si].m_dev == dev)
+ return si;
+ for(u32 si = 0; si != m_microphones.size(); si++)
+ if(&m_microphones[si].m_dev == dev)
+ return si;
+ return 0; // Can't happen
+ };
+
+
+ // Find a pointer to a node_info from the node id
+ auto find_node_info = [this](u32 node) -> const osd::audio_info::node_info * {
+ for(const auto &ni : m_osd_info.m_nodes) {
+ if(ni.m_id == node)
+ return &ni;
+ }
+ // Can't happen
+ return nullptr;
+ };
+
+ // Two possible mapping methods depending on the osd capabilities
+
+ for(auto &m : m_microphones)
+ m.m_input_mixing_steps.clear();
+ m_output_mixing_steps.clear();
+
+ auto &osd = machine().osd();
+ if(osd.sound_split_streams_per_source()) {
+ auto get_input_stream_for_node_and_device = [this, &current_input_streams] (const osd::audio_info::node_info *node, sound_io_device *dev, bool is_system_default, bool is_channel_mapping = false) -> u32 {
+ // Check if the osd stream already exists to pick it up in case.
+ // Clear the id in the current_streams structure to show it has been picked up, reset the unused mask.
+ // Clear the volumes
+ // m_dev will already be correct
+
+ for(auto &os : current_input_streams)
+ if(os.m_id && os.m_node == node->m_id && os.m_dev == dev) {
+ u32 sid = m_osd_input_streams.size();
+ m_osd_input_streams.emplace_back(std::move(os));
+ os.m_id = 0;
+ auto &nos = m_osd_input_streams[sid];
+ nos.m_is_channel_mapping = is_channel_mapping;
+ nos.m_unused_channels_mask = util::make_bitmask<u32>(node->m_sources);
+ nos.m_volumes.clear();
+ nos.m_is_system_default = is_system_default;
+ return sid;
+ }
+ // If none exists, create one
+ u32 sid = m_osd_input_streams.size();
+ u32 rate = machine().sample_rate();
+ m_osd_input_streams.emplace_back(osd_input_stream(node->m_id, is_system_default ? "" : node->m_name, node->m_sources, rate, is_system_default, dev));
+ osd_input_stream &nos = m_osd_input_streams.back();
+ nos.m_id = machine().osd().sound_stream_source_open(node->m_id, dev->tag(), rate);
+ nos.m_is_channel_mapping = is_channel_mapping;
+ nos.m_buffer.set_sync_sample(rate_and_last_sync_to_index(rate));
+ return sid;
+ };
+
+ auto get_output_stream_for_node_and_device = [this, &current_output_streams] (const osd::audio_info::node_info *node, sound_io_device *dev, bool is_system_default, bool is_channel_mapping = false) -> u32 {
+ // Check if the osd stream already exists to pick it up in case.
+ // Clear the id in the current_streams structure to show it has been picked up, reset the unused mask.
+ // Clear the volumes
+ // m_dev will already be correct
+
+ for(auto &os : current_output_streams)
+ if(os.m_id && os.m_node == node->m_id && os.m_dev == dev) {
+ u32 sid = m_osd_output_streams.size();
+ m_osd_output_streams.emplace_back(std::move(os));
+ os.m_id = 0;
+ auto &nos = m_osd_output_streams[sid];
+ nos.m_is_channel_mapping = is_channel_mapping;
+ nos.m_volumes.clear();
+ nos.m_unused_channels_mask = util::make_bitmask<u32>(node->m_sinks);
+ nos.m_is_system_default = is_system_default;
+ return sid;
+ }
-//-------------------------------------------------
-// config_load - read and apply data from the
-// configuration file
-//-------------------------------------------------
+ // If none exists, create one
+ u32 sid = m_osd_output_streams.size();
+ u32 rate = machine().sample_rate();
+ m_osd_output_streams.emplace_back(osd_output_stream(node->m_id, is_system_default ? "" : node->m_name, node->m_sinks, rate, is_system_default, dev));
+ osd_output_stream &nos = m_osd_output_streams.back();
+ nos.m_id = machine().osd().sound_stream_sink_open(node->m_id, dev->tag(), rate);
+ nos.m_is_channel_mapping = is_channel_mapping;
+ nos.m_last_sync = rate_and_last_sync_to_index(rate);
+ return sid;
+ };
+
+ auto get_input_stream_for_node_and_channel = [this, &get_input_stream_for_node_and_device] (const osd::audio_info::node_info *node, u32 node_channel, sound_io_device *dev, bool is_system_default) -> u32 {
+ // First check if there's an active stream
+ for(u32 sid = 0; sid != m_osd_input_streams.size(); sid++) {
+ auto &os = m_osd_input_streams[sid];
+ if(os.m_node == node->m_id && os.m_dev == dev && os.m_unused_channels_mask & (1 << node_channel) && os.m_is_channel_mapping)
+ return sid;
+ }
-void sound_manager::config_load(config_type cfg_type, config_level cfg_level, util::xml::data_node const *parentnode)
-{
- // we only care system-specific configuration
- if ((cfg_type != config_type::SYSTEM) || !parentnode)
- return;
+ // Otherwise use the default method
+ return get_input_stream_for_node_and_device(node, dev, is_system_default, true);
+ };
- // master volume attenuation
- if (util::xml::data_node const *node = parentnode->get_child("attenuation"))
- {
- // treat source INI files or more specific as higher priority than CFG
- // FIXME: leaky abstraction - this depends on a front-end implementation detail
- if ((OPTION_PRIORITY_NORMAL + 5) > machine().options().get_entry(OPTION_VOLUME)->priority())
- set_attenuation(std::clamp(int(node->get_attribute_int("value", 0)), -32, 0));
- }
- // iterate over channel nodes
- for (util::xml::data_node const *node = parentnode->get_child("channel"); node != nullptr; node = node->get_next_sibling("channel"))
- {
- mixer_input info;
- if (indexed_mixer_input(node->get_attribute_int("index", -1), info))
- {
- // note that this doesn't disallow out-of-range values
- float value = node->get_attribute_float("value", std::nanf(""));
-
- if (!std::isnan(value))
- info.stream->input(info.inputnum).set_user_gain(value);
- }
- }
+ auto get_output_stream_for_node_and_channel = [this, &get_output_stream_for_node_and_device] (const osd::audio_info::node_info *node, u32 node_channel, sound_io_device *dev, bool is_system_default) -> u32 {
+ // First check if there's an active stream with the correct channel not used yet
+ for(u32 sid = 0; sid != m_osd_output_streams.size(); sid++) {
+ auto &os = m_osd_output_streams[sid];
+ if(os.m_node == node->m_id && os.m_dev == dev && os.m_unused_channels_mask & (1 << node_channel) && os.m_is_channel_mapping)
+ return sid;
+ }
- // iterate over speaker panning nodes
- for (util::xml::data_node const *node = parentnode->get_child("panning"); node != nullptr; node = node->get_next_sibling("panning"))
- {
- char const *const tag = node->get_attribute_string("tag", nullptr);
- if (tag != nullptr)
- {
- for (speaker_device &speaker : speaker_device_enumerator(machine().root_device()))
- {
- if (!strcmp(tag, speaker.tag()))
- {
- float value = node->get_attribute_float("value", speaker.defpan());
- speaker.set_pan(value);
- break;
+ // Otherwise use the default method
+ return get_output_stream_for_node_and_device(node, dev, is_system_default, true);
+ };
+
+ // Create/retrieve streams to apply the decided mapping
+ for(const auto &omap : m_mappings) {
+ u32 dev_index = find_sound_io_index(omap.m_dev);
+ bool is_output = omap.m_dev->is_output();
+ if(is_output) {
+ std::vector<mixing_step> &mixing_steps = m_output_mixing_steps;
+ u32 dchannels = omap.m_dev->inputs();
+ for(const auto &nm : omap.m_node_mappings) {
+ const auto *node = find_node_info(nm.m_node);
+ u32 osd_index = get_output_stream_for_node_and_device(node, omap.m_dev, nm.m_is_system_default);
+ auto &stream = m_osd_output_streams[osd_index];
+ u32 umask = stream.m_unused_channels_mask;
+ float linear_volume = 1.0;
+
+ if(osd.sound_external_per_channel_volume()) {
+ stream.m_volumes.clear();
+ stream.m_volumes.resize(stream.m_channels, nm.m_db);
+
+ } else
+ linear_volume = osd::db_to_linear(nm.m_db);
+
+ for(u32 channel = 0; channel != dchannels; channel++) {
+ std::vector<u32> targets = find_channel_mapping(omap.m_dev->get_position(channel), node);
+ for(u32 tchannel : targets) {
+ // If the channel is output and in the to
+ // clear mask, use load, otherwise use add.
+ // Apply the volume too if needed
+ mixing_steps.emplace_back(mixing_step {
+ (umask & (1 << tchannel)) ? mixing_step::COPY : mixing_step::ADD,
+ osd_index,
+ tchannel,
+ dev_index,
+ channel,
+ linear_volume
+ });
+ umask &= ~(1 << tchannel);
+ }
+ }
+ stream.m_unused_channels_mask = umask;
+ }
+
+ for(const auto &cm : omap.m_channel_mappings) {
+ const auto *node = find_node_info(cm.m_node);
+ u32 osd_index = get_output_stream_for_node_and_channel(node, cm.m_node_channel, omap.m_dev, cm.m_is_system_default);
+ auto &stream = m_osd_output_streams[osd_index];
+ float linear_volume = 1.0;
+
+ if(osd.sound_external_per_channel_volume()) {
+ if(stream.m_volumes.empty())
+ stream.m_volumes.resize(stream.m_channels, -96);
+ stream.m_volumes[cm.m_node_channel] = cm.m_db;
+
+ } else
+ linear_volume = osd::db_to_linear(cm.m_db);
+
+ mixing_steps.emplace_back(mixing_step {
+ (stream.m_unused_channels_mask & (1 << cm.m_node_channel)) ?
+ mixing_step::COPY : mixing_step::ADD,
+ osd_index,
+ cm.m_node_channel,
+ dev_index,
+ cm.m_guest_channel,
+ linear_volume
+ });
+ stream.m_unused_channels_mask &= ~(1 << cm.m_node_channel);
+ }
+
+
+ } else {
+ std::vector<mixing_step> &mixing_steps = m_microphones[dev_index].m_input_mixing_steps;
+ u32 dchannels = omap.m_dev->outputs();
+ for(const auto &nm : omap.m_node_mappings) {
+ const auto *node = find_node_info(nm.m_node);
+ u32 osd_index = get_input_stream_for_node_and_device(node, omap.m_dev, nm.m_is_system_default);
+ auto &stream = m_osd_input_streams[osd_index];
+ u32 umask = stream.m_unused_channels_mask;
+ float linear_volume = 1.0;
+
+ if(osd.sound_external_per_channel_volume()) {
+ stream.m_volumes.clear();
+ stream.m_volumes.resize(stream.m_channels, nm.m_db);
+
+ } else
+ linear_volume = osd::db_to_linear(nm.m_db);
+
+ for(u32 channel = 0; channel != dchannels; channel++) {
+ std::vector<u32> targets = find_channel_mapping(omap.m_dev->get_position(channel), node);
+ for(u32 tchannel : targets) {
+ // If the channel is output and in the to
+ // clear mask, use load, otherwise use add.
+ // Apply the volume too if needed
+ mixing_steps.emplace_back(mixing_step {
+ mixing_step::ADD,
+ osd_index,
+ tchannel,
+ dev_index,
+ channel,
+ linear_volume
+ });
+ umask &= ~(1 << tchannel);
+ }
+ }
+ stream.m_unused_channels_mask = umask;
+ }
+
+ for(const auto &cm : omap.m_channel_mappings) {
+ const auto *node = find_node_info(cm.m_node);
+ u32 osd_index = get_input_stream_for_node_and_channel(node, cm.m_node_channel, omap.m_dev, cm.m_is_system_default);
+ auto &stream = m_osd_input_streams[osd_index];
+ float linear_volume = 1.0;
+
+ if(osd.sound_external_per_channel_volume()) {
+ if(stream.m_volumes.empty())
+ stream.m_volumes.resize(stream.m_channels, -96);
+ stream.m_volumes[cm.m_node_channel] = cm.m_db;
+
+ } else
+ linear_volume = osd::db_to_linear(cm.m_db);
+
+ mixing_steps.emplace_back(mixing_step {
+ mixing_step::ADD,
+ osd_index,
+ cm.m_node_channel,
+ dev_index,
+ cm.m_guest_channel,
+ linear_volume
+ });
+ stream.m_unused_channels_mask &= ~(1 << cm.m_node_channel);
}
}
}
- }
-}
+ } else {
+ // All sources need to be merged per-destination, max one stream per destination
+
+ std::map<u32, u32> stream_per_node;
+
+ // Retrieve or create the one osd stream for a given
+ // destination. First check if we already have it, then
+ // whether it was previously created, then otherwise create
+ // it.
+
+ auto get_input_stream_for_node = [this, &current_input_streams, &stream_per_node] (const osd::audio_info::node_info *node, bool is_system_default) -> u32 {
+ // Pick up the existing stream if there's one
+ auto si = stream_per_node.find(node->m_id);
+ if(si != stream_per_node.end())
+ return si->second;
+
+ // Create the default unused mask
+ u32 channels = node->m_sources;
+ u32 umask = util::make_bitmask<u32>(channels);
+
+ // Check if the osd stream already exists to pick it up in case.
+ // Clear the id in the current_streams structure to show it has been picked up, reset the unused mask.
+ // m_speaker will already be nullptr, m_source_channels and m_volumes empty.
+
+ for(auto &os : current_input_streams)
+ if(os.m_id && os.m_node == node->m_id) {
+ u32 sid = m_osd_input_streams.size();
+ m_osd_input_streams.emplace_back(std::move(os));
+ os.m_id = 0;
+ m_osd_input_streams.back().m_unused_channels_mask = umask;
+ m_osd_input_streams.back().m_is_system_default = is_system_default;
+ stream_per_node[node->m_id] = sid;
+ return sid;
+ }
-//-------------------------------------------------
-// config_save - save data to the configuration
-// file
-//-------------------------------------------------
+ // If none exists, create one
+ u32 sid = m_osd_input_streams.size();
+ u32 rate = machine().sample_rate();
+ m_osd_input_streams.emplace_back(osd_input_stream(node->m_id, is_system_default ? "" : node->m_name, channels, rate, is_system_default, nullptr));
+ osd_input_stream &stream = m_osd_input_streams.back();
+ stream.m_id = machine().osd().sound_stream_source_open(node->m_id, machine().system().name, rate);
+ stream.m_buffer.set_sync_sample(rate_and_last_sync_to_index(rate));
+ stream_per_node[node->m_id] = sid;
+ return sid;
+ };
+
+ auto get_output_stream_for_node = [this, &current_output_streams, &stream_per_node] (const osd::audio_info::node_info *node, bool is_system_default) -> u32 {
+ // Pick up the existing stream if there's one
+ auto si = stream_per_node.find(node->m_id);
+ if(si != stream_per_node.end())
+ return si->second;
+
+ // Create the default unused mask
+ u32 channels = node->m_sinks;
+ u32 umask = util::make_bitmask<u32>(channels);
+
+ // Check if the osd stream already exists to pick it up in case.
+ // Clear the id in the current_streams structure to show it has been picked up, reset the unused mask.
+ // m_speaker will already be nullptr, m_source_channels and m_volumes empty.
+
+ for(auto &os : current_output_streams)
+ if(os.m_id && os.m_node == node->m_id) {
+ u32 sid = m_osd_output_streams.size();
+ m_osd_output_streams.emplace_back(std::move(os));
+ os.m_id = 0;
+ m_osd_output_streams.back().m_unused_channels_mask = umask;
+ m_osd_output_streams.back().m_is_system_default = is_system_default;
+ stream_per_node[node->m_id] = sid;
+ return sid;
+ }
-void sound_manager::config_save(config_type cfg_type, util::xml::data_node *parentnode)
-{
- // we only save system-specific configuration
- if (cfg_type != config_type::SYSTEM)
- return;
+ // If none exists, create one
+ u32 sid = m_osd_output_streams.size();
+ u32 rate = machine().sample_rate();
+ m_osd_output_streams.emplace_back(osd_output_stream(node->m_id, is_system_default ? "" : node->m_name, channels, rate, is_system_default, nullptr));
+ osd_output_stream &stream = m_osd_output_streams.back();
+ stream.m_id = machine().osd().sound_stream_sink_open(node->m_id, machine().system().name, rate);
+ stream.m_last_sync = rate_and_last_sync_to_index(rate);
+ stream_per_node[node->m_id] = sid;
+ return sid;
+ };
+
+
+ // Create/retrieve streams to apply the decided mapping
+
+ for(const auto &omap : m_mappings) {
+ u32 dev_index = find_sound_io_index(omap.m_dev);
+ bool is_output = omap.m_dev->is_output();
+ if(is_output) {
+ u32 channels = m_speakers[dev_index].m_channels;
+ std::vector<mixing_step> &mixing_steps = m_output_mixing_steps;
+ for(const auto &nm : omap.m_node_mappings) {
+ const auto *node = find_node_info(nm.m_node);
+ u32 osd_index = get_output_stream_for_node(node, nm.m_is_system_default);
+ u32 umask = m_osd_output_streams[osd_index].m_unused_channels_mask;
+ float linear_volume = osd::db_to_linear(nm.m_db);
+
+ for(u32 channel = 0; channel != channels; channel++) {
+ std::vector<u32> targets = find_channel_mapping(omap.m_dev->get_position(channel), node);
+ for(u32 tchannel : targets) {
+ // If the channel is in the to clear mask, use load, otherwise use add
+ // Apply the volume too
+ mixing_steps.emplace_back(mixing_step {
+ (umask & (1 << tchannel)) ? mixing_step::COPY : mixing_step::ADD,
+ osd_index,
+ tchannel,
+ dev_index,
+ channel,
+ linear_volume
+ });
+ umask &= ~(1 << tchannel);
+ }
+ }
+ m_osd_output_streams[osd_index].m_unused_channels_mask = umask;
+ }
- // master volume attenuation
- if (m_attenuation != machine().options().volume())
- {
- if (util::xml::data_node *const node = parentnode->add_child("attenuation", nullptr))
- node->set_attribute_int("value", m_attenuation);
- }
+ for(const auto &cm : omap.m_channel_mappings) {
+ const auto *node = find_node_info(cm.m_node);
+ u32 osd_index = get_output_stream_for_node(node, false);
+ u32 umask = m_osd_output_streams[osd_index].m_unused_channels_mask;
+
+ // If the channel is in the to clear mask, use load, otherwise use add
+ // Apply the volume too
+ mixing_steps.emplace_back(mixing_step {
+ (umask & (1 << cm.m_node_channel)) ? mixing_step::COPY : mixing_step::ADD,
+ osd_index,
+ cm.m_node_channel,
+ dev_index,
+ cm.m_guest_channel,
+ osd::db_to_linear(cm.m_db)
+ });
+ m_osd_output_streams[osd_index].m_unused_channels_mask = umask & ~(1 << cm.m_node_channel);
+ }
- // iterate over mixer channels for per-channel volume
- for (int mixernum = 0; ; mixernum++)
- {
- mixer_input info;
- if (!indexed_mixer_input(mixernum, info))
- break;
+ } else {
+ u32 channels = m_microphones[dev_index].m_channels;
+ std::vector<mixing_step> &mixing_steps = m_microphones[dev_index].m_input_mixing_steps;
+ for(const auto &nm : omap.m_node_mappings) {
+ const auto *node = find_node_info(nm.m_node);
+ u32 osd_index = get_input_stream_for_node(node, nm.m_is_system_default);
+ float linear_volume = osd::db_to_linear(nm.m_db);
+
+ for(u32 channel = 0; channel != channels; channel++) {
+ std::vector<u32> targets = find_channel_mapping(omap.m_dev->get_position(channel), node);
+ for(u32 tchannel : targets) {
+ // If the channel is in the to clear mask, use load, otherwise use add
+ // Apply the volume too
+ mixing_steps.emplace_back(mixing_step {
+ mixing_step::ADD,
+ osd_index,
+ tchannel,
+ dev_index,
+ channel,
+ linear_volume
+ });
+ m_osd_input_streams[osd_index].m_unused_channels_mask &= ~(1 << tchannel);
+ }
+ }
+ }
- float const value = info.stream->input(info.inputnum).user_gain();
- if (value != 1.0f)
- {
- util::xml::data_node *const node = parentnode->add_child("channel", nullptr);
- if (node)
- {
- node->set_attribute_int("index", mixernum);
- node->set_attribute_float("value", value);
+ for(const auto &cm : omap.m_channel_mappings) {
+ const auto *node = find_node_info(cm.m_node);
+ u32 osd_index = get_input_stream_for_node(node, false);
+
+ // If the channel is in the to clear mask, use load, otherwise use add
+ // Apply the volume too
+ mixing_steps.emplace_back(mixing_step {
+ mixing_step::ADD,
+ osd_index,
+ cm.m_node_channel,
+ dev_index,
+ cm.m_guest_channel,
+ osd::db_to_linear(cm.m_db)
+ });
+ m_osd_input_streams[osd_index].m_unused_channels_mask &= ~(1 << cm.m_node_channel);
+ }
}
}
}
- // iterate over speakers for panning
- for (speaker_device &speaker : speaker_device_enumerator(machine().root_device()))
- {
- float const value = speaker.pan();
- if (value != speaker.defpan())
- {
- util::xml::data_node *const node = parentnode->add_child("panning", nullptr);
- if (node)
- {
- node->set_attribute("tag", speaker.tag());
- node->set_attribute_float("value", value);
- }
+ // Add a clear step for all output streams that need it
+ // Also set the volumes if supported
+ for(u32 stream_index = 0; stream_index != m_osd_output_streams.size(); stream_index++) {
+ auto &stream = m_osd_output_streams[stream_index];
+ if(stream.m_unused_channels_mask) {
+ for(u32 channel = 0; channel != stream.m_channels; channel ++)
+ if(stream.m_unused_channels_mask & (1 << channel))
+ m_output_mixing_steps.emplace_back(mixing_step { mixing_step::CLEAR, 0, 0, stream_index, channel, 0.0 });
}
+ if(!stream.m_volumes.empty())
+ osd.sound_stream_set_volumes(stream.m_id, stream.m_volumes);
}
-}
+ // If supported, set the volumes for the input streams
+ for(u32 stream_index = 0; stream_index != m_osd_input_streams.size(); stream_index++) {
+ auto &stream = m_osd_input_streams[stream_index];
+ if(!stream.m_volumes.empty())
+ osd.sound_stream_set_volumes(stream.m_id, stream.m_volumes);
+ }
-//-------------------------------------------------
-// adjust_toward_compressor_scale - adjust the
-// current scale factor toward the current goal,
-// in small increments
-//-------------------------------------------------
+ // Close all previous streams that haven't been picked up
+ for(const auto &stream : current_input_streams)
+ if(stream.m_id)
+ machine().osd().sound_stream_close(stream.m_id);
+ for(const auto &stream : current_output_streams)
+ if(stream.m_id)
+ machine().osd().sound_stream_close(stream.m_id);
+}
-stream_buffer::sample_t sound_manager::adjust_toward_compressor_scale(stream_buffer::sample_t curscale, stream_buffer::sample_t prevsample, stream_buffer::sample_t rawsample)
+void sound_manager::mapping_update()
{
- stream_buffer::sample_t proposed_scale = curscale;
+ auto &osd = machine().osd();
+ while(m_osd_info.m_generation != osd.sound_get_generation()) {
+ osd_information_update();
+
+ if(VERBOSE & LOG_OSD_INFO) {
+ LOG_OUTPUT_FUNC("OSD information:\n");
+ LOG_OUTPUT_FUNC("- generation %u\n", m_osd_info.m_generation);
+ LOG_OUTPUT_FUNC("- default sink %u\n", m_osd_info.m_default_sink);
+ LOG_OUTPUT_FUNC("- default source %u\n", m_osd_info.m_default_source);
+ LOG_OUTPUT_FUNC("- nodes:\n");
+ for(const auto &node : m_osd_info.m_nodes) {
+ LOG_OUTPUT_FUNC(" * %3u %s [%d %d-%d]\n", node.m_id, node.name().c_str(), node.m_rate.m_default_rate, node.m_rate.m_min_rate, node.m_rate.m_max_rate);
+ uint32_t port_count = node.m_sinks;
+ if(port_count < node.m_sources)
+ port_count = node.m_sources;
+ for(uint32_t port = 0; port != port_count; port++)
+ LOG_OUTPUT_FUNC(" %s %s [%g %g %g]\n",
+ port < node.m_sinks ? port < node.m_sources ? "<>" : ">" : "<",
+ node.m_port_names[port].c_str(),
+ node.m_port_positions[port][0],
+ node.m_port_positions[port][1],
+ node.m_port_positions[port][2]);
+ }
+ LOG_OUTPUT_FUNC("- streams:\n");
+ for(const auto &stream : m_osd_info.m_streams) {
+ LOG_OUTPUT_FUNC(" * %3u node %u", stream.m_id, stream.m_node);
+ if(!stream.m_volumes.empty()) {
+ LOG_OUTPUT_FUNC(" volumes");
+ for(float v : stream.m_volumes)
+ LOG_OUTPUT_FUNC(" %g", v);
+ }
+ LOG_OUTPUT_FUNC("\n");
+ }
+ }
- // if we want to get larger, increment by 0.01
- if (curscale < m_compressor_scale)
- {
- proposed_scale += 0.01f;
- if (proposed_scale > m_compressor_scale)
- proposed_scale = m_compressor_scale;
- }
+ generate_mapping();
- // otherwise, decrement by 0.01
- else
- {
- proposed_scale -= 0.01f;
- if (proposed_scale < m_compressor_scale)
- proposed_scale = m_compressor_scale;
- }
+ if(VERBOSE & LOG_MAPPING) {
+ LOG_OUTPUT_FUNC("MAPPING:\n");
+ for(const auto &omap : m_mappings) {
+ LOG_OUTPUT_FUNC("- sound_io %s\n", omap.m_dev->tag());
+ for(const auto &nm : omap.m_node_mappings)
+ LOG_OUTPUT_FUNC(" * node %u volume %g%s\n", nm.m_node, nm.m_db, nm.m_is_system_default ? " (default)" : "");
+ for(const auto &cm : omap.m_channel_mappings)
+ LOG_OUTPUT_FUNC(" * channel %u <-> node %u:%i volume %g\n", cm.m_guest_channel, cm.m_node, cm.m_node_channel, cm.m_db);
+ }
+ }
- // compute the sample at the current scale and at the proposed scale
- stream_buffer::sample_t cursample = rawsample * curscale;
- stream_buffer::sample_t proposed_sample = rawsample * proposed_scale;
+ update_osd_streams();
+
+ if(VERBOSE & LOG_OSD_STREAMS) {
+ LOG_OUTPUT_FUNC("OSD input streams:\n");
+ for(const auto &os : m_osd_input_streams) {
+ if(machine().osd().sound_split_streams_per_source()) {
+ LOG_OUTPUT_FUNC("- %3u %s node %u", os.m_id, os.m_dev ? os.m_dev->tag() : "-", os.m_node);
+ if(!os.m_is_channel_mapping)
+ LOG_OUTPUT_FUNC(" channels");
+ if(machine().osd().sound_external_per_channel_volume()) {
+ LOG_OUTPUT_FUNC(" dB");
+ for(u32 i = 0; i != os.m_channels; i++)
+ LOG_OUTPUT_FUNC(" %g", os.m_volumes[i]);
+ }
+ LOG_OUTPUT_FUNC("\n");
+ } else
+ LOG_OUTPUT_FUNC("- %3u node %u\n", os.m_id, os.m_node);
+ }
+ LOG_OUTPUT_FUNC("Input mixing steps:\n");
+ for(const auto &m : m_microphones) {
+ LOG_OUTPUT_FUNC(" %s:\n", m.m_dev.tag());
+ for(const auto &ms : m.m_input_mixing_steps) {
+ static const char *const modes[5] = { "clear", "copy", "copy+vol", "add", "add+vol" };
+ LOG_OUTPUT_FUNC(" - %s osd %u:%u -> device %u:%u level %g\n", modes[ms.m_mode], ms.m_osd_index, ms.m_osd_channel, ms.m_device_index, ms.m_device_channel, ms.m_linear_volume);
+ }
+ }
+ LOG_OUTPUT_FUNC("OSD output streams:\n");
+ for(const auto &os : m_osd_output_streams) {
+ if(machine().osd().sound_split_streams_per_source()) {
+ LOG_OUTPUT_FUNC("- %3u %s node %u", os.m_id, os.m_dev ? os.m_dev->tag() : "-", os.m_node);
+ if(!os.m_is_channel_mapping)
+ LOG_OUTPUT_FUNC(" channels");
+ if(machine().osd().sound_external_per_channel_volume()) {
+ LOG_OUTPUT_FUNC(" dB");
+ for(u32 i = 0; i != os.m_channels; i++)
+ LOG_OUTPUT_FUNC(" %g", os.m_volumes[i]);
+ }
+ LOG_OUTPUT_FUNC("\n");
+ } else
+ LOG_OUTPUT_FUNC("- %3u node %u\n", os.m_id, os.m_node);
+ }
+ LOG_OUTPUT_FUNC("Output mixing steps:\n");
+ for(const auto &ms : m_output_mixing_steps) {
+ static const char *const modes[5] = { "clear", "copy", "copy+vol", "add", "add+vol" };
+ LOG_OUTPUT_FUNC("- %s device %u:%u -> osd %u:%u level %g\n", modes[ms.m_mode], ms.m_device_index, ms.m_device_channel, ms.m_osd_index, ms.m_osd_channel, ms.m_linear_volume);
+ }
+ }
+ }
+}
- // if they trend in the same direction, it's ok to take the step
- if ((cursample < prevsample && proposed_sample < prevsample) || (cursample > prevsample && proposed_sample > prevsample))
- curscale = proposed_scale;
- // return the current scale
- return curscale;
-}
-//-------------------------------------------------
-// update - mix everything down to its final form
-// and send it to the OSD layer
-//-------------------------------------------------
+//**// Global sound system update
-void sound_manager::update(s32 param)
+u64 sound_manager::rate_and_time_to_index(attotime time, u32 sample_rate) const
{
- LOG("sound_update\n");
+ return time.m_seconds * sample_rate + ((time.m_attoseconds / 100000000) * sample_rate) / 10000000000;
+}
+void sound_manager::update(s32)
+{
auto profile = g_profiler.start(PROFILER_SOUND);
- // determine the duration of this update
- attotime update_period = machine().time() - m_last_update;
- sound_assert(update_period.seconds() == 0);
+ if(m_osd_info.m_generation == 0xffffffff)
+ startup_cleanups();
- // use that to compute the number of samples we need from the speakers
- attoseconds_t sample_rate_attos = HZ_TO_ATTOSECONDS(machine().sample_rate());
- m_samples_this_update = update_period.attoseconds() / sample_rate_attos;
+ mapping_update();
+ streams_update();
- // recompute the end time to an even sample boundary
- attotime endtime = m_last_update + attotime(0, m_samples_this_update * sample_rate_attos);
-
- // clear out the mix bufers
- std::fill_n(&m_leftmix[0], m_samples_this_update, 0);
- std::fill_n(&m_rightmix[0], m_samples_this_update, 0);
-
- // force all the speaker streams to generate the proper number of samples
- for (speaker_device &speaker : m_speakers)
- speaker.mix(&m_leftmix[0], &m_rightmix[0], m_last_update, endtime, m_samples_this_update, (m_muted & MUTE_REASON_SYSTEM));
+ m_last_sync_time = machine().time();
+}
- // determine the maximum in this section
- stream_buffer::sample_t curmax = 0;
- for (int sampindex = 0; sampindex < m_samples_this_update; sampindex++)
+void sound_manager::streams_update()
+{
+ attotime now = machine().time();
{
- auto sample = m_leftmix[sampindex];
- if (sample < 0)
- sample = -sample;
- if (sample > curmax)
- curmax = sample;
-
- sample = m_rightmix[sampindex];
- if (sample < 0)
- sample = -sample;
- if (sample > curmax)
- curmax = sample;
- }
-
- // pull in current compressor scale factor before modifying
- stream_buffer::sample_t lscale = m_compressor_scale;
- stream_buffer::sample_t rscale = m_compressor_scale;
+ std::unique_lock<std::mutex> lock(m_effects_mutex);
+ for(osd_output_stream &stream : m_osd_output_streams) {
+ u64 next_sync = rate_and_time_to_index(now, stream.m_rate);
+ stream.m_samples = next_sync - stream.m_last_sync;
+ stream.m_last_sync = next_sync;
+ }
- // if we're above what the compressor will handle, adjust the compression
- if (curmax * m_compressor_scale > 1.0)
- {
- m_compressor_scale = 1.0 / curmax;
- m_compressor_counter = STREAMS_UPDATE_FREQUENCY / 5;
+ for(sound_stream *stream : m_ordered_streams)
+ stream->update_nodeps();
}
- // if we're currently scaled, wait a bit to see if we can trend back toward 1.0
- else if (m_compressor_counter != 0)
- m_compressor_counter--;
-
- // try to migrate toward 0 unless we're going to introduce clipping
- else if (m_compressor_scale < 1.0 && curmax * 1.01 * m_compressor_scale < 1.0)
+ // Send the hooked samples to lua
{
- m_compressor_scale *= 1.01f;
- if (m_compressor_scale > 1.0)
- m_compressor_scale = 1.0;
- }
-
-#if (SOUND_DEBUG)
- if (lscale != m_compressor_scale)
- printf("scale=%.5f\n", m_compressor_scale);
-#endif
-
- // track whether there are pending scale changes in left/right
- stream_buffer::sample_t lprev = 0, rprev = 0;
+ std::map<std::string, std::vector<std::pair<const float *, int>>> sound_data;
+ for(device_sound_interface &sound : sound_interface_enumerator(machine().root_device()))
+ if(sound.get_sound_hook()) {
+ std::vector<std::pair<const float *, int>> buffers;
+ if(sound.device().type() == SPEAKER) {
+ const emu::detail::output_buffer_flat<sample_t> &buffer = m_speakers[static_cast<speaker_device &>(sound.device()).get_id()].m_buffer;
+ int samples = buffer.available_samples();
+ for(int channel = 0; channel != sound.inputs(); channel++)
+ buffers.emplace_back(std::make_pair(buffer.ptrs(channel, 0), samples));
+
+ } else {
+ for(int channel = 0; channel != sound.outputs(); channel++) {
+ std::pair<sound_stream *, int> info = sound.output_to_stream_output(channel);
+ const emu::detail::output_buffer_flat<sample_t> &buffer = info.first->m_output_buffer;
+ buffers.emplace_back(std::make_pair(buffer.ptrs(info.second, 0), buffer.available_samples()));
+ }
+ }
+ sound_data.emplace(sound.device().tag(), std::move(buffers));
+ }
- // now downmix the final result
- u32 finalmix_step = machine().video().speed_factor();
- u32 finalmix_offset = 0;
- s16 *finalmix = &m_finalmix[0];
- int sample;
- for (sample = m_finalmix_leftover; sample < m_samples_this_update * 1000; sample += finalmix_step)
- {
- int sampindex = sample / 1000;
-
- // ensure that changing the compression won't reverse direction to reduce "pops"
- stream_buffer::sample_t lsamp = m_leftmix[sampindex];
- if (lscale != m_compressor_scale && sample != m_finalmix_leftover)
- lscale = adjust_toward_compressor_scale(lscale, lprev, lsamp);
-
- lprev = lsamp * lscale;
- if (m_compressor_enabled)
- lsamp = lprev;
-
- // clamp the left side
- if (lsamp > 1.0)
- lsamp = 1.0;
- else if (lsamp < -1.0)
- lsamp = -1.0;
- finalmix[finalmix_offset++] = s16(lsamp * 32767.0);
-
- // ensure that changing the compression won't reverse direction to reduce "pops"
- stream_buffer::sample_t rsamp = m_rightmix[sampindex];
- if (rscale != m_compressor_scale && sample != m_finalmix_leftover)
- rscale = adjust_toward_compressor_scale(rscale, rprev, rsamp);
-
- rprev = rsamp * rscale;
- if (m_compressor_enabled)
- rsamp = rprev;
-
- // clamp the right side
- if (rsamp > 1.0)
- rsamp = 1.0;
- else if (rsamp < -1.0)
- rsamp = -1.0;
- finalmix[finalmix_offset++] = s16(rsamp * 32767.0);
+ emulator_info::sound_hook(sound_data);
}
- m_finalmix_leftover = sample - m_samples_this_update * 1000;
- // play the result
- if (finalmix_offset > 0)
- {
- if (!m_nosound_mode)
- machine().osd().update_audio_stream(finalmix, finalmix_offset / 2);
- machine().osd().add_audio_to_recording(finalmix, finalmix_offset / 2);
- machine().video().add_sound_to_recording(finalmix, finalmix_offset / 2);
- if (m_wavfile)
- util::wav_add_data_16(*m_wavfile, finalmix, finalmix_offset);
- }
+ for(sound_stream *stream : m_ordered_streams)
+ if(stream->device().type() != SPEAKER)
+ stream->sync(now);
- // update any orphaned streams so they don't get too far behind
- for (auto &stream : m_orphan_stream_list)
- stream.first->update();
+ for(osd_input_stream &stream : m_osd_input_streams)
+ stream.m_buffer.sync();
- // remember the update time
- m_last_update = endtime;
- m_update_number++;
+ machine().osd().add_audio_to_recording(m_record_buffer.data(), m_record_samples);
+ machine().video().add_sound_to_recording(m_record_buffer.data(), m_record_samples);
+ if(m_wavfile)
+ util::wav_add_data_16(*m_wavfile, m_record_buffer.data(), m_record_samples);
- // apply sample rate changes
- apply_sample_rate_changes();
+ m_effects_condition.notify_all();
+}
- // notify that new samples have been generated
- emulator_info::sound_hook();
+//**// Resampler management
+
+const audio_resampler *sound_manager::get_resampler(u32 fs, u32 ft)
+{
+ auto key = std::make_pair(fs, ft);
+ auto i = m_resamplers.find(key);
+ if(i != m_resamplers.end())
+ return i->second.get();
+ auto *res = new audio_resampler(fs, ft);
+ m_resamplers[key].reset(res);
+ return res;
}
diff --git a/src/emu/sound.h b/src/emu/sound.h
index 15f6a5743a2..3b30a58dc66 100644
--- a/src/emu/sound.h
+++ b/src/emu/sound.h
@@ -62,21 +62,19 @@
#define MAME_EMU_SOUND_H
#include "wavwrite.h"
-
+#include "interface/audio.h"
+#include <mutex>
+#include <thread>
+#include <condition_variable>
//**************************************************************************
// CONSTANTS
//**************************************************************************
// special sample-rate values
-constexpr u32 SAMPLE_RATE_INVALID = 0xffffffff;
-constexpr u32 SAMPLE_RATE_INPUT_ADAPTIVE = 0xfffffffe;
-constexpr u32 SAMPLE_RATE_OUTPUT_ADAPTIVE = 0xfffffffd;
-
-// anything below this sample rate is effectively treated as "off"
-constexpr u32 SAMPLE_RATE_MINIMUM = 50;
-
-
+constexpr u32 SAMPLE_RATE_INPUT_ADAPTIVE = 0xffffffff;
+constexpr u32 SAMPLE_RATE_OUTPUT_ADAPTIVE = 0xfffffffe;
+constexpr u32 SAMPLE_RATE_ADAPTIVE = 0xfffffffd;
//**************************************************************************
// DEBUGGING
@@ -86,7 +84,7 @@ constexpr u32 SAMPLE_RATE_MINIMUM = 50;
#ifdef MAME_DEBUG
#define SOUND_DEBUG (1)
#else
-#define SOUND_DEBUG (0)
+#define SOUND_DEBUG (1)
#endif
// if SOUND_DEBUG is on, make assertions fire regardless of MAME_DEBUG
@@ -96,491 +94,9 @@ constexpr u32 SAMPLE_RATE_MINIMUM = 50;
#define sound_assert assert
#endif
-
-
-//**************************************************************************
-// TYPE DEFINITIONS
-//**************************************************************************
-
-// ======================> stream_buffer
-
-class stream_buffer
-{
- // stream_buffer is an internal class, not directly accessed
- // outside of the classes below
- friend class read_stream_view;
- friend class write_stream_view;
- friend class sound_stream;
- friend class sound_stream_output;
-
-public:
- // the one public bit is the sample type
- using sample_t = float;
-
-private:
- // constructor/destructor
- stream_buffer(u32 sample_rate = 48000);
- ~stream_buffer();
-
- // disable copying of stream_buffers directly
- stream_buffer(stream_buffer const &src) = delete;
- stream_buffer &operator=(stream_buffer const &rhs) = delete;
-
- // return the current sample rate
- u32 sample_rate() const { return m_sample_rate; }
-
- // set a new sample rate
- void set_sample_rate(u32 rate, bool resample);
-
- // return the current sample period in attoseconds
- attoseconds_t sample_period_attoseconds() const { return m_sample_attos; }
- attotime sample_period() const { return attotime(0, m_sample_attos); }
-
- // return the attotime of the current end of buffer
- attotime end_time() const { return index_time(m_end_sample); }
-
- // set the ending time (for forced resyncs; generally not used)
- void set_end_time(attotime time)
- {
- m_end_second = time.seconds();
- m_end_sample = u32(time.attoseconds() / m_sample_attos);
- }
-
- // return the effective buffer size; currently it is a full second of audio
- // at the current sample rate, but this maybe change in the future
- u32 size() const { return m_sample_rate; }
-
- // read the sample at the given index (clamped); should be valid in all cases
- sample_t get(s32 index) const
- {
- sound_assert(u32(index) < size());
- sample_t value = m_buffer[index];
-#if (SOUND_DEBUG)
- sound_assert(!std::isnan(value));
-#endif
- return value;
- }
-
- // write the sample at the given index (clamped)
- void put(s32 index, sample_t data)
- {
- sound_assert(u32(index) < size());
- m_buffer[index] = data;
- }
-
- // simple helpers to step indexes
- u32 next_index(u32 index) { index++; return (index == size()) ? 0 : index; }
- u32 prev_index(u32 index) { return (index == 0) ? (size() - 1) : (index - 1); }
-
- // clamp an index to the size of the buffer; allows for indexing +/- one
- // buffers' worth of range
- u32 clamp_index(s32 index) const
- {
- if (index < 0)
- index += size();
- else if (index >= size())
- index -= size();
- sound_assert(index >= 0 && index < size());
- return index;
- }
-
- // fill the buffer with the given value
- void fill(sample_t value) { std::fill_n(&m_buffer[0], m_buffer.size(), value); }
-
- // return the attotime of a given index within the buffer
- attotime index_time(s32 index) const;
-
- // given an attotime, return the buffer index corresponding to it
- u32 time_to_buffer_index(attotime time, bool round_up, bool allow_expansion = false);
-
- // downsample from our buffer into a temporary buffer
- void backfill_downsample(sample_t *dest, int samples, attotime newend, attotime newperiod);
-
- // upsample from a temporary buffer into our buffer
- void backfill_upsample(sample_t const *src, int samples, attotime prevend, attotime prevperiod);
-
- // internal state
- u32 m_end_second; // current full second of the buffer end
- u32 m_end_sample; // current sample number within the final second
- u32 m_sample_rate; // sample rate of the data in the buffer
- attoseconds_t m_sample_attos; // pre-computed attoseconds per sample
- std::vector<sample_t> m_buffer; // vector of actual buffer data
-
-#if (SOUND_DEBUG)
-public:
- // for debugging, provide an interface to write a WAV stream
- void open_wav(char const *filename);
- void flush_wav();
-
-private:
- // internal debugging state
- util::wav_file_ptr m_wav_file; // pointer to the current WAV file
- u32 m_last_written = 0; // last written sample index
-#endif
-};
-
-
-// ======================> read_stream_view
-
-class read_stream_view
-{
-public:
- using sample_t = stream_buffer::sample_t;
-
-protected:
- // private constructor used by write_stream_view that allows for expansion
- read_stream_view(stream_buffer &buffer, attotime start, attotime end) :
- read_stream_view(&buffer, 0, buffer.time_to_buffer_index(end, true, true), 1.0)
- {
- // start has to be set after end, since end can expand the buffer and
- // potentially invalidate start
- m_start = buffer.time_to_buffer_index(start, false);
- normalize_start_end();
- }
-
-public:
- // base constructor to simplify some of the code
- read_stream_view(stream_buffer *buffer, s32 start, s32 end, sample_t gain) :
- m_buffer(buffer),
- m_end(end),
- m_start(start),
- m_gain(gain)
- {
- normalize_start_end();
- }
-
- // empty constructor so we can live in an array or vector
- read_stream_view() :
- read_stream_view(nullptr, 0, 0, 1.0)
- {
- }
-
- // constructor that covers the given time period
- read_stream_view(stream_buffer &buffer, attotime start, attotime end, sample_t gain) :
- read_stream_view(&buffer, buffer.time_to_buffer_index(start, false), buffer.time_to_buffer_index(end, true), gain)
- {
- }
-
- // copy constructor
- read_stream_view(read_stream_view const &src) :
- read_stream_view(src.m_buffer, src.m_start, src.m_end, src.m_gain)
- {
- }
-
- // copy constructor that sets a different start time
- read_stream_view(read_stream_view const &src, attotime start) :
- read_stream_view(src.m_buffer, src.m_buffer->time_to_buffer_index(start, false), src.m_end, src.m_gain)
- {
- }
-
- // copy assignment
- read_stream_view &operator=(read_stream_view const &rhs)
- {
- m_buffer = rhs.m_buffer;
- m_start = rhs.m_start;
- m_end = rhs.m_end;
- m_gain = rhs.m_gain;
- normalize_start_end();
- return *this;
- }
-
- // return the local gain
- sample_t gain() const { return m_gain; }
-
- // return the sample rate of the data
- u32 sample_rate() const { return m_buffer->sample_rate(); }
-
- // return the sample period (in attoseconds) of the data
- attoseconds_t sample_period_attoseconds() const { return m_buffer->sample_period_attoseconds(); }
- attotime sample_period() const { return m_buffer->sample_period(); }
-
- // return the number of samples represented by the buffer
- u32 samples() const { return m_end - m_start; }
-
- // return the starting or ending time of the buffer
- attotime start_time() const { return m_buffer->index_time(m_start); }
- attotime end_time() const { return m_buffer->index_time(m_end); }
-
- // set the gain
- read_stream_view &set_gain(float gain) { m_gain = gain; return *this; }
-
- // apply an additional gain factor
- read_stream_view &apply_gain(float gain) { m_gain *= gain; return *this; }
-
- // safely fetch a gain-scaled sample from the buffer
- sample_t get(s32 index) const
- {
- sound_assert(u32(index) < samples());
- index += m_start;
- if (index >= m_buffer->size())
- index -= m_buffer->size();
- return m_buffer->get(index) * m_gain;
- }
-
- // safely fetch a raw sample from the buffer; if you use this, you need to
- // apply the gain yourself for correctness
- sample_t getraw(s32 index) const
- {
- sound_assert(u32(index) < samples());
- index += m_start;
- if (index >= m_buffer->size())
- index -= m_buffer->size();
- return m_buffer->get(index);
- }
-
-protected:
- // normalize start/end
- void normalize_start_end()
- {
- // ensure that end is always greater than start; we'll
- // wrap to the buffer length as needed
- if (m_end < m_start && m_buffer != nullptr)
- m_end += m_buffer->size();
- sound_assert(m_end >= m_start);
- }
-
- // internal state
- stream_buffer *m_buffer; // pointer to the stream buffer we're viewing
- s32 m_end; // ending sample index (always >= start)
- s32 m_start; // starting sample index
- sample_t m_gain; // overall gain factor
-};
-
-
-// ======================> write_stream_view
-
-class write_stream_view : public read_stream_view
-{
-
-public:
- // empty constructor so we can live in an array or vector
- write_stream_view()
- {
- }
-
- // constructor that covers the given time period
- write_stream_view(stream_buffer &buffer, attotime start, attotime end) :
- read_stream_view(buffer, start, end)
- {
- }
-
- // constructor that converts from a read_stream_view
- write_stream_view(read_stream_view const &src) :
- read_stream_view(src)
- {
- }
-
- // safely write a sample to the buffer
- void put(s32 start, sample_t sample)
- {
- sound_assert(u32(start) < samples());
- m_buffer->put(index_to_buffer_index(start), sample);
- }
-
- // write a sample to the buffer, clamping to +/- the clamp value
- void put_clamp(s32 index, sample_t sample, sample_t clamp = 1.0)
- {
- assert(clamp >= sample_t(0));
- put(index, std::clamp(sample, -clamp, clamp));
- }
-
- // write a sample to the buffer, converting from an integer with the given maximum
- void put_int(s32 index, s32 sample, s32 max)
- {
- put(index, sample_t(sample) * (1.0f / sample_t(max)));
- }
-
- // write a sample to the buffer, converting from an integer with the given maximum
- void put_int_clamp(s32 index, s32 sample, s32 maxclamp)
- {
- assert(maxclamp >= 0);
- put_int(index, std::clamp(sample, -maxclamp, maxclamp), maxclamp);
- }
-
- // safely add a sample to the buffer
- void add(s32 start, sample_t sample)
- {
- sound_assert(u32(start) < samples());
- u32 index = index_to_buffer_index(start);
- m_buffer->put(index, m_buffer->get(index) + sample);
- }
-
- // add a sample to the buffer, converting from an integer with the given maximum
- void add_int(s32 index, s32 sample, s32 max)
- {
- add(index, sample_t(sample) * (1.0f / sample_t(max)));
- }
-
- // fill part of the view with the given value
- void fill(sample_t value, s32 start, s32 count)
- {
- if (start + count > samples())
- count = samples() - start;
- u32 index = index_to_buffer_index(start);
- for (s32 sampindex = 0; sampindex < count; sampindex++)
- {
- m_buffer->put(index, value);
- index = m_buffer->next_index(index);
- }
- }
- void fill(sample_t value, s32 start) { fill(value, start, samples() - start); }
- void fill(sample_t value) { fill(value, 0, samples()); }
-
- // copy data from another view
- void copy(read_stream_view const &src, s32 start, s32 count)
- {
- if (start + count > samples())
- count = samples() - start;
- u32 index = index_to_buffer_index(start);
- for (s32 sampindex = 0; sampindex < count; sampindex++)
- {
- m_buffer->put(index, src.get(start + sampindex));
- index = m_buffer->next_index(index);
- }
- }
- void copy(read_stream_view const &src, s32 start) { copy(src, start, samples() - start); }
- void copy(read_stream_view const &src) { copy(src, 0, samples()); }
-
- // add data from another view to our current values
- void add(read_stream_view const &src, s32 start, s32 count)
- {
- if (start + count > samples())
- count = samples() - start;
- u32 index = index_to_buffer_index(start);
- for (s32 sampindex = 0; sampindex < count; sampindex++)
- {
- m_buffer->put(index, m_buffer->get(index) + src.get(start + sampindex));
- index = m_buffer->next_index(index);
- }
- }
- void add(read_stream_view const &src, s32 start) { add(src, start, samples() - start); }
- void add(read_stream_view const &src) { add(src, 0, samples()); }
-
-private:
- // given a stream starting offset, return the buffer index
- u32 index_to_buffer_index(s32 start) const
- {
- u32 index = start + m_start;
- if (index >= m_buffer->size())
- index -= m_buffer->size();
- return index;
- }
-};
-
-
-// ======================> sound_stream_output
-
-class sound_stream_output
-{
-#if (SOUND_DEBUG)
- friend class sound_stream;
-#endif
-
-public:
- // construction/destruction
- sound_stream_output();
-
- // initialization
- void init(sound_stream &stream, u32 index, char const *tag_base);
-
- // no copying allowed
- sound_stream_output(sound_stream_output const &src) = delete;
- sound_stream_output &operator=(sound_stream_output const &rhs) = delete;
-
- // simple getters
- sound_stream &stream() const { sound_assert(m_stream != nullptr); return *m_stream; }
- attotime end_time() const { return m_buffer.end_time(); }
- u32 index() const { return m_index; }
- stream_buffer::sample_t gain() const { return m_gain; }
- u32 buffer_sample_rate() const { return m_buffer.sample_rate(); }
-
- // simple setters
- void set_gain(float gain) { m_gain = gain; }
-
- // return a friendly name
- std::string name() const;
-
- // handle a changing sample rate
- void sample_rate_changed(u32 rate) { m_buffer.set_sample_rate(rate, true); }
-
- // return an output view covering a time period
- write_stream_view view(attotime start, attotime end) { return write_stream_view(m_buffer, start, end); }
-
- // resync the buffer to the given end time
- void set_end_time(attotime end) { m_buffer.set_end_time(end); }
-
- // attempt to optimize resamplers by reusing them where possible
- sound_stream_output &optimize_resampler(sound_stream_output *input_resampler);
-
-private:
- // internal state
- sound_stream *m_stream; // owning stream
- stream_buffer m_buffer; // output buffer
- u32 m_index; // output index within the stream
- stream_buffer::sample_t m_gain; // gain to apply to the output
- std::vector<sound_stream_output *> m_resampler_list; // list of resamplers we're connected to
-};
-
-
-// ======================> sound_stream_input
-
-class sound_stream_input
-{
-#if (SOUND_DEBUG)
- friend class sound_stream;
-#endif
-
-public:
- // construction/destruction
- sound_stream_input();
-
- // initialization
- void init(sound_stream &stream, u32 index, char const *tag_base, sound_stream_output *resampler);
-
- // no copying allowed
- sound_stream_input(sound_stream_input const &src) = delete;
- sound_stream_input &operator=(sound_stream_input const &rhs) = delete;
-
- // simple getters
- bool valid() const { return (m_native_source != nullptr); }
- sound_stream &owner() const { sound_assert(valid()); return *m_owner; }
- sound_stream_output &source() const { sound_assert(valid()); return *m_native_source; }
- u32 index() const { return m_index; }
- stream_buffer::sample_t gain() const { return m_gain; }
- stream_buffer::sample_t user_gain() const { return m_user_gain; }
-
- // simple setters
- void set_gain(float gain) { m_gain = gain; }
- void set_user_gain(float gain) { m_user_gain = gain; }
-
- // return a friendly name
- std::string name() const;
-
- // connect the source
- void set_source(sound_stream_output *source);
-
- // update and return an reading view
- read_stream_view update(attotime start, attotime end);
-
- // tell inputs to apply sample rate changes
- void apply_sample_rate_changes(u32 updatenum, u32 downstream_rate);
-
-private:
- // internal state
- sound_stream *m_owner; // pointer to the owning stream
- sound_stream_output *m_native_source; // pointer to the native sound_stream_output
- sound_stream_output *m_resampler_source; // pointer to the resampler output
- u32 m_index; // input index within the stream
- stream_buffer::sample_t m_gain; // gain to apply to this input
- stream_buffer::sample_t m_user_gain; // user-controlled gain to apply to this input
-};
-
-
-// ======================> stream_update_delegate
-
-// new-style callback
-using stream_update_delegate = delegate<void (sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)>;
-
+using stream_update_delegate = delegate<void (sound_stream &stream)>;
+class audio_effect;
+class audio_resampler;
// ======================> sound_stream_flags
@@ -592,86 +108,203 @@ enum sound_stream_flags : u32
// specify that updates should be forced to one sample at a time, in real time
// this implicitly creates a timer that runs at the stream's output frequency
// so only use when strictly necessary
- STREAM_SYNCHRONOUS = 0x01,
-
- // specify that input streams should not be resampled; stream update handler
- // must be able to accommodate multiple strams of differing input rates
- STREAM_DISABLE_INPUT_RESAMPLING = 0x02
+ STREAM_SYNCHRONOUS = 0x01
};
+namespace emu::detail {
+ template<typename S> class output_buffer_interleaved {
+ public:
+ output_buffer_interleaved(u32 buffer_size, u32 channels);
+
+ void set_buffer_size(u32 buffer_size);
+
+ u32 channels() const { return m_channels; }
+ u64 sync_sample() const { return m_sync_sample; }
+ void set_sync_sample(u64 sample) { m_sync_sample = sample; }
+ u64 write_sample() const { return m_sync_sample + m_write_position - m_sync_position; }
+ void prepare_space(u32 samples);
+ void commit(u32 samples);
+ void sync();
+
+ void ensure_size(u32 buffer_size);
+ void set_history(u32 history);
+
+ u32 available_samples() const { return m_write_position - m_sync_position; }
+ S *ptrw(u32 channel, s32 index) { return &m_buffer[(m_write_position + index) * m_channels + channel]; }
+ const S *ptrw(u32 channel, s32 index) const { return &m_buffer[(m_write_position + index) * m_channels + channel]; }
+ const S *ptrs(u32 channel, s32 index) const { return &m_buffer[(m_sync_position + index) * m_channels + channel]; }
+
+ private:
+ std::vector<S> m_buffer;
+ u64 m_sync_sample;
+ u32 m_write_position;
+ u32 m_sync_position;
+ u32 m_history;
+ u32 m_channels;
+ };
+
+ template<typename S> class output_buffer_flat {
+ friend class sound_stream; // To make state saving easier
+ public:
+ output_buffer_flat(u32 buffer_size, u32 channels);
+
+ void set_buffer_size(u32 buffer_size);
+
+ u32 channels() const { return m_channels; }
+ u64 sync_sample() const { return m_sync_sample; }
+ void set_sync_sample(u64 sample) { m_sync_sample = sample; }
+ u64 write_sample() const { return m_sync_sample + m_write_position - m_sync_position; }
+
+ void prepare_space(u32 samples);
+ void commit(u32 samples);
+ void sync();
+
+ void ensure_size(u32 buffer_size);
+ void set_history(u32 history);
+
+ void resample(u32 previous_rate, u32 next_rate, attotime sync_time, attotime now);
+
+ void register_save_state(device_t &device, const char *id1, const char *id2);
+
+ u32 available_samples() const { return m_write_position - m_sync_position; }
+ S *ptrw(u32 channel, s32 index) { return &m_buffer[channel][m_write_position + index]; }
+ const S *ptrw(u32 channel, s32 index) const { return &m_buffer[channel][m_write_position + index]; }
+ const S *ptrs(u32 channel, s32 index) const { return &m_buffer[channel][m_sync_position + index]; }
+
+ private:
+ std::vector<std::vector<S>> m_buffer;
+ u64 m_sync_sample;
+ u32 m_write_position;
+ u32 m_sync_position;
+ u32 m_history;
+ u32 m_channels;
+ };
+}
// ======================> sound_stream
class sound_stream
{
+public:
friend class sound_manager;
+ using sample_t = float;
- // private common constructopr
- sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output_base, u32 sample_rate, sound_stream_flags flags);
-
-public:
// construction/destruction
- sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output_base, u32 sample_rate, stream_update_delegate callback, sound_stream_flags flags = STREAM_DEFAULT_FLAGS);
+ sound_stream(device_t &device, u32 inputs, u32 outputs, u32 sample_rate, stream_update_delegate callback, sound_stream_flags flags = sound_stream_flags::STREAM_DEFAULT_FLAGS);
virtual ~sound_stream();
// simple getters
- sound_stream *next() const { return m_next; }
device_t &device() const { return m_device; }
std::string name() const { return m_name; }
- bool input_adaptive() const { return m_input_adaptive || m_synchronous; }
+ bool input_adaptive() const { return m_input_adaptive; }
bool output_adaptive() const { return m_output_adaptive; }
bool synchronous() const { return m_synchronous; }
- bool resampling_disabled() const { return m_resampling_disabled; }
+ bool is_active() const { return m_sample_rate != 0; }
// input and output getters
- u32 input_count() const { return m_input.size(); }
- u32 output_count() const { return m_output.size(); }
- u32 output_base() const { return m_output_base; }
- sound_stream_input &input(int index) { sound_assert(index >= 0 && index < m_input.size()); return m_input[index]; }
- sound_stream_output &output(int index) { sound_assert(index >= 0 && index < m_output.size()); return m_output[index]; }
+ u32 input_count() const { return m_input_count; }
+ u32 output_count() const { return m_output_count; }
// sample rate and timing getters
- u32 sample_rate() const { return (m_pending_sample_rate != SAMPLE_RATE_INVALID) ? m_pending_sample_rate : m_sample_rate; }
- attotime sample_time() const { return m_output[0].end_time(); }
- attotime sample_period() const { return attotime(0, sample_period_attoseconds()); }
- attoseconds_t sample_period_attoseconds() const { return (m_sample_rate != SAMPLE_RATE_INVALID) ? HZ_TO_ATTOSECONDS(m_sample_rate) : ATTOSECONDS_PER_SECOND; }
-
- // set the sample rate of the stream; will kick in at the next global update
+ u32 sample_rate() const { return m_sample_rate; }
+ attotime sample_period() const { return attotime::from_hz(m_sample_rate); }
+
+ // sample id and timing of the first and last sample of the current update block, and first of the next sample block
+ u64 start_index() const { return m_output_buffer.write_sample(); }
+ u64 end_index() const { return m_output_buffer.write_sample() + samples() - 1; }
+ u64 sample_index() const { return m_output_buffer.write_sample() + samples(); }
+ attotime start_time() const { return sample_to_time(start_index()); }
+ attotime end_time() const { return sample_to_time(end_index()); }
+ attotime sample_time() const { return sample_to_time(sample_index()); }
+
+ // convert from absolute sample index to time
+ attotime sample_to_time(u64 index) const;
+
+ // gain management
+ float user_output_gain() const { return m_user_output_gain; }
+ void set_user_output_gain(float gain) { update(); m_user_output_gain = gain; }
+ float user_output_gain(s32 output) const { return m_user_output_channel_gain[output]; }
+ void set_user_output_gain(s32 output, float gain) { update(); m_user_output_channel_gain[output] = gain; }
+
+ float input_gain(s32 input) const { return m_input_channel_gain[input]; }
+ void set_input_gain(s32 input, float gain) { update(); m_input_channel_gain[input] = gain; }
+ void apply_input_gain(s32 input, float gain) { update(); m_input_channel_gain[input] *= gain; }
+ float output_gain(s32 output) const { return m_output_channel_gain[output]; }
+ void set_output_gain(s32 output, float gain) { update(); m_output_channel_gain[output] = gain; }
+ void apply_output_gain(s32 output, float gain) { update(); m_output_channel_gain[output] *= gain; }
+
+ // set the sample rate of the stream
void set_sample_rate(u32 sample_rate);
- // connect the output 'outputnum' of given input_stream to this stream's input 'inputnum'
- void set_input(int inputnum, sound_stream *input_stream, int outputnum = 0, float gain = 1.0f);
-
// force an update to the current time
void update();
- // force an update to the current time, returning a view covering the given time period
- read_stream_view update_view(attotime start, attotime end, u32 outputnum = 0);
+ // number of samples to handle
+ s32 samples() const { return m_samples_to_update; }
- // apply any pending sample rate changes; should only be called by the sound manager
- void apply_sample_rate_changes(u32 updatenum, u32 downstream_rate);
+ // write a sample to the buffer
+ void put(s32 output, s32 index, sample_t sample) { *m_output_buffer.ptrw(output, index) = sample; }
-#if (SOUND_DEBUG)
- // print one level of the sound graph and recursively tell our inputs to do the same
- void print_graph_recursive(int indent, int index);
-#endif
+ // write a sample to the buffer, clamping to +/- the clamp value
+ void put_clamp(s32 output, s32 index, sample_t sample, sample_t clamp = 1.0) { put(output, index, std::clamp(sample, -clamp, clamp)); }
-protected:
- // protected state
- std::string m_name; // name of this stream
+ // write a sample to the buffer, converting from an integer with the given maximum
+ void put_int(s32 output, s32 index, s32 sample, s32 max) { put(output, index, double(sample)/max); }
+
+ // write a sample to the buffer, converting from an integer with the given maximum
+ void put_int_clamp(s32 output, s32 index, s32 sample, s32 maxclamp) { put_int(output, index, std::clamp(sample, -maxclamp, maxclamp-1), maxclamp); }
+
+ // safely add a sample to the buffer
+ void add(s32 output, s32 index, sample_t sample) { *m_output_buffer.ptrw(output, index) += sample; }
+
+ // add a sample to the buffer, converting from an integer with the given maximum
+ void add_int(s32 output, s32 index, s32 sample, s32 max) { add(output, index, double(sample)/max); }
+
+ // fill part of the view with the given value
+ void fill(s32 output, sample_t value, s32 start, s32 count) { std::fill(m_output_buffer.ptrw(output, start), m_output_buffer.ptrw(output, start+count), value); }
+ void fill(s32 output, sample_t value, s32 start) { std::fill(m_output_buffer.ptrw(output, start), m_output_buffer.ptrw(output, samples()), value); }
+ void fill(s32 output, sample_t value) { std::fill(m_output_buffer.ptrw(output, 0), m_output_buffer.ptrw(output, samples()), value); }
+
+ // copy data from the input
+ void copy(s32 output, s32 input, s32 start, s32 count) { std::copy(m_input_buffer[input].begin() + start, m_input_buffer[input].begin() + start + count, m_output_buffer.ptrw(output, start)); }
+ void copy(s32 output, s32 input, s32 start) { std::copy(m_input_buffer[input].begin() + start, m_input_buffer[input].begin() + samples(), m_output_buffer.ptrw(output, start)); }
+ void copy(s32 output, s32 input) { std::copy(m_input_buffer[input].begin(), m_input_buffer[input].begin() + samples(), m_output_buffer.ptrw(output, 0)); }
+
+ // fetch a sample from the input buffer
+ sample_t get(s32 input, s32 index) const { return m_input_buffer[input][index]; }
+
+ // fetch a sample from the output buffer
+ sample_t get_output(s32 output, s32 index) const { return *m_output_buffer.ptrw(output, index); }
+
+ void add_bw_route(sound_stream *source, int output, int input, float gain);
+ void add_fw_route(sound_stream *target, int input, int output);
+ std::vector<sound_stream *> sources() const;
+ std::vector<sound_stream *> targets() const;
+
+ bool set_route_gain(sound_stream *source, int source_channel, int target_channel, float gain);
private:
- // perform most of the initialization here
- void init_common(u32 inputs, u32 outputs, u32 sample_rate, sound_stream_flags flags);
+ struct route_bw {
+ sound_stream *m_source;
+ int m_output;
+ int m_input;
+ float m_gain;
+ const audio_resampler *m_resampler;
- // if the sample rate has changed, this gets called to update internals
- void sample_rate_changed();
+ route_bw(sound_stream *source, int output, int input, float gain) : m_source(source), m_output(output), m_input(input), m_gain(gain), m_resampler(nullptr) {}
+ };
- // handle updates after a save state load
- void postload();
+ struct route_fw {
+ sound_stream *m_target;
+ int m_input;
+ int m_output;
+
+ route_fw(sound_stream *target, int input, int output) : m_target(target), m_input(input), m_output(output) {}
+ };
- // handle updates before a save state load
- void presave();
+
+ // perform most of the initialization here
+ void init();
// re-print the synchronization timer
void reprime_sync_timer();
@@ -679,68 +312,58 @@ private:
// timer callback for synchronous streams
void sync_update(s32);
- // return a view of 0 data covering the given time period
- read_stream_view empty_view(attotime start, attotime end);
+ void update_nodeps();
+ void sync(attotime now);
+ u64 get_current_sample_index() const;
+ void do_update();
+
+ bool frequency_is_solved() const { return (!(m_input_adaptive || m_output_adaptive)) || m_sample_rate != 0; }
+ bool try_solving_frequency();
+ void register_state();
+ void add_dependants(std::vector<sound_stream *> &deps);
+ void compute_dependants();
+ void create_resamplers();
+ void lookup_history_sizes();
+ u32 get_history_for_bw_route(const sound_stream *source, u32 channel) const;
+ void internal_set_sample_rate(u32 sample_rate);
+
+ std::string m_name; // name of this stream
+ std::string m_state_tag;
// linking information
device_t &m_device; // owning device
- sound_stream *m_next; // next stream in the chain
+ std::vector<route_bw> m_bw_routes;
+ std::vector<route_fw> m_fw_routes;
+ std::vector<sound_stream *> m_dependant_streams;
+
+ // buffers
+ std::vector<std::vector<sample_t>> m_input_buffer;
+ emu::detail::output_buffer_flat<sample_t> m_output_buffer;
+ attotime m_sync_time;
+ s32 m_samples_to_update;
+
+ // gains
+ std::vector<float> m_input_channel_gain;
+ std::vector<float> m_output_channel_gain;
+ std::vector<float> m_user_output_channel_gain;
+ float m_user_output_gain;
// general information
- u32 m_sample_rate; // current live sample rate
- u32 m_pending_sample_rate; // pending sample rate for dynamic changes
- u32 m_last_sample_rate_update; // update number of last sample rate change
+ u32 m_sample_rate; // current sample rate
+ u32 m_input_count;
+ u32 m_output_count;
bool m_input_adaptive; // adaptive stream that runs at the sample rate of its input
bool m_output_adaptive; // adaptive stream that runs at the sample rate of its output
bool m_synchronous; // synchronous stream that runs at the rate of its input
- bool m_resampling_disabled; // is resampling of input streams disabled?
+ bool m_started;
+ bool m_in_update;
emu_timer *m_sync_timer; // update timer for synchronous streams
- attotime m_last_update_end_time; // last end_time() in update
-
- // input information
- std::vector<sound_stream_input> m_input; // list of streams we directly depend upon
- std::vector<read_stream_view> m_input_view; // array of output views for passing to the callback
- std::vector<std::unique_ptr<sound_stream>> m_resampler_list; // internal list of resamplers
- stream_buffer m_empty_buffer; // empty buffer for invalid inputs
-
- // output information
- u32 m_output_base; // base index of our outputs, relative to our device
- std::vector<sound_stream_output> m_output; // list of streams which directly depend upon us
- std::vector<write_stream_view> m_output_view; // array of output views for passing to the callback
-
// callback information
- stream_update_delegate m_callback_ex; // extended callback function
+ stream_update_delegate m_callback; // update callback function
};
-// ======================> default_resampler_stream
-
-class default_resampler_stream : public sound_stream
-{
-public:
- // construction/destruction
- default_resampler_stream(device_t &device);
-
- // update handler
- void resampler_sound_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs);
-
-private:
- // internal state
- u32 m_max_latency;
-};
-
-
-// ======================> sound_manager
-
-// structure describing an indexed mixer
-struct mixer_input
-{
- device_mixer_interface *mixer; // owning device interface
- sound_stream * stream; // stream within the device
- int inputnum; // input on the stream
-};
-
class sound_manager
{
friend class sound_stream;
@@ -755,6 +378,27 @@ class sound_manager
static const attotime STREAMS_UPDATE_ATTOTIME;
public:
+ using sample_t = sound_stream::sample_t;
+
+ struct mapping {
+ struct node_mapping {
+ u32 m_node;
+ float m_db;
+ bool m_is_system_default;
+ };
+
+ struct channel_mapping {
+ u32 m_guest_channel;
+ u32 m_node;
+ u32 m_node_channel;
+ float m_db;
+ bool m_is_system_default;
+ };
+ sound_io_device *m_dev;
+ std::vector<node_mapping> m_node_mappings;
+ std::vector<channel_mapping> m_channel_mappings;
+ };
+
static constexpr int STREAMS_UPDATE_FREQUENCY = 50;
// construction/destruction
@@ -763,14 +407,13 @@ public:
// getters
running_machine &machine() const { return m_machine; }
- int attenuation() const { return m_attenuation; }
const std::vector<std::unique_ptr<sound_stream>> &streams() const { return m_stream_list; }
- attotime last_update() const { return m_last_update; }
- int sample_count() const { return m_samples_this_update; }
int unique_id() { return m_unique_id++; }
- stream_buffer::sample_t compressor_scale() const { return m_compressor_scale; }
- // allocate a new stream with a new-style callback
+ const typename osd::audio_info &get_osd_info() const { return m_osd_info; }
+ const std::vector<mapping> &get_mappings() const { return m_mappings; }
+
+ // allocate a new stream
sound_stream *stream_alloc(device_t &device, u32 inputs, u32 outputs, u32 sample_rate, stream_update_delegate callback, sound_stream_flags flags);
// WAV recording
@@ -778,9 +421,21 @@ public:
bool start_recording();
bool start_recording(std::string_view filename);
void stop_recording();
-
- // set the global OSD attenuation level
- void set_attenuation(float attenuation);
+ u32 outputs_count() const { return m_outputs_count; }
+
+ // manage the sound_io mapping and volume configuration
+ void config_add_sound_io_connection_node(sound_io_device *dev, std::string name, float db);
+ void config_add_sound_io_connection_default(sound_io_device *dev, float db);
+ void config_remove_sound_io_connection_node(sound_io_device *dev, std::string name);
+ void config_remove_sound_io_connection_default(sound_io_device *dev);
+ void config_set_volume_sound_io_connection_node(sound_io_device *dev, std::string name, float db);
+ void config_set_volume_sound_io_connection_default(sound_io_device *dev, float db);
+ void config_add_sound_io_channel_connection_node(sound_io_device *dev, u32 guest_channel, std::string name, u32 node_channel, float db);
+ void config_add_sound_io_channel_connection_default(sound_io_device *dev, u32 guest_channel, u32 node_channel, float db);
+ void config_remove_sound_io_channel_connection_node(sound_io_device *dev, u32 guest_channel, std::string name, u32 node_channel);
+ void config_remove_sound_io_channel_connection_default(sound_io_device *dev, u32 guest_channel, u32 node_channel);
+ void config_set_volume_sound_io_channel_connection_node(sound_io_device *dev, u32 guest_channel, std::string name, u32 node_channel, float db);
+ void config_set_volume_sound_io_channel_connection_default(sound_io_device *dev, u32 guest_channel, u32 node_channel, float db);
// mute sound for one of various independent reasons
bool muted() const { return bool(m_muted); }
@@ -791,22 +446,120 @@ public:
void debugger_mute(bool turn_off) { mute(turn_off, MUTE_REASON_DEBUGGER); }
void system_mute(bool turn_off) { mute(turn_off, MUTE_REASON_SYSTEM); }
- // return information about the given mixer input, by index
- bool indexed_mixer_input(int index, mixer_input &info) const;
+ // master gain
+ float master_gain() const { return m_master_gain; }
+ void set_master_gain(float gain) { m_master_gain = gain; }
+
+ void before_devices_init();
+ void after_devices_init();
+ void postload();
+
+ void input_get(int m_id, sound_stream &stream);
+ void output_push(int m_id, sound_stream &stream);
+ const audio_resampler *get_resampler(u32 fs, u32 ft);
+
+ u32 effect_chains() const { return m_speakers.size(); }
+ std::string effect_chain_tag(s32 index) const;
+ std::vector<audio_effect *> effect_chain(s32 index) const;
+ std::vector<audio_effect *> default_effect_chain() const;
+ void default_effect_changed(u32 entry);
- // fill the given buffer with 16-bit stereo audio samples
- void samples(s16 *buffer);
+ void mapping_update();
private:
+ struct effect_step {
+ std::unique_ptr<audio_effect> m_effect;
+ emu::detail::output_buffer_flat<sample_t> m_buffer;
+ effect_step(u32 buffer_size, u32 channels);
+ };
+
+ struct mixing_step {
+ enum { CLEAR, COPY, ADD };
+ u32 m_mode;
+ u32 m_osd_index;
+ u32 m_osd_channel;
+ u32 m_device_index;
+ u32 m_device_channel;
+ float m_linear_volume;
+ };
+
+ struct speaker_info {
+ speaker_device &m_dev;
+ sound_stream *m_stream;
+ u32 m_channels;
+ u32 m_first_output;
+
+ emu::detail::output_buffer_flat<sample_t> m_buffer;
+
+ std::vector<effect_step> m_effects;
+
+ speaker_info(speaker_device &dev, u32 rate, u32 first_output);
+ };
+
+ struct microphone_info {
+ microphone_device &m_dev;
+ u32 m_channels;
+
+ std::vector<mixing_step> m_input_mixing_steps; // actions to take to fill the buffer
+ std::vector<sample_t> m_buffer;
+ microphone_info(microphone_device &dev);
+ };
+
+ struct osd_stream {
+ u32 m_id;
+ u32 m_node;
+ std::string m_node_name;
+ u32 m_channels;
+ u32 m_rate;
+ u32 m_unused_channels_mask;
+ bool m_is_system_default;
+ bool m_is_channel_mapping;
+ sound_io_device *m_dev;
+ std::vector<float> m_volumes;
+
+ osd_stream(u32 node, std::string node_name, u32 channels, u32 rate, bool is_system_default, sound_io_device *dev) :
+ m_id(0),
+ m_node(node),
+ m_node_name(node_name),
+ m_channels(channels),
+ m_rate(rate),
+ m_unused_channels_mask(util::make_bitmask<u32>(channels)),
+ m_is_system_default(is_system_default),
+ m_is_channel_mapping(false),
+ m_dev(dev)
+ { }
+ };
+
+ struct osd_input_stream : public osd_stream {
+ emu::detail::output_buffer_interleaved<s16> m_buffer;
+ osd_input_stream(u32 node, std::string node_name, u32 channels, u32 rate, bool is_system_default, sound_io_device *dev) :
+ osd_stream(node, node_name, channels, rate, is_system_default, dev),
+ m_buffer(rate, channels)
+ { }
+ };
+
+ struct osd_output_stream : public osd_stream {
+ u64 m_last_sync;
+ u32 m_samples;
+ std::vector<s16> m_buffer;
+ osd_output_stream(u32 node, std::string node_name, u32 channels, u32 rate, bool is_system_default, sound_io_device *dev) :
+ osd_stream(node, node_name, channels, rate, is_system_default, dev),
+ m_last_sync(0),
+ m_samples(0),
+ m_buffer(channels*rate, 0)
+ { }
+ };
+
+ struct config_mapping {
+ std::string m_name;
+ // "" to indicates default node
+ std::vector<std::pair<std::string, float>> m_node_mappings;
+ std::vector<std::tuple<u32, std::string, u32, float>> m_channel_mappings;
+ };
+
// set/reset the mute state for the given reason
void mute(bool mute, u8 reason);
- // helper to remove items from the orphan list
- void recursive_remove_stream_from_orphan_list(sound_stream *stream);
-
- // apply pending sample rate changes
- void apply_sample_rate_changes();
-
// reset all sound chips
void reset();
@@ -818,39 +571,78 @@ private:
void config_load(config_type cfg_type, config_level cfg_lvl, util::xml::data_node const *parentnode);
void config_save(config_type cfg_type, util::xml::data_node *parentnode);
- // helper to adjust scale factor toward a goal
- stream_buffer::sample_t adjust_toward_compressor_scale(stream_buffer::sample_t curscale, stream_buffer::sample_t prevsample, stream_buffer::sample_t rawsample);
-
// periodic sound update, called STREAMS_UPDATE_FREQUENCY per second
- void update(s32 param = 0);
+ void update(s32);
+
+ // handle mixing mapping update if needed
+ static std::vector<u32> find_channel_mapping(const std::array<double, 3> &position, const osd::audio_info::node_info *node);
+ void startup_cleanups();
+ void streams_update();
+ template<bool is_output, typename S> void apply_osd_changes(std::vector<S> &streams);
+ void osd_information_update();
+ void generate_mapping();
+ void update_osd_streams();
+ void update_osd_input();
+ void speakers_update(attotime endtime);
+
+ void run_effects();
+
+ u64 rate_and_time_to_index(attotime time, u32 sample_rate) const;
+ u64 rate_and_last_sync_to_index(u32 sample_rate) const { return rate_and_time_to_index(m_last_sync_time, sample_rate); }
+
+ // manage the sound_io mapping and volume configuration,
+ // but don't change generation because we're in the update process
+
+ config_mapping &config_get_sound_io(sound_io_device *dev);
+ void internal_config_add_sound_io_connection_node(sound_io_device *dev, std::string name, float db);
+ void internal_config_add_sound_io_connection_default(sound_io_device *dev, float db);
+ void internal_config_remove_sound_io_connection_node(sound_io_device *dev, std::string name);
+ void internal_config_remove_sound_io_connection_default(sound_io_device *dev);
+ void internal_config_set_volume_sound_io_connection_node(sound_io_device *dev, std::string name, float db);
+ void internal_config_set_volume_sound_io_connection_default(sound_io_device *dev, float db);
+ void internal_config_add_sound_io_channel_connection_node(sound_io_device *dev, u32 guest_channel, std::string name, u32 node_channel, float db);
+ void internal_config_add_sound_io_channel_connection_default(sound_io_device *dev, u32 guest_channel, u32 node_channel, float db);
+ void internal_config_remove_sound_io_channel_connection_node(sound_io_device *dev, u32 guest_channel, std::string name, u32 node_channel);
+ void internal_config_remove_sound_io_channel_connection_default(sound_io_device *dev, u32 guest_channel, u32 node_channel);
+ void internal_config_set_volume_sound_io_channel_connection_node(sound_io_device *dev, u32 guest_channel, std::string name, u32 node_channel, float db);
+ void internal_config_set_volume_sound_io_channel_connection_default(sound_io_device *dev, u32 guest_channel, u32 node_channel, float db);
+
// internal state
- running_machine &m_machine; // reference to the running machine
- emu_timer *m_update_timer; // timer that runs the update function
- std::vector<std::reference_wrapper<speaker_device> > m_speakers;
-
- u32 m_update_number; // current update index; used for sample rate updates
- attotime m_last_update; // time of the last update
- u32 m_finalmix_leftover; // leftover samples in the final mix
- u32 m_samples_this_update; // number of samples this update
- std::vector<s16> m_finalmix; // final mix, in 16-bit signed format
- std::vector<stream_buffer::sample_t> m_leftmix; // left speaker mix, in native format
- std::vector<stream_buffer::sample_t> m_rightmix; // right speaker mix, in native format
-
- stream_buffer::sample_t m_compressor_scale; // current compressor scale factor
- int m_compressor_counter; // compressor update counter for backoff
- bool m_compressor_enabled; // enable compressor (it will still be calculated for detecting overdrive)
-
- u8 m_muted; // bitmask of muting reasons
- bool m_nosound_mode; // true if we're in "nosound" mode
- int m_attenuation; // current attentuation level (at the OSD)
- int m_unique_id; // unique ID used for stream identification
- util::wav_file_ptr m_wavfile; // WAV file for streaming
+ running_machine &m_machine; // reference to the running machine
+ emu_timer *m_update_timer; // timer that runs the update function
+ attotime m_last_sync_time;
+ std::vector<speaker_info> m_speakers;
+ std::vector<microphone_info> m_microphones;
+
+ std::vector<s16> m_record_buffer; // pre-effects speaker samples for recording
+ u32 m_record_samples; // how many samples for the next update
+ osd::audio_info m_osd_info; // current state of the osd information
+ std::vector<mapping> m_mappings; // current state of the mappings
+ std::vector<osd_input_stream> m_osd_input_streams; // currently active osd streams
+ std::vector<osd_output_stream> m_osd_output_streams; // currently active osd streams
+ std::vector<mixing_step> m_output_mixing_steps; // actions to take to fill the osd streams buffers
+ std::vector<config_mapping> m_configs; // mapping user configuration
+
+ std::mutex m_effects_mutex;
+ std::condition_variable m_effects_condition;
+ std::unique_ptr<std::thread> m_effects_thread;
+ std::vector<std::unique_ptr<audio_effect>> m_default_effects;
+ bool m_effects_done;
+
+ float m_master_gain;
+
+ std::map<std::pair<u32, u32>, std::unique_ptr<audio_resampler>> m_resamplers;
+
+ u8 m_muted; // bitmask of muting reasons
+ bool m_nosound_mode; // true if we're in "nosound" mode
+ int m_unique_id; // unique ID used for stream identification
+ util::wav_file_ptr m_wavfile; // WAV file for streaming
// streams data
std::vector<std::unique_ptr<sound_stream>> m_stream_list; // list of streams
- std::map<sound_stream *, u8> m_orphan_stream_list; // list of orphaned streams
- bool m_first_reset; // is this our first reset?
+ std::vector<sound_stream *> m_ordered_streams; // Streams in update order
+ u32 m_outputs_count;
};
diff --git a/src/emu/speaker.cpp b/src/emu/speaker.cpp
index 33b1e8d329a..d57f9119c24 100644
--- a/src/emu/speaker.cpp
+++ b/src/emu/speaker.cpp
@@ -5,6 +5,7 @@
speaker.cpp
Speaker output sound device.
+ Microphone input sound device.
***************************************************************************/
@@ -14,210 +15,80 @@
-//**************************************************************************
-// GLOBAL VARIABLES
-//**************************************************************************
-
-// device type definition
DEFINE_DEVICE_TYPE(SPEAKER, speaker_device, "speaker", "Speaker")
-
-
-
-//**************************************************************************
-// LIVE SPEAKER DEVICE
-//**************************************************************************
-
-//-------------------------------------------------
-// speaker_device - constructor
-//-------------------------------------------------
-
-speaker_device::speaker_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : device_t(mconfig, SPEAKER, tag, owner, clock)
- , device_mixer_interface(mconfig, *this)
- , m_x(0.0)
- , m_y(0.0)
- , m_z(0.0)
- , m_pan(0.0)
- , m_defpan(0.0)
- , m_current_max(0)
- , m_samples_this_bucket(0)
+DEFINE_DEVICE_TYPE(MICROPHONE, microphone_device, "microphone", "Microphone")
+
+const sound_io_device::position_name_mapping sound_io_device::position_name_mappings[] = {
+ { 0.0, 0.0, 1.0, "Front center" },
+ { -0.2, 0.0, 1.0, "Front left" },
+ { 0.0, -0.5, 1.0, "Front floor" },
+ { 0.2, 0.0, 1.0, "Front right" },
+ { 0.0, 0.0, -0.5, "Rear center" },
+ { -0.2, 0.0, -0.5, "Rear left" },
+ { 0.2, 0.0, -0.5, "Read right" },
+ { 0.0, 0.0, -0.1, "Headrest center" },
+ { -0.1, 0.0, -0.1, "Headrest left" },
+ { 0.1, 0.0, -0.1, "Headrest right" },
+ { 0.0, -0.5, 0.0, "Seat" },
+ { 0.0, -0.2, 0.1, "Backrest" },
+ { }
+};
+
+std::string sound_io_device::get_position_name(u32 channel) const
{
+ for(unsigned int i = 0; position_name_mappings[i].m_name; i++)
+ if(m_positions[channel][0] == position_name_mappings[i].m_x && m_positions[channel][1] == position_name_mappings[i].m_y && m_positions[channel][2] == position_name_mappings[i].m_z)
+ return position_name_mappings[i].m_name;
+ return util::string_format("#%d", channel);
}
-
-//-------------------------------------------------
-// ~speaker_device - destructor
-//-------------------------------------------------
-
-speaker_device::~speaker_device()
+sound_io_device &sound_io_device::set_position(u32 channel, double x, double y, double z)
{
+ if(channel >= m_positions.size())
+ fatalerror("%s: Requested channel %d on %d channel device\n", tag(), channel, m_positions.size());
+ m_positions[channel][0] = x;
+ m_positions[channel][1] = y;
+ m_positions[channel][2] = z;
+ return *this;
}
-
-//-------------------------------------------------
-// set_position - set speaker position
-//-------------------------------------------------
-
-speaker_device &speaker_device::set_position(double x, double y, double z)
+sound_io_device::sound_io_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 channels) :
+ device_t(mconfig, type, tag, owner, 0),
+ device_sound_interface(mconfig, *this),
+ m_positions(channels ? channels : 1)
{
- // as mentioned in the header file, y and z params currently have no effect
- m_x = x;
- m_y = y;
- m_z = z;
-
- // hard pan to left
- if (m_x < 0.0)
- set_pan(-1.0f);
-
- // hard pan to right
- else if (m_x > 0.0)
- set_pan(1.0f);
-
- // center (mono)
- else
- set_pan(0.0f);
-
- m_defpan = m_pan;
- return *this;
}
-//-------------------------------------------------
-// mix - mix in samples from the speaker's stream
-//-------------------------------------------------
+sound_io_device::~sound_io_device()
+{
+}
-void speaker_device::mix(stream_buffer::sample_t *leftmix, stream_buffer::sample_t *rightmix, attotime start, attotime end, int expected_samples, bool suppress)
+speaker_device::~speaker_device()
{
- // skip if no stream
- if (m_mixer_stream == nullptr)
- return;
-
- // skip if invalid range
- if (start > end)
- return;
-
- // get a view on the desired range
- read_stream_view view = m_mixer_stream->update_view(start, end);
- sound_assert(view.samples() >= expected_samples);
-
- // track maximum sample value for each 0.1s bucket
- if (machine().options().speaker_report() != 0)
- {
- u32 samples_per_bucket = m_mixer_stream->sample_rate() / BUCKETS_PER_SECOND;
- for (int sample = 0; sample < expected_samples; sample++)
- {
- m_current_max = std::max(m_current_max, fabsf(view.get(sample)));
- if (++m_samples_this_bucket >= samples_per_bucket)
- {
- m_max_sample.push_back(m_current_max);
- m_current_max = 0.0f;
- m_samples_this_bucket = 0;
- }
- }
- }
-
- // mix if sound is enabled
- if (!suppress)
- {
- // if the speaker is hard panned to the left, send only to the left
- if (m_pan == -1.0f)
- for (int sample = 0; sample < expected_samples; sample++)
- leftmix[sample] += view.get(sample);
-
- // if the speaker is hard panned to the right, send only to the right
- else if (m_pan == 1.0f)
- for (int sample = 0; sample < expected_samples; sample++)
- rightmix[sample] += view.get(sample);
-
- // otherwise, send to both
- else
- {
- const float leftpan = (m_pan <= 0.0f) ? 1.0f : 1.0f - m_pan;
- const float rightpan = (m_pan >= 0.0f) ? 1.0f : 1.0f + m_pan;
-
- for (int sample = 0; sample < expected_samples; sample++)
- {
- stream_buffer::sample_t cursample = view.get(sample);
- leftmix[sample] += cursample * leftpan;
- rightmix[sample] += cursample * rightpan;
- }
- }
- }
}
+microphone_device::~microphone_device()
+{
+}
-//-------------------------------------------------
-// device_start - handle device startup
-//-------------------------------------------------
void speaker_device::device_start()
{
+ m_stream = stream_alloc(m_positions.size(), 0, machine().sample_rate());
}
+void microphone_device::device_start()
+{
+ m_stream = stream_alloc(0, m_positions.size(), machine().sample_rate());
+}
-//-------------------------------------------------
-// device_stop - cleanup and report
-//-------------------------------------------------
+void speaker_device::sound_stream_update(sound_stream &stream)
+{
+ machine().sound().output_push(m_id, stream);
+}
-void speaker_device::device_stop()
+void microphone_device::sound_stream_update(sound_stream &stream)
{
- // level 1: just report if there was any clipping
- // level 2: report the overall maximum, even if no clipping
- // level 3: print a detailed list of all the times there was clipping
- // level 4: print a detailed list of every bucket
- int report = machine().options().speaker_report();
- if (report != 0)
- {
- m_max_sample.push_back(m_current_max);
-
- // determine overall maximum and number of clipped buckets
- stream_buffer::sample_t overallmax = 0;
- u32 clipped = 0;
- for (auto &curmax : m_max_sample)
- {
- overallmax = std::max(overallmax, curmax);
- if (curmax > stream_buffer::sample_t(1.0))
- clipped++;
- }
-
- // levels 1 and 2 just get a summary
- if (clipped != 0 || report == 2 || report == 4)
- osd_printf_info("Speaker \"%s\" - max = %.5f (gain *= %.3f) - clipped in %d/%d (%d%%) buckets\n", tag(), overallmax, 1 / (overallmax ? overallmax : 1), clipped, m_max_sample.size(), clipped * 100 / m_max_sample.size());
-
- // levels 3 and 4 get a full dump
- if (report >= 3)
- {
- static char const * const s_stars = "************************************************************";
- static char const * const s_spaces = " ";
- int totalstars = strlen(s_stars);
- double t = 0;
- if (overallmax < 1.0)
- overallmax = 1.0;
- int leftstars = totalstars / overallmax;
- for (auto &curmax : m_max_sample)
- {
- if (curmax > stream_buffer::sample_t(1.0) || report == 4)
- {
- osd_printf_info("%6.1f: %9.5f |", t, curmax);
- if (curmax == 0)
- osd_printf_info("%.*s|\n", leftstars, s_spaces);
- else if (curmax <= 1.0)
- {
- int stars = std::max(1, std::min(leftstars, int(curmax * totalstars / overallmax)));
- osd_printf_info("%.*s", stars, s_stars);
- int spaces = leftstars - stars;
- if (spaces != 0)
- osd_printf_info("%.*s", spaces, s_spaces);
- osd_printf_info("|\n");
- }
- else
- {
- int rightstars = std::max(1, std::min(totalstars, int(curmax * totalstars / overallmax)) - leftstars);
- osd_printf_info("%.*s|%.*s\n", leftstars, s_stars, rightstars, s_stars);
- }
- }
- t += 1.0 / double(BUCKETS_PER_SECOND);
- }
- }
- }
+ machine().sound().input_get(m_id, stream);
}
diff --git a/src/emu/speaker.h b/src/emu/speaker.h
index 3cb0794d998..4674c0bf08d 100644
--- a/src/emu/speaker.h
+++ b/src/emu/speaker.h
@@ -5,8 +5,9 @@
speaker.h
Speaker output sound device.
+ Microphone input sound device.
- Speakers have (x, y, z) coordinates in 3D space:
+ They have (x, y, z) coordinates in 3D space:
* Observer is at position (0, 0, 0)
* Positive x is to the right of the observer
* Negative x is to the left of the observer
@@ -15,9 +16,6 @@
* Positive z is in front of the observer
* Negative z is behind the observer
- Currently, MAME only considers the sign of the x coordinate (not its
- magnitude), and completely ignores the y and z coordinates.
-
***************************************************************************/
#ifndef MAME_EMU_SPEAKER_H
@@ -32,6 +30,7 @@
// device type definition
DECLARE_DEVICE_TYPE(SPEAKER, speaker_device)
+DECLARE_DEVICE_TYPE(MICROPHONE, microphone_device)
@@ -39,65 +38,103 @@ DECLARE_DEVICE_TYPE(SPEAKER, speaker_device)
// TYPE DEFINITIONS
//**************************************************************************
-// ======================> speaker_device
+class sound_io_device : public device_t, public device_sound_interface
+{
+public:
+ virtual ~sound_io_device();
+
+ // configuration helpers
+ sound_io_device &set_position(u32 channel, double x, double y, double z);
+ sound_io_device &front_center(u32 channel = 0) { return set_position(channel, 0.0, 0.0, 1.0); }
+ sound_io_device &front_left(u32 channel = 0) { return set_position(channel, -0.2, 0.0, 1.0); }
+ sound_io_device &front_floor(u32 channel = 0) { return set_position(channel, 0.0, -0.5, 1.0); }
+ sound_io_device &front_right(u32 channel = 0) { return set_position(channel, 0.2, 0.0, 1.0); }
+ sound_io_device &rear_center(u32 channel = 0) { return set_position(channel, 0.0, 0.0, -0.5); }
+ sound_io_device &rear_left(u32 channel = 0) { return set_position(channel, -0.2, 0.0, -0.5); }
+ sound_io_device &rear_right(u32 channel = 0) { return set_position(channel, 0.2, 0.0, -0.5); }
+ sound_io_device &headrest_center(u32 channel = 0) { return set_position(channel, 0.0, 0.0, -0.1); }
+ sound_io_device &headrest_left(u32 channel = 0) { return set_position(channel, -0.1, 0.0, -0.1); }
+ sound_io_device &headrest_right(u32 channel = 0) { return set_position(channel, 0.1, 0.0, -0.1); }
+ sound_io_device &seat(u32 channel = 0) { return set_position(channel, 0.0, -0.5, 0.0); }
+ sound_io_device &backrest(u32 channel = 0) { return set_position(channel, 0.0, -0.2, 0.1); }
+ sound_io_device &front() { return front_left(0).front_right(1); }
+ sound_io_device &rear() { return rear_left(0).rear_right(1); }
+ sound_io_device &corners() { return front_left(0).front_right(1).rear_left(2).rear_right(3); }
+ int channels() const { return m_positions.size(); }
+ std::array<double, 3> get_position(u32 channel) const { return m_positions[channel]; }
+ std::string get_position_name(u32 channel) const;
+
+ virtual bool is_output() const = 0;
+ void set_id(int id) { m_id = id; }
+ int get_id() const { return m_id; }
+
+ sound_stream *stream() const { return m_stream; }
+
+protected:
+ struct position_name_mapping {
+ double m_x, m_y, m_z;
+ const char *m_name;
+ };
+
+ static const position_name_mapping position_name_mappings[];
-class speaker_device : public device_t, public device_mixer_interface
+ // configuration state
+ std::vector<std::array<double, 3>> m_positions;
+ sound_stream *m_stream;
+ int m_id;
+
+ sound_io_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, double x, double y, double z)
+ : sound_io_device(mconfig, type, tag, owner, 1)
+ {
+ set_position(0, x, y, z);
+ }
+ sound_io_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 channels); // Collides with clock, but not important
+};
+
+class speaker_device : public sound_io_device
{
public:
// construction/destruction
speaker_device(const machine_config &mconfig, const char *tag, device_t *owner, double x, double y, double z)
- : speaker_device(mconfig, tag, owner, 0)
- {
- set_position(x, y, z);
- }
- speaker_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0);
+ : sound_io_device(mconfig, SPEAKER, tag, owner, x, y, z) {}
+ speaker_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 channels = 1)
+ : sound_io_device(mconfig, SPEAKER, tag, owner, channels) {}
+
virtual ~speaker_device();
- // configuration helpers
- speaker_device &set_position(double x, double y, double z);
- speaker_device &front_center() { set_position( 0.0, 0.0, 1.0); return *this; }
- speaker_device &front_left() { set_position(-0.2, 0.0, 1.0); return *this; }
- speaker_device &front_floor() { set_position( 0.0, -0.5, 1.0); return *this; }
- speaker_device &front_right() { set_position( 0.2, 0.0, 1.0); return *this; }
- speaker_device &rear_center() { set_position( 0.0, 0.0, -0.5); return *this; }
- speaker_device &rear_left() { set_position(-0.2, 0.0, -0.5); return *this; }
- speaker_device &rear_right() { set_position( 0.2, 0.0, -0.5); return *this; }
- speaker_device &headrest_center() { set_position( 0.0, 0.0, -0.1); return *this; }
- speaker_device &headrest_left() { set_position(-0.1, 0.0, -0.1); return *this; }
- speaker_device &headrest_right() { set_position( 0.1, 0.0, -0.1); return *this; }
- speaker_device &seat() { set_position( 0.0, -0.5, 0.0); return *this; }
- speaker_device &backrest() { set_position( 0.0, -0.2, 0.1); return *this; }
-
- // internally for use by the sound system
- void mix(stream_buffer::sample_t *leftmix, stream_buffer::sample_t *rightmix, attotime start, attotime end, int expected_samples, bool suppress);
-
- // user panning configuration
- void set_pan(float pan) { m_pan = std::clamp(pan, -1.0f, 1.0f); }
- float pan() { return m_pan; }
- float defpan() { return m_defpan; }
+ virtual bool is_output() const override { return true; }
protected:
+
// device-level overrides
virtual void device_start() override ATTR_COLD;
- virtual void device_stop() override ATTR_COLD;
- // configuration state
- double m_x;
- double m_y;
- double m_z;
- float m_pan;
- float m_defpan;
-
- // internal state
- static constexpr int BUCKETS_PER_SECOND = 10;
- std::vector<stream_buffer::sample_t> m_max_sample;
- stream_buffer::sample_t m_current_max;
- u32 m_samples_this_bucket;
+ virtual void sound_stream_update(sound_stream &stream) override;
};
+class microphone_device : public sound_io_device
+{
+public:
+ // construction/destruction
+ microphone_device(const machine_config &mconfig, const char *tag, device_t *owner, double x, double y, double z)
+ : sound_io_device(mconfig, MICROPHONE, tag, owner, x, y, z) {}
+ microphone_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 channels = 1)
+ : sound_io_device(mconfig, MICROPHONE, tag, owner, channels) {}
+
+ virtual ~microphone_device();
+
+ virtual bool is_output() const override { return false; }
+
+protected:
+
+ // device-level overrides
+ virtual void device_start() override ATTR_COLD;
+
+ virtual void sound_stream_update(sound_stream &stream) override;
+};
-// speaker device iterator
using speaker_device_enumerator = device_type_enumerator<speaker_device>;
+using microphone_device_enumerator = device_type_enumerator<microphone_device>;
#endif // MAME_EMU_SPEAKER_H
diff --git a/src/frontend/mame/infoxml.cpp b/src/frontend/mame/infoxml.cpp
index ee5c51d3a21..1318fa12fda 100644
--- a/src/frontend/mame/infoxml.cpp
+++ b/src/frontend/mame/infoxml.cpp
@@ -1257,7 +1257,7 @@ void output_chips(std::ostream &out, device_t &device, const char *root_tag)
// iterate over sound devices
for (device_sound_interface &sound : sound_interface_enumerator(device))
{
- if (strcmp(sound.device().tag(), device.tag()) != 0 && sound.issound())
+ if (strcmp(sound.device().tag(), device.tag()) != 0)
{
std::string newtag(sound.device().tag()), oldtag(":");
newtag = newtag.substr(newtag.find(oldtag.append(root_tag)) + oldtag.length());
diff --git a/src/frontend/mame/luaengine.cpp b/src/frontend/mame/luaengine.cpp
index 93616f825f6..54693cd4536 100644
--- a/src/frontend/mame/luaengine.cpp
+++ b/src/frontend/mame/luaengine.cpp
@@ -26,6 +26,7 @@
#include "natkeyboard.h"
#include "screen.h"
#include "softlist.h"
+#include "speaker.h"
#include "uiinput.h"
#include "corestr.h"
@@ -605,13 +606,13 @@ size_t lua_engine::enumerate_functions(const char *id, T &&callback)
return count;
}
-bool lua_engine::execute_function(const char *id)
+template <typename... Params> bool lua_engine::execute_function(const char *id, Params&&... args)
{
size_t count = enumerate_functions(
id,
- [this] (const sol::protected_function &func)
+ [this, args...] (const sol::protected_function &func)
{
- auto ret = invoke(func);
+ auto ret = invoke(func, args...);
if (!ret.valid())
{
sol::error err = ret;
@@ -706,9 +707,23 @@ void lua_engine::on_machine_postload()
m_notifiers->on_postload();
}
-void lua_engine::on_sound_update()
+void lua_engine::on_sound_update(const std::map<std::string, std::vector<std::pair<const float *, int>>> &sound)
{
- execute_function("LUA_ON_SOUND_UPDATE");
+ auto stable = sol().create_table();
+ for(const auto &e : sound) {
+ auto dtable = sol().create_table();
+ u32 channels = e.second.size();
+ for(u32 channel = 0; channel != channels; channel ++) {
+ const auto &info = e.second[channel];
+ auto ctable = sol().create_table(sol::new_table(info.second));
+ for(u32 i=0; i != info.second; i++)
+ ctable[i+1] = info.first[i];
+ dtable[channel+1] = ctable;
+ }
+ stable[e.first] = dtable;
+ }
+
+ execute_function("LUA_ON_SOUND_UPDATE", stable);
}
void lua_engine::on_periodic()
@@ -1462,6 +1477,7 @@ void lua_engine::initialize()
machine_type["cassettes"] = sol::property([] (running_machine &m) { return devenum<cassette_device_enumerator>(m.root_device()); });
machine_type["images"] = sol::property([] (running_machine &m) { return devenum<image_interface_enumerator>(m.root_device()); });
machine_type["slots"] = sol::property([](running_machine &m) { return devenum<slot_interface_enumerator>(m.root_device()); });
+ machine_type["sounds"] = sol::property([](running_machine &m) { return devenum<sound_interface_enumerator>(m.root_device()); });
machine_type["phase"] = sol::property(
[] (running_machine const &m) -> char const *
{
@@ -1602,7 +1618,6 @@ void lua_engine::initialize()
return table;
});
-
auto dipalette_type = sol().registry().new_usertype<device_palette_interface>("dipalette", sol::no_constructor);
dipalette_type.set_function("pen", &device_palette_interface::pen);
dipalette_type.set_function(
@@ -1658,6 +1673,52 @@ void lua_engine::initialize()
dipalette_type["device"] = sol::property(static_cast<device_t & (device_palette_interface::*)()>(&device_palette_interface::device));
+ auto disound_type = sol().registry().new_usertype<device_sound_interface>("disound", sol::no_constructor);
+ disound_type["inputs"] = sol::property(&device_sound_interface::inputs);
+ disound_type["outputs"] = sol::property(&device_sound_interface::outputs);
+ disound_type["microphone"] = sol::property(
+ [] (device_sound_interface &dev)
+ {
+ return dev.device().type() == MICROPHONE;
+ });
+ disound_type["speaker"] = sol::property(
+ [] (device_sound_interface &dev)
+ {
+ return dev.device().type() == SPEAKER;
+ });
+ disound_type["io_positions"] = sol::property(
+ [this] (device_sound_interface &dev)
+ {
+ auto pos_table = sol().create_table();
+ auto *iodev = dynamic_cast<sound_io_device *>(&dev.device());
+ if (iodev)
+ for(int channel=0; channel != iodev->channels(); channel++)
+ {
+ auto pos = iodev->get_position(channel);
+ auto table = sol().create_table();
+ table[1] = pos[0];
+ table[2] = pos[1];
+ table[3] = pos[2];
+ pos_table[channel+1] = table;
+ }
+ return pos_table;
+ });
+ disound_type["io_names"] = sol::property(
+ [this] (device_sound_interface &dev)
+ {
+ auto pos_table = sol().create_table();
+ auto *iodev = dynamic_cast<sound_io_device *>(&dev.device());
+ if (iodev)
+ for(int channel=0; channel != iodev->channels(); channel++)
+ pos_table[channel+1] = iodev->get_position_name(channel);
+ return pos_table;
+ });
+
+ disound_type["hook"] = sol::property(&device_sound_interface::get_sound_hook, &device_sound_interface::set_sound_hook);
+ disound_type["device"] = sol::property(static_cast<device_t & (device_sound_interface::*)()>(&device_sound_interface::device));
+
+
+
auto screen_dev_type = sol().registry().new_usertype<screen_device>(
"screen_dev",
sol::no_constructor,
@@ -2068,16 +2129,6 @@ void lua_engine::initialize()
return filename ? sm.start_recording(filename) : sm.start_recording();
};
sound_type["stop_recording"] = &sound_manager::stop_recording;
- sound_type["get_samples"] =
- [] (sound_manager &sm, sol::this_state s)
- {
- luaL_Buffer buff;
- s32 const count = sm.sample_count() * 2 * 2; // 2 channels, 2 bytes per sample
- s16 *const ptr = (s16 *)luaL_buffinitsize(s, &buff, count);
- sm.samples(ptr);
- luaL_pushresultsize(&buff, count);
- return sol::make_reference(s, sol::stack_reference(s, -1));
- };
sound_type["muted"] = sol::property(&sound_manager::muted);
sound_type["ui_mute"] = sol::property(
static_cast<bool (sound_manager::*)() const>(&sound_manager::ui_mute),
@@ -2088,9 +2139,6 @@ void lua_engine::initialize()
sound_type["system_mute"] = sol::property(
static_cast<bool (sound_manager::*)() const>(&sound_manager::system_mute),
static_cast<void (sound_manager::*)(bool)>(&sound_manager::system_mute));
- sound_type["attenuation"] = sol::property(
- &sound_manager::attenuation,
- &sound_manager::set_attenuation);
sound_type["recording"] = sol::property(&sound_manager::is_recording);
diff --git a/src/frontend/mame/luaengine.h b/src/frontend/mame/luaengine.h
index de94e7ba729..a146ab2c0d2 100644
--- a/src/frontend/mame/luaengine.h
+++ b/src/frontend/mame/luaengine.h
@@ -61,7 +61,7 @@ public:
void set_machine(running_machine *machine);
std::vector<std::string> const &get_menu() { return m_menu; }
void attach_notifiers();
- void on_sound_update();
+ void on_sound_update(const std::map<std::string, std::vector<std::pair<const sound_stream::sample_t *, int>>> &sound);
void on_periodic();
bool on_missing_mandatory_image(const std::string &instance_name);
void on_machine_before_load_settings();
@@ -199,7 +199,7 @@ private:
void resume(s32 param);
void register_function(sol::function func, const char *id);
template <typename T> size_t enumerate_functions(const char *id, T &&callback);
- bool execute_function(const char *id);
+ template <typename... Params> bool execute_function(const char *id, Params&&... args);
sol::object call_plugin(const std::string &name, sol::object in);
void close();
diff --git a/src/frontend/mame/mame.cpp b/src/frontend/mame/mame.cpp
index a44bd19814f..d732392a5c9 100644
--- a/src/frontend/mame/mame.cpp
+++ b/src/frontend/mame/mame.cpp
@@ -474,9 +474,9 @@ bool emulator_info::frame_hook()
return mame_machine_manager::instance()->lua()->frame_hook();
}
-void emulator_info::sound_hook()
+void emulator_info::sound_hook(const std::map<std::string, std::vector<std::pair<const float *, int>>> &sound)
{
- return mame_machine_manager::instance()->lua()->on_sound_update();
+ return mame_machine_manager::instance()->lua()->on_sound_update(sound);
}
void emulator_info::layout_script_cb(layout_file &file, const char *script)
diff --git a/src/frontend/mame/ui/audio_effect_eq.cpp b/src/frontend/mame/ui/audio_effect_eq.cpp
new file mode 100644
index 00000000000..d758480ad00
--- /dev/null
+++ b/src/frontend/mame/ui/audio_effect_eq.cpp
@@ -0,0 +1,365 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+/*********************************************************************
+
+ ui/audio_effect_eq.cpp
+
+ Equalizer configuration
+
+*********************************************************************/
+
+#include "emu.h"
+#include "ui/audio_effect_eq.h"
+#include "audio_effects/aeffect.h"
+#include "audio_effects/eq.h"
+
+#include "ui/ui.h"
+
+namespace ui {
+
+const u32 menu_audio_effect_eq::freqs[3][43] = {
+ { 0, 32, 36, 40, 45, 50, 56, 63, 70, 80, 90, 100, 110, 125, 140, 160, 180, 200, 225, 250, 280, 315, 355, 400, 450, 500, 560, 630, 700, 800, 900, 1000, 1100, 1200, 1400, 1600, 1800, 2000 },
+ { 0, 100, 110, 125, 140, 160, 180, 200, 225, 250, 280, 315, 355, 400, 450, 500, 560, 630, 700, 800, 900, 1000, 1100, 1200, 1400, 1600, 1800, 2000, 2200, 2500, 2800, 3200, 3600, 4000, 4500, 5000, 5600, 6300, 7000, 8000, 9000, 10000 },
+ { 0, 500, 560, 630, 700, 800, 900, 1000, 1100, 1200, 1400, 1600, 1800, 2000, 2200, 2500, 2800, 3200, 3600, 4000, 4500, 5000, 5600, 6300, 7000, 8000, 9000, 10000, 11000, 12000, 14000, 16000 },
+};
+
+menu_audio_effect_eq::menu_audio_effect_eq(mame_ui_manager &mui, render_container &container, u16 chain, u16 entry, audio_effect *effect)
+ : menu(mui, container)
+{
+ m_chain = chain;
+ m_entry = entry;
+ m_effect = static_cast<audio_effect_eq *>(effect);
+ set_heading(util::string_format("%s #%u", chain == 0xffff ? _("Default") : machine().sound().effect_chain_tag(chain), entry+1));
+ set_process_flags(PROCESS_LR_REPEAT | PROCESS_LR_ALWAYS);
+}
+
+menu_audio_effect_eq::~menu_audio_effect_eq()
+{
+}
+
+std::pair<u32, u32> menu_audio_effect_eq::find_f(u32 band) const
+{
+ u32 variant = band == 0 ? 0 : band < 4 ? 1 : 2;
+ u32 bi = 0;
+ s32 dt = 40000;
+ s32 f = s32(m_effect->f(band) + 0.5);
+ for(u32 index = 1; freqs[variant][index]; index++) {
+ s32 d1 = f - freqs[variant][index];
+ if(d1 < 0)
+ d1 = -d1;
+ if(d1 < dt) {
+ dt = d1;
+ bi = index;
+ }
+ }
+ return std::make_pair(variant, bi);
+}
+
+void menu_audio_effect_eq::change_f(u32 band, s32 direction)
+{
+ auto [variant, bi] = find_f(band);
+ bi += direction;
+ if(!freqs[variant][bi])
+ bi -= direction;
+ m_effect->set_f(band, freqs[variant][bi]);
+ if(m_chain == 0xffff)
+ machine().sound().default_effect_changed(m_entry);
+}
+
+bool menu_audio_effect_eq::handle(event const *ev)
+{
+ if(!ev)
+ return false;
+
+ u32 band = (uintptr_t(ev->itemref)) >> 16;
+ u32 entry = (uintptr_t(ev->itemref)) & 0xffff;
+
+ switch(ev->iptkey) {
+ case IPT_UI_LEFT: {
+ switch(entry) {
+ case MODE:
+ m_effect->set_mode(0);
+ if(m_chain == 0xffff)
+ machine().sound().default_effect_changed(m_entry);
+ reset(reset_options::REMEMBER_POSITION);
+ return true;
+
+ case SHELF:
+ if(band == 0)
+ m_effect->set_low_shelf(true);
+ else
+ m_effect->set_high_shelf(true);
+ if(m_chain == 0xffff)
+ machine().sound().default_effect_changed(m_entry);
+ reset(reset_options::REMEMBER_POSITION);
+ return true;
+
+ case F:
+ change_f(band, -1);
+ reset(reset_options::REMEMBER_POSITION);
+ return true;
+
+ case Q: {
+ float q = m_effect->q(band);
+ q = (int(q*10 + 0.5) - 1) / 10.0;
+ if(q < 0.1)
+ q = 0.1;
+ m_effect->set_q(band, q);
+ if(m_chain == 0xffff)
+ machine().sound().default_effect_changed(m_entry);
+ reset(reset_options::REMEMBER_POSITION);
+ return true;
+ }
+
+ case DB: {
+ float db = m_effect->db(band);
+ db -= 1;
+ if(db < -12)
+ db = -12;
+ m_effect->set_db(band, db);
+ if(m_chain == 0xffff)
+ machine().sound().default_effect_changed(m_entry);
+ reset(reset_options::REMEMBER_POSITION);
+ return true;
+ }
+ }
+ break;
+ }
+
+ case IPT_UI_RIGHT: {
+ switch(entry) {
+ case MODE:
+ m_effect->set_mode(1);
+ if(m_chain == 0xffff)
+ machine().sound().default_effect_changed(m_entry);
+ reset(reset_options::REMEMBER_POSITION);
+ return true;
+
+ case SHELF:
+ if(band == 0)
+ m_effect->set_low_shelf(false);
+ else
+ m_effect->set_high_shelf(false);
+ if(m_chain == 0xffff)
+ machine().sound().default_effect_changed(m_entry);
+ reset(reset_options::REMEMBER_POSITION);
+ return true;
+
+ case F:
+ change_f(band, +1);
+ reset(reset_options::REMEMBER_POSITION);
+ return true;
+
+ case Q: {
+ float q = m_effect->q(band);
+ q = (int(q*10 + 0.5) + 1) / 10.0;
+ if(q > 12)
+ q = 12;
+ m_effect->set_q(band, q);
+ if(m_chain == 0xffff)
+ machine().sound().default_effect_changed(m_entry);
+ reset(reset_options::REMEMBER_POSITION);
+ return true;
+ }
+
+ case DB: {
+ float db = m_effect->db(band);
+ db += 1;
+ if(db > 12)
+ db = 12;
+ m_effect->set_db(band, db);
+ if(m_chain == 0xffff)
+ machine().sound().default_effect_changed(m_entry);
+ reset(reset_options::REMEMBER_POSITION);
+ return true;
+ }
+ }
+ break;
+ }
+ case IPT_UI_CLEAR: {
+ switch(entry) {
+ case MODE:
+ m_effect->reset_mode();
+ if(m_chain == 0xffff)
+ machine().sound().default_effect_changed(m_entry);
+ reset(reset_options::REMEMBER_POSITION);
+ return true;
+
+ case SHELF:
+ if(band == 0)
+ m_effect->reset_low_shelf();
+ else
+ m_effect->reset_high_shelf();
+ if(m_chain == 0xffff)
+ machine().sound().default_effect_changed(m_entry);
+ reset(reset_options::REMEMBER_POSITION);
+ return true;
+
+ case F:
+ m_effect->reset_f(band);
+ reset(reset_options::REMEMBER_POSITION);
+ return true;
+
+ case Q: {
+ m_effect->reset_q(band);
+ if(m_chain == 0xffff)
+ machine().sound().default_effect_changed(m_entry);
+ reset(reset_options::REMEMBER_POSITION);
+ return true;
+ }
+
+ case DB: {
+ m_effect->reset_db(band);
+ if(m_chain == 0xffff)
+ machine().sound().default_effect_changed(m_entry);
+ reset(reset_options::REMEMBER_POSITION);
+ return true;
+ }
+ }
+ break;
+ }
+ }
+ return false;
+}
+
+std::string menu_audio_effect_eq::format_f(float f)
+{
+ return f >= 1000 ? util::string_format("%.1fkHz", f/1000) : util::string_format("%.0fHz", f);
+}
+
+std::string menu_audio_effect_eq::format_q(float q)
+{
+ return util::string_format("%.1f", q);
+}
+
+std::string menu_audio_effect_eq::format_db(float db)
+{
+ return util::string_format("%+.0fdB", db);
+}
+
+u32 menu_audio_effect_eq::flag_mode() const
+{
+ u32 flag = 0;
+ if(!m_effect->isset_mode())
+ flag |= FLAG_INVERT;
+ if(m_effect->mode() == 1)
+ flag |= FLAG_LEFT_ARROW;
+ if(m_effect->mode() == 0)
+ flag |= FLAG_RIGHT_ARROW;
+ return flag;
+}
+
+u32 menu_audio_effect_eq::flag_low_shelf() const
+{
+ u32 flag = 0;
+ if(!m_effect->isset_low_shelf())
+ flag |= FLAG_INVERT;
+ if(m_effect->low_shelf())
+ flag |= FLAG_RIGHT_ARROW;
+ else
+ flag |= FLAG_LEFT_ARROW;
+ return flag;
+}
+
+u32 menu_audio_effect_eq::flag_high_shelf() const
+{
+ u32 flag = 0;
+ if(!m_effect->isset_high_shelf())
+ flag |= FLAG_INVERT;
+ if(m_effect->high_shelf())
+ flag |= FLAG_RIGHT_ARROW;
+ else
+ flag |= FLAG_LEFT_ARROW;
+ return flag;
+}
+
+u32 menu_audio_effect_eq::flag_f(u32 band) const
+{
+ u32 flag = 0;
+ if(!m_effect->isset_f(band))
+ flag |= FLAG_INVERT;
+ auto [variant, bi] = find_f(band);
+ if(freqs[variant][bi-1])
+ flag |= FLAG_LEFT_ARROW;
+ if(freqs[variant][bi+1])
+ flag |= FLAG_RIGHT_ARROW;
+ return flag;
+}
+
+u32 menu_audio_effect_eq::flag_q(u32 band) const
+{
+ u32 flag = 0;
+ if(!m_effect->isset_q(band))
+ flag |= FLAG_INVERT;
+ float q = m_effect->q(band);
+ if(q < 10)
+ flag |= FLAG_LEFT_ARROW;
+ if(q > 0.1)
+ flag |= FLAG_RIGHT_ARROW;
+ return flag;
+}
+
+u32 menu_audio_effect_eq::flag_db(u32 band) const
+{
+ u32 flag = 0;
+ if(!m_effect->isset_db(band))
+ flag |= FLAG_INVERT;
+ float db = m_effect->db(band);
+ if(db < 12)
+ flag |= FLAG_LEFT_ARROW;
+ if(db > -12)
+ flag |= FLAG_RIGHT_ARROW;
+ return flag;
+}
+
+void menu_audio_effect_eq::populate()
+{
+ item_append(_(audio_effect::effect_names[audio_effect::EQ]), FLAG_UI_HEADING | FLAG_DISABLE, nullptr);
+ item_append(_("Mode"), m_effect->mode() ? _("5-Band EQ") : _("Bypass"), flag_mode(), (void *)MODE);
+ item_append(_("Low band mode"), m_effect->low_shelf() ? _("Shelf") : _("Peak"), flag_low_shelf(), (void *)uintptr_t(SHELF | (0 << 16)));
+ item_append(_("Low band freq."), format_f(m_effect->f(0)), flag_f(0), (void *)uintptr_t(F | (0 << 16)));
+ if(!m_effect->low_shelf())
+ item_append(_("Low band Q"), format_q(m_effect->q(0)), flag_q(0), (void *)uintptr_t(Q | (0 << 16)));
+ item_append(_("Low band dB"), format_db(m_effect->db(0)), flag_db(0), (void *)uintptr_t(DB | (0 << 16)));
+
+ item_append(_("Lo mid band freq."), format_f(m_effect->f(1)), flag_f(1), (void *)uintptr_t(F | (1 << 16)));
+ item_append(_("Lo mid band Q"), format_q(m_effect->q(1)), flag_q(1), (void *)uintptr_t(Q | (1 << 16)));
+ item_append(_("Lo mid band dB"), format_db(m_effect->db(1)), flag_db(1), (void *)uintptr_t(DB | (1 << 16)));
+
+ item_append(_("Mid band freq."), format_f(m_effect->f(2)), flag_f(2), (void *)uintptr_t(F | (2 << 16)));
+ item_append(_("Mid band Q"), format_q(m_effect->q(2)), flag_q(2), (void *)uintptr_t(Q | (2 << 16)));
+ item_append(_("Mid band dB"), format_db(m_effect->db(2)), flag_db(2), (void *)uintptr_t(DB | (2 << 16)));
+
+ item_append(_("Hi mid band freq."), format_f(m_effect->f(3)), flag_f(3), (void *)uintptr_t(F | (3 << 16)));
+ item_append(_("Hi mid band Q"), format_q(m_effect->q(3)), flag_q(3), (void *)uintptr_t(Q | (3 << 16)));
+ item_append(_("Hi mid band dB"), format_db(m_effect->db(3)), flag_db(3), (void *)uintptr_t(DB | (3 << 16)));
+
+
+ item_append(_("High band mode"), m_effect->high_shelf() ? _("Shelf") : _("Peak"), flag_high_shelf(), (void *)uintptr_t(SHELF | (4 << 16)));
+ item_append(_("High band freq."), format_f(m_effect->f(4)), flag_f(4), (void *)uintptr_t(F | (4 << 16)));
+ if(!m_effect->high_shelf())
+ item_append(_("High band Q"), format_q(m_effect->q(4)), flag_q(4), (void *)uintptr_t(Q | (4 << 16)));
+ item_append(_("High band dB"), format_db(m_effect->db(4)), flag_db(4), (void *)uintptr_t(DB | (4 << 16)));
+ item_append(menu_item_type::SEPARATOR);
+}
+
+void menu_audio_effect_eq::recompute_metrics(uint32_t width, uint32_t height, float aspect)
+{
+ menu::recompute_metrics(width, height, aspect);
+}
+
+void menu_audio_effect_eq::custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x1, float y1, float x2, float y2)
+{
+}
+
+void menu_audio_effect_eq::menu_activated()
+{
+ // scripts or the other form of the menu could have changed something in the mean time
+ reset(reset_options::REMEMBER_POSITION);
+}
+
+void menu_audio_effect_eq::menu_deactivated()
+{
+}
+
+}
diff --git a/src/frontend/mame/ui/audio_effect_eq.h b/src/frontend/mame/ui/audio_effect_eq.h
new file mode 100644
index 00000000000..c11d4f3996c
--- /dev/null
+++ b/src/frontend/mame/ui/audio_effect_eq.h
@@ -0,0 +1,61 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+/***************************************************************************
+
+ ui/audio_effect_eq.h
+
+ Equalizer configuration
+
+***************************************************************************/
+
+#ifndef MAME_FRONTEND_UI_AUDIO_EFFECT_EQ_H
+#define MAME_FRONTEND_UI_AUDIO_EFFECT_EQ_H
+
+#pragma once
+
+#include "ui/menu.h"
+
+class audio_effect_eq;
+
+namespace ui {
+
+class menu_audio_effect_eq : public menu
+{
+public:
+ menu_audio_effect_eq(mame_ui_manager &mui, render_container &container, u16 chain, u16 entry, audio_effect *effect);
+ virtual ~menu_audio_effect_eq() override;
+
+protected:
+ virtual void recompute_metrics(uint32_t width, uint32_t height, float aspect) override;
+ virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
+ virtual void menu_activated() override;
+ virtual void menu_deactivated() override;
+
+private:
+ enum { MODE = 1, SHELF, F, Q, DB };
+
+ static const u32 freqs[3][43];
+
+ u16 m_chain, m_entry;
+ audio_effect_eq *m_effect;
+
+ virtual void populate() override;
+ virtual bool handle(event const *ev) override;
+
+ static std::string format_f(float f);
+ static std::string format_q(float q);
+ static std::string format_db(float db);
+ u32 flag_mode() const;
+ u32 flag_low_shelf() const;
+ u32 flag_high_shelf() const;
+ u32 flag_f(u32 band) const;
+ u32 flag_q(u32 band) const;
+ u32 flag_db(u32 band) const;
+
+ std::pair<u32, u32> find_f(u32 band) const;
+ void change_f(u32 band, s32 direction);
+};
+
+} // namespace ui
+
+#endif // MAME_FRONTEND_UI_AUDIO_EFFECT_EQ_H
diff --git a/src/frontend/mame/ui/audio_effect_filter.cpp b/src/frontend/mame/ui/audio_effect_filter.cpp
new file mode 100644
index 00000000000..9b6a90df980
--- /dev/null
+++ b/src/frontend/mame/ui/audio_effect_filter.cpp
@@ -0,0 +1,351 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+/*********************************************************************
+
+ ui/audio_effect_filter.cpp
+
+ Filter configuration
+
+*********************************************************************/
+
+#include "emu.h"
+#include "ui/audio_effect_filter.h"
+#include "audio_effects/aeffect.h"
+#include "audio_effects/filter.h"
+
+#include "ui/ui.h"
+
+namespace ui {
+const u32 menu_audio_effect_filter::freqs[2][38] = {
+ { 0, 20, 22, 24, 26, 28, 30, 32, 36, 40, 45, 50, 56, 63, 70, 80, 90, 100, 110, 125, 140, 160, 180, 200, 225, 250, 280, 315, 355, 400, 450, 500, 560, 630, 700, 800, 900, 1000 },
+ { 0, 1000, 1100, 1200, 1400, 1600, 1800, 2000, 2200, 2500, 2800, 3200, 3600, 4000, 4500, 5000, 5600, 6300, 7000, 8000, 9000, 10000, 11000, 12000, 14000, 16000, 18000, 20000 },
+};
+
+menu_audio_effect_filter::menu_audio_effect_filter(mame_ui_manager &mui, render_container &container, u16 chain, u16 entry, audio_effect *effect)
+ : menu(mui, container)
+{
+ m_chain = chain;
+ m_entry = entry;
+ m_effect = static_cast<audio_effect_filter *>(effect);
+ set_heading(util::string_format("%s #%u", chain == 0xffff ? _("Default") : machine().sound().effect_chain_tag(chain), entry+1));
+ set_process_flags(PROCESS_LR_REPEAT | PROCESS_LR_ALWAYS);
+}
+
+menu_audio_effect_filter::~menu_audio_effect_filter()
+{
+}
+
+std::pair<u32, u32> menu_audio_effect_filter::find_f(bool lp) const
+{
+ u32 variant = lp ? 1 : 0;
+ u32 bi = 0;
+ s32 dt = 40000;
+ s32 f = s32((lp ? m_effect->fl() : m_effect->fh()) + 0.5);
+ for(u32 index = 1; freqs[variant][index]; index++) {
+ s32 d1 = f - freqs[variant][index];
+ if(d1 < 0)
+ d1 = -d1;
+ if(d1 < dt) {
+ dt = d1;
+ bi = index;
+ }
+ }
+ return std::make_pair(variant, bi);
+}
+
+void menu_audio_effect_filter::change_f(bool lp, s32 direction)
+{
+ auto [variant, bi] = find_f(lp);
+ bi += direction;
+ if(!freqs[variant][bi])
+ bi -= direction;
+ if(lp)
+ m_effect->set_fl(freqs[variant][bi]);
+ else
+ m_effect->set_fh(freqs[variant][bi]);
+ if(m_chain == 0xffff)
+ machine().sound().default_effect_changed(m_entry);
+}
+
+bool menu_audio_effect_filter::handle(event const *ev)
+{
+ if(!ev)
+ return false;
+
+ switch(ev->iptkey) {
+ case IPT_UI_LEFT: {
+ switch(uintptr_t(ev->itemref)) {
+ case ACTIVE | HP:
+ m_effect->set_highpass_active(false);
+ if(m_chain == 0xffff)
+ machine().sound().default_effect_changed(m_entry);
+ reset(reset_options::REMEMBER_POSITION);
+ return true;
+
+ case F | HP:
+ change_f(false, -1);
+ reset(reset_options::REMEMBER_POSITION);
+ return true;
+
+ case Q | HP: {
+ float q = m_effect->qh();
+ q = (int(q*10 + 0.5) - 1) / 10.0;
+ if(q < 0.1)
+ q = 0.1;
+ m_effect->set_qh(q);
+ if(m_chain == 0xffff)
+ machine().sound().default_effect_changed(m_entry);
+ reset(reset_options::REMEMBER_POSITION);
+ return true;
+ }
+
+ case ACTIVE | LP:
+ m_effect->set_lowpass_active(false);
+ if(m_chain == 0xffff)
+ machine().sound().default_effect_changed(m_entry);
+ reset(reset_options::REMEMBER_POSITION);
+ return true;
+
+ case F | LP:
+ change_f(true, -1);
+ reset(reset_options::REMEMBER_POSITION);
+ return true;
+
+ case Q | LP: {
+ float q = m_effect->ql();
+ q = (int(q*10 + 0.5) - 1) / 10.0;
+ if(q < 0.1)
+ q = 0.1;
+ m_effect->set_ql(q);
+ if(m_chain == 0xffff)
+ machine().sound().default_effect_changed(m_entry);
+ reset(reset_options::REMEMBER_POSITION);
+ return true;
+ }
+ }
+ break;
+ }
+
+ case IPT_UI_RIGHT: {
+ switch(uintptr_t(ev->itemref)) {
+ case ACTIVE | HP:
+ m_effect->set_highpass_active(true);
+ if(m_chain == 0xffff)
+ machine().sound().default_effect_changed(m_entry);
+ reset(reset_options::REMEMBER_POSITION);
+ return true;
+
+ case F | HP:
+ change_f(false, +1);
+ reset(reset_options::REMEMBER_POSITION);
+ return true;
+
+ case Q | HP: {
+ float q = m_effect->qh();
+ q = (int(q*10 + 0.5) + 1) / 10.0;
+ if(q > 10)
+ q = 10;
+ m_effect->set_qh(q);
+ if(m_chain == 0xffff)
+ machine().sound().default_effect_changed(m_entry);
+ reset(reset_options::REMEMBER_POSITION);
+ return true;
+ }
+
+ case ACTIVE | LP:
+ m_effect->set_lowpass_active(true);
+ if(m_chain == 0xffff)
+ machine().sound().default_effect_changed(m_entry);
+ reset(reset_options::REMEMBER_POSITION);
+ return true;
+
+ case F | LP:
+ change_f(true, +1);
+ reset(reset_options::REMEMBER_POSITION);
+ return true;
+
+ case Q | LP: {
+ float q = m_effect->ql();
+ q = (int(q*10 + 0.5) + 1) / 10.0;
+ if(q > 10)
+ q = 10;
+ m_effect->set_ql(q);
+ if(m_chain == 0xffff)
+ machine().sound().default_effect_changed(m_entry);
+ reset(reset_options::REMEMBER_POSITION);
+ return true;
+ }
+ }
+ break;
+ }
+
+ case IPT_UI_CLEAR: {
+ switch(uintptr_t(ev->itemref)) {
+ case ACTIVE | HP:
+ m_effect->reset_highpass_active();
+ if(m_chain == 0xffff)
+ machine().sound().default_effect_changed(m_entry);
+ reset(reset_options::REMEMBER_POSITION);
+ return true;
+
+ case F | HP:
+ m_effect->reset_fh();
+ if(m_chain == 0xffff)
+ machine().sound().default_effect_changed(m_entry);
+ reset(reset_options::REMEMBER_POSITION);
+ return true;
+
+ case Q | HP:
+ m_effect->reset_qh();
+ if(m_chain == 0xffff)
+ machine().sound().default_effect_changed(m_entry);
+ reset(reset_options::REMEMBER_POSITION);
+ return true;
+
+ case ACTIVE | LP:
+ m_effect->reset_lowpass_active();
+ if(m_chain == 0xffff)
+ machine().sound().default_effect_changed(m_entry);
+ reset(reset_options::REMEMBER_POSITION);
+ return true;
+
+ case F | LP:
+ m_effect->reset_fl();
+ if(m_chain == 0xffff)
+ machine().sound().default_effect_changed(m_entry);
+ reset(reset_options::REMEMBER_POSITION);
+ return true;
+
+ case Q | LP:
+ m_effect->reset_ql();
+ if(m_chain == 0xffff)
+ machine().sound().default_effect_changed(m_entry);
+ reset(reset_options::REMEMBER_POSITION);
+ return true;
+ }
+ break;
+ }
+ }
+ return false;
+}
+
+std::string menu_audio_effect_filter::format_f(float f)
+{
+ return f >= 1000 ? util::string_format("%.1fkHz", f/1000) : util::string_format("%.0fHz", f);
+}
+
+std::string menu_audio_effect_filter::format_q(float q)
+{
+ return util::string_format("%.1f", q);
+}
+
+u32 menu_audio_effect_filter::flag_highpass_active() const
+{
+ u32 flag = 0;
+ if(!m_effect->isset_highpass_active())
+ flag |= FLAG_INVERT;
+ if(m_effect->highpass_active())
+ flag |= FLAG_LEFT_ARROW;
+ else
+ flag |= FLAG_RIGHT_ARROW;
+ return flag;
+}
+
+u32 menu_audio_effect_filter::flag_fh() const
+{
+ u32 flag = 0;
+ if(!m_effect->isset_fh())
+ flag |= FLAG_INVERT;
+ auto [variant, bi] = find_f(false);
+ if(freqs[variant][bi-1])
+ flag |= FLAG_LEFT_ARROW;
+ if(freqs[variant][bi+1])
+ flag |= FLAG_RIGHT_ARROW;
+ return flag;
+}
+
+u32 menu_audio_effect_filter::flag_qh() const
+{
+ u32 flag = 0;
+ if(!m_effect->isset_qh())
+ flag |= FLAG_INVERT;
+ float q = m_effect->qh();
+ if(q > 0.1)
+ flag |= FLAG_LEFT_ARROW;
+ if(q < 10)
+ flag |= FLAG_RIGHT_ARROW;
+ return flag;
+}
+
+u32 menu_audio_effect_filter::flag_lowpass_active() const
+{
+ u32 flag = 0;
+ if(!m_effect->isset_lowpass_active())
+ flag |= FLAG_INVERT;
+ if(m_effect->lowpass_active())
+ flag |= FLAG_LEFT_ARROW;
+ else
+ flag |= FLAG_RIGHT_ARROW;
+ return flag;
+}
+
+u32 menu_audio_effect_filter::flag_fl() const
+{
+ u32 flag = 0;
+ if(!m_effect->isset_fl())
+ flag |= FLAG_INVERT;
+ auto [variant, bi] = find_f(true);
+ if(freqs[variant][bi-1])
+ flag |= FLAG_LEFT_ARROW;
+ if(freqs[variant][bi+1])
+ flag |= FLAG_RIGHT_ARROW;
+ return flag;
+}
+
+u32 menu_audio_effect_filter::flag_ql() const
+{
+ u32 flag = 0;
+ if(!m_effect->isset_ql())
+ flag |= FLAG_INVERT;
+ float q = m_effect->ql();
+ if(q > 0.1)
+ flag |= FLAG_LEFT_ARROW;
+ if(q < 10)
+ flag |= FLAG_RIGHT_ARROW;
+ return flag;
+}
+
+void menu_audio_effect_filter::populate()
+{
+ item_append(_(audio_effect::effect_names[audio_effect::FILTER]), FLAG_UI_HEADING | FLAG_DISABLE, nullptr);
+ item_append(_("Highpass (DC removal)"), m_effect->highpass_active() ? _("Active") : _("Bypass"), flag_highpass_active(), (void *)(ACTIVE | HP));
+ item_append(_("Highpass cutoff"), format_f(m_effect->fh()), flag_fh(), (void *)(F | HP));
+ item_append(_("Highpass Q"), format_q(m_effect->qh()), flag_qh(), (void *)(Q | HP));
+
+ item_append(_("Lowpass"), m_effect->lowpass_active() ? _("Active") : _("Bypass"), flag_lowpass_active(), (void *)(ACTIVE | LP));
+ item_append(_("Lowpass cutoff"), format_f(m_effect->fl()), flag_fl(), (void *)(F | LP));
+ item_append(_("Lowpass Q"), format_q(m_effect->ql()), flag_ql(), (void *)(Q | LP));
+
+ item_append(menu_item_type::SEPARATOR);
+}
+
+void menu_audio_effect_filter::recompute_metrics(uint32_t width, uint32_t height, float aspect)
+{
+ menu::recompute_metrics(width, height, aspect);
+}
+
+void menu_audio_effect_filter::custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x1, float y1, float x2, float y2)
+{
+}
+
+void menu_audio_effect_filter::menu_activated()
+{
+ // scripts or the other form of the menu could have changed something in the mean time
+ reset(reset_options::REMEMBER_POSITION);
+}
+
+void menu_audio_effect_filter::menu_deactivated()
+{
+}
+
+}
diff --git a/src/frontend/mame/ui/audio_effect_filter.h b/src/frontend/mame/ui/audio_effect_filter.h
new file mode 100644
index 00000000000..7a4d84e4122
--- /dev/null
+++ b/src/frontend/mame/ui/audio_effect_filter.h
@@ -0,0 +1,60 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+/***************************************************************************
+
+ ui/audio_effect_filter.h
+
+ Filter configuration
+
+***************************************************************************/
+
+#ifndef MAME_FRONTEND_UI_AUDIO_EFFECT_FILTER_H
+#define MAME_FRONTEND_UI_AUDIO_EFFECT_FILTER_H
+
+#pragma once
+
+#include "ui/menu.h"
+
+class audio_effect_filter;
+
+namespace ui {
+
+class menu_audio_effect_filter : public menu
+{
+public:
+ menu_audio_effect_filter(mame_ui_manager &mui, render_container &container, u16 chain, u16 entry, audio_effect *effect);
+ virtual ~menu_audio_effect_filter() override;
+
+protected:
+ virtual void recompute_metrics(uint32_t width, uint32_t height, float aspect) override;
+ virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
+ virtual void menu_activated() override;
+ virtual void menu_deactivated() override;
+
+private:
+ enum { ACTIVE = 1, F = 2, Q = 3, HP = 0, LP = 8 };
+
+ static const u32 freqs[2][38];
+
+ u16 m_chain, m_entry;
+ audio_effect_filter *m_effect;
+
+ virtual void populate() override;
+ virtual bool handle(event const *ev) override;
+
+ static std::string format_f(float f);
+ static std::string format_q(float q);
+ u32 flag_highpass_active() const;
+ u32 flag_fh() const;
+ u32 flag_qh() const;
+ u32 flag_lowpass_active() const;
+ u32 flag_fl() const;
+ u32 flag_ql() const;
+
+ std::pair<u32, u32> find_f(bool lp) const;
+ void change_f(bool lp, s32 direction);
+};
+
+} // namespace ui
+
+#endif // MAME_FRONTEND_UI_AUDIO_EFFECT_FILTER_H
diff --git a/src/frontend/mame/ui/audioeffects.cpp b/src/frontend/mame/ui/audioeffects.cpp
new file mode 100644
index 00000000000..6ac84e22954
--- /dev/null
+++ b/src/frontend/mame/ui/audioeffects.cpp
@@ -0,0 +1,95 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+/*********************************************************************
+
+ ui/audioeffects.cpp
+
+ Audio effects control
+
+*********************************************************************/
+
+#include "emu.h"
+#include "ui/audioeffects.h"
+#include "audio_effects/aeffect.h"
+
+#include "audio_effect_eq.h"
+#include "audio_effect_filter.h"
+
+#include "ui/ui.h"
+
+#include "osdepend.h"
+#include "speaker.h"
+
+namespace ui {
+
+menu_audio_effects::menu_audio_effects(mame_ui_manager &mui, render_container &container)
+ : menu(mui, container)
+{
+ set_heading(_("Audio Effects"));
+}
+
+menu_audio_effects::~menu_audio_effects()
+{
+}
+
+bool menu_audio_effects::handle(event const *ev)
+{
+ if(ev && (ev->iptkey == IPT_UI_SELECT)) {
+ u16 chain = (uintptr_t(ev->itemref)) >> 16;
+ u16 entry = (uintptr_t(ev->itemref)) & 0xffff;
+ audio_effect *eff = chain == 0xffff ? machine().sound().default_effect_chain()[entry] : machine().sound().effect_chain(chain)[entry];
+ switch(eff->type()) {
+ case audio_effect::FILTER:
+ menu::stack_push<menu_audio_effect_filter>(ui(), container(), chain, entry, eff);
+ break;
+
+ case audio_effect::EQ:
+ menu::stack_push<menu_audio_effect_eq>(ui(), container(), chain, entry, eff);
+ break;
+ }
+ return true;
+ }
+
+ return false;
+}
+
+
+void menu_audio_effects::populate()
+{
+ auto &sound = machine().sound();
+ for(s32 chain = 0; chain != sound.effect_chains(); chain++) {
+ std::string tag = sound.effect_chain_tag(chain);
+ item_append(tag, FLAG_UI_HEADING | FLAG_DISABLE, nullptr);
+ auto eff = sound.effect_chain(chain);
+ for(u32 e = 0; e != eff.size(); e++)
+ item_append(_(audio_effect::effect_names[eff[e]->type()]), 0, (void *)intptr_t((chain << 16) | e));
+ }
+ item_append(_("Default"), FLAG_UI_HEADING | FLAG_DISABLE, nullptr);
+ auto eff = sound.default_effect_chain();
+ for(u32 e = 0; e != eff.size(); e++)
+ item_append(_(audio_effect::effect_names[eff[e]->type()]), 0, (void *)intptr_t((0xffff << 16) | e));
+ item_append(menu_item_type::SEPARATOR);
+}
+
+void menu_audio_effects::recompute_metrics(uint32_t width, uint32_t height, float aspect)
+{
+ menu::recompute_metrics(width, height, aspect);
+}
+
+void menu_audio_effects::custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x1, float y1, float x2, float y2)
+{
+}
+
+void menu_audio_effects::menu_activated()
+{
+ // scripts or the other form of the menu could have changed something in the mean time
+ reset(reset_options::REMEMBER_POSITION);
+}
+
+void menu_audio_effects::menu_deactivated()
+{
+}
+
+
+} // namespace ui
+
diff --git a/src/frontend/mame/ui/audioeffects.h b/src/frontend/mame/ui/audioeffects.h
new file mode 100644
index 00000000000..1ee15da82f9
--- /dev/null
+++ b/src/frontend/mame/ui/audioeffects.h
@@ -0,0 +1,40 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+/***************************************************************************
+
+ ui/audioeffects.h
+
+ Audio effects control
+
+***************************************************************************/
+
+#ifndef MAME_FRONTEND_UI_AUDIOEFFECTS_H
+#define MAME_FRONTEND_UI_AUDIOEFFECTS_H
+
+#pragma once
+
+#include "ui/menu.h"
+
+
+namespace ui {
+
+class menu_audio_effects : public menu
+{
+public:
+ menu_audio_effects(mame_ui_manager &mui, render_container &container);
+ virtual ~menu_audio_effects() override;
+
+protected:
+ virtual void recompute_metrics(uint32_t width, uint32_t height, float aspect) override;
+ virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
+ virtual void menu_activated() override;
+ virtual void menu_deactivated() override;
+
+private:
+ virtual void populate() override;
+ virtual bool handle(event const *ev) override;
+};
+
+} // namespace ui
+
+#endif // MAME_FRONTEND_UI_AUDIOEFFECTS_H
diff --git a/src/frontend/mame/ui/audiomix.cpp b/src/frontend/mame/ui/audiomix.cpp
new file mode 100644
index 00000000000..75b5ee334d5
--- /dev/null
+++ b/src/frontend/mame/ui/audiomix.cpp
@@ -0,0 +1,1053 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+/*********************************************************************
+
+ ui/audiomix.cpp
+
+ Audio mixing/mapping control
+
+*********************************************************************/
+
+#include "emu.h"
+#include "ui/audiomix.h"
+
+#include "ui/ui.h"
+
+#include "osdepend.h"
+#include "speaker.h"
+
+namespace ui {
+
+menu_audio_mixer::menu_audio_mixer(mame_ui_manager &mui, render_container &container)
+ : menu(mui, container)
+{
+ set_heading(_("Audio Mixer"));
+ m_generation = 0;
+ m_current_selection.m_maptype = MT_UNDEFINED;
+ m_current_selection.m_dev = nullptr;
+ m_current_selection.m_guest_channel = 0;
+ m_current_selection.m_node = 0;
+ m_current_selection.m_node_channel = 0;
+ m_current_group = GRP_NODE;
+
+ set_process_flags(PROCESS_LR_ALWAYS);
+}
+
+menu_audio_mixer::~menu_audio_mixer()
+{
+}
+
+bool menu_audio_mixer::handle(event const *ev)
+{
+ if(!ev) {
+ if(m_generation != machine().sound().get_osd_info().m_generation) {
+ reset(reset_options::REMEMBER_POSITION);
+ return true;
+ }
+ return false;
+ }
+
+ bool const alt_pressed = machine().input().code_pressed(KEYCODE_LALT) || machine().input().code_pressed(KEYCODE_RALT);
+ bool const ctrl_pressed = machine().input().code_pressed(KEYCODE_LCONTROL) || machine().input().code_pressed(KEYCODE_RCONTROL);
+ bool const shift_pressed = machine().input().code_pressed(KEYCODE_LSHIFT) || machine().input().code_pressed(KEYCODE_RSHIFT);
+
+ switch(ev->iptkey) {
+ case IPT_UI_MIXER_ADD_FULL:
+ if(m_current_selection.m_maptype == MT_INTERNAL)
+ return false;
+
+ if(full_mapping_available(m_current_selection.m_dev, 0)) {
+ m_current_selection.m_node = 0;
+ machine().sound().config_add_sound_io_connection_default(m_current_selection.m_dev, 0.0);
+
+ } else {
+ uint32_t node = find_next_available_node(m_current_selection.m_dev, 0);
+ if(node == 0xffffffff)
+ return false;
+ m_current_selection.m_node = node;
+ machine().sound().config_add_sound_io_connection_node(m_current_selection.m_dev, find_node_name(node), 0.0);
+ }
+
+ m_current_selection.m_maptype = MT_FULL;
+ m_current_selection.m_guest_channel = 0;
+ m_current_selection.m_node_channel = 0;
+ m_current_selection.m_db = 0.0;
+ m_generation --;
+ return true;
+
+ case IPT_UI_MIXER_ADD_CHANNEL: {
+ if(m_current_selection.m_maptype == MT_INTERNAL)
+ return false;
+
+ // Find a possible triplet, any triplet
+ const auto &info = machine().sound().get_osd_info();
+ u32 guest_channel;
+ u32 node_index, node_id;
+ u32 node_channel;
+ u32 default_osd_id = m_current_selection.m_dev->is_output() ? info.m_default_sink : info.m_default_source;
+ for(node_index = default_osd_id == 0 ? 0 : 0xffffffff; node_index != info.m_nodes.size(); node_index++) {
+ node_id = node_index == 0xffffffff ? 0 : info.m_nodes[node_index].m_id;
+ u32 guest_channel_count = m_current_selection.m_dev->inputs();
+ u32 node_channel_count = 0;
+ if(node_index == 0xffffffff) {
+ for(u32 i = 0; i != info.m_nodes.size(); i++)
+ if(info.m_nodes[i].m_id == default_osd_id) {
+ node_channel_count = m_current_selection.m_dev->is_output() ? info.m_nodes[i].m_sinks : info.m_nodes[i].m_sources;
+ break;
+ }
+ } else
+ node_channel_count = m_current_selection.m_dev->is_output() ? info.m_nodes[node_index].m_sinks : info.m_nodes[node_index].m_sources;
+
+ for(guest_channel = 0; guest_channel != guest_channel_count; guest_channel ++)
+ for(node_channel = 0; node_channel != node_channel_count; node_channel ++)
+ if(channel_mapping_available(m_current_selection.m_dev, guest_channel, node_id, node_channel))
+ goto found;
+ }
+ return false;
+
+ found:
+ if(node_id)
+ machine().sound().config_add_sound_io_channel_connection_node(m_current_selection.m_dev, guest_channel, info.m_nodes[node_index].name(), node_channel, 0.0);
+ else
+ machine().sound().config_add_sound_io_channel_connection_default(m_current_selection.m_dev, guest_channel, node_channel, 0.0);
+ m_current_selection.m_maptype = MT_CHANNEL;
+ m_current_selection.m_guest_channel = guest_channel;
+ m_current_selection.m_node = node_id;
+ m_current_selection.m_node_channel = node_channel;
+ m_current_selection.m_db = 0.0;
+ m_generation --;
+ return true;
+ }
+
+ case IPT_UI_CLEAR: {
+ if(m_current_selection.m_maptype == MT_NONE || m_current_selection.m_maptype == MT_INTERNAL)
+ return false;
+
+ if(m_current_selection.m_maptype == MT_FULL) {
+ if(m_current_selection.m_node == 0)
+ machine().sound().config_remove_sound_io_connection_default(m_current_selection.m_dev);
+ else
+ machine().sound().config_remove_sound_io_connection_node(m_current_selection.m_dev, find_node_name(m_current_selection.m_node));
+ } else {
+ if(m_current_selection.m_node == 0)
+ machine().sound().config_remove_sound_io_channel_connection_default(m_current_selection.m_dev, m_current_selection.m_guest_channel, m_current_selection.m_node_channel);
+ else
+ machine().sound().config_remove_sound_io_channel_connection_node(m_current_selection.m_dev, m_current_selection.m_guest_channel, find_node_name(m_current_selection.m_node), m_current_selection.m_node_channel);
+ }
+
+ // Find where the selection was
+ uint32_t cursel_index = 0;
+ for(uint32_t i = 0; i != m_selections.size(); i++)
+ if(m_selections[i] == m_current_selection) {
+ cursel_index = i;
+ break;
+ }
+
+ // If the next item exists and is the same speaker, go there (visually, the cursor stays on the same line)
+ // Otherwise if the previous item exists and is the same speaker, go there (visually, the cursor goes up once)
+ // Otherwise create a MT_NONE, because one is going to appear at the same place
+
+ if(cursel_index + 1 < m_selections.size() && m_selections[cursel_index+1].m_dev == m_current_selection.m_dev)
+ m_current_selection = m_selections[cursel_index+1];
+ else if(cursel_index != 0 && m_selections[cursel_index-1].m_dev == m_current_selection.m_dev)
+ m_current_selection = m_selections[cursel_index-1];
+ else {
+ m_current_selection.m_maptype = MT_NONE;
+ m_current_selection.m_guest_channel = 0;
+ m_current_selection.m_node = 0;
+ m_current_selection.m_node_channel = 0;
+ m_current_selection.m_db = 0.0;
+ }
+
+ m_generation --;
+ return true;
+ }
+
+ case IPT_UI_UP:
+ case IPT_UI_DOWN:
+ if(!ev->itemref) {
+ m_current_selection.m_maptype = MT_INTERNAL;
+ m_generation --;
+ return true;
+ }
+
+ m_current_selection = *(select_entry *)(ev->itemref);
+ if(m_current_selection.m_maptype == MT_FULL) {
+ if(m_current_group == GRP_GUEST_CHANNEL || m_current_group == GRP_NODE_CHANNEL)
+ m_current_group = GRP_NODE;
+ }
+ m_generation --;
+ return true;
+
+ case IPT_UI_NEXT_GROUP:
+ if(m_current_selection.m_maptype == MT_NONE || m_current_selection.m_maptype == MT_INTERNAL)
+ return false;
+
+ if(m_current_selection.m_maptype == MT_FULL) {
+ if(m_current_group == GRP_NODE)
+ m_current_group = GRP_DB;
+ else
+ m_current_group = GRP_NODE;
+
+ } else if(m_current_selection.m_maptype == MT_CHANNEL) {
+ if(m_current_group == GRP_NODE)
+ m_current_group = GRP_NODE_CHANNEL;
+ else if(m_current_group == GRP_NODE_CHANNEL)
+ m_current_group = GRP_DB;
+ else if(m_current_group == GRP_DB)
+ m_current_group = GRP_GUEST_CHANNEL;
+ else
+ m_current_group = GRP_NODE;
+ }
+ m_generation --;
+ return true;
+
+ case IPT_UI_PREV_GROUP:
+ if(m_current_selection.m_maptype == MT_NONE || m_current_selection.m_maptype == MT_INTERNAL)
+ return false;
+
+ if(m_current_selection.m_maptype == MT_FULL) {
+ if(m_current_group == GRP_NODE)
+ m_current_group = GRP_DB;
+ else
+ m_current_group = GRP_NODE;
+
+ } else if(m_current_selection.m_maptype == MT_CHANNEL) {
+ if(m_current_group == GRP_NODE)
+ m_current_group = GRP_GUEST_CHANNEL;
+ else if(m_current_group == GRP_GUEST_CHANNEL)
+ m_current_group = GRP_DB;
+ else if(m_current_group == GRP_DB)
+ m_current_group = GRP_NODE_CHANNEL;
+ else
+ m_current_group = GRP_NODE;
+ }
+ m_generation --;
+ return true;
+
+ case IPT_UI_LEFT: {
+ if(m_current_selection.m_maptype == MT_NONE || m_current_selection.m_maptype == MT_INTERNAL)
+ return false;
+
+ switch(m_current_group) {
+ case GRP_NODE: {
+ if(m_current_selection.m_maptype == MT_FULL) {
+ uint32_t prev_node = m_current_selection.m_node;
+ uint32_t next_node = find_previous_available_node(m_current_selection.m_dev, prev_node);
+ if(next_node != 0xffffffff) {
+ m_current_selection.m_node = next_node;
+ if(prev_node)
+ machine().sound().config_remove_sound_io_connection_node(m_current_selection.m_dev, find_node_name(prev_node));
+ else
+ machine().sound().config_remove_sound_io_connection_default(m_current_selection.m_dev);
+ if(next_node)
+ machine().sound().config_add_sound_io_connection_node(m_current_selection.m_dev, find_node_name(next_node), m_current_selection.m_db);
+ else
+ machine().sound().config_add_sound_io_connection_default(m_current_selection.m_dev, m_current_selection.m_db);
+ m_generation --;
+ return true;
+ }
+ } else if(m_current_selection.m_maptype == MT_CHANNEL) {
+ uint32_t prev_node = m_current_selection.m_node;
+ uint32_t next_node = find_previous_available_channel_node(m_current_selection.m_dev, m_current_selection.m_guest_channel, prev_node, m_current_selection.m_node_channel);
+ if(next_node != 0xffffffff) {
+ m_current_selection.m_node = next_node;
+ if(prev_node)
+ machine().sound().config_remove_sound_io_channel_connection_node(m_current_selection.m_dev, m_current_selection.m_guest_channel, find_node_name(prev_node), m_current_selection.m_node_channel);
+ else
+ machine().sound().config_remove_sound_io_channel_connection_default(m_current_selection.m_dev, m_current_selection.m_guest_channel, m_current_selection.m_node_channel);
+ if(next_node)
+ machine().sound().config_add_sound_io_channel_connection_node(m_current_selection.m_dev, m_current_selection.m_guest_channel, find_node_name(next_node), m_current_selection.m_node_channel, m_current_selection.m_db);
+ else
+ machine().sound().config_add_sound_io_channel_connection_default(m_current_selection.m_dev, m_current_selection.m_guest_channel, m_current_selection.m_node_channel, m_current_selection.m_db);
+ m_generation --;
+ return true;
+ }
+ }
+ break;
+ }
+
+ case GRP_DB: {
+ if(shift_pressed)
+ m_current_selection.m_db -= 0.1f;
+ else if(ctrl_pressed)
+ m_current_selection.m_db -= 10.0f;
+ else if(alt_pressed) {
+ if(m_current_selection.m_db > 0.0f)
+ m_current_selection.m_db = 0.0f;
+ else
+ m_current_selection.m_db = -96.0f;
+ }
+ else
+ m_current_selection.m_db -= 1.0f;
+
+ m_current_selection.m_db = floorf(m_current_selection.m_db * 10.0f) / 10.0f;
+ m_current_selection.m_db = std::clamp(m_current_selection.m_db, -96.0f, 12.0f);
+
+ if(m_current_selection.m_maptype == MT_FULL) {
+ if(m_current_selection.m_node == 0)
+ machine().sound().config_set_volume_sound_io_connection_default(m_current_selection.m_dev, m_current_selection.m_db);
+ else
+ machine().sound().config_set_volume_sound_io_connection_node(m_current_selection.m_dev, find_node_name(m_current_selection.m_node), m_current_selection.m_db);
+ } else {
+ if(m_current_selection.m_node == 0)
+ machine().sound().config_set_volume_sound_io_channel_connection_default(m_current_selection.m_dev, m_current_selection.m_guest_channel, m_current_selection.m_node_channel, m_current_selection.m_db);
+ else
+ machine().sound().config_set_volume_sound_io_channel_connection_node(m_current_selection.m_dev, m_current_selection.m_guest_channel, find_node_name(m_current_selection.m_node), m_current_selection.m_node_channel, m_current_selection.m_db);
+ }
+ m_generation --;
+ return true;
+ }
+
+ case GRP_GUEST_CHANNEL: {
+ if(m_current_selection.m_maptype != MT_CHANNEL)
+ return false;
+
+ u32 guest_channel_count = m_current_selection.m_dev->inputs();
+ if(guest_channel_count == 1)
+ return false;
+ u32 guest_channel = m_current_selection.m_guest_channel;
+ for(;;) {
+ if(guest_channel == 0)
+ guest_channel = guest_channel_count - 1;
+ else
+ guest_channel --;
+ if(guest_channel == m_current_selection.m_guest_channel)
+ return false;
+ if(channel_mapping_available(m_current_selection.m_dev, guest_channel, m_current_selection.m_node, m_current_selection.m_node_channel)) {
+ if(m_current_selection.m_node) {
+ std::string node = find_node_name(m_current_selection.m_node);
+ machine().sound().config_remove_sound_io_channel_connection_node(m_current_selection.m_dev, m_current_selection.m_guest_channel, node, m_current_selection.m_node_channel);
+ machine().sound().config_add_sound_io_channel_connection_node(m_current_selection.m_dev, guest_channel, node, m_current_selection.m_node_channel, m_current_selection.m_db);
+ } else {
+ machine().sound().config_remove_sound_io_channel_connection_default(m_current_selection.m_dev, m_current_selection.m_guest_channel, m_current_selection.m_node_channel);
+ machine().sound().config_add_sound_io_channel_connection_default(m_current_selection.m_dev, guest_channel, m_current_selection.m_node_channel, m_current_selection.m_db);
+ }
+ m_current_selection.m_guest_channel = guest_channel;
+ m_generation --;
+ return true;
+ }
+ }
+ break;
+ }
+
+ case GRP_NODE_CHANNEL: {
+ if(m_current_selection.m_maptype != MT_CHANNEL)
+ return false;
+
+ u32 node_channel_count = find_node_channel_count(m_current_selection.m_node, m_current_selection.m_dev->is_output());
+ if(node_channel_count == 1)
+ return false;
+ u32 node_channel = m_current_selection.m_node_channel;
+ for(;;) {
+ if(node_channel == 0)
+ node_channel = node_channel_count - 1;
+ else
+ node_channel --;
+ if(node_channel == m_current_selection.m_node_channel)
+ return false;
+ if(channel_mapping_available(m_current_selection.m_dev, m_current_selection.m_guest_channel, m_current_selection.m_node, node_channel)) {
+ if(m_current_selection.m_node) {
+ std::string node = find_node_name(m_current_selection.m_node);
+ machine().sound().config_remove_sound_io_channel_connection_node(m_current_selection.m_dev, m_current_selection.m_guest_channel, node, m_current_selection.m_node_channel);
+ machine().sound().config_add_sound_io_channel_connection_node(m_current_selection.m_dev, m_current_selection.m_guest_channel, node, node_channel, m_current_selection.m_db);
+ } else {
+ machine().sound().config_remove_sound_io_channel_connection_default(m_current_selection.m_dev, m_current_selection.m_guest_channel, m_current_selection.m_node_channel);
+ machine().sound().config_add_sound_io_channel_connection_default(m_current_selection.m_dev, m_current_selection.m_guest_channel, node_channel, m_current_selection.m_db);
+ }
+ m_current_selection.m_node_channel = node_channel;
+ m_generation --;
+ return true;
+ }
+ }
+ break;
+ }
+ }
+ break;
+ }
+
+ case IPT_UI_RIGHT: {
+ if(m_current_selection.m_maptype == MT_NONE || m_current_selection.m_maptype == MT_INTERNAL)
+ return false;
+
+ switch(m_current_group) {
+ case GRP_NODE: {
+ if(m_current_selection.m_maptype == MT_FULL) {
+ uint32_t prev_node = m_current_selection.m_node;
+ uint32_t next_node = find_next_available_node(m_current_selection.m_dev, prev_node);
+ if(next_node != 0xffffffff) {
+ m_current_selection.m_node = next_node;
+ if(prev_node)
+ machine().sound().config_remove_sound_io_connection_node(m_current_selection.m_dev, find_node_name(prev_node));
+ else
+ machine().sound().config_remove_sound_io_connection_default(m_current_selection.m_dev);
+ if(next_node)
+ machine().sound().config_add_sound_io_connection_node(m_current_selection.m_dev, find_node_name(next_node), m_current_selection.m_db);
+ else
+ machine().sound().config_add_sound_io_connection_default(m_current_selection.m_dev, m_current_selection.m_db);
+ m_generation --;
+ return true;
+ }
+ } else if(m_current_selection.m_maptype == MT_CHANNEL) {
+ uint32_t prev_node = m_current_selection.m_node;
+ uint32_t next_node = find_next_available_channel_node(m_current_selection.m_dev, m_current_selection.m_guest_channel, prev_node, m_current_selection.m_node_channel);
+ if(next_node != 0xffffffff) {
+ m_current_selection.m_node = next_node;
+ if(prev_node)
+ machine().sound().config_remove_sound_io_channel_connection_node(m_current_selection.m_dev, m_current_selection.m_guest_channel, find_node_name(prev_node), m_current_selection.m_node_channel);
+ else
+ machine().sound().config_remove_sound_io_channel_connection_default(m_current_selection.m_dev, m_current_selection.m_guest_channel, m_current_selection.m_node_channel);
+ if(next_node)
+ machine().sound().config_add_sound_io_channel_connection_node(m_current_selection.m_dev, m_current_selection.m_guest_channel, find_node_name(next_node), m_current_selection.m_node_channel, m_current_selection.m_db);
+ else
+ machine().sound().config_add_sound_io_channel_connection_default(m_current_selection.m_dev, m_current_selection.m_guest_channel, m_current_selection.m_node_channel, m_current_selection.m_db);
+ m_generation --;
+ return true;
+ }
+ }
+ break;
+ }
+
+ case GRP_DB: {
+ if(shift_pressed)
+ m_current_selection.m_db += 0.1f;
+ else if(ctrl_pressed)
+ m_current_selection.m_db += 10.0f;
+ else if(alt_pressed) {
+ if(m_current_selection.m_db < 0.0f)
+ m_current_selection.m_db = 0.0f;
+ else
+ m_current_selection.m_db = 12.0f;
+ }
+ else
+ m_current_selection.m_db += 1.0f;
+
+ m_current_selection.m_db = floorf(m_current_selection.m_db * 10.0f) / 10.0f;
+ m_current_selection.m_db = std::clamp(m_current_selection.m_db, -96.0f, 12.0f);
+
+ if(m_current_selection.m_maptype == MT_FULL) {
+ if(m_current_selection.m_node == 0)
+ machine().sound().config_set_volume_sound_io_connection_default(m_current_selection.m_dev, m_current_selection.m_db);
+ else
+ machine().sound().config_set_volume_sound_io_connection_node(m_current_selection.m_dev, find_node_name(m_current_selection.m_node), m_current_selection.m_db);
+ } else {
+ if(m_current_selection.m_node == 0)
+ machine().sound().config_set_volume_sound_io_channel_connection_default(m_current_selection.m_dev, m_current_selection.m_guest_channel, m_current_selection.m_node_channel, m_current_selection.m_db);
+ else
+ machine().sound().config_set_volume_sound_io_channel_connection_node(m_current_selection.m_dev, m_current_selection.m_guest_channel, find_node_name(m_current_selection.m_node), m_current_selection.m_node_channel, m_current_selection.m_db);
+ }
+ m_generation --;
+ return true;
+ }
+
+ case GRP_GUEST_CHANNEL: {
+ if(m_current_selection.m_maptype != MT_CHANNEL)
+ return false;
+
+ u32 guest_channel_count = m_current_selection.m_dev->inputs();
+ if(guest_channel_count == 1)
+ return false;
+ u32 guest_channel = m_current_selection.m_guest_channel;
+ for(;;) {
+ guest_channel ++;
+ if(guest_channel == guest_channel_count)
+ guest_channel = 0;
+ if(guest_channel == m_current_selection.m_guest_channel)
+ return false;
+ if(channel_mapping_available(m_current_selection.m_dev, guest_channel, m_current_selection.m_node, m_current_selection.m_node_channel)) {
+ if(m_current_selection.m_node) {
+ std::string node = find_node_name(m_current_selection.m_node);
+ machine().sound().config_remove_sound_io_channel_connection_node(m_current_selection.m_dev, m_current_selection.m_guest_channel, node, m_current_selection.m_node_channel);
+ machine().sound().config_add_sound_io_channel_connection_node(m_current_selection.m_dev, guest_channel, node, m_current_selection.m_node_channel, m_current_selection.m_db);
+ } else {
+ machine().sound().config_remove_sound_io_channel_connection_default(m_current_selection.m_dev, m_current_selection.m_guest_channel, m_current_selection.m_node_channel);
+ machine().sound().config_add_sound_io_channel_connection_default(m_current_selection.m_dev, guest_channel, m_current_selection.m_node_channel, m_current_selection.m_db);
+ }
+ m_current_selection.m_guest_channel = guest_channel;
+ m_generation --;
+ return true;
+ }
+ }
+ break;
+ }
+
+ case GRP_NODE_CHANNEL: {
+ if(m_current_selection.m_maptype != MT_CHANNEL)
+ return false;
+
+ u32 node_channel_count = find_node_channel_count(m_current_selection.m_node, m_current_selection.m_dev->is_output());
+ if(node_channel_count == 1)
+ return false;
+ u32 node_channel = m_current_selection.m_node_channel;
+ for(;;) {
+ node_channel ++;
+ if(node_channel == node_channel_count)
+ node_channel = 0;
+ if(node_channel == m_current_selection.m_node_channel)
+ return false;
+ if(channel_mapping_available(m_current_selection.m_dev, m_current_selection.m_guest_channel, m_current_selection.m_node, node_channel)) {
+ if(m_current_selection.m_node) {
+ std::string node = find_node_name(m_current_selection.m_node);
+ machine().sound().config_remove_sound_io_channel_connection_node(m_current_selection.m_dev, m_current_selection.m_guest_channel, node, m_current_selection.m_node_channel);
+ machine().sound().config_add_sound_io_channel_connection_node(m_current_selection.m_dev, m_current_selection.m_guest_channel, node, node_channel, m_current_selection.m_db);
+ } else {
+ machine().sound().config_remove_sound_io_channel_connection_default(m_current_selection.m_dev, m_current_selection.m_guest_channel, m_current_selection.m_node_channel);
+ machine().sound().config_add_sound_io_channel_connection_default(m_current_selection.m_dev, m_current_selection.m_guest_channel, node_channel, m_current_selection.m_db);
+ }
+ m_current_selection.m_node_channel = node_channel;
+ m_generation --;
+ return true;
+ }
+ }
+ break;
+ }
+ }
+ break;
+ }
+ }
+
+ return false;
+}
+
+
+//-------------------------------------------------
+// menu_audio_mixer_populate - populate the audio_mixer
+// menu
+//-------------------------------------------------
+
+void menu_audio_mixer::populate()
+{
+ const auto &mapping = machine().sound().get_mappings();
+ const auto &info = machine().sound().get_osd_info();
+ m_generation = info.m_generation;
+
+ auto find_node = [&info](u32 node_id) -> const osd::audio_info::node_info * {
+ for(const auto &node : info.m_nodes)
+ if(node.m_id == node_id)
+ return &node;
+ // Never happens
+ return nullptr;
+ };
+
+ // Rebuild the selections list
+ m_selections.clear();
+ for(const auto &omap : mapping) {
+ for(const auto &nmap : omap.m_node_mappings)
+ m_selections.emplace_back(select_entry { MT_FULL, omap.m_dev, 0, nmap.m_is_system_default ? 0 : nmap.m_node, 0, nmap.m_db });
+ for(const auto &cmap : omap.m_channel_mappings)
+ m_selections.emplace_back(select_entry { MT_CHANNEL, omap.m_dev, cmap.m_guest_channel, cmap.m_is_system_default ? 0 : cmap.m_node, cmap.m_node_channel, cmap.m_db });
+ if(omap.m_node_mappings.empty() && omap.m_channel_mappings.empty())
+ m_selections.emplace_back(select_entry { MT_NONE, omap.m_dev, 0, 0, 0, 0 });
+ }
+
+ // If there's nothing, get out of there
+ if(m_selections.empty())
+ return;
+
+ // Find the line of the current selection, if any.
+ // Otherwise default to the first line
+
+ u32 cursel_line = 0xffffffff;
+
+ for(u32 i = 0; i != m_selections.size(); i++) {
+ if(m_current_selection == m_selections[i]) {
+ cursel_line = i;
+ break;
+ }
+ }
+
+ if(cursel_line == 0xffffffff)
+ for(u32 i = 0; i != m_selections.size(); i++) {
+ if(m_current_selection.m_dev == m_selections[i].m_dev) {
+ cursel_line = i;
+ break;
+ }
+ }
+
+ if(cursel_line == 0xffffffff)
+ cursel_line = 0;
+
+ if(m_current_selection.m_maptype == MT_INTERNAL)
+ cursel_line = 0xffffffff;
+ else
+ m_current_selection = m_selections[cursel_line];
+
+ if(m_current_selection.m_maptype == MT_FULL) {
+ if(m_current_group == GRP_GUEST_CHANNEL || m_current_group == GRP_NODE_CHANNEL)
+ m_current_group = GRP_NODE;
+ }
+
+ // (Re)build the menu
+ u32 curline = 0;
+ for(const auto &omap : mapping) {
+ item_append(omap.m_dev->tag(), FLAG_UI_HEADING | FLAG_DISABLE, nullptr);
+ for(const auto &nmap : omap.m_node_mappings) {
+ const auto &node = find_node(nmap.m_node);
+ std::string lnode = nmap.m_is_system_default || node->m_name == "" ? "[default]" : node->m_name;
+ if(!omap.m_dev->is_output() && node->m_sinks)
+ lnode = util::string_format("Monitor of %s", lnode);
+ if(curline == cursel_line && m_current_group == GRP_NODE)
+ lnode = u8"\u25c4" + lnode + u8"\u25ba";
+
+ std::string line = (omap.m_dev->is_output() ? "> " : "< ") + lnode;
+
+ std::string db = util::string_format("%g dB", nmap.m_db);
+ if(curline == cursel_line && m_current_group == GRP_DB)
+ db = u8"\u25c4" + db + u8"\u25ba";
+
+ item_append(line, db, 0, m_selections.data() + curline);
+ curline ++;
+ }
+ for(const auto &cmap : omap.m_channel_mappings) {
+ const auto &node = find_node(cmap.m_node);
+ std::string guest_channel = omap.m_dev->get_position_name(cmap.m_guest_channel);
+ if(curline == cursel_line && m_current_group == GRP_GUEST_CHANNEL)
+ guest_channel = u8"\u25c4" + guest_channel + u8"\u25ba";
+
+ std::string lnode = cmap.m_is_system_default || node->m_name == "" ? "[default]" : node->m_name;
+ if(!omap.m_dev->is_output() && node->m_sinks)
+ lnode = util::string_format("Monitor of %s", lnode);
+ if(curline == cursel_line && m_current_group == GRP_NODE)
+ lnode = u8"\u25c4" + lnode + u8"\u25ba";
+
+ std::string lnode_channel = node->m_port_names[cmap.m_node_channel];
+ if(curline == cursel_line && m_current_group == GRP_NODE_CHANNEL)
+ lnode_channel = u8"\u25c4" + lnode_channel + u8"\u25ba";
+
+ std::string line = guest_channel + " > " + lnode + ":" + lnode_channel;
+
+ std::string db = util::string_format("%g dB", cmap.m_db);
+ if(curline == cursel_line && m_current_group == GRP_DB)
+ db = u8"\u25c4" + db + u8"\u25ba";
+
+ item_append(line, db, 0, m_selections.data() + curline);
+ curline ++;
+ }
+ if(omap.m_node_mappings.empty() && omap.m_channel_mappings.empty()) {
+ item_append("[no mapping]", 0, m_selections.data() + curline);
+ curline ++;
+ }
+ }
+ item_append(menu_item_type::SEPARATOR);
+ item_append(util::string_format("%s: add a full mapping", ui().get_general_input_setting(IPT_UI_MIXER_ADD_FULL)), FLAG_DISABLE, nullptr);
+ item_append(util::string_format("%s: add a channel mapping", ui().get_general_input_setting(IPT_UI_MIXER_ADD_CHANNEL)), FLAG_DISABLE, nullptr);
+ item_append(util::string_format("%s: remove a mapping", ui().get_general_input_setting(IPT_UI_CLEAR)), FLAG_DISABLE, nullptr);
+ item_append(menu_item_type::SEPARATOR);
+
+ if(cursel_line != 0xffffffff)
+ set_selection(m_selections.data() + cursel_line);
+}
+
+
+//-------------------------------------------------
+// recompute_metrics - recompute metrics
+//-------------------------------------------------
+
+void menu_audio_mixer::recompute_metrics(uint32_t width, uint32_t height, float aspect)
+{
+ menu::recompute_metrics(width, height, aspect);
+
+ // set_custom_space(0.0f, 2.0f * line_height() + 2.0f * tb_border());
+}
+
+
+//-------------------------------------------------
+// menu_audio_mixer_custom_render - perform our special
+// rendering
+//-------------------------------------------------
+
+void menu_audio_mixer::custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x1, float y1, float x2, float y2)
+{
+}
+
+
+//-------------------------------------------------
+// menu_activated - handle menu gaining focus
+//-------------------------------------------------
+
+void menu_audio_mixer::menu_activated()
+{
+ // scripts or the other form of the menu could have changed something in the mean time
+ reset(reset_options::REMEMBER_POSITION);
+}
+
+
+//-------------------------------------------------
+// menu_deactivated - handle menu losing focus
+//-------------------------------------------------
+
+void menu_audio_mixer::menu_deactivated()
+{
+}
+
+uint32_t menu_audio_mixer::find_node_index(uint32_t node) const
+{
+ const auto &info = machine().sound().get_osd_info();
+ for(uint32_t i = 0; i != info.m_nodes.size(); i++)
+ if(info.m_nodes[i].m_id == node)
+ return i;
+ // Can't happen in theory
+ return 0xffffffff;
+}
+
+std::string menu_audio_mixer::find_node_name(uint32_t node) const
+{
+ const auto &info = machine().sound().get_osd_info();
+ for(uint32_t i = 0; i != info.m_nodes.size(); i++)
+ if(info.m_nodes[i].m_id == node)
+ return info.m_nodes[i].name();
+ // Can't happen in theory
+ return "";
+}
+
+uint32_t menu_audio_mixer::find_node_channel_count(uint32_t node, bool is_output) const
+{
+ const auto &info = machine().sound().get_osd_info();
+ if(!node)
+ node = info.m_default_sink;
+ for(uint32_t i = 0; i != info.m_nodes.size(); i++)
+ if(info.m_nodes[i].m_id == node)
+ return is_output ? info.m_nodes[i].m_sinks : info.m_nodes[i].m_sources;
+ // Can't happen in theory
+ return 0;
+}
+
+uint32_t menu_audio_mixer::find_next_sink_node_index(uint32_t index) const
+{
+ if(index == 0xffffffff)
+ return index;
+
+ const auto &info = machine().sound().get_osd_info();
+ for(uint32_t idx = index + 1; idx != info.m_nodes.size(); idx++)
+ if(info.m_nodes[idx].m_sinks)
+ return idx;
+ return 0xffffffff;
+}
+
+uint32_t menu_audio_mixer::find_next_source_node_index(uint32_t index) const
+{
+ if(index == 0xffffffff)
+ return index;
+
+ const auto &info = machine().sound().get_osd_info();
+ for(uint32_t idx = index + 1; idx != info.m_nodes.size(); idx++)
+ if(info.m_nodes[idx].m_sources)
+ return idx;
+ return 0xffffffff;
+}
+
+uint32_t menu_audio_mixer::find_previous_sink_node_index(uint32_t index) const
+{
+ if(index == 0xffffffff)
+ return index;
+
+ const auto &info = machine().sound().get_osd_info();
+ for(uint32_t idx = index - 1; idx != 0xffffffff; idx--)
+ if(info.m_nodes[idx].m_sinks)
+ return idx;
+ return 0xffffffff;
+}
+
+uint32_t menu_audio_mixer::find_previous_source_node_index(uint32_t index) const
+{
+ if(index == 0xffffffff)
+ return index;
+
+ const auto &info = machine().sound().get_osd_info();
+ for(uint32_t idx = index - 1; idx != 0xffffffff; idx--)
+ if(info.m_nodes[idx].m_sources)
+ return idx;
+ return 0xffffffff;
+}
+
+uint32_t menu_audio_mixer::find_first_sink_node_index() const
+{
+ const auto &info = machine().sound().get_osd_info();
+ for(uint32_t index = 0; index != info.m_nodes.size(); index ++)
+ if(info.m_nodes[index].m_sinks)
+ return index;
+ return 0xffffffff;
+}
+
+uint32_t menu_audio_mixer::find_first_source_node_index() const
+{
+ const auto &info = machine().sound().get_osd_info();
+ for(uint32_t index = 0; index != info.m_nodes.size(); index ++)
+ if(info.m_nodes[index].m_sources)
+ return index;
+ return 0xffffffff;
+}
+
+uint32_t menu_audio_mixer::find_last_sink_node_index() const
+{
+ const auto &info = machine().sound().get_osd_info();
+ for(uint32_t index = info.m_nodes.size() - 1; index != 0xffffffff; index --)
+ if(info.m_nodes[index].m_sinks)
+ return index;
+ return 0xffffffff;
+}
+
+uint32_t menu_audio_mixer::find_last_source_node_index() const
+{
+ const auto &info = machine().sound().get_osd_info();
+ for(uint32_t index = info.m_nodes.size() - 1; index != 0xffffffff; index --)
+ if(info.m_nodes[index].m_sources)
+ return index;
+ return 0xffffffff;
+}
+
+bool menu_audio_mixer::full_mapping_available(sound_io_device *dev, uint32_t node) const
+{
+ if(dev->is_output() && !node && machine().sound().get_osd_info().m_default_sink == 0)
+ return false;
+ if(!dev->is_output() && !node && machine().sound().get_osd_info().m_default_source == 0)
+ return false;
+
+ const auto &mapping = machine().sound().get_mappings();
+ for(const auto &omap : mapping)
+ if(omap.m_dev == dev) {
+ for(const auto &nmap : omap.m_node_mappings)
+ if((node != 0 && nmap.m_node == node && !nmap.m_is_system_default) || (node == 0 && nmap.m_is_system_default))
+ return false;
+ return true;
+ }
+ return true;
+}
+
+bool menu_audio_mixer::channel_mapping_available(sound_io_device *dev, uint32_t guest_channel, uint32_t node, uint32_t node_channel) const
+{
+ if(dev->is_output() && !node && machine().sound().get_osd_info().m_default_sink == 0)
+ return false;
+ if(!dev->is_output() && !node && machine().sound().get_osd_info().m_default_source == 0)
+ return false;
+
+ const auto &mapping = machine().sound().get_mappings();
+ for(const auto &omap : mapping)
+ if(omap.m_dev == dev) {
+ for(const auto &cmap : omap.m_channel_mappings)
+ if(cmap.m_guest_channel == guest_channel &&
+ ((node != 0 && cmap.m_node == node && !cmap.m_is_system_default) || (node == 0 && cmap.m_is_system_default))
+ && cmap.m_node_channel == node_channel)
+ return false;
+ return true;
+ }
+ return true;
+}
+
+uint32_t menu_audio_mixer::find_next_available_node(sound_io_device *dev, uint32_t node) const
+{
+ const auto &info = machine().sound().get_osd_info();
+
+ if(dev->is_output()) {
+ if(node == 0) {
+ uint32_t index = find_first_sink_node_index();
+ while(index != 0xffffffff && !full_mapping_available(dev, info.m_nodes[index].m_id))
+ index = find_next_sink_node_index(index);
+ return index == 0xffffffff ? 0xffffffff : info.m_nodes[index].m_id;
+ }
+
+ uint32_t index = find_node_index(node);
+ while(index != 0xffffffff) {
+ index = find_next_sink_node_index(index);
+ if(index != 0xffffffff && full_mapping_available(dev, info.m_nodes[index].m_id))
+ return info.m_nodes[index].m_id;
+ }
+
+ if(info.m_default_sink != 0 && full_mapping_available(dev, 0))
+ return 0;
+
+ index = find_first_sink_node_index();
+ while(index != 0xffffffff && !full_mapping_available(dev, info.m_nodes[index].m_id))
+ index = find_next_sink_node_index(index);
+ return index == 0xffffffff ? 0xffffffff : info.m_nodes[index].m_id;
+ } else {
+ if(node == 0) {
+ uint32_t index = find_first_source_node_index();
+ while(index != 0xffffffff && !full_mapping_available(dev, info.m_nodes[index].m_id))
+ index = find_next_source_node_index(index);
+ return index == 0xffffffff ? 0xffffffff : info.m_nodes[index].m_id;
+ }
+
+ uint32_t index = find_node_index(node);
+ while(index != 0xffffffff) {
+ index = find_next_source_node_index(index);
+ if(index != 0xffffffff && full_mapping_available(dev, info.m_nodes[index].m_id))
+ return info.m_nodes[index].m_id;
+ }
+
+ if(info.m_default_source != 0 && full_mapping_available(dev, 0))
+ return 0;
+
+ index = find_first_source_node_index();
+ while(index != 0xffffffff && !full_mapping_available(dev, info.m_nodes[index].m_id))
+ index = find_next_source_node_index(index);
+ return index == 0xffffffff ? 0xffffffff : info.m_nodes[index].m_id;
+ }
+}
+
+uint32_t menu_audio_mixer::find_previous_available_node(sound_io_device *dev, uint32_t node) const
+{
+ const auto &info = machine().sound().get_osd_info();
+
+ if(dev->is_output()) {
+ if(node == 0) {
+ uint32_t index = find_last_sink_node_index();
+ while(index != 0xffffffff && !full_mapping_available(dev, info.m_nodes[index].m_id))
+ index = find_previous_sink_node_index(index);
+ return index == 0xffffffff ? 0xffffffff : info.m_nodes[index].m_id;
+ }
+
+ uint32_t index = find_node_index(node);
+ while(index != 0xffffffff) {
+ index = find_previous_sink_node_index(index);
+ if(index != 0xffffffff && full_mapping_available(dev, info.m_nodes[index].m_id))
+ return info.m_nodes[index].m_id;
+ }
+
+ if(info.m_default_sink != 0 && full_mapping_available(dev, 0))
+ return 0;
+
+ index = find_last_sink_node_index();
+ while(index != 0xffffffff && !full_mapping_available(dev, info.m_nodes[index].m_id))
+ index = find_previous_sink_node_index(index);
+ return index == 0xffffffff ? 0xffffffff : info.m_nodes[index].m_id;
+
+ } else {
+ if(node == 0) {
+ uint32_t index = find_last_source_node_index();
+ while(index != 0xffffffff && !full_mapping_available(dev, info.m_nodes[index].m_id))
+ index = find_previous_source_node_index(index);
+ return index == 0xffffffff ? 0xffffffff : info.m_nodes[index].m_id;
+ }
+
+ uint32_t index = find_node_index(node);
+ while(index != 0xffffffff) {
+ index = find_previous_source_node_index(index);
+ if(index != 0xffffffff && full_mapping_available(dev, info.m_nodes[index].m_id))
+ return info.m_nodes[index].m_id;
+ }
+
+ if(info.m_default_source != 0 && full_mapping_available(dev, 0))
+ return 0;
+
+ index = find_last_source_node_index();
+ while(index != 0xffffffff && !full_mapping_available(dev, info.m_nodes[index].m_id))
+ index = find_previous_source_node_index(index);
+ return index == 0xffffffff ? 0xffffffff : info.m_nodes[index].m_id;
+ }
+}
+
+uint32_t menu_audio_mixer::find_next_available_channel_node(sound_io_device *dev, uint32_t guest_channel, uint32_t node, uint32_t node_channel) const
+{
+ const auto &info = machine().sound().get_osd_info();
+
+ if(dev->is_output()) {
+ if(node == 0) {
+ uint32_t index = find_first_sink_node_index();
+ while(index != 0xffffffff && !channel_mapping_available(dev, guest_channel, info.m_nodes[index].m_id, node_channel))
+ index = find_next_sink_node_index(index);
+ return index == 0xffffffff ? 0xffffffff : info.m_nodes[index].m_id;
+ }
+
+ uint32_t index = find_node_index(node);
+ while(index != 0xffffffff) {
+ index = find_next_sink_node_index(index);
+ if(index != 0xffffffff && channel_mapping_available(dev, guest_channel, info.m_nodes[index].m_id, node_channel))
+ return info.m_nodes[index].m_id;
+ }
+
+ if(dev->is_output() && info.m_default_sink != 0 && channel_mapping_available(dev, guest_channel, 0, node_channel))
+ return 0;
+ if(!dev->is_output() && info.m_default_source != 0 && channel_mapping_available(dev, guest_channel, 0, node_channel))
+ return 0;
+
+ index = find_first_sink_node_index();
+ while(index != 0xffffffff && !channel_mapping_available(dev, guest_channel, info.m_nodes[index].m_id, node_channel))
+ index = find_next_sink_node_index(index);
+ return index == 0xffffffff ? 0xffffffff : info.m_nodes[index].m_id;
+
+ } else {
+ if(node == 0) {
+ uint32_t index = find_first_source_node_index();
+ while(index != 0xffffffff && !channel_mapping_available(dev, guest_channel, info.m_nodes[index].m_id, node_channel))
+ index = find_next_source_node_index(index);
+ return index == 0xffffffff ? 0xffffffff : info.m_nodes[index].m_id;
+ }
+
+ uint32_t index = find_node_index(node);
+ while(index != 0xffffffff) {
+ index = find_next_source_node_index(index);
+ if(index != 0xffffffff && channel_mapping_available(dev, guest_channel, info.m_nodes[index].m_id, node_channel))
+ return info.m_nodes[index].m_id;
+ }
+
+ if(dev->is_output() && info.m_default_source != 0 && channel_mapping_available(dev, guest_channel, 0, node_channel))
+ return 0;
+ if(!dev->is_output() && info.m_default_source != 0 && channel_mapping_available(dev, guest_channel, 0, node_channel))
+ return 0;
+
+ index = find_first_source_node_index();
+ while(index != 0xffffffff && !channel_mapping_available(dev, guest_channel, info.m_nodes[index].m_id, node_channel))
+ index = find_next_source_node_index(index);
+ return index == 0xffffffff ? 0xffffffff : info.m_nodes[index].m_id;
+ }
+}
+
+uint32_t menu_audio_mixer::find_previous_available_channel_node(sound_io_device *dev, uint32_t guest_channel, uint32_t node, uint32_t node_channel) const
+{
+ const auto &info = machine().sound().get_osd_info();
+
+ if(dev->is_output()) {
+ if(node == 0) {
+ uint32_t index = find_last_sink_node_index();
+ while(index != 0xffffffff && !channel_mapping_available(dev, guest_channel, info.m_nodes[index].m_id, node_channel))
+ index = find_previous_sink_node_index(index);
+ return index == 0xffffffff ? 0xffffffff : info.m_nodes[index].m_id;
+ }
+
+ uint32_t index = find_node_index(node);
+ while(index != 0xffffffff) {
+ index = find_previous_sink_node_index(index);
+ if(index != 0xffffffff && channel_mapping_available(dev, guest_channel, info.m_nodes[index].m_id, node_channel))
+ return info.m_nodes[index].m_id;
+ }
+
+ if(dev->is_output() && info.m_default_sink != 0 && channel_mapping_available(dev, guest_channel, 0, node_channel))
+ return 0;
+ if(!dev->is_output() && info.m_default_source != 0 && channel_mapping_available(dev, guest_channel, 0, node_channel))
+ return 0;
+
+ index = find_last_sink_node_index();
+ while(index != 0xffffffff && !channel_mapping_available(dev, guest_channel, info.m_nodes[index].m_id, node_channel))
+ index = find_previous_sink_node_index(index);
+ return index == 0xffffffff ? 0xffffffff : info.m_nodes[index].m_id;
+
+ } else {
+ if(node == 0) {
+ uint32_t index = find_last_source_node_index();
+ while(index != 0xffffffff && !channel_mapping_available(dev, guest_channel, info.m_nodes[index].m_id, node_channel))
+ index = find_previous_source_node_index(index);
+ return index == 0xffffffff ? 0xffffffff : info.m_nodes[index].m_id;
+ }
+
+ uint32_t index = find_node_index(node);
+ while(index != 0xffffffff) {
+ index = find_previous_source_node_index(index);
+ if(index != 0xffffffff && channel_mapping_available(dev, guest_channel, info.m_nodes[index].m_id, node_channel))
+ return info.m_nodes[index].m_id;
+ }
+
+ if(dev->is_output() && info.m_default_source != 0 && channel_mapping_available(dev, guest_channel, 0, node_channel))
+ return 0;
+ if(!dev->is_output() && info.m_default_source != 0 && channel_mapping_available(dev, guest_channel, 0, node_channel))
+ return 0;
+
+ index = find_last_source_node_index();
+ while(index != 0xffffffff && !channel_mapping_available(dev, guest_channel, info.m_nodes[index].m_id, node_channel))
+ index = find_previous_source_node_index(index);
+ return index == 0xffffffff ? 0xffffffff : info.m_nodes[index].m_id;
+ }
+}
+
+} // namespace ui
+
diff --git a/src/frontend/mame/ui/audiomix.h b/src/frontend/mame/ui/audiomix.h
new file mode 100644
index 00000000000..5f8468f01f0
--- /dev/null
+++ b/src/frontend/mame/ui/audiomix.h
@@ -0,0 +1,95 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+/***************************************************************************
+
+ ui/audiomix.h
+
+ Audio mixing/mapping control
+
+***************************************************************************/
+
+#ifndef MAME_FRONTEND_UI_AUDIOMIX_H
+#define MAME_FRONTEND_UI_AUDIOMIX_H
+
+#pragma once
+
+#include "ui/menu.h"
+
+
+namespace ui {
+
+class menu_audio_mixer : public menu
+{
+public:
+ menu_audio_mixer(mame_ui_manager &mui, render_container &container);
+ virtual ~menu_audio_mixer() override;
+
+protected:
+ virtual void recompute_metrics(uint32_t width, uint32_t height, float aspect) override;
+ virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
+ virtual void menu_activated() override;
+ virtual void menu_deactivated() override;
+
+private:
+ enum {
+ MT_UNDEFINED, // At startup
+ MT_NONE, // [no mapping]
+ MT_FULL, // Full mapping to node
+ MT_CHANNEL, // Channel-to-channel mapping
+ MT_INTERNAL // Go back to previous menu or other non-mapping entry
+ };
+
+ enum {
+ GRP_GUEST_CHANNEL,
+ GRP_NODE,
+ GRP_NODE_CHANNEL,
+ GRP_DB
+ };
+
+ struct select_entry {
+ u32 m_maptype;
+ sound_io_device *m_dev;
+ u32 m_guest_channel;
+ u32 m_node;
+ u32 m_node_channel;
+ float m_db;
+
+ inline bool operator ==(const select_entry &sel) {
+ return sel.m_maptype == m_maptype && sel.m_dev == m_dev && sel.m_guest_channel == m_guest_channel && sel.m_node == m_node && sel.m_node_channel == m_node_channel;
+ }
+ };
+
+ uint32_t m_generation;
+ select_entry m_current_selection;
+ uint32_t m_current_group;
+ std::vector<select_entry> m_selections;
+
+ virtual void populate() override;
+ virtual bool handle(event const *ev) override;
+
+ uint32_t find_node_index(uint32_t node) const;
+ std::string find_node_name(uint32_t node) const;
+ uint32_t find_node_channel_count(uint32_t node, bool is_output) const;
+
+ uint32_t find_next_sink_node_index(uint32_t index) const;
+ uint32_t find_next_source_node_index(uint32_t index) const;
+ uint32_t find_previous_sink_node_index(uint32_t index) const;
+ uint32_t find_previous_source_node_index(uint32_t index) const;
+
+ uint32_t find_first_sink_node_index() const;
+ uint32_t find_first_source_node_index() const;
+ uint32_t find_last_sink_node_index() const;
+ uint32_t find_last_source_node_index() const;
+
+ bool full_mapping_available(sound_io_device *dev, uint32_t node) const;
+ bool channel_mapping_available(sound_io_device *dev, uint32_t guest_channel, uint32_t node, uint32_t node_channel) const;
+
+ uint32_t find_next_available_node(sound_io_device *dev, uint32_t node) const;
+ uint32_t find_previous_available_node(sound_io_device *dev, uint32_t node) const;
+ uint32_t find_next_available_channel_node(sound_io_device *dev, uint32_t guest_channel, uint32_t node, uint32_t node_channel) const;
+ uint32_t find_previous_available_channel_node(sound_io_device *dev, uint32_t guest_channel, uint32_t node, uint32_t node_channel) const;
+};
+
+} // namespace ui
+
+#endif // MAME_FRONTEND_UI_AUDIOMIX_H
diff --git a/src/frontend/mame/ui/devopt.cpp b/src/frontend/mame/ui/devopt.cpp
index 40f60d9b59f..fa8bb4fadce 100644
--- a/src/frontend/mame/ui/devopt.cpp
+++ b/src/frontend/mame/ui/devopt.cpp
@@ -167,7 +167,7 @@ void menu_device_config::populate_text(std::optional<text_layout> &layout, float
std::unordered_set<std::string> soundtags;
for (device_sound_interface &sound : snditer)
{
- if (!sound.issound() || !soundtags.insert(sound.device().tag()).second)
+ if (!soundtags.insert(sound.device().tag()).second)
continue;
// count how many identical sound chips we have
diff --git a/src/frontend/mame/ui/info.cpp b/src/frontend/mame/ui/info.cpp
index c2ba4af2cfb..7176779ea02 100644
--- a/src/frontend/mame/ui/info.cpp
+++ b/src/frontend/mame/ui/info.cpp
@@ -446,7 +446,7 @@ std::string machine_info::game_info_string() const
bool found_sound = false;
for (device_sound_interface &sound : snditer)
{
- if (!sound.issound() || !soundtags.insert(sound.device().tag()).second)
+ if (!soundtags.insert(sound.device().tag()).second)
continue;
// append the Sound: string
diff --git a/src/frontend/mame/ui/mainmenu.cpp b/src/frontend/mame/ui/mainmenu.cpp
index 16b7396e7f5..c7b23b8d19f 100644
--- a/src/frontend/mame/ui/mainmenu.cpp
+++ b/src/frontend/mame/ui/mainmenu.cpp
@@ -12,6 +12,8 @@
#include "ui/mainmenu.h"
#include "ui/about.h"
+#include "ui/audiomix.h"
+#include "ui/audioeffects.h"
#include "ui/barcode.h"
#include "ui/cheatopt.h"
#include "ui/confswitch.h"
@@ -56,6 +58,8 @@ enum : unsigned {
TAPE_CONTROL,
SLOT_DEVICES,
NETWORK_DEVICES,
+ AUDIO_MIXER,
+ AUDIO_EFFECTS,
SLIDERS,
VIDEO_TARGETS,
CROSSHAIR,
@@ -157,6 +161,10 @@ void menu_main::populate()
if (network_interface_enumerator(machine().root_device()).first() != nullptr)
item_append(_("menu-main", "Network Devices"), 0, (void*)NETWORK_DEVICES);
+ item_append(_("menu-main", "Audio Mixer"), 0, (void *)AUDIO_MIXER);
+
+ item_append(_("menu-main", "Audio Effects"), 0, (void *)AUDIO_EFFECTS);
+
item_append(_("menu-main", "Slider Controls"), 0, (void *)SLIDERS);
item_append(_("menu-main", "Video Options"), 0, (void *)VIDEO_TARGETS);
@@ -262,6 +270,14 @@ bool menu_main::handle(event const *ev)
menu::stack_push<menu_network_devices>(ui(), container());
break;
+ case AUDIO_MIXER:
+ menu::stack_push<menu_audio_mixer>(ui(), container());
+ break;
+
+ case AUDIO_EFFECTS:
+ menu::stack_push<menu_audio_effects>(ui(), container());
+ break;
+
case SLIDERS:
menu::stack_push<menu_sliders>(ui(), container(), false);
break;
diff --git a/src/frontend/mame/ui/ui.cpp b/src/frontend/mame/ui/ui.cpp
index dbfd5531be6..71006aa8a97 100644
--- a/src/frontend/mame/ui/ui.cpp
+++ b/src/frontend/mame/ui/ui.cpp
@@ -882,20 +882,6 @@ bool mame_ui_manager::update_and_render(render_container &container)
container.add_rect(0.0f, 0.0f, 1.0f, 1.0f, rgb_t(alpha,0x00,0x00,0x00), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
}
- // show red if overdriving sound
- if (machine().options().speaker_report() != 0 && machine().phase() == machine_phase::RUNNING)
- {
- auto compressor = machine().sound().compressor_scale();
- if (compressor < 1.0)
- {
- float width = 0.05f + std::min(0.15f, (1.0f - compressor) * 0.4f);
- container.add_rect(0.0f, 0.0f, 1.0f, width, rgb_t(0xc0,0xff,0x00,0x00), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
- container.add_rect(0.0f, 1.0f - width, 1.0f, 1.0f, rgb_t(0xc0,0xff,0x00,0x00), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
- container.add_rect(0.0f, width, width, 1.0f - width, rgb_t(0xc0,0xff,0x00,0x00), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
- container.add_rect(1.0f - width, width, 1.0f, 1.0f - width, rgb_t(0xc0,0xff,0x00,0x00), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
- }
- }
-
// render any cheat stuff at the bottom
if (machine().phase() >= machine_phase::RESET)
mame_machine_manager::instance()->cheat().render_text(*this, container);
@@ -1874,22 +1860,19 @@ std::vector<ui::menu_item> mame_ui_manager::slider_init(running_machine &machine
m_sliders.clear();
// add overall volume
- slider_alloc(_("Master Volume"), -32, 0, 0, 1, std::bind(&mame_ui_manager::slider_volume, this, _1, _2));
+ slider_alloc(_("Master Volume"), -960, 0, 120, 10, std::bind(&mame_ui_manager::slider_volume, this, _1, _2));
- // add per-channel volume
- mixer_input info;
- for (int item = 0; machine.sound().indexed_mixer_input(item, info); item++)
+ // add per-sound device and per-sound device channel volume
+ for (device_sound_interface &snd : sound_interface_enumerator(machine.root_device()))
{
- std::string str = string_format(_("%1$s Volume"), info.stream->input(info.inputnum).name());
- slider_alloc(std::move(str), 0, 1000, 4000, 20, std::bind(&mame_ui_manager::slider_mixervol, this, item, _1, _2));
- }
+ // Don't add microphones, speakers or devices without outputs
+ if (dynamic_cast<sound_io_device *>(&snd) || !snd.outputs())
+ continue;
- // add speaker panning
- for (speaker_device &speaker : speaker_device_enumerator(machine.root_device()))
- {
- int defpan = floorf(speaker.defpan() * 1000.0f + 0.5f);
- std::string str = string_format(_("%s '%s' Panning"), speaker.name(), speaker.tag());
- slider_alloc(std::move(str), -1000, defpan, 1000, 20, std::bind(&mame_ui_manager::slider_panning, this, std::ref(speaker), _1, _2));
+ slider_alloc(util::string_format(_("%1$s volume"), snd.device().tag()), -960, 0, 120, 10, std::bind(&mame_ui_manager::slider_devvol, this, &snd, _1, _2));
+ if (snd.outputs() != 1)
+ for (int channel = 0; channel != snd.outputs(); channel ++)
+ slider_alloc(util::string_format(_("%1$s channel %d volume"), snd.device().tag(), channel), -960, 0, 120, 10, std::bind(&mame_ui_manager::slider_devvol_chan, this, &snd, channel, _1, _2));
}
// add analog adjusters
@@ -2032,84 +2015,74 @@ std::vector<ui::menu_item> mame_ui_manager::slider_init(running_machine &machine
int32_t mame_ui_manager::slider_volume(std::string *str, int32_t newval)
{
if (newval != SLIDER_NOCHANGE)
- machine().sound().set_attenuation(newval);
+ machine().sound().set_master_gain(newval == -960 ? 0 : osd::db_to_linear(newval * 0.1f));
- int32_t curval = machine().sound().attenuation();
- if (str)
- *str = string_format(_(u8"%1$3d\u00a0dB"), curval);
+ int curval = machine().sound().master_gain() == 0 ? -960 : floorf(osd::linear_to_db(machine().sound().master_gain()) * 10.0f + 0.5f);
+ if (str)
+ {
+ if (curval == -960)
+ *str = _("Mute");
+ else if (curval % 10)
+ *str = string_format(_(u8"%1$5.1f\u00a0dB"), float(curval) * 0.1f);
+ else
+ *str = string_format(_(u8"%1$3d\u00a0dB"), curval / 10);
+ }
return curval;
}
//-------------------------------------------------
-// slider_mixervol - single channel volume
+// slider_devvol - device volume
// slider callback
//-------------------------------------------------
-int32_t mame_ui_manager::slider_mixervol(int item, std::string *str, int32_t newval)
+int32_t mame_ui_manager::slider_devvol(device_sound_interface *snd, std::string *str, int32_t newval)
{
- mixer_input info;
- if (!machine().sound().indexed_mixer_input(item, info))
- return 0;
-
if (newval != SLIDER_NOCHANGE)
- info.stream->input(info.inputnum).set_user_gain(float(newval) * 0.001f);
+ snd->set_user_output_gain(newval == -960 ? 0 : osd::db_to_linear(newval * 0.1f));
+
+ int curval = snd->user_output_gain() == 0 ? -960 : floorf(osd::linear_to_db(snd->user_output_gain()) * 10.0f + 0.5f);
- int32_t curval = floorf(info.stream->input(info.inputnum).user_gain() * 1000.0f + 0.5f);
if (str)
{
- if (curval == 0)
+ if (curval == -960)
*str = _("Mute");
else if (curval % 10)
- *str = string_format(_("%1$.1f%%"), float(curval) * 0.1f);
+ *str = string_format(_(u8"%1$5.1f\u00a0dB"), float(curval) * 0.1f);
else
- *str = string_format(_("%1$3d%%"), curval / 10);
+ *str = string_format(_(u8"%1$3d\u00a0dB"), curval / 10);
}
-
return curval;
}
//-------------------------------------------------
-// slider_panning - speaker panning slider
-// callback
+// slider_devvol_chan - device channel volume
+// slider callback
//-------------------------------------------------
-int32_t mame_ui_manager::slider_panning(speaker_device &speaker, std::string *str, int32_t newval)
+int32_t mame_ui_manager::slider_devvol_chan(device_sound_interface *snd, int channel, std::string *str, int32_t newval)
{
if (newval != SLIDER_NOCHANGE)
- speaker.set_pan(float(newval) * 0.001f);
+ snd->set_user_output_gain(channel, newval == -960 ? 0 : osd::db_to_linear(newval * 0.1f));
+
+ int curval = snd->user_output_gain(channel) == 0 ? -960 : floorf(osd::linear_to_db(snd->user_output_gain(channel)) * 10.0f + 0.5f);
- int32_t curval = floorf(speaker.pan() * 1000.0f + 0.5f);
if (str)
{
- switch (curval)
- {
- // preset strings for exact center/left/right
- case 0:
- *str = _("Center");
- break;
-
- case -1000:
- *str = _("Left");
- break;
-
- case 1000:
- *str = _("Right");
- break;
-
- // otherwise show as floating point
- default:
- *str = string_format(_("%1$.3f"), float(curval) * 0.001f);
- break;
- }
+ if (curval == -960)
+ *str = _("Mute");
+ else if (curval % 10)
+ *str = string_format(_(u8"%1$5.1f\u00a0dB"), float(curval) * 0.1f);
+ else
+ *str = string_format(_(u8"%1$3d\u00a0dB"), curval / 10);
}
-
return curval;
}
+
//-------------------------------------------------
// slider_adjuster - analog adjuster slider
// callback
diff --git a/src/frontend/mame/ui/ui.h b/src/frontend/mame/ui/ui.h
index 05017154d48..667f4b30aeb 100644
--- a/src/frontend/mame/ui/ui.h
+++ b/src/frontend/mame/ui/ui.h
@@ -349,8 +349,8 @@ private:
// slider controls
int32_t slider_volume(std::string *str, int32_t newval);
- int32_t slider_mixervol(int item, std::string *str, int32_t newval);
- int32_t slider_panning(speaker_device &speaker, std::string *str, int32_t newval);
+ int32_t slider_devvol(device_sound_interface *snd, std::string *str, int32_t newval);
+ int32_t slider_devvol_chan(device_sound_interface *snd, int channel, std::string *str, int32_t newval);
int32_t slider_adjuster(ioport_field &field, std::string *str, int32_t newval);
int32_t slider_overclock(device_t &device, std::string *str, int32_t newval);
int32_t slider_refresh(screen_device &screen, std::string *str, int32_t newval);
diff --git a/src/lib/util/aviio.cpp b/src/lib/util/aviio.cpp
index 40ce6ebe689..7b5e8d00d87 100644
--- a/src/lib/util/aviio.cpp
+++ b/src/lib/util/aviio.cpp
@@ -48,7 +48,7 @@ static constexpr std::uint64_t FOUR_GB = std::uint64_t(1) << 32;
* @brief A constant that defines maximum sound channels.
*/
-static constexpr unsigned MAX_SOUND_CHANNELS = 2;
+static constexpr unsigned MAX_SOUND_CHANNELS = 16;
/**
* @def SOUND_BUFFER_MSEC
diff --git a/src/mame/access/acvirus.cpp b/src/mame/access/acvirus.cpp
index 2d2bf966bb8..cd14ae6690a 100644
--- a/src/mame/access/acvirus.cpp
+++ b/src/mame/access/acvirus.cpp
@@ -114,8 +114,7 @@ void acvirus_state::virus(machine_config &config)
SAB80C535(config, m_maincpu, XTAL(12'000'000));
m_maincpu->set_addrmap(AS_PROGRAM, &acvirus_state::virus_map);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
static INPUT_PORTS_START( virus )
diff --git a/src/mame/acorn/electron_ula.cpp b/src/mame/acorn/electron_ula.cpp
index 66d6f6930c6..053f53aa82b 100644
--- a/src/mame/acorn/electron_ula.cpp
+++ b/src/mame/acorn/electron_ula.cpp
@@ -218,19 +218,14 @@ void electron_ula_device::set_cpu_clock(offs_t offset)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void electron_ula_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void electron_ula_device::sound_stream_update(sound_stream &stream)
{
- auto &buffer = outputs[0];
-
- // if we're not enabled, just fill with 0
+ // if we're not enabled, just leave the default 0-fill
if (!m_sound_enable || m_sound_freq == 0)
- {
- buffer.fill(0);
return;
- }
// fill in the sample
- for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
m_sound_incr -= m_sound_freq;
while (m_sound_incr < 0)
@@ -239,7 +234,7 @@ void electron_ula_device::sound_stream_update(sound_stream &stream, std::vector<
m_sound_signal = -m_sound_signal;
}
- buffer.put(sampindex, m_sound_signal);
+ stream.put(0, sampindex, m_sound_signal);
}
}
diff --git a/src/mame/acorn/electron_ula.h b/src/mame/acorn/electron_ula.h
index 2c233e9e1a4..36f00a3afed 100644
--- a/src/mame/acorn/electron_ula.h
+++ b/src/mame/acorn/electron_ula.h
@@ -54,7 +54,7 @@ protected:
virtual uint32_t palette_entries() const noexcept override { return 16; }
// 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;
// device_memory_interface implementation
virtual space_config_vector memory_space_config() const override;
@@ -70,7 +70,7 @@ private:
bool m_sound_enable; // enable beep
uint32_t m_sound_freq; // set frequency
int32_t m_sound_incr; // initial wave state
- stream_buffer::sample_t m_sound_signal; // current signal
+ sound_stream::sample_t m_sound_signal; // current signal
casin_delegate m_cas_in_cb;
casout_delegate m_cas_out_cb;
diff --git a/src/mame/acorn/ssfindo.cpp b/src/mame/acorn/ssfindo.cpp
index dd3165c80cb..f975dfb5e01 100644
--- a/src/mame/acorn/ssfindo.cpp
+++ b/src/mame/acorn/ssfindo.cpp
@@ -630,15 +630,14 @@ void ssfindo_state::ssfindo(machine_config &config)
m_iomd->iolines_read().set(FUNC(ssfindo_state::iolines_r));
m_iomd->iolines_write().set(FUNC(ssfindo_state::iolines_w));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
qs1000_device &qs1000(QS1000(config, "qs1000", 24_MHz_XTAL));
qs1000.set_external_rom(true);
// qs1000.p1_out().set(FUNC()); // TODO: writes something here
qs1000.p3_in().set([this]() { return u8(0xfeU | m_txd); });
- qs1000.add_route(0, "lspeaker", 0.25);
- qs1000.add_route(1, "rspeaker", 0.25);
+ qs1000.add_route(0, "speaker", 0.25, 0);
+ qs1000.add_route(1, "speaker", 0.25, 1);
}
void ssfindo_state::ppcar(machine_config &config)
diff --git a/src/mame/act/victor9k.cpp b/src/mame/act/victor9k.cpp
index ab09b8f3437..87299548c54 100644
--- a/src/mame/act/victor9k.cpp
+++ b/src/mame/act/victor9k.cpp
@@ -23,29 +23,33 @@
*/
#include "emu.h"
+
+#include "victor9k_fdc.h"
+#include "victor9k_kb.h"
+
#include "bus/centronics/ctronics.h"
#include "bus/ieee488/ieee488.h"
#include "bus/rs232/rs232.h"
#include "cpu/i86/i86.h"
-#include "formats/victor9k_dsk.h"
#include "imagedev/floppy.h"
#include "machine/6522via.h"
#include "machine/mc6852.h"
-#include "machine/pit8253.h"
#include "machine/pic8259.h"
+#include "machine/pit8253.h"
#include "machine/ram.h"
#include "machine/rescap.h"
-#include "victor9k_kb.h"
-#include "victor9k_fdc.h"
#include "machine/z80sio.h"
-#include "sound/hc55516.h"
#include "sound/flt_biquad.h"
+#include "sound/hc55516.h"
#include "video/mc6845.h"
+
#include "emupal.h"
#include "screen.h"
#include "softlist_dev.h"
#include "speaker.h"
+#include "formats/victor9k_dsk.h"
+
#include <iostream>
//**************************************************************************
@@ -398,8 +402,8 @@ void victor9k_state::ssda_sm_dtr_w(int state)
m_ssda->cts_w(state);
m_ssda->dcd_w(!state);
- /* ___
- * We're supposed to set the ENC/DEC input of the HC55516 to !state,
+ /*
+ * We're supposed to set the _ENC/DEC input of the HC55516 to !state,
* but only playback/decode is currently supported, and that input
* is not implemenented.
*/
diff --git a/src/mame/akai/mpc3000.cpp b/src/mame/akai/mpc3000.cpp
index b2945bb890d..6e38fa00cc2 100644
--- a/src/mame/akai/mpc3000.cpp
+++ b/src/mame/akai/mpc3000.cpp
@@ -295,12 +295,11 @@ void mpc3000_state::mpc3000(machine_config &config)
spc.out_dreq_callback().set(m_maincpu, FUNC(v53a_device::dreq_w<0>));
});
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
L7A1045(config, m_dsp, 16_MHz_XTAL);
- m_dsp->add_route(0, "lspeaker", 1.0);
- m_dsp->add_route(1, "rspeaker", 1.0);
+ m_dsp->add_route(0, "speaker", 1.0, 0);
+ m_dsp->add_route(1, "speaker", 1.0, 1);
}
static INPUT_PORTS_START( mpc3000 )
diff --git a/src/mame/alesis/alesis_a.cpp b/src/mame/alesis/alesis_a.cpp
index bc48b0f234c..5495a71e74c 100644
--- a/src/mame/alesis/alesis_a.cpp
+++ b/src/mame/alesis/alesis_a.cpp
@@ -47,11 +47,9 @@ alesis_dm3ag_device::alesis_dm3ag_device(const machine_config &mconfig, const ch
void alesis_dm3ag_device::device_add_mconfig(machine_config &config)
{
- SPEAKER(config, "lspeaker1").front_left();
- SPEAKER(config, "rspeaker1").front_right();
- SPEAKER(config, "lspeaker2").front_left();
- SPEAKER(config, "rspeaker2").front_right();
- PCM54HP(config, m_dac, 0).add_route(ALL_OUTPUTS, "lspeaker1", 1.0).add_route(ALL_OUTPUTS, "rspeaker1", 1.0); // PCM54HP DAC + R63/R73-75 + Sample and hold
+ SPEAKER(config, "speaker1", 2).front();
+ SPEAKER(config, "speaker2", 2).front();
+ PCM54HP(config, m_dac, 0).add_route(ALL_OUTPUTS, "speaker1", 1.0, 0).add_route(ALL_OUTPUTS, "speaker1", 1.0, 1); // PCM54HP DAC + R63/R73-75 + Sample and hold
}
//-------------------------------------------------
diff --git a/src/mame/alesis/midiverb.cpp b/src/mame/alesis/midiverb.cpp
index 00bf021c651..66dbc5775b0 100644
--- a/src/mame/alesis/midiverb.cpp
+++ b/src/mame/alesis/midiverb.cpp
@@ -37,17 +37,10 @@ MIDI is optional, and can be configured as follows:
./mame -listmidi # List MIDI devices, physical or virtual (e.g. DAWs).
./mame -window midiverb -midiin "{midi device}"
-Audio inputs are emulated using MAME's sample playback mechanism.
-- Create a new directory `midiverb` under the `samples` MAME directory.
-- Copy the .wav files to be used as audio inputs into that directory. Use names:
- left.wav and right.wav for the left and right input respectively. Note that
- MAME does not support stereo .wav files, so they need to be separate. It is
- also fine to just include one of the two files.
-- When the emulation is running, press Space to trigger the processing of those
- files.
-- Look out for any errors, such as unsupported file format.
-- If there is distortion or crackling, adjust INPUT LEVEL (in the Slider
- Controls menu).
+Audio inputs are emulated using MAME's audio input capabilities.
+
+- Select your input through the audio mixer menu. You can adjust level there too.
+
- Use the "DRY/WET MIX" Slider Control to adjust the wet/dry ratio.
*/
@@ -60,7 +53,6 @@ Audio inputs are emulated using MAME's sample playback mechanism.
#include "sound/flt_biquad.h"
#include "sound/flt_rc.h"
#include "sound/mixer.h"
-#include "sound/samples.h"
#include "video/pwm.h"
#include "speaker.h"
@@ -85,7 +77,7 @@ public:
protected:
void device_start() override ATTR_COLD;
- void sound_stream_update(sound_stream &stream, const std::vector<read_stream_view> &inputs, std::vector<write_stream_view> &outputs) override;
+ void sound_stream_update(sound_stream &stream) override;
private:
u16 analog_to_digital(float sample) const;
@@ -147,20 +139,14 @@ void midiverb_dsp_device::device_start()
LOGMASKED(LOG_DSP_EXECUTION, __VA_ARGS__); \
} while(0)
-void midiverb_dsp_device::sound_stream_update(sound_stream &stream, const std::vector<read_stream_view> &inputs, std::vector<write_stream_view> &outputs)
+void midiverb_dsp_device::sound_stream_update(sound_stream &stream)
{
static constexpr const u8 MAX_PC = 0x7f;
static constexpr const int DEBUG_SAMPLES = 2;
static constexpr const char* const OP_NAME[4] =
{ "ADDHF", "LDHF ", "STPOS", "STNEG" };
- assert(inputs.size() == 1);
- assert(outputs.size() == 2);
-
- const read_stream_view &in = inputs[0];
- write_stream_view &left = outputs[0];
- write_stream_view &right = outputs[1];
- const int n = in.samples();
+ const int n = stream.samples();
const u16 rom_base = u16(m_program) << 8;
for (int sample_i = 0; sample_i < n; ++sample_i)
@@ -200,7 +186,7 @@ void midiverb_dsp_device::sound_stream_update(sound_stream &stream, const std::v
int num_bus_writes = 0;
if (mode_rc0)
{
- bus_value = analog_to_digital(in.get(sample_i));
+ bus_value = analog_to_digital(stream.get(0, sample_i));
++num_bus_writes;
}
if (rd_r0)
@@ -229,9 +215,9 @@ void midiverb_dsp_device::sound_stream_update(sound_stream &stream, const std::v
if (ld_dac)
{
if (dac_left)
- left.put(sample_i, digital_to_analog(bus_value));
+ stream.put(0, sample_i, digital_to_analog(bus_value));
else
- right.put(sample_i, digital_to_analog(bus_value));
+ stream.put(1, sample_i, digital_to_analog(bus_value));
}
if (clear_acc)
@@ -305,7 +291,6 @@ public:
, m_digit_device(*this, "pwm_digit_device")
, m_digit_out(*this, "digit_%d", 1U)
, m_mix(*this, "mix")
- , m_input_level(*this, "audio_input_level")
, m_audio_in(*this, "audio_input")
, m_dsp(*this, "discrete_dsp")
, m_left_out(*this, "left_mixer_out")
@@ -316,8 +301,6 @@ public:
void midiverb(machine_config &config) ATTR_COLD;
DECLARE_INPUT_CHANGED_MEMBER(mix_changed);
- DECLARE_INPUT_CHANGED_MEMBER(audio_input_play);
- DECLARE_INPUT_CHANGED_MEMBER(audio_input_level);
protected:
void machine_start() override ATTR_COLD;
@@ -331,7 +314,6 @@ private:
void digit_out_update_w(offs_t offset, u8 data);
void update_mix();
- void update_audio_input_level();
void program_map(address_map &map) ATTR_COLD;
void external_memory_map(address_map &map) ATTR_COLD;
@@ -341,8 +323,7 @@ private:
required_device<pwm_display_device> m_digit_device;
output_finder<2> m_digit_out; // 2 x MAN4710A (7-seg display), DS1 & DS2.
required_ioport m_mix;
- required_ioport m_input_level;
- required_device<samples_device> m_audio_in;
+ required_device<microphone_device> m_audio_in;
required_device<midiverb_dsp_device> m_dsp;
required_device<mixer_device> m_left_out;
required_device<mixer_device> m_right_out;
@@ -409,13 +390,6 @@ void midiverb_state::update_mix()
m_right_out->set_input_gain(1, wet);
}
-void midiverb_state::update_audio_input_level()
-{
- const float gain = m_input_level->read() / 100.0F;
- m_audio_in->set_output_gain(LEFT_CHANNEL, gain);
- m_audio_in->set_output_gain(RIGHT_CHANNEL, gain);
-}
-
void midiverb_state::program_map(address_map &map)
{
// 2764 ROM has A0-A11 connected to the MCU, and A12 tied high. ROM /OE
@@ -429,26 +403,17 @@ void midiverb_state::external_memory_map(address_map &map)
map(0x0000, 0x0000).mirror(0xffff).w(FUNC(midiverb_state::digit_latch_w));
}
-static const char *const midiverb_sample_names[] =
-{
- "left",
- "right",
- nullptr
-};
-
void midiverb_state::configure_audio(machine_config &config)
{
static constexpr const double SK_R3 = RES_M(999.99);
static constexpr const double SK_R4 = RES_R(0.001);
- // Audio input. Emulated with a "samples" device.
- SAMPLES(config, m_audio_in);
- m_audio_in->set_samples_names(midiverb_sample_names);
- m_audio_in->set_channels(2);
+ // Audio input.
+ MICROPHONE(config, m_audio_in, 2).front();
// According to the user manual, input levels can be up to +6 dBV peak when
// a single input is connected, or 0 dBV when both are connected. 0 dBV
- // means the input voltage can peak at +/- 1.414V. The Samples device
+ // means the input voltage can peak at +/- 1.414V. The microphone device
// returns samples in the range +/- 1. So we can just treat those as
// voltages.
@@ -545,19 +510,18 @@ void midiverb_state::configure_audio(machine_config &config)
// corresponding original (dry) channel, based on the position of a
// user-accessible, dual-gang potentiometer.
MIXER(config, m_left_out);
- left_amp_in.add_route(0, m_left_out, 1.0);
- left_sk_out.add_route(0, m_left_out, 1.0);
+ left_amp_in.add_route(0, m_left_out, 1.0, 0);
+ left_sk_out.add_route(0, m_left_out, 1.0, 1);
MIXER(config, m_right_out);
- right_amp_in.add_route(0, m_right_out, 1.0);
- right_sk_out.add_route(0, m_right_out, 1.0);
+ right_amp_in.add_route(0, m_right_out, 1.0, 0);
+ right_sk_out.add_route(0, m_right_out, 1.0, 1);
// Finally, the signals are attenuated to line level, undoing the ~5x
// amplification at the input.
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
const double output_gain = RES_VOLTAGE_DIVIDER(RES_K(2.4), RES_R(500));
- m_left_out->add_route(ALL_OUTPUTS, "lspeaker", output_gain);
- m_right_out->add_route(ALL_OUTPUTS, "rspeaker", output_gain);
+ m_left_out->add_route(ALL_OUTPUTS, "speaker", output_gain, 0);
+ m_right_out->add_route(ALL_OUTPUTS, "speaker", output_gain, 1);
}
void midiverb_state::machine_start()
@@ -571,7 +535,6 @@ void midiverb_state::machine_start()
void midiverb_state::machine_reset()
{
update_mix();
- update_audio_input_level();
}
void midiverb_state::midiverb(machine_config &config)
@@ -604,19 +567,6 @@ DECLARE_INPUT_CHANGED_MEMBER(midiverb_state::mix_changed)
update_mix();
}
-DECLARE_INPUT_CHANGED_MEMBER(midiverb_state::audio_input_play)
-{
- if (newval == 0)
- return;
- m_audio_in->start(LEFT_CHANNEL, 0);
- m_audio_in->start(RIGHT_CHANNEL, 1);
-}
-
-DECLARE_INPUT_CHANGED_MEMBER(midiverb_state::audio_input_level)
-{
- update_audio_input_level();
-}
-
INPUT_PORTS_START(midiverb)
PORT_START("buttons")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("MIDI CHANNEL") PORT_CODE(KEYCODE_C)
@@ -627,17 +577,6 @@ INPUT_PORTS_START(midiverb)
PORT_START("mix") // MIX potentiometer at the back of the unit.
PORT_ADJUSTER(100, "DRY/WET MIX")
PORT_CHANGED_MEMBER(DEVICE_SELF, FUNC(midiverb_state::mix_changed), 0)
-
- // The following are not controls on the real unit.
- // They control audio input.
-
- PORT_START("audio_input_control")
- PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("PLAY") PORT_CODE(KEYCODE_SPACE)
- PORT_CHANGED_MEMBER(DEVICE_SELF, FUNC(midiverb_state::audio_input_play), 0)
-
- PORT_START("audio_input_level")
- PORT_ADJUSTER(90, "INPUT LEVEL")
- PORT_CHANGED_MEMBER(DEVICE_SELF, FUNC(midiverb_state::audio_input_level), 0)
INPUT_PORTS_END
ROM_START(midiverb)
diff --git a/src/mame/amiga/akiko.cpp b/src/mame/amiga/akiko.cpp
index be5d02c23c2..57f930e95ac 100644
--- a/src/mame/amiga/akiko.cpp
+++ b/src/mame/amiga/akiko.cpp
@@ -55,8 +55,8 @@ void akiko_device::device_add_mconfig(machine_config &config)
{
CDROM(config, m_cdrom).set_interface("cdrom");
CDDA(config, m_cdda);
- m_cdda->add_route(0, ":lspeaker", 0.50);
- m_cdda->add_route(1, ":rspeaker", 0.50);
+ m_cdda->add_route(0, ":speaker", 0.50, 0);
+ m_cdda->add_route(1, ":speaker", 0.50, 1);
m_cdda->set_cdrom_tag(m_cdrom);
}
diff --git a/src/mame/amiga/alg.cpp b/src/mame/amiga/alg.cpp
index cc9cfb843ea..ca0f625402e 100644
--- a/src/mame/amiga/alg.cpp
+++ b/src/mame/amiga/alg.cpp
@@ -356,19 +356,18 @@ void alg_state::alg_r1(machine_config &config)
MCFG_VIDEO_START_OVERRIDE(alg_state,alg)
// Sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
PAULA_8364(config, m_paula, amiga_state::CLK_C1_NTSC);
- m_paula->add_route(0, "lspeaker", 0.25);
- m_paula->add_route(1, "rspeaker", 0.25);
- m_paula->add_route(2, "rspeaker", 0.25);
- m_paula->add_route(3, "lspeaker", 0.25);
+ m_paula->add_route(0, "speaker", 0.25, 0);
+ m_paula->add_route(1, "speaker", 0.25, 1);
+ m_paula->add_route(2, "speaker", 0.25, 1);
+ m_paula->add_route(3, "speaker", 0.25, 0);
m_paula->mem_read_cb().set(FUNC(amiga_state::chip_ram_r));
m_paula->int_cb().set(FUNC(amiga_state::paula_int_w));
- m_laserdisc->add_route(0, "lspeaker", 1.0);
- m_laserdisc->add_route(1, "rspeaker", 1.0);
+ m_laserdisc->add_route(0, "speaker", 1.0, 0);
+ m_laserdisc->add_route(1, "speaker", 1.0, 1);
// cia
MOS8520(config, m_cia_0, amiga_state::CLK_E_NTSC);
diff --git a/src/mame/amiga/amiga.cpp b/src/mame/amiga/amiga.cpp
index ac82186d1bf..350aabe92cb 100644
--- a/src/mame/amiga/amiga.cpp
+++ b/src/mame/amiga/amiga.cpp
@@ -1725,13 +1725,12 @@ void amiga_state::amiga_base(machine_config &config)
m_cia_1->pb_wr_callback().set(m_fdc, FUNC(paula_fdc_device::ciaaprb_w));
// audio
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
PAULA_8364(config, m_paula, amiga_state::CLK_C1_PAL);
- m_paula->add_route(0, "lspeaker", 0.50);
- m_paula->add_route(1, "rspeaker", 0.50);
- m_paula->add_route(2, "rspeaker", 0.50);
- m_paula->add_route(3, "lspeaker", 0.50);
+ m_paula->add_route(0, "speaker", 0.50, 0);
+ m_paula->add_route(1, "speaker", 0.50, 1);
+ m_paula->add_route(2, "speaker", 0.50, 1);
+ m_paula->add_route(3, "speaker", 0.50, 0);
m_paula->mem_read_cb().set(FUNC(amiga_state::chip_ram_r));
m_paula->int_cb().set(FUNC(amiga_state::paula_int_w));
@@ -1979,8 +1978,8 @@ void cdtv_state::cdtv(machine_config &config)
m_tpi->out_pb_cb().set(FUNC(cdtv_state::tpi_portb_w));
CR511B(config, m_cdrom, 0);
- m_cdrom->add_route(0, "lspeaker", 1.0);
- m_cdrom->add_route(1, "rspeaker", 1.0);
+ m_cdrom->add_route(0, "speaker", 1.0, 0);
+ m_cdrom->add_route(1, "speaker", 1.0, 1);
m_cdrom->scor_cb().set(m_tpi, FUNC(tpi6525_device::i1_w)).invert();
m_cdrom->stch_cb().set(m_tpi, FUNC(tpi6525_device::i2_w)).invert();
m_cdrom->sten_cb().set(m_tpi, FUNC(tpi6525_device::i3_w));
diff --git a/src/mame/amiga/arsystems.cpp b/src/mame/amiga/arsystems.cpp
index d717618fcfa..7385e2773b0 100644
--- a/src/mame/amiga/arsystems.cpp
+++ b/src/mame/amiga/arsystems.cpp
@@ -342,14 +342,13 @@ void arcadia_amiga_state::arcadia(machine_config &config)
MCFG_VIDEO_START_OVERRIDE(arcadia_amiga_state,amiga)
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
PAULA_8364(config, m_paula, amiga_state::CLK_C1_NTSC);
- m_paula->add_route(0, "lspeaker", 0.50);
- m_paula->add_route(1, "rspeaker", 0.50);
- m_paula->add_route(2, "rspeaker", 0.50);
- m_paula->add_route(3, "lspeaker", 0.50);
+ m_paula->add_route(0, "speaker", 0.50, 0);
+ m_paula->add_route(1, "speaker", 0.50, 1);
+ m_paula->add_route(2, "speaker", 0.50, 1);
+ m_paula->add_route(3, "speaker", 0.50, 0);
m_paula->mem_read_cb().set(FUNC(amiga_state::chip_ram_r));
m_paula->int_cb().set(FUNC(amiga_state::paula_int_w));
diff --git a/src/mame/amiga/cubo.cpp b/src/mame/amiga/cubo.cpp
index 5d0cea2dbd8..04b139d030d 100644
--- a/src/mame/amiga/cubo.cpp
+++ b/src/mame/amiga/cubo.cpp
@@ -1133,14 +1133,13 @@ void cubo_state::cubo(machine_config &config)
MCFG_VIDEO_START_OVERRIDE(amiga_state, amiga_aga)
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
PAULA_8364(config, m_paula, amiga_state::CLK_C1_PAL);
- m_paula->add_route(0, "lspeaker", 0.25);
- m_paula->add_route(1, "rspeaker", 0.25);
- m_paula->add_route(2, "rspeaker", 0.25);
- m_paula->add_route(3, "lspeaker", 0.25);
+ m_paula->add_route(0, "speaker", 0.25, 0);
+ m_paula->add_route(1, "speaker", 0.25, 1);
+ m_paula->add_route(2, "speaker", 0.25, 1);
+ m_paula->add_route(3, "speaker", 0.25, 0);
m_paula->mem_read_cb().set(FUNC(amiga_state::chip_ram_r));
m_paula->int_cb().set(FUNC(amiga_state::paula_int_w));
diff --git a/src/mame/amiga/mquake.cpp b/src/mame/amiga/mquake.cpp
index 6b1f5815a25..880640b2f35 100644
--- a/src/mame/amiga/mquake.cpp
+++ b/src/mame/amiga/mquake.cpp
@@ -339,22 +339,21 @@ void mquake_state::mquake(machine_config &config)
MCFG_VIDEO_START_OVERRIDE(mquake_state,amiga)
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
PAULA_8364(config, m_paula, amiga_state::CLK_C1_NTSC);
- m_paula->add_route(0, "lspeaker", 0.50);
- m_paula->add_route(1, "rspeaker", 0.50);
- m_paula->add_route(2, "rspeaker", 0.50);
- m_paula->add_route(3, "lspeaker", 0.50);
+ m_paula->add_route(0, "speaker", 0.50, 0);
+ m_paula->add_route(1, "speaker", 0.50, 1);
+ m_paula->add_route(2, "speaker", 0.50, 1);
+ m_paula->add_route(3, "speaker", 0.50, 0);
m_paula->mem_read_cb().set(FUNC(amiga_state::chip_ram_r));
m_paula->int_cb().set(FUNC(amiga_state::paula_int_w));
ES5503(config, m_es5503, amiga_state::CLK_7M_NTSC); /* ES5503 is likely mono due to channel strobe used as bank select */
m_es5503->set_channels(1);
m_es5503->set_addrmap(0, &mquake_state::mquake_es5503_map);
- m_es5503->add_route(0, "lspeaker", 0.50);
- m_es5503->add_route(0, "rspeaker", 0.50);
+ m_es5503->add_route(0, "speaker", 0.50, 0);
+ m_es5503->add_route(0, "speaker", 0.50, 1);
/* cia */
MOS8520(config, m_cia_0, amiga_state::CLK_E_NTSC);
diff --git a/src/mame/amiga/paula.cpp b/src/mame/amiga/paula.cpp
index cd3627157e6..307ffe14ae3 100644
--- a/src/mame/amiga/paula.cpp
+++ b/src/mame/amiga/paula.cpp
@@ -273,7 +273,7 @@ std::string paula_device::print_audio_state()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void paula_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void paula_device::sound_stream_update(sound_stream &stream)
{
int channum, sampoffs = 0;
@@ -284,14 +284,10 @@ void paula_device::sound_stream_update(sound_stream &stream, std::vector<read_st
m_channel[1].dma_enabled =
m_channel[2].dma_enabled =
m_channel[3].dma_enabled = false;
-
- // clear the sample data to 0
- for (channum = 0; channum < 4; channum++)
- outputs[channum].fill(0);
return;
}
- int samples = outputs[0].samples() * CLOCK_DIVIDER;
+ int samples = stream.samples() * CLOCK_DIVIDER;
if (LIVE_AUDIO_VIEW)
popmessage(print_audio_state());
@@ -351,7 +347,7 @@ void paula_device::sound_stream_update(sound_stream &stream, std::vector<read_st
// fill the buffer with the sample
for (i = 0; i < ticks; i += CLOCK_DIVIDER)
- outputs[channum].put_int_clamp((sampoffs + i) / CLOCK_DIVIDER, sample, 32768);
+ stream.put_int_clamp(channum, (sampoffs + i) / CLOCK_DIVIDER, sample, 32768);
// account for the ticks; if we hit 0, advance
chan->curticks -= ticks;
diff --git a/src/mame/amiga/paula.h b/src/mame/amiga/paula.h
index f5d822e70a4..62461ba27b4 100644
--- a/src/mame/amiga/paula.h
+++ b/src/mame/amiga/paula.h
@@ -65,7 +65,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;
private:
template <u8 ch> void audxlch_w(u16 data);
diff --git a/src/mame/amiga/upscope.cpp b/src/mame/amiga/upscope.cpp
index 4caa4f0bc4e..c4c544f4ada 100644
--- a/src/mame/amiga/upscope.cpp
+++ b/src/mame/amiga/upscope.cpp
@@ -288,14 +288,13 @@ void upscope_state::upscope(machine_config &config)
MCFG_VIDEO_START_OVERRIDE(upscope_state,amiga)
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
PAULA_8364(config, m_paula, amiga_state::CLK_C1_NTSC);
- m_paula->add_route(0, "rspeaker", 0.50);
- m_paula->add_route(1, "lspeaker", 0.50);
- m_paula->add_route(2, "lspeaker", 0.50);
- m_paula->add_route(3, "rspeaker", 0.50);
+ m_paula->add_route(0, "speaker", 0.50, 1);
+ m_paula->add_route(1, "speaker", 0.50, 0);
+ m_paula->add_route(2, "speaker", 0.50, 0);
+ m_paula->add_route(3, "speaker", 0.50, 1);
m_paula->mem_read_cb().set(FUNC(amiga_state::chip_ram_r));
m_paula->int_cb().set(FUNC(amiga_state::paula_int_w));
diff --git a/src/mame/apple/apple2gs.cpp b/src/mame/apple/apple2gs.cpp
index 5ebfceda441..94df9d333ab 100644
--- a/src/mame/apple/apple2gs.cpp
+++ b/src/mame/apple/apple2gs.cpp
@@ -136,7 +136,7 @@ public:
m_a2common(*this, "a2common"),
// m_a2host(*this, "a2host"),
m_gameio(*this, "gameio"),
- m_speaker(*this, "speaker"),
+ m_speaker(*this, "speaker_sound"),
m_upperbank(*this, A2GS_UPPERBANK_TAG),
m_upperaux(*this, A2GS_AUXUPPER_TAG),
m_upper00(*this, A2GS_00UPPER_TAG),
@@ -3833,16 +3833,15 @@ void apple2gs_state::apple2gs(machine_config &config)
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 1.00);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ES5503(config, m_doc, A2GS_7M);
m_doc->set_channels(2);
m_doc->set_addrmap(0, &apple2gs_state::a2gs_es5503_map);
m_doc->irq_func().set(FUNC(apple2gs_state::doc_irq_w));
m_doc->adc_func().set(FUNC(apple2gs_state::doc_adc_read));
// IIgs Tech Node #19 says even channels are right, odd are left, and 80s/90s stereo cards followed that.
- m_doc->add_route(0, "rspeaker", 1.0);
- m_doc->add_route(1, "lspeaker", 1.0);
+ m_doc->add_route(0, "speaker", 1.0, 1);
+ m_doc->add_route(1, "speaker", 1.0, 0);
/* RAM */
RAM(config, m_ram).set_default_size("2M").set_extra_options("1M,3M,4M,5M,6M,7M,8M").set_default_value(0x00);
diff --git a/src/mame/apple/awacs_macrisc.cpp b/src/mame/apple/awacs_macrisc.cpp
index f40c8e11013..4e4735180fa 100644
--- a/src/mame/apple/awacs_macrisc.cpp
+++ b/src/mame/apple/awacs_macrisc.cpp
@@ -92,7 +92,7 @@ void screamer_device::device_reset()
// our sound stream
//-------------------------------------------------
-void awacs_macrisc_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void awacs_macrisc_device::sound_stream_update(sound_stream &stream)
{
// if we're active and not muted
if ((m_active & ACTIVE_OUT) && !(m_registers[1] & REGISTER_1_MUTE))
@@ -106,13 +106,13 @@ void awacs_macrisc_device::sound_stream_update(sound_stream &stream, std::vector
const s32 left = ((s32)l_raw * atten_L) >> 4;
const s32 right = ((s32)r_raw * atten_R) >> 4;
- outputs[0].put_int(0, left, 32768);
- outputs[1].put_int(0, right, 32768);
+ stream.put_int(0, 0, left, 32768);
+ stream.put_int(1, 0, right, 32768);
}
else
{
- outputs[0].put_int(0, 0, 32768);
- outputs[1].put_int(0, 0, 32768);
+ stream.put_int(0, 0, 0, 32768);
+ stream.put_int(1, 0, 0, 32768);
}
m_phase = (m_phase + 1) & 0xfff;
diff --git a/src/mame/apple/awacs_macrisc.h b/src/mame/apple/awacs_macrisc.h
index 02e3109f848..21aec3c188a 100644
--- a/src/mame/apple/awacs_macrisc.h
+++ b/src/mame/apple/awacs_macrisc.h
@@ -45,7 +45,7 @@ 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;
devcb_read32 m_output_cb;
devcb_write32 m_input_cb;
diff --git a/src/mame/apple/burgundy.cpp b/src/mame/apple/burgundy.cpp
index 2865b9e5574..995e64bae93 100644
--- a/src/mame/apple/burgundy.cpp
+++ b/src/mame/apple/burgundy.cpp
@@ -74,7 +74,7 @@ void burgundy_device::device_reset()
// our sound stream
//-------------------------------------------------
-void burgundy_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void burgundy_device::sound_stream_update(sound_stream &stream)
{
if (m_codec_status & CODEC_BUSY)
{
@@ -88,13 +88,13 @@ void burgundy_device::sound_stream_update(sound_stream &stream, std::vector<read
const u32 data = swapendian_int32(m_output_cb(m_phase));
const s16 left = data >> 16;
const s16 right = data;
- outputs[0].put_int(0, left, 32768);
- outputs[1].put_int(0, right, 32768);
+ stream.put_int(0, 0, left, 32768);
+ stream.put_int(1, 0, right, 32768);
}
else
{
- outputs[0].put_int(0, 0, 32768);
- outputs[1].put_int(0, 0, 32768);
+ stream.put_int(0, 0, 0, 32768);
+ stream.put_int(1, 0, 0, 32768);
}
m_phase = (m_phase + 1) & 0xfff;
diff --git a/src/mame/apple/burgundy.h b/src/mame/apple/burgundy.h
index 69950fc952a..f46065a8d25 100644
--- a/src/mame/apple/burgundy.h
+++ b/src/mame/apple/burgundy.h
@@ -41,7 +41,7 @@ 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;
devcb_read32 m_output_cb;
devcb_write32 m_input_cb;
diff --git a/src/mame/apple/dfac.cpp b/src/mame/apple/dfac.cpp
index 38e0c893350..95e6443c607 100644
--- a/src/mame/apple/dfac.cpp
+++ b/src/mame/apple/dfac.cpp
@@ -122,25 +122,19 @@ void dfac_device::device_start()
save_item(NAME(m_settings_byte));
}
-void dfac_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void dfac_device::sound_stream_update(sound_stream &stream)
{
if (BIT(m_settings_byte, 1)) // LPF In can go through to Amp Out
{
- for (int i = 0; i < inputs[0].samples(); i++)
- {
- stream_buffer::sample_t l = inputs[0].get(i);
- stream_buffer::sample_t r = inputs[1].get(i);
- outputs[0].put(i, l * atten_table[m_settings_byte >> 5]);
- outputs[1].put(i, r * atten_table[m_settings_byte >> 5]);
- }
+ sound_stream::sample_t l = stream.get(0, 0);
+ sound_stream::sample_t r = stream.get(1, 0);
+ stream.put(0, 0, l * atten_table[m_settings_byte >> 5]);
+ stream.put(1, 0, r * atten_table[m_settings_byte >> 5]);
}
else
{
- for (int i = 0; i < inputs[0].samples(); i++)
- {
- outputs[0].put(i, 0.0);
- outputs[1].put(i, 0.0);
- }
+ stream.put(0, 0, 0.0);
+ stream.put(1, 0, 0.0);
}
}
diff --git a/src/mame/apple/dfac.h b/src/mame/apple/dfac.h
index 7936f04e57b..e34fca0d765 100644
--- a/src/mame/apple/dfac.h
+++ b/src/mame/apple/dfac.h
@@ -21,7 +21,7 @@ protected:
// device_r overrides
virtual void device_start() override ATTR_COLD;
// device_sound_interface 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;
private:
sound_stream *m_stream;
diff --git a/src/mame/apple/f108.cpp b/src/mame/apple/f108.cpp
index a7df93e9a99..01b8e914d6d 100644
--- a/src/mame/apple/f108.cpp
+++ b/src/mame/apple/f108.cpp
@@ -59,8 +59,8 @@ void f108_device::device_add_mconfig(machine_config &config)
NSCSI_CONNECTOR(config, "scsi:3").option_set("cdrom", NSCSI_CDROM_APPLE).machine_config(
[](device_t *device)
{
- device->subdevice<cdda_device>("cdda")->add_route(0, "^^^primetimeii:lspeaker", 1.0);
- device->subdevice<cdda_device>("cdda")->add_route(1, "^^^primetimeii:rspeaker", 1.0);
+ device->subdevice<cdda_device>("cdda")->add_route(0, "^^^primetimeii:speaker", 1.0, 0);
+ device->subdevice<cdda_device>("cdda")->add_route(1, "^^^primetimeii:speaker", 1.0, 1);
});
NSCSI_CONNECTOR(config, "scsi:4", mac_scsi_devices, nullptr);
NSCSI_CONNECTOR(config, "scsi:5", mac_scsi_devices, nullptr);
diff --git a/src/mame/apple/imacg3.cpp b/src/mame/apple/imacg3.cpp
index bd941ee170b..caeda269d54 100644
--- a/src/mame/apple/imacg3.cpp
+++ b/src/mame/apple/imacg3.cpp
@@ -213,10 +213,9 @@ void imac_state::imac(machine_config &config)
paddington.codec_r_callback().set(burgundy, FUNC(burgundy_device::read_macrisc));
paddington.codec_w_callback().set(burgundy, FUNC(burgundy_device::write_macrisc));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
- burgundy.add_route(0, "lspeaker", 1.0);
- burgundy.add_route(1, "rspeaker", 1.0);
+ SPEAKER(config, "speaker", 2).front();
+ burgundy.add_route(0, "speaker", 1.0, 0);
+ burgundy.add_route(1, "speaker", 1.0, 1);
}
ROM_START(imac)
diff --git a/src/mame/apple/iosb.cpp b/src/mame/apple/iosb.cpp
index 8a8a226067c..2b636a299fe 100644
--- a/src/mame/apple/iosb.cpp
+++ b/src/mame/apple/iosb.cpp
@@ -84,11 +84,10 @@ void iosb_base::device_add_mconfig(machine_config &config)
m_via2->writepb_handler().set(FUNC(iosb_base::via2_out_b));
m_via2->irq_handler().set(FUNC(iosb_base::via2_irq));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ASC(config, m_asc, C15M, asc_device::asc_type::SONORA);
- m_asc->add_route(0, "lspeaker", 1.0);
- m_asc->add_route(1, "rspeaker", 1.0);
+ m_asc->add_route(0, "speaker", 1.0, 0);
+ m_asc->add_route(1, "speaker", 1.0, 1);
m_asc->irqf_callback().set(FUNC(iosb_base::asc_irq));
SWIM2(config, m_fdc, C15M);
diff --git a/src/mame/apple/mac128.cpp b/src/mame/apple/mac128.cpp
index aecf22610e2..737a6f89849 100644
--- a/src/mame/apple/mac128.cpp
+++ b/src/mame/apple/mac128.cpp
@@ -1169,8 +1169,7 @@ void mac128_state::macplus(machine_config &config)
// SCSI bus and devices
// These machines were strictly external CD-ROMs so sound didn't route back into them; the AppleCD SC had
// RCA jacks for connection to speakers/a stereo.
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speakers", 2).front();
NSCSI_BUS(config, m_scsibus);
NSCSI_CONNECTOR(config, "scsi:0", mac_scsi_devices, nullptr);
@@ -1179,8 +1178,8 @@ void mac128_state::macplus(machine_config &config)
NSCSI_CONNECTOR(config, "scsi:3").option_set("cdrom", NSCSI_CDROM_APPLE).machine_config(
[](device_t *device)
{
- device->subdevice<cdda_device>("cdda")->add_route(0, "^^lspeaker", 1.0);
- device->subdevice<cdda_device>("cdda")->add_route(1, "^^rspeaker", 1.0);
+ device->subdevice<cdda_device>("cdda")->add_route(0, "^^speakers", 1.0, 0);
+ device->subdevice<cdda_device>("cdda")->add_route(1, "^^speakers", 1.0, 1);
});
NSCSI_CONNECTOR(config, "scsi:4", mac_scsi_devices, nullptr);
NSCSI_CONNECTOR(config, "scsi:5", mac_scsi_devices, nullptr);
diff --git a/src/mame/apple/macii.cpp b/src/mame/apple/macii.cpp
index 26131f1c6f1..392c6c2773c 100644
--- a/src/mame/apple/macii.cpp
+++ b/src/mame/apple/macii.cpp
@@ -925,12 +925,11 @@ void macii_state::macii(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &macii_state::macii_map);
m_maincpu->set_dasm_override(std::function(&mac68k_dasm_override), "mac68k_dasm_override");
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ASC(config, m_asc, C15M, asc_device::asc_type::ASC);
m_asc->irqf_callback().set(FUNC(macii_state::mac_asc_irq));
- m_asc->add_route(0, "lspeaker", 1.0);
- m_asc->add_route(1, "rspeaker", 1.0);
+ m_asc->add_route(0, "speaker", 1.0, 0);
+ m_asc->add_route(1, "speaker", 1.0, 1);
RTC3430042(config, m_rtc, XTAL(32'768));
m_rtc->cko_cb().set(m_via1, FUNC(via6522_device::write_ca2));
@@ -963,8 +962,8 @@ void macii_state::macii(machine_config &config)
NSCSI_CONNECTOR(config, "scsi:2", mac_scsi_devices, nullptr);
NSCSI_CONNECTOR(config, "scsi:3").option_set("cdrom", NSCSI_CDROM_APPLE).machine_config([](device_t *device)
{
- device->subdevice<cdda_device>("cdda")->add_route(0, "^^lspeaker", 1.0);
- device->subdevice<cdda_device>("cdda")->add_route(1, "^^rspeaker", 1.0); });
+ device->subdevice<cdda_device>("cdda")->add_route(0, "^^speaker", 1.0, 0);
+ device->subdevice<cdda_device>("cdda")->add_route(1, "^^speaker", 1.0, 1); });
NSCSI_CONNECTOR(config, "scsi:4", mac_scsi_devices, nullptr);
NSCSI_CONNECTOR(config, "scsi:5", mac_scsi_devices, nullptr);
NSCSI_CONNECTOR(config, "scsi:6", mac_scsi_devices, "harddisk");
diff --git a/src/mame/apple/maciici.cpp b/src/mame/apple/maciici.cpp
index 37c35974307..78491730e1a 100644
--- a/src/mame/apple/maciici.cpp
+++ b/src/mame/apple/maciici.cpp
@@ -545,12 +545,11 @@ void maciici_state::maciixi_base(machine_config &config)
rs232b.dcd_handler().set(m_scc, FUNC(z80scc_device::dcdb_w));
rs232b.cts_handler().set(m_scc, FUNC(z80scc_device::ctsb_w));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ASC(config, m_asc, C15M, asc_device::asc_type::ASC);
m_asc->irqf_callback().set(m_rbv, FUNC(rbv_device::asc_irq_w));
- m_asc->add_route(0, "lspeaker", 1.0);
- m_asc->add_route(1, "rspeaker", 1.0);
+ m_asc->add_route(0, "speaker", 1.0, 0);
+ m_asc->add_route(1, "speaker", 1.0, 1);
R65NC22(config, m_via1, C7M / 10);
m_via1->readpa_handler().set(FUNC(maciici_state::via_in_a));
@@ -567,8 +566,8 @@ void maciici_state::maciixi_base(machine_config &config)
NSCSI_CONNECTOR(config, "scsi:3").option_set("cdrom", NSCSI_CDROM_APPLE).machine_config(
[](device_t *device)
{
- device->subdevice<cdda_device>("cdda")->add_route(0, "^^lspeaker", 1.0);
- device->subdevice<cdda_device>("cdda")->add_route(1, "^^rspeaker", 1.0);
+ device->subdevice<cdda_device>("cdda")->add_route(0, "^^speaker", 1.0, 0);
+ device->subdevice<cdda_device>("cdda")->add_route(1, "^^speaker", 1.0, 1);
});
NSCSI_CONNECTOR(config, "scsi:4", mac_scsi_devices, nullptr);
NSCSI_CONNECTOR(config, "scsi:5", mac_scsi_devices, nullptr);
diff --git a/src/mame/apple/maciifx.cpp b/src/mame/apple/maciifx.cpp
index 04c9eef62a4..a96325156ed 100644
--- a/src/mame/apple/maciifx.cpp
+++ b/src/mame/apple/maciifx.cpp
@@ -449,11 +449,10 @@ void maciifx_state::maciifx(machine_config &config)
m_scsidma->set_maincpu_tag("maincpu");
m_scsidma->write_irq().set(FUNC(maciifx_state::oss_interrupt<9>));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ASC(config, m_asc, C15M, asc_device::asc_type::ASC);
- m_asc->add_route(0, "lspeaker", 1.0);
- m_asc->add_route(1, "rspeaker", 1.0);
+ m_asc->add_route(0, "speaker", 1.0, 0);
+ m_asc->add_route(1, "speaker", 1.0, 1);
m_asc->irqf_callback().set(FUNC(maciifx_state::oss_interrupt<8>));
R65NC22(config, m_via1, C7M / 10);
diff --git a/src/mame/apple/maciivx.cpp b/src/mame/apple/maciivx.cpp
index 2c8699fe7d8..431b838042e 100644
--- a/src/mame/apple/maciivx.cpp
+++ b/src/mame/apple/maciivx.cpp
@@ -320,8 +320,8 @@ void maciivx_state::maciiv_base(machine_config &config)
NSCSI_CONNECTOR(config, "scsi:3").option_set("cdrom", NSCSI_CDROM_APPLE).machine_config(
[](device_t *device)
{
- device->subdevice<cdda_device>("cdda")->add_route(0, "^^lspeaker", 1.0);
- device->subdevice<cdda_device>("cdda")->add_route(1, "^^rspeaker", 1.0);
+ device->subdevice<cdda_device>("cdda")->add_route(0, "^^speaker", 1.0, 0);
+ device->subdevice<cdda_device>("cdda")->add_route(1, "^^speaker", 1.0, 1);
});
NSCSI_CONNECTOR(config, "scsi:4", mac_scsi_devices, nullptr);
NSCSI_CONNECTOR(config, "scsi:5", mac_scsi_devices, nullptr);
@@ -360,19 +360,18 @@ void maciivx_state::maciiv_base(machine_config &config)
rs232b.dcd_handler().set(m_scc, FUNC(z80scc_device::dcdb_w));
rs232b.cts_handler().set(m_scc, FUNC(z80scc_device::ctsb_w));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
APPLE_DFAC(config, m_dfac, 22257);
- m_dfac->add_route(0, "lspeaker", 1.0);
- m_dfac->add_route(1, "rspeaker", 1.0);
+ m_dfac->add_route(0, "speaker", 1.0, 0);
+ m_dfac->add_route(1, "speaker", 1.0, 1);
VASP(config, m_vasp, C15M);
m_vasp->set_maincpu_tag("maincpu");
m_vasp->set_rom_tag("bootrom");
m_vasp->hdsel_callback().set(FUNC(maciivx_state::hdsel_w));
- m_vasp->add_route(0, m_dfac, 1.0);
- m_vasp->add_route(1, m_dfac, 1.0);
+ m_vasp->add_route(0, m_dfac, 1.0, 0);
+ m_vasp->add_route(1, m_dfac, 1.0, 1);
MACADB(config, m_macadb, C15M);
diff --git a/src/mame/apple/maclc.cpp b/src/mame/apple/maclc.cpp
index 422aa1ca682..80b78debe1d 100644
--- a/src/mame/apple/maclc.cpp
+++ b/src/mame/apple/maclc.cpp
@@ -346,8 +346,8 @@ void maclc_state::maclc_base(machine_config &config)
NSCSI_CONNECTOR(config, "scsi:3").option_set("cdrom", NSCSI_CDROM_APPLE).machine_config(
[](device_t *device)
{
- device->subdevice<cdda_device>("cdda")->add_route(0, "^^lspeaker", 1.0);
- device->subdevice<cdda_device>("cdda")->add_route(1, "^^rspeaker", 1.0);
+ device->subdevice<cdda_device>("cdda")->add_route(0, "^^speaker", 1.0, 0);
+ device->subdevice<cdda_device>("cdda")->add_route(1, "^^speaker", 1.0, 1);
});
NSCSI_CONNECTOR(config, "scsi:4", mac_scsi_devices, nullptr);
NSCSI_CONNECTOR(config, "scsi:5", mac_scsi_devices, nullptr);
@@ -386,20 +386,19 @@ void maclc_state::maclc_base(machine_config &config)
rs232b.dcd_handler().set(m_scc, FUNC(z80scc_device::dcdb_w));
rs232b.cts_handler().set(m_scc, FUNC(z80scc_device::ctsb_w));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
APPLE_DFAC(config, m_dfac, 22257);
- m_dfac->add_route(0, "lspeaker", 1.0);
- m_dfac->add_route(1, "rspeaker", 1.0);
+ m_dfac->add_route(0, "speaker", 1.0, 0);
+ m_dfac->add_route(1, "speaker", 1.0, 1);
V8(config, m_v8, C15M);
m_v8->set_maincpu_tag("maincpu");
m_v8->set_rom_tag("bootrom");
m_v8->hdsel_callback().set(FUNC(maclc_state::hdsel_w));
m_v8->hmmu_enable_callback().set(FUNC(maclc_state::set_hmmu));
- m_v8->add_route(0, m_dfac, 1.0);
- m_v8->add_route(1, m_dfac, 1.0);
+ m_v8->add_route(0, m_dfac, 1.0, 0);
+ m_v8->add_route(1, m_dfac, 1.0, 1);
nubus_device &nubus(NUBUS(config, "pds", 0));
nubus.set_space(m_maincpu, AS_PROGRAM);
@@ -494,8 +493,8 @@ void maclc_state::maccclas(machine_config &config)
m_v8->pb4_callback().set(m_cuda, FUNC(cuda_device::set_byteack));
m_v8->pb5_callback().set(m_cuda, FUNC(cuda_device::set_tip));
m_v8->cb2_callback().set(m_cuda, FUNC(cuda_device::set_via_data));
- m_v8->add_route(0, "lspeaker", 1.0);
- m_v8->add_route(1, "rspeaker", 1.0);
+ m_v8->add_route(0, "speaker", 1.0, 0);
+ m_v8->add_route(1, "speaker", 1.0, 1);
config.device_remove("dfac");
@@ -539,8 +538,8 @@ void maclc_state::mactv(machine_config &config)
m_v8->pb4_callback().set(m_cuda, FUNC(cuda_device::set_byteack));
m_v8->pb5_callback().set(m_cuda, FUNC(cuda_device::set_tip));
m_v8->cb2_callback().set(m_cuda, FUNC(cuda_device::set_via_data));
- m_v8->add_route(0, "lspeaker", 1.0);
- m_v8->add_route(1, "rspeaker", 1.0);
+ m_v8->add_route(0, "speaker", 1.0, 0);
+ m_v8->add_route(1, "speaker", 1.0, 1);
config.device_remove("dfac");
@@ -570,8 +569,8 @@ void maclc_state::macclas2(machine_config &config)
m_v8->pb4_callback().set(m_egret, FUNC(egret_device::set_via_full));
m_v8->pb5_callback().set(m_egret, FUNC(egret_device::set_sys_session));
m_v8->cb2_callback().set(m_egret, FUNC(egret_device::set_via_data));
- m_v8->add_route(0, m_dfac, 1.0);
- m_v8->add_route(1, m_dfac, 1.0);
+ m_v8->add_route(0, m_dfac, 1.0, 0);
+ m_v8->add_route(1, m_dfac, 1.0, 1);
// Classic II doesn't have an LC PDS slot (and its ROM has the Slot Manager disabled)
config.device_remove("pds");
diff --git a/src/mame/apple/maclc3.cpp b/src/mame/apple/maclc3.cpp
index 2c28aaebcae..526dac53659 100644
--- a/src/mame/apple/maclc3.cpp
+++ b/src/mame/apple/maclc3.cpp
@@ -269,8 +269,8 @@ void macvail_state::maclc3_base(machine_config &config)
NSCSI_CONNECTOR(config, "scsi:3").option_set("cdrom", NSCSI_CDROM_APPLE).machine_config(
[](device_t *device)
{
- device->subdevice<cdda_device>("cdda")->add_route(0, "^^lspeaker", 1.0);
- device->subdevice<cdda_device>("cdda")->add_route(1, "^^rspeaker", 1.0);
+ device->subdevice<cdda_device>("cdda")->add_route(0, "^^speaker", 1.0, 0);
+ device->subdevice<cdda_device>("cdda")->add_route(1, "^^speaker", 1.0, 1);
});
NSCSI_CONNECTOR(config, "scsi:4", mac_scsi_devices, nullptr);
NSCSI_CONNECTOR(config, "scsi:5", mac_scsi_devices, nullptr);
@@ -309,12 +309,11 @@ void macvail_state::maclc3_base(machine_config &config)
rs232b.dcd_handler().set(m_scc, FUNC(z80scc_device::dcdb_w));
rs232b.cts_handler().set(m_scc, FUNC(z80scc_device::ctsb_w));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
APPLE_DFAC(config, m_dfac, 22257);
- m_dfac->add_route(0, "lspeaker", 1.0);
- m_dfac->add_route(1, "rspeaker", 1.0);
+ m_dfac->add_route(0, "speaker", 1.0, 0);
+ m_dfac->add_route(1, "speaker", 1.0, 1);
APPLE_OMEGA(config, m_omega, 31.3344_MHz_XTAL);
m_omega->pclock_changed().set(m_sonora, FUNC(sonora_device::pixel_clock_w));
@@ -322,8 +321,8 @@ void macvail_state::maclc3_base(machine_config &config)
SONORA(config, m_sonora, C15M);
m_sonora->set_maincpu_tag("maincpu");
m_sonora->set_rom_tag("bootrom");
- m_sonora->add_route(0, m_dfac, 1.0);
- m_sonora->add_route(1, m_dfac, 1.0);
+ m_sonora->add_route(0, m_dfac, 1.0, 0);
+ m_sonora->add_route(1, m_dfac, 1.0, 1);
nubus_device &nubus(NUBUS(config, "pds", 0));
nubus.set_space(m_maincpu, AS_PROGRAM);
@@ -396,8 +395,8 @@ void macvail_state::maclc520(machine_config &config)
// DFAC only is found in machines with Egret, and not the IIsi
m_sonora->reset_routes();
- m_sonora->add_route(0, "lspeaker", 1.0);
- m_sonora->add_route(1, "rspeaker", 1.0);
+ m_sonora->add_route(0, "speaker", 1.0, 0);
+ m_sonora->add_route(1, "speaker", 1.0, 1);
config.device_remove("dfac");
}
diff --git a/src/mame/apple/macpdm.cpp b/src/mame/apple/macpdm.cpp
index bfe708f806e..46962ebeb12 100644
--- a/src/mame/apple/macpdm.cpp
+++ b/src/mame/apple/macpdm.cpp
@@ -1182,8 +1182,7 @@ void macpdm_state::macpdm(machine_config &config)
m_video->set_PDM();
m_video->screen_vblank().set(FUNC(macpdm_state::vblank_irq));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
AWACS(config, m_awacs, SOUND_CLOCK/2);
m_awacs->irq_out_cb().set(FUNC(macpdm_state::sndo_dma_irq));
@@ -1191,8 +1190,8 @@ void macpdm_state::macpdm(machine_config &config)
m_awacs->dma_output().set(FUNC(macpdm_state::sound_dma_output));
m_awacs->dma_input().set(FUNC(macpdm_state::sound_dma_input));
- m_awacs->add_route(0, "lspeaker", 1.0);
- m_awacs->add_route(1, "rspeaker", 1.0);
+ m_awacs->add_route(0, "speaker", 1.0, 0);
+ m_awacs->add_route(1, "speaker", 1.0, 1);
NSCSI_BUS(config, m_scsibus);
NSCSI_CONNECTOR(config, "scsi:0", default_scsi_devices, "harddisk");
@@ -1201,8 +1200,8 @@ void macpdm_state::macpdm(machine_config &config)
NSCSI_CONNECTOR(config, "scsi:3").option_set("cdrom", NSCSI_CDROM_APPLE).machine_config(
[](device_t *device)
{
- device->subdevice<cdda_device>("cdda")->add_route(0, "^^lspeaker", 1.0);
- device->subdevice<cdda_device>("cdda")->add_route(1, "^^rspeaker", 1.0);
+ device->subdevice<cdda_device>("cdda")->add_route(0, "^^speaker", 1.0, 0);
+ device->subdevice<cdda_device>("cdda")->add_route(1, "^^speaker", 1.0, 1);
});
NSCSI_CONNECTOR(config, "scsi:4", default_scsi_devices, nullptr);
NSCSI_CONNECTOR(config, "scsi:5", default_scsi_devices, nullptr);
diff --git a/src/mame/apple/macprtb.cpp b/src/mame/apple/macprtb.cpp
index 0e9d8264268..26257de402c 100644
--- a/src/mame/apple/macprtb.cpp
+++ b/src/mame/apple/macprtb.cpp
@@ -754,8 +754,8 @@ void macportable_state::macprtb(machine_config &config)
NSCSI_CONNECTOR(config, "scsi:3").option_set("cdrom", NSCSI_CDROM_APPLE).machine_config(
[](device_t *device)
{
- device->subdevice<cdda_device>("cdda")->add_route(0, "^^lspeaker", 1.0);
- device->subdevice<cdda_device>("cdda")->add_route(1, "^^rspeaker", 1.0);
+ device->subdevice<cdda_device>("cdda")->add_route(0, "^^speaker", 1.0, 0);
+ device->subdevice<cdda_device>("cdda")->add_route(1, "^^speaker", 1.0, 1);
});
NSCSI_CONNECTOR(config, "scsi:4", mac_scsi_devices, nullptr);
NSCSI_CONNECTOR(config, "scsi:5", mac_scsi_devices, nullptr);
@@ -785,12 +785,11 @@ void macportable_state::macprtb(machine_config &config)
m_via1->writepb_handler().set(FUNC(macportable_state::via_out_b));
m_via1->irq_handler().set(FUNC(macportable_state::via_irq_w));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ASC(config, m_asc, 15.6672_MHz_XTAL, asc_device::asc_type::ASC);
m_asc->irqf_callback().set(FUNC(macportable_state::asc_irq_w));
- m_asc->add_route(0, "lspeaker", 1.0);
- m_asc->add_route(1, "rspeaker", 1.0);
+ m_asc->add_route(0, "speaker", 1.0, 0);
+ m_asc->add_route(1, "speaker", 1.0, 1);
RAM(config, m_ram);
m_ram->set_default_size("1M");
diff --git a/src/mame/apple/macpwrbk030.cpp b/src/mame/apple/macpwrbk030.cpp
index 1c387b29e74..19c891c24d0 100644
--- a/src/mame/apple/macpwrbk030.cpp
+++ b/src/mame/apple/macpwrbk030.cpp
@@ -1282,8 +1282,8 @@ void macpb030_state::macpb140(machine_config &config)
NSCSI_CONNECTOR(config, "scsi:3").option_set("cdrom", NSCSI_CDROM_APPLE).machine_config(
[](device_t *device)
{
- device->subdevice<cdda_device>("cdda")->add_route(0, "^^lspeaker", 1.0);
- device->subdevice<cdda_device>("cdda")->add_route(1, "^^rspeaker", 1.0);
+ device->subdevice<cdda_device>("cdda")->add_route(0, "^^speaker", 1.0, 0);
+ device->subdevice<cdda_device>("cdda")->add_route(1, "^^speaker", 1.0, 1);
});
NSCSI_CONNECTOR(config, "scsi:4", mac_scsi_devices, nullptr);
NSCSI_CONNECTOR(config, "scsi:5", mac_scsi_devices, nullptr);
@@ -1319,12 +1319,11 @@ void macpb030_state::macpb140(machine_config &config)
m_pseudovia->writepb_handler().set(FUNC(macpb030_state::via2_out_b));
m_pseudovia->irq_callback().set(FUNC(macpb030_state::via2_irq_w));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ASC(config, m_asc, 22.5792_MHz_XTAL, asc_device::asc_type::EASC);
m_asc->irqf_callback().set(m_pseudovia, FUNC(pseudovia_device::asc_irq_w));
- m_asc->add_route(0, "lspeaker", 1.0);
- m_asc->add_route(1, "rspeaker", 1.0);
+ m_asc->add_route(0, "speaker", 1.0, 0);
+ m_asc->add_route(1, "speaker", 1.0, 1);
RAM(config, m_ram);
m_ram->set_default_size("2M");
diff --git a/src/mame/apple/macpwrbkmsc.cpp b/src/mame/apple/macpwrbkmsc.cpp
index 6c0a4d104e9..8b1f0db967b 100644
--- a/src/mame/apple/macpwrbkmsc.cpp
+++ b/src/mame/apple/macpwrbkmsc.cpp
@@ -798,14 +798,14 @@ void macpbmsc_state::macpd210(machine_config &config)
m_msc->set_pmu_tag("pge");
m_msc->set_rom_tag("bootrom");
m_msc->set_cpu_clock(25_MHz_XTAL);
- m_msc->add_route(0, m_dfac, 1.0);
- m_msc->add_route(1, m_dfac, 1.0);
+ m_msc->add_route(0, m_dfac, 1.0, 0);
+ m_msc->add_route(1, m_dfac, 1.0, 1);
m_msc->cb2_callback().set(m_pmu, FUNC(m68hc05pge_device::spi_miso_w));
m_msc->vbl_callback().set(FUNC(macpbmsc_state::vbl_w));
APPLE_DFAC(config, m_dfac, 22257);
- m_dfac->add_route(0, "lspeaker", 1.0);
- m_dfac->add_route(1, "rspeaker", 1.0);
+ m_dfac->add_route(0, "speaker", 1.0, 0);
+ m_dfac->add_route(1, "speaker", 1.0, 1);
GSC(config, m_gsc, 31.3344_MHz_XTAL);
m_gsc->set_panel_id(6);
@@ -817,8 +817,8 @@ void macpbmsc_state::macpd210(machine_config &config)
NSCSI_CONNECTOR(config, "scsi:3").option_set("cdrom", NSCSI_CDROM_APPLE).machine_config(
[](device_t *device)
{
- device->subdevice<cdda_device>("cdda")->add_route(0, "^^lspeaker", 1.0);
- device->subdevice<cdda_device>("cdda")->add_route(1, "^^rspeaker", 1.0);
+ device->subdevice<cdda_device>("cdda")->add_route(0, "^^speaker", 1.0, 0);
+ device->subdevice<cdda_device>("cdda")->add_route(1, "^^speaker", 1.0, 1);
});
NSCSI_CONNECTOR(config, "scsi:4", mac_scsi_devices, nullptr);
NSCSI_CONNECTOR(config, "scsi:5", mac_scsi_devices, nullptr);
@@ -842,8 +842,7 @@ void macpbmsc_state::macpd210(machine_config &config)
DS2401(config, m_battserial, 0); // actually DS2400, but 2400/2401 are compatible
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
RAM(config, m_ram);
m_ram->set_default_size("4M");
diff --git a/src/mame/apple/macquadra605.cpp b/src/mame/apple/macquadra605.cpp
index 5dd7526e24b..609b18aaa2d 100644
--- a/src/mame/apple/macquadra605.cpp
+++ b/src/mame/apple/macquadra605.cpp
@@ -189,8 +189,8 @@ void quadra605_state::macqd605(machine_config &config)
NSCSI_CONNECTOR(config, "scsi:3").option_set("cdrom", NSCSI_CDROM_APPLE).machine_config(
[](device_t *device)
{
- device->subdevice<cdda_device>("cdda")->add_route(0, "^^primetime:lspeaker", 1.0);
- device->subdevice<cdda_device>("cdda")->add_route(1, "^^primetime:rspeaker", 1.0);
+ device->subdevice<cdda_device>("cdda")->add_route(0, "^^primetime:speaker", 1.0, 0);
+ device->subdevice<cdda_device>("cdda")->add_route(1, "^^primetime:speaker", 1.0, 1);
});
NSCSI_CONNECTOR(config, "scsi:4", mac_scsi_devices, nullptr);
NSCSI_CONNECTOR(config, "scsi:5", mac_scsi_devices, nullptr);
diff --git a/src/mame/apple/macquadra700.cpp b/src/mame/apple/macquadra700.cpp
index a18c140fb1a..98d63d3804b 100644
--- a/src/mame/apple/macquadra700.cpp
+++ b/src/mame/apple/macquadra700.cpp
@@ -759,8 +759,8 @@ void eclipse_state::via2_out_b_q900(u8 data)
NSCSI_CONNECTOR(config, "scsi:2", mac_scsi_devices, nullptr);
NSCSI_CONNECTOR(config, "scsi:3").option_set("cdrom", NSCSI_CDROM_APPLE).machine_config([](device_t *device)
{
- device->subdevice<cdda_device>("cdda")->add_route(0, "^^lspeaker", 1.0);
- device->subdevice<cdda_device>("cdda")->add_route(1, "^^rspeaker", 1.0); });
+ device->subdevice<cdda_device>("cdda")->add_route(0, "^^speaker", 1.0, 0);
+ device->subdevice<cdda_device>("cdda")->add_route(1, "^^speaker", 1.0, 1); });
NSCSI_CONNECTOR(config, "scsi:4", mac_scsi_devices, nullptr);
NSCSI_CONNECTOR(config, "scsi:5", mac_scsi_devices, nullptr);
NSCSI_CONNECTOR(config, "scsi:6", mac_scsi_devices, "harddisk");
@@ -800,12 +800,11 @@ void eclipse_state::via2_out_b_q900(u8 data)
MACADB(config, m_macadb, C15M);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ASC(config, m_easc, 22.5792_MHz_XTAL, asc_device::asc_type::EASC);
m_easc->irqf_callback().set(m_via2, FUNC(via6522_device::write_cb1)).invert();
- m_easc->add_route(0, "lspeaker", 1.0);
- m_easc->add_route(1, "rspeaker", 1.0);
+ m_easc->add_route(0, "speaker", 1.0, 0);
+ m_easc->add_route(1, "speaker", 1.0, 1);
// DFAC is only for audio input on Q700/Q800
APPLE_DFAC(config, m_dfac, 22257);
diff --git a/src/mame/apple/macquadra800.cpp b/src/mame/apple/macquadra800.cpp
index 9e733f77efb..de1be30f6a1 100644
--- a/src/mame/apple/macquadra800.cpp
+++ b/src/mame/apple/macquadra800.cpp
@@ -225,8 +225,8 @@ void quadra800_state::macqd800(machine_config &config)
NSCSI_CONNECTOR(config, "scsi:3").option_set("cdrom", NSCSI_CDROM_APPLE).machine_config(
[](device_t *device)
{
- device->subdevice<cdda_device>("cdda")->add_route(0, "^^iosb:lspeaker", 1.0);
- device->subdevice<cdda_device>("cdda")->add_route(1, "^^iosb:rspeaker", 1.0);
+ device->subdevice<cdda_device>("cdda")->add_route(0, "^^iosb:speaker", 1.0, 0);
+ device->subdevice<cdda_device>("cdda")->add_route(1, "^^iosb:speaker", 1.0, 1);
});
NSCSI_CONNECTOR(config, "scsi:4", mac_scsi_devices, nullptr);
NSCSI_CONNECTOR(config, "scsi:5", mac_scsi_devices, nullptr);
diff --git a/src/mame/apple/msc.cpp b/src/mame/apple/msc.cpp
index b5c9aeff0d3..c0786512767 100644
--- a/src/mame/apple/msc.cpp
+++ b/src/mame/apple/msc.cpp
@@ -63,8 +63,8 @@ void msc_device::device_add_mconfig(machine_config &config)
m_pseudovia->writevideo_handler().set(FUNC(msc_device::msc_config_w));
ASC(config, m_asc, C15M, asc_device::asc_type::EASC);
- m_asc->add_route(0, tag(), 1.0);
- m_asc->add_route(1, tag(), 1.0);
+ m_asc->add_route(0, tag(), 1.0, 0);
+ m_asc->add_route(1, tag(), 1.0, 1);
m_asc->irqf_callback().set(m_pseudovia, FUNC(pseudovia_device::asc_irq_w));
}
@@ -106,7 +106,7 @@ msc_device::msc_device(const machine_config &mconfig, const char *tag, device_t
void msc_device::device_start()
{
- m_stream = stream_alloc(8, 2, m_asc->clock(), STREAM_SYNCHRONOUS);
+ m_stream = stream_alloc(8, 2, 22257, STREAM_SYNCHRONOUS);
m_6015_timer = timer_alloc(FUNC(msc_device::msc_6015_tick), this);
m_6015_timer->adjust(attotime::never);
@@ -160,13 +160,10 @@ void msc_device::device_reset()
space.install_rom(0x00000000, memory_end & ~memory_mirror, memory_mirror, m_rom_ptr);
}
-void msc_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void msc_device::sound_stream_update(sound_stream &stream)
{
- for (int i = 0; i < inputs[0].samples(); i++)
- {
- outputs[0].put(i, inputs[0].get(i));
- outputs[1].put(i, inputs[1].get(i));
- }
+ stream.copy(0, 0);
+ stream.copy(1, 1);
}
u32 msc_device::rom_switch_r(offs_t offset)
diff --git a/src/mame/apple/msc.h b/src/mame/apple/msc.h
index d28d84aeeb4..8c2ce7f3de4 100644
--- a/src/mame/apple/msc.h
+++ b/src/mame/apple/msc.h
@@ -73,7 +73,7 @@ protected:
virtual void device_reset() override ATTR_COLD;
virtual void device_add_mconfig(machine_config &config) 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;
private:
devcb_write_line write_pb4, write_pb5, write_cb2, write_vbl;
diff --git a/src/mame/apple/pippin.cpp b/src/mame/apple/pippin.cpp
index 6f3ba3c2ebf..0337a527844 100644
--- a/src/mame/apple/pippin.cpp
+++ b/src/mame/apple/pippin.cpp
@@ -189,10 +189,9 @@ void pippin_state::pippin(machine_config &config)
grandcentral.codec_r_callback().set(awacs, FUNC(awacs_macrisc_device::read_macrisc));
grandcentral.codec_w_callback().set(awacs, FUNC(awacs_macrisc_device::write_macrisc));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
- awacs.add_route(0, "lspeaker", 1.0);
- awacs.add_route(1, "rspeaker", 1.0);
+ SPEAKER(config, "speaker", 2).front();
+ awacs.add_route(0, "speaker", 1.0, 0);
+ awacs.add_route(1, "speaker", 1.0, 1);
MACADB(config, m_macadb, 15.6672_MHz_XTAL);
diff --git a/src/mame/apple/powermacg3.cpp b/src/mame/apple/powermacg3.cpp
index df7a4596e05..8cda2f4dc9e 100644
--- a/src/mame/apple/powermacg3.cpp
+++ b/src/mame/apple/powermacg3.cpp
@@ -204,10 +204,9 @@ void pwrmacg3_state::pwrmacg3(machine_config &config)
heathrow.codec_r_callback().set(screamer, FUNC(screamer_device::read_macrisc));
heathrow.codec_w_callback().set(screamer, FUNC(screamer_device::write_macrisc));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
- screamer.add_route(0, "lspeaker", 1.0);
- screamer.add_route(1, "rspeaker", 1.0);
+ SPEAKER(config, "speaker", 2).front();
+ screamer.add_route(0, "speaker", 1.0, 0);
+ screamer.add_route(1, "speaker", 1.0, 1);
}
/*
diff --git a/src/mame/apple/scsidma.cpp b/src/mame/apple/scsidma.cpp
index 850e7a39543..a73d1fbf1fa 100644
--- a/src/mame/apple/scsidma.cpp
+++ b/src/mame/apple/scsidma.cpp
@@ -55,8 +55,8 @@ void scsidma_device::device_add_mconfig(machine_config &config)
NSCSI_CONNECTOR(config, "scsi:2", mac_scsi_devices, nullptr);
NSCSI_CONNECTOR(config, "scsi:3").option_set("cdrom", NSCSI_CDROM_APPLE).machine_config([](device_t *device)
{
- device->subdevice<cdda_device>("cdda")->add_route(0, "^^^lspeaker", 1.0);
- device->subdevice<cdda_device>("cdda")->add_route(1, "^^^rspeaker", 1.0);
+ device->subdevice<cdda_device>("cdda")->add_route(0, "^^^speaker", 1.0, 0);
+ device->subdevice<cdda_device>("cdda")->add_route(1, "^^^speaker", 1.0, 1);
});
NSCSI_CONNECTOR(config, "scsi:4", mac_scsi_devices, nullptr);
NSCSI_CONNECTOR(config, "scsi:5", mac_scsi_devices, nullptr);
diff --git a/src/mame/apple/sonora.cpp b/src/mame/apple/sonora.cpp
index 581bef5abb2..7a2b1e9a45c 100644
--- a/src/mame/apple/sonora.cpp
+++ b/src/mame/apple/sonora.cpp
@@ -81,8 +81,8 @@ void sonora_device::device_add_mconfig(machine_config &config)
m_pseudovia->irq_callback().set(FUNC(sonora_device::via2_irq));
ASC(config, m_asc, C15M, asc_device::asc_type::SONORA);
- m_asc->add_route(0, tag(), 1.0);
- m_asc->add_route(1, tag(), 1.0);
+ m_asc->add_route(0, tag(), 1.0, 0);
+ m_asc->add_route(1, tag(), 1.0, 1);
m_asc->irqf_callback().set(m_pseudovia, FUNC(pseudovia_device::asc_irq_w));
SWIM2(config, m_fdc, C15M);
@@ -126,7 +126,7 @@ void sonora_device::device_start()
{
m_vram = std::make_unique<u32[]>(0x100000 / sizeof(u32));
- m_stream = stream_alloc(8, 2, m_asc->clock(), STREAM_SYNCHRONOUS);
+ m_stream = stream_alloc(8, 2, 22257, STREAM_SYNCHRONOUS);
m_6015_timer = timer_alloc(FUNC(sonora_device::mac_6015_tick), this);
m_6015_timer->adjust(attotime::never);
@@ -174,13 +174,10 @@ void sonora_device::device_reset()
space.install_rom(0x00000000, memory_end & ~memory_mirror, memory_mirror, m_rom_ptr);
}
-void sonora_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void sonora_device::sound_stream_update(sound_stream &stream)
{
- for (int i = 0; i < inputs[0].samples(); i++)
- {
- outputs[0].put(i, inputs[0].get(i));
- outputs[1].put(i, inputs[1].get(i));
- }
+ stream.copy(0, 0);
+ stream.copy(1, 1);
}
u32 sonora_device::rom_switch_r(offs_t offset)
@@ -386,6 +383,9 @@ void sonora_device::swim_w(offs_t offset, u16 data, u16 mem_mask)
m_fdc->write((offset >> 8) & 0xf, data & 0xff);
else
m_fdc->write((offset >> 8) & 0xf, data >> 8);
+
+ if (!machine().side_effects_disabled())
+ m_maincpu->adjust_icount(-5);
}
void sonora_device::phases_w(uint8_t phases)
diff --git a/src/mame/apple/sonora.h b/src/mame/apple/sonora.h
index 3634a666f02..c1ab8a9274f 100644
--- a/src/mame/apple/sonora.h
+++ b/src/mame/apple/sonora.h
@@ -54,7 +54,7 @@ protected:
virtual void device_reset() override ATTR_COLD;
virtual void device_add_mconfig(machine_config &config) 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;
private:
devcb_write_line write_pb4, write_pb5, write_cb2;
diff --git a/src/mame/apple/v8.cpp b/src/mame/apple/v8.cpp
index e1a3798e8c9..a979e97bedc 100644
--- a/src/mame/apple/v8.cpp
+++ b/src/mame/apple/v8.cpp
@@ -116,8 +116,8 @@ void v8_device::device_add_mconfig(machine_config &config)
ASC(config, m_asc, C15M, asc_device::asc_type::V8);
m_asc->irqf_callback().set(m_pseudovia, FUNC(pseudovia_device::asc_irq_w));
- m_asc->add_route(0, tag(), 1.0);
- m_asc->add_route(1, tag(), 1.0);
+ m_asc->add_route(0, tag(), 1.0, 0);
+ m_asc->add_route(1, tag(), 1.0, 1);
APPLE_PSEUDOVIA(config, m_pseudovia, C15M);
m_pseudovia->writepb_handler().set(FUNC(v8_device::via2_pb_w));
@@ -169,7 +169,7 @@ void v8_device::device_start()
{
m_vram = std::make_unique<u32[]>(0x100000 / sizeof(u32));
- m_stream = stream_alloc(8, 2, m_asc->clock(), STREAM_SYNCHRONOUS);
+ m_stream = stream_alloc(8, 2, 22257, STREAM_SYNCHRONOUS);
m_6015_timer = timer_alloc(FUNC(v8_device::mac_6015_tick), this);
m_6015_timer->adjust(attotime::never);
@@ -217,13 +217,10 @@ void v8_device::device_reset()
space.install_rom(0x00000000, memory_end & ~memory_mirror, memory_mirror, &m_rom[0]);
}
-void v8_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void v8_device::sound_stream_update(sound_stream &stream)
{
- for (int i = 0; i < inputs[0].samples(); i++)
- {
- outputs[0].put(i, inputs[0].get(i));
- outputs[1].put(i, inputs[1].get(i));
- }
+ stream.copy(0, 0);
+ stream.copy(1, 1);
}
u32 v8_device::rom_switch_r(offs_t offset)
@@ -694,8 +691,8 @@ void eagle_device::device_add_mconfig(machine_config &config)
m_screen->set_raw(15.6672_MHz_XTAL, 704, 0, 512, 370, 0, 342);
ASC(config.replace(), m_asc, C15M, asc_device::asc_type::EAGLE);
- m_asc->add_route(0, tag(), 1.0);
- m_asc->add_route(1, tag(), 1.0);
+ m_asc->add_route(0, tag(), 1.0, 0);
+ m_asc->add_route(1, tag(), 1.0, 1);
m_asc->irqf_callback().set(m_pseudovia, FUNC(pseudovia_device::asc_irq_w));
m_pseudovia->readvideo_handler().set(FUNC(eagle_device::via2_video_config_r));
@@ -769,8 +766,8 @@ void spice_device::device_add_mconfig(machine_config &config)
m_screen->set_raw(15.6672_MHz_XTAL, 640, 0, 512, 407, 0, 384);
ASC(config.replace(), m_asc, C15M, asc_device::asc_type::SONORA);
- m_asc->add_route(0, tag(), 1.0);
- m_asc->add_route(1, tag(), 1.0);
+ m_asc->add_route(0, tag(), 1.0, 0);
+ m_asc->add_route(1, tag(), 1.0, 1);
m_asc->irqf_callback().set(m_pseudovia, FUNC(pseudovia_device::asc_irq_w));
SWIM2(config, m_fdc, C15M);
diff --git a/src/mame/apple/v8.h b/src/mame/apple/v8.h
index 24289c3bbce..3b768cd5e4e 100644
--- a/src/mame/apple/v8.h
+++ b/src/mame/apple/v8.h
@@ -65,7 +65,7 @@ protected:
virtual void device_add_mconfig(machine_config &config) override ATTR_COLD;
virtual ioport_constructor device_input_ports() const 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 void ram_size(u8 config);
diff --git a/src/mame/apple/vasp.cpp b/src/mame/apple/vasp.cpp
index b7277387123..f709ff4bd36 100644
--- a/src/mame/apple/vasp.cpp
+++ b/src/mame/apple/vasp.cpp
@@ -91,8 +91,8 @@ void vasp_device::device_add_mconfig(machine_config &config)
m_pseudovia->irq_callback().set(FUNC(vasp_device::via2_irq));
ASC(config, m_asc, C15M, asc_device::asc_type::VASP);
- m_asc->add_route(0, tag(), 1.0);
- m_asc->add_route(1, tag(), 1.0);
+ m_asc->add_route(0, tag(), 1.0, 0);
+ m_asc->add_route(1, tag(), 1.0, 1);
m_asc->irqf_callback().set(m_pseudovia, FUNC(pseudovia_device::asc_irq_w));
}
@@ -129,7 +129,7 @@ void vasp_device::device_start()
{
m_vram = std::make_unique<u32[]>(0x100000 / sizeof(u32));
- m_stream = stream_alloc(8, 2, m_asc->clock(), STREAM_SYNCHRONOUS);
+ m_stream = stream_alloc(8, 2, 22257, STREAM_SYNCHRONOUS);
m_6015_timer = timer_alloc(FUNC(vasp_device::mac_6015_tick), this);
m_6015_timer->adjust(attotime::never);
@@ -179,13 +179,10 @@ void vasp_device::device_reset()
space.install_rom(0x00000000, memory_end & ~memory_mirror, memory_mirror, m_rom_ptr);
}
-void vasp_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void vasp_device::sound_stream_update(sound_stream &stream)
{
- for (int i = 0; i < inputs[0].samples(); i++)
- {
- outputs[0].put(i, inputs[0].get(i));
- outputs[1].put(i, inputs[1].get(i));
- }
+ stream.copy(0, 0);
+ stream.copy(1, 1);
}
u32 vasp_device::rom_switch_r(offs_t offset)
diff --git a/src/mame/apple/vasp.h b/src/mame/apple/vasp.h
index c5c7727ebe4..13507a6fd2a 100644
--- a/src/mame/apple/vasp.h
+++ b/src/mame/apple/vasp.h
@@ -54,7 +54,7 @@ protected:
virtual void device_add_mconfig(machine_config &config) override ATTR_COLD;
virtual ioport_constructor device_input_ports() const 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;
private:
devcb_write_line write_pb4, write_pb5, write_cb2, write_hdsel;
diff --git a/src/mame/arcadia/arcadia_a.cpp b/src/mame/arcadia/arcadia_a.cpp
index f4498fc18b7..0859d381493 100644
--- a/src/mame/arcadia/arcadia_a.cpp
+++ b/src/mame/arcadia/arcadia_a.cpp
@@ -80,12 +80,9 @@ void arcadia_sound_device::device_reset()
// our sound stream
//-------------------------------------------------
-void arcadia_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void arcadia_sound_device::sound_stream_update(sound_stream &stream)
{
- int i;
- auto &buffer = outputs[0];
-
- for (i = 0; i < buffer.samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
s32 result = 0;
@@ -132,7 +129,7 @@ void arcadia_sound_device::sound_stream_update(sound_stream &stream, std::vector
m_pos = 0;
}
}
- buffer.put_int(i, result, 32768);
+ stream.put_int(0, i, result, 32768);
}
}
diff --git a/src/mame/arcadia/arcadia_a.h b/src/mame/arcadia/arcadia_a.h
index 29f1e42309f..523e6087b43 100644
--- a/src/mame/arcadia/arcadia_a.h
+++ b/src/mame/arcadia/arcadia_a.h
@@ -21,7 +21,7 @@ protected:
// device-level overrides
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;
sound_stream *m_channel = nullptr;
uint8_t m_reg[3]{};
diff --git a/src/mame/atari/atarigt.cpp b/src/mame/atari/atarigt.cpp
index 63fe14900d0..98275fc6fbb 100644
--- a/src/mame/atari/atarigt.cpp
+++ b/src/mame/atari/atarigt.cpp
@@ -902,15 +902,14 @@ void atarigt_state::atarigt_stereo(machine_config &config)
// 3 Channel output directly from CAGE or through motherboard JAMMA output
// based on dedicated cabinet configuration;
// 'universal' kit supports mono and stereo, with/without subwoofer.
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
SPEAKER(config, "subwoofer").front_floor(); // Next to the coin door at dedicated cabinet, just silence for now (not implemented)
// TODO: correct? sound board has only 1 DAC populated.
- m_cage->add_route(0, "rspeaker", 1.0);
- m_cage->add_route(1, "lspeaker", 1.0);
- m_cage->add_route(2, "lspeaker", 1.0);
- m_cage->add_route(3, "rspeaker", 1.0);
+ m_cage->add_route(0, "speaker", 1.0, 1);
+ m_cage->add_route(1, "speaker", 1.0, 0);
+ m_cage->add_route(2, "speaker", 1.0, 0);
+ m_cage->add_route(3, "speaker", 1.0, 1);
m_cage->add_route(4, "subwoofer", 1.0);
}
@@ -925,17 +924,14 @@ void atarigt_state::tmek(machine_config &config)
m_adc->in_callback<7>().set_ioport("AN3");
// 5 Channel output (4 Channel input connected to Quad Amp PCB)
- SPEAKER(config, "flspeaker").front_left();
- SPEAKER(config, "frspeaker").front_right();
- SPEAKER(config, "rlspeaker").headrest_left();
- SPEAKER(config, "rrspeaker").headrest_right();
+ SPEAKER(config, "speaker", 4).front().headrest_left(2).headrest_right(3);
//SPEAKER(config, "subwoofer").seat(); Not implemented, Quad Amp PCB output;
m_cage->set_speedup(0x4fad);
- m_cage->add_route(0, "frspeaker", 1.0); // Foward Right
- m_cage->add_route(1, "rlspeaker", 1.0); // Back Left
- m_cage->add_route(2, "flspeaker", 1.0); // Foward Left
- m_cage->add_route(3, "rrspeaker", 1.0); // Back Right
+ m_cage->add_route(0, "speaker", 1.0, 1); // Foward Right
+ m_cage->add_route(1, "speaker", 1.0, 2); // Back Left
+ m_cage->add_route(2, "speaker", 1.0, 0); // Foward Left
+ m_cage->add_route(3, "speaker", 1.0, 3); // Back Right
}
void atarigt_state::primrage(machine_config &config)
diff --git a/src/mame/atari/atarigx2.cpp b/src/mame/atari/atarigx2.cpp
index 19a001a939b..096b55c9694 100644
--- a/src/mame/atari/atarigx2.cpp
+++ b/src/mame/atari/atarigx2.cpp
@@ -1514,14 +1514,13 @@ void atarigx2_state::atarigx2(machine_config &config)
m_screen->screen_vblank().set_inputline(m_maincpu, M68K_IRQ_4, ASSERT_LINE);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ATARI_JSA_IIIS(config, m_jsa, 0);
m_jsa->main_int_cb().set_inputline(m_maincpu, M68K_IRQ_5);
m_jsa->test_read_cb().set_ioport("SERVICE").bit(6);
- m_jsa->add_route(0, "lspeaker", 0.7);
- m_jsa->add_route(1, "rspeaker", 0.7);
+ m_jsa->add_route(0, "speaker", 0.7, 0);
+ m_jsa->add_route(1, "speaker", 0.7, 1);
}
void atarigx2_state::atarigx2_0x200(machine_config &config)
diff --git a/src/mame/atari/atarijsa.cpp b/src/mame/atari/atarijsa.cpp
index d4908848a4c..2581c7286d0 100644
--- a/src/mame/atari/atarijsa.cpp
+++ b/src/mame/atari/atarijsa.cpp
@@ -234,9 +234,9 @@ INPUT_PORTS_END
// atari_jsa_base_device - constructor
//-------------------------------------------------
-atari_jsa_base_device::atari_jsa_base_device(const machine_config &mconfig, device_type devtype, const char *tag, device_t *owner, uint32_t clock, int channels)
+atari_jsa_base_device::atari_jsa_base_device(const machine_config &mconfig, device_type devtype, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, devtype, tag, owner, clock),
- device_mixer_interface(mconfig, *this, channels),
+ device_mixer_interface(mconfig, *this),
m_soundcomm(*this, "soundcomm"),
m_jsacpu(*this, "cpu"),
m_ym2151(*this, "ym2151"),
@@ -426,8 +426,8 @@ void atari_jsa_base_device::update_sound_irq()
// atari_jsa_oki_base_device: Constructor
//-------------------------------------------------
-atari_jsa_oki_base_device::atari_jsa_oki_base_device(const machine_config &mconfig, device_type devtype, const char *tag, device_t *owner, uint32_t clock, int channels)
- : atari_jsa_base_device(mconfig, devtype, tag, owner, clock, channels),
+atari_jsa_oki_base_device::atari_jsa_oki_base_device(const machine_config &mconfig, device_type devtype, const char *tag, device_t *owner, uint32_t clock)
+ : atari_jsa_base_device(mconfig, devtype, tag, owner, clock),
m_oki1(*this, "oki1"),
m_oki2(*this, "oki2"),
m_oki1_region(*this, "oki1"),
@@ -644,7 +644,7 @@ void atari_jsa_oki_base_device::update_all_volumes()
//-------------------------------------------------
atari_jsa_i_device::atari_jsa_i_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : atari_jsa_base_device(mconfig, ATARI_JSA_I, tag, owner, clock, 2),
+ : atari_jsa_base_device(mconfig, ATARI_JSA_I, tag, owner, clock),
m_pokey(*this, "pokey"),
m_tms5220(*this, "tms"),
m_jsai(*this, "JSAI"),
@@ -799,16 +799,16 @@ void atari_jsa_i_device::device_add_mconfig(machine_config &config)
YM2151(config, m_ym2151, JSA_MASTER_CLOCK);
m_ym2151->irq_handler().set(FUNC(atari_jsa_i_device::ym2151_irq_gen));
m_ym2151->port_write_handler().set(FUNC(atari_jsa_base_device::ym2151_port_w));
- m_ym2151->add_route(0, *this, 0.60, AUTO_ALLOC_INPUT, 0);
- m_ym2151->add_route(1, *this, 0.60, AUTO_ALLOC_INPUT, 1);
+ m_ym2151->add_route(0, *this, 0.60, 0);
+ m_ym2151->add_route(1, *this, 0.60, 1);
POKEY(config, m_pokey, JSA_MASTER_CLOCK/2);
- m_pokey->add_route(ALL_OUTPUTS, *this, 0.40, AUTO_ALLOC_INPUT, 0);
- m_pokey->add_route(ALL_OUTPUTS, *this, 0.40, AUTO_ALLOC_INPUT, 1);
+ m_pokey->add_route(ALL_OUTPUTS, *this, 0.40, 0);
+ m_pokey->add_route(ALL_OUTPUTS, *this, 0.40, 1);
TMS5220C(config, m_tms5220, JSA_MASTER_CLOCK*2/11); // potentially JSA_MASTER_CLOCK/9 as well
- m_tms5220->add_route(ALL_OUTPUTS, *this, 1.0, AUTO_ALLOC_INPUT, 0);
- m_tms5220->add_route(ALL_OUTPUTS, *this, 1.0, AUTO_ALLOC_INPUT, 1);
+ m_tms5220->add_route(ALL_OUTPUTS, *this, 1.0, 0);
+ m_tms5220->add_route(ALL_OUTPUTS, *this, 1.0, 1);
}
@@ -879,7 +879,7 @@ void atari_jsa_i_device::update_all_volumes()
//-------------------------------------------------
atari_jsa_ii_device::atari_jsa_ii_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : atari_jsa_oki_base_device(mconfig, ATARI_JSA_II, tag, owner, clock, 1)
+ : atari_jsa_oki_base_device(mconfig, ATARI_JSA_II, tag, owner, clock)
, m_jsaii(*this, "JSAII")
{
}
@@ -930,10 +930,10 @@ void atari_jsa_ii_device::device_add_mconfig(machine_config &config)
YM2151(config, m_ym2151, JSA_MASTER_CLOCK);
m_ym2151->irq_handler().set(FUNC(atari_jsa_ii_device::ym2151_irq_gen));
m_ym2151->port_write_handler().set(FUNC(atari_jsa_base_device::ym2151_port_w));
- m_ym2151->add_route(ALL_OUTPUTS, *this, 0.60, AUTO_ALLOC_INPUT, 0);
+ m_ym2151->add_route(ALL_OUTPUTS, *this, 0.60, 0);
OKIM6295(config, m_oki1, JSA_MASTER_CLOCK/3, okim6295_device::PIN7_HIGH);
- m_oki1->add_route(ALL_OUTPUTS, *this, 0.75, AUTO_ALLOC_INPUT, 0);
+ m_oki1->add_route(ALL_OUTPUTS, *this, 0.75, 0);
}
@@ -958,12 +958,12 @@ ioport_constructor atari_jsa_ii_device::device_input_ports() const
//-------------------------------------------------
atari_jsa_iii_device::atari_jsa_iii_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : atari_jsa_iii_device(mconfig, ATARI_JSA_III, tag, owner, clock, 1)
+ : atari_jsa_iii_device(mconfig, ATARI_JSA_III, tag, owner, clock)
{
}
-atari_jsa_iii_device::atari_jsa_iii_device(const machine_config &mconfig, device_type devtype, const char *tag, device_t *owner, uint32_t clock, int channels)
- : atari_jsa_oki_base_device(mconfig, devtype, tag, owner, clock, channels)
+atari_jsa_iii_device::atari_jsa_iii_device(const machine_config &mconfig, device_type devtype, const char *tag, device_t *owner, uint32_t clock)
+ : atari_jsa_oki_base_device(mconfig, devtype, tag, owner, clock)
, m_jsaiii(*this, "JSAIII")
{
}
@@ -1013,11 +1013,11 @@ void atari_jsa_iii_device::device_add_mconfig(machine_config &config)
YM2151(config, m_ym2151, JSA_MASTER_CLOCK);
m_ym2151->irq_handler().set(FUNC(atari_jsa_iii_device::ym2151_irq_gen));
m_ym2151->port_write_handler().set(FUNC(atari_jsa_base_device::ym2151_port_w));
- m_ym2151->add_route(ALL_OUTPUTS, *this, 0.60, AUTO_ALLOC_INPUT, 0);
+ m_ym2151->add_route(ALL_OUTPUTS, *this, 0.60, 0);
OKIM6295(config, m_oki1, JSA_MASTER_CLOCK/3, okim6295_device::PIN7_HIGH);
m_oki1->set_addrmap(0, &atari_jsa_iii_device::jsa3_oki1_map);
- m_oki1->add_route(ALL_OUTPUTS, *this, 0.75, AUTO_ALLOC_INPUT, 0);
+ m_oki1->add_route(ALL_OUTPUTS, *this, 0.75, 0);
}
@@ -1042,7 +1042,7 @@ ioport_constructor atari_jsa_iii_device::device_input_ports() const
//-------------------------------------------------
atari_jsa_iiis_device::atari_jsa_iiis_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : atari_jsa_iii_device(mconfig, ATARI_JSA_IIIS, tag, owner, clock, 2)
+ : atari_jsa_iii_device(mconfig, ATARI_JSA_IIIS, tag, owner, clock)
{
}
@@ -1057,10 +1057,10 @@ void atari_jsa_iiis_device::device_add_mconfig(machine_config &config)
atari_jsa_iii_device::device_add_mconfig(config);
m_ym2151->reset_routes();
- m_ym2151->add_route(0, *this, 0.60, AUTO_ALLOC_INPUT, 0);
- m_ym2151->add_route(1, *this, 0.60, AUTO_ALLOC_INPUT, 1);
+ m_ym2151->add_route(0, *this, 0.60, 0);
+ m_ym2151->add_route(1, *this, 0.60, 1);
OKIM6295(config, m_oki2, JSA_MASTER_CLOCK/3, okim6295_device::PIN7_HIGH);
- m_oki2->add_route(ALL_OUTPUTS, *this, 0.75, AUTO_ALLOC_INPUT, 1);
+ m_oki2->add_route(ALL_OUTPUTS, *this, 0.75, 1);
m_oki2->set_addrmap(0, &atari_jsa_iiis_device::jsa3_oki2_map);
}
diff --git a/src/mame/atari/atarijsa.h b/src/mame/atari/atarijsa.h
index fcd77d6b17a..dd3ee742824 100644
--- a/src/mame/atari/atarijsa.h
+++ b/src/mame/atari/atarijsa.h
@@ -54,7 +54,7 @@ class atari_jsa_base_device : public device_t,
{
protected:
// construction/destruction
- atari_jsa_base_device(const machine_config &mconfig, device_type devtype, const char *tag, device_t *owner, uint32_t clock, int channels);
+ atari_jsa_base_device(const machine_config &mconfig, device_type devtype, const char *tag, device_t *owner, uint32_t clock);
public:
// configuration
@@ -125,7 +125,7 @@ class atari_jsa_oki_base_device : public atari_jsa_base_device
{
protected:
// derived construction/destruction
- atari_jsa_oki_base_device(const machine_config &mconfig, device_type devtype, const char *tag, device_t *owner, uint32_t clock, int channels);
+ atari_jsa_oki_base_device(const machine_config &mconfig, device_type devtype, const char *tag, device_t *owner, uint32_t clock);
public:
// read/write handlers
@@ -234,7 +234,7 @@ public:
void jsa3_oki1_map(address_map &map) ATTR_COLD;
protected:
// derived construction/destruction
- atari_jsa_iii_device(const machine_config &mconfig, device_type devtype, const char *tag, device_t *owner, uint32_t clock, int channels);
+ atari_jsa_iii_device(const machine_config &mconfig, device_type devtype, const char *tag, device_t *owner, uint32_t clock);
public:
// read/write handlers
diff --git a/src/mame/atari/atarisac.cpp b/src/mame/atari/atarisac.cpp
index 9a2982774eb..51153208a30 100644
--- a/src/mame/atari/atarisac.cpp
+++ b/src/mame/atari/atarisac.cpp
@@ -95,7 +95,7 @@ INPUT_PORTS_END
//-------------------------------------------------
atari_sac_device::atari_sac_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : atari_jsa_base_device(mconfig, ATARI_SAC, tag, owner, clock, 2)
+ : atari_jsa_base_device(mconfig, ATARI_SAC, tag, owner, clock)
, m_daccpu(*this, "dac")
, m_datin(*this, "datin")
, m_datout(*this, "datout")
@@ -265,12 +265,12 @@ void atari_sac_device::device_add_mconfig(machine_config &config)
YM2151(config, m_ym2151, 14.318181_MHz_XTAL/4);
m_ym2151->irq_handler().set(FUNC(atari_sac_device::ym2151_irq_gen));
m_ym2151->port_write_handler().set(FUNC(atari_sac_device::ym2151_port_w));
- m_ym2151->add_route(0, *this, 0.60, AUTO_ALLOC_INPUT, 0);
- m_ym2151->add_route(1, *this, 0.60, AUTO_ALLOC_INPUT, 1);
+ m_ym2151->add_route(0, *this, 0.60, 0);
+ m_ym2151->add_route(1, *this, 0.60, 1);
// FIXME: there is actually only one DAC (plus some analog switches)
- AM6012(config, m_rdac).add_route(ALL_OUTPUTS, *this, 0.5, AUTO_ALLOC_INPUT, 1); // AM6012.6j
- AM6012(config, m_ldac).add_route(ALL_OUTPUTS, *this, 0.5, AUTO_ALLOC_INPUT, 0); // AM6012.6j
+ AM6012(config, m_rdac).add_route(ALL_OUTPUTS, *this, 0.5, 1); // AM6012.6j
+ AM6012(config, m_ldac).add_route(ALL_OUTPUTS, *this, 0.5, 0); // AM6012.6j
}
diff --git a/src/mame/atari/atarist.cpp b/src/mame/atari/atarist.cpp
index 81470df514c..aabdb5aaaae 100644
--- a/src/mame/atari/atarist.cpp
+++ b/src/mame/atari/atarist.cpp
@@ -9,10 +9,9 @@
#include "stvideo.h"
#include "bus/centronics/ctronics.h"
-#include "bus/generic/slot.h"
-#include "bus/generic/carts.h"
#include "bus/midi/midi.h"
#include "bus/rs232/rs232.h"
+#include "bus/st/stcart.h"
#include "cpu/m68000/m68000.h"
#include "imagedev/floppy.h"
#include "machine/6850acia.h"
@@ -138,7 +137,7 @@ protected:
required_device<mc68901_device> m_mfp;
required_device_array<acia6850_device, 2> m_acia;
required_device<centronics_device> m_centronics;
- required_device<generic_slot_device> m_cart;
+ required_device<stcart_connector> m_cart;
required_device<ram_device> m_ramcfg;
required_device<rs232_port_device> m_rs232;
required_device<ym2149_device> m_ymsnd;
@@ -808,7 +807,6 @@ void st_state::st_super_map(address_map &map)
map(0x000000, 0x000007).rom().region(M68000_TAG, 0);
map(0x000000, 0x000007).before_delay(NAME([](offs_t) { return 64; })).w(m_maincpu, FUNC(m68000_device::berr_w));
map(0x400000, 0xf9ffff).before_delay(NAME([](offs_t) { return 64; })).rw(m_maincpu, FUNC(m68000_device::berr_r), FUNC(m68000_device::berr_w));
- map(0xfa0000, 0xfbffff).noprw(); // mapped by the cartslot
map(0xfc0000, 0xfeffff).rom().region(M68000_TAG, 0);
map(0xfc0000, 0xfeffff).before_delay(NAME([](offs_t) { return 64; })).w(m_maincpu, FUNC(m68000_device::berr_w));
@@ -840,7 +838,6 @@ void st_state::st_user_map(address_map &map)
map.unmap_value_high();
map(0x000000, 0x0007ff).before_delay(NAME([](offs_t) { return 64; })).rw(m_maincpu, FUNC(m68000_device::berr_r), FUNC(m68000_device::berr_w));
map(0x400000, 0xf9ffff).before_delay(NAME([](offs_t) { return 64; })).rw(m_maincpu, FUNC(m68000_device::berr_r), FUNC(m68000_device::berr_w));
- map(0xfa0000, 0xfbffff).noprw(); // mapped by the cartslot
map(0xfc0000, 0xfeffff).rom().region(M68000_TAG, 0).w(m_maincpu, FUNC(m68000_device::berr_w));
map(0xfc0000, 0xfeffff).before_delay(NAME([](offs_t) { return 64; })).w(m_maincpu, FUNC(m68000_device::berr_w));
map(0xff0000, 0xffffff).before_delay(NAME([](offs_t) { return 64; })).rw(m_maincpu, FUNC(m68000_device::berr_r), FUNC(m68000_device::berr_w));
@@ -1220,10 +1217,8 @@ void st_state::machine_start()
{
m_mmu->set_ram_size(m_ramcfg->size());
- if (m_cart->exists()) {
- m_maincpu->space(AS_PROGRAM).install_read_handler(0xfa0000, 0xfbffff, read16s_delegate(*m_cart, FUNC(generic_slot_device::read16_rom)));
- m_maincpu->space(m68000_device::AS_USER_PROGRAM).install_read_handler(0xfa0000, 0xfbffff, read16s_delegate(*m_cart, FUNC(generic_slot_device::read16_rom)));
- }
+ m_cart->map(m_maincpu->space(AS_PROGRAM));
+ m_cart->map(m_maincpu->space(m68000_device::AS_USER_PROGRAM));
/// TODO: get callbacks to trigger these.
m_mfp->i0_w(1);
@@ -1263,8 +1258,8 @@ void ste_state::machine_start()
{
m_mmu->set_ram_size(m_ramcfg->size());
- if (m_cart->exists())
- m_maincpu->space(AS_PROGRAM).install_read_handler(0xfa0000, 0xfbffff, read16s_delegate(*m_cart, FUNC(generic_slot_device::read16_rom)));
+ m_cart->map(m_maincpu->space(AS_PROGRAM));
+ m_cart->map(m_maincpu->space(m68000_device::AS_USER_PROGRAM));
/* allocate timers */
m_dmasound_timer = timer_alloc(FUNC(ste_state::dmasound_tick), this);
@@ -1309,8 +1304,8 @@ void stbook_state::machine_start()
break;
}
- if (m_cart->exists())
- m_maincpu->space(AS_PROGRAM).install_read_handler(0xfa0000, 0xfbffff, read16s_delegate(*m_cart, FUNC(generic_slot_device::read16_rom)));
+ m_cart->map(m_maincpu->space(AS_PROGRAM));
+ m_cart->map(m_maincpu->space(m68000_device::AS_USER_PROGRAM));
/* register for state saving */
ste_state::state_save();
@@ -1415,9 +1410,8 @@ void st_state::common(machine_config &config)
acia_clock.signal_handler().append(m_acia[1], FUNC(acia6850_device::write_rxc));
// cartridge
- GENERIC_CARTSLOT(config, m_cart, generic_linear_slot, "st_cart", "bin,rom");
- m_cart->set_width(GENERIC_ROM16_WIDTH);
- m_cart->set_endian(ENDIANNESS_BIG);
+
+ STCART_CONNECTOR(config, m_cart, stcart_intf, nullptr);
// software lists
SOFTWARE_LIST(config, "flop_list").set_original("st_flop");
@@ -1525,14 +1519,13 @@ void ste_state::ste(machine_config &config)
m_videox->de_callback().set(m_mfp, FUNC(mc68901_device::tbi_w));
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
- m_ymsnd->add_route(0, "lspeaker", 0.50);
- m_ymsnd->add_route(0, "rspeaker", 0.50);
+ SPEAKER(config, "speaker", 2).front();
+ m_ymsnd->add_route(0, "speaker", 0.50, 0);
+ m_ymsnd->add_route(0, "speaker", 0.50, 1);
/*
custom_device &custom_dac(CUSTOM(config, "custom", 0)); // DAC
- custom_dac.add_route(0, "rspeaker", 0.50);
- custom_dac.add_route(1, "lspeaker", 0.50);
+ custom_dac.add_route(0, "speaker", 0.50);
+ custom_dac.add_route(1, "speaker", 0.50);
*/
LMC1992(config, LMC1992_TAG);
diff --git a/src/mame/atari/atarisy1.cpp b/src/mame/atari/atarisy1.cpp
index 6519058bd7d..4800808e6f9 100644
--- a/src/mame/atari/atarisy1.cpp
+++ b/src/mame/atari/atarisy1.cpp
@@ -718,8 +718,8 @@ void atarisy1_state::add_speech(machine_config &config)
m_audiocpu->set_addrmap(AS_PROGRAM, &atarisy1_state::sound_ext_map);
TMS5220C(config, m_tms, 14.318181_MHz_XTAL/2/11);
- m_tms->add_route(ALL_OUTPUTS, "lspeaker", 0.6);
- m_tms->add_route(ALL_OUTPUTS, "rspeaker", 0.6);
+ m_tms->add_route(ALL_OUTPUTS, "speaker", 0.6, 0);
+ m_tms->add_route(ALL_OUTPUTS, "speaker", 0.6, 1);
MOS6522(config, m_via, 14.318181_MHz_XTAL/8);
m_via->readpa_handler().set(m_tms, FUNC(tms5220_device::status_r));
@@ -773,8 +773,7 @@ void atarisy1_state::atarisy1(machine_config &config)
m_screen->screen_vblank().set_inputline(m_maincpu, M68K_IRQ_4, ASSERT_LINE);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, m6502_device::NMI_LINE);
@@ -785,12 +784,12 @@ void atarisy1_state::atarisy1(machine_config &config)
ym2151_device &ymsnd(YM2151(config, "ymsnd", 14.318181_MHz_XTAL/4));
ymsnd.irq_handler().set_inputline(m_audiocpu, m6502_device::IRQ_LINE);
- ymsnd.add_route(0, "lspeaker", 0.48);
- ymsnd.add_route(1, "rspeaker", 0.48);
+ ymsnd.add_route(0, "speaker", 0.48, 0);
+ ymsnd.add_route(1, "speaker", 0.48, 1);
pokey_device &pokey(POKEY(config, "pokey", 14.318181_MHz_XTAL/8));
- pokey.add_route(ALL_OUTPUTS, "lspeaker", 0.24);
- pokey.add_route(ALL_OUTPUTS, "rspeaker", 0.24);
+ pokey.add_route(ALL_OUTPUTS, "speaker", 0.24, 0);
+ pokey.add_route(ALL_OUTPUTS, "speaker", 0.24, 1);
}
void atarisy1_state::marble(machine_config &config)
diff --git a/src/mame/atari/atarisy2.cpp b/src/mame/atari/atarisy2.cpp
index 98baffabf2c..94e8c995e5e 100644
--- a/src/mame/atari/atarisy2.cpp
+++ b/src/mame/atari/atarisy2.cpp
@@ -1224,8 +1224,7 @@ void atarisy2_state::atarisy2(machine_config &config)
screen.screen_vblank().set(FUNC(atarisy2_state::vblank_int));
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, m6502_device::NMI_LINE);
@@ -1235,20 +1234,20 @@ void atarisy2_state::atarisy2(machine_config &config)
GENERIC_LATCH_8(config, m_mainlatch);
YM2151(config, m_ym2151, SOUND_CLOCK/4);
- m_ym2151->add_route(0, "lspeaker", 0.60);
- m_ym2151->add_route(1, "rspeaker", 0.60);
+ m_ym2151->add_route(0, "speaker", 0.60, 0);
+ m_ym2151->add_route(1, "speaker", 0.60, 1);
POKEY(config, m_pokey[0], SOUND_CLOCK/8);
m_pokey[0]->allpot_r().set_ioport("DSW0");
- m_pokey[0]->add_route(ALL_OUTPUTS, "lspeaker", 1.35);
+ m_pokey[0]->add_route(ALL_OUTPUTS, "speaker", 1.35, 0);
POKEY(config, m_pokey[1], SOUND_CLOCK/8);
m_pokey[1]->allpot_r().set_ioport("DSW1");
- m_pokey[1]->add_route(ALL_OUTPUTS, "rspeaker", 1.35);
+ m_pokey[1]->add_route(ALL_OUTPUTS, "speaker", 1.35, 1);
TMS5220C(config, m_tms5220, MASTER_CLOCK/4/4/2);
- m_tms5220->add_route(ALL_OUTPUTS, "lspeaker", 0.75);
- m_tms5220->add_route(ALL_OUTPUTS, "rspeaker", 0.75);
+ m_tms5220->add_route(ALL_OUTPUTS, "speaker", 0.75, 0);
+ m_tms5220->add_route(ALL_OUTPUTS, "speaker", 0.75, 1);
}
diff --git a/src/mame/atari/blstroid.cpp b/src/mame/atari/blstroid.cpp
index f406131fd3f..6ae8ec7777f 100644
--- a/src/mame/atari/blstroid.cpp
+++ b/src/mame/atari/blstroid.cpp
@@ -406,14 +406,13 @@ void blstroid_state::blstroid(machine_config &config)
m_screen->screen_vblank().set_inputline(m_maincpu, M68K_IRQ_2, ASSERT_LINE);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ATARI_JSA_I(config, m_jsa, 0);
m_jsa->main_int_cb().set_inputline(m_maincpu, M68K_IRQ_4);
m_jsa->test_read_cb().set_ioport("IN0").bit(7);
- m_jsa->add_route(0, "lspeaker", 1.0);
- m_jsa->add_route(1, "rspeaker", 1.0);
+ m_jsa->add_route(0, "speaker", 1.0, 0);
+ m_jsa->add_route(1, "speaker", 1.0, 1);
config.device_remove("jsa:pokey");
config.device_remove("jsa:tms");
}
diff --git a/src/mame/atari/canyon.cpp b/src/mame/atari/canyon.cpp
index da95e27cd60..222ded0a924 100644
--- a/src/mame/atari/canyon.cpp
+++ b/src/mame/atari/canyon.cpp
@@ -416,12 +416,11 @@ void canyon_state::canyon(machine_config &config)
PALETTE(config, m_palette, FUNC(canyon_state::palette), 4);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DISCRETE(config, m_discrete, canyon_discrete);
- m_discrete->add_route(0, "lspeaker", 1.0);
- m_discrete->add_route(1, "rspeaker", 1.0);
+ m_discrete->add_route(0, "speaker", 1.0, 0);
+ m_discrete->add_route(1, "speaker", 1.0, 1);
}
diff --git a/src/mame/atari/cops.cpp b/src/mame/atari/cops.cpp
index 25f7ec4fdb0..b2e1c54dcba 100644
--- a/src/mame/atari/cops.cpp
+++ b/src/mame/atari/cops.cpp
@@ -615,20 +615,18 @@ void cops_state::base(machine_config &config)
SONY_LDP1450HLE(config, m_ld, 0);
m_ld->set_screen("screen");
m_ld->set_overlay(256, 256, FUNC(cops_state::screen_update));
- m_ld->add_route(0, "lspeaker", 0.50);
- m_ld->add_route(1, "rspeaker", 0.50);
+ m_ld->add_route(0, "speaker", 0.50, 0);
+ m_ld->add_route(1, "speaker", 0.50, 1);
m_ld->set_baud(9600);
m_ld->add_ntsc_screen(config, "screen");
m_ld->serial_tx().set("dacia", FUNC(r65c52_device::write_rxd1));
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
- SPEAKER(config, "lspeaker").front_left();
+ SPEAKER(config, "speaker", 2).front();
SPEAKER(config, "mspeaker").front_center();
- SPEAKER(config, "rspeaker").front_right();
-
R65C52(config, m_dacia, DACIA_CLOCK);
m_dacia->txd1_handler().set("laserdisc", FUNC(sony_ldp1450hle_device::rx_w));
m_dacia->irq1_handler().set(FUNC(cops_state::acia1_irq));
diff --git a/src/mame/atari/copsnrob.cpp b/src/mame/atari/copsnrob.cpp
index dcc0b8fbc12..b47e45869bc 100644
--- a/src/mame/atari/copsnrob.cpp
+++ b/src/mame/atari/copsnrob.cpp
@@ -440,12 +440,11 @@ void copsnrob_state::copsnrob(machine_config &config)
PALETTE(config, m_palette, palette_device::MONOCHROME);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
discrete_sound_device &discrete(DISCRETE(config, "discrete", copsnrob_discrete));
- discrete.add_route(0, "lspeaker", 1.0);
- discrete.add_route(1, "rspeaker", 1.0);
+ discrete.add_route(0, "speaker", 1.0, 0);
+ discrete.add_route(1, "speaker", 1.0, 1);
f9334_device &latch(F9334(config, "latch")); // H3 on audio board
latch.q_out_cb<0>().set("discrete", FUNC(discrete_device::write_line<COPSNROB_MOTOR3_INV>));
diff --git a/src/mame/atari/cyberbal.cpp b/src/mame/atari/cyberbal.cpp
index b0467ab062e..04dd18e25df 100644
--- a/src/mame/atari/cyberbal.cpp
+++ b/src/mame/atari/cyberbal.cpp
@@ -773,14 +773,13 @@ void cyberbal_state::cyberbal(machine_config &config)
m_rscreen->set_palette("rpalette");
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ATARI_SAC(config, m_sac);
m_sac->main_int_cb().set_inputline(m_maincpu, M68K_IRQ_1);
m_sac->test_read_cb().set_ioport("IN0").bit(15);
- m_sac->add_route(0, "lspeaker", 1.0);
- m_sac->add_route(1, "rspeaker", 1.0);
+ m_sac->add_route(0, "speaker", 1.0, 0);
+ m_sac->add_route(1, "speaker", 1.0, 1);
}
void cyberbal_state::cyberbalt(machine_config &config)
diff --git a/src/mame/atari/cybstorm.cpp b/src/mame/atari/cybstorm.cpp
index db3dae9d38e..3ee3c2e1833 100644
--- a/src/mame/atari/cybstorm.cpp
+++ b/src/mame/atari/cybstorm.cpp
@@ -519,14 +519,13 @@ void cybstorm_state::cybstorm(machine_config &config)
round2(config);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ATARI_JSA_IIIS(config, m_jsa, 0);
m_jsa->main_int_cb().set_inputline(m_maincpu, M68K_IRQ_6);
m_jsa->test_read_cb().set_ioport("9F0010").bit(22);
- m_jsa->add_route(0, "lspeaker", 0.9);
- m_jsa->add_route(1, "rspeaker", 0.9);
+ m_jsa->add_route(0, "speaker", 0.9, 0);
+ m_jsa->add_route(1, "speaker", 0.9, 1);
}
diff --git a/src/mame/atari/dragrace.cpp b/src/mame/atari/dragrace.cpp
index 8103a8b08bf..4df3319955f 100644
--- a/src/mame/atari/dragrace.cpp
+++ b/src/mame/atari/dragrace.cpp
@@ -451,12 +451,11 @@ void dragrace_state::dragrace(machine_config &config)
PALETTE(config, "palette", FUNC(dragrace_state::palette), 16);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DISCRETE(config, m_discrete, dragrace_discrete);
- m_discrete->add_route(0, "lspeaker", 1.0);
- m_discrete->add_route(1, "rspeaker", 1.0);
+ m_discrete->add_route(0, "speaker", 1.0, 0);
+ m_discrete->add_route(1, "speaker", 1.0, 1);
f9334_device &latch_f5(F9334(config, "latch_f5")); // F5
latch_f5.parallel_out_cb().set(FUNC(dragrace_state::speed1_w)).mask(0x1f); // set 3SPEED1-7SPEED1
diff --git a/src/mame/atari/firefox.cpp b/src/mame/atari/firefox.cpp
index 3f316f7e355..ab1b89b141c 100644
--- a/src/mame/atari/firefox.cpp
+++ b/src/mame/atari/firefox.cpp
@@ -640,8 +640,8 @@ void firefox_state::firefox(machine_config &config)
PHILIPS_22VP931(config, m_laserdisc, 0);
m_laserdisc->set_overlay(64*8, 525, FUNC(firefox_state::screen_update_firefox));
m_laserdisc->set_overlay_clip(7*8, 53*8-1, 44, 480+44);
- m_laserdisc->add_route(0, "lspeaker", 0.50);
- m_laserdisc->add_route(1, "rspeaker", 0.50);
+ m_laserdisc->add_route(0, "speaker", 0.50, 0);
+ m_laserdisc->add_route(1, "speaker", 0.50, 1);
m_laserdisc->add_ntsc_screen(config, "screen");
X2212(config, "nvram_1c").set_auto_save(true);
@@ -658,8 +658,7 @@ void firefox_state::firefox(machine_config &config)
m_riot->irq_wr_callback().set_inputline(m_audiocpu, M6502_IRQ_LINE);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, soundlatch[0]);
soundlatch[0]->data_pending_callback().set(m_riot, FUNC(mos6532_device::pa_bit_w<7>)); // MAINFLAG
@@ -672,13 +671,13 @@ void firefox_state::firefox(machine_config &config)
for (int i = 0; i < 4; i++)
{
POKEY(config, m_pokey[i], MASTER_XTAL/8);
- m_pokey[i]->add_route(ALL_OUTPUTS, "lspeaker", 0.30);
- m_pokey[i]->add_route(ALL_OUTPUTS, "rspeaker", 0.30);
+ m_pokey[i]->add_route(ALL_OUTPUTS, "speaker", 0.30, 0);
+ m_pokey[i]->add_route(ALL_OUTPUTS, "speaker", 0.30, 1);
}
TMS5220(config, m_tms, MASTER_XTAL/2/11);
- m_tms->add_route(ALL_OUTPUTS, "lspeaker", 0.75);
- m_tms->add_route(ALL_OUTPUTS, "rspeaker", 0.75);
+ m_tms->add_route(ALL_OUTPUTS, "speaker", 0.75, 0);
+ m_tms->add_route(ALL_OUTPUTS, "speaker", 0.75, 1);
}
diff --git a/src/mame/atari/gauntlet.cpp b/src/mame/atari/gauntlet.cpp
index 9a2cd4a5f90..1104ae5563f 100644
--- a/src/mame/atari/gauntlet.cpp
+++ b/src/mame/atari/gauntlet.cpp
@@ -784,8 +784,7 @@ void gauntlet_state::base(machine_config &config)
m_screen->screen_vblank().set_inputline(m_maincpu, M68K_IRQ_4, ASSERT_LINE);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, m6502_device::NMI_LINE);
@@ -795,16 +794,16 @@ void gauntlet_state::base(machine_config &config)
m_mainlatch->data_pending_callback().set_inputline(m_maincpu, M68K_IRQ_6);
YM2151(config, m_ym2151, 14.318181_MHz_XTAL / 4);
- m_ym2151->add_route(1, "lspeaker", 0.48);
- m_ym2151->add_route(0, "rspeaker", 0.48);
+ m_ym2151->add_route(1, "speaker", 0.48, 0);
+ m_ym2151->add_route(0, "speaker", 0.48, 1);
POKEY(config, m_pokey, 14.318181_MHz_XTAL / 8);
- m_pokey->add_route(ALL_OUTPUTS, "lspeaker", 0.32);
- m_pokey->add_route(ALL_OUTPUTS, "rspeaker", 0.32);
+ m_pokey->add_route(ALL_OUTPUTS, "speaker", 0.32, 0);
+ m_pokey->add_route(ALL_OUTPUTS, "speaker", 0.32, 1);
TMS5220C(config, m_tms5220, 14.318181_MHz_XTAL / 2 / 11); // potentially 14.318181_MHz_XTAL / 2 / 9 as well
- m_tms5220->add_route(ALL_OUTPUTS, "lspeaker", 0.80);
- m_tms5220->add_route(ALL_OUTPUTS, "rspeaker", 0.80);
+ m_tms5220->add_route(ALL_OUTPUTS, "speaker", 0.80, 0);
+ m_tms5220->add_route(ALL_OUTPUTS, "speaker", 0.80, 1);
LS259(config, m_soundctl); // 16T/U
m_soundctl->q_out_cb<0>().set(m_ym2151, FUNC(ym2151_device::reset_w)); // music reset, low reset
diff --git a/src/mame/atari/harddriv.cpp b/src/mame/atari/harddriv.cpp
index d2acec8b538..a872282cec5 100644
--- a/src/mame/atari/harddriv.cpp
+++ b/src/mame/atari/harddriv.cpp
@@ -1627,11 +1627,10 @@ void harddriv_state::ds3(machine_config &config)
m_ds3xdsp->set_addrmap(AS_DATA, &harddriv_state::ds3xdsp_data_map);
TIMER(config, "ds3xdsp_timer").configure_generic(FUNC(harddriv_state::ds3xdsp_internal_timer_callback));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- DAC_16BIT_R2R(config, m_ldac, 0).add_route(ALL_OUTPUTS, "lspeaker", 1.0); // unknown DAC
- DAC_16BIT_R2R(config, m_rdac, 0).add_route(ALL_OUTPUTS, "rspeaker", 1.0); // unknown DAC
+ DAC_16BIT_R2R(config, m_ldac, 0).add_route(ALL_OUTPUTS, "speaker", 1.0, 0); // unknown DAC
+ DAC_16BIT_R2R(config, m_rdac, 0).add_route(ALL_OUTPUTS, "speaker", 1.0, 1); // unknown DAC
}
@@ -1932,8 +1931,7 @@ void steeltal_board_device_state::device_add_mconfig(machine_config &config) //t
config.device_remove("ds3xdsp");
config.device_remove("ldac");
config.device_remove("rdac");
- config.device_remove("lspeaker");
- config.device_remove("rspeaker");
+ config.device_remove("speaker");
ASIC65(config, m_asic65, 0, ASIC65_STEELTAL); /* ASIC65 on DSPCOM board */
diff --git a/src/mame/atari/jaguar.cpp b/src/mame/atari/jaguar.cpp
index 6ef3347778b..352b62a9141 100644
--- a/src/mame/atari/jaguar.cpp
+++ b/src/mame/atari/jaguar.cpp
@@ -40,7 +40,7 @@
Components:
sdt79r3041-20j
Atari Jaguar CPU V1.0 6sc880hf106
- Atari Jaguar DSP V1.0 sc414201ft (has Motorolla logo)
+ Atari Jaguar DSP V1.0 sc414201ft (has Motorola logo)
Altera epm7128elc84-15 marked A-21652
VIA vt83c461 IDE controller
Actel a1010b marked A-22096 near IDE and gun inputs
@@ -1760,7 +1760,7 @@ void jaguar_state::video_config(machine_config &config, const XTAL clock)
void jaguar_state::cojagr3k(machine_config &config)
{
/* basic machine hardware */
- R3041(config, m_maincpu, R3000_CLOCK).set_endianness(ENDIANNESS_BIG);
+ R3041(config, m_maincpu, R3000_CLOCK / 2).set_endianness(ENDIANNESS_BIG); // divider not verified, but chip is rated for 20 MHz
m_maincpu->set_addrmap(AS_PROGRAM, &jaguar_state::r3000_map);
video_config(config, COJAG_CLOCK/2);
@@ -1783,10 +1783,9 @@ void jaguar_state::cojagr3k(machine_config &config)
PALETTE(config, m_palette, FUNC(jaguar_state::jagpal_ycc), 65536);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
- DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_ldac, 0).add_route(ALL_OUTPUTS, "lspeaker", 1.0); // unknown DAC
- DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_rdac, 0).add_route(ALL_OUTPUTS, "rspeaker", 1.0); // unknown DAC
+ SPEAKER(config, "speaker", 2).front();
+ DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_ldac, 0).add_route(ALL_OUTPUTS, "speaker", 1.0, 0); // unknown DAC
+ DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_rdac, 0).add_route(ALL_OUTPUTS, "speaker", 1.0, 1); // unknown DAC
// TODO: subwoofer speaker
}
@@ -1833,10 +1832,9 @@ void jaguar_state::jaguar(machine_config &config)
PALETTE(config, m_palette, FUNC(jaguar_state::jagpal_ycc), 65536);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
- DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_ldac, 0).add_route(ALL_OUTPUTS, "lspeaker", 1.0); // unknown DAC
- DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_rdac, 0).add_route(ALL_OUTPUTS, "rspeaker", 1.0); // unknown DAC
+ SPEAKER(config, "speaker", 2).front();
+ DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_ldac, 0).add_route(ALL_OUTPUTS, "speaker", 1.0, 0); // unknown DAC
+ DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_rdac, 0).add_route(ALL_OUTPUTS, "speaker", 1.0, 1); // unknown DAC
/* quickload */
QUICKLOAD(config, "quickload", "abs,bin,cof,jag,prg,rom", attotime::from_seconds(1)).set_load_callback(FUNC(jaguar_state::quickload_cb));
diff --git a/src/mame/atari/jedi.cpp b/src/mame/atari/jedi.cpp
index 1b0a657c56c..dc8c0740fa3 100644
--- a/src/mame/atari/jedi.cpp
+++ b/src/mame/atari/jedi.cpp
@@ -946,30 +946,29 @@ void jedi_state::jedi(machine_config &config)
M6502(config, m_audiocpu, JEDI_AUDIO_CPU_CLOCK);
m_audiocpu->set_addrmap(AS_PROGRAM, &jedi_state::audio_map);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
pokey_device &pokey1(POKEY(config, "pokey1", JEDI_POKEY_CLOCK));
pokey1.set_output_opamp(RES_K(1), 0.0, 5.0);
- pokey1.add_route(ALL_OUTPUTS, "lspeaker", 0.30);
- pokey1.add_route(ALL_OUTPUTS, "rspeaker", 0.30);
+ pokey1.add_route(ALL_OUTPUTS, "speaker", 0.30, 0);
+ pokey1.add_route(ALL_OUTPUTS, "speaker", 0.30, 1);
pokey_device &pokey2(POKEY(config, "pokey2", JEDI_POKEY_CLOCK));
pokey2.set_output_opamp(RES_K(1), 0.0, 5.0);
- pokey2.add_route(ALL_OUTPUTS, "lspeaker", 0.30);
- pokey2.add_route(ALL_OUTPUTS, "rspeaker", 0.30);
+ pokey2.add_route(ALL_OUTPUTS, "speaker", 0.30, 0);
+ pokey2.add_route(ALL_OUTPUTS, "speaker", 0.30, 1);
pokey_device &pokey3(POKEY(config, "pokey3", JEDI_POKEY_CLOCK));
pokey3.set_output_opamp(RES_K(1), 0.0, 5.0);
- pokey3.add_route(ALL_OUTPUTS, "lspeaker", 0.30);
+ pokey3.add_route(ALL_OUTPUTS, "speaker", 0.30, 0);
pokey_device &pokey4(POKEY(config, "pokey4", JEDI_POKEY_CLOCK));
pokey4.set_output_opamp(RES_K(1), 0.0, 5.0);
- pokey4.add_route(ALL_OUTPUTS, "rspeaker", 0.30);
+ pokey4.add_route(ALL_OUTPUTS, "speaker", 0.30, 1);
TMS5220(config, m_tms, JEDI_TMS5220_CLOCK);
- m_tms->add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- m_tms->add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ m_tms->add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ m_tms->add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
GENERIC_LATCH_8(config, m_soundlatch); // 5E (LS374) + 3E (LS279) pins 13-15
GENERIC_LATCH_8(config, m_sacklatch); // 4E (LS374) + 3E (LS279) pins 1-4
diff --git a/src/mame/atari/lynx.cpp b/src/mame/atari/lynx.cpp
index 7b8e730278a..fb4732510c0 100644
--- a/src/mame/atari/lynx.cpp
+++ b/src/mame/atari/lynx.cpp
@@ -118,12 +118,11 @@ void lynx_state::lynx2(machine_config &config)
/* sound hardware */
config.device_remove("mono");
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
LYNX2_SND(config.replace(), m_sound, XTAL(16'000'000));
m_sound->set_timer_delegate(FUNC(lynx_state::sound_cb));
- m_sound->add_route(0, "lspeaker", 0.50);
- m_sound->add_route(1, "rspeaker", 0.50);
+ m_sound->add_route(0, "speaker", 0.50, 0);
+ m_sound->add_route(1, "speaker", 0.50, 1);
}
#endif
diff --git a/src/mame/atari/mediagx.cpp b/src/mame/atari/mediagx.cpp
index ef413948a6c..ea6d9a342f5 100644
--- a/src/mame/atari/mediagx.cpp
+++ b/src/mame/atari/mediagx.cpp
@@ -912,12 +912,11 @@ void mediagx_state::mediagx(machine_config &config)
PALETTE(config, m_palette).set_entries(256);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- DMADAC(config, m_dmadac[0]).add_route(ALL_OUTPUTS, "lspeaker", 1.0);
+ DMADAC(config, m_dmadac[0]).add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
- DMADAC(config, m_dmadac[1]).add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ DMADAC(config, m_dmadac[1]).add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
}
diff --git a/src/mame/atari/metalmx.cpp b/src/mame/atari/metalmx.cpp
index 66e8c8f11c0..ee18f1fcc12 100644
--- a/src/mame/atari/metalmx.cpp
+++ b/src/mame/atari/metalmx.cpp
@@ -760,19 +760,16 @@ void metalmx_state::metalmx(machine_config &config)
// TODO: copied from atarigt.cpp; Same configurations as T-Mek?
// 5 Channel output (4 Channel input connected to Quad Amp PCB)
- SPEAKER(config, "flspeaker").front_left();
- SPEAKER(config, "frspeaker").front_right();
- SPEAKER(config, "rlspeaker").headrest_left();
- SPEAKER(config, "rrspeaker").headrest_right();
+ SPEAKER(config, "speaker", 4).front().headrest_left(2).headrest_right(3);
//SPEAKER(config, "subwoofer").seat(); Not implemented, Quad Amp PCB output;
ATARI_CAGE(config, m_cage, 0);
m_cage->set_speedup(0); // TODO: speedup address
m_cage->irq_handler().set(FUNC(metalmx_state::cage_irq_callback));
- m_cage->add_route(0, "frspeaker", 1.0); // Foward Right
- m_cage->add_route(1, "rlspeaker", 1.0); // Back Left
- m_cage->add_route(2, "flspeaker", 1.0); // Foward Left
- m_cage->add_route(3, "rrspeaker", 1.0); // Back Right
+ m_cage->add_route(0, "speaker", 1.0, 1); // Foward Right
+ m_cage->add_route(1, "speaker", 1.0, 2); // Back Left
+ m_cage->add_route(2, "speaker", 1.0, 0); // Foward Left
+ m_cage->add_route(3, "speaker", 1.0, 3); // Back Right
}
diff --git a/src/mame/atari/orbit.cpp b/src/mame/atari/orbit.cpp
index 91a3650adf5..70d3ee54879 100644
--- a/src/mame/atari/orbit.cpp
+++ b/src/mame/atari/orbit.cpp
@@ -471,12 +471,11 @@ void orbit_state::orbit(machine_config &config)
PALETTE(config, m_palette, palette_device::MONOCHROME);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DISCRETE(config, m_discrete, orbit_discrete);
- m_discrete->add_route(0, "lspeaker", 1.0);
- m_discrete->add_route(1, "rspeaker", 1.0);
+ m_discrete->add_route(0, "speaker", 1.0, 0);
+ m_discrete->add_route(1, "speaker", 1.0, 1);
}
diff --git a/src/mame/atari/redbaron.cpp b/src/mame/atari/redbaron.cpp
index 43989e8d85a..14932230a3a 100644
--- a/src/mame/atari/redbaron.cpp
+++ b/src/mame/atari/redbaron.cpp
@@ -123,10 +123,9 @@ void redbaron_sound_device::device_start()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void redbaron_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void redbaron_sound_device::sound_stream_update(sound_stream &stream)
{
- auto &buffer = outputs[0];
- for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
int sum = 0;
@@ -225,7 +224,7 @@ void redbaron_sound_device::sound_stream_update(sound_stream &stream, std::vecto
if( m_squeal_out )
sum += 32767 * 40 / 100;
- buffer.put_int(sampindex, sum, 32768);
+ stream.put_int(0, sampindex, sum, 32768);
}
}
diff --git a/src/mame/atari/redbaron.h b/src/mame/atari/redbaron.h
index 8a9e303624b..4ddc5ff5f36 100644
--- a/src/mame/atari/redbaron.h
+++ b/src/mame/atari/redbaron.h
@@ -19,7 +19,7 @@ protected:
virtual void device_start() 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;
private:
std::unique_ptr<int16_t[]> m_vol_lookup;
diff --git a/src/mame/atari/sprint2.cpp b/src/mame/atari/sprint2.cpp
index b89eb436bb6..58f843b0c4c 100644
--- a/src/mame/atari/sprint2.cpp
+++ b/src/mame/atari/sprint2.cpp
@@ -784,8 +784,7 @@ void sprint2_state::sprint2(machine_config &config)
PALETTE(config, m_palette, FUNC(sprint2_state::palette), 12, 4);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
F9334(config, m_outlatch); // at H8
m_outlatch->q_out_cb<0>().set("discrete", FUNC(discrete_device::write_line<SPRINT2_ATTRACT_EN>)); // also DOMINOS_ATTRACT_EN
@@ -796,8 +795,8 @@ void sprint2_state::sprint2(machine_config &config)
//m_outlatch->q_out_cb<6>().set(FUNC(sprint2_state::spare_w));
DISCRETE(config, m_discrete, sprint2_discrete);
- m_discrete->add_route(0, "lspeaker", 1.0);
- m_discrete->add_route(1, "rspeaker", 1.0);
+ m_discrete->add_route(0, "speaker", 1.0, 0);
+ m_discrete->add_route(1, "speaker", 1.0, 1);
}
@@ -806,8 +805,7 @@ void sprint2_state::sprint1(machine_config &config)
sprint2(config);
// sound hardware
- config.device_remove("lspeaker");
- config.device_remove("rspeaker");
+ config.device_remove("speaker");
SPEAKER(config, "mono").front_center();
DISCRETE(config.replace(), m_discrete, sprint1_discrete).add_route(ALL_OUTPUTS, "mono", 1.0);
diff --git a/src/mame/atari/sprint4.cpp b/src/mame/atari/sprint4.cpp
index 3523519b953..45ca84f4d9e 100644
--- a/src/mame/atari/sprint4.cpp
+++ b/src/mame/atari/sprint4.cpp
@@ -583,8 +583,7 @@ void sprint4_state::sprint4(machine_config &config)
PALETTE(config, m_palette, FUNC(sprint4_state::palette_init), 10, 6);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
f9334_device &latch(F9334(config, "latch")); // at E11
latch.q_out_cb<0>().set_output("led0"); // START LAMP 1
@@ -597,8 +596,8 @@ void sprint4_state::sprint4(machine_config &config)
latch.q_out_cb<7>().set("discrete", FUNC(discrete_device::write_line<SPRINT4_SCREECH_EN_4>));
DISCRETE(config, m_discrete, sprint4_discrete);
- m_discrete->add_route(0, "lspeaker", 1.0);
- m_discrete->add_route(1, "rspeaker", 1.0);
+ m_discrete->add_route(0, "speaker", 1.0, 0);
+ m_discrete->add_route(1, "speaker", 1.0, 1);
}
// NOTE: SPRINT 4 A008716 PCB can accept both 8bit ROMs and 4bit BPROMs or combination thereof
diff --git a/src/mame/atari/subs.cpp b/src/mame/atari/subs.cpp
index f6d06092766..a5e644da352 100644
--- a/src/mame/atari/subs.cpp
+++ b/src/mame/atari/subs.cpp
@@ -501,10 +501,9 @@ void subs_state::subs(machine_config &config)
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- DISCRETE(config, m_discrete, subs_discrete).add_route(0, "lspeaker", 1.0).add_route(1, "rspeaker", 1.0);
+ DISCRETE(config, m_discrete, subs_discrete).add_route(0, "speaker", 1.0, 0).add_route(1, "speaker", 1.0, 1);
ls259_device &latch(LS259(config, "latch")); // C9
latch.q_out_cb<0>().set_output("led0").invert(); // START LAMP 1
diff --git a/src/mame/atari/tomcat.cpp b/src/mame/atari/tomcat.cpp
index 8f87dcb25c6..af5d183c809 100644
--- a/src/mame/atari/tomcat.cpp
+++ b/src/mame/atari/tomcat.cpp
@@ -376,17 +376,16 @@ void tomcat_state::tomcat(machine_config &config)
avg.set_vector("vector");
avg.set_memory(m_maincpu, AS_PROGRAM, 0x800000);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
- POKEY(config, "pokey1", XTAL(14'318'181) / 8).add_route(ALL_OUTPUTS, "lspeaker", 0.20);
+ SPEAKER(config, "speaker", 2).front();
+ POKEY(config, "pokey1", XTAL(14'318'181) / 8).add_route(ALL_OUTPUTS, "speaker", 0.20, 0);
- POKEY(config, "pokey2", XTAL(14'318'181) / 8).add_route(ALL_OUTPUTS, "rspeaker", 0.20);
+ POKEY(config, "pokey2", XTAL(14'318'181) / 8).add_route(ALL_OUTPUTS, "speaker", 0.20, 1);
TMS5220(config, m_tms, 325000);
- m_tms->add_route(ALL_OUTPUTS, "lspeaker", 0.50);
- m_tms->add_route(ALL_OUTPUTS, "rspeaker", 0.50);
+ m_tms->add_route(ALL_OUTPUTS, "speaker", 0.50, 0);
+ m_tms->add_route(ALL_OUTPUTS, "speaker", 0.50, 1);
- YM2151(config, "ymsnd", XTAL(14'318'181)/4).add_route(0, "lspeaker", 0.60).add_route(1, "rspeaker", 0.60);
+ YM2151(config, "ymsnd", XTAL(14'318'181)/4).add_route(0, "speaker", 0.60, 0).add_route(1, "speaker", 0.60, 1);
}
ROM_START( tomcat )
diff --git a/src/mame/atari/toobin.cpp b/src/mame/atari/toobin.cpp
index d2fcb9ae39a..ccab5578336 100644
--- a/src/mame/atari/toobin.cpp
+++ b/src/mame/atari/toobin.cpp
@@ -542,14 +542,13 @@ void toobin_state::toobin(machine_config &config)
PALETTE(config, m_palette).set_entries(1024);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ATARI_JSA_I(config, m_jsa, 0);
m_jsa->main_int_cb().set_inputline(m_maincpu, M68K_IRQ_IPL1);
m_jsa->test_read_cb().set_ioport("FF9000").bit(12);
- m_jsa->add_route(0, "lspeaker", 1.0);
- m_jsa->add_route(1, "rspeaker", 1.0);
+ m_jsa->add_route(0, "speaker", 1.0, 0);
+ m_jsa->add_route(1, "speaker", 1.0, 1);
config.device_remove("jsa:tms");
}
diff --git a/src/mame/atari/vindictr.cpp b/src/mame/atari/vindictr.cpp
index 54526e5dc99..1c72a5a7692 100644
--- a/src/mame/atari/vindictr.cpp
+++ b/src/mame/atari/vindictr.cpp
@@ -551,14 +551,13 @@ void vindictr_state::vindictr(machine_config &config)
m_screen->set_palette(m_palette);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ATARI_JSA_I(config, m_jsa, 0);
m_jsa->main_int_cb().set_inputline(m_maincpu, M68K_IRQ_6);
m_jsa->test_read_cb().set_ioport("260010").bit(12);
- m_jsa->add_route(0, "lspeaker", 1.0);
- m_jsa->add_route(1, "rspeaker", 1.0);
+ m_jsa->add_route(0, "speaker", 1.0, 0);
+ m_jsa->add_route(1, "speaker", 1.0, 1);
config.device_remove("jsa:tms");
}
diff --git a/src/mame/atari/xybots.cpp b/src/mame/atari/xybots.cpp
index 8ce1adc3a42..9dc810a2e43 100644
--- a/src/mame/atari/xybots.cpp
+++ b/src/mame/atari/xybots.cpp
@@ -389,15 +389,14 @@ void xybots_state::xybots(machine_config &config)
m_screen->screen_vblank().set_inputline(m_maincpu, M68K_IRQ_1, ASSERT_LINE);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ATARI_JSA_I(config, m_jsa, 0);
m_jsa->set_swapped_coins(true);
m_jsa->main_int_cb().set_inputline(m_maincpu, M68K_IRQ_2);
m_jsa->test_read_cb().set_ioport("FFE200").bit(8);
- m_jsa->add_route(0, "rspeaker", 1.0);
- m_jsa->add_route(1, "lspeaker", 1.0);
+ m_jsa->add_route(0, "speaker", 1.0, 1);
+ m_jsa->add_route(1, "speaker", 1.0, 0);
config.device_remove("jsa:pokey");
config.device_remove("jsa:tms");
}
diff --git a/src/mame/atlus/rallypnt.cpp b/src/mame/atlus/rallypnt.cpp
index 4ab4fb40f5c..d3714d84148 100644
--- a/src/mame/atlus/rallypnt.cpp
+++ b/src/mame/atlus/rallypnt.cpp
@@ -131,12 +131,11 @@ void rallypnt_state::rallypnt(machine_config &config)
// no video, only lamps
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ymz280b_device &ymz(YMZ280B(config, "ymz", 32_MHz_XTAL / 2)); // divider unknown (or 16.9344 MHz internal?)
- ymz.add_route(0, "lspeaker", 1.0);
- ymz.add_route(1, "rspeaker", 1.0);
+ ymz.add_route(0, "speaker", 1.0, 0);
+ ymz.add_route(1, "speaker", 1.0, 1);
}
diff --git a/src/mame/ausnz/applix.cpp b/src/mame/ausnz/applix.cpp
index 47bf2659a34..2b47b7192aa 100644
--- a/src/mame/ausnz/applix.cpp
+++ b/src/mame/ausnz/applix.cpp
@@ -870,10 +870,9 @@ void applix_state::applix(machine_config &config)
PALETTE(config, m_palette, FUNC(applix_state::applix_palette), 16);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
- DAC0800(config, "ldac", 0).add_route(ALL_OUTPUTS, "lspeaker", 1.0); // 74ls374.u20 + dac0800.u21 + 4052.u23
- DAC0800(config, "rdac", 0).add_route(ALL_OUTPUTS, "rspeaker", 1.0); // 74ls374.u20 + dac0800.u21 + 4052.u23
+ SPEAKER(config, "speaker", 2).front();
+ DAC0800(config, "ldac", 0).add_route(ALL_OUTPUTS, "speaker", 1.0, 0); // 74ls374.u20 + dac0800.u21 + 4052.u23
+ DAC0800(config, "rdac", 0).add_route(ALL_OUTPUTS, "speaker", 1.0, 1); // 74ls374.u20 + dac0800.u21 + 4052.u23
/* Devices */
MC6845(config, m_crtc, 30_MHz_XTAL / 16); // MC6545 @ 1.875 MHz
@@ -902,7 +901,7 @@ void applix_state::applix(machine_config &config)
CASSETTE(config, m_cass);
m_cass->set_default_state(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED);
- m_cass->add_route(ALL_OUTPUTS, "lspeaker", 0.10);
+ m_cass->add_route(ALL_OUTPUTS, "speaker", 0.10, 0);
WD1772(config, m_fdc, 16_MHz_XTAL / 2); //connected to Z80H clock pin
FLOPPY_CONNECTOR(config, m_floppy[0], applix_floppies, "35dd", applix_state::floppy_formats).enable_sound(true);
diff --git a/src/mame/bandai/wswan.cpp b/src/mame/bandai/wswan.cpp
index fc149da6ce1..a2304d8489a 100644
--- a/src/mame/bandai/wswan.cpp
+++ b/src/mame/bandai/wswan.cpp
@@ -311,12 +311,11 @@ void wswan_state::wswan_base(machine_config &config)
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
WSWAN_SND(config, m_sound, X1 / 4);
m_sound->set_addrmap(0, &wswan_state::snd_map);
- m_sound->add_route(0, "lspeaker", 0.50);
- m_sound->add_route(1, "rspeaker", 0.50);
+ m_sound->add_route(0, "speaker", 0.50, 0);
+ m_sound->add_route(1, "speaker", 0.50, 1);
// cartridge
WS_CART_SLOT(config, m_cart, X1 / 32, wswan_cart, nullptr);
diff --git a/src/mame/barcrest/mpu4vid.cpp b/src/mame/barcrest/mpu4vid.cpp
index 3788820e6cc..691a4f92f30 100644
--- a/src/mame/barcrest/mpu4vid.cpp
+++ b/src/mame/barcrest/mpu4vid.cpp
@@ -2086,8 +2086,8 @@ void mpu4vid_state::mpu4_vid(machine_config &config)
AY8913(config, m_ay8913, MPU4_MASTER_CLOCK/4);
m_ay8913->set_flags(AY8910_SINGLE_OUTPUT);
m_ay8913->set_resistors_load(820, 0, 0);
- m_ay8913->add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- m_ay8913->add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ m_ay8913->add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ m_ay8913->add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); /* confirm */
@@ -2124,13 +2124,12 @@ void mpu4vid_state::mpu4_vid(machine_config &config)
m_ptm->o3_callback().set(FUNC(mpu4vid_state::vid_o3_callback));
m_ptm->irq_callback().set(FUNC(mpu4vid_state::cpu1_ptm_irq));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
/* Present on all video cards */
saa1099_device &saa(SAA1099(config, "saa", 8000000));
- saa.add_route(0, "lspeaker", 0.5);
- saa.add_route(1, "rspeaker", 0.5);
+ saa.add_route(0, "speaker", 0.5, 0);
+ saa.add_route(1, "speaker", 0.5, 1);
ACIA6850(config, m_acia_0, 0);
m_acia_0->txd_handler().set("acia6850_1", FUNC(acia6850_device::write_rxd));
@@ -2187,8 +2186,8 @@ void mpu4vid_state::vid_oki(machine_config &config)
//and all samples are adjusted to fit the different clock speed.
MPU4_OKI_SAMPLED_SOUND(config, m_okicard, VIDEO_MASTER_CLOCK/10);
- m_okicard->add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- m_okicard->add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ m_okicard->add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ m_okicard->add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
m_okicard->cb2_handler().set(FUNC(mpu4vid_state::pia_gb_cb2_w));
diff --git a/src/mame/barcrest/mpu5.cpp b/src/mame/barcrest/mpu5.cpp
index 2e7bcda10ba..60d0e4df7db 100644
--- a/src/mame/barcrest/mpu5.cpp
+++ b/src/mame/barcrest/mpu5.cpp
@@ -441,7 +441,6 @@ void mpu5_state::mpu5(machine_config &config)
config.set_default_layout(layout_mpu5);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
/* unknown sound */
}
diff --git a/src/mame/bfm/bfm_ad5.cpp b/src/mame/bfm/bfm_ad5.cpp
index 35066900f67..e14a404e1f6 100644
--- a/src/mame/bfm/bfm_ad5.cpp
+++ b/src/mame/bfm/bfm_ad5.cpp
@@ -187,7 +187,6 @@ void adder5_state::bfm_ad5(machine_config &config)
m_maincpu->set_periodic_int(FUNC(adder5_state::ad5_fake_timer_int), attotime::from_hz(1000));
MCF5206E_PERIPHERAL(config, "maincpu_onboard", 0, m_maincpu);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
/* unknown sound */
}
diff --git a/src/mame/bfm/rastersp.cpp b/src/mame/bfm/rastersp.cpp
index dd3ca04dc96..338eb0ad1ee 100644
--- a/src/mame/bfm/rastersp.cpp
+++ b/src/mame/bfm/rastersp.cpp
@@ -1472,13 +1472,12 @@ void rastersp_state::rs_config_base(machine_config &config)
PALETTE(config, m_palette, palette_device::RGB_565);
/* Sound */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_ldac, 0);
DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_rdac, 0);
- m_ldac->add_route(ALL_OUTPUTS, "lspeaker", 0.5); // unknown DAC
- m_rdac->add_route(ALL_OUTPUTS, "rspeaker", 0.5); // unknown DAC
+ m_ldac->add_route(ALL_OUTPUTS, "speaker", 0.5, 0); // unknown DAC
+ m_rdac->add_route(ALL_OUTPUTS, "speaker", 0.5, 1); // unknown DAC
SCC85C30(config, m_duart, 8'000'000);
m_duart->configure_channels(1'843'200, 0, 1'843'200, 0);
diff --git a/src/mame/bitcorp/gamate.cpp b/src/mame/bitcorp/gamate.cpp
index af5fff060b5..a9eb5cee877 100644
--- a/src/mame/bitcorp/gamate.cpp
+++ b/src/mame/bitcorp/gamate.cpp
@@ -191,13 +191,13 @@ void gamate_state::gamate(machine_config &config)
GAMATE_VIDEO(config, "video", 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left(); // Stereo headphone output
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front(); // Stereo headphone output
+
AY8910(config, m_ay, 4433000 / 4); // AY compatible, no actual AY chip present
- m_ay->add_route(0, "lspeaker", 0.5);
- m_ay->add_route(1, "rspeaker", 0.5);
- m_ay->add_route(2, "lspeaker", 0.25);
- m_ay->add_route(2, "rspeaker", 0.25);
+ m_ay->add_route(0, "speaker", 0.5, 0);
+ m_ay->add_route(1, "speaker", 0.5, 1);
+ m_ay->add_route(2, "speaker", 0.25, 0);
+ m_ay->add_route(2, "speaker", 0.25, 1);
GAMATE_CART_SLOT(config, m_cartslot, gamate_cart, nullptr);
diff --git a/src/mame/bmc/bmcbowl.cpp b/src/mame/bmc/bmcbowl.cpp
index 5d8f450bb61..37022194108 100644
--- a/src/mame/bmc/bmcbowl.cpp
+++ b/src/mame/bmc/bmcbowl.cpp
@@ -487,22 +487,21 @@ void bmcbowl_state::bmcbowl(machine_config &config)
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2413_device &ymsnd(YM2413(config, "ymsnd", 3.579545_MHz_XTAL)); // guessed chip type
- ymsnd.add_route(ALL_OUTPUTS, "lspeaker", 0.50);
- ymsnd.add_route(ALL_OUTPUTS, "rspeaker", 0.50);
+ ymsnd.add_route(ALL_OUTPUTS, "speaker", 0.50, 0);
+ ymsnd.add_route(ALL_OUTPUTS, "speaker", 0.50, 1);
ay8910_device &aysnd(AY8910(config, "aysnd", 21.477272_MHz_XTAL / 16)); // matches PCB recording
aysnd.port_a_read_callback().set(FUNC(bmcbowl_state::dips1_r));
aysnd.port_b_write_callback().set(FUNC(bmcbowl_state::input_mux_w));
- aysnd.add_route(ALL_OUTPUTS, "lspeaker", 0.50);
- aysnd.add_route(ALL_OUTPUTS, "rspeaker", 0.50);
+ aysnd.add_route(ALL_OUTPUTS, "speaker", 0.50, 0);
+ aysnd.add_route(ALL_OUTPUTS, "speaker", 0.50, 1);
okim6295_device &oki(OKIM6295(config, "oki", 21.477272_MHz_XTAL / 16, okim6295_device::PIN7_LOW)); // matches PCB recording
- oki.add_route(ALL_OUTPUTS, "lspeaker", 0.50);
- oki.add_route(ALL_OUTPUTS, "rspeaker", 0.50);
+ oki.add_route(ALL_OUTPUTS, "speaker", 0.50, 0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 0.50, 1);
/* via */
via6522_device &via(MOS6522(config, "via6522", 13.3_MHz_XTAL / 16)); // clock not verified (controls music tempo)
diff --git a/src/mame/bmc/koftball.cpp b/src/mame/bmc/koftball.cpp
index 6063107be74..56944d3e4f9 100644
--- a/src/mame/bmc/koftball.cpp
+++ b/src/mame/bmc/koftball.cpp
@@ -578,16 +578,15 @@ void koftball_state::koftball(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_koftball);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2413_device &ymsnd(YM2413(config, "ymsnd", 3.579545_MHz_XTAL));
- ymsnd.add_route(ALL_OUTPUTS, "lspeaker", 0.50);
- ymsnd.add_route(ALL_OUTPUTS, "rspeaker", 0.50);
+ ymsnd.add_route(ALL_OUTPUTS, "speaker", 0.50, 0);
+ ymsnd.add_route(ALL_OUTPUTS, "speaker", 0.50, 1);
okim6295_device &oki(OKIM6295(config, "oki", 21.477272_MHz_XTAL / 22, okim6295_device::PIN7_HIGH)); // clock frequency & pin 7 verified for jxzh
- oki.add_route(ALL_OUTPUTS, "lspeaker", 0.50);
- oki.add_route(ALL_OUTPUTS, "rspeaker", 0.50);
+ oki.add_route(ALL_OUTPUTS, "speaker", 0.50, 0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 0.50, 1);
}
void koftball_state::jxzh(machine_config &config)
diff --git a/src/mame/capcom/cps1.cpp b/src/mame/capcom/cps1.cpp
index 1a77f2ac80b..2df3cb7002f 100644
--- a/src/mame/capcom/cps1.cpp
+++ b/src/mame/capcom/cps1.cpp
@@ -3984,8 +3984,7 @@ void cps_state::qsound(machine_config &config)
/* sound hardware */
config.device_remove("mono");
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
config.device_remove("soundlatch");
config.device_remove("soundlatch2");
@@ -3993,8 +3992,8 @@ void cps_state::qsound(machine_config &config)
config.device_remove("oki");
qsound_device &qsound(QSOUND(config, "qsound"));
- qsound.add_route(0, "lspeaker", 1.0);
- qsound.add_route(1, "rspeaker", 1.0);
+ qsound.add_route(0, "speaker", 1.0, 0);
+ qsound.add_route(1, "speaker", 1.0, 1);
}
void cps_state::wofhfh(machine_config &config)
diff --git a/src/mame/capcom/cps2.cpp b/src/mame/capcom/cps2.cpp
index 4c94caa778a..13e356aba0e 100644
--- a/src/mame/capcom/cps2.cpp
+++ b/src/mame/capcom/cps2.cpp
@@ -1903,12 +1903,11 @@ void cps2_state::cps2(machine_config &config)
PALETTE(config, m_palette, palette_device::BLACK).set_entries(0xc00);
// Sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
QSOUND(config, m_qsound);
- m_qsound->add_route(0, "lspeaker", 1.0);
- m_qsound->add_route(1, "rspeaker", 1.0);
+ m_qsound->add_route(0, "speaker", 1.0, 0);
+ m_qsound->add_route(1, "speaker", 1.0, 1);
}
void cps2_state::cps2comm(machine_config &config)
@@ -1945,8 +1944,8 @@ void cps2_state::gigaman2(machine_config &config)
config.device_remove("qsound");
OKIM6295(config, m_oki, XTAL(32'000'000)/32, okim6295_device::PIN7_HIGH); // clock frequency & pin 7 not verified
- m_oki->add_route(ALL_OUTPUTS, "lspeaker", 0.47);
- m_oki->add_route(ALL_OUTPUTS, "rspeaker", 0.47);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 0.47, 0);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 0.47, 1);
}
/*************************************
diff --git a/src/mame/capcom/cps3.cpp b/src/mame/capcom/cps3.cpp
index 2242cc2f8d2..53d3fe301d3 100644
--- a/src/mame/capcom/cps3.cpp
+++ b/src/mame/capcom/cps3.cpp
@@ -2522,12 +2522,11 @@ void cps3_state::cps3(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfxdecode_device::empty);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
CPS3(config, m_cps3sound, XTAL(42'954'545) / 3);
- m_cps3sound->add_route(1, "lspeaker", 1.0);
- m_cps3sound->add_route(0, "rspeaker", 1.0);
+ m_cps3sound->add_route(1, "speaker", 1.0, 0);
+ m_cps3sound->add_route(0, "speaker", 1.0, 1);
}
diff --git a/src/mame/capcom/cps3_a.cpp b/src/mame/capcom/cps3_a.cpp
index 95dfe625c3e..21d463a2554 100644
--- a/src/mame/capcom/cps3_a.cpp
+++ b/src/mame/capcom/cps3_a.cpp
@@ -55,12 +55,8 @@ void cps3_sound_device::device_start()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void cps3_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void cps3_sound_device::sound_stream_update(sound_stream &stream)
{
- /* Clear the buffers */
- outputs[0].fill(0);
- outputs[1].fill(0);
-
for (int i = 0; i < 16; i ++)
{
if (m_key & (1 << i))
@@ -103,7 +99,7 @@ void cps3_sound_device::sound_stream_update(sound_stream &stream, std::vector<re
loop -= 0x400000;
/* Go through the buffer and add voice contributions */
- for (int j = 0; j < outputs[0].samples(); j++)
+ for (int j = 0; j < stream.samples(); j++)
{
int32_t sample;
@@ -127,21 +123,14 @@ void cps3_sound_device::sound_stream_update(sound_stream &stream, std::vector<re
sample = m_base[BYTE4_XOR_LE(start + pos)];
frac += step;
- outputs[0].add_int(j, sample * vol_l, 32768 << 8);
- outputs[1].add_int(j, sample * vol_r, 32768 << 8);
+ stream.add_int(0, j, sample * vol_l, 32768 << 8);
+ stream.add_int(1, j, sample * vol_r, 32768 << 8);
}
vptr->pos = pos;
vptr->frac = frac;
}
}
-
- // clamp the output; unknown what the real chip does
- for (int sampindex = 0; sampindex < outputs[0].samples(); sampindex++)
- {
- outputs[0].put_clamp(sampindex, outputs[0].getraw(sampindex));
- outputs[1].put_clamp(sampindex, outputs[1].getraw(sampindex));
- }
}
diff --git a/src/mame/capcom/cps3_a.h b/src/mame/capcom/cps3_a.h
index 4bbd5e3856a..4453a821512 100644
--- a/src/mame/capcom/cps3_a.h
+++ b/src/mame/capcom/cps3_a.h
@@ -46,7 +46,7 @@ protected:
virtual void device_start() 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;
private:
sound_stream *m_stream;
diff --git a/src/mame/capcom/sf.cpp b/src/mame/capcom/sf.cpp
index 91de15e5884..60abe668009 100644
--- a/src/mame/capcom/sf.cpp
+++ b/src/mame/capcom/sf.cpp
@@ -775,25 +775,24 @@ void sf_state::sfan(machine_config &config)
PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 1024);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
ym2151_device &ymsnd(YM2151(config, "ymsnd", XTAL(3'579'545)));
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
- ymsnd.add_route(0, "lspeaker", 0.60);
- ymsnd.add_route(1, "rspeaker", 0.60);
+ ymsnd.add_route(0, "speaker", 0.60, 0);
+ ymsnd.add_route(1, "speaker", 0.60, 1);
MSM5205(config, m_msm[0], 384000);
m_msm[0]->set_prescaler_selector(msm5205_device::SEX_4B); /* 8KHz playback ? */
- m_msm[0]->add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- m_msm[0]->add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ m_msm[0]->add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ m_msm[0]->add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
MSM5205(config, m_msm[1], 384000);
m_msm[1]->set_prescaler_selector(msm5205_device::SEX_4B); /* 8KHz playback ? */
- m_msm[1]->add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- m_msm[1]->add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ m_msm[1]->add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ m_msm[1]->add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
}
void sf_state::sfus(machine_config &config)
diff --git a/src/mame/casio/ct8000.cpp b/src/mame/casio/ct8000.cpp
index 5e4d9273bf6..2a1f82b4794 100644
--- a/src/mame/casio/ct8000.cpp
+++ b/src/mame/casio/ct8000.cpp
@@ -95,6 +95,7 @@ protected:
void ct8000_io_map(address_map &map) ATTR_COLD;
virtual void driver_start() override ATTR_COLD;
+ virtual void driver_reset() override ATTR_COLD;
void p1_w(u8 data);
u8 p1_r();
@@ -118,8 +119,6 @@ protected:
void pll_w(offs_t offset, u8 data);
virtual void update_clocks();
- attoseconds_t chorus_cv(attotime const &curtime);
-
required_device<i8049_device> m_maincpu;
required_device_array<i8243_device, 2> m_io;
@@ -136,6 +135,11 @@ protected:
optional_ioport_array<13> m_inputs;
+ TIMER_CALLBACK_MEMBER(bbd_tick);
+ void bbd_setup_next_tick();
+
+ emu_timer *m_bbd_timer;
+
u16 m_key_select;
u8 m_key_enable;
@@ -200,12 +204,11 @@ void ct8000_state::ctmb1(machine_config &config)
{
config_base(config);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
MIXER(config, m_mixer);
- m_mixer->add_route(0, "lspeaker", 1.0);
- m_mixer->add_route(0, "rspeaker", 1.0);
+ m_mixer->add_route(0, "speaker", 1.0, 0);
+ m_mixer->add_route(0, "speaker", 1.0, 1);
// 931 A - sub (consonant) waveform
UPD931(config, m_931a, m_maincpu->clock());
@@ -240,13 +243,13 @@ void ct8000_state::ctmb1(machine_config &config)
FILTER_RC(config, "filter_ac1").set_ac().add_route(0, m_mixer, 1.0);
- MN3207(config, m_bbd).set_cv_handler(FUNC(ct8000_state::chorus_cv));
+ MN3207(config, m_bbd);
m_mixer->add_route(0, m_bbd, 1.0);
m_bbd->add_route(ALL_OUTPUTS, "chorus", 0.5);
auto &bbd_mixer = MIXER(config, "chorus");
- bbd_mixer.add_route(0, "lspeaker", 0.4);
- bbd_mixer.add_route(0, "rspeaker", -0.4);
+ bbd_mixer.add_route(0, "speaker", 0.4, 0);
+ bbd_mixer.add_route(0, "speaker", -0.4, 1);
}
//**************************************************************************
@@ -284,6 +287,8 @@ void ct8000_state::ctfk1(machine_config &config)
//**************************************************************************
void ct8000_state::driver_start()
{
+ m_bbd_timer = timer_alloc(FUNC(ct8000_state::bbd_tick), this);
+
m_bank->configure_entries(0, 2, memregion("bankrom")->base(), 0x800);
m_key_select = 0xffff;
@@ -306,6 +311,11 @@ void ct8000_state::driver_start()
save_item(NAME(m_clock_div));
}
+void ct8000_state::driver_reset()
+{
+ bbd_setup_next_tick();
+}
+
//**************************************************************************
void ct8000_state::p1_w(u8 data)
{
@@ -632,15 +642,21 @@ void ct8000_state::update_clocks()
}
//**************************************************************************
-attoseconds_t ct8000_state::chorus_cv(attotime const &cvtime)
+TIMER_CALLBACK_MEMBER(ct8000_state::bbd_tick)
+{
+ m_bbd->tick();
+ bbd_setup_next_tick();
+}
+
+void ct8000_state::bbd_setup_next_tick()
{
// 62.5 to 80 kHz, varies at 0.6666... Hz
- double pos = cvtime.as_double() / 1.5;
+ double pos = machine().time().as_double() / 1.5;
pos -= std::floor(pos);
pos = (pos < 0.5) ? (2 * pos) : 2 * (1.0 - pos);
const double bbd_freq = 62500 + (80000 - 62500) * pos;
- return HZ_TO_ATTOSECONDS(bbd_freq);
+ m_bbd_timer->adjust(attotime::from_ticks(1, bbd_freq));
}
diff --git a/src/mame/casio/ctk551.cpp b/src/mame/casio/ctk551.cpp
index 8747bd29010..33c52981fdf 100644
--- a/src/mame/casio/ctk551.cpp
+++ b/src/mame/casio/ctk551.cpp
@@ -449,8 +449,8 @@ void ctk551_state::ap10(machine_config& config)
// CPU
GT913(config, m_maincpu, 24_MHz_XTAL / 2);
m_maincpu->set_addrmap(AS_DATA, &ctk551_state::ap10_map);
- m_maincpu->add_route(0, "lspeaker", 1.0);
- m_maincpu->add_route(1, "rspeaker", 1.0);
+ m_maincpu->add_route(0, "speaker", 1.0, 0);
+ m_maincpu->add_route(1, "speaker", 1.0, 1);
m_maincpu->read_adc<0>().set_constant(0);
m_maincpu->read_adc<1>().set_constant(0);
m_maincpu->read_port1().set_ioport("P1");
@@ -474,8 +474,7 @@ void ctk551_state::ap10(machine_config& config)
midiout_slot(mdout);
m_maincpu->write_sci_tx<0>().set(mdout, FUNC(midi_port_device::write_txd));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
config.set_default_layout(layout_ap10);
}
@@ -485,8 +484,8 @@ void ctk551_state::ctk530(machine_config& config)
// CPU
GT913(config, m_maincpu, 20_MHz_XTAL / 2);
m_maincpu->set_addrmap(AS_DATA, &ctk551_state::ctk530_map);
- m_maincpu->add_route(0, "lspeaker", 1.0);
- m_maincpu->add_route(1, "rspeaker", 1.0);
+ m_maincpu->add_route(0, "speaker", 1.0, 0);
+ m_maincpu->add_route(1, "speaker", 1.0, 1);
m_maincpu->read_adc<0>().set_constant(0);
m_maincpu->read_adc<1>().set_constant(0);
m_maincpu->read_port1().set_ioport("P1");
@@ -509,8 +508,7 @@ void ctk551_state::ctk530(machine_config& config)
m_pwm->set_size(4, 8);
m_pwm->set_segmask(0x7, 0xff);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
config.set_default_layout(layout_ctk530);
}
@@ -520,8 +518,8 @@ void ctk551_state::gz70sp(machine_config& config)
// CPU
GT913(config, m_maincpu, 30_MHz_XTAL / 2);
m_maincpu->set_addrmap(AS_DATA, &ctk551_state::gz70sp_map);
- m_maincpu->add_route(0, "lspeaker", 1.0);
- m_maincpu->add_route(1, "rspeaker", 1.0);
+ m_maincpu->add_route(0, "speaker", 1.0, 0);
+ m_maincpu->add_route(1, "speaker", 1.0, 1);
m_maincpu->read_adc<0>().set_constant(0);
m_maincpu->read_adc<1>().set_constant(0);
m_maincpu->read_port1().set_ioport("P1");
@@ -537,8 +535,7 @@ void ctk551_state::gz70sp(machine_config& config)
midiin_slot(mdin);
mdin.rxd_handler().set(m_maincpu, FUNC(gt913_device::sci_rx_w<1>));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
void ctk551_state::ctk601(machine_config& config)
@@ -546,8 +543,8 @@ void ctk551_state::ctk601(machine_config& config)
// CPU
GT913(config, m_maincpu, 30_MHz_XTAL / 2);
m_maincpu->set_addrmap(AS_DATA, &ctk551_state::ctk601_map);
- m_maincpu->add_route(0, "lspeaker", 1.0);
- m_maincpu->add_route(1, "rspeaker", 1.0);
+ m_maincpu->add_route(0, "speaker", 1.0, 0);
+ m_maincpu->add_route(1, "speaker", 1.0, 1);
m_maincpu->read_adc<0>().set_constant(0);
m_maincpu->read_adc<1>().set_constant(0);
m_maincpu->read_port1().set_ioport("P1_R");
@@ -579,8 +576,7 @@ void ctk551_state::ctk601(machine_config& config)
screen.set_visarea_full();
screen.screen_vblank().set(FUNC(ctk551_state::render_w));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
m_switch = 0x8;
}
@@ -590,8 +586,8 @@ void ctk551_state::ctk551(machine_config &config)
// CPU
GT913(config, m_maincpu, 30'000'000 / 2);
m_maincpu->set_addrmap(AS_DATA, &ctk551_state::ctk530_map);
- m_maincpu->add_route(0, "lspeaker", 1.0);
- m_maincpu->add_route(1, "rspeaker", 1.0);
+ m_maincpu->add_route(0, "speaker", 1.0, 0);
+ m_maincpu->add_route(1, "speaker", 1.0, 1);
m_maincpu->read_adc<0>().set_ioport("AN0");
m_maincpu->read_adc<1>().set_ioport("AN1");
m_maincpu->read_port1().set_ioport("P1_R");
@@ -621,8 +617,7 @@ void ctk551_state::ctk551(machine_config &config)
screen.set_visarea_full();
screen.screen_vblank().set(FUNC(ctk551_state::render_w));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
m_switch = 0x2;
}
diff --git a/src/mame/casio/cz1.cpp b/src/mame/casio/cz1.cpp
index d43b02c289a..d4b491367b5 100644
--- a/src/mame/casio/cz1.cpp
+++ b/src/mame/casio/cz1.cpp
@@ -877,11 +877,10 @@ void cz1_state::mz1(machine_config &config)
config.set_default_layout(layout_mz1);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- MIXER(config, m_mixer[0]).add_route(0, "lspeaker", 1.0);
- MIXER(config, m_mixer[1]).add_route(0, "rspeaker", 1.0);
+ MIXER(config, m_mixer[0]).add_route(0, "speaker", 1.0, 0);
+ MIXER(config, m_mixer[1]).add_route(0, "speaker", 1.0, 1);
UPD933(config, m_upd933[0], 8.96_MHz_XTAL / 2);
m_upd933[0]->irq_cb().set("irq", FUNC(input_merger_any_high_device::in_w<0>));
diff --git a/src/mame/casio/pv1000.cpp b/src/mame/casio/pv1000.cpp
index 9ce06f3af3d..5f0f7dfebae 100644
--- a/src/mame/casio/pv1000.cpp
+++ b/src/mame/casio/pv1000.cpp
@@ -32,7 +32,7 @@ protected:
virtual void device_start() 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;
private:
// internal state
@@ -117,14 +117,12 @@ void pv1000_sound_device::voice_w(offs_t offset, uint8_t data)
square1 via i/o$F8 is -6dB, square2 via i/o$F9 is -3dB, defining square3 via i/o$FA as 0dB
*/
-void pv1000_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void pv1000_sound_device::sound_stream_update(sound_stream &stream)
{
- auto &buffer = outputs[0];
-
// Each channel has a different volume via resistor mixing which correspond to -6dB, -3dB, 0dB drops
static const int volumes[3] = { 0x1000, 0x1800, 0x2000 };
- for (int index = 0; index < buffer.samples(); index++)
+ for (int index = 0; index < stream.samples(); index++)
{
s32 sum = 0;
@@ -161,7 +159,7 @@ void pv1000_sound_device::sound_stream_update(sound_stream &stream, std::vector<
sum += m_voice[2].val * volumes[2];
}
- buffer.put_int(index, sum, 32768);
+ stream.put_int(0, index, sum, 32768);
}
}
diff --git a/src/mame/casio/wk1800.cpp b/src/mame/casio/wk1800.cpp
index 103ad490cde..f4aa2d87c31 100644
--- a/src/mame/casio/wk1800.cpp
+++ b/src/mame/casio/wk1800.cpp
@@ -321,12 +321,11 @@ void wk1600_state::wk1600(machine_config &config)
screen.set_visarea_full();
screen.screen_vblank().set(FUNC(wk1600_state::render_w));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GT155(config, m_gt155, 24.576_MHz_XTAL);
- m_gt155->add_route(0, "lspeaker", 1.0);
- m_gt155->add_route(1, "rspeaker", 1.0);
+ m_gt155->add_route(0, "speaker", 1.0, 0);
+ m_gt155->add_route(1, "speaker", 1.0, 1);
}
/**************************************************************************/
diff --git a/src/mame/cinematronics/dlair.cpp b/src/mame/cinematronics/dlair.cpp
index 396e80347cd..dad18ed8851 100644
--- a/src/mame/cinematronics/dlair.cpp
+++ b/src/mame/cinematronics/dlair.cpp
@@ -65,7 +65,7 @@ public:
dlair_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
- m_speaker(*this, "speaker"),
+ m_speaker(*this, "speaker_sound"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_ldv1000(*this, "ld_ldv1000"),
@@ -736,13 +736,12 @@ void dlair_state::dlair_base(machine_config &config)
m_maincpu->set_periodic_int(FUNC(dlair_state::irq0_line_hold), attotime::from_hz((double)MASTER_CLOCK_US/8/16/16/16/16));
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ay8910_device &aysnd(AY8910(config, "aysnd", MASTER_CLOCK_US/8));
aysnd.port_a_read_callback().set_ioport("DSW1");
aysnd.port_b_read_callback().set_ioport("DSW2");
- aysnd.add_route(ALL_OUTPUTS, "rspeaker", 0.33);
+ aysnd.add_route(ALL_OUTPUTS, "speaker", 0.33, 1);
}
@@ -750,8 +749,8 @@ void dlair_state::dlair_pr7820(machine_config &config)
{
dlair_base(config);
PIONEER_PR7820(config, m_pr7820, 0);
- m_pr7820->add_route(0, "lspeaker", 1.0);
- m_pr7820->add_route(1, "rspeaker", 1.0);
+ m_pr7820->add_route(0, "speaker", 1.0, 0);
+ m_pr7820->add_route(1, "speaker", 1.0, 1);
m_pr7820->add_ntsc_screen(config, "screen");
}
@@ -760,8 +759,8 @@ void dlair_state::dlair_ldv1000(machine_config &config)
{
dlair_base(config);
PIONEER_LDV1000HLE(config, m_ldv1000, 0);
- m_ldv1000->add_route(0, "lspeaker", 1.0);
- m_ldv1000->add_route(1, "rspeaker", 1.0);
+ m_ldv1000->add_route(0, "speaker", 1.0, 0);
+ m_ldv1000->add_route(1, "speaker", 1.0, 1);
m_ldv1000->add_ntsc_screen(config, "screen");
}
@@ -786,8 +785,8 @@ void dlair_state::dleuro(machine_config &config)
PHILIPS_22VP932(config, m_22vp932, 0);
m_22vp932->set_overlay(256, 256, FUNC(dlair_state::screen_update_dleuro));
- m_22vp932->add_route(0, "lspeaker", 1.0);
- m_22vp932->add_route(1, "rspeaker", 1.0);
+ m_22vp932->add_route(0, "speaker", 1.0, 0);
+ m_22vp932->add_route(1, "speaker", 1.0, 1);
/* video hardware */
m_22vp932->add_pal_screen(config, "screen");
@@ -796,12 +795,11 @@ void dlair_state::dleuro(machine_config &config)
PALETTE(config, m_palette, FUNC(dlair_state::dleuro_palette), 16);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
SPEAKER_SOUND(config, m_speaker);
- m_speaker->add_route(ALL_OUTPUTS, "lspeaker", 0.33);
- m_speaker->add_route(ALL_OUTPUTS, "rspeaker", 0.33);
+ m_speaker->add_route(ALL_OUTPUTS, "speaker", 0.33, 0);
+ m_speaker->add_route(ALL_OUTPUTS, "speaker", 0.33, 1);
}
diff --git a/src/mame/commodore/c65.cpp b/src/mame/commodore/c65.cpp
index 242564db746..88ea38d3bf7 100644
--- a/src/mame/commodore/c65.cpp
+++ b/src/mame/commodore/c65.cpp
@@ -1457,18 +1457,17 @@ void c65_state::c65(machine_config &config)
PALETTE(config, m_palette, FUNC(c65_state::palette_init), 0x100);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
// 8580 SID
MOS6581(config, m_sid[0], MAIN_C64_CLOCK);
//m_sid->potx().set(FUNC(c64_state::sid_potx_r));
//m_sid->poty().set(FUNC(c64_state::sid_poty_r));
- m_sid[0]->add_route(ALL_OUTPUTS, "lspeaker", 0.50);
+ m_sid[0]->add_route(ALL_OUTPUTS, "speaker", 0.50, 0);
MOS6581(config, m_sid[1], MAIN_C64_CLOCK);
//m_sid->potx().set(FUNC(c64_state::sid_potx_r));
//m_sid->poty().set(FUNC(c64_state::sid_poty_r));
- m_sid[1]->add_route(ALL_OUTPUTS, "rspeaker", 0.50);
+ m_sid[1]->add_route(ALL_OUTPUTS, "speaker", 0.50, 1);
VCS_CONTROL_PORT(config, m_joy[0], vcs_control_port_devices, "joy");
//m_joy1->trigger_wr_callback().set(MOS6567_TAG, FUNC(mos6567_device::lp_w));
diff --git a/src/mame/dai/dai.cpp b/src/mame/dai/dai.cpp
index 1a328b774ce..daad3cdb88c 100644
--- a/src/mame/dai/dai.cpp
+++ b/src/mame/dai/dai.cpp
@@ -215,9 +215,8 @@ void dai_state::dai(machine_config &config)
/* sound hardware */
SPEAKER(config, "mono").front_center();
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
- DAI_SOUND(config, m_sound).add_route(0, "lspeaker", 0.50).add_route(1, "rspeaker", 0.50);
+ SPEAKER(config, "speaker", 2).front();
+ DAI_SOUND(config, m_sound).add_route(0, "speaker", 0.50, 0).add_route(1, "speaker", 0.50, 1);
/* cassette */
CASSETTE(config, m_cassette);
diff --git a/src/mame/dai/dai_snd.cpp b/src/mame/dai/dai_snd.cpp
index 4c61ec57e01..d5bdf459ed8 100644
--- a/src/mame/dai/dai_snd.cpp
+++ b/src/mame/dai/dai_snd.cpp
@@ -119,23 +119,20 @@ void dai_sound_device::set_input_ch2(int state)
// our sound stream
//-------------------------------------------------
-void dai_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void dai_sound_device::sound_stream_update(sound_stream &stream)
{
- auto &sample_left = outputs[0];
- auto &sample_right = outputs[1];
-
int16_t channel_0_signal = m_dai_input[0] ? s_osc_volume_table[m_osc_volume[0]] : -s_osc_volume_table[m_osc_volume[0]];
int16_t channel_1_signal = m_dai_input[1] ? s_osc_volume_table[m_osc_volume[1]] : -s_osc_volume_table[m_osc_volume[1]];
int16_t channel_2_signal = m_dai_input[2] ? s_osc_volume_table[m_osc_volume[2]] : -s_osc_volume_table[m_osc_volume[2]];
- for (int sampindex = 0; sampindex < sample_left.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
int16_t noise = machine().rand()&0x01 ? s_noise_volume_table[m_noise_volume] : -s_noise_volume_table[m_noise_volume];
/* channel 0 + channel 1 + noise */
- sample_left.put_int(sampindex, channel_0_signal + channel_1_signal + noise, 32768);
+ stream.put_int(0, sampindex, channel_0_signal + channel_1_signal + noise, 32768);
/* channel 1 + channel 2 + noise */
- sample_right.put_int(sampindex, channel_1_signal + channel_2_signal + noise, 32768);
+ stream.put_int(1, sampindex, channel_1_signal + channel_2_signal + noise, 32768);
}
}
diff --git a/src/mame/dai/dai_snd.h b/src/mame/dai/dai_snd.h
index 9b37744170c..0792848cd2f 100644
--- a/src/mame/dai/dai_snd.h
+++ b/src/mame/dai/dai_snd.h
@@ -27,7 +27,7 @@ protected:
// device-level overrides
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;
private:
sound_stream * m_mixer_channel = nullptr;
diff --git a/src/mame/dataeast/backfire.cpp b/src/mame/dataeast/backfire.cpp
index 79715a95eb7..539853481e6 100644
--- a/src/mame/dataeast/backfire.cpp
+++ b/src/mame/dataeast/backfire.cpp
@@ -418,12 +418,11 @@ void backfire_state::backfire(machine_config &config)
m_sprgen[1]->set_pri_callback(FUNC(backfire_state::pri_callback));
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ymz280b_device &ymz(YMZ280B(config, "ymz", 28000000 / 2));
- ymz.add_route(0, "lspeaker", 1.0);
- ymz.add_route(1, "rspeaker", 1.0);
+ ymz.add_route(0, "speaker", 1.0, 0);
+ ymz.add_route(1, "speaker", 1.0, 1);
}
diff --git a/src/mame/dataeast/boogwing.cpp b/src/mame/dataeast/boogwing.cpp
index 082dcf465a9..a9d7cb93a8b 100644
--- a/src/mame/dataeast/boogwing.cpp
+++ b/src/mame/dataeast/boogwing.cpp
@@ -723,8 +723,8 @@ void boogwing_state::boogwing(machine_config &config)
H6280(config, m_audiocpu, SOUND_XTAL / 4);
m_audiocpu->set_addrmap(AS_PROGRAM, &boogwing_state::audio_map);
- m_audiocpu->add_route(ALL_OUTPUTS, "lspeaker", 0); // internal sound unused
- m_audiocpu->add_route(ALL_OUTPUTS, "rspeaker", 0);
+ m_audiocpu->add_route(ALL_OUTPUTS, "speaker", 0, 0); // internal sound unused
+ m_audiocpu->add_route(ALL_OUTPUTS, "speaker", 0, 1);
// video hardware
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
@@ -775,23 +775,22 @@ void boogwing_state::boogwing(machine_config &config)
m_deco104->set_interface_scramble_reverse();
m_deco104->set_use_magic_read_address_xor(true);
- // sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ /* sound hardware */
+ SPEAKER(config, "speaker", 2).front();
ym2151_device &ymsnd(YM2151(config, "ymsnd", SOUND_XTAL / 9));
ymsnd.irq_handler().set_inputline(m_audiocpu, 1); // IRQ2
ymsnd.port_write_handler().set(FUNC(boogwing_state::sound_bankswitch_w));
- ymsnd.add_route(0, "lspeaker", 0.32);
- ymsnd.add_route(1, "rspeaker", 0.32);
+ ymsnd.add_route(0, "speaker", 0.32, 0);
+ ymsnd.add_route(1, "speaker", 0.32, 1);
OKIM6295(config, m_oki[0], SOUND_XTAL / 32, okim6295_device::PIN7_HIGH);
- m_oki[0]->add_route(ALL_OUTPUTS, "lspeaker", 0.56);
- m_oki[0]->add_route(ALL_OUTPUTS, "rspeaker", 0.56);
+ m_oki[0]->add_route(ALL_OUTPUTS, "speaker", 0.56, 0);
+ m_oki[0]->add_route(ALL_OUTPUTS, "speaker", 0.56, 1);
OKIM6295(config, m_oki[1], SOUND_XTAL / 16, okim6295_device::PIN7_HIGH);
- m_oki[1]->add_route(ALL_OUTPUTS, "lspeaker", 0.12);
- m_oki[1]->add_route(ALL_OUTPUTS, "rspeaker", 0.12);
+ m_oki[1]->add_route(ALL_OUTPUTS, "speaker", 0.12, 0);
+ m_oki[1]->add_route(ALL_OUTPUTS, "speaker", 0.12, 1);
}
/**********************************************************************************/
diff --git a/src/mame/dataeast/dassault.cpp b/src/mame/dataeast/dassault.cpp
index dd2b89a4f56..a2884a2f643 100644
--- a/src/mame/dataeast/dassault.cpp
+++ b/src/mame/dataeast/dassault.cpp
@@ -744,8 +744,8 @@ void dassault_state::dassault(machine_config &config)
H6280(config, m_audiocpu, XTAL(32'220'000) / 8); // Accurate
m_audiocpu->set_addrmap(AS_PROGRAM, &dassault_state::sound_map);
- m_audiocpu->add_route(ALL_OUTPUTS, "lspeaker", 0); // internal sound unused
- m_audiocpu->add_route(ALL_OUTPUTS, "rspeaker", 0);
+ m_audiocpu->add_route(ALL_OUTPUTS, "speaker", 0, 0); // internal sound unused
+ m_audiocpu->add_route(ALL_OUTPUTS, "speaker", 0, 1);
config.set_maximum_quantum(attotime::from_hz(m_maincpu->clock() / 4)); // I was seeing random lockups.. let's see if this helps
@@ -794,29 +794,28 @@ void dassault_state::dassault(machine_config &config)
DECO_SPRITE(config, m_sprgen[1], 0, m_palette, gfx_dassault_spr2);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, 0); // IRQ1
ym2203_device &ym1(YM2203(config, "ym1", XTAL(32'220'000) / 8));
- ym1.add_route(ALL_OUTPUTS, "lspeaker", 0.40);
- ym1.add_route(ALL_OUTPUTS, "rspeaker", 0.40);
+ ym1.add_route(ALL_OUTPUTS, "speaker", 0.40, 0);
+ ym1.add_route(ALL_OUTPUTS, "speaker", 0.40, 1);
ym2151_device &ym2(YM2151(config, "ym2", XTAL(32'220'000) / 9));
ym2.irq_handler().set_inputline(m_audiocpu, 1);
ym2.port_write_handler().set(FUNC(dassault_state::sound_bankswitch_w));
- ym2.add_route(0, "lspeaker", 0.45);
- ym2.add_route(1, "rspeaker", 0.45);
+ ym2.add_route(0, "speaker", 0.45, 0);
+ ym2.add_route(1, "speaker", 0.45, 1);
okim6295_device &oki1(OKIM6295(config, "oki1", XTAL(32'220'000) / 32, okim6295_device::PIN7_HIGH)); // verified
- oki1.add_route(ALL_OUTPUTS, "lspeaker", 0.50);
- oki1.add_route(ALL_OUTPUTS, "rspeaker", 0.50);
+ oki1.add_route(ALL_OUTPUTS, "speaker", 0.50, 0);
+ oki1.add_route(ALL_OUTPUTS, "speaker", 0.50, 1);
OKIM6295(config, m_oki2, XTAL(32'220'000) / 16, okim6295_device::PIN7_HIGH); // verified
- m_oki2->add_route(ALL_OUTPUTS, "lspeaker", 0.25);
- m_oki2->add_route(ALL_OUTPUTS, "rspeaker", 0.25);
+ m_oki2->add_route(ALL_OUTPUTS, "speaker", 0.25, 0);
+ m_oki2->add_route(ALL_OUTPUTS, "speaker", 0.25, 1);
}
/**********************************************************************************/
diff --git a/src/mame/dataeast/deco156.cpp b/src/mame/dataeast/deco156.cpp
index 9f4e755ef73..4a5fdf97743 100644
--- a/src/mame/dataeast/deco156.cpp
+++ b/src/mame/dataeast/deco156.cpp
@@ -393,12 +393,11 @@ void deco156_state::wcvol95(machine_config &config)
m_sprgen->set_pri_callback(FUNC(deco156_state::pri_callback));
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ymz280b_device &ymz(YMZ280B(config, "ymz", 28000000 / 2));
- ymz.add_route(0, "lspeaker", 1.0);
- ymz.add_route(1, "rspeaker", 1.0);
+ ymz.add_route(0, "speaker", 1.0, 0);
+ ymz.add_route(1, "speaker", 1.0, 1);
}
diff --git a/src/mame/dataeast/deco32.cpp b/src/mame/dataeast/deco32.cpp
index 67da29776bd..dc237a34025 100644
--- a/src/mame/dataeast/deco32.cpp
+++ b/src/mame/dataeast/deco32.cpp
@@ -1906,8 +1906,8 @@ void captaven_state::captaven(machine_config &config)
h6280_device &audiocpu(H6280(config, m_audiocpu, XTAL(32'220'000)/4/3)); // pin 10 is 32mhz/4, pin 14 is High so internal divisor is 3 (verified on pcb)
audiocpu.set_addrmap(AS_PROGRAM, &captaven_state::h6280_sound_map);
- audiocpu.add_route(ALL_OUTPUTS, "lspeaker", 0); // internal sound unused
- audiocpu.add_route(ALL_OUTPUTS, "rspeaker", 0);
+ audiocpu.add_route(ALL_OUTPUTS, "speaker", 0, 0); // internal sound unused
+ audiocpu.add_route(ALL_OUTPUTS, "speaker", 0, 1);
INPUT_MERGER_ANY_HIGH(config, "irq_merger").output_handler().set_inputline(m_maincpu, ARM_IRQ_LINE);
@@ -1960,22 +1960,21 @@ void captaven_state::captaven(machine_config &config)
m_ioprot->soundlatch_irq_cb().set_inputline(m_audiocpu, 0);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
YM2151(config, m_ym2151, XTAL(32'220'000)/9); // verified on pcb
m_ym2151->irq_handler().set_inputline(m_audiocpu, 1);
m_ym2151->port_write_handler().set(FUNC(deco32_state::sound_bankswitch_w));
- m_ym2151->add_route(0, "lspeaker", 0.42);
- m_ym2151->add_route(1, "rspeaker", 0.42);
+ m_ym2151->add_route(0, "speaker", 0.42, 0);
+ m_ym2151->add_route(1, "speaker", 0.42, 1);
OKIM6295(config, m_oki[0], XTAL(32'220'000)/32, okim6295_device::PIN7_HIGH); // verified on pcb; pin 7 is floating to 2.5V (left unconnected), so I presume High
- m_oki[0]->add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- m_oki[0]->add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ m_oki[0]->add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ m_oki[0]->add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
OKIM6295(config, m_oki[1], XTAL(32'220'000)/16, okim6295_device::PIN7_HIGH); // verified on pcb; pin 7 is floating to 2.5V (left unconnected), so I presume High
- m_oki[1]->add_route(ALL_OUTPUTS, "lspeaker", 0.35);
- m_oki[1]->add_route(ALL_OUTPUTS, "rspeaker", 0.35);
+ m_oki[1]->add_route(ALL_OUTPUTS, "speaker", 0.35, 0);
+ m_oki[1]->add_route(ALL_OUTPUTS, "speaker", 0.35, 1);
}
// DE-0380-2
@@ -1987,8 +1986,8 @@ void fghthist_state::fghthist(machine_config &config)
h6280_device &audiocpu(H6280(config, m_audiocpu, XTAL(32'220'000) / 8));
audiocpu.set_addrmap(AS_PROGRAM, &fghthist_state::h6280_sound_custom_latch_map);
- audiocpu.add_route(ALL_OUTPUTS, "lspeaker", 0); // internal sound unused
- audiocpu.add_route(ALL_OUTPUTS, "rspeaker", 0);
+ audiocpu.add_route(ALL_OUTPUTS, "speaker", 0, 0); // internal sound unused
+ audiocpu.add_route(ALL_OUTPUTS, "speaker", 0, 1);
EEPROM_93C46_16BIT(config, m_eeprom);
@@ -2036,8 +2035,7 @@ void fghthist_state::fghthist(machine_config &config)
m_ioprot->set_use_magic_read_address_xor(true);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, 0);
@@ -2045,16 +2043,16 @@ void fghthist_state::fghthist(machine_config &config)
YM2151(config, m_ym2151, 32220000/9);
m_ym2151->irq_handler().set_inputline(m_audiocpu, 1);
m_ym2151->port_write_handler().set(FUNC(deco32_state::sound_bankswitch_w));
- m_ym2151->add_route(0, "lspeaker", 0.42);
- m_ym2151->add_route(1, "rspeaker", 0.42);
+ m_ym2151->add_route(0, "speaker", 0.42, 0);
+ m_ym2151->add_route(1, "speaker", 0.42, 1);
OKIM6295(config, m_oki[0], 32220000/32, okim6295_device::PIN7_HIGH);
- m_oki[0]->add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- m_oki[0]->add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ m_oki[0]->add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ m_oki[0]->add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
OKIM6295(config, m_oki[1], 32220000/16, okim6295_device::PIN7_HIGH);
- m_oki[1]->add_route(ALL_OUTPUTS, "lspeaker", 0.35);
- m_oki[1]->add_route(ALL_OUTPUTS, "rspeaker", 0.35);
+ m_oki[1]->add_route(ALL_OUTPUTS, "speaker", 0.35, 0);
+ m_oki[1]->add_route(ALL_OUTPUTS, "speaker", 0.35, 1);
}
// DE-0395-1
@@ -2084,8 +2082,8 @@ void fghthist_state::fghthistu(machine_config &config)
m_ym2151->irq_handler().set("sound_irq_merger", FUNC(input_merger_any_high_device::in_w<1>));
m_ym2151->reset_routes();
- m_ym2151->add_route(0, "lspeaker", 0.40);
- m_ym2151->add_route(1, "rspeaker", 0.40);
+ m_ym2151->add_route(0, "speaker", 0.40, 0);
+ m_ym2151->add_route(1, "speaker", 0.40, 1);
}
// DE-0359-2 + Bottom board DE-0360-4
@@ -2097,8 +2095,8 @@ void dragngun_state::dragngun(machine_config &config)
h6280_device &audiocpu(H6280(config, m_audiocpu, 32220000/8));
audiocpu.set_addrmap(AS_PROGRAM, &dragngun_state::h6280_sound_map);
- audiocpu.add_route(ALL_OUTPUTS, "lspeaker", 0); // internal sound unused
- audiocpu.add_route(ALL_OUTPUTS, "rspeaker", 0);
+ audiocpu.add_route(ALL_OUTPUTS, "speaker", 0, 0); // internal sound unused
+ audiocpu.add_route(ALL_OUTPUTS, "speaker", 0, 1);
INPUT_MERGER_ANY_HIGH(config, "irq_merger").output_handler().set_inputline("maincpu", ARM_IRQ_LINE);
@@ -2160,22 +2158,21 @@ void dragngun_state::dragngun(machine_config &config)
m_ioprot->set_interface_scramble_reverse();
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
YM2151(config, m_ym2151, 32220000/9);
m_ym2151->irq_handler().set_inputline(m_audiocpu, 1);
m_ym2151->port_write_handler().set(FUNC(deco32_state::sound_bankswitch_w));
- m_ym2151->add_route(0, "lspeaker", 0.42);
- m_ym2151->add_route(1, "rspeaker", 0.42);
+ m_ym2151->add_route(0, "speaker", 0.42, 0);
+ m_ym2151->add_route(1, "speaker", 0.42, 1);
OKIM6295(config, m_oki[0], 32220000/32, okim6295_device::PIN7_HIGH);
- m_oki[0]->add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- m_oki[0]->add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ m_oki[0]->add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ m_oki[0]->add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
OKIM6295(config, m_oki[1], 32220000/16, okim6295_device::PIN7_HIGH);
- m_oki[1]->add_route(ALL_OUTPUTS, "lspeaker", 0.35);
- m_oki[1]->add_route(ALL_OUTPUTS, "rspeaker", 0.35);
+ m_oki[1]->add_route(ALL_OUTPUTS, "speaker", 0.35, 0);
+ m_oki[1]->add_route(ALL_OUTPUTS, "speaker", 0.35, 1);
SPEAKER(config, "gun_speaker").front_center();
@@ -2294,22 +2291,21 @@ void dragngun_state::lockload(machine_config &config)
m_ioprot->set_interface_scramble_reverse();
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
YM2151(config, m_ym2151, 32220000/9);
m_ym2151->irq_handler().set("sound_irq_merger", FUNC(input_merger_any_high_device::in_w<1>));
m_ym2151->port_write_handler().set(FUNC(dragngun_state::lockload_okibank_lo_w));
- m_ym2151->add_route(0, "lspeaker", 0.42);
- m_ym2151->add_route(1, "rspeaker", 0.42);
+ m_ym2151->add_route(0, "speaker", 0.42, 0);
+ m_ym2151->add_route(1, "speaker", 0.42, 1);
OKIM6295(config, m_oki[0], 32220000/32, okim6295_device::PIN7_HIGH);
- m_oki[0]->add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- m_oki[0]->add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ m_oki[0]->add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ m_oki[0]->add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
OKIM6295(config, m_oki[1], 32220000/16, okim6295_device::PIN7_HIGH);
- m_oki[1]->add_route(ALL_OUTPUTS, "lspeaker", 0.35);
- m_oki[1]->add_route(ALL_OUTPUTS, "rspeaker", 0.35);
+ m_oki[1]->add_route(ALL_OUTPUTS, "speaker", 0.35, 0);
+ m_oki[1]->add_route(ALL_OUTPUTS, "speaker", 0.35, 1);
LC7535(config, m_vol_main);
m_vol_main->select().set_constant(1);
@@ -2371,12 +2367,11 @@ void tattass_state::tattass(machine_config &config)
m_ioprot->set_interface_scramble_interleave();
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DECOBSMT(config, m_decobsmt, 0);
- m_decobsmt->add_route(0, "lspeaker", 1.0);
- m_decobsmt->add_route(1, "rspeaker", 1.0);
+ m_decobsmt->add_route(0, "speaker", 1.0, 0);
+ m_decobsmt->add_route(1, "speaker", 1.0, 1);
}
void nslasher_state::nslasher(machine_config &config)
@@ -2442,22 +2437,21 @@ void nslasher_state::nslasher(machine_config &config)
m_ioprot->set_interface_scramble_interleave();
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
YM2151(config, m_ym2151, 32220000/9);
m_ym2151->irq_handler().set("sound_irq_merger", FUNC(input_merger_any_high_device::in_w<1>));
m_ym2151->port_write_handler().set(FUNC(deco32_state::sound_bankswitch_w));
- m_ym2151->add_route(0, "lspeaker", 0.40);
- m_ym2151->add_route(1, "rspeaker", 0.40);
+ m_ym2151->add_route(0, "speaker", 0.40, 0);
+ m_ym2151->add_route(1, "speaker", 0.40, 1);
OKIM6295(config, m_oki[0], 32220000/32, okim6295_device::PIN7_HIGH);
- m_oki[0]->add_route(ALL_OUTPUTS, "lspeaker", 0.80);
- m_oki[0]->add_route(ALL_OUTPUTS, "rspeaker", 0.80);
+ m_oki[0]->add_route(ALL_OUTPUTS, "speaker", 0.80, 0);
+ m_oki[0]->add_route(ALL_OUTPUTS, "speaker", 0.80, 1);
OKIM6295(config, m_oki[1], 32220000/16, okim6295_device::PIN7_HIGH);
- m_oki[1]->add_route(ALL_OUTPUTS, "lspeaker", 0.10);
- m_oki[1]->add_route(ALL_OUTPUTS, "rspeaker", 0.10);
+ m_oki[1]->add_route(ALL_OUTPUTS, "speaker", 0.10, 0);
+ m_oki[1]->add_route(ALL_OUTPUTS, "speaker", 0.10, 1);
}
// the US release uses a H6280 instead of a Z80, much like Lock 'n' Loaded
@@ -2468,8 +2462,8 @@ void nslasher_state::nslasheru(machine_config &config)
h6280_device &audiocpu(H6280(config, m_audiocpu, 32220000/8));
audiocpu.set_addrmap(AS_PROGRAM, &nslasher_state::h6280_sound_map);
- audiocpu.add_route(ALL_OUTPUTS, "lspeaker", 0); // internal sound unused
- audiocpu.add_route(ALL_OUTPUTS, "rspeaker", 0);
+ audiocpu.add_route(ALL_OUTPUTS, "speaker", 0, 0); // internal sound unused
+ audiocpu.add_route(ALL_OUTPUTS, "speaker", 0, 1);
config.device_remove("sound_irq_merger");
diff --git a/src/mame/dataeast/deco_ld.cpp b/src/mame/dataeast/deco_ld.cpp
index 361ef3942e6..01e63c0efde 100644
--- a/src/mame/dataeast/deco_ld.cpp
+++ b/src/mame/dataeast/deco_ld.cpp
@@ -484,8 +484,8 @@ void deco_ld_state::rblaster(machine_config &config)
SONY_LDP1000(config, m_laserdisc, 0);
m_laserdisc->set_overlay(256, 256, FUNC(deco_ld_state::screen_update));
//m_laserdisc->set_overlay_clip(0, 256-1, 8, 240-1);
- m_laserdisc->add_route(0, "lspeaker", 1.0);
- m_laserdisc->add_route(1, "rspeaker", 1.0);
+ m_laserdisc->add_route(0, "speaker", 1.0, 0);
+ m_laserdisc->add_route(1, "speaker", 1.0, 1);
/* video hardware */
m_laserdisc->add_ntsc_screen(config, "screen");
@@ -498,17 +498,16 @@ void deco_ld_state::rblaster(machine_config &config)
/* sound hardware */
// TODO: mixing with laserdisc
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, 0);
GENERIC_LATCH_8(config, m_soundlatch2);
- AY8910(config, "ay1", 1500000).add_route(ALL_OUTPUTS, "lspeaker", 0.25).add_route(ALL_OUTPUTS, "rspeaker", 0.25);
+ AY8910(config, "ay1", 1500000).add_route(ALL_OUTPUTS, "speaker", 0.25, 0).add_route(ALL_OUTPUTS, "speaker", 0.25, 1);
- AY8910(config, "ay2", 1500000).add_route(ALL_OUTPUTS, "lspeaker", 0.25).add_route(ALL_OUTPUTS, "rspeaker", 0.25);
+ AY8910(config, "ay2", 1500000).add_route(ALL_OUTPUTS, "speaker", 0.25, 0).add_route(ALL_OUTPUTS, "speaker", 0.25, 1);
}
/***************************************************************************
diff --git a/src/mame/dataeast/deco_mlc.cpp b/src/mame/dataeast/deco_mlc.cpp
index a881296639a..4b2386d96b9 100644
--- a/src/mame/dataeast/deco_mlc.cpp
+++ b/src/mame/dataeast/deco_mlc.cpp
@@ -560,12 +560,11 @@ void deco_mlc_state::avengrgs(machine_config &config)
m_palette->set_membits(16);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
YMZ280B(config, m_ymz, 42000000 / 3);
- m_ymz->add_route(0, "lspeaker", 1.0);
- m_ymz->add_route(1, "rspeaker", 1.0);
+ m_ymz->add_route(0, "speaker", 1.0, 0);
+ m_ymz->add_route(1, "speaker", 1.0, 1);
}
void deco_mlc_state::mlc(machine_config &config)
@@ -592,12 +591,11 @@ void deco_mlc_state::mlc(machine_config &config)
m_palette->set_membits(16);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
YMZ280B(config, m_ymz, 42000000 / 3);
- m_ymz->add_route(0, "lspeaker", 1.0);
- m_ymz->add_route(1, "rspeaker", 1.0);
+ m_ymz->add_route(0, "speaker", 1.0, 0);
+ m_ymz->add_route(1, "speaker", 1.0, 1);
}
void deco_mlc_state::mlc_6bpp(machine_config &config)
@@ -614,8 +612,8 @@ void deco_mlc_state::mlc_5bpp(machine_config &config)
m_gfxdecode->set_info(gfx_5bpp);
// TODO: mono? ch.0 doesn't output any sound in-game
- m_ymz->add_route(1, "lspeaker", 1.0);
- m_ymz->add_route(0, "rspeaker", 1.0);
+ m_ymz->add_route(1, "speaker", 1.0, 0);
+ m_ymz->add_route(0, "speaker", 1.0, 1);
}
void deco_mlc_state::stadhr96(machine_config &config)
diff --git a/src/mame/dataeast/funkyjet.cpp b/src/mame/dataeast/funkyjet.cpp
index 4a1912f76d0..5780b18c55c 100644
--- a/src/mame/dataeast/funkyjet.cpp
+++ b/src/mame/dataeast/funkyjet.cpp
@@ -405,8 +405,8 @@ void funkyjet_state::funkyjet(machine_config &config)
H6280(config, m_audiocpu, XTAL(32'220'000)/4); // Custom chip 45, Audio section crystal is 32.220 MHz
m_audiocpu->set_addrmap(AS_PROGRAM, &funkyjet_state::sound_map);
- m_audiocpu->add_route(ALL_OUTPUTS, "lspeaker", 0); // internal sound unused
- m_audiocpu->add_route(ALL_OUTPUTS, "rspeaker", 0);
+ m_audiocpu->add_route(ALL_OUTPUTS, "speaker", 0, 0); // internal sound unused
+ m_audiocpu->add_route(ALL_OUTPUTS, "speaker", 0, 1);
// video hardware
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
@@ -441,17 +441,16 @@ void funkyjet_state::funkyjet(machine_config &config)
DECO_SPRITE(config, m_sprgen, 0, "palette", gfx_funkyjet_spr);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2151_device &ymsnd(YM2151(config, "ymsnd", XTAL(32'220'000)/9));
ymsnd.irq_handler().set_inputline(m_audiocpu, 1); // IRQ2
- ymsnd.add_route(0, "lspeaker", 0.45);
- ymsnd.add_route(1, "rspeaker", 0.45);
+ ymsnd.add_route(0, "speaker", 0.45, 0);
+ ymsnd.add_route(1, "speaker", 0.45, 1);
okim6295_device &oki(OKIM6295(config, "oki", XTAL(28'000'000)/28, okim6295_device::PIN7_HIGH));
- oki.add_route(ALL_OUTPUTS, "lspeaker", 0.50);
- oki.add_route(ALL_OUTPUTS, "rspeaker", 0.50);
+ oki.add_route(ALL_OUTPUTS, "speaker", 0.50, 0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 0.50, 1);
}
/******************************************************************************/
diff --git a/src/mame/dataeast/lemmings.cpp b/src/mame/dataeast/lemmings.cpp
index 6a81a6be8ef..9e08988023a 100644
--- a/src/mame/dataeast/lemmings.cpp
+++ b/src/mame/dataeast/lemmings.cpp
@@ -482,19 +482,18 @@ void lemmings_state::lemmings(machine_config &config)
m_deco146->soundlatch_irq_cb().set_inputline(m_audiocpu, M6809_FIRQ_LINE);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
ym2151_device &ymsnd(YM2151(config, "ymsnd", 32.22_MHz_XTAL / 9)); // clock likely wrong
ymsnd.irq_handler().set_inputline(m_audiocpu, M6809_IRQ_LINE);
- ymsnd.add_route(0, "lspeaker", 0.45);
- ymsnd.add_route(1, "rspeaker", 0.45);
+ ymsnd.add_route(0, "speaker", 0.45, 0);
+ ymsnd.add_route(1, "speaker", 0.45, 1);
okim6295_device &oki(OKIM6295(config, "oki", 1023924, okim6295_device::PIN7_HIGH)); // clock frequency & pin 7 not verified
- oki.add_route(ALL_OUTPUTS, "lspeaker", 0.50);
- oki.add_route(ALL_OUTPUTS, "rspeaker", 0.50);
+ oki.add_route(ALL_OUTPUTS, "speaker", 0.50, 0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 0.50, 1);
}
/******************************************************************************/
diff --git a/src/mame/dataeast/rohga.cpp b/src/mame/dataeast/rohga.cpp
index 7fc8d33a3ce..f156d07eda9 100644
--- a/src/mame/dataeast/rohga.cpp
+++ b/src/mame/dataeast/rohga.cpp
@@ -873,8 +873,8 @@ void rohga_state::rohga_base(machine_config &config)
H6280(config, m_audiocpu, 32'220'000/4/3); // verified on PCB (8.050Mhz is XIN on pin 10 of H6280
m_audiocpu->set_addrmap(AS_PROGRAM, &rohga_state::sound_map);
- m_audiocpu->add_route(ALL_OUTPUTS, "lspeaker", 0); // internal sound unused
- m_audiocpu->add_route(ALL_OUTPUTS, "rspeaker", 0);
+ m_audiocpu->add_route(ALL_OUTPUTS, "speaker", 0, 0); // internal sound unused
+ m_audiocpu->add_route(ALL_OUTPUTS, "speaker", 0, 1);
// video hardware
BUFFERED_SPRITERAM16(config, m_spriteram[0]);
@@ -924,23 +924,22 @@ void rohga_state::rohga_base(machine_config &config)
m_ioprot->port_c_cb().set_ioport("DSW");
m_ioprot->soundlatch_irq_cb().set_inputline("audiocpu", 0);
- // sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ /* sound hardware */
+ SPEAKER(config, "speaker", 2).front();
ym2151_device &ymsnd(YM2151(config, "ymsnd", 32'220'000/9));
ymsnd.irq_handler().set_inputline(m_audiocpu, 1); // IRQ2
ymsnd.port_write_handler().set(FUNC(rohga_state::sound_bankswitch_w));
- ymsnd.add_route(0, "lspeaker", 0.36);
- ymsnd.add_route(1, "rspeaker", 0.36);
+ ymsnd.add_route(0, "speaker", 0.36, 0);
+ ymsnd.add_route(1, "speaker", 0.36, 1);
OKIM6295(config, m_oki[0], 32'220'000/32, okim6295_device::PIN7_HIGH);
- m_oki[0]->add_route(ALL_OUTPUTS, "lspeaker", 0.46);
- m_oki[0]->add_route(ALL_OUTPUTS, "rspeaker", 0.46);
+ m_oki[0]->add_route(ALL_OUTPUTS, "speaker", 0.46, 0);
+ m_oki[0]->add_route(ALL_OUTPUTS, "speaker", 0.46, 1);
OKIM6295(config, m_oki[1], 32'220'000/16, okim6295_device::PIN7_HIGH);
- m_oki[1]->add_route(ALL_OUTPUTS, "lspeaker", 0.18);
- m_oki[1]->add_route(ALL_OUTPUTS, "rspeaker", 0.18);
+ m_oki[1]->add_route(ALL_OUTPUTS, "speaker", 0.18, 0);
+ m_oki[1]->add_route(ALL_OUTPUTS, "speaker", 0.18, 1);
}
void rohga_state::rohga(machine_config &config)
diff --git a/src/mame/dgrm/blackt96.cpp b/src/mame/dgrm/blackt96.cpp
index 75659d0936b..f28098ff917 100644
--- a/src/mame/dgrm/blackt96.cpp
+++ b/src/mame/dgrm/blackt96.cpp
@@ -518,17 +518,16 @@ void blackt96_state::blackt96(machine_config &config)
m_sprites->set_xpos_shift(12);
m_sprites->set_color_entry_mask(0x7f);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
OKIM6295(config, m_oki[0], 8_MHz_XTAL / 8, okim6295_device::PIN7_HIGH); // music
- m_oki[0]->add_route(ALL_OUTPUTS, "lspeaker", 0.47);
- m_oki[0]->add_route(ALL_OUTPUTS, "rspeaker", 0.47);
+ m_oki[0]->add_route(ALL_OUTPUTS, "speaker", 0.47, 0);
+ m_oki[0]->add_route(ALL_OUTPUTS, "speaker", 0.47, 1);
m_oki[0]->set_addrmap(0, &blackt96_state::oki1_map);
OKIM6295(config, m_oki[1], 8_MHz_XTAL / 8, okim6295_device::PIN7_HIGH); // sfx
- m_oki[1]->add_route(ALL_OUTPUTS, "lspeaker", 0.47);
- m_oki[1]->add_route(ALL_OUTPUTS, "rspeaker", 0.47);
+ m_oki[1]->add_route(ALL_OUTPUTS, "speaker", 0.47, 0);
+ m_oki[1]->add_route(ALL_OUTPUTS, "speaker", 0.47, 1);
}
diff --git a/src/mame/dynax/realbrk.cpp b/src/mame/dynax/realbrk.cpp
index 6a3dc6e0316..1b732458063 100644
--- a/src/mame/dynax/realbrk.cpp
+++ b/src/mame/dynax/realbrk.cpp
@@ -768,16 +768,15 @@ void realbrk_state::realbrk(machine_config &config)
PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x8000);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ymz280b_device &ymz(YMZ280B(config, "ymz", XTAL(33'868'800) / 2));
- ymz.add_route(0, "lspeaker", 0.50);
- ymz.add_route(1, "rspeaker", 0.50);
+ ymz.add_route(0, "speaker", 0.50, 0);
+ ymz.add_route(1, "speaker", 0.50, 1);
ym2413_device &ymsnd(YM2413(config, "ymsnd", XTAL(3'579'545)));
- ymsnd.add_route(ALL_OUTPUTS, "lspeaker", 0.25);
- ymsnd.add_route(ALL_OUTPUTS, "rspeaker", 0.25);
+ ymsnd.add_route(ALL_OUTPUTS, "speaker", 0.25, 0);
+ ymsnd.add_route(ALL_OUTPUTS, "speaker", 0.25, 1);
}
void realbrk_state::pkgnsh(machine_config &config)
diff --git a/src/mame/edevices/mugsmash.cpp b/src/mame/edevices/mugsmash.cpp
index 39340ea95e9..71339261716 100644
--- a/src/mame/edevices/mugsmash.cpp
+++ b/src/mame/edevices/mugsmash.cpp
@@ -504,20 +504,19 @@ void mugsmash_state::mugsmash(machine_config &config)
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x300);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
ym2151_device &ymsnd(YM2151(config, "ymsnd", 3'579'545));
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
- ymsnd.add_route(0, "lspeaker", 1.00); // music
- ymsnd.add_route(1, "rspeaker", 1.00);
+ ymsnd.add_route(0, "speaker", 1.00, 0); // music
+ ymsnd.add_route(1, "speaker", 1.00, 1);
okim6295_device &oki(OKIM6295(config, "oki", 1'122'000, okim6295_device::PIN7_HIGH)); // clock frequency & pin 7 not verified
- oki.add_route(ALL_OUTPUTS, "lspeaker", 0.50); // sound fx
- oki.add_route(ALL_OUTPUTS, "rspeaker", 0.50);
+ oki.add_route(ALL_OUTPUTS, "speaker", 0.50, 0); // sound fx
+ oki.add_route(ALL_OUTPUTS, "speaker", 0.50, 1);
}
ROM_START( mugsmash )
diff --git a/src/mame/elektron/elektronmono.cpp b/src/mame/elektron/elektronmono.cpp
index 47f537c6889..a99cd3f735b 100644
--- a/src/mame/elektron/elektronmono.cpp
+++ b/src/mame/elektron/elektronmono.cpp
@@ -161,8 +161,7 @@ void elekmono_state::elektron(machine_config &config)
MCF5206E(config, m_maincpu, XTAL(25'447'000));
m_maincpu->set_addrmap(AS_PROGRAM, &elekmono_state::elektron_map);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
static INPUT_PORTS_START( elektron )
diff --git a/src/mame/ensoniq/esq1.cpp b/src/mame/ensoniq/esq1.cpp
index ce2250f0acf..34b1f951546 100644
--- a/src/mame/ensoniq/esq1.cpp
+++ b/src/mame/ensoniq/esq1.cpp
@@ -210,7 +210,7 @@ protected:
virtual void device_start() override ATTR_COLD;
// device_sound_interface 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;
private:
struct filter {
@@ -341,7 +341,7 @@ void esq1_filters::device_start()
recalc_filter(elem);
}
-void esq1_filters::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void esq1_filters::sound_stream_update(sound_stream &stream)
{
/* if(0) {
for(int i=0; i<8; i++)
@@ -353,11 +353,11 @@ void esq1_filters::sound_stream_update(sound_stream &stream, std::vector<read_st
fprintf(stderr, "\n");
}*/
- for(int i=0; i<outputs[0].samples(); i++) {
+ for(int i=0; i<stream.samples(); i++) {
double l=0, r=0;
for(int j=0; j<8; j++) {
filter &f = filters[j];
- double x = inputs[j].get(i);
+ double x = stream.get(j, i);
double y = (x*f.a[0]
+ f.x[0]*f.a[1] + f.x[1]*f.a[2] + f.x[2]*f.a[3] + f.x[3]*f.a[4]
- f.y[0]*f.b[1] - f.y[1]*f.b[2] - f.y[2]*f.b[3] - f.y[3]*f.b[4]) / f.b[0];
@@ -379,8 +379,8 @@ void esq1_filters::sound_stream_update(sound_stream &stream, std::vector<read_st
// r *= 6553;
l *= 2;
r *= 2;
- outputs[0].put_clamp(i, l, 1.0);
- outputs[1].put_clamp(i, r, 1.0);
+ stream.put_clamp(0, i, l, 1.0);
+ stream.put_clamp(1, i, r, 1.0);
}
}
@@ -631,12 +631,11 @@ void esq1_state::esq1(machine_config &config)
midiout_slot(MIDI_PORT(config, "mdout"));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ESQ1_FILTERS(config, m_filters);
- m_filters->add_route(0, "lspeaker", 1.0);
- m_filters->add_route(1, "rspeaker", 1.0);
+ m_filters->add_route(0, "speaker", 1.0, 0);
+ m_filters->add_route(1, "speaker", 1.0, 1);
ES5503(config, m_es5503, 8_MHz_XTAL);
m_es5503->set_channels(8);
diff --git a/src/mame/ensoniq/esq5505.cpp b/src/mame/ensoniq/esq5505.cpp
index e6ef200b123..3289b3b98e0 100644
--- a/src/mame/ensoniq/esq5505.cpp
+++ b/src/mame/ensoniq/esq5505.cpp
@@ -658,13 +658,12 @@ void esq5505_state::vfx(machine_config &config)
midiout_slot(MIDI_PORT(config, "mdout"));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ESQ_5505_5510_PUMP(config, m_pump, 10_MHz_XTAL / (16 * 21));
m_pump->set_esp(m_esp);
- m_pump->add_route(0, "lspeaker", 1.0);
- m_pump->add_route(1, "rspeaker", 1.0);
+ m_pump->add_route(0, "speaker", 1.0, 0);
+ m_pump->add_route(1, "speaker", 1.0, 1);
auto &es5505(ES5505(config, "otis", 10_MHz_XTAL));
es5505.sample_rate_changed().set(FUNC(esq5505_state::es5505_clock_changed));
@@ -749,13 +748,12 @@ void esq5505_state::vfx32(machine_config &config)
midiout_slot(MIDI_PORT(config, "mdout"));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ESQ_5505_5510_PUMP(config, m_pump, 30.47618_MHz_XTAL / (2 * 16 * 32));
m_pump->set_esp(m_esp);
- m_pump->add_route(0, "lspeaker", 1.0);
- m_pump->add_route(1, "rspeaker", 1.0);
+ m_pump->add_route(0, "speaker", 1.0, 0);
+ m_pump->add_route(1, "speaker", 1.0, 1);
auto &es5505(ES5505(config, "otis", 30.47618_MHz_XTAL / 2));
es5505.sample_rate_changed().set(FUNC(esq5505_state::es5505_clock_changed));
diff --git a/src/mame/ensoniq/esqasr.cpp b/src/mame/ensoniq/esqasr.cpp
index 9236473cdf6..c891449183a 100644
--- a/src/mame/ensoniq/esqasr.cpp
+++ b/src/mame/ensoniq/esqasr.cpp
@@ -130,13 +130,12 @@ void esqasr_state::asr(machine_config &config)
ESQ2X40_SQ1(config, m_sq1vfd, 60);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ESQ_5505_5510_PUMP(config, m_pump, XTAL(16'000'000) / (16 * 32));
m_pump->set_esp(m_esp);
- m_pump->add_route(0, "lspeaker", 1.0);
- m_pump->add_route(1, "rspeaker", 1.0);
+ m_pump->add_route(0, "speaker", 1.0, 0);
+ m_pump->add_route(1, "speaker", 1.0, 1);
es5506_device &ensoniq(ES5506(config, "ensoniq", XTAL(16'000'000)));
ensoniq.sample_rate_changed().set(FUNC(esqasr_state::es5506_clock_changed));
@@ -167,13 +166,12 @@ void esqasr_state::asrx(machine_config &config)
ESQ2X40_SQ1(config, m_sq1vfd, 60);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ESQ_5505_5510_PUMP(config, m_pump, XTAL(16'000'000) / (16 * 32)); // Actually ES5511
m_pump->set_esp(m_esp);
- m_pump->add_route(0, "lspeaker", 1.0);
- m_pump->add_route(1, "rspeaker", 1.0);
+ m_pump->add_route(0, "speaker", 1.0, 0);
+ m_pump->add_route(1, "speaker", 1.0, 1);
es5506_device &ensoniq(ES5506(config, "ensoniq", XTAL(16'000'000)));
ensoniq.sample_rate_changed().set(FUNC(esqasr_state::es5506_clock_changed));
diff --git a/src/mame/ensoniq/esqkt.cpp b/src/mame/ensoniq/esqkt.cpp
index 647f7fbaacd..6b69a19443c 100644
--- a/src/mame/ensoniq/esqkt.cpp
+++ b/src/mame/ensoniq/esqkt.cpp
@@ -273,13 +273,12 @@ void esqkt_state::kt(machine_config &config)
midiout_slot(MIDI_PORT(config, "mdout"));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ESQ_5505_5510_PUMP(config, m_pump, 16_MHz_XTAL / (16 * 32));
m_pump->set_esp(m_esp);
- m_pump->add_route(0, "lspeaker", 1.0);
- m_pump->add_route(1, "rspeaker", 1.0);
+ m_pump->add_route(0, "speaker", 1.0, 0);
+ m_pump->add_route(1, "speaker", 1.0, 1);
auto &es5506a(ES5506(config, "ensoniq1", 16_MHz_XTAL));
es5506a.sample_rate_changed().set(FUNC(esqkt_state::es5506_clock_changed)); // TODO : Sync with 2 chips?
@@ -305,14 +304,14 @@ void esqkt_state::kt(machine_config &config)
es5506b.set_region2("waverom3"); /* Bank 0 */
es5506b.set_region3("waverom4"); /* Bank 1 */
es5506b.set_channels(4); /* channels */
- es5506b.add_route(0, "lspeaker", 1.0);
- es5506b.add_route(1, "rspeaker", 1.0);
- es5506b.add_route(2, "lspeaker", 1.0);
- es5506b.add_route(3, "rspeaker", 1.0);
- es5506b.add_route(4, "lspeaker", 1.0);
- es5506b.add_route(5, "rspeaker", 1.0);
- es5506b.add_route(6, "lspeaker", 1.0);
- es5506b.add_route(7, "rspeaker", 1.0);
+ es5506b.add_route(0, "speaker", 1.0, 0);
+ es5506b.add_route(1, "speaker", 1.0, 1);
+ es5506b.add_route(2, "speaker", 1.0, 0);
+ es5506b.add_route(3, "speaker", 1.0, 1);
+ es5506b.add_route(4, "speaker", 1.0, 0);
+ es5506b.add_route(5, "speaker", 1.0, 1);
+ es5506b.add_route(6, "speaker", 1.0, 0);
+ es5506b.add_route(7, "speaker", 1.0, 1);
}
void esqkt_state::ts(machine_config &config)
@@ -338,13 +337,12 @@ void esqkt_state::ts(machine_config &config)
midiout_slot(MIDI_PORT(config, "mdout"));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ESQ_5505_5510_PUMP(config, m_pump, 16_MHz_XTAL / (16 * 32));
m_pump->set_esp(m_esp);
- m_pump->add_route(0, "lspeaker", 1.0);
- m_pump->add_route(1, "rspeaker", 1.0);
+ m_pump->add_route(0, "speaker", 1.0, 0);
+ m_pump->add_route(1, "speaker", 1.0, 1);
auto &es5506a(ES5506(config, "ensoniq", 16_MHz_XTAL));
es5506a.sample_rate_changed().set(FUNC(esqkt_state::es5506_clock_changed));
diff --git a/src/mame/ensoniq/esqmr.cpp b/src/mame/ensoniq/esqmr.cpp
index 5a20eb7c03b..7d0c374393f 100644
--- a/src/mame/ensoniq/esqmr.cpp
+++ b/src/mame/ensoniq/esqmr.cpp
@@ -290,8 +290,7 @@ void esqmr_state::mr(machine_config &config)
ESQPANEL2X40_VFX(config, m_panel);
m_panel->write_tx().set(duart, FUNC(mc68340_serial_module_device::rx_b_w));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
es5506_device &ensoniq(ES5506(config, "ensoniq", XTAL(16'000'000)));
ensoniq.set_region0("waverom"); /* Bank 0 */
@@ -301,8 +300,8 @@ void esqmr_state::mr(machine_config &config)
ensoniq.set_channels(1);
ensoniq.irq_cb().set(FUNC(esqmr_state::esq5506_otto_irq)); /* irq */
ensoniq.read_port_cb().set(FUNC(esqmr_state::esq5506_read_adc));
- ensoniq.add_route(0, "lspeaker", 0.5);
- ensoniq.add_route(1, "rspeaker", 0.5);
+ ensoniq.add_route(0, "speaker", 0.5, 0);
+ ensoniq.add_route(1, "speaker", 0.5, 1);
es5506_device &ensoniq2(ES5506(config, "ensoniq2", XTAL(16'000'000)));
ensoniq2.set_region0("waverom"); /* Bank 0 */
@@ -310,8 +309,8 @@ void esqmr_state::mr(machine_config &config)
ensoniq2.set_region2("waverom3"); /* Bank 0 */
ensoniq2.set_region3("waverom4"); /* Bank 1 */
ensoniq2.set_channels(1);
- ensoniq2.add_route(0, "lspeaker", 0.5);
- ensoniq2.add_route(1, "rspeaker", 0.5);
+ ensoniq2.add_route(0, "speaker", 0.5, 0);
+ ensoniq2.add_route(1, "speaker", 0.5, 1);
}
static INPUT_PORTS_START( mr )
diff --git a/src/mame/enterprise/dave.cpp b/src/mame/enterprise/dave.cpp
index b84ba6cf8ff..0528f7ecd6e 100644
--- a/src/mame/enterprise/dave.cpp
+++ b/src/mame/enterprise/dave.cpp
@@ -192,7 +192,7 @@ device_memory_interface::space_config_vector dave_device::memory_space_config()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void dave_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void dave_device::sound_stream_update(sound_stream &stream)
{
/* 0 = channel 0 left volume, 1 = channel 0 right volume,
2 = channel 1 left volume, 3 = channel 1 right volume,
@@ -204,10 +204,7 @@ void dave_device::sound_stream_update(sound_stream &stream, std::vector<read_str
//logerror("sound update!\n");
- auto &buffer1 = outputs[0];
- auto &buffer2 = outputs[1];
-
- for (int sampindex = 0; sampindex < buffer1.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
int vol[4];
@@ -265,8 +262,8 @@ void dave_device::sound_stream_update(sound_stream &stream, std::vector<read_str
left_volume = output_volumes[0] + output_volumes[2] + output_volumes[4] + output_volumes[6];
right_volume = output_volumes[1] + output_volumes[3] + output_volumes[5] + output_volumes[7];
- buffer1.put_int(sampindex, left_volume, 32768 * 4);
- buffer2.put_int(sampindex, right_volume, 32768 * 4);
+ stream.put_int(0, sampindex, left_volume, 32768 * 4);
+ stream.put_int(1, sampindex, right_volume, 32768 * 4);
}
}
diff --git a/src/mame/enterprise/dave.h b/src/mame/enterprise/dave.h
index e5f6469da9a..04bd467cc80 100644
--- a/src/mame/enterprise/dave.h
+++ b/src/mame/enterprise/dave.h
@@ -48,7 +48,7 @@ protected:
virtual space_config_vector memory_space_config() const override;
// sound stream update implentation
- 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;
TIMER_CALLBACK_MEMBER(update_1hz_timer);
TIMER_CALLBACK_MEMBER(update_50hz_timer);
diff --git a/src/mame/enterprise/ep64.cpp b/src/mame/enterprise/ep64.cpp
index e06a3dfff9e..c660a3b2c5e 100644
--- a/src/mame/enterprise/ep64.cpp
+++ b/src/mame/enterprise/ep64.cpp
@@ -594,15 +594,14 @@ void ep64_state::ep64(machine_config &config)
m_nick->virq_wr_callback().set(m_dave, FUNC(dave_device::int1_w));
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DAVE(config, m_dave, XTAL(8'000'000));
m_dave->set_addrmap(AS_PROGRAM, &ep64_state::dave_64k_mem);
m_dave->set_addrmap(AS_IO, &ep64_state::dave_io);
m_dave->irq_wr().set_inputline(Z80_TAG, INPUT_LINE_IRQ0);
- m_dave->add_route(0, "lspeaker", 0.25);
- m_dave->add_route(1, "rspeaker", 0.25);
+ m_dave->add_route(0, "speaker", 0.25, 0);
+ m_dave->add_route(1, "speaker", 0.25, 1);
// devices
EP64_EXPANSION_BUS_SLOT(config, m_exp, nullptr);
@@ -623,12 +622,12 @@ void ep64_state::ep64(machine_config &config)
CASSETTE(config, m_cassette1);
m_cassette1->set_default_state(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED);
m_cassette1->set_interface("ep64_cass");
- m_cassette1->add_route(ALL_OUTPUTS, "lspeaker", 0.05);
+ m_cassette1->add_route(ALL_OUTPUTS, "speaker", 0.05, 0);
CASSETTE(config, m_cassette2);
m_cassette2->set_default_state(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED);
m_cassette2->set_interface("ep64_cass");
- m_cassette2->add_route(ALL_OUTPUTS, "rspeaker", 0.05);
+ m_cassette2->add_route(ALL_OUTPUTS, "speaker", 0.05, 1);
// internal RAM
RAM(config, m_ram).set_default_size("64K");
diff --git a/src/mame/eolith/eolith.cpp b/src/mame/eolith/eolith.cpp
index bd190b53000..e3ad5150b1e 100644
--- a/src/mame/eolith/eolith.cpp
+++ b/src/mame/eolith/eolith.cpp
@@ -723,8 +723,7 @@ void eolith_state::eolith45(machine_config &config)
PALETTE(config, m_palette, palette_device::RGB_555);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, "soundlatch").data_pending_callback().set_inputline(m_soundcpu, MCS51_INT0_LINE);
@@ -733,8 +732,8 @@ void eolith_state::eolith45(machine_config &config)
m_qs1000->p1_in().set(FUNC(eolith_state::qs1000_p1_r));
m_qs1000->p1_out().set(FUNC(eolith_state::qs1000_p1_w));
m_qs1000->p3_in().set(FUNC(eolith_state::qs1000_p3_r));
- m_qs1000->add_route(0, "lspeaker", 1.0);
- m_qs1000->add_route(1, "rspeaker", 1.0);
+ m_qs1000->add_route(0, "speaker", 1.0, 0);
+ m_qs1000->add_route(1, "speaker", 1.0, 1);
}
void eolith_state::eolith50(machine_config &config)
diff --git a/src/mame/eolith/eolith16.cpp b/src/mame/eolith/eolith16.cpp
index adb080791ad..fd144026520 100644
--- a/src/mame/eolith/eolith16.cpp
+++ b/src/mame/eolith/eolith16.cpp
@@ -185,12 +185,11 @@ void eolith16_state::eolith16(machine_config &config)
PALETTE(config, "palette", FUNC(eolith16_state::eolith16_palette), 256);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
okim6295_device &oki(OKIM6295(config, "oki", XTAL(1'000'000), okim6295_device::PIN7_HIGH));
- oki.add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- oki.add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
}
/*
diff --git a/src/mame/eolith/ghosteo.cpp b/src/mame/eolith/ghosteo.cpp
index 3a32bb47822..db8076bba17 100644
--- a/src/mame/eolith/ghosteo.cpp
+++ b/src/mame/eolith/ghosteo.cpp
@@ -647,8 +647,7 @@ void ghosteo_state::ghosteo(machine_config &config)
I2C_24C16(config, "i2cmem", 0); // M24CL16-S
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set(m_qs1000, FUNC(qs1000_device::set_irq));
@@ -660,8 +659,8 @@ void ghosteo_state::ghosteo(machine_config &config)
m_qs1000->p1_out().set(FUNC(ghosteo_state::qs1000_p1_w));
m_qs1000->p2_out().set(FUNC(ghosteo_state::qs1000_p2_w));
m_qs1000->p3_out().set(FUNC(ghosteo_state::qs1000_p3_w));
- m_qs1000->add_route(0, "lspeaker", 1.0);
- m_qs1000->add_route(1, "rspeaker", 1.0);
+ m_qs1000->add_route(0, "speaker", 1.0, 0);
+ m_qs1000->add_route(1, "speaker", 1.0, 1);
}
void ghosteo_state::bballoon(machine_config &config)
diff --git a/src/mame/eolith/vegaeo.cpp b/src/mame/eolith/vegaeo.cpp
index d916f5f4619..68280ce3498 100644
--- a/src/mame/eolith/vegaeo.cpp
+++ b/src/mame/eolith/vegaeo.cpp
@@ -203,8 +203,7 @@ void vegaeo_state::vega(machine_config &config)
m_palette->set_membits(16);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set("qs1000", FUNC(qs1000_device::set_irq));
@@ -216,8 +215,8 @@ void vegaeo_state::vega(machine_config &config)
m_qs1000->p1_out().set(FUNC(vegaeo_state::qs1000_p1_w));
m_qs1000->p2_out().set(FUNC(vegaeo_state::qs1000_p2_w));
m_qs1000->p3_out().set(FUNC(vegaeo_state::qs1000_p3_w));
- m_qs1000->add_route(0, "lspeaker", 1.0);
- m_qs1000->add_route(1, "rspeaker", 1.0);
+ m_qs1000->add_route(0, "speaker", 1.0, 0);
+ m_qs1000->add_route(1, "speaker", 1.0, 1);
}
/*
diff --git a/src/mame/excellent/aquarium.cpp b/src/mame/excellent/aquarium.cpp
index b1de277ca88..28c4c80eeb5 100644
--- a/src/mame/excellent/aquarium.cpp
+++ b/src/mame/excellent/aquarium.cpp
@@ -444,8 +444,7 @@ void aquarium_state::aquarium(machine_config &config)
m_sprgen->set_colpri_callback(FUNC(aquarium_state::aquarium_colpri_cb));
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
@@ -453,12 +452,12 @@ void aquarium_state::aquarium(machine_config &config)
ym2151_device &ymsnd(YM2151(config, "ymsnd", XTAL(14'318'181) / 4)); // clock not verified on PCB
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
- ymsnd.add_route(0, "lspeaker", 0.45);
- ymsnd.add_route(1, "rspeaker", 0.45);
+ ymsnd.add_route(0, "speaker", 0.45, 0);
+ ymsnd.add_route(1, "speaker", 0.45, 1);
OKIM6295(config, m_oki, XTAL(1'056'000), okim6295_device::PIN7_HIGH); // pin 7 not verified
- m_oki->add_route(ALL_OUTPUTS, "lspeaker", 0.47);
- m_oki->add_route(ALL_OUTPUTS, "rspeaker", 0.47);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 0.47, 0);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 0.47, 1);
}
ROM_START( aquarium )
diff --git a/src/mame/excellent/es9501.cpp b/src/mame/excellent/es9501.cpp
index 782e4688ab8..627d5675102 100644
--- a/src/mame/excellent/es9501.cpp
+++ b/src/mame/excellent/es9501.cpp
@@ -166,16 +166,15 @@ void es9501_state::es9501(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_es9501);
PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 0x1000 / 2); // TODO
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ymz280b_device &ymz(YMZ280B(config, "ymz", 28.636363_MHz_XTAL / 2));
- ymz.add_route(0, "lspeaker", 1.0);
- ymz.add_route(1, "rspeaker", 1.0);
+ ymz.add_route(0, "speaker", 1.0, 0);
+ ymz.add_route(1, "speaker", 1.0, 1);
ymz284_device & ymz284(YMZ284(config, "ymz284", 28.636363_MHz_XTAL / 8)); // divider not verified
- ymz284.add_route(0, "lspeaker", 1.0);
- ymz284.add_route(1, "rspeaker", 1.0);
+ ymz284.add_route(0, "speaker", 1.0, 0);
+ ymz284.add_route(1, "speaker", 1.0, 1);
}
diff --git a/src/mame/exidy/exidy440.cpp b/src/mame/exidy/exidy440.cpp
index 4b7685952e0..f9e75a6ed3a 100644
--- a/src/mame/exidy/exidy440.cpp
+++ b/src/mame/exidy/exidy440.cpp
@@ -1005,12 +1005,11 @@ void exidy440_state::exidy440(machine_config &config)
exidy440_video(config);
/* audio hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
EXIDY440(config, m_custom, EXIDY440_MC3418_CLOCK);
- m_custom->add_route(0, "lspeaker", 1.0);
- m_custom->add_route(1, "rspeaker", 1.0);
+ m_custom->add_route(0, "speaker", 1.0, 0);
+ m_custom->add_route(1, "speaker", 1.0, 1);
}
diff --git a/src/mame/exidy/exidy440_a.cpp b/src/mame/exidy/exidy440_a.cpp
index 0ad11f3cfd5..127e6d49be2 100644
--- a/src/mame/exidy/exidy440_a.cpp
+++ b/src/mame/exidy/exidy440_a.cpp
@@ -82,10 +82,10 @@ void exidy440_sound_device::device_add_mconfig(machine_config &config)
MC6809(config, m_audiocpu, EXIDY440_AUDIO_CLOCK);
m_audiocpu->set_addrmap(AS_PROGRAM, &exidy440_sound_device::exidy440_audio_map);
-// MC3418(config, "cvsd1", EXIDY440_MC3418_CLOCK).add_route(ALL_OUTPUTS, "lspeaker", 1.0);
-// MC3418(config, "cvsd2", EXIDY440_MC3418_CLOCK).add_route(ALL_OUTPUTS, "rspeaker", 1.0);
-// MC3417(config, "cvsd3", EXIDY440_MC3417_CLOCK).add_route(ALL_OUTPUTS, "lspeaker", 1.0);
-// MC3417(config, "cvsd4", EXIDY440_MC3417_CLOCK).add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+// MC3418(config, "cvsd1", EXIDY440_MC3418_CLOCK).add_route(ALL_OUTPUTS, "speaker", 1.0);
+// MC3418(config, "cvsd2", EXIDY440_MC3418_CLOCK).add_route(ALL_OUTPUTS, "speaker", 1.0);
+// MC3417(config, "cvsd3", EXIDY440_MC3417_CLOCK).add_route(ALL_OUTPUTS, "speaker", 1.0);
+// MC3417(config, "cvsd4", EXIDY440_MC3417_CLOCK).add_route(ALL_OUTPUTS, "speaker", 1.0);
}
//-------------------------------------------------
@@ -205,15 +205,15 @@ void exidy440_sound_device::add_and_scale_samples(int ch, int32_t *dest, int sam
*
*************************************/
-void exidy440_sound_device::mix_to_16(write_stream_view &dest_left, write_stream_view &dest_right)
+void exidy440_sound_device::mix_to_16(sound_stream &stream)
{
int32_t *mixer_left = &m_mixer_buffer_left[0];
int32_t *mixer_right = &m_mixer_buffer_right[0];
- for (int i = 0; i < dest_left.samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
- dest_left.put_int_clamp(i, *mixer_left++, 32768);
- dest_right.put_int_clamp(i, *mixer_right++, 32768);
+ stream.put_int_clamp(0, i, *mixer_left++, 32768);
+ stream.put_int_clamp(1, i, *mixer_right++, 32768);
}
}
@@ -789,17 +789,17 @@ void exidy440_sound_device::sound_banks_w(offs_t offset, uint8_t data)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void exidy440_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void exidy440_sound_device::sound_stream_update(sound_stream &stream)
{
/* reset the mixer buffers */
- std::fill_n(&m_mixer_buffer_left[0], outputs[0].samples(), 0);
- std::fill_n(&m_mixer_buffer_right[0], outputs[0].samples(), 0);
+ std::fill_n(&m_mixer_buffer_left[0], stream.samples(), 0);
+ std::fill_n(&m_mixer_buffer_right[0], stream.samples(), 0);
/* loop over channels */
for (int ch = 0; ch < 4; ch++)
{
sound_channel_data *channel = &m_sound_channel[ch];
- int length, volume, left = outputs[0].samples();
+ int length, volume, left = stream.samples();
int effective_offset;
/* if we're not active, bail */
@@ -837,5 +837,5 @@ void exidy440_sound_device::sound_stream_update(sound_stream &stream, std::vecto
}
/* all done, time to mix it */
- mix_to_16(outputs[0], outputs[1]);
+ mix_to_16(stream);
}
diff --git a/src/mame/exidy/exidy440_a.h b/src/mame/exidy/exidy440_a.h
index 4a27c9b1ab5..3f25bd7d451 100644
--- a/src/mame/exidy/exidy440_a.h
+++ b/src/mame/exidy/exidy440_a.h
@@ -29,7 +29,7 @@ protected:
virtual void device_stop() 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;
private:
void exidy440_audio_map(address_map &map) ATTR_COLD;
@@ -104,7 +104,7 @@ private:
void fir_filter(int32_t *input, int16_t *output, int count);
void add_and_scale_samples(int ch, int32_t *dest, int samples, int volume);
- void mix_to_16(write_stream_view &dest_left, write_stream_view &dest_right);
+ void mix_to_16(sound_stream &stream);
uint8_t sound_command_r();
uint8_t sound_volume_r(offs_t offset);
diff --git a/src/mame/exidy/starfire.cpp b/src/mame/exidy/starfire.cpp
index a89fd18205c..6b84e897667 100644
--- a/src/mame/exidy/starfire.cpp
+++ b/src/mame/exidy/starfire.cpp
@@ -419,13 +419,12 @@ void fireone_state::fireone(machine_config &config)
m_pit->out_handler<2>().set(FUNC(fireone_state::music_c_out_cb));
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
NETLIST_SOUND(config, "sound_nl", 48000)
.set_source(NETLIST_NAME(fireone))
- .add_route(0, "lspeaker", 1.0)
- .add_route(1, "rspeaker", 1.0);
+ .add_route(0, "speaker", 1.0, 0)
+ .add_route(1, "speaker", 1.0, 1);
NETLIST_LOGIC_INPUT(config, "sound_nl:ltorp", "LTORP.IN", 0);
NETLIST_LOGIC_INPUT(config, "sound_nl:lshpht", "LSHPHT.IN", 0);
diff --git a/src/mame/exidy/vertigo.cpp b/src/mame/exidy/vertigo.cpp
index 60558f6b0bf..5ebc8d371ac 100644
--- a/src/mame/exidy/vertigo.cpp
+++ b/src/mame/exidy/vertigo.cpp
@@ -119,12 +119,11 @@ void vertigo_state::vertigo(machine_config &config)
m_adc->in_callback<2>().set_ioport("PADDLE");
// IN3-IN7 tied to Vss
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
EXIDY440(config, m_custom, EXIDY440_MC3418_CLOCK);
- m_custom->add_route(0, "lspeaker", 1.0);
- m_custom->add_route(1, "rspeaker", 1.0);
+ m_custom->add_route(0, "speaker", 1.0, 0);
+ m_custom->add_route(1, "speaker", 1.0, 1);
pit8254_device &pit(PIT8254(config, "pit", 0));
pit.set_clk<0>(24_MHz_XTAL / 100);
diff --git a/src/mame/f32/f-32.cpp b/src/mame/f32/f-32.cpp
index 901b6d980d5..4a8d01fd0c2 100644
--- a/src/mame/f32/f-32.cpp
+++ b/src/mame/f32/f-32.cpp
@@ -262,16 +262,15 @@ void mosaicf2_state::mosaicf2(machine_config &config)
PALETTE(config, "palette", palette_device::RGB_555);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2151_device &ymsnd(YM2151(config, "ymsnd", XTAL(14'318'181)/4)); /* 3.579545 MHz */
- ymsnd.add_route(0, "lspeaker", 1.0);
- ymsnd.add_route(1, "rspeaker", 1.0);
+ ymsnd.add_route(0, "speaker", 1.0, 0);
+ ymsnd.add_route(1, "speaker", 1.0, 1);
okim6295_device &oki(OKIM6295(config, "oki", XTAL(14'318'181)/8, okim6295_device::PIN7_HIGH)); /* 1.7897725 MHz */
- oki.add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- oki.add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
}
@@ -484,17 +483,16 @@ void royalpk2_state::royalpk2(machine_config &config)
PALETTE(config, "palette", palette_device::RGB_555);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
// ym2151_device &ymsnd(YM2151(config, "ymsnd", XTAL(14'318'181)/4)); /* 3.579545 MHz */
-// ymsnd.add_route(0, "lspeaker", 1.0);
-// ymsnd.add_route(1, "rspeaker", 1.0);
+// ymsnd.add_route(0, "speaker", 1.0);
+// ymsnd.add_route(1, "speaker", 1.0);
okim6295_device &oki(OKIM6295(config, "oki", XTAL(14'318'181)/8, okim6295_device::PIN7_HIGH)); /* 1.7897725 MHz */
oki.set_addrmap(0, &royalpk2_state::oki_map);
- oki.add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- oki.add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
// there is a 16c550 for communication
}
diff --git a/src/mame/fairchild/channelf_a.cpp b/src/mame/fairchild/channelf_a.cpp
index bd1dbe765f1..5ba7aa5c81e 100644
--- a/src/mame/fairchild/channelf_a.cpp
+++ b/src/mame/fairchild/channelf_a.cpp
@@ -70,15 +70,13 @@ void channelf_sound_device::device_start()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void channelf_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void channelf_sound_device::sound_stream_update(sound_stream &stream)
{
uint32_t mask = 0, target = 0;
- auto &buffer = outputs[0];
switch( m_sound_mode )
{
case 0: /* sound off */
- buffer.fill(0);
return;
case 1: /* high tone (2V) - 1000Hz */
@@ -95,12 +93,12 @@ void channelf_sound_device::sound_stream_update(sound_stream &stream, std::vecto
break;
}
- for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
if ((m_forced_ontime > 0) || ((m_sample_counter & mask) == target)) // change made for improved sound
- buffer.put_int(sampindex, m_envelope, 32768);
+ stream.put_int(0, sampindex, m_envelope, 32768);
else
- buffer.put(sampindex, 0);
+ stream.put(1, sampindex, 0);
m_sample_counter += m_incr;
m_envelope *= m_decay_mult;
if (m_forced_ontime > 0) // added for improved sound
diff --git a/src/mame/fairchild/channelf_a.h b/src/mame/fairchild/channelf_a.h
index d6784ede335..b74b787bdb5 100644
--- a/src/mame/fairchild/channelf_a.h
+++ b/src/mame/fairchild/channelf_a.h
@@ -20,7 +20,7 @@ protected:
virtual void device_start() 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;
private:
// internal state
sound_stream *m_channel;
diff --git a/src/mame/fairlight/cmi01a.cpp b/src/mame/fairlight/cmi01a.cpp
index 59f1663efd4..4754509c5dc 100644
--- a/src/mame/fairlight/cmi01a.cpp
+++ b/src/mame/fairlight/cmi01a.cpp
@@ -211,13 +211,11 @@ void cmi01a_device::device_reset()
update_filters();
}
-void cmi01a_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void cmi01a_device::sound_stream_update(sound_stream &stream)
{
if (m_run)
{
- auto &buf = outputs[0];
-
- for (int sampindex = 0; sampindex < buf.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
double sample = s8(m_current_sample ^ 0x80); // -128..127
double hbn = (sample + 2*m_ha0 + m_ha1 - m_ka1 * m_hb0 - m_ka2 * m_hb1) / m_ka0;
@@ -231,7 +229,7 @@ void cmi01a_device::sound_stream_update(sound_stream &stream, std::vector<read_s
double env = (m_env == 0) ? 0.0 : hbn * m_env; // -32768..32767 (guard against ∞ × 0 → NaN)
double vol = env * m_vol_latch; // -8388608..8388607
- buf.put(sampindex, vol / 8388608);
+ stream.put(0, sampindex, vol / 8388608);
}
}
else
@@ -239,7 +237,6 @@ void cmi01a_device::sound_stream_update(sound_stream &stream, std::vector<read_s
m_ha0 = m_ha1 = 0;
m_hb0 = m_hb1 = 0;
m_hc0 = m_hc1 = 0;
- outputs[0].fill(0);
}
}
diff --git a/src/mame/fairlight/cmi01a.h b/src/mame/fairlight/cmi01a.h
index 0531b3106d8..8cb5e26819e 100644
--- a/src/mame/fairlight/cmi01a.h
+++ b/src/mame/fairlight/cmi01a.h
@@ -28,7 +28,7 @@ public:
void write(offs_t offset, u8 data);
u8 read(offs_t offset);
- 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 set_master_osc(double mosc) { m_mosc = mosc; }
diff --git a/src/mame/fujitsu/fmtowns.cpp b/src/mame/fujitsu/fmtowns.cpp
index a6c03eddf5a..84adf9ffd3c 100644
--- a/src/mame/fujitsu/fmtowns.cpp
+++ b/src/mame/fujitsu/fmtowns.cpp
@@ -2607,34 +2607,33 @@ void towns_state::towns_base(machine_config &config)
PALETTE(config, m_palette16[1]).set_entries(16);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym3438_device &fm(YM3438(config, "fm", 16000000 / 2)); // actual clock speed unknown
fm.irq_handler().set(FUNC(towns_state::towns_fm_irq));
- fm.add_route(0, "lspeaker", 1.00);
- fm.add_route(1, "rspeaker", 1.00);
+ fm.add_route(0, "speaker", 1.00, 0);
+ fm.add_route(1, "speaker", 1.00, 1);
/*
// Later model uses YMF276 for FM
ymf276_device &fm(YMF276(config, "fm", 16000000 / 2)); // actual clock speed unknown
fm.irq_handler().set(FUNC(towns_state::towns_fm_irq));
- fm.add_route(0, "lspeaker", 1.00);
- fm.add_route(1, "rspeaker", 1.00);
+ fm.add_route(0, "speaker", 1.00);
+ fm.add_route(1, "speaker", 1.00);
*/
rf5c68_device &pcm(RF5C68(config, "pcm", 16000000 / 2)); // actual clock speed unknown
pcm.set_end_callback(FUNC(towns_state::towns_pcm_irq));
pcm.set_addrmap(0, &towns_state::pcm_mem);
- pcm.add_route(0, "lspeaker", 1.00);
- pcm.add_route(1, "rspeaker", 1.00);
+ pcm.add_route(0, "speaker", 1.00, 0);
+ pcm.add_route(1, "speaker", 1.00, 1);
CDDA(config, m_cdda);
- m_cdda->add_route(0, "lspeaker", 0.30);
- m_cdda->add_route(1, "rspeaker", 0.30);
+ m_cdda->add_route(0, "speaker", 0.30, 0);
+ m_cdda->add_route(1, "speaker", 0.30, 1);
SPEAKER_SOUND(config, m_speaker);
- m_speaker->add_route(ALL_OUTPUTS, "lspeaker", 0.50);
- m_speaker->add_route(ALL_OUTPUTS, "rspeaker", 0.50);
+ m_speaker->add_route(ALL_OUTPUTS, "speaker", 0.50, 0);
+ m_speaker->add_route(ALL_OUTPUTS, "speaker", 0.50, 1);
PIT8253(config, m_pit, 0);
m_pit->set_clk<0>(307200);
diff --git a/src/mame/fujitsu/fmtowns.h b/src/mame/fujitsu/fmtowns.h
index 90cc3861eee..f498c467bf8 100644
--- a/src/mame/fujitsu/fmtowns.h
+++ b/src/mame/fujitsu/fmtowns.h
@@ -102,7 +102,7 @@ public:
, m_scsi(*this, "fmscsi")
, m_flop(*this, "fdc:%u", 0U)
, m_pad_ports(*this, "pad%u", 1U)
- , m_speaker(*this, "speaker")
+ , m_speaker(*this, "speaker_sound")
, m_pic_master(*this, "pic8259_master")
, m_pic_slave(*this, "pic8259_slave")
, m_pit(*this, "pit")
diff --git a/src/mame/funtech/supracan.cpp b/src/mame/funtech/supracan.cpp
index 4757c11be54..a9aa0d23c64 100644
--- a/src/mame/funtech/supracan.cpp
+++ b/src/mame/funtech/supracan.cpp
@@ -2411,16 +2411,15 @@ void supracan_state::supracan(machine_config &config)
GFXDECODE(config, m_gfxdecode, "palette", gfx_supracan);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
// TODO: derive and verify from U13_CLOCK
UMC6619_SOUND(config, m_sound, XTAL(3'579'545));
m_sound->ram_read().set(FUNC(supracan_state::sound_ram_read));
m_sound->timer_irq_handler().set(FUNC(supracan_state::sound_timer_irq));
m_sound->dma_irq_handler().set(FUNC(supracan_state::sound_dma_irq));
- m_sound->add_route(0, "lspeaker", 1.0);
- m_sound->add_route(1, "rspeaker", 1.0);
+ m_sound->add_route(0, "speaker", 1.0, 0);
+ m_sound->add_route(1, "speaker", 1.0, 1);
// TODO: clock for cart is (again) unconfirmed
SUPERACAN_CART_SLOT(config, m_cart, U13_CLOCK / 6, superacan_cart_types, nullptr).set_must_be_loaded(true);
diff --git a/src/mame/funtech/umc6619_sound.cpp b/src/mame/funtech/umc6619_sound.cpp
index 4f8c19f3d51..426767489eb 100644
--- a/src/mame/funtech/umc6619_sound.cpp
+++ b/src/mame/funtech/umc6619_sound.cpp
@@ -132,9 +132,9 @@ std::string umc6619_sound_device::print_audio_state()
return outbuffer.str();
}
-void umc6619_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void umc6619_sound_device::sound_stream_update(sound_stream &stream)
{
- std::fill_n(&m_mix[0], outputs[0].samples() * 2, 0);
+ std::fill_n(&m_mix[0], stream.samples() * 2, 0);
if (LIVE_AUDIO_VIEW)
popmessage(print_audio_state());
@@ -146,7 +146,7 @@ void umc6619_sound_device::sound_stream_update(sound_stream &stream, std::vector
acan_channel &channel = m_channels[i];
int32_t *mixp = &m_mix[0];
- for (int s = 0; s < outputs[0].samples(); s++)
+ for (int s = 0; s < stream.samples(); s++)
{
uint8_t data = m_ram_read(channel.curr_addr) + 0x80;
int16_t sample = (int16_t)(data << 8);
@@ -179,10 +179,10 @@ void umc6619_sound_device::sound_stream_update(sound_stream &stream, std::vector
}
int32_t *mixp = &m_mix[0];
- for (int i = 0; i < outputs[0].samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
- outputs[0].put_int(i, *mixp++, 32768 << 4);
- outputs[1].put_int(i, *mixp++, 32768 << 4);
+ stream.put_int(0, i, *mixp++, 32768 << 4);
+ stream.put_int(1, i, *mixp++, 32768 << 4);
}
}
diff --git a/src/mame/funtech/umc6619_sound.h b/src/mame/funtech/umc6619_sound.h
index f897a469d97..b4e026bdc62 100644
--- a/src/mame/funtech/umc6619_sound.h
+++ b/src/mame/funtech/umc6619_sound.h
@@ -29,7 +29,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;
TIMER_CALLBACK_MEMBER(channel_irq);
diff --git a/src/mame/fuuki/fuukifg3.cpp b/src/mame/fuuki/fuukifg3.cpp
index 176c6d06c6a..3a9e68fe3fd 100644
--- a/src/mame/fuuki/fuukifg3.cpp
+++ b/src/mame/fuuki/fuukifg3.cpp
@@ -652,17 +652,16 @@ void fuuki32_state::fuuki32(machine_config &config)
m_fuukitmap->set_yoffs(0x3f6, 0x2c7);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ymf278b_device &ymf(YMF278B(config, "ymf", 33.8688_MHz_XTAL));
ymf.irq_handler().set_inputline("soundcpu", 0);
- ymf.add_route(0, "lspeaker", 0.50);
- ymf.add_route(1, "rspeaker", 0.50);
- ymf.add_route(2, "lspeaker", 0.40);
- ymf.add_route(3, "rspeaker", 0.40);
- ymf.add_route(4, "lspeaker", 0.50);
- ymf.add_route(5, "rspeaker", 0.50);
+ ymf.add_route(0, "speaker", 0.50, 0);
+ ymf.add_route(1, "speaker", 0.50, 1);
+ ymf.add_route(2, "speaker", 0.40, 0);
+ ymf.add_route(3, "speaker", 0.40, 1);
+ ymf.add_route(4, "speaker", 0.50, 0);
+ ymf.add_route(5, "speaker", 0.50, 1);
}
//-------------------------------------------------
diff --git a/src/mame/gaelco/gaelco2.cpp b/src/mame/gaelco/gaelco2.cpp
index d41b3af3166..06fd46a43b3 100644
--- a/src/mame/gaelco/gaelco2.cpp
+++ b/src/mame/gaelco/gaelco2.cpp
@@ -200,14 +200,13 @@ void gaelco2_state::maniacsq(machine_config &config)
MCFG_VIDEO_START_OVERRIDE(gaelco2_state,gaelco2)
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
gaelco_gae1_device &gaelco(GAELCO_GAE1(config, "gaelco", XTAL(30'000'000) / 30));
gaelco.set_device_rom_tag("gfx");
gaelco.set_bank_offsets(0 * 0x0080000, 1 * 0x0080000, 0, 0);
- gaelco.add_route(0, "lspeaker", 1.0);
- gaelco.add_route(1, "rspeaker", 1.0);
+ gaelco.add_route(0, "speaker", 1.0, 0);
+ gaelco.add_route(1, "speaker", 1.0, 1);
}
void gaelco2_state::maniacsq_d5002fp(machine_config &config)
@@ -484,15 +483,14 @@ void gaelco2_state::saltcrdi(machine_config &config)
MCFG_VIDEO_START_OVERRIDE(gaelco2_state,gaelco2)
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
// unused? ROMs contain no sound data
gaelco_gae1_device &gaelco(GAELCO_GAE1(config, "gaelco", XTAL(24'000'000) / 24)); // TODO : Correct OSC?
gaelco.set_device_rom_tag("gfx");
gaelco.set_bank_offsets(0 * 0x0080000, 1 * 0x0080000, 0, 0);
- gaelco.add_route(0, "lspeaker", 1.0);
- gaelco.add_route(1, "rspeaker", 1.0);
+ gaelco.add_route(0, "speaker", 1.0, 0);
+ gaelco.add_route(1, "speaker", 1.0, 1);
}
/*============================================================================
@@ -1038,14 +1036,13 @@ void gaelco2_state::play2000(machine_config &config)
MCFG_VIDEO_START_OVERRIDE(gaelco2_state,gaelco2)
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
gaelco_gae1_device &gaelco(GAELCO_GAE1(config, "gaelco", XTAL(34'000'000) / 34));
gaelco.set_device_rom_tag("gfx");
gaelco.set_bank_offsets(0 * 0x080000, 0 * 0x080000, 0 * 0x080000, 0 * 0x080000);
- gaelco.add_route(0, "lspeaker", 1.0);
- gaelco.add_route(1, "rspeaker", 1.0);
+ gaelco.add_route(0, "speaker", 1.0, 0);
+ gaelco.add_route(1, "speaker", 1.0, 1);
}
void gaelco2_state::srollnd(machine_config& config)
@@ -1077,14 +1074,13 @@ void gaelco2_state::srollnd(machine_config& config)
MCFG_VIDEO_START_OVERRIDE(gaelco2_state,gaelco2)
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
gaelco_gae1_device &gaelco(GAELCO_GAE1(config, "gaelco", XTAL(34'000'000) / 34));
gaelco.set_device_rom_tag("gfx");
gaelco.set_bank_offsets(0 * 0x080000, 0 * 0x080000, 0 * 0x080000, 0 * 0x080000);
- gaelco.add_route(0, "lspeaker", 1.0);
- gaelco.add_route(1, "rspeaker", 1.0);
+ gaelco.add_route(0, "speaker", 1.0, 0);
+ gaelco.add_route(1, "speaker", 1.0, 1);
}
@@ -1180,14 +1176,13 @@ void bang_state::bang(machine_config &config)
MCFG_VIDEO_START_OVERRIDE(bang_state,gaelco2)
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
gaelco_cg1v_device &gaelco(GAELCO_CG1V(config, "gaelco", XTAL(30'000'000) / 30));
gaelco.set_device_rom_tag("gfx");
gaelco.set_bank_offsets(0 * 0x0200000, 1 * 0x0200000, 2 * 0x0200000, 3 * 0x0200000);
- gaelco.add_route(0, "lspeaker", 1.0);
- gaelco.add_route(1, "rspeaker", 1.0);
+ gaelco.add_route(0, "speaker", 1.0, 0);
+ gaelco.add_route(1, "speaker", 1.0, 1);
}
@@ -1425,14 +1420,13 @@ void gaelco2_state::alighunt(machine_config &config)
MCFG_VIDEO_START_OVERRIDE(gaelco2_state,gaelco2)
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
gaelco_gae1_device &gaelco(GAELCO_GAE1(config, "gaelco", XTAL(30'000'000) / 30));
gaelco.set_device_rom_tag("gfx");
gaelco.set_bank_offsets(0 * 0x0400000, 1 * 0x0400000, 2 * 0x0400000, 3 * 0x0400000);
- gaelco.add_route(0, "lspeaker", 1.0);
- gaelco.add_route(1, "rspeaker", 1.0);
+ gaelco.add_route(0, "speaker", 1.0, 0);
+ gaelco.add_route(1, "speaker", 1.0, 1);
}
void gaelco2_state::alighunt_d5002fp(machine_config &config)
@@ -1796,14 +1790,13 @@ void gaelco2_state::touchgo(machine_config &config)
// sound hardware
/* the chip is stereo, but the game sound is mono because the right channel
output is for cabinet 1 and the left channel output is for cabinet 2 */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
gaelco_gae1_device &gaelco(GAELCO_GAE1(config, "gaelco", XTAL(40'000'000) / 40));
gaelco.set_device_rom_tag("gfx");
gaelco.set_bank_offsets(0 * 0x0400000, 1 * 0x0400000, 0, 0);
- gaelco.add_route(0, "rspeaker", 1.0);
- gaelco.add_route(1, "lspeaker", 1.0);
+ gaelco.add_route(0, "speaker", 1.0, 1);
+ gaelco.add_route(1, "speaker", 1.0, 0);
}
void gaelco2_state::touchgo_d5002fp(machine_config &config)
@@ -2095,14 +2088,13 @@ void snowboar_state::snowboar(machine_config &config)
MCFG_VIDEO_START_OVERRIDE(snowboar_state,gaelco2)
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
gaelco_cg1v_device &gaelco(GAELCO_CG1V(config, "gaelco", XTAL(34'000'000) / 34));
gaelco.set_device_rom_tag("gfx");
gaelco.set_bank_offsets(0 * 0x0400000, 1 * 0x0400000, 0, 0);
- gaelco.add_route(0, "lspeaker", 1.0);
- gaelco.add_route(1, "rspeaker", 1.0);
+ gaelco.add_route(0, "speaker", 1.0, 0);
+ gaelco.add_route(1, "speaker", 1.0, 1);
}
void snowboar_state::maniacsqs(machine_config &config)
@@ -2139,14 +2131,13 @@ void snowboar_state::maniacsqs(machine_config &config)
MCFG_VIDEO_START_OVERRIDE(snowboar_state,gaelco2)
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
gaelco_gae1_device &gaelco(GAELCO_GAE1(config, "gaelco", XTAL(30'000'000) / 30));
gaelco.set_device_rom_tag("gfx");
gaelco.set_bank_offsets(0 * 0x0080000, 1 * 0x0080000, 0, 0);
- gaelco.add_route(0, "lspeaker", 1.0);
- gaelco.add_route(1, "rspeaker", 1.0);
+ gaelco.add_route(0, "speaker", 1.0, 0);
+ gaelco.add_route(1, "speaker", 1.0, 1);
}
@@ -2440,14 +2431,13 @@ void wrally2_state::wrally2(machine_config &config)
// sound hardware
/* the chip is stereo, but the game sound is mono because the right channel
output is for cabinet 1 and the left channel output is for cabinet 2 */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
gaelco_gae1_device &gaelco(GAELCO_GAE1(config, "gaelco", XTAL(34'000'000) / 34));
gaelco.set_device_rom_tag("gfx");
gaelco.set_bank_offsets(0 * 0x0200000, 1 * 0x0200000, 0, 0);
- gaelco.add_route(0, "rspeaker", 1.0);
- gaelco.add_route(1, "lspeaker", 1.0);
+ gaelco.add_route(0, "speaker", 1.0, 1);
+ gaelco.add_route(1, "speaker", 1.0, 0);
}
/*
diff --git a/src/mame/gamepark/gp2x.cpp b/src/mame/gamepark/gp2x.cpp
index 2fe2d0095f6..918a825e95d 100644
--- a/src/mame/gamepark/gp2x.cpp
+++ b/src/mame/gamepark/gp2x.cpp
@@ -377,8 +377,7 @@ void gp2x_state::gp2x(machine_config &config)
screen.set_visarea(0, 319, 0, 239);
screen.set_screen_update(FUNC(gp2x_state::screen_update_gp2x));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
} // anonymous namespace
diff --git a/src/mame/gamepark/gp32.cpp b/src/mame/gamepark/gp32.cpp
index 764d66610d5..07d2c780067 100644
--- a/src/mame/gamepark/gp32.cpp
+++ b/src/mame/gamepark/gp32.cpp
@@ -1696,10 +1696,9 @@ void gp32_state::gp32(machine_config &config)
m_screen->set_visarea(0, 239, 0, 319);
m_screen->set_screen_update(FUNC(gp32_state::screen_update_gp32));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
- DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_ldac, 0).add_route(ALL_OUTPUTS, "lspeaker", 1.0); // unknown DAC
- DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_rdac, 0).add_route(ALL_OUTPUTS, "rspeaker", 1.0); // unknown DAC
+ SPEAKER(config, "speaker", 2).front();
+ DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_ldac, 0).add_route(ALL_OUTPUTS, "speaker", 1.0, 0); // unknown DAC
+ DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_rdac, 0).add_route(ALL_OUTPUTS, "speaker", 1.0, 1); // unknown DAC
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1);
diff --git a/src/mame/hp/hp16500.cpp b/src/mame/hp/hp16500.cpp
index ad1a12c6ada..87474573778 100644
--- a/src/mame/hp/hp16500.cpp
+++ b/src/mame/hp/hp16500.cpp
@@ -436,8 +436,7 @@ void hp16500_state::hp1650(machine_config &config)
SCN2661A(config, "epci", 5000000);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
void hp16500_state::hp1651(machine_config &config)
@@ -459,8 +458,7 @@ void hp16500_state::hp1651(machine_config &config)
SCN2661A(config, "epci", 5000000);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
void hp16500_state::hp16500a(machine_config &config)
@@ -480,8 +478,7 @@ void hp16500_state::hp16500a(machine_config &config)
crtc.set_update_row_callback(FUNC(hp16500_state::crtc_update_row));
crtc.out_vsync_callback().set(FUNC(hp16500_state::vsync_changed));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
void hp16500_state::hp16500b(machine_config &config)
@@ -509,8 +506,7 @@ void hp16500_state::hp16500b(machine_config &config)
DS1286(config, "rtc", 32768);
//WD37C65C(config, "fdc", 16_MHz_XTAL);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
static INPUT_PORTS_START( hp16500 )
diff --git a/src/mame/hp/hp80.cpp b/src/mame/hp/hp80.cpp
index 73b33de1caf..36c675941e0 100644
--- a/src/mame/hp/hp80.cpp
+++ b/src/mame/hp/hp80.cpp
@@ -275,8 +275,8 @@ void hp80_base_state::hp80_base(machine_config &config)
// Beeper
SPEAKER(config, "mono").front_center();
- DAC_1BIT(config, m_dac , 0).add_route(ALL_OUTPUTS, "mono", 0.5, AUTO_ALLOC_INPUT, 0);
- BEEP(config, m_beep, CPU_CLOCK / 512).add_route(ALL_OUTPUTS, "mono", 0.5, AUTO_ALLOC_INPUT, 0);
+ DAC_1BIT(config, m_dac , 0).add_route(ALL_OUTPUTS, "mono", 0.5, 0);
+ BEEP(config, m_beep, CPU_CLOCK / 512).add_route(ALL_OUTPUTS, "mono", 0.5, 0);
// Optional ROMs
for (auto& finder : m_rom_drawers) {
diff --git a/src/mame/hp/hp_ipc.cpp b/src/mame/hp/hp_ipc.cpp
index 2f7053d6ceb..517009db14b 100644
--- a/src/mame/hp/hp_ipc.cpp
+++ b/src/mame/hp/hp_ipc.cpp
@@ -797,7 +797,7 @@ void hp_ipc_state::hp_ipc_base(machine_config &config)
// Beeper
COP452(config , m_spkr , 2_MHz_XTAL);
SPEAKER(config, "mono").front_center();
- DAC_1BIT(config, m_dac , 0).add_route(ALL_OUTPUTS, "mono", 0.5, AUTO_ALLOC_INPUT, 0);
+ DAC_1BIT(config, m_dac , 0).add_route(ALL_OUTPUTS, "mono", 0.5, 0);
m_spkr->oa_w().set(m_dac , FUNC(dac_1bit_device::write));
// IO slots
diff --git a/src/mame/hp/jornada.cpp b/src/mame/hp/jornada.cpp
index 3e7b6486cb8..844ec57a639 100644
--- a/src/mame/hp/jornada.cpp
+++ b/src/mame/hp/jornada.cpp
@@ -624,11 +624,10 @@ void jornada_state::jornada720(machine_config &config)
UDA1344(config, m_codec);
m_codec->l3_ack_out().set(m_companion, FUNC(sa1111_device::l3wd_in));
- m_codec->add_route(0, "lspeaker", 0.5);
- m_codec->add_route(1, "rspeaker", 0.5);
+ m_codec->add_route(0, "speaker", 0.5, 0);
+ m_codec->add_route(1, "speaker", 0.5, 1);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
SED1356(config, m_epson);
m_epson->set_screen("screen");
diff --git a/src/mame/ibm/thinkpad8xx.cpp b/src/mame/ibm/thinkpad8xx.cpp
index 2a290b4ba7b..bfbbc6a7020 100644
--- a/src/mame/ibm/thinkpad8xx.cpp
+++ b/src/mame/ibm/thinkpad8xx.cpp
@@ -79,8 +79,7 @@ void thinkpad8xx_state::thinkpad850(machine_config &config)
H8325(config, "mcu", XTAL(10'000'000)); // Actually an H8/338 (HD6473388: 48k-byte ROM; 2k-byte RAM), unknown clock
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
SOFTWARE_LIST(config, "thinkpad8xx").set_original("thinkpad8xx");
}
diff --git a/src/mame/igs/goldstar.cpp b/src/mame/igs/goldstar.cpp
index c864fd69b19..f9967bf9628 100644
--- a/src/mame/igs/goldstar.cpp
+++ b/src/mame/igs/goldstar.cpp
@@ -483,7 +483,6 @@ public:
void amcoe2(machine_config &config);
void amcoe1(machine_config &config);
void chryangl(machine_config &config);
- void ss2001(machine_config &config);
void super7(machine_config &config);
void animalhs(machine_config &config);
void eldoraddoa(machine_config &config);
@@ -504,7 +503,6 @@ public:
void nfm_portmap(address_map &map) ATTR_COLD;
void super7_portmap(address_map &map) ATTR_COLD;
void chryangl_decrypted_opcodes_map(address_map &map) ATTR_COLD;
- void ss2001_portmap(address_map &map) ATTR_COLD;
protected:
// installed by various driver init handlers to get stuff to work
@@ -2281,18 +2279,6 @@ void cmaster_state::cmv4zg_portmap(address_map &map)
map(0x14, 0x14).w(FUNC(cmaster_state::girl_scroll_w));
}
-void cmaster_state::ss2001_portmap(address_map &map) // TODO: everything but AY8910
-{
- map.global_mask(0xff);
- map(0x01, 0x01).r("aysnd", FUNC(ay8910_device::data_r));
- map(0x02, 0x03).w("aysnd", FUNC(ay8910_device::data_address_w));
- map(0x13, 0x13).portr("IN0");
- map(0x14, 0x14).portr("IN1");
- map(0x15, 0x15).portr("IN2");
- map(0x16, 0x16).portr("DSW1");
- map(0x17, 0x17).portr("DSW2");
-}
-
void cmaster_state::chryangl_decrypted_opcodes_map(address_map &map)
{
map(0x0000, 0xffff).rom().share("decrypted_opcodes");
@@ -10823,13 +10809,6 @@ void cmaster_state::cm97(machine_config &config)
config.device_remove("ppi8255_1");
}
-void cmaster_state::ss2001(machine_config &config)
-{
- cm97(config);
-
- m_maincpu->set_addrmap(AS_IO, &cmaster_state::ss2001_portmap);
-}
-
void cmaster_state::chryangl(machine_config &config)
{
cm(config);
@@ -21657,104 +21636,6 @@ ROM_START( fl7_tw ) // Serial 00000050E9B7.
ROM_END
-/*
- Super Shanghai 2001
-
- it's a 3-reel 5-liner with an extra reel.
- Puts PATRICK SHANGHAI in NVRAM, so some kind of hack / bootleg
-
- PCB pic is blurred, but main components appear to be:
-
- TMPZ84C00AP-8,
- Winbond WF19054,
- 5 8-dip banks (dip sheet available)
-
-*/
-ROM_START( ss2001 )
- ROM_REGION( 0x10000, "maincpu", 0 )
- ROM_LOAD( "9.u26", 0x00000, 0x10000, CRC(9ddb0239) SHA1(15733481996de9becccd5b920e40220c6101becf) )
-
- ROM_REGION( 0x80000, "gfx", 0 ) // all 27c1001
- ROM_LOAD( "1.u1", 0x00000, 0x10000, CRC(f4075f1c) SHA1(16513735e181e14a01fe24be6de0b22ef5a894eb) ) // 1ST AND 2ND HALF IDENTICAL
- ROM_IGNORE(0x10000)
- ROM_LOAD( "2.u2", 0x10000, 0x10000, CRC(7df72d1b) SHA1(ad61c3de89be547014ca123b72bb9775bad55cdd) ) // 1ST AND 2ND HALF IDENTICAL
- ROM_IGNORE(0x10000)
- ROM_LOAD( "3.u3", 0x20000, 0x10000, CRC(c8db92f7) SHA1(3a77d9a21125e47396b06dc8c54625aa8ad54386) ) // 1ST AND 2ND HALF IDENTICAL
- ROM_IGNORE(0x10000)
- ROM_LOAD( "4.u4", 0x30000, 0x10000, CRC(bdca2cd5) SHA1(6139a697321475ac6fefac5b5a9f76c8de30f2f8) ) // 1ST AND 2ND HALF IDENTICAL
- ROM_IGNORE(0x10000)
- ROM_LOAD( "5.u5", 0x40000, 0x10000, CRC(c01acca1) SHA1(f2caed0b8624fb224f41323f15eaa9ce3fadd886) ) // 1ST AND 2ND HALF IDENTICAL
- ROM_IGNORE(0x10000)
- ROM_LOAD( "6.u6", 0x50000, 0x10000, CRC(a6194545) SHA1(74ddda87ad55e8bce1e986dde8fd371ab8843ceb) ) // 1ST AND 2ND HALF IDENTICAL
- ROM_IGNORE(0x10000)
- ROM_LOAD( "7.u7", 0x60000, 0x10000, CRC(03375cf9) SHA1(d336c4dff53a7368c9264a02fbc53afd0776a9cd) ) // 1ST AND 2ND HALF IDENTICAL
- ROM_IGNORE(0x10000)
- ROM_LOAD( "8.u8", 0x70000, 0x10000, CRC(2ad9778b) SHA1(05d8e0be028060cbe78ff1ff927f15f8114f8508) ) // 1ST AND 2ND HALF IDENTICAL
- ROM_IGNORE(0x10000)
-
- ROM_REGION( 0x2000, "proms", 0 )
- ROM_LOAD( "d27hc65d.bin", 0x0000, 0x02000, CRC(af8ce88d) SHA1(59d59b6b739aed4f6ee618db04af9ab9d2873bed) ) // colour data is at 0x1800-0x18ff
-ROM_END
-
-/*
- Super Shanghai 2000
-
- PCB pic is blurred, but main components appear to be:
-
- Zilog Z80,
- Winbond WF19054,
- 5 8-dip banks (dip sheet available)
-
-*/
-ROM_START( ss2000 ) // main program (green board)
- ROM_REGION( 0x10000, "maincpu", 0 )
- ROM_LOAD( "main_program_set_2_green_board.bin", 0x00000, 0x10000, CRC(a5017fa0) SHA1(af985a15fe2c6195b3310ece8dc9e431d1b8c673) )
-
- ROM_REGION( 0x80000, "gfx", 0 ) // all 27c512, same gfx set as ss2001 but half sized roms
- ROM_LOAD( "rom1_m27c512.u1", 0x00000, 0x10000, CRC(52d1914b) SHA1(f8e5e7ba8809006e4109b82dd84e019d0d1e5447) )
- ROM_LOAD( "rom2_m27c512.u2", 0x10000, 0x10000, CRC(d5d50ef8) SHA1(60016d62922b369ce78130b8a94d967585657cd1) )
- ROM_LOAD( "rom3_m27c512.u3", 0x20000, 0x10000, CRC(56e6e11b) SHA1(0a20ef1e05ded62b0aece5a94565736cbc83edf7) )
- ROM_LOAD( "rom4_m27c512.u4", 0x30000, 0x10000, CRC(2cd3eb2d) SHA1(31f804cf9ddcd7dd8501946f9bf2f8a13b5b48f3) )
- ROM_LOAD( "rom5_m27c512.u5", 0x40000, 0x10000, CRC(57328ec5) SHA1(0f5cddb4b45ddef8f6d352220e32cff27edac2b4) )
- ROM_LOAD( "rom6_m27c512.u6", 0x50000, 0x10000, CRC(dd228316) SHA1(2d618758e870224284efc0dc8d3a83f3447d0e48) )
- ROM_LOAD( "rom7_m27c512.u7", 0x60000, 0x10000, CRC(a7c2a38b) SHA1(149ccc4b36bca6a149f3a26f5a580f34f4020ef3) )
- ROM_LOAD( "rom8_m27c512.u8", 0x70000, 0x10000, CRC(f6ef214c) SHA1(1f50ea87214b86416feda58fb5065175eb18df6a) )
-
- ROM_REGION( 0x2000, "proms", 0 )
- ROM_LOAD( "am27s29.bin", 0x0000, 0x0200, CRC(3ad40503) SHA1(5f7516001ac4286df3ca4f6ab36882a15019546a) )
-ROM_END
-
-/*
- Super Shanghai 2000
- Wrestle Fiesta.
- Main program 30% bonus by Vegas (red board)
-
- PCB pic is blurred, but main components appear to be:
-
- TMPZ84C00AP-8,
- Winbond WF19054,
- 5 8-dip banks
-
-*/
-ROM_START( ss2000a )
- ROM_REGION( 0x10000, "maincpu", 0 )
- ROM_LOAD( "main_program_set_3_red_board.bin", 0x00000, 0x10000, CRC(4aaa348c) SHA1(a33656798807906ce72351a1740f77563c5b2640) )
-
- ROM_REGION( 0x80000, "gfx", 0 ) // all 27c512
- ROM_LOAD( "27c512.u1", 0x00000, 0x10000, CRC(26df6ee7) SHA1(3221639174b432ea93e0db33b7554f2ce8125052) )
- ROM_LOAD( "27c512.u2", 0x10000, 0x10000, CRC(5983a654) SHA1(6374e1fb0eda2454370e54d4dd8bf6c82b2f177e) )
- ROM_LOAD( "27c512.u3", 0x20000, 0x10000, CRC(0c2cd067) SHA1(a1c749ee0c0c3d25a80af6d56c41057430646ce9) )
- ROM_LOAD( "27c512.u4", 0x30000, 0x10000, CRC(e3adb317) SHA1(817a885236c28dc5dee02cc1d7e9e1c780560cae) )
- ROM_LOAD( "27c512.u5", 0x40000, 0x10000, CRC(e693e419) SHA1(8834419d02eb0f4f4a1619195a87b00e3f315a39) )
- ROM_LOAD( "27c512.u6", 0x50000, 0x10000, CRC(096c691a) SHA1(59a45ad654981cdfecaa3390253850491baccb9f) )
- ROM_LOAD( "27c512.u7", 0x60000, 0x10000, CRC(f26a3eeb) SHA1(83bbe0b068549f3bceb083d17894fb080e9b58a1) )
- ROM_LOAD( "27c512.u8", 0x70000, 0x10000, CRC(1444ee50) SHA1(6e6137869d4c46762bab92ed54071d9292243532) )
-
- ROM_REGION( 0x2000, "proms", 0 )
- ROM_LOAD( "am27s29.bin", 0x0000, 0x0200, CRC(3ad40503) SHA1(5f7516001ac4286df3ca4f6ab36882a15019546a) )
-ROM_END
-
-
/*********************************************************************************************************************/
void goldstar_state::init_goldstar()
@@ -24110,11 +23991,6 @@ GAME( 1996, cherry96, scmaster, unkch, unkch4, unkch_state, init_un
GAME( 1998, rolling, scmaster, rolling, unkch4, unkch_state, empty_init, ROT0, "bootleg", "Rolling", MACHINE_NOT_WORKING ) // inputs, outputs
-// this has a 4th reel
-GAME( 2001, ss2001, 0, ss2001, cmaster, cmaster_state, empty_init, ROT0, "bootleg", "Super Shanghai 2001", MACHINE_NO_SOUND | MACHINE_NOT_WORKING ) // TODO: everything
-GAME( 2000, ss2000, 0, ss2001, cmaster, cmaster_state, empty_init, ROT0, "bootleg", "Super Shanghai 2000 (standard. green board)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING ) // TODO: everything
-GAME( 2000, ss2000a, 0, ss2001, cmaster, cmaster_state, empty_init, ROT0, "bootleg", "Super Shanghai 2000 - Wrestle Fiesta (30% bonus, red board)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING ) // TODO: everything
-
// ******************* Stealth sets *******************
// These have hidden games inside that can be switched
diff --git a/src/mame/igs/igs017.cpp b/src/mame/igs/igs017.cpp
index 72a77196a8a..6daced93f00 100644
--- a/src/mame/igs/igs017.cpp
+++ b/src/mame/igs/igs017.cpp
@@ -27,7 +27,7 @@ Year + Game PCB CPU Sound
98 Manguan Caishen (V110C) NO-0266 68000 M6295 IGS031 IGS025 IGS026 Battery
99 Tarzan (V107) NO-0228? Z180 U6295 IGS031 IGS025 IGS029 Battery
99 Tarzan (V109C) NO-0248-1 Z180 U6295 IGS031 IGS025 Battery
-00 Chaoji Da manguan 2 - Jiaqiang Ban (V100C) NO-0271 68000 K668 IGS031 IGS025 Battery
+00 Chaoji Da Manguan 2 - Jiaqiang Ban (V100C) NO-0271 68000 K668 IGS031 IGS025 Battery
00? Jungle King (V103A) NO-0230-1 Z180 U6295 IGS031 IGS025 (N9) Battery
00? Super Tarzan (V100I) NO-0230-1 Z180 K668 IGS031 IGS025 Battery
00? Happy Skill (V611IT) NO-0281 Z180 K668 IGS031 IGS025 Battery
@@ -38,10 +38,11 @@ Year + Game PCB CPU Sound
not present in another set *
To Do:
-- Protection emulation in some games, instead of patching the roms.
-- NVRAM.
+- Protection emulation in some games, instead of patching the ROMs.
+- Do iqblocka and clones, genius6 and clones, tjsb support NVRAM?
- mgcs: Finish IGS029 protection simulation.
- jking302us: IGS025 and IGS029 protection simulation.
+- sdmg2: different protection that kicks in after several dozens of hands
Notes:
@@ -88,6 +89,7 @@ Notes:
#include "cpu/m68000/m68000.h"
#include "cpu/z180/z180.h"
#include "machine/i8255.h"
+#include "machine/nvram.h"
#include "machine/ticket.h"
#include "machine/timer.h"
#include "sound/okim6295.h"
@@ -698,7 +700,8 @@ public:
void init_mgdh() ATTR_COLD;
void init_mgdha() ATTR_COLD;
void init_sdmg2() ATTR_COLD;
- void init_sdmg2a() ATTR_COLD;
+ void init_sdmg2754ca() ATTR_COLD;
+ void init_sdmg2754cb() ATTR_COLD;
void init_sdmg2p() ATTR_COLD;
void init_slqz2() ATTR_COLD;
void init_spkrform() ATTR_COLD;
@@ -897,6 +900,7 @@ private:
void cpoker2_io(address_map &map) ATTR_COLD;
void cpoker2_map(address_map &map) ATTR_COLD;
void cpoker2_mux_map(address_map &map) ATTR_COLD;
+ void happyskl_map(address_map &map) ATTR_COLD;
void happyskl_io(address_map &map) ATTR_COLD;
void happyskl_mux_map(address_map &map) ATTR_COLD;
void iqblocka_io(address_map &map) ATTR_COLD;
@@ -1533,7 +1537,7 @@ void igs017_state::init_cpoker2()
// sdmg2
-void igs017_state::init_sdmg2()
+void igs017_state::init_sdmg2754ca()
{
const int rom_size = memregion("maincpu")->bytes();
u16 * const rom = (u16 *)memregion("maincpu")->base();
@@ -1584,7 +1588,7 @@ void igs017_state::init_sdmg2()
}
//
-void igs017_state::init_sdmg2a()
+void igs017_state::init_sdmg2754cb()
{
const int rom_size = memregion("maincpu")->bytes();
u16 * const rom = (u16 *)memregion("maincpu")->base();
@@ -1634,6 +1638,37 @@ void igs017_state::init_sdmg2a()
}
}
+void igs017_state::init_sdmg2()
+{
+ const int rom_size = memregion("maincpu")->bytes();
+ u16 * const rom = (u16 *)memregion("maincpu")->base();
+
+ for (int i = 0; i < rom_size / 2; i++)
+ {
+ u16 x = rom[i];
+
+ // bit 0 xor layer
+ if (i & 0x20 / 2)
+ if (i & 0x02 / 2)
+ x ^= 0x0001;
+
+ if (!(i & 0x4000 / 2))
+ if (!(i & 0x300 / 2))
+ x ^= 0x0001;
+
+ // bit 9 xor layer
+ if (!(i & 0x20000 / 2))
+ if (i & 0x400 / 2)
+ x ^= 0x0200;
+
+ // bit 12 xor layer
+ if (i & 0x20000 / 2)
+ x ^= 0x1000;
+
+ rom[i] = x;
+ }
+}
+
// sdmg2p
void igs017_state::init_sdmg2p()
@@ -2112,7 +2147,7 @@ void igs017_state::igs_fixed_data_mux_map(address_map &map)
void igs017_state::iqblocka_map(address_map &map)
{
map(0x00000, 0x0dfff).rom();
- map(0x0e000, 0x0efff).ram();
+ map(0x0e000, 0x0efff).ram().share("nvram");
map(0x0f000, 0x0ffff).ram();
map(0x10000, 0x3ffff).rom();
}
@@ -2251,6 +2286,13 @@ void igs017_state::starzan_mux_map(address_map &map)
// happyksl
+void igs017_state::happyskl_map(address_map &map)
+{
+ map(0x00000, 0x0dfff).rom();
+ map(0x0e000, 0x0ffff).ram().share("nvram");
+ map(0x10000, 0x3ffff).rom();
+}
+
void igs017_state::happyskl_io(address_map &map)
{
map(0x0000, 0x7fff).rw(m_igs017_igs031, FUNC(igs017_igs031_device::read), FUNC(igs017_igs031_device::write));
@@ -2591,7 +2633,7 @@ u8 igs017_state::mgcs_keys_joy_r()
void igs017_state::mgcs_map(address_map &map)
{
map(0x000000, 0x07ffff).rom();
- map(0x300000, 0x303fff).ram();
+ map(0x300000, 0x303fff).ram().share("nvram");
map(0x49c000, 0x49c001).nopr().w(m_igs_mux, FUNC(igs_mux_device::address_w)).umask16(0x00ff); // clr.w dummy read
map(0x49c002, 0x49c003).rw(m_igs_mux, FUNC(igs_mux_device::data_r), FUNC(igs_mux_device::data_w)).umask16(0x00ff);
@@ -2615,7 +2657,7 @@ void igs017_state::mgcs_mux_map(address_map &map)
void igs017_state::mgcsa_map(address_map &map)
{
map(0x000000, 0x07ffff).rom();
- map(0x100000, 0x103fff).ram();
+ map(0x100000, 0x103fff).ram().share("nvram");
map(0x49c000, 0x49c001).nopr().w(m_igs_mux, FUNC(igs_mux_device::address_w)).umask16(0x00ff); // clr.w dummy read
map(0x49c002, 0x49c003).rw(m_igs_mux, FUNC(igs_mux_device::data_r), FUNC(igs_mux_device::data_w)).umask16(0x00ff);
@@ -2629,7 +2671,7 @@ void igs017_state::mgcsa_map(address_map &map)
void igs017_state::mgcsb_map(address_map &map)
{
map(0x000000, 0x07ffff).rom();
- map(0x300000, 0x303fff).ram();
+ map(0x300000, 0x303fff).ram().share("nvram");
map(0x49c000, 0x49c001).nopr().w(m_igs_mux, FUNC(igs_mux_device::address_w)).umask16(0x00ff); // clr.w dummy read
map(0x49c002, 0x49c003).rw(m_igs_mux, FUNC(igs_mux_device::data_r), FUNC(igs_mux_device::data_w)).umask16(0x00ff);
@@ -2661,7 +2703,7 @@ void igs017_state::sdmg2_map(address_map &map)
map(0x002007, 0x002007).w(m_igs_incdec, FUNC(igs_incdec_device::inc_w));
map(0x00200b, 0x00200b).r(m_igs_incdec, FUNC(igs_incdec_device::result_r));
- map(0x1f0000, 0x1fffff).ram();
+ map(0x1f0000, 0x1fffff).ram().share("nvram");
map(0x200000, 0x20ffff).rw(m_igs017_igs031, FUNC(igs017_igs031_device::read), FUNC(igs017_igs031_device::write)).umask16(0x00ff);
@@ -2703,7 +2745,7 @@ void igs017_state::sdmg2_mux_map(address_map &map)
void igs017_state::mgdh_map(address_map &map)
{
map(0x000000, 0x07ffff).rom();
- map(0x600000, 0x603fff).ram();
+ map(0x600000, 0x603fff).ram().share("nvram");
map(0x876000, 0x876001).nopr().w(m_igs_mux, FUNC(igs_mux_device::address_w)).umask16(0x00ff); // clr.w dummy read
map(0x876002, 0x876003).rw(m_igs_mux, FUNC(igs_mux_device::data_r), FUNC(igs_mux_device::data_w)).umask16(0x00ff);
@@ -2752,7 +2794,7 @@ void igs017_state::sdmg2p_map(address_map &map)
{
map(0x000000, 0x07ffff).rom();
- map(0x100000, 0x103fff).ram();
+ map(0x100000, 0x103fff).ram().share("nvram");
map(0x38d000, 0x38d001).nopr().w(m_igs_mux, FUNC(igs_mux_device::address_w)).umask16(0x00ff); // clr.w dummy read
map(0x38d002, 0x38d003).rw(m_igs_mux, FUNC(igs_mux_device::data_r), FUNC(igs_mux_device::data_w)).umask16(0x00ff);
@@ -2847,7 +2889,7 @@ void igs017_state::lhzb2_map(address_map &map)
map(0x100000, 0x103fff).ram().share("igs022:sharedprotram"); // Shared with protection device
- map(0x500000, 0x503fff).ram();
+ map(0x500000, 0x503fff).ram().share("nvram");
map(0x910000, 0x910001).nopr().w(m_igs_mux, FUNC(igs_mux_device::address_w)).umask16(0x00ff); // clr.w dummy read
map(0x910002, 0x910003).rw(m_igs_mux, FUNC(igs_mux_device::data_r), FUNC(igs_mux_device::data_w)).umask16(0x00ff);
@@ -2980,7 +3022,7 @@ void igs017_state::lhzb2a_map(address_map &map)
map(0x003207, 0x003207).w(m_igs_incdec, FUNC(igs_incdec_device::inc_w));
map(0x00320b, 0x00320b).r(m_igs_incdec, FUNC(igs_incdec_device::result_r));
- map(0x500000, 0x503fff).ram();
+ map(0x500000, 0x503fff).ram().share("nvram");
// map(0x910000, 0x910003) accesses appear to be from leftover code where the final checks were disabled
map(0xb00000, 0xb0ffff).rw(m_igs017_igs031, FUNC(igs017_igs031_device::read), FUNC(igs017_igs031_device::write)).umask16(0x00ff);
@@ -3006,7 +3048,7 @@ void igs017_state::lhzb2a_mux_map(address_map &map)
void igs017_state::slqz2_map(address_map &map)
{
map(0x000000, 0x07ffff).rom();
- map(0x100000, 0x103fff).ram();
+ map(0x100000, 0x103fff).ram().share("nvram");
map(0x300000, 0x303fff).ram().share("igs022:sharedprotram"); // Shared with protection device
@@ -3053,7 +3095,7 @@ void igs017_state::slqz2_mux_map(address_map &map)
void igs017_state::jking302us_map(address_map &map)
{
map(0x000000, 0x07ffff).rom();
- map(0x100000, 0x103fff).ram();
+ map(0x100000, 0x103fff).ram().share("nvram"); // TODO: verify once it works
map(0x638000, 0x638001).nopr().w(m_igs_mux, FUNC(igs_mux_device::address_w)).umask16(0x00ff); // clr.w dummy read
map(0x638002, 0x638003).rw(m_igs_mux, FUNC(igs_mux_device::data_r), FUNC(igs_mux_device::data_w)).umask16(0x00ff);
@@ -4367,6 +4409,8 @@ void igs017_state::iqblocka(machine_config &config)
m_maincpu->set_addrmap(AS_IO, &igs017_state::iqblocka_io);
TIMER(config, "scantimer").configure_scanline(FUNC(igs017_state::iqblocka_interrupt), "screen", 0, 1);
+ // NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
+
// i/o
m_igs_mux->set_addrmap(0, &igs017_state::iqblocka_mux_map);
@@ -4424,6 +4468,8 @@ void igs017_state::tarzan(machine_config &config)
m_maincpu->set_addrmap(AS_OPCODES, &igs017_state::decrypted_opcodes_map);
TIMER(config, "scantimer").configure_scanline(FUNC(igs017_state::iqblocka_interrupt), "screen", 0, 1);
+ NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
+
// I/O
m_igs_mux->set_addrmap(0, &igs017_state::tarzan_mux_map);
@@ -4457,6 +4503,8 @@ void igs017_state::starzan(machine_config &config)
m_maincpu->set_addrmap(AS_OPCODES, &igs017_state::decrypted_opcodes_map);
TIMER(config, "scantimer").configure_scanline(FUNC(igs017_state::iqblocka_interrupt), "screen", 0, 1);
+ NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
+
// i/o
m_igs_mux->set_addrmap(0, &igs017_state::starzan_mux_map);
@@ -4486,11 +4534,13 @@ void igs017_state::happyskl(machine_config &config)
base_machine_oki(config, 16_MHz_XTAL / 16);
HD64180RP(config, m_maincpu, 16_MHz_XTAL);
- m_maincpu->set_addrmap(AS_PROGRAM, &igs017_state::iqblocka_map);
+ m_maincpu->set_addrmap(AS_PROGRAM, &igs017_state::happyskl_map);
m_maincpu->set_addrmap(AS_IO, &igs017_state::happyskl_io);
m_maincpu->set_addrmap(AS_OPCODES, &igs017_state::decrypted_opcodes_map);
TIMER(config, "scantimer").configure_scanline(FUNC(igs017_state::iqblocka_interrupt), "screen", 0, 1);
+ NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
+
// i/o
m_igs_mux->set_addrmap(0, &igs017_state::happyskl_mux_map);
@@ -4516,6 +4566,8 @@ void igs017_state::cpoker2(machine_config &config)
m_maincpu->set_addrmap(AS_IO, &igs017_state::cpoker2_io);
TIMER(config, "scantimer").configure_scanline(FUNC(igs017_state::iqblocka_interrupt), "screen", 0, 1);
+ NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
+
// i/o
m_igs_mux->set_addrmap(0, &igs017_state::cpoker2_mux_map);
@@ -4577,6 +4629,8 @@ void igs017_state::spkrform(machine_config &config)
m_maincpu->set_addrmap(AS_IO, &igs017_state::spkrform_io);
TIMER(config, "scantimer").configure_scanline(FUNC(igs017_state::iqblocka_interrupt), "screen", 0, 1);
+ NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
+
// i/o
m_igs_mux->set_addrmap(0, &igs017_state::spkrform_mux_map);
@@ -4617,6 +4671,8 @@ void igs017_state::mgcs(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &igs017_state::mgcs_map);
TIMER(config, "scantimer").configure_scanline(FUNC(igs017_state::mgcs_interrupt), "screen", 0, 1);
+ NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
+
// i/o
m_igs_mux->set_addrmap(0, &igs017_state::mgcs_mux_map);
@@ -4660,6 +4716,8 @@ void igs017_state::lhzb2(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &igs017_state::lhzb2_map);
TIMER(config, "scantimer").configure_scanline(FUNC(igs017_state::mgcs_interrupt), "screen", 0, 1);
+ NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
+
// i/o
m_igs_mux->set_addrmap(0, &igs017_state::lhzb2_mux_map);
@@ -4695,6 +4753,8 @@ void igs017_state::lhzb2a(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &igs017_state::lhzb2a_map);
TIMER(config, "scantimer").configure_scanline(FUNC(igs017_state::mgcs_interrupt), "screen", 0, 1);
+ NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
+
MCFG_MACHINE_RESET_OVERRIDE(igs017_state, lhzb2a)
// i/o
@@ -4732,6 +4792,8 @@ void igs017_state::slqz2(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &igs017_state::slqz2_map);
TIMER(config, "scantimer").configure_scanline(FUNC(igs017_state::mgcs_interrupt), "screen", 0, 1);
+ NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
+
// i/o
m_igs_mux->set_addrmap(0, &igs017_state::slqz2_mux_map);
@@ -4761,6 +4823,8 @@ void igs017_state::sdmg2(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &igs017_state::sdmg2_map);
TIMER(config, "scantimer").configure_scanline(FUNC(igs017_state::mgcs_interrupt), "screen", 0, 1);
+ NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
+
// i/o
m_igs_mux->set_addrmap(0, &igs017_state::sdmg2_mux_map);
@@ -4796,6 +4860,8 @@ void igs017_state::mgdha(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &igs017_state::mgdh_map);
TIMER(config, "scantimer").configure_scanline(FUNC(igs017_state::mgdh_interrupt), "screen", 0, 1);
+ NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
+
// i/o
m_igs_mux->set_addrmap(0, &igs017_state::mgdha_mux_map);
@@ -4822,6 +4888,8 @@ void igs017_state::sdmg2p(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &igs017_state::sdmg2p_map);
TIMER(config, "scantimer").configure_scanline(FUNC(igs017_state::mgcs_interrupt), "screen", 0, 1);
+ NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
+
// i/o
m_igs_mux->set_addrmap(0, &igs017_state::sdmg2p_mux_map);
@@ -4842,6 +4910,8 @@ void igs017_state::jking302us(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &igs017_state::jking302us_map);
TIMER(config, "scantimer").configure_scanline(FUNC(igs017_state::mgdh_interrupt), "screen", 0, 1);
+ NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
+
// i/o
m_igs_mux->set_addrmap(0, &igs017_state::jking302us_mux_map);
@@ -5284,9 +5354,9 @@ Notes:
***************************************************************************/
-ROM_START( sdmg2 )
+ROM_START( sdmg2754ca )
ROM_REGION( 0x80000, "maincpu", 0 )
- ROM_LOAD16_WORD_SWAP( "p0900.u25", 0x00000, 0x80000,CRC(43366f51) SHA1(48dd965dceff7de15b43c2140226a8b17a792dbc) )
+ ROM_LOAD16_WORD_SWAP( "p0900.u25", 0x00000, 0x80000, CRC(43366f51) SHA1(48dd965dceff7de15b43c2140226a8b17a792dbc) )
ROM_REGION( 0x280000, "igs017_igs031:sprites", 0 )
ROM_LOAD( "m0901.u5", 0x000000, 0x200000, CRC(9699db24) SHA1(50fc2f173c20b48d10595f01f1e9545f1b13a61b) ) // FIXED BITS (xxxxxxxx0xxxxxxx)
@@ -5299,9 +5369,9 @@ ROM_START( sdmg2 )
ROM_LOAD( "s0903.u15", 0x00000, 0x80000, CRC(ae5a441c) SHA1(923774ef73ab0f70e0db1738a4292dcbd70d2384) )
ROM_END
-ROM_START( sdmg2a ) // supposedly earlier / easier, but reports same version as the other set
+ROM_START( sdmg2754cb ) // supposedly earlier / easier, but reports same version as sdmg2754ca
ROM_REGION( 0x80000, "maincpu", 0 )
- ROM_LOAD16_WORD_SWAP( "p0900.u25", 0x00000, 0x80000,CRC(1afc95d8) SHA1(924e198437359beec2abe6ee42a985f63d70b7e3) ) // SLDH
+ ROM_LOAD16_WORD_SWAP( "p0900.u25", 0x00000, 0x80000, CRC(1afc95d8) SHA1(924e198437359beec2abe6ee42a985f63d70b7e3) ) // SLDH
ROM_REGION( 0x280000, "igs017_igs031:sprites", 0 )
ROM_LOAD( "m0901.u5", 0x000000, 0x200000, CRC(9699db24) SHA1(50fc2f173c20b48d10595f01f1e9545f1b13a61b) ) // FIXED BITS (xxxxxxxx0xxxxxxx)
@@ -5314,6 +5384,21 @@ ROM_START( sdmg2a ) // supposedly earlier / easier, but reports same version as
ROM_LOAD( "s0903.u15", 0x00000, 0x80000, CRC(ae5a441c) SHA1(923774ef73ab0f70e0db1738a4292dcbd70d2384) )
ROM_END
+ROM_START( sdmg2 ) // C5220P001 PCB
+ ROM_REGION( 0x80000, "maincpu", 0 )
+ ROM_LOAD16_WORD_SWAP( "rom.u16", 0x00000, 0x80000, CRC(362800e8) SHA1(00d93002272b1f3171ca84e67822eb31f760191f) )
+
+ ROM_REGION( 0x280000, "igs017_igs031:sprites", 0 )
+ ROM_LOAD( "m0205.u6", 0x000000, 0x200000, BAD_DUMP CRC(9699db24) SHA1(50fc2f173c20b48d10595f01f1e9545f1b13a61b) ) // ROM didn't read correctly, taken from other sets
+ ROM_LOAD( "rom.u5", 0x200000, 0x080000, CRC(3298b13b) SHA1(13b21ddeed368b7f4fea1408c8fc511244342faf) ) // FIXED BITS (xxxxxxxx0xxxxxxx)
+
+ ROM_REGION( 0x20000, "igs017_igs031:tilemaps", 0 )
+ ROM_LOAD( "text.u7", 0x000000, 0x020000, CRC(cb34cbc0) SHA1(ceedbdda085fd1acc9a575502bdf7cf998f54f05) )
+
+ ROM_REGION( 0x80000, "oki", 0 )
+ ROM_LOAD( "s0206.u3", 0x00000, 0x80000, CRC(ae5a441c) SHA1(923774ef73ab0f70e0db1738a4292dcbd70d2384) )
+ROM_END
+
/***************************************************************************
Maque Wangchao / Chaoji Da Manguan 2 - Jiaqiang Ban
@@ -6140,8 +6225,9 @@ GAME ( 1996, iqblocka, iqblock, iqblocka, iqblocka, igs017_state, init
GAME ( 1997, iqblockf, iqblock, iqblockf, iqblockf, igs017_state, init_iqblocka, ROT0, "IGS", "IQ Block (V113FR, gambling)", 0 )
GAME ( 1997, mgdh, 0, mgdh, mgdh, igs017_state, init_mgdh, ROT0, "IGS", "Manguan Daheng (Taiwan, V125T1)", MACHINE_IMPERFECT_COLORS | MACHINE_UNEMULATED_PROTECTION) // 滿貫大亨, wrong colors in betting screen, game id check (patched out)
GAME ( 1997, mgdha, mgdh, mgdha, mgdh, igs017_state, init_mgdha, ROT0, "IGS", "Manguan Daheng (Taiwan, V123T1)", 0 ) // 滿貫大亨
-GAME ( 1997, sdmg2, 0, sdmg2, sdmg2, igs017_state, init_sdmg2, ROT0, "IGS", "Chaoji Da Manguan II (China, V754C, set 1)", 0 ) // 超級大滿貫II
-GAME ( 1997, sdmg2a, sdmg2, sdmg2, sdmg2, igs017_state, init_sdmg2a, ROT0, "IGS", "Chaoji Da Manguan II (China, V754C, set 2)", 0 ) // 超級大滿貫II
+GAME ( 1997, sdmg2, 0, sdmg2, sdmg2, igs017_state, init_sdmg2, ROT0, "IGS", "Chaoji Da Manguan II (China, V765C)", MACHINE_UNEMULATED_PROTECTION | MACHINE_NOT_WORKING ) // 超級大滿貫II
+GAME ( 1997, sdmg2754ca, sdmg2, sdmg2, sdmg2, igs017_state, init_sdmg2754ca, ROT0, "IGS", "Chaoji Da Manguan II (China, V754C, set 1)", 0 ) // 超級大滿貫II
+GAME ( 1997, sdmg2754cb, sdmg2, sdmg2, sdmg2, igs017_state, init_sdmg2754cb, ROT0, "IGS", "Chaoji Da Manguan II (China, V754C, set 2)", 0 ) // 超級大滿貫II
GAME ( 1997, tjsb, 0, tjsb, tjsb, igs017_state, init_tjsb, ROT0, "IGS", "Tian Jiang Shen Bing (China, V137C)", MACHINE_UNEMULATED_PROTECTION ) // 天將神兵, fails the bonus round protection check (if enabled via DSW), see e.g. demo mode
GAME ( 1998, genius6, 0, genius6, genius6, igs017_state, init_iqblocka, ROT0, "IGS", "Genius 6 (V110F)", 0 ) // shows Chinese text in puzzle game
GAME ( 1997, genius6a, genius6, genius6, genius6, igs017_state, init_iqblocka, ROT0, "IGS", "Genius 6 (V133F)", 0 ) // clone because it has older copyright year
diff --git a/src/mame/igs/pgm.cpp b/src/mame/igs/pgm.cpp
index 9be1d26923c..a7c8977d6e4 100644
--- a/src/mame/igs/pgm.cpp
+++ b/src/mame/igs/pgm.cpp
@@ -222,19 +222,37 @@ void pgm_state::coin_counter_w(u16 data)
machine().bookkeeping().coin_counter_w(3, data & 0x0008);
}
+bool pgm_state::z80_sync(int which)
+{
+ if (!machine().side_effects_disabled())
+ {
+ // retry_access() forces the z80 to catch up before maincpu does the read
+ if (!m_z80_sync[which])
+ m_maincpu->retry_access();
+
+ m_z80_sync[which] = !m_z80_sync[which];
+ }
+
+ return m_z80_sync[which];
+}
+
u8 pgm_state::z80_ram_r(offs_t offset)
{
+ // 2 sync semaphores because of word access
+ z80_sync(offset & 1);
return m_z80_mainram[offset];
}
void pgm_state::z80_ram_w(offs_t offset, u8 data)
{
- const int pc = m_maincpu->pc();
-
- m_z80_mainram[offset] = data;
+ if (!z80_sync(offset & 1))
+ {
+ const u32 pc = m_maincpu->pc();
+ if (pc != 0xf12 && pc != 0xde2 && pc != 0x100c50 && pc != 0x100b20)
+ LOGZ80("Z80: write %04x, %02x (%06x)\n", offset, data, pc);
- if (pc != 0xf12 && pc != 0xde2 && pc != 0x100c50 && pc != 0x100b20)
- LOGZ80("Z80: write %04x, %02x (%06x)\n", offset, data, m_maincpu->pc());
+ m_z80_mainram[offset] = data;
+ }
}
void pgm_state::z80_reset_w(offs_t offset, u16 data, u16 mem_mask)
@@ -260,17 +278,23 @@ void pgm_state::z80_ctrl_w(offs_t offset, u16 data, u16 mem_mask)
LOGZ80("Z80: ctrl %04x @ %04x (%06x)\n", data, mem_mask, m_maincpu->pc());
}
-void pgm_state::m68k_l1_w(u8 data)
+template<int N>
+u8 pgm_state::m68k_latch_r()
+{
+ return z80_sync(0) ? 0 : m_soundlatch[N]->read();
+}
+
+void pgm_state::m68k_latch1_w(u8 data)
{
LOGZ80("SL 1 m68.w %02x (%06x) IRQ\n", data, m_maincpu->pc());
- m_soundlatch->write(data);
+ m_soundlatch[0]->write(data);
m_soundcpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero);
}
-void pgm_state::z80_l3_w(u8 data)
+void pgm_state::z80_latch3_w(u8 data)
{
LOGZ80("SL 3 z80.w %02x (%04x)\n", data, m_soundcpu->pc());
- m_soundlatch3->write(data);
+ m_soundlatch[2]->write(data);
}
@@ -286,9 +310,9 @@ void pgm_state::pgm_z80_mem(address_map &map)
void pgm_state::pgm_z80_io(address_map &map)
{
map(0x8000, 0x8003).rw("ics", FUNC(ics2115_device::read), FUNC(ics2115_device::write));
- map(0x8100, 0x81ff).r(m_soundlatch3, FUNC(generic_latch_8_device::read)).w(FUNC(pgm_state::z80_l3_w));
- map(0x8200, 0x82ff).rw(m_soundlatch, FUNC(generic_latch_8_device::read), FUNC(generic_latch_8_device::write));
- map(0x8400, 0x84ff).rw("soundlatch2", FUNC(generic_latch_8_device::read), FUNC(generic_latch_8_device::write));
+ map(0x8100, 0x81ff).r(m_soundlatch[2], FUNC(generic_latch_8_device::read)).w(FUNC(pgm_state::z80_latch3_w));
+ map(0x8200, 0x82ff).rw(m_soundlatch[0], FUNC(generic_latch_8_device::read), FUNC(generic_latch_8_device::write));
+ map(0x8400, 0x84ff).rw(m_soundlatch[1], FUNC(generic_latch_8_device::read), FUNC(generic_latch_8_device::write));
}
/*** 68000 (main CPU) + variants for protection devices **********************/
@@ -310,12 +334,12 @@ void pgm_state::pgm_base_mem(address_map &map)
//map(0xb06000, 0xb06001) Foreground scroll X?
//map(0xb0e000, 0xb0e001) Unknown #1
- map(0xc00003, 0xc00003).r(m_soundlatch, FUNC(generic_latch_8_device::read)).w(FUNC(pgm_state::m68k_l1_w));
- map(0xc00005, 0xc00005).rw("soundlatch2", FUNC(generic_latch_8_device::read), FUNC(generic_latch_8_device::write));
+ map(0xc00003, 0xc00003).rw(FUNC(pgm_state::m68k_latch_r<0>), FUNC(pgm_state::m68k_latch1_w));
+ map(0xc00005, 0xc00005).r(FUNC(pgm_state::m68k_latch_r<1>)).w(m_soundlatch[1], FUNC(generic_latch_8_device::write));
map(0xc00007, 0xc00007).rw("rtc", FUNC(v3021_device::read), FUNC(v3021_device::write));
map(0xc00008, 0xc00009).w(FUNC(pgm_state::z80_reset_w));
map(0xc0000a, 0xc0000b).w(FUNC(pgm_state::z80_ctrl_w));
- map(0xc0000d, 0xc0000d).rw(m_soundlatch3, FUNC(generic_latch_8_device::read), FUNC(generic_latch_8_device::write));
+ map(0xc0000d, 0xc0000d).r(FUNC(pgm_state::m68k_latch_r<2>)).w(m_soundlatch[2], FUNC(generic_latch_8_device::write));
map(0xc08000, 0xc08001).portr("P1P2");
map(0xc08002, 0xc08003).portr("P3P4");
@@ -445,6 +469,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(pgm_state::interrupt)
void pgm_state::machine_reset()
{
+ m_z80_sync[0] = m_z80_sync[1] = false;
m_soundcpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
}
@@ -453,8 +478,9 @@ u16 pgm_state::sprites_r(offs_t offset)
return m_mainram[offset];
}
-void pgm_state::video_start()
+void pgm_state::machine_start()
{
+ save_item(NAME(m_z80_sync));
}
void pgm_state::screen_vblank(int state)
@@ -497,9 +523,9 @@ void pgm_state::pgmbase(machine_config &config)
/*sound hardware */
SPEAKER(config, "mono").front_center();
- GENERIC_LATCH_8(config, m_soundlatch);
- GENERIC_LATCH_8(config, "soundlatch2");
- GENERIC_LATCH_8(config, m_soundlatch3);
+ GENERIC_LATCH_8(config, m_soundlatch[0]);
+ GENERIC_LATCH_8(config, m_soundlatch[1]);
+ GENERIC_LATCH_8(config, m_soundlatch[2]);
IGS023_VIDEO(config, m_video, 0);
m_video->set_palette(m_palette);
diff --git a/src/mame/igs/pgm.h b/src/mame/igs/pgm.h
index 17bfb2ba045..e603af5c260 100644
--- a/src/mame/igs/pgm.h
+++ b/src/mame/igs/pgm.h
@@ -37,12 +37,10 @@ public:
, m_z80_mainram(*this, "z80_mainram")
, m_soundcpu(*this, "soundcpu")
, m_palette(*this, "palette")
- , m_soundlatch(*this, "soundlatch")
- , m_soundlatch3(*this, "soundlatch3")
+ , m_soundlatch(*this, "soundlatch%u", 1)
, m_ics(*this, "ics")
, m_video(*this, "igs023")
{
- m_irq4_disabled = 0;
}
void init_pgm();
@@ -52,8 +50,8 @@ public:
void pgmbase(machine_config &config);
protected:
+ virtual void machine_start() override ATTR_COLD;
virtual void machine_reset() override ATTR_COLD;
- virtual void video_start() override ATTR_COLD;
// memory pointers
required_shared_ptr<u16> m_mainram;
@@ -64,8 +62,7 @@ protected:
// devices
required_device<cpu_device> m_maincpu;
- // hack
- int m_irq4_disabled = 0;
+ int m_irq4_disabled = 0; // hack
void pgm_base_mem(address_map &map) ATTR_COLD;
void pgm_mem(address_map &map) ATTR_COLD;
@@ -74,23 +71,24 @@ private:
// memory pointers
required_shared_ptr<u8> m_z80_mainram;
-
-
// devices
- required_device<cpu_device> m_soundcpu;
- required_device<palette_device> m_palette;
- required_device<generic_latch_8_device> m_soundlatch;
- required_device<generic_latch_8_device> m_soundlatch3;
- required_device<ics2115_device> m_ics;
- required_device<igs023_video_device> m_video;
+ required_device<cpu_device> m_soundcpu;
+ required_device<palette_device> m_palette;
+ required_device_array<generic_latch_8_device, 3> m_soundlatch;
+ required_device<ics2115_device> m_ics;
+ required_device<igs023_video_device> m_video;
+
+ bool m_z80_sync[2] = { };
void coin_counter_w(u16 data);
+ bool z80_sync(int which);
u8 z80_ram_r(offs_t offset);
void z80_ram_w(offs_t offset, u8 data);
void z80_reset_w(offs_t offset, u16 data, u16 mem_mask = ~0);
void z80_ctrl_w(offs_t offset, u16 data, u16 mem_mask = ~0);
- void m68k_l1_w(u8 data);
- void z80_l3_w(u8 data);
+ template<int N> u8 m68k_latch_r();
+ void m68k_latch1_w(u8 data);
+ void z80_latch3_w(u8 data);
void screen_vblank(int state);
TIMER_DEVICE_CALLBACK_MEMBER(interrupt);
diff --git a/src/mame/igs/pgm2.cpp b/src/mame/igs/pgm2.cpp
index f7ef1c85c21..80e95719d93 100644
--- a/src/mame/igs/pgm2.cpp
+++ b/src/mame/igs/pgm2.cpp
@@ -776,12 +776,11 @@ void pgm2_state::pgm2(machine_config &config)
NVRAM(config, "sram", nvram_device::DEFAULT_ALL_0);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ymz774_device &ymz774(YMZ774(config, "ymz774", 16384000)); // is clock correct ?
- ymz774.add_route(0, "lspeaker", 1.0);
- ymz774.add_route(1, "rspeaker", 1.0);
+ ymz774.add_route(0, "speaker", 1.0, 0);
+ ymz774.add_route(1, "speaker", 1.0, 1);
PGM2_MEMCARD(config, m_memcard[0], 0);
PGM2_MEMCARD(config, m_memcard[1], 0);
diff --git a/src/mame/igs/pgmprot_igs027a_type1.cpp b/src/mame/igs/pgmprot_igs027a_type1.cpp
index 07bd5e1ef86..e841e97d63f 100644
--- a/src/mame/igs/pgmprot_igs027a_type1.cpp
+++ b/src/mame/igs/pgmprot_igs027a_type1.cpp
@@ -187,6 +187,8 @@ void pgm_arm_type1_state::cavepgm_mem(address_map &map)
void pgm_arm_type1_state::machine_start()
{
+ pgm_state::machine_start();
+
save_item(NAME(m_value0));
save_item(NAME(m_value1));
save_item(NAME(m_valuekey));
diff --git a/src/mame/igs/pgmprot_igs027a_type1.h b/src/mame/igs/pgmprot_igs027a_type1.h
index bbfb98e0825..f1c2afa25c0 100644
--- a/src/mame/igs/pgmprot_igs027a_type1.h
+++ b/src/mame/igs/pgmprot_igs027a_type1.h
@@ -70,7 +70,6 @@ private:
optional_shared_ptr<u32> m_arm7_shareram;
optional_device<cpu_device> m_prot;
- DECLARE_MACHINE_START(pgm_arm_type1);
u32 arm7_type1_protlatch_r();
void arm7_type1_protlatch_w(offs_t offset, u32 data, u32 mem_mask);
diff --git a/src/mame/interton/vc4000_a.cpp b/src/mame/interton/vc4000_a.cpp
index 9004d256635..418ec6ee8c5 100644
--- a/src/mame/interton/vc4000_a.cpp
+++ b/src/mame/interton/vc4000_a.cpp
@@ -39,14 +39,11 @@ void vc4000_sound_device::device_start()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void vc4000_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void vc4000_sound_device::sound_stream_update(sound_stream &stream)
{
- int i;
- auto &buffer = outputs[0];
-
- for (i = 0; i < buffer.samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
- buffer.put(i, (m_reg[0] && m_pos <= m_size / 2) ? 1.0 : 0.0);
+ stream.put(0, i, (m_reg[0] && m_pos <= m_size / 2) ? 1.0 : 0.0);
if (m_pos <= m_size)
m_pos++;
if (m_pos > m_size)
diff --git a/src/mame/interton/vc4000_a.h b/src/mame/interton/vc4000_a.h
index 5012f56e1ed..34138b2151d 100644
--- a/src/mame/interton/vc4000_a.h
+++ b/src/mame/interton/vc4000_a.h
@@ -28,7 +28,7 @@ protected:
virtual void device_start() 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;
public:
void soundport_w(int mode, int data);
diff --git a/src/mame/irem/m107.cpp b/src/mame/irem/m107.cpp
index 8245455858e..e035d2b7064 100644
--- a/src/mame/irem/m107.cpp
+++ b/src/mame/irem/m107.cpp
@@ -1227,8 +1227,7 @@ void m107_state::firebarr(machine_config &config)
PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
generic_latch_8_device &soundlatch(GENERIC_LATCH_8(config, "soundlatch"));
soundlatch.data_pending_callback().set_inputline(m_soundcpu, NEC_INPUT_LINE_INTP1);
@@ -1238,12 +1237,12 @@ void m107_state::firebarr(machine_config &config)
ym2151_device &ymsnd(YM2151(config, "ymsnd", XTAL(14'318'181) / 4));
ymsnd.irq_handler().set_inputline(m_soundcpu, NEC_INPUT_LINE_INTP0);
- ymsnd.add_route(0, "lspeaker", 0.40);
- ymsnd.add_route(1, "rspeaker", 0.40);
+ ymsnd.add_route(0, "speaker", 0.40, 0);
+ ymsnd.add_route(1, "speaker", 0.40, 1);
iremga20_device &ga20(IREMGA20(config, "irem", XTAL(14'318'181) / 4));
- ga20.add_route(0, "lspeaker", 1.0);
- ga20.add_route(1, "rspeaker", 1.0);
+ ga20.add_route(0, "speaker", 1.0, 0);
+ ga20.add_route(1, "speaker", 1.0, 1);
}
void m107_state::dsoccr94(machine_config &config)
diff --git a/src/mame/irem/m119.cpp b/src/mame/irem/m119.cpp
index a4d160593f6..391d4baceea 100644
--- a/src/mame/irem/m119.cpp
+++ b/src/mame/irem/m119.cpp
@@ -114,12 +114,11 @@ void m119_state::m119(machine_config &config)
// TODO: UPD94244-210 VDP
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ymz280b_device &ymz(YMZ280B(config, "ymz", 16'934'400)); // internal?
- ymz.add_route(0, "lspeaker", 1.0);
- ymz.add_route(1, "rspeaker", 1.0);
+ ymz.add_route(0, "speaker", 1.0, 0);
+ ymz.add_route(1, "speaker", 1.0, 1);
}
diff --git a/src/mame/irem/m78.cpp b/src/mame/irem/m78.cpp
index ce8581663f4..689d42c99ba 100644
--- a/src/mame/irem/m78.cpp
+++ b/src/mame/irem/m78.cpp
@@ -343,18 +343,17 @@ void m78_state::bj92(machine_config &config)
RST_NEG_BUFFER(config, "soundirq").int_callback().set_inputline("audiocpu", 0);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
m72_audio_device &m72_audio(IREM_M72_AUDIO(config, "m72_audio"));
m72_audio.set_dac_tag("dac");
ym2151_device &ymsnd(YM2151(config, "ymsnd", 3.579545_MHz_XTAL )); // Verified on PCB
ymsnd.irq_handler().set("soundirq", FUNC(rst_neg_buffer_device::rst28_w));
- ymsnd.add_route(0, "lspeaker", 0.5);
- ymsnd.add_route(1, "rspeaker", 0.5);
+ ymsnd.add_route(0, "speaker", 0.5, 0);
+ ymsnd.add_route(1, "speaker", 0.5, 1);
- DAC_8BIT_R2R(config, "dac", 0).add_route(ALL_OUTPUTS, "lspeaker", 0.25).add_route(ALL_OUTPUTS, "rspeaker", 0.25); // unknown DAC
+ DAC_8BIT_R2R(config, "dac", 0).add_route(ALL_OUTPUTS, "speaker", 0.25, 0).add_route(ALL_OUTPUTS, "speaker", 0.25, 1); // unknown DAC
}
diff --git a/src/mame/irem/m80.cpp b/src/mame/irem/m80.cpp
index dc7a047fcce..149b91a69d5 100644
--- a/src/mame/irem/m80.cpp
+++ b/src/mame/irem/m80.cpp
@@ -390,8 +390,7 @@ void shisen_state::shisen(machine_config &config)
PALETTE(config, m_palette).set_entries(256);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
generic_latch_8_device &soundlatch(GENERIC_LATCH_8(config, "soundlatch"));
soundlatch.data_pending_callback().set("soundirq", FUNC(rst_neg_buffer_device::rst18_w));
@@ -404,10 +403,10 @@ void shisen_state::shisen(machine_config &config)
ym2151_device &ymsnd(YM2151(config, "ymsnd", 3.579545_MHz_XTAL )); // Verified on PCB
ymsnd.irq_handler().set("soundirq", FUNC(rst_neg_buffer_device::rst28_w));
- ymsnd.add_route(0, "lspeaker", 0.5);
- ymsnd.add_route(1, "rspeaker", 0.5);
+ ymsnd.add_route(0, "speaker", 0.5, 0);
+ ymsnd.add_route(1, "speaker", 0.5, 1);
- DAC_8BIT_R2R(config, "dac", 0).add_route(ALL_OUTPUTS, "lspeaker", 0.25).add_route(ALL_OUTPUTS, "rspeaker", 0.25); // Y3014B DAC
+ DAC_8BIT_R2R(config, "dac", 0).add_route(ALL_OUTPUTS, "speaker", 0.25, 0).add_route(ALL_OUTPUTS, "speaker", 0.25, 1); // Y3014B DAC
}
diff --git a/src/mame/irem/vigilant.cpp b/src/mame/irem/vigilant.cpp
index 83909ececa2..b157e896ee6 100644
--- a/src/mame/irem/vigilant.cpp
+++ b/src/mame/irem/vigilant.cpp
@@ -1281,8 +1281,7 @@ void vigilant_state::vigilant(machine_config &config)
PALETTE(config, m_palette).set_entries(512+32); // 512 real palette, 32 virtual palette
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
generic_latch_8_device &soundlatch(GENERIC_LATCH_8(config, "soundlatch"));
soundlatch.data_pending_callback().set("soundirq", FUNC(rst_neg_buffer_device::rst18_w));
@@ -1295,12 +1294,12 @@ void vigilant_state::vigilant(machine_config &config)
ym2151_device &ymsnd(YM2151(config, "ymsnd", 3.579545_MHz_XTAL));
ymsnd.irq_handler().set("soundirq", FUNC(rst_neg_buffer_device::rst28_w));
- ymsnd.add_route(0, "lspeaker", 0.28);
- ymsnd.add_route(1, "rspeaker", 0.28);
+ ymsnd.add_route(0, "speaker", 0.28, 0);
+ ymsnd.add_route(1, "speaker", 0.28, 1);
dac_8bit_r2r_device &dac(DAC_8BIT_R2R(config, "dac", 0)); // unknown DAC
- dac.add_route(ALL_OUTPUTS, "lspeaker", 0.5);
- dac.add_route(ALL_OUTPUTS, "rspeaker", 0.5);
+ dac.add_route(ALL_OUTPUTS, "speaker", 0.5, 0);
+ dac.add_route(ALL_OUTPUTS, "speaker", 0.5, 1);
}
void vigilant_state::buccanrs(machine_config &config)
@@ -1329,8 +1328,7 @@ void vigilant_state::buccanrs(machine_config &config)
PALETTE(config, m_palette).set_entries(512+32); // 512 real palette, 32 virtual palette
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
generic_latch_8_device &soundlatch(GENERIC_LATCH_8(config, "soundlatch"));
soundlatch.data_pending_callback().set("soundirq", FUNC(rst_neg_buffer_device::rst18_w));
@@ -1343,28 +1341,28 @@ void vigilant_state::buccanrs(machine_config &config)
ym2203_device &ym1(YM2203(config, "ym1", 18.432_MHz_XTAL / 6));
ym1.irq_handler().set("soundirq", FUNC(rst_neg_buffer_device::rst28_w));
- ym1.add_route(0, "lspeaker", 0.35);
- ym1.add_route(0, "rspeaker", 0.35);
- ym1.add_route(1, "lspeaker", 0.35);
- ym1.add_route(1, "rspeaker", 0.35);
- ym1.add_route(2, "lspeaker", 0.35);
- ym1.add_route(2, "rspeaker", 0.35);
- ym1.add_route(3, "lspeaker", 0.50);
- ym1.add_route(3, "rspeaker", 0.50);
+ ym1.add_route(0, "speaker", 0.35, 0);
+ ym1.add_route(0, "speaker", 0.35, 1);
+ ym1.add_route(1, "speaker", 0.35, 0);
+ ym1.add_route(1, "speaker", 0.35, 1);
+ ym1.add_route(2, "speaker", 0.35, 0);
+ ym1.add_route(2, "speaker", 0.35, 1);
+ ym1.add_route(3, "speaker", 0.50, 0);
+ ym1.add_route(3, "speaker", 0.50, 1);
ym2203_device &ym2(YM2203(config, "ym2", 18.432_MHz_XTAL / 6));
- ym2.add_route(0, "lspeaker", 0.35);
- ym2.add_route(0, "rspeaker", 0.35);
- ym2.add_route(1, "lspeaker", 0.35);
- ym2.add_route(1, "rspeaker", 0.35);
- ym2.add_route(2, "lspeaker", 0.35);
- ym2.add_route(2, "rspeaker", 0.35);
- ym2.add_route(3, "lspeaker", 0.50);
- ym2.add_route(3, "rspeaker", 0.50);
+ ym2.add_route(0, "speaker", 0.35, 0);
+ ym2.add_route(0, "speaker", 0.35, 1);
+ ym2.add_route(1, "speaker", 0.35, 0);
+ ym2.add_route(1, "speaker", 0.35, 1);
+ ym2.add_route(2, "speaker", 0.35, 0);
+ ym2.add_route(2, "speaker", 0.35, 1);
+ ym2.add_route(3, "speaker", 0.50, 0);
+ ym2.add_route(3, "speaker", 0.50, 1);
dac_8bit_r2r_device &dac(DAC_8BIT_R2R(config, "dac", 0)); // unknown DAC
- dac.add_route(ALL_OUTPUTS, "lspeaker", 0.35);
- dac.add_route(ALL_OUTPUTS, "rspeaker", 0.35);
+ dac.add_route(ALL_OUTPUTS, "speaker", 0.35, 0);
+ dac.add_route(ALL_OUTPUTS, "speaker", 0.35, 1);
}
void captainx_state::captainx(machine_config &config)
@@ -1406,8 +1404,7 @@ void vigilant_state::kikcubic(machine_config &config)
PALETTE(config, m_palette).set_entries(256);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
generic_latch_8_device &soundlatch(GENERIC_LATCH_8(config, "soundlatch"));
soundlatch.data_pending_callback().set("soundirq", FUNC(rst_neg_buffer_device::rst18_w));
@@ -1420,12 +1417,12 @@ void vigilant_state::kikcubic(machine_config &config)
ym2151_device &ymsnd(YM2151(config, "ymsnd", 3.579545_MHz_XTAL));
ymsnd.irq_handler().set("soundirq", FUNC(rst_neg_buffer_device::rst28_w));
- ymsnd.add_route(0, "lspeaker", 0.28);
- ymsnd.add_route(1, "rspeaker", 0.28);
+ ymsnd.add_route(0, "speaker", 0.28, 0);
+ ymsnd.add_route(1, "speaker", 0.28, 1);
dac_8bit_r2r_device &dac(DAC_8BIT_R2R(config, "dac", 0)); // unknown DAC
- dac.add_route(ALL_OUTPUTS, "lspeaker", 0.5);
- dac.add_route(ALL_OUTPUTS, "rspeaker", 0.5);
+ dac.add_route(ALL_OUTPUTS, "speaker", 0.5, 0);
+ dac.add_route(ALL_OUTPUTS, "speaker", 0.5, 1);
}
@@ -1455,8 +1452,7 @@ void vigilant_state::bowmen(machine_config &config)
PALETTE(config, m_palette).set_entries(512 + 32); // 512 real palette, 32 virtual palette
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
generic_latch_8_device &soundlatch(GENERIC_LATCH_8(config, "soundlatch"));
soundlatch.data_pending_callback().set("soundirq", FUNC(rst_neg_buffer_device::rst18_w));
@@ -1469,28 +1465,28 @@ void vigilant_state::bowmen(machine_config &config)
ym2203_device &ym1(YM2203(config, "ym1", 18_MHz_XTAL / 6));
ym1.irq_handler().set("soundirq", FUNC(rst_neg_buffer_device::rst28_w));
- ym1.add_route(0, "lspeaker", 0.35);
- ym1.add_route(0, "rspeaker", 0.35);
- ym1.add_route(1, "lspeaker", 0.35);
- ym1.add_route(1, "rspeaker", 0.35);
- ym1.add_route(2, "lspeaker", 0.35);
- ym1.add_route(2, "rspeaker", 0.35);
- ym1.add_route(3, "lspeaker", 0.50);
- ym1.add_route(3, "rspeaker", 0.50);
+ ym1.add_route(0, "speaker", 0.35, 0);
+ ym1.add_route(0, "speaker", 0.35, 1);
+ ym1.add_route(1, "speaker", 0.35, 0);
+ ym1.add_route(1, "speaker", 0.35, 1);
+ ym1.add_route(2, "speaker", 0.35, 0);
+ ym1.add_route(2, "speaker", 0.35, 1);
+ ym1.add_route(3, "speaker", 0.50, 0);
+ ym1.add_route(3, "speaker", 0.50, 1);
ym2203_device &ym2(YM2203(config, "ym2", 18_MHz_XTAL / 6));
- ym2.add_route(0, "lspeaker", 0.35);
- ym2.add_route(0, "rspeaker", 0.35);
- ym2.add_route(1, "lspeaker", 0.35);
- ym2.add_route(1, "rspeaker", 0.35);
- ym2.add_route(2, "lspeaker", 0.35);
- ym2.add_route(2, "rspeaker", 0.35);
- ym2.add_route(3, "lspeaker", 0.50);
- ym2.add_route(3, "rspeaker", 0.50);
+ ym2.add_route(0, "speaker", 0.35, 0);
+ ym2.add_route(0, "speaker", 0.35, 1);
+ ym2.add_route(1, "speaker", 0.35, 0);
+ ym2.add_route(1, "speaker", 0.35, 1);
+ ym2.add_route(2, "speaker", 0.35, 0);
+ ym2.add_route(2, "speaker", 0.35, 1);
+ ym2.add_route(3, "speaker", 0.50, 0);
+ ym2.add_route(3, "speaker", 0.50, 1);
dac_8bit_r2r_device &dac(DAC_8BIT_R2R(config, "dac", 0)); // unknown DAC
- dac.add_route(ALL_OUTPUTS, "lspeaker", 0.35);
- dac.add_route(ALL_OUTPUTS, "rspeaker", 0.35);
+ dac.add_route(ALL_OUTPUTS, "speaker", 0.35, 0);
+ dac.add_route(ALL_OUTPUTS, "speaker", 0.35, 1);
}
diff --git a/src/mame/itech/iteagle.cpp b/src/mame/itech/iteagle.cpp
index ad9723f58c3..bb8469cf702 100644
--- a/src/mame/itech/iteagle.cpp
+++ b/src/mame/itech/iteagle.cpp
@@ -195,7 +195,7 @@ void iteagle_state::iteagle(machine_config &config)
m_fpga->guny_callback().set_ioport("GUNY1");
es1373_device &pci_sound(ES1373(config, PCI_ID_SOUND, 0));
- pci_sound.add_route(0, PCI_ID_SOUND":lspeaker", 1.0).add_route(1, PCI_ID_SOUND":rspeaker", 1.0);
+ pci_sound.add_route(0, PCI_ID_SOUND":speaker", 1.0, 0).add_route(1, PCI_ID_SOUND":speaker", 1.0, 1);
pci_sound.irq_handler().set_inputline(m_maincpu, MIPS3_IRQ3);
voodoo_3_pci_device &voodoo(VOODOO_3_PCI(config, PCI_ID_VIDEO, 0, m_maincpu, "screen"));
diff --git a/src/mame/itech/itech32.cpp b/src/mame/itech/itech32.cpp
index 7d63beab6e1..ceb01d738a1 100644
--- a/src/mame/itech/itech32.cpp
+++ b/src/mame/itech/itech32.cpp
@@ -1789,8 +1789,7 @@ void itech32_state::base_devices(machine_config &config)
m_screen->set_palette(m_palette);
m_screen->screen_vblank().set(FUNC(itech32_state::generate_int1));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ES5506(config, m_ensoniq, SOUND_CLOCK);
m_ensoniq->set_region0("ensoniq.0");
@@ -1798,8 +1797,8 @@ void itech32_state::base_devices(machine_config &config)
m_ensoniq->set_region2("ensoniq.2");
m_ensoniq->set_region3("ensoniq.3");
m_ensoniq->set_channels(1); // channels
- m_ensoniq->add_route(0, "rspeaker", 0.1); // swapped stereo
- m_ensoniq->add_route(1, "lspeaker", 0.1);
+ m_ensoniq->add_route(0, "speaker", 0.1, 1); // swapped stereo
+ m_ensoniq->add_route(1, "speaker", 0.1, 0);
}
void itech32_state::via(machine_config &config)
diff --git a/src/mame/jaleco/acommand.cpp b/src/mame/jaleco/acommand.cpp
index ec06efcb249..1c6648d4a90 100644
--- a/src/mame/jaleco/acommand.cpp
+++ b/src/mame/jaleco/acommand.cpp
@@ -509,16 +509,15 @@ void acommand_state::acommand(machine_config &config)
MEGASYS1_TILEMAP(config, m_txtmap, m_palette, 0x2700);
// assume amplified stereo
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
OKIM6295(config, m_oki[0], 2112000, okim6295_device::PIN7_HIGH); // clock frequency & pin 7 not verified
- m_oki[0]->add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- m_oki[0]->add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ m_oki[0]->add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ m_oki[0]->add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
OKIM6295(config, m_oki[1], 2112000, okim6295_device::PIN7_HIGH); // clock frequency & pin 7 not verified
- m_oki[1]->add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- m_oki[1]->add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ m_oki[1]->add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ m_oki[1]->add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
}
/***************************************************************************
diff --git a/src/mame/jaleco/bestleag.cpp b/src/mame/jaleco/bestleag.cpp
index c5dfa30f802..7be2d355891 100644
--- a/src/mame/jaleco/bestleag.cpp
+++ b/src/mame/jaleco/bestleag.cpp
@@ -388,12 +388,11 @@ void bestleag_state::bestleag(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_bestleag);
PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 0x800);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
OKIM6295(config, m_oki, 1000000, okim6295_device::PIN7_HIGH); /* Hand-tuned */
- m_oki->add_route(ALL_OUTPUTS, "lspeaker", 1.00);
- m_oki->add_route(ALL_OUTPUTS, "rspeaker", 1.00);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 1.00, 0);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 1.00, 1);
}
diff --git a/src/mame/jaleco/bigstrkb.cpp b/src/mame/jaleco/bigstrkb.cpp
index d2ee33df87e..b45e3b03c30 100644
--- a/src/mame/jaleco/bigstrkb.cpp
+++ b/src/mame/jaleco/bigstrkb.cpp
@@ -396,17 +396,16 @@ void bigstrkb_state::bigstrkb(machine_config &config)
PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 0x400);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
// YM2151(config, "ymsnd", 4'000'000);
okim6295_device &oki1(OKIM6295(config, "oki1", 4'000'000, okim6295_device::PIN7_HIGH));
- oki1.add_route(ALL_OUTPUTS, "lspeaker", 0.30);
- oki1.add_route(ALL_OUTPUTS, "rspeaker", 0.30);
+ oki1.add_route(ALL_OUTPUTS, "speaker", 0.30, 0);
+ oki1.add_route(ALL_OUTPUTS, "speaker", 0.30, 1);
okim6295_device &oki2(OKIM6295(config, "oki2", 4'000'000, okim6295_device::PIN7_HIGH));
- oki2.add_route(ALL_OUTPUTS, "lspeaker", 0.30);
- oki2.add_route(ALL_OUTPUTS, "rspeaker", 0.30);
+ oki2.add_route(ALL_OUTPUTS, "speaker", 0.30, 0);
+ oki2.add_route(ALL_OUTPUTS, "speaker", 0.30, 1);
}
// Rom Loading
diff --git a/src/mame/jaleco/bnstars.cpp b/src/mame/jaleco/bnstars.cpp
index 1f56327d649..60e9b1e6801 100644
--- a/src/mame/jaleco/bnstars.cpp
+++ b/src/mame/jaleco/bnstars.cpp
@@ -707,25 +707,24 @@ void ms32_bnstars_state::bnstars(machine_config &config)
// m_sysctrl->set_invert_vblank_lines(true);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
YMF271(config, m_ymf[0], XTAL(16'934'400)); // 16.9344MHz
- m_ymf[0]->add_route(0, "lspeaker", 1.0);
- m_ymf[0]->add_route(1, "rspeaker", 1.0);
+ m_ymf[0]->add_route(0, "speaker", 1.0, 0);
+ m_ymf[0]->add_route(1, "speaker", 1.0, 1);
// Output 2/3 not used?
-// m_ymf[0]->add_route(2, "lspeaker", 1.0);
-// m_ymf[0]->add_route(3, "rspeaker", 1.0);
+// m_ymf[0]->add_route(2, "speaker", 1.0);
+// m_ymf[0]->add_route(3, "speaker", 1.0);
YMF271(config, m_ymf[1], XTAL(16'934'400)); // 16.9344MHz
- m_ymf[1]->add_route(0, "lspeaker", 1.0);
- m_ymf[1]->add_route(1, "rspeaker", 1.0);
+ m_ymf[1]->add_route(0, "speaker", 1.0, 0);
+ m_ymf[1]->add_route(1, "speaker", 1.0, 1);
// Output 2/3 not used?
-// m_ymf[1]->add_route(2, "lspeaker", 1.0);
-// m_ymf[1]->add_route(3, "rspeaker", 1.0);
+// m_ymf[1]->add_route(2, "speaker", 1.0);
+// m_ymf[1]->add_route(3, "speaker", 1.0);
}
diff --git a/src/mame/jaleco/cischeat.cpp b/src/mame/jaleco/cischeat.cpp
index 340dfcdfaad..b75de642569 100644
--- a/src/mame/jaleco/cischeat.cpp
+++ b/src/mame/jaleco/cischeat.cpp
@@ -2116,8 +2116,7 @@ void cischeat_state::bigrun(machine_config &config)
MEGASYS1_TILEMAP(config, m_tmap[2], m_palette, 0x3600/2);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_16(config, m_soundlatch);
GENERIC_LATCH_16(config, m_soundlatch2);
@@ -2125,16 +2124,16 @@ void cischeat_state::bigrun(machine_config &config)
// TODO: all sound frequencies unverified (assume same as Mega System 1)
ym2151_device &ymsnd(YM2151(config, "ymsnd", 7000000/2));
ymsnd.irq_handler().set(FUNC(cischeat_state::sound_irq));
- ymsnd.add_route(0, "lspeaker", 0.50);
- ymsnd.add_route(1, "rspeaker", 0.50);
+ ymsnd.add_route(0, "speaker", 0.50, 0);
+ ymsnd.add_route(1, "speaker", 0.50, 1);
OKIM6295(config, m_oki1, 4000000, okim6295_device::PIN7_HIGH); // clock frequency & pin 7 not verified
- m_oki1->add_route(ALL_OUTPUTS, "lspeaker", 0.25);
- m_oki1->add_route(ALL_OUTPUTS, "rspeaker", 0.25);
+ m_oki1->add_route(ALL_OUTPUTS, "speaker", 0.25, 0);
+ m_oki1->add_route(ALL_OUTPUTS, "speaker", 0.25, 1);
OKIM6295(config, m_oki2, 4000000, okim6295_device::PIN7_HIGH); // clock frequency & pin 7 not verified
- m_oki2->add_route(ALL_OUTPUTS, "lspeaker", 0.25);
- m_oki2->add_route(ALL_OUTPUTS, "rspeaker", 0.25);
+ m_oki2->add_route(ALL_OUTPUTS, "speaker", 0.25, 0);
+ m_oki2->add_route(ALL_OUTPUTS, "speaker", 0.25, 1);
}
void cischeat_state::bigrun_d65006(machine_config &config)
@@ -2295,16 +2294,15 @@ void cischeat_state::scudhamm(machine_config &config)
MEGASYS1_TILEMAP(config, m_tmap[2], m_palette, 0x4e00/2);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
OKIM6295(config, m_oki1, 4000000/2, okim6295_device::PIN7_HIGH); // pin 7 not verified
- m_oki1->add_route(ALL_OUTPUTS, "lspeaker", 0.5);
- m_oki1->add_route(ALL_OUTPUTS, "rspeaker", 0.5);
+ m_oki1->add_route(ALL_OUTPUTS, "speaker", 0.5, 0);
+ m_oki1->add_route(ALL_OUTPUTS, "speaker", 0.5, 1);
OKIM6295(config, m_oki2, 4000000/2, okim6295_device::PIN7_HIGH); // pin 7 not verified
- m_oki2->add_route(ALL_OUTPUTS, "lspeaker", 0.5);
- m_oki2->add_route(ALL_OUTPUTS, "rspeaker", 0.5);
+ m_oki2->add_route(ALL_OUTPUTS, "speaker", 0.5, 0);
+ m_oki2->add_route(ALL_OUTPUTS, "speaker", 0.5, 1);
}
@@ -2399,18 +2397,17 @@ void captflag_state::captflag(machine_config &config)
config.set_default_layout(layout_captflag);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
OKIM6295(config, m_oki1, 4000000/2, okim6295_device::PIN7_HIGH); // pin 7 not verified
m_oki1->set_addrmap(0, &captflag_state::oki1_map);
- m_oki1->add_route(ALL_OUTPUTS, "lspeaker", 0.5);
- m_oki1->add_route(ALL_OUTPUTS, "rspeaker", 0.5);
+ m_oki1->add_route(ALL_OUTPUTS, "speaker", 0.5, 0);
+ m_oki1->add_route(ALL_OUTPUTS, "speaker", 0.5, 1);
OKIM6295(config, m_oki2, 4000000/2, okim6295_device::PIN7_HIGH); // pin 7 not verified
m_oki2->set_addrmap(0, &captflag_state::oki2_map);
- m_oki2->add_route(ALL_OUTPUTS, "lspeaker", 0.5);
- m_oki2->add_route(ALL_OUTPUTS, "rspeaker", 0.5);
+ m_oki2->add_route(ALL_OUTPUTS, "speaker", 0.5, 0);
+ m_oki2->add_route(ALL_OUTPUTS, "speaker", 0.5, 1);
}
diff --git a/src/mame/jaleco/jaleco_vj_pc.cpp b/src/mame/jaleco/jaleco_vj_pc.cpp
index 234fce72cd5..48482772194 100644
--- a/src/mame/jaleco/jaleco_vj_pc.cpp
+++ b/src/mame/jaleco/jaleco_vj_pc.cpp
@@ -46,7 +46,7 @@ when actually playing the games because otherwise you'll be sending inputs to th
jaleco_vj_pc_device::jaleco_vj_pc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, JALECO_VJ_PC, tag, owner, clock),
- device_mixer_interface(mconfig, *this, 2),
+ device_mixer_interface(mconfig, *this),
m_maincpu(*this, "maincpu"),
m_king_qtaro(*this, "pci:08.0"),
m_sound(*this, "isa1:vj_sound"),
@@ -95,8 +95,8 @@ void jaleco_vj_pc_device::sound_config(device_t &device)
{
jaleco_vj_isa16_sound_device &sound = downcast<jaleco_vj_isa16_sound_device &>(device);
sound.set_steppingstage_mode(m_is_steppingstage);
- sound.add_route(0, *this, 1.0, AUTO_ALLOC_INPUT, 0);
- sound.add_route(1, *this, 1.0, AUTO_ALLOC_INPUT, 1);
+ sound.add_route(0, *this, 1.0, 0);
+ sound.add_route(1, *this, 1.0, 1);
}
void jaleco_vj_pc_device::boot_state_w(uint8_t data)
diff --git a/src/mame/jaleco/jaleco_vj_sound.cpp b/src/mame/jaleco/jaleco_vj_sound.cpp
index da22c550fb8..171ef907b7d 100644
--- a/src/mame/jaleco/jaleco_vj_sound.cpp
+++ b/src/mame/jaleco/jaleco_vj_sound.cpp
@@ -239,7 +239,7 @@ void jaleco_vj_isa16_sound_device::comm_w(offs_t offset, uint16_t data, uint16_t
jaleco_vj_isa16_sound_device::jaleco_vj_isa16_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, JALECO_VJ_ISA16_SOUND, tag, owner, clock),
device_isa16_card_interface(mconfig, *this),
- device_mixer_interface(mconfig, *this, 2),
+ device_mixer_interface(mconfig, *this),
m_ymz(*this, "ymz%u", 1),
m_ymzram(*this, "ymz_ram"),
m_ymzram2(*this, "ymz_ram2"),
@@ -260,12 +260,12 @@ void jaleco_vj_isa16_sound_device::device_add_mconfig(machine_config &config)
// BGM normal
YMZ280B(config, m_ymz[0], 16.9344_MHz_XTAL);
m_ymz[0]->set_addrmap(0, &jaleco_vj_isa16_sound_device::ymz280b_map);
- m_ymz[0]->add_route(1, *this, 1.0, AUTO_ALLOC_INPUT, 0);
+ m_ymz[0]->add_route(1, *this, 1.0, 0);
// BGM subwoofer
YMZ280B(config, m_ymz[1], 16.9344_MHz_XTAL);
m_ymz[1]->set_addrmap(0, &jaleco_vj_isa16_sound_device::ymz280b_map2);
- m_ymz[1]->add_route(1, *this, 1.0, AUTO_ALLOC_INPUT, 1);
+ m_ymz[1]->add_route(1, *this, 1.0, 1);
}
void jaleco_vj_isa16_sound_device::device_start()
diff --git a/src/mame/jaleco/megasys1.cpp b/src/mame/jaleco/megasys1.cpp
index 057a0fc40ef..91d8ba85820 100644
--- a/src/mame/jaleco/megasys1.cpp
+++ b/src/mame/jaleco/megasys1.cpp
@@ -1917,24 +1917,23 @@ void megasys1_state::system_base(machine_config &config)
m_tmap[2]->set_screen_tag(m_screen);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_16(config, m_soundlatch[0]);
GENERIC_LATCH_16(config, m_soundlatch[1]);
ym2151_device &ymsnd(YM2151(config, "ymsnd", SOUND_CPU_CLOCK/2)); /* 3.5MHz (7MHz / 2) verified */
ymsnd.irq_handler().set(FUNC(megasys1_state::sound_irq));
- ymsnd.add_route(0, "lspeaker", 0.80);
- ymsnd.add_route(1, "rspeaker", 0.80);
+ ymsnd.add_route(0, "speaker", 0.80, 0);
+ ymsnd.add_route(1, "speaker", 0.80, 1);
OKIM6295(config, m_oki[0], OKI4_SOUND_CLOCK, okim6295_device::PIN7_HIGH); /* 4MHz verified */
- m_oki[0]->add_route(ALL_OUTPUTS, "lspeaker", 0.30);
- m_oki[0]->add_route(ALL_OUTPUTS, "rspeaker", 0.30);
+ m_oki[0]->add_route(ALL_OUTPUTS, "speaker", 0.30, 0);
+ m_oki[0]->add_route(ALL_OUTPUTS, "speaker", 0.30, 1);
OKIM6295(config, m_oki[1], OKI4_SOUND_CLOCK, okim6295_device::PIN7_HIGH); /* 4MHz verified */
- m_oki[1]->add_route(ALL_OUTPUTS, "lspeaker", 0.30);
- m_oki[1]->add_route(ALL_OUTPUTS, "rspeaker", 0.30);
+ m_oki[1]->add_route(ALL_OUTPUTS, "speaker", 0.30, 0);
+ m_oki[1]->add_route(ALL_OUTPUTS, "speaker", 0.30, 1);
}
void megasys1_typea_state::system_A(machine_config &config)
@@ -2002,8 +2001,8 @@ void megasys1_typea_state::system_A_kickoffb(machine_config &config)
ym2203_device &ymsnd(YM2203(config.replace(), "ymsnd", SOUND_CPU_CLOCK / 2));
ymsnd.irq_handler().set(FUNC(megasys1_typea_state::sound_irq));
- ymsnd.add_route(ALL_OUTPUTS, "lspeaker", 0.80);
- ymsnd.add_route(ALL_OUTPUTS, "rspeaker", 0.80);
+ ymsnd.add_route(ALL_OUTPUTS, "speaker", 0.80, 0);
+ ymsnd.add_route(ALL_OUTPUTS, "speaker", 0.80, 1);
}
void megasys1_typea_state::system_A_p47bl(machine_config &config)
@@ -2027,13 +2026,13 @@ void megasys1_typea_state::system_A_p47bl(machine_config &config)
// OKI M5205
MSM5205(config, m_p47bl_adpcm[0], 384000);
m_p47bl_adpcm[0]->set_prescaler_selector(msm5205_device::SEX_4B);
- m_p47bl_adpcm[0]->add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- m_p47bl_adpcm[0]->add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ m_p47bl_adpcm[0]->add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ m_p47bl_adpcm[0]->add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
MSM5205(config, m_p47bl_adpcm[1], 384000);
m_p47bl_adpcm[1]->set_prescaler_selector(msm5205_device::SEX_4B);
- m_p47bl_adpcm[1]->add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- m_p47bl_adpcm[1]->add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ m_p47bl_adpcm[1]->add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ m_p47bl_adpcm[1]->add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
}
void megasys1_state::system_B(machine_config &config)
@@ -2115,13 +2114,12 @@ void megasys1_state::system_Bbl(machine_config &config)
m_tmap[2]->set_screen_tag(m_screen);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
/* just the one OKI, used for sound and music */
OKIM6295(config, m_oki[0], OKI4_SOUND_CLOCK, okim6295_device::PIN7_HIGH);
- m_oki[0]->add_route(ALL_OUTPUTS, "lspeaker", 0.30);
- m_oki[0]->add_route(ALL_OUTPUTS, "rspeaker", 0.30);
+ m_oki[0]->add_route(ALL_OUTPUTS, "speaker", 0.30, 0);
+ m_oki[0]->add_route(ALL_OUTPUTS, "speaker", 0.30, 1);
}
void megasys1_bc_iosim_state::system_B_hayaosi1(machine_config &config)
@@ -2131,12 +2129,12 @@ void megasys1_bc_iosim_state::system_B_hayaosi1(machine_config &config)
/* basic machine hardware */
OKIM6295(config.replace(), m_oki[0], 2000000, okim6295_device::PIN7_HIGH); /* correct speed, but unknown OSC + divider combo */
- m_oki[0]->add_route(ALL_OUTPUTS, "lspeaker", 0.30);
- m_oki[0]->add_route(ALL_OUTPUTS, "rspeaker", 0.30);
+ m_oki[0]->add_route(ALL_OUTPUTS, "speaker", 0.30, 0);
+ m_oki[0]->add_route(ALL_OUTPUTS, "speaker", 0.30, 1);
OKIM6295(config.replace(), m_oki[1], 2000000, okim6295_device::PIN7_HIGH); /* correct speed, but unknown OSC + divider combo */
- m_oki[1]->add_route(ALL_OUTPUTS, "lspeaker", 0.30);
- m_oki[1]->add_route(ALL_OUTPUTS, "rspeaker", 0.30);
+ m_oki[1]->add_route(ALL_OUTPUTS, "speaker", 0.30, 0);
+ m_oki[1]->add_route(ALL_OUTPUTS, "speaker", 0.30, 1);
}
void megasys1_state::system_C(machine_config &config)
diff --git a/src/mame/jaleco/ms32.cpp b/src/mame/jaleco/ms32.cpp
index c6d91b712c8..30d8452cb2f 100644
--- a/src/mame/jaleco/ms32.cpp
+++ b/src/mame/jaleco/ms32.cpp
@@ -1749,18 +1749,17 @@ void ms32_state::ms32(machine_config &config)
m_sprite->set_color_entries(16);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
YMF271(config, m_ymf, XTAL(16'934'400)); // 16.9344MHz
- m_ymf->add_route(0, "lspeaker", 1.0);
- m_ymf->add_route(1, "rspeaker", 1.0);
+ m_ymf->add_route(0, "speaker", 1.0, 0);
+ m_ymf->add_route(1, "speaker", 1.0, 1);
// Output 2/3 not used?
-// m_ymf->add_route(2, "lspeaker", 1.0);
-// m_ymf->add_route(3, "rspeaker", 1.0);
+// m_ymf->add_route(2, "speaker", 1.0);
+// m_ymf->add_route(3, "speaker", 1.0);
}
void ms32_state::ms32_invert_lines(machine_config &config)
diff --git a/src/mame/jaleco/tetrisp2.cpp b/src/mame/jaleco/tetrisp2.cpp
index 5c47ea3a236..896601620c4 100644
--- a/src/mame/jaleco/tetrisp2.cpp
+++ b/src/mame/jaleco/tetrisp2.cpp
@@ -1819,12 +1819,11 @@ void tetrisp2_state::tetrisp2(machine_config &config)
setup_main_sysctrl(config, XTAL(48'000'000));
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ymz280b_device &ymz(YMZ280B(config, "ymz", XTAL(16'934'400))); // 16.9344MHz
- ymz.add_route(0, "lspeaker", 1.0);
- ymz.add_route(1, "rspeaker", 1.0);
+ ymz.add_route(0, "speaker", 1.0, 0);
+ ymz.add_route(1, "speaker", 1.0, 1);
}
@@ -1886,13 +1885,12 @@ void rockn_state::rockn(machine_config &config)
setup_main_sysctrl(config, XTAL(48'000'000));
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ymz280b_device &ymz(YMZ280B(config, "ymz", XTAL(16'934'400))); // 16.9344MHz
ymz.set_addrmap(0, &rockn_state::rockn1_ymz_map);
- ymz.add_route(0, "lspeaker", 1.0);
- ymz.add_route(1, "rspeaker", 1.0);
+ ymz.add_route(0, "speaker", 1.0, 0);
+ ymz.add_route(1, "speaker", 1.0, 1);
}
@@ -1920,13 +1918,12 @@ void rockn_state::rockn2(machine_config &config)
setup_main_sysctrl(config, XTAL(48'000'000));
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ymz280b_device &ymz(YMZ280B(config, "ymz", XTAL(16'934'400))); // 16.9344MHz
ymz.set_addrmap(0, &rockn_state::rockn2_ymz_map);
- ymz.add_route(0, "lspeaker", 1.0);
- ymz.add_route(1, "rspeaker", 1.0);
+ ymz.add_route(0, "speaker", 1.0, 0);
+ ymz.add_route(1, "speaker", 1.0, 1);
}
void rocknms_state::sub_field_irq_w(int state)
@@ -2001,13 +1998,12 @@ void rocknms_state::rocknms(machine_config &config)
m_sub_sysctrl->sound_reset_cb().set(FUNC(rocknms_state::sub_sound_reset_line_w));
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ymz280b_device &ymz(YMZ280B(config, "ymz", XTAL(16'934'400))); // 16.9344MHz
ymz.set_addrmap(0, &rocknms_state::rockn1_ymz_map);
- ymz.add_route(0, "lspeaker", 1.0);
- ymz.add_route(1, "rspeaker", 1.0);
+ ymz.add_route(0, "speaker", 1.0, 0);
+ ymz.add_route(1, "speaker", 1.0, 1);
}
void stepstag_state::field_cb(int state)
@@ -2114,15 +2110,14 @@ void stepstag_state::stepstag(machine_config &config)
config.set_default_layout(layout_stepstag);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_16(config, m_soundlatch);
JALECO_VJ_PC(config, m_jaleco_vj_pc, 0);
m_jaleco_vj_pc->set_steppingstage_mode(true);
- m_jaleco_vj_pc->add_route(0, "lspeaker", 1.0);
- m_jaleco_vj_pc->add_route(1, "rspeaker", 1.0);
+ m_jaleco_vj_pc->add_route(0, "speaker", 1.0, 0);
+ m_jaleco_vj_pc->add_route(1, "speaker", 1.0, 1);
}
void stepstag_state::vjdash(machine_config &config) // 4 Screens
@@ -2202,15 +2197,14 @@ void stepstag_state::vjdash(machine_config &config) // 4 Screens
config.set_default_layout(layout_vjdash);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_16(config, m_soundlatch);
JALECO_VJ_PC(config, m_jaleco_vj_pc, 0);
m_jaleco_vj_pc->set_steppingstage_mode(false);
- m_jaleco_vj_pc->add_route(0, "lspeaker", 1.0);
- m_jaleco_vj_pc->add_route(1, "rspeaker", 1.0);
+ m_jaleco_vj_pc->add_route(0, "speaker", 1.0, 0);
+ m_jaleco_vj_pc->add_route(1, "speaker", 1.0, 1);
}
void stepstag_state::machine_start()
diff --git a/src/mame/jpm/jpmsys7.cpp b/src/mame/jpm/jpmsys7.cpp
index dd04774c81d..bf9707ff323 100644
--- a/src/mame/jpm/jpmsys7.cpp
+++ b/src/mame/jpm/jpmsys7.cpp
@@ -64,8 +64,7 @@ void jpmsys7_state::jpmsys7(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &jpmsys7_state::jpmsys7_map);
MCF5206E_PERIPHERAL(config, "maincpu_onboard", 0, m_maincpu);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
/* unknown sound (probably DMA driven DAC) */
}
diff --git a/src/mame/jpm/pluto5.cpp b/src/mame/jpm/pluto5.cpp
index 5895840d254..7087e948d80 100644
--- a/src/mame/jpm/pluto5.cpp
+++ b/src/mame/jpm/pluto5.cpp
@@ -272,8 +272,7 @@ void pluto5_state::pluto5(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &pluto5_state::pluto5_map);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
// unknown sound
}
diff --git a/src/mame/jpm/pluto6.cpp b/src/mame/jpm/pluto6.cpp
index f2c00addb74..cf1f01cd54c 100644
--- a/src/mame/jpm/pluto6.cpp
+++ b/src/mame/jpm/pluto6.cpp
@@ -79,8 +79,7 @@ void pluto6_state::pluto6(machine_config &config)
MCF5206E_PERIPHERAL(config, "maincpu_onboard", 0, m_maincpu);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
diff --git a/src/mame/kaneko/djboy.cpp b/src/mame/kaneko/djboy.cpp
index bf7dcedc52f..734d6c6472a 100644
--- a/src/mame/kaneko/djboy.cpp
+++ b/src/mame/kaneko/djboy.cpp
@@ -689,24 +689,23 @@ void djboy_state::djboy(machine_config &config)
KANEKO_PANDORA(config, m_pandora, 0, m_palette, gfx_djboy_spr);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set_inputline(m_soundcpu, INPUT_LINE_NMI);
ym2203_device &ymsnd(YM2203(config, "ymsnd", 12_MHz_XTAL / 4)); // 3.000MHz, verified
ymsnd.irq_handler().set_inputline(m_soundcpu, INPUT_LINE_IRQ0);
- ymsnd.add_route(ALL_OUTPUTS, "lspeaker", 0.40);
- ymsnd.add_route(ALL_OUTPUTS, "rspeaker", 0.40);
+ ymsnd.add_route(ALL_OUTPUTS, "speaker", 0.40, 0);
+ ymsnd.add_route(ALL_OUTPUTS, "speaker", 0.40, 1);
okim6295_device &oki_l(OKIM6295(config, "oki_l", 12_MHz_XTAL / 8, okim6295_device::PIN7_LOW)); // 1.500MHz, verified
oki_l.set_device_rom_tag("oki");
- oki_l.add_route(ALL_OUTPUTS, "lspeaker", 0.50);
+ oki_l.add_route(ALL_OUTPUTS, "speaker", 0.50, 0);
okim6295_device &oki_r(OKIM6295(config, "oki_r", 12_MHz_XTAL / 8, okim6295_device::PIN7_LOW)); // 1.500MHz, verified
oki_r.set_device_rom_tag("oki");
- oki_r.add_route(ALL_OUTPUTS, "rspeaker", 0.50);
+ oki_r.add_route(ALL_OUTPUTS, "speaker", 0.50, 1);
}
diff --git a/src/mame/kaneko/galpani2.cpp b/src/mame/kaneko/galpani2.cpp
index 7359370c020..0f2bd10eca8 100644
--- a/src/mame/kaneko/galpani2.cpp
+++ b/src/mame/kaneko/galpani2.cpp
@@ -669,12 +669,11 @@ void galpani2_state::galpani2(machine_config &config)
m_kaneko_spr->set_color_base(0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- OKIM6295(config, "oki1", XTAL(20'000'000)/10, okim6295_device::PIN7_HIGH).add_route(ALL_OUTPUTS, "lspeaker", 1.0); /* Confirmed on galpani2i PCB */
+ OKIM6295(config, "oki1", XTAL(20'000'000)/10, okim6295_device::PIN7_HIGH).add_route(ALL_OUTPUTS, "speaker", 1.0, 0); /* Confirmed on galpani2i PCB */
- OKIM6295(config, m_oki2, XTAL(20'000'000)/10, okim6295_device::PIN7_HIGH).add_route(ALL_OUTPUTS, "rspeaker", 1.0); /* Confirmed on galpani2i PCB */
+ OKIM6295(config, m_oki2, XTAL(20'000'000)/10, okim6295_device::PIN7_HIGH).add_route(ALL_OUTPUTS, "speaker", 1.0, 1); /* Confirmed on galpani2i PCB */
}
diff --git a/src/mame/kaneko/jchan.cpp b/src/mame/kaneko/jchan.cpp
index f663c29314e..8a21934ffe2 100644
--- a/src/mame/kaneko/jchan.cpp
+++ b/src/mame/kaneko/jchan.cpp
@@ -618,12 +618,11 @@ void jchan_state::jchan(machine_config &config)
EEPROM_93C46_16BIT(config, "eeprom");
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ymz280b_device &ymz(YMZ280B(config, "ymz", 16000000));
- ymz.add_route(0, "lspeaker", 1.0);
- ymz.add_route(1, "rspeaker", 1.0);
+ ymz.add_route(0, "speaker", 1.0, 0);
+ ymz.add_route(1, "speaker", 1.0, 1);
}
/* ROM loading */
diff --git a/src/mame/kaneko/kaneko16.cpp b/src/mame/kaneko/kaneko16.cpp
index 2b30c396dab..cf295592542 100644
--- a/src/mame/kaneko/kaneko16.cpp
+++ b/src/mame/kaneko/kaneko16.cpp
@@ -1857,15 +1857,14 @@ void kaneko16_blazeon_state::blazeon(machine_config &config)
// there is actually a 2nd sprite chip! looks like our device emulation handles both at once
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
YM2151(config, m_ymsnd, 4000000);
- m_ymsnd->add_route(0, "lspeaker", 1.0);
- m_ymsnd->add_route(1, "rspeaker", 1.0);
+ m_ymsnd->add_route(0, "speaker", 1.0, 0);
+ m_ymsnd->add_route(1, "speaker", 1.0, 1);
}
diff --git a/src/mame/kaneko/suprnova.cpp b/src/mame/kaneko/suprnova.cpp
index dfbc068bae2..113540986c3 100644
--- a/src/mame/kaneko/suprnova.cpp
+++ b/src/mame/kaneko/suprnova.cpp
@@ -797,12 +797,11 @@ void skns_state::skns(machine_config &config)
SKNS_SPRITE(config, m_spritegen, 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ymz280b_device &ymz(YMZ280B(config, "ymz", XTAL(33'333'333) / 2));
- ymz.add_route(0, "lspeaker", 1.0);
- ymz.add_route(1, "rspeaker", 1.0);
+ ymz.add_route(0, "speaker", 1.0, 0);
+ ymz.add_route(1, "speaker", 1.0, 1);
}
MACHINE_RESET_MEMBER(skns_state,sknsa)
diff --git a/src/mame/konami/ajax.cpp b/src/mame/konami/ajax.cpp
index aefcaaa7590..5ab9f99ffcd 100644
--- a/src/mame/konami/ajax.cpp
+++ b/src/mame/konami/ajax.cpp
@@ -592,24 +592,23 @@ void ajax_state::ajax(machine_config &config)
m_k051316->set_zoom_callback(FUNC(ajax_state::zoom_callback));
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
- YM2151(config, "ymsnd", 3579545).add_route(0, "lspeaker", 1.0).add_route(1, "rspeaker", 1.0);
+ YM2151(config, "ymsnd", 3579545).add_route(0, "speaker", 1.0, 0).add_route(1, "speaker", 1.0, 1);
K007232(config, m_k007232[0], 3579545);
m_k007232[0]->port_write().set(FUNC(ajax_state::volume_callback0));
- m_k007232[0]->add_route(0, "lspeaker", 0.20);
- m_k007232[0]->add_route(0, "rspeaker", 0.20);
- m_k007232[0]->add_route(1, "lspeaker", 0.20);
- m_k007232[0]->add_route(1, "rspeaker", 0.20);
+ m_k007232[0]->add_route(0, "speaker", 0.20, 0);
+ m_k007232[0]->add_route(0, "speaker", 0.20, 1);
+ m_k007232[0]->add_route(1, "speaker", 0.20, 0);
+ m_k007232[0]->add_route(1, "speaker", 0.20, 1);
K007232(config, m_k007232[1], 3579545);
m_k007232[1]->port_write().set(FUNC(ajax_state::volume_callback1));
- m_k007232[1]->add_route(0, "lspeaker", 0.50);
- m_k007232[1]->add_route(1, "rspeaker", 0.50);
+ m_k007232[1]->add_route(0, "speaker", 0.50, 0);
+ m_k007232[1]->add_route(1, "speaker", 0.50, 1);
}
diff --git a/src/mame/konami/asterix.cpp b/src/mame/konami/asterix.cpp
index 6fc09dec553..6ce294f6f4d 100644
--- a/src/mame/konami/asterix.cpp
+++ b/src/mame/konami/asterix.cpp
@@ -417,14 +417,13 @@ void asterix_state::asterix(machine_config &config)
K053251(config, m_k053251, 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- YM2151(config, "ymsnd", XTAL(32'000'000)/8).add_route(0, "lspeaker", 1.0).add_route(1, "rspeaker", 1.0); // 4MHz
+ YM2151(config, "ymsnd", XTAL(32'000'000)/8).add_route(0, "speaker", 1.0, 0).add_route(1, "speaker", 1.0, 1); // 4MHz
k053260_device &k053260(K053260(config, "k053260", XTAL(32'000'000)/8)); // 4MHz
- k053260.add_route(0, "lspeaker", 0.75);
- k053260.add_route(1, "rspeaker", 0.75);
+ k053260.add_route(0, "speaker", 0.75, 0);
+ k053260.add_route(1, "speaker", 0.75, 1);
k053260.sh1_cb().set(FUNC(asterix_state::z80_nmi_w));
}
diff --git a/src/mame/konami/bishi.cpp b/src/mame/konami/bishi.cpp
index 9f19aac2fe1..088ad995072 100644
--- a/src/mame/konami/bishi.cpp
+++ b/src/mame/konami/bishi.cpp
@@ -523,13 +523,12 @@ void bishi_state::bishi(machine_config &config)
K055555(config, m_k055555, 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ymz280b_device &ymz(YMZ280B(config, "ymz", SOUND_CLOCK)); /* 16.9344MHz */
ymz.irq_handler().set_inputline("maincpu", M68K_IRQ_1);
- ymz.add_route(0, "lspeaker", 1.0);
- ymz.add_route(1, "rspeaker", 1.0);
+ ymz.add_route(0, "speaker", 1.0, 0);
+ ymz.add_route(1, "speaker", 1.0, 1);
}
// ROM definitions
diff --git a/src/mame/konami/chqflag.cpp b/src/mame/konami/chqflag.cpp
index 6bec9b16311..a1a154b9ad0 100644
--- a/src/mame/konami/chqflag.cpp
+++ b/src/mame/konami/chqflag.cpp
@@ -477,28 +477,27 @@ void chqflag_state::chqflag(machine_config &config)
K051733(config, "k051733", 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, "soundlatch");
GENERIC_LATCH_8(config, "soundlatch2").data_pending_callback().set_inputline(m_audiocpu, 0);
ym2151_device &ymsnd(YM2151(config, "ymsnd", XTAL(3'579'545))); /* verified on pcb */
ymsnd.irq_handler().set_inputline(m_audiocpu, INPUT_LINE_NMI);
- ymsnd.add_route(0, "lspeaker", 1.00);
- ymsnd.add_route(1, "rspeaker", 1.00);
+ ymsnd.add_route(0, "speaker", 1.00, 0);
+ ymsnd.add_route(1, "speaker", 1.00, 1);
K007232(config, m_k007232[0], XTAL(3'579'545)); /* verified on pcb */
m_k007232[0]->port_write().set(FUNC(chqflag_state::volume_callback0));
- m_k007232[0]->add_route(0, "lspeaker", 0.20);
- m_k007232[0]->add_route(1, "rspeaker", 0.20);
+ m_k007232[0]->add_route(0, "speaker", 0.20, 0);
+ m_k007232[0]->add_route(1, "speaker", 0.20, 1);
K007232(config, m_k007232[1], XTAL(3'579'545)); /* verified on pcb */
m_k007232[1]->port_write().set(FUNC(chqflag_state::volume_callback1));
- m_k007232[1]->add_route(0, "lspeaker", 0.20);
- m_k007232[1]->add_route(0, "rspeaker", 0.20);
- m_k007232[1]->add_route(1, "lspeaker", 0.20);
- m_k007232[1]->add_route(1, "rspeaker", 0.20);
+ m_k007232[1]->add_route(0, "speaker", 0.20, 0);
+ m_k007232[1]->add_route(0, "speaker", 0.20, 1);
+ m_k007232[1]->add_route(1, "speaker", 0.20, 0);
+ m_k007232[1]->add_route(1, "speaker", 0.20, 1);
}
ROM_START( chqflag )
diff --git a/src/mame/konami/cobra.cpp b/src/mame/konami/cobra.cpp
index a440873d415..aa278bb71ec 100644
--- a/src/mame/konami/cobra.cpp
+++ b/src/mame/konami/cobra.cpp
@@ -2978,17 +2978,16 @@ void cobra_state::cobra(machine_config &config)
m_screen->set_screen_update(FUNC(cobra_state::screen_update_cobra));
PALETTE(config, m_palette).set_entries(65536);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
rf5c400_device &rfsnd(RF5C400(config, "rfsnd", XTAL(16'934'400)));
rfsnd.set_addrmap(0, &cobra_state::rf5c400_map);
- rfsnd.add_route(0, "lspeaker", 1.0);
- rfsnd.add_route(1, "rspeaker", 1.0);
+ rfsnd.add_route(0, "speaker", 1.0, 0);
+ rfsnd.add_route(1, "speaker", 1.0, 1);
- DMADAC(config, m_dmadac[0]).add_route(ALL_OUTPUTS, "lspeaker", 1.0);
+ DMADAC(config, m_dmadac[0]).add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
- DMADAC(config, m_dmadac[1]).add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ DMADAC(config, m_dmadac[1]).add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
M48T58(config, "m48t58", 0);
diff --git a/src/mame/konami/contra.cpp b/src/mame/konami/contra.cpp
index 1a6b3f73718..76b43c9ddb4 100644
--- a/src/mame/konami/contra.cpp
+++ b/src/mame/konami/contra.cpp
@@ -626,12 +626,11 @@ void contra_state::contra(machine_config &config)
K007121(config, m_k007121[1], 0, m_palette, gfx_contra_2);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, "soundlatch");
- YM2151(config, "ymsnd", XTAL(3'579'545)).add_route(0, "lspeaker", 0.60).add_route(1, "rspeaker", 0.60);
+ YM2151(config, "ymsnd", XTAL(3'579'545)).add_route(0, "speaker", 0.60, 0).add_route(1, "speaker", 0.60, 1);
}
diff --git a/src/mame/konami/cougar.cpp b/src/mame/konami/cougar.cpp
index d852270999f..336b4590fc9 100644
--- a/src/mame/konami/cougar.cpp
+++ b/src/mame/konami/cougar.cpp
@@ -75,12 +75,11 @@ void cougar_state::cougar(machine_config &config)
//SCREEN(config, "screen", SCREEN_TYPE_RASTER);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ymz280b_device &ymz(YMZ280B(config, "ymz", 16.9344_MHz_XTAL));
- ymz.add_route(0, "lspeaker", 1.0);
- ymz.add_route(1, "rspeaker", 1.0);
+ ymz.add_route(0, "speaker", 1.0, 0);
+ ymz.add_route(1, "speaker", 1.0, 1);
}
/***************************************************************************
diff --git a/src/mame/konami/crimfght.cpp b/src/mame/konami/crimfght.cpp
index 8d7acd02d4b..b0d335efd76 100644
--- a/src/mame/konami/crimfght.cpp
+++ b/src/mame/konami/crimfght.cpp
@@ -465,22 +465,21 @@ void crimfght_state::crimfght(machine_config &config)
m_k051960->irq_handler().set_inputline(m_maincpu, KONAMI_IRQ_LINE);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
ym2151_device &ymsnd(YM2151(config, "ymsnd", XTAL(3'579'545))); // verified on pcb
ymsnd.port_write_handler().set(FUNC(crimfght_state::ym2151_ct_w));
- ymsnd.add_route(0, "lspeaker", 1.0);
- ymsnd.add_route(1, "rspeaker", 1.0);
+ ymsnd.add_route(0, "speaker", 1.0, 0);
+ ymsnd.add_route(1, "speaker", 1.0, 1);
K007232(config, m_k007232, XTAL(3'579'545)); // verified on pcb
m_k007232->port_write().set(FUNC(crimfght_state::volume_callback));
- m_k007232->add_route(0, "lspeaker", 0.20);
- m_k007232->add_route(0, "rspeaker", 0.20);
- m_k007232->add_route(1, "lspeaker", 0.20);
- m_k007232->add_route(1, "rspeaker", 0.20);
+ m_k007232->add_route(0, "speaker", 0.20, 0);
+ m_k007232->add_route(0, "speaker", 0.20, 1);
+ m_k007232->add_route(1, "speaker", 0.20, 0);
+ m_k007232->add_route(1, "speaker", 0.20, 1);
}
/***************************************************************************
diff --git a/src/mame/konami/dbz.cpp b/src/mame/konami/dbz.cpp
index d349bb6d9aa..777d2f2ee04 100644
--- a/src/mame/konami/dbz.cpp
+++ b/src/mame/konami/dbz.cpp
@@ -600,19 +600,18 @@ void dbz_state::dbz(machine_config &config)
m_k053252->int1_ack().set(FUNC(dbz_state::dbz_irq2_ack_w));
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, "soundlatch");
ym2151_device &ymsnd(YM2151(config, "ymsnd", 4000000));
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
- ymsnd.add_route(0, "lspeaker", 1.0);
- ymsnd.add_route(1, "rspeaker", 1.0);
+ ymsnd.add_route(0, "speaker", 1.0, 0);
+ ymsnd.add_route(1, "speaker", 1.0, 1);
okim6295_device &oki(OKIM6295(config, "oki", 1056000, okim6295_device::PIN7_HIGH));
- oki.add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- oki.add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
}
void dbz_state::dbz2bl(machine_config &config)
diff --git a/src/mame/konami/djmain.cpp b/src/mame/konami/djmain.cpp
index 0bffa60dce7..af740e3bc99 100644
--- a/src/mame/konami/djmain.cpp
+++ b/src/mame/konami/djmain.cpp
@@ -1700,18 +1700,17 @@ void djmain_state::djmainj(machine_config &config)
K055555(config, m_k055555, 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
k054539_device &k054539_1(K054539(config, "k054539_1", XTAL(18'432'000)));
k054539_1.set_addrmap(0, &djmain_state::k054539_map);
- k054539_1.add_route(0, "lspeaker", 1.0);
- k054539_1.add_route(1, "rspeaker", 1.0);
+ k054539_1.add_route(0, "speaker", 1.0, 0);
+ k054539_1.add_route(1, "speaker", 1.0, 1);
k054539_device &k054539_2(K054539(config, "k054539_2", XTAL(18'432'000)));
k054539_2.set_addrmap(0, &djmain_state::k054539_map);
- k054539_2.add_route(0, "lspeaker", 1.0);
- k054539_2.add_route(1, "rspeaker", 1.0);
+ k054539_2.add_route(0, "speaker", 1.0, 0);
+ k054539_2.add_route(1, "speaker", 1.0, 1);
}
void djmain_state::djmainu(machine_config &config)
diff --git a/src/mame/konami/firebeat.cpp b/src/mame/konami/firebeat.cpp
index 3930b129640..1d73afb5f59 100644
--- a/src/mame/konami/firebeat.cpp
+++ b/src/mame/konami/firebeat.cpp
@@ -196,7 +196,7 @@ protected:
virtual void device_reset() override ATTR_COLD;
// device_sound_interface-level overrides
- void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
+ void sound_stream_update(sound_stream &stream) override;
private:
enum {
@@ -220,7 +220,7 @@ private:
firebeat_extend_spectrum_analyzer_device::firebeat_extend_spectrum_analyzer_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, KONAMI_FIREBEAT_EXTEND_SPECTRUM_ANALYZER, tag, owner, clock),
- device_mixer_interface(mconfig, *this, 2)
+ device_mixer_interface(mconfig, *this)
{
}
@@ -245,15 +245,15 @@ void firebeat_extend_spectrum_analyzer_device::device_reset()
m_audio_fill_index = 0;
}
-void firebeat_extend_spectrum_analyzer_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void firebeat_extend_spectrum_analyzer_device::sound_stream_update(sound_stream &stream)
{
- device_mixer_interface::sound_stream_update(stream, inputs, outputs);
+ device_mixer_interface::sound_stream_update(stream);
- for (int pos = 0; pos < outputs[0].samples(); pos++)
+ for (int pos = 0; pos < stream.samples(); pos++)
{
- for (int ch = 0; ch < outputs.size(); ch++)
+ for (int ch = 0; ch < stream.output_count(); ch++)
{
- const float sample = outputs[ch].get(pos);
+ const float sample = stream.get(ch, pos);
m_audio_buf[m_audio_fill_index][ch][m_audio_count[m_audio_fill_index]] = sample;
}
@@ -389,8 +389,8 @@ static void firebeat_ata_devices(device_slot_interface &device)
static void cdrom_config(device_t *device)
{
- device->subdevice<cdda_device>("cdda")->add_route(0, "^^lspeaker", 0.5);
- device->subdevice<cdda_device>("cdda")->add_route(1, "^^rspeaker", 0.5);
+ device->subdevice<cdda_device>("cdda")->add_route(0, "^^speaker", 0.5, 0);
+ device->subdevice<cdda_device>("cdda")->add_route(1, "^^speaker", 0.5, 1);
}
static void dvdrom_config(device_t *device)
@@ -762,14 +762,13 @@ void firebeat_state::firebeat(machine_config &config)
m_gcu->irq_callback().set(FUNC(firebeat_state::gcu_interrupt));
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ymz280b_device &ymz(YMZ280B(config, "ymz", 16934400));
ymz.irq_handler().set(FUNC(firebeat_state::sound_irq_callback));
ymz.set_addrmap(0, &firebeat_state::ymz280b_map);
- ymz.add_route(1, "lspeaker", 1.0);
- ymz.add_route(0, "rspeaker", 1.0);
+ ymz.add_route(1, "speaker", 1.0, 0);
+ ymz.add_route(0, "speaker", 1.0, 1);
PC16552D(config, "duart_com", 0);
NS16550(config, "duart_com:chan0", XTAL(19'660'800));
@@ -1213,8 +1212,8 @@ void firebeat_spu_state::firebeat_spu_base(machine_config &config)
m_rf5c400->set_addrmap(0, &firebeat_spu_state::rf5c400_map);
// Clean channel audio
- m_rf5c400->add_route(0, "lspeaker", 0.5);
- m_rf5c400->add_route(1, "rspeaker", 0.5);
+ m_rf5c400->add_route(0, "speaker", 0.5, 0);
+ m_rf5c400->add_route(1, "speaker", 0.5, 1);
}
void firebeat_spu_state::firebeat_spu_map(address_map &map)
@@ -1452,14 +1451,14 @@ void firebeat_bm3_state::firebeat_bm3(machine_config &config)
NS16550(config, "duart_midi:chan1", XTAL(24'000'000)).out_int_callback().set(FUNC(firebeat_bm3_state::midi_st224_irq_callback));
// Effects audio channel, routed to ST-224's audio input
- m_rf5c400->add_route(2, "lspeaker", 0.5);
- m_rf5c400->add_route(3, "rspeaker", 0.5);
+ m_rf5c400->add_route(2, "speaker", 0.5, 0);
+ m_rf5c400->add_route(3, "speaker", 0.5, 1);
KONAMI_FIREBEAT_EXTEND_SPECTRUM_ANALYZER(config, m_spectrum_analyzer, 0);
- m_rf5c400->add_route(0, m_spectrum_analyzer, 0.5, AUTO_ALLOC_INPUT, 0);
- m_rf5c400->add_route(1, m_spectrum_analyzer, 0.5, AUTO_ALLOC_INPUT, 1);
- m_rf5c400->add_route(2, m_spectrum_analyzer, 0.5, AUTO_ALLOC_INPUT, 0);
- m_rf5c400->add_route(3, m_spectrum_analyzer, 0.5, AUTO_ALLOC_INPUT, 1);
+ m_rf5c400->add_route(0, m_spectrum_analyzer, 0.5, 0);
+ m_rf5c400->add_route(1, m_spectrum_analyzer, 0.5, 1);
+ m_rf5c400->add_route(2, m_spectrum_analyzer, 0.5, 0);
+ m_rf5c400->add_route(3, m_spectrum_analyzer, 0.5, 1);
}
void firebeat_bm3_state::init_bm3()
@@ -1548,8 +1547,8 @@ void firebeat_popn_state::firebeat_popn(machine_config &config)
TIMER(config, "spu_timer").configure_periodic(FUNC(firebeat_popn_state::spu_timer_callback), attotime::from_hz(500));
// Effects audio channel, routed back to main (no external processing)
- m_rf5c400->add_route(2, "lspeaker", 0.5);
- m_rf5c400->add_route(3, "rspeaker", 0.5);
+ m_rf5c400->add_route(2, "speaker", 0.5, 0);
+ m_rf5c400->add_route(3, "speaker", 0.5, 1);
}
void firebeat_popn_state::init_popn_base()
@@ -1817,14 +1816,13 @@ void firebeat_kbm_state::firebeat_kbm(machine_config &config)
m_gcu_sub->irq_callback().set(FUNC(firebeat_kbm_state::gcu_interrupt));
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ymz280b_device &ymz(YMZ280B(config, "ymz", 16934400));
ymz.irq_handler().set(FUNC(firebeat_kbm_state::sound_irq_callback));
ymz.set_addrmap(0, &firebeat_kbm_state::ymz280b_map);
- ymz.add_route(1, "lspeaker", 1.0);
- ymz.add_route(0, "rspeaker", 1.0);
+ ymz.add_route(1, "speaker", 1.0, 0);
+ ymz.add_route(0, "speaker", 1.0, 1);
// On the main PCB
PC16552D(config, "duart_com", 0);
@@ -1844,8 +1842,8 @@ void firebeat_kbm_state::firebeat_kbm(machine_config &config)
// Synth card
auto &xt446(XT446(config, "xt446"));
midi_chan1.out_tx_callback().set(xt446, FUNC(xt446_device::midi_w));
- xt446.add_route(0, "lspeaker", 1.0);
- xt446.add_route(1, "rspeaker", 1.0);
+ xt446.add_route(0, "speaker", 1.0, 0);
+ xt446.add_route(1, "speaker", 1.0, 1);
}
void firebeat_kbm_state::firebeat_kbm_map(address_map &map)
diff --git a/src/mame/konami/flkatck.cpp b/src/mame/konami/flkatck.cpp
index 7e178728681..8b4b33b408a 100644
--- a/src/mame/konami/flkatck.cpp
+++ b/src/mame/konami/flkatck.cpp
@@ -437,19 +437,18 @@ void flkatck_state::flkatck(machine_config &config)
K007121(config, m_k007121, 0, "palette", gfx_flkatck);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
- YM2151(config, "ymsnd", 3.579545_MHz_XTAL).add_route(0, "lspeaker", 1.0).add_route(0, "rspeaker", 1.0);
+ YM2151(config, "ymsnd", 3.579545_MHz_XTAL).add_route(0, "speaker", 1.0, 0).add_route(0, "speaker", 1.0, 1);
K007232(config, m_k007232, 3.579545_MHz_XTAL);
m_k007232->port_write().set(FUNC(flkatck_state::volume_callback));
- m_k007232->add_route(0, "lspeaker", 0.50);
- m_k007232->add_route(0, "rspeaker", 0.50);
- m_k007232->add_route(1, "lspeaker", 0.50);
- m_k007232->add_route(1, "rspeaker", 0.50);
+ m_k007232->add_route(0, "speaker", 0.50, 0);
+ m_k007232->add_route(0, "speaker", 0.50, 1);
+ m_k007232->add_route(1, "speaker", 0.50, 0);
+ m_k007232->add_route(1, "speaker", 0.50, 1);
}
diff --git a/src/mame/konami/gijoe.cpp b/src/mame/konami/gijoe.cpp
index d0ce2c62963..df8f67a4f91 100644
--- a/src/mame/konami/gijoe.cpp
+++ b/src/mame/konami/gijoe.cpp
@@ -542,15 +542,14 @@ void gijoe_state::gijoe(machine_config &config)
K053251(config, m_k053251, 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- K054321(config, m_k054321, "lspeaker", "rspeaker");
+ K054321(config, m_k054321, "speaker");
k054539_device &k054539(K054539(config, "k054539", XTAL(18'432'000)));
k054539.timer_handler().set_inputline("audiocpu", INPUT_LINE_NMI);
- k054539.add_route(0, "rspeaker", 1.0);
- k054539.add_route(1, "lspeaker", 1.0);
+ k054539.add_route(0, "speaker", 1.0, 1);
+ k054539.add_route(1, "speaker", 1.0, 0);
}
diff --git a/src/mame/konami/goldenregion.cpp b/src/mame/konami/goldenregion.cpp
index 42dfa1e3090..af05001d2c3 100644
--- a/src/mame/konami/goldenregion.cpp
+++ b/src/mame/konami/goldenregion.cpp
@@ -306,12 +306,11 @@ void gs761_state::gs761(machine_config &config)
K055555(config, m_k055555, 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
YMZ280B(config, m_ymz, XTAL(33'868'800)/2); // 33.8688 MHz xtal verified on PCB
- m_ymz->add_route(0, "lspeaker", 0.75);
- m_ymz->add_route(1, "rspeaker", 0.75);
+ m_ymz->add_route(0, "speaker", 0.75, 0);
+ m_ymz->add_route(1, "speaker", 0.75, 1);
}
ROM_START( glregion )
diff --git a/src/mame/konami/gradius3.cpp b/src/mame/konami/gradius3.cpp
index 722420f507b..0f4aac5bd92 100644
--- a/src/mame/konami/gradius3.cpp
+++ b/src/mame/konami/gradius3.cpp
@@ -501,19 +501,18 @@ void gradius3_state::gradius3(machine_config &config)
m_k051960->set_plane_order(K051960_PLANEORDER_GRADIUS3);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, "soundlatch");
- YM2151(config, "ymsnd", 3579545).add_route(0, "lspeaker", 1.0).add_route(0, "rspeaker", 1.0);
+ YM2151(config, "ymsnd", 3579545).add_route(0, "speaker", 1.0, 0).add_route(0, "speaker", 1.0, 1);
K007232(config, m_k007232, 3579545);
m_k007232->port_write().set(FUNC(gradius3_state::volume_callback));
- m_k007232->add_route(0, "lspeaker", 0.20);
- m_k007232->add_route(0, "rspeaker", 0.20);
- m_k007232->add_route(1, "lspeaker", 0.20);
- m_k007232->add_route(1, "rspeaker", 0.20);
+ m_k007232->add_route(0, "speaker", 0.20, 0);
+ m_k007232->add_route(0, "speaker", 0.20, 1);
+ m_k007232->add_route(1, "speaker", 0.20, 0);
+ m_k007232->add_route(1, "speaker", 0.20, 1);
}
diff --git a/src/mame/konami/gticlub.cpp b/src/mame/konami/gticlub.cpp
index 81bbd0c30d8..fa6db848efd 100644
--- a/src/mame/konami/gticlub.cpp
+++ b/src/mame/konami/gticlub.cpp
@@ -930,12 +930,11 @@ void gticlub_state::gticlub(machine_config &config)
K056800(config, m_k056800, XTAL(33'868'800)/2);
m_k056800->int_callback().set_inputline(m_audiocpu, M68K_IRQ_2);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
rf5c400_device &rfsnd(RF5C400(config, "rfsnd", XTAL(33'868'800)/2));
- rfsnd.add_route(0, "lspeaker", 1.0);
- rfsnd.add_route(1, "rspeaker", 1.0);
+ rfsnd.add_route(0, "speaker", 1.0, 0);
+ rfsnd.add_route(1, "speaker", 1.0, 1);
KONPPC(config, m_konppc, 0);
m_konppc->set_dsp_tag(0, m_dsp[0]);
@@ -1035,12 +1034,11 @@ void hangplt_state::hangplt(machine_config &config)
K056800(config, m_k056800, XTAL(33'868'800)/2);
m_k056800->int_callback().set_inputline(m_audiocpu, M68K_IRQ_2);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
rf5c400_device &rfsnd(RF5C400(config, "rfsnd", XTAL(33'868'800)/2));
- rfsnd.add_route(0, "lspeaker", 1.0);
- rfsnd.add_route(1, "rspeaker", 1.0);
+ rfsnd.add_route(0, "speaker", 1.0, 0);
+ rfsnd.add_route(1, "speaker", 1.0, 1);
KONPPC(config, m_konppc, 0);
m_konppc->set_dsp_tag(0, m_dsp[0]);
diff --git a/src/mame/konami/gyruss.cpp b/src/mame/konami/gyruss.cpp
index eb4a3a5e1e1..d08de6f1c3a 100644
--- a/src/mame/konami/gyruss.cpp
+++ b/src/mame/konami/gyruss.cpp
@@ -743,8 +743,7 @@ void gyruss_state::gyruss(machine_config &config)
PALETTE(config, m_palette, FUNC(gyruss_state::palette), 16*4+16*16, 32);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, "soundlatch");
GENERIC_LATCH_8(config, "soundlatch2");
@@ -788,8 +787,8 @@ void gyruss_state::gyruss(machine_config &config)
ay5.add_route(2, "discrete", 1.0, 14);
DISCRETE(config, m_discrete, sound_discrete);
- m_discrete->add_route(0, "rspeaker", 1.0);
- m_discrete->add_route(1, "lspeaker", 1.0);
+ m_discrete->add_route(0, "speaker", 1.0, 1);
+ m_discrete->add_route(1, "speaker", 1.0, 0);
}
diff --git a/src/mame/konami/hornet.cpp b/src/mame/konami/hornet.cpp
index bda20bc23d0..5ba2910f4cb 100644
--- a/src/mame/konami/hornet.cpp
+++ b/src/mame/konami/hornet.cpp
@@ -1383,12 +1383,11 @@ void hornet_state::hornet(machine_config &config)
K056800(config, m_k056800, XTAL(16'934'400));
m_k056800->int_callback().set_inputline(m_audiocpu, M68K_IRQ_2);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
RF5C400(config, "rfsnd", XTAL(16'934'400)) // value from Guru readme, gives 44100 Hz sample rate
- .add_route(0, "lspeaker", 1.0)
- .add_route(1, "rspeaker", 1.0);
+ .add_route(0, "speaker", 1.0, 0)
+ .add_route(1, "speaker", 1.0, 1);
M48T58(config, "m48t58", 0);
diff --git a/src/mame/konami/jackal.cpp b/src/mame/konami/jackal.cpp
index 8217171bb02..21e5525dcd9 100644
--- a/src/mame/konami/jackal.cpp
+++ b/src/mame/konami/jackal.cpp
@@ -599,10 +599,9 @@ void jackal_state::jackal(machine_config &config)
m_palette->set_endianness(ENDIANNESS_LITTLE);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- YM2151(config, "ymsnd", 3.579545_MHz_XTAL).add_route(0, "lspeaker", 0.50).add_route(1, "rspeaker", 0.50); // verified on PCB
+ YM2151(config, "ymsnd", 3.579545_MHz_XTAL).add_route(0, "speaker", 0.50, 0).add_route(1, "speaker", 0.50, 1); // verified on PCB
}
/*************************************
diff --git a/src/mame/konami/k573dio.cpp b/src/mame/konami/k573dio.cpp
index 175e2455bdd..8258a54fe03 100644
--- a/src/mame/konami/k573dio.cpp
+++ b/src/mame/konami/k573dio.cpp
@@ -176,8 +176,8 @@ void k573dio_device::device_add_mconfig(machine_config &config)
{
KONAMI_573_DIGITAL_FPGA(config, k573fpga);
k573fpga->set_ram(ram);
- k573fpga->add_route(0, ":lspeaker", 1.0);
- k573fpga->add_route(1, ":rspeaker", 1.0);
+ k573fpga->add_route(0, ":speaker", 1.0, 0);
+ k573fpga->add_route(1, ":speaker", 1.0, 1);
DS2401(config, digital_id);
}
diff --git a/src/mame/konami/konamigq.cpp b/src/mame/konami/konamigq.cpp
index c0a52010886..b7540e8c3a9 100644
--- a/src/mame/konami/konamigq.cpp
+++ b/src/mame/konami/konamigq.cpp
@@ -378,8 +378,7 @@ void konamigq_state::konamigq(machine_config &config)
SCREEN(config, "screen", SCREEN_TYPE_RASTER);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
K056800(config, m_k056800, XTAL(18'432'000));
m_k056800->int_callback().set_inputline(m_soundcpu, M68K_IRQ_1);
@@ -387,13 +386,13 @@ void konamigq_state::konamigq(machine_config &config)
k054539_device &k054539_1(K054539(config, "k054539_1", XTAL(18'432'000)));
k054539_1.set_addrmap(0, &konamigq_state::konamigq_k054539_map);
k054539_1.timer_handler().set(FUNC(konamigq_state::k054539_irq_gen));
- k054539_1.add_route(0, "lspeaker", 1.0);
- k054539_1.add_route(1, "rspeaker", 1.0);
+ k054539_1.add_route(0, "speaker", 1.0, 0);
+ k054539_1.add_route(1, "speaker", 1.0, 1);
k054539_device &k054539_2(K054539(config, "k054539_2", XTAL(18'432'000)));
k054539_2.set_addrmap(0, &konamigq_state::konamigq_k054539_map);
- k054539_2.add_route(0, "lspeaker", 1.0);
- k054539_2.add_route(1, "rspeaker", 1.0);
+ k054539_2.add_route(0, "speaker", 1.0, 0);
+ k054539_2.add_route(1, "speaker", 1.0, 1);
}
static INPUT_PORTS_START( konamigq )
diff --git a/src/mame/konami/konamigv.cpp b/src/mame/konami/konamigv.cpp
index 6d9a997b21a..4b3b2ae77c0 100644
--- a/src/mame/konami/konamigv.cpp
+++ b/src/mame/konami/konamigv.cpp
@@ -580,8 +580,8 @@ void konamigv_state::konamigv(machine_config &config)
NSCSI_CONNECTOR(config, "scsi:4").option_set("cdrom", NSCSI_XM5401).machine_config(
[](device_t *device)
{
- device->subdevice<cdda_device>("cdda")->add_route(0, "^^lspeaker", 1.0);
- device->subdevice<cdda_device>("cdda")->add_route(1, "^^rspeaker", 1.0);
+ device->subdevice<cdda_device>("cdda")->add_route(0, "^^speaker", 1.0, 0);
+ device->subdevice<cdda_device>("cdda")->add_route(1, "^^speaker", 1.0, 1);
});
NSCSI_CONNECTOR(config, "scsi:7").option_set("ncr53cf96", NCR53CF96).clock(32_MHz_XTAL/2).machine_config(
[this](device_t *device)
@@ -597,12 +597,11 @@ void konamigv_state::konamigv(machine_config &config)
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
spu_device &spu(SPU(config, "spu", XTAL(67'737'600)/2, subdevice<psxcpu_device>("maincpu")));
- spu.add_route(1, "lspeaker", 0.75); // to verify the channels, btchamp's "game sound test" in the sound test menu speaks the words left, right, center
- spu.add_route(0, "rspeaker", 0.75);
+ spu.add_route(1, "speaker", 0.75, 0); // to verify the channels, btchamp's "game sound test" in the sound test menu speaks the words left, right, center
+ spu.add_route(0, "speaker", 0.75, 1);
}
diff --git a/src/mame/konami/konamigx.cpp b/src/mame/konami/konamigx.cpp
index 817b228c5d3..bb099011451 100644
--- a/src/mame/konami/konamigx.cpp
+++ b/src/mame/konami/konamigx.cpp
@@ -1776,13 +1776,12 @@ void konamigx_state::konamigx(machine_config &config)
MCFG_VIDEO_START_OVERRIDE(konamigx_state, konamigx_5bpp)
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- m_dasp->add_route(0, "lspeaker", 0.3); // Connected to the aux input of respective 54539.
- m_dasp->add_route(1, "rspeaker", 0.3);
- m_dasp->add_route(2, "lspeaker", 0.3);
- m_dasp->add_route(3, "rspeaker", 0.3);
+ m_dasp->add_route(0, "speaker", 0.3, 0); // Connected to the aux input of respective 54539.
+ m_dasp->add_route(1, "speaker", 0.3, 1);
+ m_dasp->add_route(2, "speaker", 0.3, 0);
+ m_dasp->add_route(3, "speaker", 0.3, 1);
K056800(config, m_k056800, XTAL(18'432'000));
m_k056800->int_callback().set_inputline(m_soundcpu, M68K_IRQ_1);
@@ -1792,15 +1791,15 @@ void konamigx_state::konamigx(machine_config &config)
m_k054539_1->timer_handler().set(FUNC(konamigx_state::k054539_irq_gen));
m_k054539_1->add_route(0, "dasp", 0.5, 0);
m_k054539_1->add_route(1, "dasp", 0.5, 1);
- m_k054539_1->add_route(0, "lspeaker", 1.0);
- m_k054539_1->add_route(1, "rspeaker", 1.0);
+ m_k054539_1->add_route(0, "speaker", 1.0, 0);
+ m_k054539_1->add_route(1, "speaker", 1.0, 1);
K054539(config, m_k054539_2, XTAL(18'432'000));
m_k054539_2->set_device_rom_tag("k054539");
m_k054539_2->add_route(0, "dasp", 0.5, 2);
m_k054539_2->add_route(1, "dasp", 0.5, 3);
- m_k054539_2->add_route(0, "lspeaker", 1.0);
- m_k054539_2->add_route(1, "rspeaker", 1.0);
+ m_k054539_2->add_route(0, "speaker", 1.0, 0);
+ m_k054539_2->add_route(1, "speaker", 1.0, 1);
}
void konamigx_state::konamigx_bios(machine_config &config)
diff --git a/src/mame/konami/konamigx.h b/src/mame/konami/konamigx.h
index 03577ef5ebb..82d9601d1a7 100644
--- a/src/mame/konami/konamigx.h
+++ b/src/mame/konami/konamigx.h
@@ -5,22 +5,25 @@
#pragma once
+#include "k053246_k053247_k055673.h"
+#include "k053250.h"
+#include "k054156_k054157_k056832.h"
+#include "k054338.h"
+#include "k055555.h"
+
#include "cpu/tms57002/tms57002.h"
#include "machine/adc083x.h"
#include "machine/k053252.h"
#include "machine/timer.h"
-#include "sound/k056800.h"
#include "sound/k054539.h"
-#include "k053246_k053247_k055673.h"
-#include "k053250.h"
+#include "sound/k056800.h"
#include "video/k053936.h"
-#include "k054156_k054157_k056832.h"
-#include "k054338.h"
-#include "k055555.h"
+
#include "emupal.h"
#include "screen.h"
#include "tilemap.h"
+
class konamigx_state : public driver_device
{
public:
diff --git a/src/mame/konami/konamigx_v.cpp b/src/mame/konami/konamigx_v.cpp
index 0c7c388f6dc..246a5dcfd55 100644
--- a/src/mame/konami/konamigx_v.cpp
+++ b/src/mame/konami/konamigx_v.cpp
@@ -438,8 +438,9 @@ void konamigx_state::konamigx_mixer(screen_device &screen, bitmap_rgb32 &bitmap,
{
if (layerpri[j] <= layerpri[i])
{
- std::swap(layerpri[j], layerpri[i]);
- std::swap(layerid[j], layerid[i]);
+ using std::swap;
+ swap(layerpri[j], layerpri[i]);
+ swap(layerid[j], layerid[i]);
}
}
}
@@ -480,7 +481,7 @@ void konamigx_state::konamigx_mixer(screen_device &screen, bitmap_rgb32 &bitmap,
{
const uint32_t order = layerpri[i] << 24;
const int color = 0;
- objpool.push_back(GX_OBJ{order, offs, code, color});
+ objpool.emplace_back(GX_OBJ{ order, offs, code, color });
}
}
@@ -594,35 +595,34 @@ void konamigx_state::konamigx_mixer(screen_device &screen, bitmap_rgb32 &bitmap,
{
// add objects with solid or alpha pens
uint32_t order = pri << 24 | zcode << 16 | offs << (8 - 3) | solid_draw_mode << 4;
- objpool.push_back(GX_OBJ{order, offs, code, color});
+ objpool.emplace_back(GX_OBJ{ order, offs, code, color });
}
if (add_shadow && !(color & K055555_SKIPSHADOW) && !(mixerflags & GXMIX_NOSHADOW))
{
// add objects with shadows if enabled
uint32_t order = spri << 24 | zcode << 16 | offs << (8 - 3) | shadow_draw_mode << 4 | shadow;
- objpool.push_back(GX_OBJ{ order, offs, code, color});
+ objpool.emplace_back(GX_OBJ{ order, offs, code, color });
}
}
// sort objects in descending order (SLOW)
// reverse objpool to retain order in case of ties
std::reverse(objpool.begin(), objpool.end());
- std::stable_sort(objpool.begin(), objpool.end(), [](const GX_OBJ &a, const GX_OBJ &b){
- return a.order > b.order;
- });
+ std::stable_sort(
+ objpool.begin(),
+ objpool.end(),
+ [] (const GX_OBJ &a, const GX_OBJ &b) { return a.order > b.order; });
konamigx_mixer_draw(screen, bitmap, cliprect, sub1, sub1flags, sub2, sub2flags, mixerflags, extra_bitmap, rushingheroes_hack, objpool);
}
-void konamigx_state::konamigx_mixer_draw(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect,
- tilemap_t *sub1, int sub1flags,
- tilemap_t *sub2, int sub2flags,
- int mixerflags, bitmap_ind16 *extra_bitmap, int rushingheroes_hack,
-
- /* passed from above function */
- const std::vector<GX_OBJ> &objpool
- )
+void konamigx_state::konamigx_mixer_draw(
+ screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect,
+ tilemap_t *sub1, int sub1flags,
+ tilemap_t *sub2, int sub2flags,
+ int mixerflags, bitmap_ind16 *extra_bitmap, int rushingheroes_hack,
+ const std::vector<GX_OBJ> &objpool) /* passed from above function */
{
// traverse draw list
const uint8_t disp = m_k055555->K055555_read_register(K55_INPUT_ENABLES);
@@ -662,11 +662,10 @@ void konamigx_state::konamigx_mixer_draw(screen_device &screen, bitmap_rgb32 &bi
}
m_k055673->k053247_draw_single_sprite_gxcore(bitmap, cliprect,
- m_gx_objzbuf, m_gx_shdzbuf.get(), code, m_gx_spriteram, offs,
- color, alpha, drawmode, zcode, pri,
- /* non-gx only */
- 0, 0, nullptr, nullptr, 0
- );
+ m_gx_objzbuf, m_gx_shdzbuf.get(), code, m_gx_spriteram, offs,
+ color, alpha, drawmode, zcode, pri,
+ /* non-gx only */
+ 0, 0, nullptr, nullptr, 0);
}
/* the rest are tilemaps of various kinda */
else
@@ -725,6 +724,7 @@ void konamigx_state::gx_draw_basic_tilemaps(screen_device &screen, bitmap_rgb32
flags2 |= K056382_DRAW_FLAG_FORCE_XYSCROLL;
}
+ // FIXME: implement mixpri and additive
// hack: mask out mixpri bit. if additive bit set, mask it out and invert alpha.
// this makes additive alpha effects look OK until they are properly handled.
int alpha = m_k054338->set_alpha_level(mix_mode_internal) & 0x1ff;
diff --git a/src/mame/konami/konamim2.cpp b/src/mame/konami/konamim2.cpp
index 6cfb2cd5c5d..72958b5ea6d 100644
--- a/src/mame/konami/konamim2.cpp
+++ b/src/mame/konami/konamim2.cpp
@@ -1124,8 +1124,8 @@ INPUT_PORTS_END
void konamim2_state::cr589_config(device_t *device)
{
- device->subdevice<cdda_device>("cdda")->add_route(0, ":lspeaker", 0.5);
- device->subdevice<cdda_device>("cdda")->add_route(1, ":rspeaker", 0.5);
+ device->subdevice<cdda_device>("cdda")->add_route(0, ":speaker", 0.5, 0);
+ device->subdevice<cdda_device>("cdda")->add_route(1, ":speaker", 0.5, 1);
device = device->subdevice("cdda");
}
@@ -1170,12 +1170,11 @@ void konamim2_state::konamim2(machine_config &config)
m_screen->set_screen_update("bda:vdu", FUNC(m2_vdu_device::screen_update));
// Sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
// TODO!
- DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_ldac, 0).add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_rdac, 0).add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_ldac, 0).add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_rdac, 0).add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
}
@@ -1211,8 +1210,8 @@ void konamim2_state::add_ymz280b(machine_config &config)
{
// TODO: The YMZ280B outputs are actually routed to a speaker in each gun
YMZ280B(config, m_ymz280b, XTAL(16'934'400));
- m_ymz280b->add_route(0, "lspeaker", 0.5);
- m_ymz280b->add_route(1, "rspeaker", 0.5);
+ m_ymz280b->add_route(0, "speaker", 0.5, 0);
+ m_ymz280b->add_route(1, "speaker", 0.5, 1);
}
void konamim2_state::add_mt48t58(machine_config &config)
diff --git a/src/mame/konami/konendev.cpp b/src/mame/konami/konendev.cpp
index f58c99b5d81..494fa82c882 100644
--- a/src/mame/konami/konendev.cpp
+++ b/src/mame/konami/konendev.cpp
@@ -403,13 +403,12 @@ void konendev_state::konendev(machine_config &config)
EEPROM_93C56_16BIT(config, "eeprom");
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ymz280b_device &ymz(YMZ280B(config, "ymz", 16'934'400)); // Clock unknown
ymz.set_addrmap(0, &konendev_state::ymz280b_map);
- ymz.add_route(0, "lspeaker", 1.0);
- ymz.add_route(1, "rspeaker", 1.0);
+ ymz.add_route(0, "speaker", 1.0, 0);
+ ymz.add_route(1, "speaker", 1.0, 1);
}
diff --git a/src/mame/konami/kongs470.cpp b/src/mame/konami/kongs470.cpp
index a05e223a374..655e2f88e30 100644
--- a/src/mame/konami/kongs470.cpp
+++ b/src/mame/konami/kongs470.cpp
@@ -76,12 +76,11 @@ void kongs470_state::kongs470(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &kongs470_state::main_map);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
k054539_device &k054539(K054539(config, "k054539", 18'432'000)); // clock unverified
- k054539.add_route(0, "rspeaker", 0.75);
- k054539.add_route(1, "lspeaker", 0.75);
+ k054539.add_route(0, "speaker", 0.75, 1);
+ k054539.add_route(1, "speaker", 0.75, 0);
}
diff --git a/src/mame/konami/konmedal.cpp b/src/mame/konami/konmedal.cpp
index f69c04f59ca..c39f4894703 100644
--- a/src/mame/konami/konmedal.cpp
+++ b/src/mame/konami/konmedal.cpp
@@ -967,12 +967,11 @@ void konmedal_state::tsukande(machine_config &config)
m_k056832->set_palette(m_palette);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
YMZ280B(config, m_ymz, XTAL(16'934'400)); // 16.9344MHz xtal verified on PCB
- m_ymz->add_route(0, "lspeaker", 1.0);
- m_ymz->add_route(1, "rspeaker", 1.0);
+ m_ymz->add_route(0, "speaker", 1.0, 0);
+ m_ymz->add_route(1, "speaker", 1.0, 1);
}
void konmedal_state::ddboy(machine_config &config)
diff --git a/src/mame/konami/konmedal020.cpp b/src/mame/konami/konmedal020.cpp
index ae38dd6c822..4915185038b 100644
--- a/src/mame/konami/konmedal020.cpp
+++ b/src/mame/konami/konmedal020.cpp
@@ -107,12 +107,11 @@ void konmedal020_state::gs471(machine_config &config)
m_vga->set_vram_size(0x100000);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
YMZ280B(config, m_ymz, XTAL(16'934'400)); // 16.9344 MHz xtal verified on PCB
- m_ymz->add_route(0, "lspeaker", 0.75);
- m_ymz->add_route(1, "rspeaker", 0.75);
+ m_ymz->add_route(0, "speaker", 0.75, 0);
+ m_ymz->add_route(1, "speaker", 0.75, 1);
}
ROM_START( gs471 )
diff --git a/src/mame/konami/konmedal68k.cpp b/src/mame/konami/konmedal68k.cpp
index a52f8601105..29d4ded4c47 100644
--- a/src/mame/konami/konmedal68k.cpp
+++ b/src/mame/konami/konmedal68k.cpp
@@ -662,12 +662,11 @@ void konmedal68k_state::kzaurus(machine_config &config)
K055555(config, m_k055555, 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
YMZ280B(config, m_ymz, XTAL(33'868'800)/2); // 33.8688 MHz xtal verified on PCB
- m_ymz->add_route(0, "lspeaker", 0.75);
- m_ymz->add_route(1, "rspeaker", 0.75);
+ m_ymz->add_route(0, "speaker", 0.75, 0);
+ m_ymz->add_route(1, "speaker", 0.75, 1);
}
void konmedal68k_state::koropens(machine_config &config)
diff --git a/src/mame/konami/konmedalppc.cpp b/src/mame/konami/konmedalppc.cpp
index baf95a7f6e8..38effb41a89 100644
--- a/src/mame/konami/konmedalppc.cpp
+++ b/src/mame/konami/konmedalppc.cpp
@@ -148,13 +148,12 @@ void konmedalppc_state::konmedalppc(machine_config &config)
K057714(config, m_gcu, 0).set_screen("screen");
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ymz280b_device &ymz(YMZ280B(config, "ymz", 16934400));
ymz.set_addrmap(0, &konmedalppc_state::ymz280b_map);
- ymz.add_route(1, "lspeaker", 1.0);
- ymz.add_route(0, "rspeaker", 1.0);
+ ymz.add_route(1, "speaker", 1.0, 0);
+ ymz.add_route(0, "speaker", 1.0, 1);
}
ROM_START( turfwld3 )
diff --git a/src/mame/konami/kontest.cpp b/src/mame/konami/kontest.cpp
index fc8651afdf8..abf9f749b40 100644
--- a/src/mame/konami/kontest.cpp
+++ b/src/mame/konami/kontest.cpp
@@ -267,12 +267,11 @@ void kontest_state::kontest(machine_config &config)
PALETTE(config, m_palette, FUNC(kontest_state::kontest_palette), 32);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- SN76489A(config, "sn1", MAIN_CLOCK/16).add_route(ALL_OUTPUTS, "rspeaker", 0.50);
+ SN76489A(config, "sn1", MAIN_CLOCK/16).add_route(ALL_OUTPUTS, "speaker", 0.50, 1);
- SN76489A(config, "sn2", MAIN_CLOCK/16).add_route(ALL_OUTPUTS, "lspeaker", 0.50);
+ SN76489A(config, "sn2", MAIN_CLOCK/16).add_route(ALL_OUTPUTS, "speaker", 0.50, 0);
}
diff --git a/src/mame/konami/kpontoon.cpp b/src/mame/konami/kpontoon.cpp
index 7d60e96fffa..72910a34eee 100644
--- a/src/mame/konami/kpontoon.cpp
+++ b/src/mame/konami/kpontoon.cpp
@@ -387,8 +387,7 @@ void kpontoon_state::kpontoon(machine_config &config)
GFXDECODE(config, m_gfxdecode, "palette", gfx_pontoon);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
K053246(config, m_k053246, 0);
//m_k053246.set_sprite_callback(FUNC(kpontoon_state::sprite_callback));
@@ -398,8 +397,8 @@ void kpontoon_state::kpontoon(machine_config &config)
K054539(config, m_k054539, 18.432_MHz_XTAL);
m_k054539->set_device_rom_tag("k054539");
m_k054539->timer_handler().set(FUNC(kpontoon_state::k054539_nmi_gen));
- m_k054539->add_route(0, "rspeaker", 0.75);
- m_k054539->add_route(1, "lspeaker", 0.75);
+ m_k054539->add_route(0, "speaker", 0.75, 1);
+ m_k054539->add_route(1, "speaker", 0.75, 0);
}
diff --git a/src/mame/konami/ksys573.cpp b/src/mame/konami/ksys573.cpp
index 757574802aa..dc75cf57679 100644
--- a/src/mame/konami/ksys573.cpp
+++ b/src/mame/konami/ksys573.cpp
@@ -2395,8 +2395,8 @@ double ksys573_state::analogue_inputs_callback(uint8_t input)
void ksys573_state::cr589_config(device_t *device)
{
auto cdda = device->subdevice<cdda_device>("cdda");
- cdda->add_route(0, "^^lspeaker", 1.0);
- cdda->add_route(1, "^^rspeaker", 1.0);
+ cdda->add_route(0, "^^speaker", 1.0, 0);
+ cdda->add_route(1, "^^speaker", 1.0, 1);
auto cdrom = device->subdevice<cdrom_image_device>("image");
cdrom->add_region("install");
@@ -2450,12 +2450,11 @@ void ksys573_state::konami573(machine_config &config, bool no_cdrom)
SCREEN(config, "screen", SCREEN_TYPE_RASTER);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
spu_device &spu(SPU(config, "spu", XTAL(67'737'600)/2, m_maincpu.target()));
- spu.add_route(0, "lspeaker", 1.0);
- spu.add_route(1, "rspeaker", 1.0);
+ spu.add_route(0, "speaker", 1.0, 0);
+ spu.add_route(1, "speaker", 1.0, 1);
M48T58(config, "m48t58", 0);
diff --git a/src/mame/konami/lethal.cpp b/src/mame/konami/lethal.cpp
index 1c01036769f..6687f069c64 100644
--- a/src/mame/konami/lethal.cpp
+++ b/src/mame/konami/lethal.cpp
@@ -691,15 +691,14 @@ void lethal_state::lethalen(machine_config &config)
K054000(config, "k054000", 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- K054321(config, m_k054321, "lspeaker", "rspeaker");
+ K054321(config, m_k054321, "speaker");
k054539_device &k054539(K054539(config, "k054539", SOUND_CLOCK));
k054539.timer_handler().set_inputline("soundcpu", INPUT_LINE_NMI);
- k054539.add_route(0, "rspeaker", 1.0);
- k054539.add_route(1, "lspeaker", 1.0);
+ k054539.add_route(0, "speaker", 1.0, 0);
+ k054539.add_route(1, "speaker", 1.0, 1);
}
void lethal_state::lethalej(machine_config &config)
diff --git a/src/mame/konami/mogura.cpp b/src/mame/konami/mogura.cpp
index 07efc4a0cef..28677631c9a 100644
--- a/src/mame/konami/mogura.cpp
+++ b/src/mame/konami/mogura.cpp
@@ -294,10 +294,9 @@ void mogura_state::mogura(machine_config &config)
PALETTE(config, "palette", FUNC(mogura_state::palette), 32);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
- DAC_4BIT_R2R(config, m_ldac, 0).add_route(ALL_OUTPUTS, "lspeaker", 0.25);
- DAC_4BIT_R2R(config, m_rdac, 0).add_route(ALL_OUTPUTS, "rspeaker", 0.25);
+ SPEAKER(config, "speaker", 2).front();
+ DAC_4BIT_R2R(config, m_ldac, 0).add_route(ALL_OUTPUTS, "speaker", 0.25, 0);
+ DAC_4BIT_R2R(config, m_rdac, 0).add_route(ALL_OUTPUTS, "speaker", 0.25, 1);
}
diff --git a/src/mame/konami/moo.cpp b/src/mame/konami/moo.cpp
index 5c3a0b45fb5..b86e998682e 100644
--- a/src/mame/konami/moo.cpp
+++ b/src/mame/konami/moo.cpp
@@ -754,16 +754,15 @@ void moo_state::moo(machine_config &config)
K054338(config, m_k054338, 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- K054321(config, m_k054321, "lspeaker", "rspeaker");
+ K054321(config, m_k054321, "speaker");
- YM2151(config, "ymsnd", XTAL(32'000'000)/8).add_route(0, "lspeaker", 0.50).add_route(1, "rspeaker", 0.50); // 4MHz verified
+ YM2151(config, "ymsnd", XTAL(32'000'000)/8).add_route(0, "speaker", 0.50, 0).add_route(1, "speaker", 0.50, 1); // 4MHz verified
K054539(config, m_k054539, XTAL(18'432'000));
- m_k054539->add_route(0, "rspeaker", 0.75);
- m_k054539->add_route(1, "lspeaker", 0.75);
+ m_k054539->add_route(0, "speaker", 0.75, 0);
+ m_k054539->add_route(1, "speaker", 0.75, 1);
}
void moo_state::moobl(machine_config &config)
@@ -805,12 +804,11 @@ void moo_state::moobl(machine_config &config)
K054338(config, m_k054338, 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
OKIM6295(config, m_oki, 1056000, okim6295_device::PIN7_HIGH); // clock frequency & pin 7 not verified
- m_oki->add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- m_oki->add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
}
void moo_state::bucky(machine_config &config)
diff --git a/src/mame/konami/mystwarr.cpp b/src/mame/konami/mystwarr.cpp
index 22818d9233b..96a51473a0f 100644
--- a/src/mame/konami/mystwarr.cpp
+++ b/src/mame/konami/mystwarr.cpp
@@ -996,21 +996,20 @@ void mystwarr_state::mystwarr(machine_config &config)
MCFG_VIDEO_START_OVERRIDE(mystwarr_state, mystwarr)
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- K054321(config, m_k054321, "lspeaker", "rspeaker");
+ K054321(config, m_k054321, "speaker");
K054539(config, m_k054539_1, XTAL(18'432'000));
m_k054539_1->set_device_rom_tag("k054539");
m_k054539_1->timer_handler().set(FUNC(mystwarr_state::k054539_nmi_gen));
- m_k054539_1->add_route(0, "rspeaker", 1.0); /* stereo channels are inverted */
- m_k054539_1->add_route(1, "lspeaker", 1.0);
+ m_k054539_1->add_route(0, "speaker", 1.0, 1); /* stereo channels are inverted */
+ m_k054539_1->add_route(1, "speaker", 1.0, 0);
K054539(config, m_k054539_2, XTAL(18'432'000));
m_k054539_2->set_device_rom_tag("k054539");
- m_k054539_2->add_route(0, "rspeaker", 1.0); /* stereo channels are inverted */
- m_k054539_2->add_route(1, "lspeaker", 1.0);
+ m_k054539_2->add_route(0, "speaker", 1.0, 1); /* stereo channels are inverted */
+ m_k054539_2->add_route(1, "speaker", 1.0, 0);
}
void mystwarr_state::viostorm(machine_config &config)
@@ -1057,8 +1056,8 @@ void mystwarr_state::viostormbl(machine_config &config)
okim6295_device &oki(OKIM6295(config, "oki", 1'056'000, okim6295_device::PIN7_HIGH)); // frequency and pin 7 unverified
oki.set_addrmap(0, &mystwarr_state::oki_map);
- oki.add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- oki.add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
}
void mystwarr_state::metamrph(machine_config &config)
diff --git a/src/mame/konami/nemesis.cpp b/src/mame/konami/nemesis.cpp
index 05052a13e57..167a3707581 100644
--- a/src/mame/konami/nemesis.cpp
+++ b/src/mame/konami/nemesis.cpp
@@ -2115,25 +2115,24 @@ void salamand_state::salamand(machine_config &config)
m_palette->set_membits(8);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, "soundlatch");
VLM5030(config, m_vlm, 3'579'545);
m_vlm->set_addrmap(0, &salamand_state::salamand_vlm_map);
- m_vlm->add_route(ALL_OUTPUTS, "lspeaker", 2.50);
- m_vlm->add_route(ALL_OUTPUTS, "rspeaker", 2.50);
+ m_vlm->add_route(ALL_OUTPUTS, "speaker", 2.50, 0);
+ m_vlm->add_route(ALL_OUTPUTS, "speaker", 2.50, 1);
K007232(config, m_k007232, 3'579'545);
m_k007232->port_write().set(FUNC(salamand_state::volume_callback));
- m_k007232->add_route(ALL_OUTPUTS, "lspeaker", 0.08);
- m_k007232->add_route(ALL_OUTPUTS, "rspeaker", 0.08);
+ m_k007232->add_route(ALL_OUTPUTS, "speaker", 0.08, 0);
+ m_k007232->add_route(ALL_OUTPUTS, "speaker", 0.08, 1);
ym2151_device &ymsnd(YM2151(config, "ymsnd", 3'579'545));
// ymsnd.irq_handler().set_inputline(m_audiocpu, 0); ... Interrupts _are_ generated, I wonder where they go
- ymsnd.add_route(0, "rspeaker", 1.2); // reversed according to MT #4565
- ymsnd.add_route(1, "lspeaker", 1.2);
+ ymsnd.add_route(0, "speaker", 1.2, 1); // reversed according to MT #4565
+ ymsnd.add_route(1, "speaker", 1.2, 0);
}
void salamand_state::blkpnthr(machine_config &config)
@@ -2159,20 +2158,19 @@ void salamand_state::blkpnthr(machine_config &config)
m_palette->set_membits(8);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, "soundlatch");
K007232(config, m_k007232, 3'579'545);
m_k007232->port_write().set(FUNC(salamand_state::volume_callback));
- m_k007232->add_route(ALL_OUTPUTS, "lspeaker", 0.10);
- m_k007232->add_route(ALL_OUTPUTS, "rspeaker", 0.10);
+ m_k007232->add_route(ALL_OUTPUTS, "speaker", 0.10, 0);
+ m_k007232->add_route(ALL_OUTPUTS, "speaker", 0.10, 1);
ym2151_device &ymsnd(YM2151(config, "ymsnd", 3'579'545));
// ymsnd.irq_handler().set_inputline(m_audiocpu, 0); ... Interrupts _are_ generated, I wonder where they go
- ymsnd.add_route(0, "lspeaker", 1.0);
- ymsnd.add_route(1, "rspeaker", 1.0);
+ ymsnd.add_route(0, "speaker", 1.0, 0);
+ ymsnd.add_route(1, "speaker", 1.0, 1);
}
void hcrash_state::citybomb(machine_config &config)
@@ -2287,25 +2285,24 @@ void hcrash_state::hcrash(machine_config &config)
m_palette->set_membits(8);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, "soundlatch");
VLM5030(config, m_vlm, 3'579'545);
m_vlm->set_addrmap(0, &hcrash_state::salamand_vlm_map);
- m_vlm->add_route(ALL_OUTPUTS, "lspeaker", 2.00);
- m_vlm->add_route(ALL_OUTPUTS, "rspeaker", 2.00);
+ m_vlm->add_route(ALL_OUTPUTS, "speaker", 2.00, 0);
+ m_vlm->add_route(ALL_OUTPUTS, "speaker", 2.00, 1);
K007232(config, m_k007232, 3'579'545);
m_k007232->port_write().set(FUNC(hcrash_state::volume_callback));
- m_k007232->add_route(ALL_OUTPUTS, "lspeaker", 0.10);
- m_k007232->add_route(ALL_OUTPUTS, "rspeaker", 0.10);
+ m_k007232->add_route(ALL_OUTPUTS, "speaker", 0.10, 0);
+ m_k007232->add_route(ALL_OUTPUTS, "speaker", 0.10, 1);
ym2151_device &ymsnd(YM2151(config, "ymsnd", 3'579'545));
// ymsnd.irq_handler().set_inputline(m_audiocpu, 0); ... Interrupts _are_ generated, I wonder where they go
- ymsnd.add_route(0, "lspeaker", 0.50);
- ymsnd.add_route(1, "rspeaker", 0.50);
+ ymsnd.add_route(0, "speaker", 0.50, 0);
+ ymsnd.add_route(1, "speaker", 0.50, 1);
}
/***************************************************************************
diff --git a/src/mame/konami/nwk-tr.cpp b/src/mame/konami/nwk-tr.cpp
index 8aae7dab21c..2003745d253 100644
--- a/src/mame/konami/nwk-tr.cpp
+++ b/src/mame/konami/nwk-tr.cpp
@@ -700,15 +700,14 @@ void nwktr_state::nwktr(machine_config &config)
K001604(config, m_k001604[1], 0);
m_k001604[1]->set_palette(m_palette[1]);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
K056800(config, m_k056800, XTAL(16'934'400));
m_k056800->int_callback().set_inputline(m_audiocpu, M68K_IRQ_2);
rf5c400_device &rfsnd(RF5C400(config, "rfsnd", XTAL(16'934'400))); // as per Guru readme above
- rfsnd.add_route(0, "lspeaker", 1.0);
- rfsnd.add_route(1, "rspeaker", 1.0);
+ rfsnd.add_route(0, "speaker", 1.0, 0);
+ rfsnd.add_route(1, "speaker", 1.0, 1);
KONPPC(config, m_konppc, 0);
m_konppc->set_dsp_tag(0, m_dsp[0]);
diff --git a/src/mame/konami/overdriv.cpp b/src/mame/konami/overdriv.cpp
index 6c8f5e196a3..d694b817e50 100644
--- a/src/mame/konami/overdriv.cpp
+++ b/src/mame/konami/overdriv.cpp
@@ -496,20 +496,19 @@ void overdriv_state::overdriv(machine_config &config)
m_k053252->set_offsets(13*8, 2*8);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- YM2151(config, "ymsnd", XTAL(3'579'545)).add_route(0, "lspeaker", 0.5).add_route(1, "rspeaker", 0.5);
+ YM2151(config, "ymsnd", XTAL(3'579'545)).add_route(0, "speaker", 0.5, 0).add_route(1, "speaker", 0.5, 1);
k053260_device &k053260_1(K053260(config, "k053260_1", XTAL(3'579'545)));
k053260_1.set_device_rom_tag("k053260");
- k053260_1.add_route(0, "lspeaker", 0.35);
- k053260_1.add_route(1, "rspeaker", 0.35);
+ k053260_1.add_route(0, "speaker", 0.35, 0);
+ k053260_1.add_route(1, "speaker", 0.35, 1);
k053260_device &k053260_2(K053260(config, "k053260_2", XTAL(3'579'545)));
k053260_2.set_device_rom_tag("k053260");
- k053260_2.add_route(0, "lspeaker", 0.35);
- k053260_2.add_route(1, "rspeaker", 0.35);
+ k053260_2.add_route(0, "speaker", 0.35, 0);
+ k053260_2.add_route(1, "speaker", 0.35, 1);
}
diff --git a/src/mame/konami/parodius.cpp b/src/mame/konami/parodius.cpp
index 7d5b578eca8..4603b976a3c 100644
--- a/src/mame/konami/parodius.cpp
+++ b/src/mame/konami/parodius.cpp
@@ -393,14 +393,13 @@ void parodius_state::parodius(machine_config &config)
K053251(config, m_k053251, 0);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- YM2151(config, "ymsnd", 3579545).add_route(0, "lspeaker", 1.0).add_route(1, "rspeaker", 1.0);
+ YM2151(config, "ymsnd", 3579545).add_route(0, "speaker", 1.0, 0).add_route(1, "speaker", 1.0, 1);
k053260_device &k053260(K053260(config, "k053260", 3579545));
- k053260.add_route(0, "lspeaker", 0.70);
- k053260.add_route(1, "rspeaker", 0.70);
+ k053260.add_route(0, "speaker", 0.70, 0);
+ k053260.add_route(1, "speaker", 0.70, 1);
k053260.sh1_cb().set(FUNC(parodius_state::z80_nmi_w));
}
diff --git a/src/mame/konami/piratesh.cpp b/src/mame/konami/piratesh.cpp
index 9301ca59757..161feb11cdd 100644
--- a/src/mame/konami/piratesh.cpp
+++ b/src/mame/konami/piratesh.cpp
@@ -648,13 +648,12 @@ void piratesh_state::piratesh(machine_config &config)
K054338(config, "k054338", 0, m_k055555).set_alpha_invert(1);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
K054539(config, m_k054539, XTAL(18'432'000));
m_k054539->timer_handler().set(FUNC(piratesh_state::k054539_nmi_gen));
- m_k054539->add_route(0, "lspeaker", 0.2);
- m_k054539->add_route(1, "rspeaker", 0.2);
+ m_k054539->add_route(0, "speaker", 0.2, 0);
+ m_k054539->add_route(1, "speaker", 0.2, 1);
}
diff --git a/src/mame/konami/plygonet.cpp b/src/mame/konami/plygonet.cpp
index 8bfb552f4ce..8f7940e213a 100644
--- a/src/mame/konami/plygonet.cpp
+++ b/src/mame/konami/plygonet.cpp
@@ -1077,15 +1077,14 @@ void polygonet_state::plygonet(machine_config &config)
m_k053936->set_wrap(true);
// Sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- K054321(config, m_k054321, "lspeaker", "rspeaker");
+ K054321(config, m_k054321, "speaker");
k054539_device &k054539(K054539(config, "k054539", XTAL(18'432'000)));
k054539.timer_handler().set(FUNC(polygonet_state::k054539_nmi_gen));
- k054539.add_route(0, "lspeaker", 0.75);
- k054539.add_route(1, "rspeaker", 0.75);
+ k054539.add_route(0, "speaker", 0.75, 0);
+ k054539.add_route(1, "speaker", 0.75, 1);
}
diff --git a/src/mame/konami/qdrmfgp.cpp b/src/mame/konami/qdrmfgp.cpp
index 6fc5c89842a..87708c311f3 100644
--- a/src/mame/konami/qdrmfgp.cpp
+++ b/src/mame/konami/qdrmfgp.cpp
@@ -697,14 +697,13 @@ void qdrmfgp_state::qdrmfgp(machine_config &config)
m_k053252->set_offsets(40, 16);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
k054539_device &k054539(K054539(config, m_k054539, XTAL(18'432'000)));
k054539.set_addrmap(0, &qdrmfgp_state::qdrmfgp_k054539_map);
k054539.timer_handler().set(FUNC(qdrmfgp_state::k054539_irq1_gen));
- k054539.add_route(0, "lspeaker", 1.0);
- k054539.add_route(1, "rspeaker", 1.0);
+ k054539.add_route(0, "speaker", 1.0, 0);
+ k054539.add_route(1, "speaker", 1.0, 1);
}
void qdrmfgp_state::qdrmfgp2(machine_config &config)
@@ -742,13 +741,12 @@ void qdrmfgp_state::qdrmfgp2(machine_config &config)
m_k053252->set_offsets(40, 16);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
k054539_device &k054539(K054539(config, "k054539", XTAL(18'432'000)));
k054539.set_addrmap(0, &qdrmfgp_state::qdrmfgp_k054539_map);
- k054539.add_route(0, "lspeaker", 1.0);
- k054539.add_route(1, "rspeaker", 1.0);
+ k054539.add_route(0, "speaker", 1.0, 0);
+ k054539.add_route(1, "speaker", 1.0, 1);
}
diff --git a/src/mame/konami/rockrage.cpp b/src/mame/konami/rockrage.cpp
index 19d273666c4..64f18790f2d 100644
--- a/src/mame/konami/rockrage.cpp
+++ b/src/mame/konami/rockrage.cpp
@@ -400,17 +400,16 @@ void rockrage_state::rockrage(machine_config &config)
m_palette->set_endianness(ENDIANNESS_LITTLE);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, "soundlatch").data_pending_callback().set_inputline(m_audiocpu, M6809_IRQ_LINE);
- YM2151(config, "ymsnd", 3'579'545).add_route(0, "lspeaker", 0.30).add_route(1, "rspeaker", 0.30);
+ YM2151(config, "ymsnd", 3'579'545).add_route(0, "speaker", 0.30, 0).add_route(1, "speaker", 0.30, 1);
VLM5030(config, m_vlm, 3'579'545);
m_vlm->set_addrmap(0, &rockrage_state::vlm_map);
- m_vlm->add_route(ALL_OUTPUTS, "lspeaker", 0.60);
- m_vlm->add_route(ALL_OUTPUTS, "rspeaker", 0.60);
+ m_vlm->add_route(ALL_OUTPUTS, "speaker", 0.60, 0);
+ m_vlm->add_route(ALL_OUTPUTS, "speaker", 0.60, 1);
}
diff --git a/src/mame/konami/rungun.cpp b/src/mame/konami/rungun.cpp
index e19321b7d31..7f3ed148e61 100644
--- a/src/mame/konami/rungun.cpp
+++ b/src/mame/konami/rungun.cpp
@@ -685,23 +685,22 @@ void rungun_state::rng(machine_config &config)
m_palette2->enable_hilights();
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- K054321(config, m_k054321, "lspeaker", "rspeaker");
+ K054321(config, m_k054321, "speaker");
// SFX
K054539(config, m_k054539[0], 18.432_MHz_XTAL);
m_k054539[0]->set_device_rom_tag("k054539");
m_k054539[0]->timer_handler().set(FUNC(rungun_state::k054539_nmi_gen));
- m_k054539[0]->add_route(0, "rspeaker", 1.0);
- m_k054539[0]->add_route(1, "lspeaker", 1.0);
+ m_k054539[0]->add_route(0, "speaker", 1.0, 1);
+ m_k054539[0]->add_route(1, "speaker", 1.0, 0);
// BGM, volumes handtuned to make SFXs audible (still not 100% right tho)
K054539(config, m_k054539[1], 18.432_MHz_XTAL);
m_k054539[1]->set_device_rom_tag("k054539");
- m_k054539[1]->add_route(0, "rspeaker", 0.6);
- m_k054539[1]->add_route(1, "lspeaker", 0.6);
+ m_k054539[1]->add_route(0, "speaker", 0.6, 0);
+ m_k054539[1]->add_route(1, "speaker", 0.6, 1);
}
// for dual-screen output Run and Gun requires the video de-multiplexer board connected to the Jamma output, this gives you 2 Jamma connectors, one for each screen.
diff --git a/src/mame/konami/simpsons.cpp b/src/mame/konami/simpsons.cpp
index 423525feebe..a0aabd3170d 100644
--- a/src/mame/konami/simpsons.cpp
+++ b/src/mame/konami/simpsons.cpp
@@ -677,18 +677,17 @@ void simpsons_state::simpsons(machine_config &config)
K053251(config, m_k053251, 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2151_device &ymsnd(YM2151(config, "ymsnd", XTAL(3'579'545))); /* verified on pcb */
- ymsnd.add_route(0, "lspeaker", 0.5); /* only left channel is connected */
- ymsnd.add_route(0, "rspeaker", 0.5);
- ymsnd.add_route(1, "lspeaker", 0.0);
- ymsnd.add_route(1, "rspeaker", 0.0);
+ ymsnd.add_route(0, "speaker", 0.5, 0); /* only left channel is connected */
+ ymsnd.add_route(0, "speaker", 0.5, 1);
+ ymsnd.add_route(1, "speaker", 0.0, 0);
+ ymsnd.add_route(1, "speaker", 0.0, 1);
k053260_device &k053260(K053260(config, "k053260", XTAL(3'579'545))); /* verified on pcb */
- k053260.add_route(0, "lspeaker", 0.5);
- k053260.add_route(1, "rspeaker", 0.5);
+ k053260.add_route(0, "speaker", 0.5, 0);
+ k053260.add_route(1, "speaker", 0.5, 1);
k053260.sh1_cb().set(FUNC(simpsons_state::z80_nmi_w));
}
diff --git a/src/mame/konami/stingnet.cpp b/src/mame/konami/stingnet.cpp
index 37ed17f5ebc..610660a77a4 100644
--- a/src/mame/konami/stingnet.cpp
+++ b/src/mame/konami/stingnet.cpp
@@ -344,13 +344,12 @@ void stingnet_state::stingnet(machine_config &config)
NS16550(config, "duart:chan0", XTAL(19'660'800));
NS16550(config, "duart:chan1", XTAL(19'660'800));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ymz280b_device &ymz(YMZ280B(config, m_ymz, 16934400));
ymz.set_addrmap(0, &stingnet_state::ymz280b_map);
- ymz.add_route(1, "lspeaker", 1.0);
- ymz.add_route(0, "rspeaker", 1.0);
+ ymz.add_route(1, "speaker", 1.0, 0);
+ ymz.add_route(0, "speaker", 1.0, 1);
}
ROM_START( tropchnc )
diff --git a/src/mame/konami/surpratk.cpp b/src/mame/konami/surpratk.cpp
index f0b4fbd32c0..65710c25172 100644
--- a/src/mame/konami/surpratk.cpp
+++ b/src/mame/konami/surpratk.cpp
@@ -336,13 +336,12 @@ void surpratk_state::surpratk(machine_config &config)
K053251(config, m_k053251, 0);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2151_device &ymsnd(YM2151(config, "ymsnd", XTAL(3'579'545)));
ymsnd.irq_handler().set_inputline(m_maincpu, KONAMI_FIRQ_LINE);
- ymsnd.add_route(0, "lspeaker", 1.0);
- ymsnd.add_route(1, "rspeaker", 1.0);
+ ymsnd.add_route(0, "speaker", 1.0, 0);
+ ymsnd.add_route(1, "speaker", 1.0, 1);
}
diff --git a/src/mame/konami/tasman.cpp b/src/mame/konami/tasman.cpp
index 16b798f0c7d..29867e2a48a 100644
--- a/src/mame/konami/tasman.cpp
+++ b/src/mame/konami/tasman.cpp
@@ -690,8 +690,7 @@ void kongambl_state::kongambl(machine_config &config)
m_k056832->set_config(K056832_BPP_8TASMAN, 0, 0);
m_k056832->set_palette(m_palette);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
diff --git a/src/mame/konami/tmnt2.cpp b/src/mame/konami/tmnt2.cpp
index 5ac99b03e27..21fdb8c477b 100644
--- a/src/mame/konami/tmnt2.cpp
+++ b/src/mame/konami/tmnt2.cpp
@@ -2461,14 +2461,13 @@ void tmnt2_state::lgtnfght(machine_config &config)
K053251(config, m_k053251, 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- YM2151(config, "ymsnd", XTAL(3'579'545)).add_route(0, "lspeaker", 1.0).add_route(1, "rspeaker", 1.0);
+ YM2151(config, "ymsnd", XTAL(3'579'545)).add_route(0, "speaker", 1.0, 0).add_route(1, "speaker", 1.0, 1);
K053260(config, m_k053260, XTAL(3'579'545));
- m_k053260->add_route(0, "lspeaker", 0.70);
- m_k053260->add_route(1, "rspeaker", 0.70);
+ m_k053260->add_route(0, "speaker", 0.70, 0);
+ m_k053260->add_route(1, "speaker", 0.70, 1);
m_k053260->sh1_cb().set(FUNC(tmnt2_state::z80_nmi_w));
}
@@ -2517,14 +2516,13 @@ void tmnt2_state::blswhstl(machine_config &config)
K054000(config, m_k054000, 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- YM2151(config, "ymsnd", XTAL(3'579'545)).add_route(0, "lspeaker", 0.70).add_route(1, "rspeaker", 0.70);
+ YM2151(config, "ymsnd", XTAL(3'579'545)).add_route(0, "speaker", 0.70, 0).add_route(1, "speaker", 0.70, 1);
K053260(config, m_k053260, XTAL(3'579'545));
- m_k053260->add_route(0, "rspeaker", 0.50); /* fixed inverted stereo channels */
- m_k053260->add_route(1, "lspeaker", 0.50);
+ m_k053260->add_route(0, "speaker", 0.50, 1); /* fixed inverted stereo channels */
+ m_k053260->add_route(1, "speaker", 0.50, 0);
m_k053260->sh1_cb().set(FUNC(tmnt2_state::z80_nmi_w));
}
@@ -2584,12 +2582,11 @@ void glfgreat_state::glfgreat(machine_config &config)
K053251(config, m_k053251, 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
K053260(config, m_k053260, XTAL(3'579'545));
- m_k053260->add_route(0, "lspeaker", 1.0);
- m_k053260->add_route(1, "rspeaker", 1.0);
+ m_k053260->add_route(0, "speaker", 1.0, 1);
+ m_k053260->add_route(1, "speaker", 1.0, 0);
m_k053260->sh1_cb().set(FUNC(glfgreat_state::z80_nmi_w));
}
@@ -2648,15 +2645,14 @@ void prmrsocr_state::prmrsocr(machine_config &config)
K053251(config, m_k053251, 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- K054321(config, "k054321", "lspeaker", "rspeaker");
+ K054321(config, "k054321", "speaker");
K054539(config, m_k054539, XTAL(18'432'000));
m_k054539->timer_handler().set_inputline("audiocpu", INPUT_LINE_NMI);
- m_k054539->add_route(0, "lspeaker", 1.0);
- m_k054539->add_route(1, "rspeaker", 1.0);
+ m_k054539->add_route(0, "speaker", 1.0, 0);
+ m_k054539->add_route(1, "speaker", 1.0, 1);
}
void tmnt2_state::tmnt2(machine_config &config)
@@ -2705,14 +2701,13 @@ void tmnt2_state::tmnt2(machine_config &config)
K053251(config, m_k053251, 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- YM2151(config, "ymsnd", XTAL(3'579'545)).add_route(0, "lspeaker", 1.0).add_route(1, "rspeaker", 1.0);
+ YM2151(config, "ymsnd", XTAL(3'579'545)).add_route(0, "speaker", 1.0, 0).add_route(1, "speaker", 1.0, 1);
K053260(config, m_k053260, XTAL(3'579'545));
- m_k053260->add_route(0, "lspeaker", 0.75);
- m_k053260->add_route(1, "rspeaker", 0.75);
+ m_k053260->add_route(0, "speaker", 0.75, 0);
+ m_k053260->add_route(1, "speaker", 0.75, 1);
m_k053260->sh1_cb().set(FUNC(tmnt2_state::z80_nmi_w));
}
@@ -2759,14 +2754,13 @@ void tmnt2_state::ssriders(machine_config &config)
K053251(config, m_k053251, 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- YM2151(config, "ymsnd", XTAL(3'579'545)).add_route(0, "lspeaker", 1.0).add_route(1, "rspeaker", 1.0);
+ YM2151(config, "ymsnd", XTAL(3'579'545)).add_route(0, "speaker", 1.0, 0).add_route(1, "speaker", 1.0, 1);
K053260(config, m_k053260, XTAL(3'579'545));
- m_k053260->add_route(0, "lspeaker", 0.70);
- m_k053260->add_route(1, "rspeaker", 0.70);
+ m_k053260->add_route(0, "speaker", 0.70, 0);
+ m_k053260->add_route(1, "speaker", 0.70, 1);
m_k053260->sh1_cb().set(FUNC(tmnt2_state::z80_nmi_w));
}
@@ -2820,12 +2814,11 @@ void sunsetbl_state::sunsetbl(machine_config &config)
K053251(config, m_k053251, 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
okim6295_device &oki(OKIM6295(config, "oki", 1056000, okim6295_device::PIN7_HIGH)); // clock frequency & pin 7 not verified
- oki.add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- oki.add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
}
void tmnt2_state::thndrx2(machine_config &config)
@@ -2869,14 +2862,13 @@ void tmnt2_state::thndrx2(machine_config &config)
/* sound hardware */
// NB: game defaults in mono
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- YM2151(config, "ymsnd", XTAL(3'579'545)).add_route(0, "lspeaker", 0.25).add_route(1, "rspeaker", 0.25);
+ YM2151(config, "ymsnd", XTAL(3'579'545)).add_route(0, "speaker", 0.25, 0).add_route(1, "speaker", 0.25, 1);
K053260(config, m_k053260, XTAL(3'579'545));
- m_k053260->add_route(0, "lspeaker", 0.50);
- m_k053260->add_route(1, "rspeaker", 0.50);
+ m_k053260->add_route(0, "speaker", 0.50, 0);
+ m_k053260->add_route(1, "speaker", 0.50, 1);
m_k053260->sh1_cb().set(FUNC(tmnt2_state::z80_nmi_w));
}
diff --git a/src/mame/konami/twin16.cpp b/src/mame/konami/twin16.cpp
index 0756ce2e20c..db317971e11 100644
--- a/src/mame/konami/twin16.cpp
+++ b/src/mame/konami/twin16.cpp
@@ -677,23 +677,22 @@ void twin16_state::twin16(machine_config &config)
m_palette->enable_shadows();
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, "soundlatch");
- YM2151(config, "ymsnd", XTAL(3'579'545)).add_route(0, "lspeaker", 1.0).add_route(1, "rspeaker", 1.0);
+ YM2151(config, "ymsnd", XTAL(3'579'545)).add_route(0, "speaker", 1.0, 0).add_route(1, "speaker", 1.0, 1);
K007232(config, m_k007232, XTAL(3'579'545));
m_k007232->port_write().set(FUNC(twin16_state::volume_callback));
- m_k007232->add_route(0, "lspeaker", 0.12); // estimated with gradius2 OST
- m_k007232->add_route(0, "rspeaker", 0.12);
- m_k007232->add_route(1, "lspeaker", 0.12);
- m_k007232->add_route(1, "rspeaker", 0.12);
+ m_k007232->add_route(0, "speaker", 0.12, 0); // estimated with gradius2 OST
+ m_k007232->add_route(0, "speaker", 0.12, 1);
+ m_k007232->add_route(1, "speaker", 0.12, 0);
+ m_k007232->add_route(1, "speaker", 0.12, 1);
UPD7759(config, m_upd7759);
- m_upd7759->add_route(ALL_OUTPUTS, "lspeaker", 0.20);
- m_upd7759->add_route(ALL_OUTPUTS, "rspeaker", 0.20);
+ m_upd7759->add_route(ALL_OUTPUTS, "speaker", 0.20, 0);
+ m_upd7759->add_route(ALL_OUTPUTS, "speaker", 0.20, 1);
}
void twin16_state::devilw(machine_config &config)
@@ -731,23 +730,22 @@ void fround_state::fround(machine_config &config)
m_palette->enable_shadows();
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, "soundlatch");
- YM2151(config, "ymsnd", XTAL(3'579'545)).add_route(0, "lspeaker", 1.0).add_route(1, "rspeaker", 1.0);
+ YM2151(config, "ymsnd", XTAL(3'579'545)).add_route(0, "speaker", 1.0, 0).add_route(1, "speaker", 1.0, 1);
K007232(config, m_k007232, XTAL(3'579'545));
m_k007232->port_write().set(FUNC(twin16_state::volume_callback));
- m_k007232->add_route(0, "lspeaker", 0.12);
- m_k007232->add_route(0, "rspeaker", 0.12);
- m_k007232->add_route(1, "lspeaker", 0.12);
- m_k007232->add_route(1, "rspeaker", 0.12);
+ m_k007232->add_route(0, "speaker", 0.12, 0);
+ m_k007232->add_route(0, "speaker", 0.12, 1);
+ m_k007232->add_route(1, "speaker", 0.12, 0);
+ m_k007232->add_route(1, "speaker", 0.12, 1);
UPD7759(config, m_upd7759);
- m_upd7759->add_route(ALL_OUTPUTS, "lspeaker", 0.20);
- m_upd7759->add_route(ALL_OUTPUTS, "rspeaker", 0.20);
+ m_upd7759->add_route(ALL_OUTPUTS, "speaker", 0.20, 0);
+ m_upd7759->add_route(ALL_OUTPUTS, "speaker", 0.20, 1);
}
void twin16_state::miaj(machine_config &config)
diff --git a/src/mame/konami/ultraman.cpp b/src/mame/konami/ultraman.cpp
index 66bc40385e6..9fc4174400e 100644
--- a/src/mame/konami/ultraman.cpp
+++ b/src/mame/konami/ultraman.cpp
@@ -393,16 +393,15 @@ void ultraman_state::ultraman(machine_config &config)
m_k051316[2]->set_zoom_callback(FUNC(ultraman_state::zoom_callback<2>));
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
- YM2151(config, "ymsnd", 24'000'000 / 6).add_route(0, "lspeaker", 1.0).add_route(1, "rspeaker", 1.0);
+ YM2151(config, "ymsnd", 24'000'000 / 6).add_route(0, "speaker", 1.0, 0).add_route(1, "speaker", 1.0, 1);
okim6295_device &oki(OKIM6295(config, "oki", 1'056'000, okim6295_device::PIN7_HIGH)); // clock frequency & pin 7 not verified
- oki.add_route(ALL_OUTPUTS, "lspeaker", 0.50);
- oki.add_route(ALL_OUTPUTS, "rspeaker", 0.50);
+ oki.add_route(ALL_OUTPUTS, "speaker", 0.50, 0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 0.50, 1);
}
diff --git a/src/mame/konami/ultrsprt.cpp b/src/mame/konami/ultrsprt.cpp
index b83edaaac31..28cc580ef34 100644
--- a/src/mame/konami/ultrsprt.cpp
+++ b/src/mame/konami/ultrsprt.cpp
@@ -277,13 +277,12 @@ void ultrsprt_state::ultrsprt(machine_config &config)
K056800(config, m_k056800, XTAL(18'432'000));
m_k056800->int_callback().set_inputline(m_audiocpu, M68K_IRQ_6);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
k054539_device &k054539(K054539(config, "k054539", XTAL(18'432'000)));
k054539.timer_handler().set_inputline("audiocpu", M68K_IRQ_5);
- k054539.add_route(0, "lspeaker", 1.0);
- k054539.add_route(1, "rspeaker", 1.0);
+ k054539.add_route(0, "speaker", 1.0, 0);
+ k054539.add_route(1, "speaker", 1.0, 1);
}
diff --git a/src/mame/konami/vendetta.cpp b/src/mame/konami/vendetta.cpp
index fe1c6a3a42d..b6604e7d20e 100644
--- a/src/mame/konami/vendetta.cpp
+++ b/src/mame/konami/vendetta.cpp
@@ -646,14 +646,13 @@ void vendetta_state::vendetta(machine_config &config)
K054000(config, m_k054000, 0);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- YM2151(config, "ymsnd", XTAL(3'579'545)).add_route(0, "lspeaker", 0.5).add_route(1, "rspeaker", 0.5); // verified with PCB
+ YM2151(config, "ymsnd", XTAL(3'579'545)).add_route(0, "speaker", 0.5, 0).add_route(1, "speaker", 0.5, 1); // verified with PCB
k053260_device &k053260(K053260(config, "k053260", XTAL(3'579'545))); // verified with PCB
- k053260.add_route(0, "lspeaker", 0.75);
- k053260.add_route(1, "rspeaker", 0.75);
+ k053260.add_route(0, "speaker", 0.75, 0);
+ k053260.add_route(1, "speaker", 0.75, 1);
k053260.sh1_cb().set(FUNC(vendetta_state::z80_nmi_w));
}
diff --git a/src/mame/konami/viper.cpp b/src/mame/konami/viper.cpp
index fdb1feaaf06..1bbfaf15433 100644
--- a/src/mame/konami/viper.cpp
+++ b/src/mame/konami/viper.cpp
@@ -2605,10 +2605,9 @@ void viper_state::viper(machine_config &config)
PALETTE(config, "palette").set_entries(65536);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
- DMADAC(config, "dacl").add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- DMADAC(config, "dacr").add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ SPEAKER(config, "speaker", 2).front();
+ DMADAC(config, "dacl").add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ DMADAC(config, "dacr").add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
M48T58(config, "m48t58", 0);
@@ -2629,12 +2628,10 @@ void viper_state::viper_ppp(machine_config &config)
void viper_state::viper_fullbody(machine_config &config)
{
viper(config);
- config.device_remove("lspeaker");
- config.device_remove("rspeaker");
- SPEAKER(config, "front").front_center();
- SPEAKER(config, "rear").rear_center();
- DMADAC(config.replace(), "dacl").add_route(ALL_OUTPUTS, "front", 1.0);
- DMADAC(config.replace(), "dacr").add_route(ALL_OUTPUTS, "rear", 1.0);
+ config.device_remove("speaker");
+ SPEAKER(config, "speaker", 2).front_center(0).rear_center(1);
+ DMADAC(config.replace(), "dacl").add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ DMADAC(config.replace(), "dacr").add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
}
void viper_state::viper_fbdongle(machine_config &config)
diff --git a/src/mame/konami/wecleman.cpp b/src/mame/konami/wecleman.cpp
index d9b16ff3798..1a58eb657bb 100644
--- a/src/mame/konami/wecleman.cpp
+++ b/src/mame/konami/wecleman.cpp
@@ -1073,17 +1073,16 @@ void wecleman_state::wecleman(machine_config &config)
PALETTE(config, m_palette).set_entries(2048);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, "soundlatch");
- YM2151(config, "ymsnd", 3579545).add_route(0, "lspeaker", 0.85).add_route(1, "rspeaker", 0.85);
+ YM2151(config, "ymsnd", 3579545).add_route(0, "speaker", 0.85, 0).add_route(1, "speaker", 0.85, 1);
K007232(config, m_k007232[0], 3579545);
m_k007232[0]->port_write().set(FUNC(wecleman_state::wecleman_volume_callback));
- m_k007232[0]->add_route(ALL_OUTPUTS, "lspeaker", 0.20);
- m_k007232[0]->add_route(ALL_OUTPUTS, "rspeaker", 0.20);
+ m_k007232[0]->add_route(ALL_OUTPUTS, "speaker", 0.20, 0);
+ m_k007232[0]->add_route(ALL_OUTPUTS, "speaker", 0.20, 1);
}
@@ -1153,25 +1152,24 @@ void hotchase_state::hotchase(machine_config &config)
m_k051316[1]->set_zoom_callback(FUNC(hotchase_state::hotchase_zoom_callback_2));
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, "soundlatch");
K007232(config, m_k007232[0], 3579545);
// SLEV not used, volume control is elsewhere
- m_k007232[0]->add_route(0, "lspeaker", 0.20);
- m_k007232[0]->add_route(1, "rspeaker", 0.20);
+ m_k007232[0]->add_route(0, "speaker", 0.20, 0);
+ m_k007232[0]->add_route(1, "speaker", 0.20, 1);
K007232(config, m_k007232[1], 3579545);
// SLEV not used, volume control is elsewhere
- m_k007232[1]->add_route(0, "lspeaker", 0.20);
- m_k007232[1]->add_route(1, "rspeaker", 0.20);
+ m_k007232[1]->add_route(0, "speaker", 0.20, 0);
+ m_k007232[1]->add_route(1, "speaker", 0.20, 1);
K007232(config, m_k007232[2], 3579545);
// SLEV not used, volume control is elsewhere
- m_k007232[2]->add_route(0, "lspeaker", 0.20);
- m_k007232[2]->add_route(1, "rspeaker", 0.20);
+ m_k007232[2]->add_route(0, "speaker", 0.20, 0);
+ m_k007232[2]->add_route(1, "speaker", 0.20, 1);
}
diff --git a/src/mame/konami/xexex.cpp b/src/mame/konami/xexex.cpp
index af99cbd1421..09288378674 100644
--- a/src/mame/konami/xexex.cpp
+++ b/src/mame/konami/xexex.cpp
@@ -733,10 +733,9 @@ void xexex_state::xexex(machine_config &config)
K054338(config, m_k054338, 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- K054321(config, m_k054321, "lspeaker", "rspeaker");
+ K054321(config, m_k054321, "speaker");
ym2151_device &ymsnd(YM2151(config, "ymsnd", XTAL(32'000'000)/8)); // 4MHz
ymsnd.add_route(0, "filter1_l", 0.2);
@@ -746,15 +745,15 @@ void xexex_state::xexex(machine_config &config)
K054539(config, m_k054539, XTAL(18'432'000));
m_k054539->set_analog_callback(FUNC(xexex_state::ym_set_mixing));
- m_k054539->add_route(0, "lspeaker", 0.4);
- m_k054539->add_route(0, "rspeaker", 0.4);
- m_k054539->add_route(1, "lspeaker", 0.4);
- m_k054539->add_route(1, "rspeaker", 0.4);
-
- FILTER_VOLUME(config, "filter1_l").add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- FILTER_VOLUME(config, "filter1_r").add_route(ALL_OUTPUTS, "rspeaker", 1.0);
- FILTER_VOLUME(config, "filter2_l").add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- FILTER_VOLUME(config, "filter2_r").add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ m_k054539->add_route(0, "speaker", 0.4, 0);
+ m_k054539->add_route(0, "speaker", 0.4, 1);
+ m_k054539->add_route(1, "speaker", 0.4, 0);
+ m_k054539->add_route(1, "speaker", 0.4, 1);
+
+ FILTER_VOLUME(config, "filter1_l").add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ FILTER_VOLUME(config, "filter1_r").add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
+ FILTER_VOLUME(config, "filter2_l").add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ FILTER_VOLUME(config, "filter2_r").add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
}
diff --git a/src/mame/konami/xmen.cpp b/src/mame/konami/xmen.cpp
index bbae8982dc5..4117f1a0cc4 100644
--- a/src/mame/konami/xmen.cpp
+++ b/src/mame/konami/xmen.cpp
@@ -662,16 +662,15 @@ void xmen_state::sound_hardware(machine_config &config)
m_audiocpu->set_addrmap(AS_PROGRAM, &xmen_state::sound_map);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- K054321(config, "k054321", "lspeaker", "rspeaker");
+ K054321(config, "k054321", "speaker");
- YM2151(config, "ymsnd", XTAL(16'000'000) / 4).add_route(0, "lspeaker", 0.20).add_route(1, "rspeaker", 0.20); // verified on PCB
+ YM2151(config, "ymsnd", XTAL(16'000'000) / 4).add_route(0, "speaker", 0.20, 1).add_route(1, "speaker", 0.20, 0); // verified on PCB
k054539_device &k054539(K054539(config, "k054539", XTAL(18'432'000)));
- k054539.add_route(0, "rspeaker", 1.00);
- k054539.add_route(1, "lspeaker", 1.00);
+ k054539.add_route(0, "speaker", 1.00, 1);
+ k054539.add_route(1, "speaker", 1.00, 0);
}
void xmen_state::bootleg_sound_hardware(machine_config &config)
diff --git a/src/mame/konami/zr107.cpp b/src/mame/konami/zr107.cpp
index 3df56517c8f..8d3eb6486eb 100644
--- a/src/mame/konami/zr107.cpp
+++ b/src/mame/konami/zr107.cpp
@@ -780,19 +780,18 @@ void zr107_state::zr107(machine_config &config)
K056800(config, m_k056800, XTAL(18'432'000));
m_k056800->int_callback().set_inputline(m_audiocpu, M68K_IRQ_1);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
k054539_device &k054539_1(K054539(config, "k054539_1", XTAL(18'432'000)));
k054539_1.set_device_rom_tag("k054539");
k054539_1.timer_handler().set(FUNC(zr107_state::k054539_irq_gen));
- k054539_1.add_route(0, "lspeaker", 0.75);
- k054539_1.add_route(1, "rspeaker", 0.75);
+ k054539_1.add_route(0, "speaker", 0.75, 0);
+ k054539_1.add_route(1, "speaker", 0.75, 1);
k054539_device &k054539_2(K054539(config, "k054539_2", XTAL(18'432'000)));
k054539_2.set_device_rom_tag("k054539");
- k054539_2.add_route(0, "lspeaker", 0.75);
- k054539_2.add_route(1, "rspeaker", 0.75);
+ k054539_2.add_route(0, "speaker", 0.75, 0);
+ k054539_2.add_route(1, "speaker", 0.75, 1);
adc0838_device &adc(ADC0838(config, "adc0838"));
adc.set_input_callback(FUNC(zr107_state::adc0838_callback));
diff --git a/src/mame/korg/korgds8.cpp b/src/mame/korg/korgds8.cpp
index 412c259fe5e..d93c5347aba 100644
--- a/src/mame/korg/korgds8.cpp
+++ b/src/mame/korg/korgds8.cpp
@@ -233,12 +233,11 @@ void korg_ds8_state::ds8(machine_config &config)
lcdc.set_lcd_size(2, 40);
lcdc.set_pixel_update_cb(FUNC(korg_ds8_state::lcd_pixel_update));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2164_device &fm(YM2164(config, "fm", 3.579545_MHz_XTAL)); // YM2164 + YM3012
- fm.add_route(0, "lspeaker", 1.00);
- fm.add_route(1, "rspeaker", 1.00);
+ fm.add_route(0, "speaker", 1.00, 0);
+ fm.add_route(1, "speaker", 1.00, 1);
}
void korg_ds8_state::korg707(machine_config &config)
diff --git a/src/mame/korg/korgz3.cpp b/src/mame/korg/korgz3.cpp
index 812e1ade33d..18aea46b973 100644
--- a/src/mame/korg/korgz3.cpp
+++ b/src/mame/korg/korgz3.cpp
@@ -128,12 +128,11 @@ void korgz3_state::korgz3(machine_config &config)
M58990(config, m_adc, 1'000'000); // M58990P-1
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2414_device &ymsnd(YM2414(config, "ymsnd", 3'579'545)); // YM2414B
- ymsnd.add_route(0, "lspeaker", 0.60);
- ymsnd.add_route(1, "rspeaker", 0.60);
+ ymsnd.add_route(0, "speaker", 0.60, 0);
+ ymsnd.add_route(1, "speaker", 0.60, 1);
}
ROM_START(korgz3)
diff --git a/src/mame/korg/polysix.cpp b/src/mame/korg/polysix.cpp
index 09ec249ea6b..c19ebc39f9b 100644
--- a/src/mame/korg/polysix.cpp
+++ b/src/mame/korg/polysix.cpp
@@ -40,7 +40,7 @@ public:
u8 get_control_low();
- 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 void device_start() override;
virtual void device_reset() override;
@@ -358,9 +358,9 @@ u8 polysix_sound_block::get_control_low()
}
// #*#*#*#*#*#*#*#
-void polysix_sound_block::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void polysix_sound_block::sound_stream_update(sound_stream &stream)
{
- for(int sample=0; sample != outputs[0].samples(); sample++) {
+ for(int sample=0; sample != stream.samples(); sample++) {
// u8 trigger = m_gates & ~m_current_gates;
float out = 0;
@@ -416,7 +416,7 @@ void polysix_sound_block::sound_stream_update(sound_stream &stream, std::vector<
}
m_current_gates = m_gates;
- outputs[0].put_clamp(sample, out/2);
+ stream.put(0, sample, out/2);
}
}
diff --git a/src/mame/kurzweil/krz2000.cpp b/src/mame/kurzweil/krz2000.cpp
index 9b445d59678..0f5c2422c21 100644
--- a/src/mame/kurzweil/krz2000.cpp
+++ b/src/mame/kurzweil/krz2000.cpp
@@ -368,8 +368,7 @@ void k2000_state::k2000(machine_config &config)
LM24014H(config, "lcd");
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
void k2000_state::k2000_palette(palette_device &palette) const
diff --git a/src/mame/layout/moog_source.lay b/src/mame/layout/moog_source.lay
index 26a33ffbc92..833aa106ea1 100644
--- a/src/mame/layout/moog_source.lay
+++ b/src/mame/layout/moog_source.lay
@@ -1146,7 +1146,7 @@ copyright-holders:m1macrophage
<element ref="text_mod_rate">
<bounds x="90" y="303" width="26" height="7"/>
</element>
- <element ref="led">
+ <element ref="led" name="mod_rate_led">
<bounds x="118" y="304" width="8" height="8"/>
</element>
<element ref="text_pitch">
diff --git a/src/mame/leapfrog/leapster_explorer.cpp b/src/mame/leapfrog/leapster_explorer.cpp
index ab4fd6f484c..564a74a918d 100644
--- a/src/mame/leapfrog/leapster_explorer.cpp
+++ b/src/mame/leapfrog/leapster_explorer.cpp
@@ -91,8 +91,7 @@ void leapfrog_leapster_explorer_state::leapfrog_leapster_explorer(machine_config
m_screen->set_visarea(0, 320 - 1, 0, 240 - 1);
m_screen->set_screen_update(FUNC(leapfrog_leapster_explorer_state::screen_update_innotab));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_CARTSLOT(config, m_cart, generic_plain_slot, "leapfrog_leapster_explorer_cart");
m_cart->set_width(GENERIC_ROM16_WIDTH);
diff --git a/src/mame/linn/linndrum.cpp b/src/mame/linn/linndrum.cpp
index edfb52c15e2..1803e68fdba 100644
--- a/src/mame/linn/linndrum.cpp
+++ b/src/mame/linn/linndrum.cpp
@@ -272,8 +272,7 @@ private:
required_device<filter_biquad_device> m_click_bpf;
required_device<mixer_device> m_left_mixer; // 4558 op-amp (U1A).
required_device<mixer_device> m_right_mixer; // 4558 op-amp (U1B).
- required_device<speaker_device> m_left_out; // 4558 op-amp (U2A).
- required_device<speaker_device> m_right_out; // 4558 op-amp (U2B).
+ required_device<speaker_device> m_out; // 4558 op-amp (U2A, U2B).
static constexpr const float MIXER_R_PRE_FADER[NUM_MIXER_CHANNELS] =
{
@@ -383,8 +382,7 @@ linndrum_audio_device::linndrum_audio_device(const machine_config &mconfig, cons
, m_click_bpf(*this, "click_bpf")
, m_left_mixer(*this, "lmixer")
, m_right_mixer(*this, "rmixer")
- , m_left_out(*this, "lspeaker")
- , m_right_out(*this, "rspeaker")
+ , m_out(*this, "speaker")
{
}
@@ -676,11 +674,10 @@ void linndrum_audio_device::device_add_mconfig(machine_config &config)
m_left_mixer->add_route(0, left_rc, 1.0);
m_right_mixer->add_route(0, right_rc, 1.0);
- SPEAKER(config, m_left_out).front_left();
- SPEAKER(config, m_right_out).front_right();
+ SPEAKER(config, m_out, 2).front();
// Gain will be set in update_master_volume().
- left_rc.add_route(0, m_left_out, 1.0);
- right_rc.add_route(0, m_right_out, 1.0);
+ left_rc.add_route(0, m_out, 1.0, 0);
+ right_rc.add_route(0, m_out, 1.0, 1);
}
void linndrum_audio_device::device_start()
@@ -996,8 +993,8 @@ void linndrum_audio_device::update_master_volume()
const float final_gain = gain * VOLTAGE_TO_SOUND_SCALER;
// Using -final_gain, because the output opamps (U2A, U2B) are inverting.
- m_left_out->set_input_gain(0, -final_gain);
- m_right_out->set_input_gain(0, -final_gain);
+ m_out->set_input_gain(0, -final_gain);
+ m_out->set_input_gain(1, -final_gain);
LOGMASKED(LOG_MIX, "Master volume updated. Gain: %f, final gain: %f\n", gain, final_gain);
}
diff --git a/src/mame/mame.lst b/src/mame/mame.lst
index 20385b524ab..61e83f6b5e6 100644
--- a/src/mame/mame.lst
+++ b/src/mame/mame.lst
@@ -20466,9 +20466,6 @@ skill98
skillch
skillcha
srmagic
-ss2000
-ss2000a
-ss2001
star100
super7
super9
@@ -20545,7 +20542,8 @@ mgcsb
mgdh
mgdha
sdmg2
-sdmg2a
+sdmg2754ca
+sdmg2754cb
sdmg2p
slqz2
slqz2a
@@ -29531,6 +29529,7 @@ cas21iwc
comg074
comg076
comg079
+comg079b
comg080
comg094
comg107
@@ -32572,6 +32571,11 @@ vcarn
sprcros2
sprcros2a
+@source:misc/sshanghai.cpp
+ssh2000
+ssh2000a
+ssh2000wf
+
@source:misc/startouch.cpp
europl01
@@ -42616,6 +42620,9 @@ bert
@source:skeleton/biorhythm.cpp
biorhthm
+@source:skeleton/biorhythm_fp.cpp
+biortmfp
+
@source:skeleton/bitgraph.cpp
bitgrpha
bitgrphb
@@ -46387,6 +46394,7 @@ ablkickb
abltenni
anpantv
ban_krkk
+ban_tam2
comil
ddr33v
decathln
@@ -46395,6 +46403,7 @@ dmbtjunc
doraglob
doraglobf
doraglobg
+doraglobuk
doraphon
doraphonf
doyousud
diff --git a/src/mame/maygay/maygay1b.cpp b/src/mame/maygay/maygay1b.cpp
index 3f327e3c321..31162e624a5 100644
--- a/src/mame/maygay/maygay1b.cpp
+++ b/src/mame/maygay/maygay1b.cpp
@@ -743,21 +743,20 @@ void maygay1b_state::maygay_m1(machine_config &config)
mainlatch.q_out_cb<6>().set(FUNC(maygay1b_state::srsel_w)); // Srsel
S16LF01(config, m_vfd);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
YM2149(config, m_ay, M1_MASTER_CLOCK);
m_ay->port_a_write_callback().set(FUNC(maygay1b_state::m1_meter_w));
m_ay->port_b_write_callback().set(FUNC(maygay1b_state::m1_lockout_w));
- m_ay->add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- m_ay->add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ m_ay->add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ m_ay->add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
ym2413_device &ymsnd(YM2413(config, "ymsnd", M1_MASTER_CLOCK/4));
- ymsnd.add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- ymsnd.add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ ymsnd.add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ ymsnd.add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
OKIM6376(config, m_msm6376, 102400); //? Seems to work well with samples, but unconfirmed
- m_msm6376->add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- m_msm6376->add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ m_msm6376->add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ m_msm6376->add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
TIMER(config, "nmitimer").configure_periodic(FUNC(maygay1b_state::maygay1b_nmitimer_callback), attotime::from_hz(75)); // freq?
@@ -807,8 +806,8 @@ void maygay1b_state::maygay_m1_nec(machine_config &config)
config.device_remove("msm6376");
UPD7759(config, m_upd7759);
- m_upd7759->add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- m_upd7759->add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ m_upd7759->add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ m_upd7759->add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
}
void maygay1b_state::m1ab_no_oki_w(uint8_t data)
diff --git a/src/mame/metro/metro.cpp b/src/mame/metro/metro.cpp
index 0d23f95c409..67ab9b207d1 100644
--- a/src/mame/metro/metro.cpp
+++ b/src/mame/metro/metro.cpp
@@ -3478,18 +3478,17 @@ void blzntrnd_state::blzntrnd(machine_config &config)
// sound hardware
// HUM-002 PCB Configuration : Stereo output with second speaker connector
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
ym2610_device &ymsnd(YM2610(config, m_ymsnd, 16_MHz_XTAL/2));
ymsnd.irq_handler().set_inputline("audiocpu", 0);
- ymsnd.add_route(0, "lspeaker", 0.75);
- ymsnd.add_route(0, "rspeaker", 0.75);
- ymsnd.add_route(1, "lspeaker", 1.0);
- ymsnd.add_route(2, "rspeaker", 1.0);
+ ymsnd.add_route(0, "speaker", 0.75, 0);
+ ymsnd.add_route(0, "speaker", 0.75, 1);
+ ymsnd.add_route(1, "speaker", 1.0, 0);
+ ymsnd.add_route(2, "speaker", 1.0, 1);
}
void blzntrnd_state::gstrik2(machine_config &config)
@@ -3504,8 +3503,7 @@ void blzntrnd_state::gstrik2(machine_config &config)
m_vdp2->set_tmap_xoffsets(0,8,0);
// HUM-003 PCB Configuration : Mono output only
- config.device_remove("lspeaker");
- config.device_remove("rspeaker");
+ config.device_remove("speaker");
SPEAKER(config, "mono").front_center();
ym2610_device &ymsnd(YM2610(config.replace(), m_ymsnd, 16_MHz_XTAL/2));
diff --git a/src/mame/metro/rabbit.cpp b/src/mame/metro/rabbit.cpp
index 6df9428a83f..911cfe7e19b 100644
--- a/src/mame/metro/rabbit.cpp
+++ b/src/mame/metro/rabbit.cpp
@@ -900,12 +900,11 @@ void rabbit_state::rabbit(machine_config &config)
PALETTE(config, m_palette, palette_device::BLACK).set_format(palette_device::xGRB_888, 0x4000);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
i5000snd_device &i5000snd(I5000_SND(config, "i5000snd", XTAL(40'000'000)));
- i5000snd.add_route(0, "rspeaker", 1.0);
- i5000snd.add_route(1, "lspeaker", 1.0);
+ i5000snd.add_route(0, "speaker", 1.0, 1);
+ i5000snd.add_route(1, "speaker", 1.0, 0);
}
diff --git a/src/mame/metro/tmmjprd.cpp b/src/mame/metro/tmmjprd.cpp
index 53a8426102b..e132d98afc3 100644
--- a/src/mame/metro/tmmjprd.cpp
+++ b/src/mame/metro/tmmjprd.cpp
@@ -757,12 +757,11 @@ void tmmjprd_state::tmpdoki(machine_config &config)
lscreen.set_palette(m_palette);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
i5000snd_device &i5000snd(I5000_SND(config, "i5000snd", XTAL(40'000'000)));
- i5000snd.add_route(0, "rspeaker", 1.0);
- i5000snd.add_route(1, "lspeaker", 1.0);
+ i5000snd.add_route(0, "speaker", 1.0, 1);
+ i5000snd.add_route(1, "speaker", 1.0, 0);
}
void tmmjprd_state::tmmjprd(machine_config &config)
diff --git a/src/mame/midw8080/mw8080bw_a.cpp b/src/mame/midw8080/mw8080bw_a.cpp
index 6c5bdac4f45..7cae8111fdf 100644
--- a/src/mame/midw8080/mw8080bw_a.cpp
+++ b/src/mame/midw8080/mw8080bw_a.cpp
@@ -775,14 +775,13 @@ void gunfight_audio_device::write(u8 data)
void gunfight_audio_device::device_add_mconfig(machine_config &config)
{
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
netlist_mame_sound_device &nl_sound =
NETLIST_SOUND(config, "sound_nl", 48000)
.set_source(NETLIST_NAME(gunfight));
- nl_sound.add_route(0, "lspeaker", 0.5);
- nl_sound.add_route(1, "rspeaker", 0.5);
+ nl_sound.add_route(0, "speaker", 0.5, 0);
+ nl_sound.add_route(1, "speaker", 0.5, 1);
NETLIST_LOGIC_INPUT(config, "sound_nl:left_shot", "I_LEFT_SHOT.IN", 0);
NETLIST_LOGIC_INPUT(config, "sound_nl:right_shot", "I_RIGHT_SHOT.IN", 0);
@@ -1060,12 +1059,11 @@ void boothill_audio_device::write(u8 data)
void boothill_audio_device::device_add_mconfig(machine_config &config)
{
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DISCRETE(config, m_discrete, boothill_discrete);
- m_discrete->add_route(0, "lspeaker", 1.0);
- m_discrete->add_route(1, "rspeaker", 1.0);
+ m_discrete->add_route(0, "speaker", 1.0, 0);
+ m_discrete->add_route(1, "speaker", 1.0, 1);
}
ioport_constructor boothill_audio_device::device_input_ports() const
@@ -1659,18 +1657,17 @@ void gmissile_audio_device::device_add_mconfig(machine_config &config)
"2", // explosion
nullptr };
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
SAMPLES(config, m_samples[0]);
m_samples[0]->set_channels(1);
m_samples[0]->set_samples_names(sample_names);
- m_samples[0]->add_route(ALL_OUTPUTS, "lspeaker", 1.0);
+ m_samples[0]->add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
SAMPLES(config, m_samples[1]);
m_samples[1]->set_channels(1);
m_samples[1]->set_samples_names(sample_names);
- m_samples[1]->add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ m_samples[1]->add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
}
void gmissile_audio_device::device_start()
@@ -1745,18 +1742,17 @@ void m4_audio_device::device_add_mconfig(machine_config &config)
"2", // explosion
nullptr };
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
SAMPLES(config, m_samples[0]);
m_samples[0]->set_channels(2);
m_samples[0]->set_samples_names(sample_names);
- m_samples[0]->add_route(ALL_OUTPUTS, "lspeaker", 1.0);
+ m_samples[0]->add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
SAMPLES(config, m_samples[1]);
m_samples[1]->set_channels(2);
m_samples[1]->set_samples_names(sample_names);
- m_samples[1]->add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ m_samples[1]->add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
}
void m4_audio_device::device_start()
@@ -2557,12 +2553,11 @@ void dogpatch_audio_device::write(u8 data)
void dogpatch_audio_device::device_add_mconfig(machine_config &config)
{
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DISCRETE(config, m_discrete, dogpatch_discrete);
- m_discrete->add_route(0, "lspeaker", 1.0);
- m_discrete->add_route(1, "rspeaker", 1.0);
+ m_discrete->add_route(0, "speaker", 1.0, 0);
+ m_discrete->add_route(1, "speaker", 1.0, 1);
}
void dogpatch_audio_device::device_start()
diff --git a/src/mame/midway/astrocde.cpp b/src/mame/midway/astrocde.cpp
index 2eb4fabfa81..551d14f46db 100644
--- a/src/mame/midway/astrocde.cpp
+++ b/src/mame/midway/astrocde.cpp
@@ -1257,15 +1257,14 @@ void astrocde_state::astrocade_mono_sound(machine_config &config)
void astrocde_state::astrocade_stereo_sound(machine_config &config)
{
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ASTROCADE_IO(config, m_astrocade_sound[0], ASTROCADE_CLOCK/4);
m_astrocade_sound[0]->si_cb().set(FUNC(astrocde_state::input_mux_r));
m_astrocade_sound[0]->so_cb<0>().set("watchdog", FUNC(watchdog_timer_device::reset_w));
- m_astrocade_sound[0]->add_route(ALL_OUTPUTS, "lspeaker", 0.35);
+ m_astrocade_sound[0]->add_route(ALL_OUTPUTS, "speaker", 0.35, 0);
- ASTROCADE_IO(config, m_astrocade_sound[1], ASTROCADE_CLOCK/4).add_route(ALL_OUTPUTS, "rspeaker", 0.35);
+ ASTROCADE_IO(config, m_astrocade_sound[1], ASTROCADE_CLOCK/4).add_route(ALL_OUTPUTS, "speaker", 0.35, 1);
WATCHDOG_TIMER(config, "watchdog").set_vblank_count("screen", 128); // MC14024B on CPU board at U18, CLK = VERTDR, Q7 used for RESET
}
@@ -1305,22 +1304,21 @@ void seawolf2_state::seawolf2(machine_config &config)
lamplatch1.bit_handler<5>().set_output("lamp7"); // left player explosion (hit)
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
SAMPLES(config, m_samples);
m_samples->set_channels(10); /* 5*2 channels */
m_samples->set_samples_names(seawolf_sample_names);
- m_samples->add_route(0, "lspeaker", 0.25);
- m_samples->add_route(1, "lspeaker", 0.25);
- m_samples->add_route(2, "lspeaker", 0.25);
- m_samples->add_route(3, "lspeaker", 0.25);
- m_samples->add_route(4, "lspeaker", 0.25);
- m_samples->add_route(5, "rspeaker", 0.25);
- m_samples->add_route(6, "rspeaker", 0.25);
- m_samples->add_route(7, "rspeaker", 0.25);
- m_samples->add_route(8, "rspeaker", 0.25);
- m_samples->add_route(9, "rspeaker", 0.25);
+ m_samples->add_route(0, "speaker", 0.25, 0);
+ m_samples->add_route(1, "speaker", 0.25, 0);
+ m_samples->add_route(2, "speaker", 0.25, 0);
+ m_samples->add_route(3, "speaker", 0.25, 0);
+ m_samples->add_route(4, "speaker", 0.25, 0);
+ m_samples->add_route(5, "speaker", 0.25, 1);
+ m_samples->add_route(6, "speaker", 0.25, 1);
+ m_samples->add_route(7, "speaker", 0.25, 1);
+ m_samples->add_route(8, "speaker", 0.25, 1);
+ m_samples->add_route(9, "speaker", 0.25, 1);
}
void ebases_state::ebases(machine_config &config)
diff --git a/src/mame/midway/atlantis.cpp b/src/mame/midway/atlantis.cpp
index 446da68446c..6f0770f5ce8 100644
--- a/src/mame/midway/atlantis.cpp
+++ b/src/mame/midway/atlantis.cpp
@@ -839,15 +839,14 @@ void atlantis_state::mwskins(machine_config &config)
m_screen->set_screen_update("zeus2", FUNC(zeus2_device::screen_update));
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DCS2_AUDIO_DENVER_2CH(config, m_dcs, 0);
m_dcs->set_maincpu_tag(m_maincpu);
m_dcs->set_dram_in_mb(4);
m_dcs->set_polling_offset(0xe33);
- m_dcs->add_route(0, "rspeaker", 1.0);
- m_dcs->add_route(1, "lspeaker", 1.0);
+ m_dcs->add_route(0, "speaker", 1.0, 1);
+ m_dcs->add_route(1, "speaker", 1.0, 0);
MIDWAY_IOASIC(config, m_ioasic, 0);
m_ioasic->in_port_cb<0>().set_ioport("DIPS");
diff --git a/src/mame/midway/gridlee.h b/src/mame/midway/gridlee.h
index 24c4c788d2a..cd6bc26c14c 100644
--- a/src/mame/midway/gridlee.h
+++ b/src/mame/midway/gridlee.h
@@ -101,7 +101,7 @@ protected:
virtual void device_start() 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;
public:
void gridlee_sound_w(offs_t offset, uint8_t data);
diff --git a/src/mame/midway/gridlee_a.cpp b/src/mame/midway/gridlee_a.cpp
index e9f38afd7d4..438e4f71153 100644
--- a/src/mame/midway/gridlee_a.cpp
+++ b/src/mame/midway/gridlee_a.cpp
@@ -53,16 +53,14 @@ void gridlee_sound_device::device_start()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void gridlee_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void gridlee_sound_device::sound_stream_update(sound_stream &stream)
{
- auto &buffer = outputs[0];
-
/* loop over samples */
- for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
/* tone channel */
m_tone_fraction += m_tone_step;
- buffer.put_int(sampindex, (m_tone_fraction & 0x0800000) ? m_tone_volume : 0, 32768 >> 6);
+ stream.put_int(0, sampindex, (m_tone_fraction & 0x0800000) ? m_tone_volume : 0, 32768 >> 6);
}
}
diff --git a/src/mame/midway/mcr.cpp b/src/mame/midway/mcr.cpp
index d32228a9d9b..4e5c457b474 100644
--- a/src/mame/midway/mcr.cpp
+++ b/src/mame/midway/mcr.cpp
@@ -1801,11 +1801,10 @@ void mcr_state::mcr_90009(machine_config &config)
PALETTE(config, m_palette).set_format(palette_device::xRBG_444, 32);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
MIDWAY_SSIO(config, m_ssio);
- m_ssio->add_route(0, "lspeaker", 1.0);
- m_ssio->add_route(1, "rspeaker", 1.0);
+ m_ssio->add_route(0, "speaker", 1.0, 0);
+ m_ssio->add_route(1, "speaker", 1.0, 1);
}
/* as above, but in a casino cabinet */
@@ -1843,8 +1842,8 @@ void mcr_state::mcr_90010_tt(machine_config &config)
SAMPLES(config, m_samples);
m_samples->set_channels(2);
m_samples->set_samples_names(twotiger_sample_names);
- m_samples->add_route(0, "lspeaker", 0.25);
- m_samples->add_route(1, "rspeaker", 0.25);
+ m_samples->add_route(0, "speaker", 0.25, 0);
+ m_samples->add_route(1, "speaker", 0.25, 1);
}
/* 91475 CPU board plus 90908/90913/91483 sound board plus cassette interface */
@@ -1859,8 +1858,8 @@ void mcr_state::mcr_91475(machine_config &config)
SAMPLES(config, m_samples);
m_samples->set_channels(1);
m_samples->set_samples_names(journey_sample_names);
- m_samples->add_route(ALL_OUTPUTS, "lspeaker", 0.25);
- m_samples->add_route(ALL_OUTPUTS, "rspeaker", 0.25);
+ m_samples->add_route(ALL_OUTPUTS, "speaker", 0.25, 0);
+ m_samples->add_route(ALL_OUTPUTS, "speaker", 0.25, 1);
}
@@ -1885,8 +1884,8 @@ void mcr_state::mcr_91490_snt(machine_config &config)
/* basic machine hardware */
BALLY_SQUAWK_N_TALK(config, m_squawk_n_talk);
- m_squawk_n_talk->add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- m_squawk_n_talk->add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ m_squawk_n_talk->add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ m_squawk_n_talk->add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
}
@@ -1926,8 +1925,8 @@ void mcr_state::mcr_91490_tcs(machine_config &config)
/* basic machine hardware */
MIDWAY_TURBO_CHEAP_SQUEAK(config, m_turbo_cheap_squeak);
- m_turbo_cheap_squeak->add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- m_turbo_cheap_squeak->add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ m_turbo_cheap_squeak->add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ m_turbo_cheap_squeak->add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
}
diff --git a/src/mame/midway/mcr3.cpp b/src/mame/midway/mcr3.cpp
index 4bc017a6ff5..f0a9cdc44c3 100644
--- a/src/mame/midway/mcr3.cpp
+++ b/src/mame/midway/mcr3.cpp
@@ -1099,8 +1099,7 @@ void mcr3_state::mcrmono(machine_config &config)
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
/* video hardware */
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
@@ -1127,8 +1126,8 @@ void mcr3_state::mono_tcs(machine_config &config)
/* basic machine hardware */
MIDWAY_TURBO_CHEAP_SQUEAK(config, m_turbo_cheap_squeak);
- m_turbo_cheap_squeak->add_route(ALL_OUTPUTS, "lspeaker", 0.8);
- m_turbo_cheap_squeak->add_route(ALL_OUTPUTS, "rspeaker", 0.8);
+ m_turbo_cheap_squeak->add_route(ALL_OUTPUTS, "speaker", 0.8, 0);
+ m_turbo_cheap_squeak->add_route(ALL_OUTPUTS, "speaker", 0.8, 1);
}
void maxrpm_state::maxrpm(machine_config &config)
@@ -1150,8 +1149,8 @@ void mcr3_state::mono_sg(machine_config &config)
/* basic machine hardware */
MIDWAY_SOUNDS_GOOD(config, m_sounds_good);
- m_sounds_good->add_route(ALL_OUTPUTS, "lspeaker", 0.75);
- m_sounds_good->add_route(ALL_OUTPUTS, "rspeaker", 0.75);
+ m_sounds_good->add_route(ALL_OUTPUTS, "speaker", 0.75, 0);
+ m_sounds_good->add_route(ALL_OUTPUTS, "speaker", 0.75, 1);
}
@@ -1165,8 +1164,8 @@ void mcr3_state::mcrscroll(machine_config &config)
/* basic machine hardware */
MIDWAY_SSIO(config, m_ssio);
- m_ssio->add_route(0, "lspeaker", 1.0);
- m_ssio->add_route(1, "rspeaker", 1.0);
+ m_ssio->add_route(0, "speaker", 1.0, 0);
+ m_ssio->add_route(1, "speaker", 1.0, 1);
m_maincpu->set_addrmap(AS_PROGRAM, &mcr3_state::spyhunt_map);
m_maincpu->set_addrmap(AS_IO, &mcr3_state::spyhunt_portmap);
@@ -1189,8 +1188,8 @@ void mcrsc_csd_state::mcrsc_csd(machine_config &config)
/* basic machine hardware */
MIDWAY_CHEAP_SQUEAK_DELUXE(config, m_cheap_squeak_deluxe);
- m_cheap_squeak_deluxe->add_route(ALL_OUTPUTS, "lspeaker", 0.8);
- m_cheap_squeak_deluxe->add_route(ALL_OUTPUTS, "rspeaker", 0.8);
+ m_cheap_squeak_deluxe->add_route(ALL_OUTPUTS, "speaker", 0.8, 0);
+ m_cheap_squeak_deluxe->add_route(ALL_OUTPUTS, "speaker", 0.8, 1);
CD4099(config, m_lamplatch); // U1 on Lamp Driver Board
m_lamplatch->q_out_cb<0>().set_output("lamp0");
diff --git a/src/mame/midway/midvunit.cpp b/src/mame/midway/midvunit.cpp
index e084befb51e..1c14a96d257 100644
--- a/src/mame/midway/midvunit.cpp
+++ b/src/mame/midway/midvunit.cpp
@@ -1231,15 +1231,14 @@ void midvplus_state::midvplus(machine_config &config)
m_midway_ioasic->set_yearoffs(94);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DCS2_AUDIO_2115(config, m_dcs, 0);
m_dcs->set_maincpu_tag(m_maincpu);
m_dcs->set_dram_in_mb(2);
m_dcs->set_polling_offset(0x3839);
- m_dcs->add_route(0, "rspeaker", 1.0);
- m_dcs->add_route(1, "lspeaker", 1.0);
+ m_dcs->add_route(0, "speaker", 1.0, 1);
+ m_dcs->add_route(1, "speaker", 1.0, 0);
}
diff --git a/src/mame/midway/midway.cpp b/src/mame/midway/midway.cpp
index c32a0ea9c36..1ef870501ef 100644
--- a/src/mame/midway/midway.cpp
+++ b/src/mame/midway/midway.cpp
@@ -45,7 +45,7 @@ DEFINE_DEVICE_TYPE(MIDWAY_TURBO_CHEAP_SQUEAK, midway_turbo_cheap_squeak_device,
midway_ssio_device::midway_ssio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, MIDWAY_SSIO, tag, owner, clock)
- , device_mixer_interface(mconfig, *this, 2)
+ , device_mixer_interface(mconfig, *this)
, m_cpu(*this, "cpu")
, m_ay0(*this, "ay0")
, m_ay1(*this, "ay1")
@@ -410,12 +410,12 @@ void midway_ssio_device::device_add_mconfig(machine_config &config)
AY8910(config, m_ay0, DERIVED_CLOCK(1, 2*4));
m_ay0->port_a_write_callback().set(FUNC(midway_ssio_device::porta0_w));
m_ay0->port_b_write_callback().set(FUNC(midway_ssio_device::portb0_w));
- m_ay0->add_route(ALL_OUTPUTS, *this, 0.33, AUTO_ALLOC_INPUT, 0);
+ m_ay0->add_route(ALL_OUTPUTS, *this, 0.33, 0);
AY8910(config, m_ay1, DERIVED_CLOCK(1, 2*4));
m_ay1->port_a_write_callback().set(FUNC(midway_ssio_device::porta1_w));
m_ay1->port_b_write_callback().set(FUNC(midway_ssio_device::portb1_w));
- m_ay1->add_route(ALL_OUTPUTS, *this, 0.33, AUTO_ALLOC_INPUT, 1);
+ m_ay1->add_route(ALL_OUTPUTS, *this, 0.33, 1);
}
diff --git a/src/mame/midway/midyunit.cpp b/src/mame/midway/midyunit.cpp
index fdc5988c1d2..7b762670f2f 100644
--- a/src/mame/midway/midyunit.cpp
+++ b/src/mame/midway/midyunit.cpp
@@ -1110,11 +1110,10 @@ void midzunit_state::zunit(machine_config &config)
screen.set_palette(m_palette);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
WILLIAMS_NARC_SOUND(config, m_narc_sound);
- m_narc_sound->add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- m_narc_sound->add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ m_narc_sound->add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ m_narc_sound->add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
}
diff --git a/src/mame/midway/midzeus.cpp b/src/mame/midway/midzeus.cpp
index a990ca74790..fa7e05ec7aa 100644
--- a/src/mame/midway/midzeus.cpp
+++ b/src/mame/midway/midzeus.cpp
@@ -1385,13 +1385,12 @@ void midzeus_state::midzeus(machine_config &config)
m_screen->set_palette(m_palette);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
dcs2_audio_2104_device &dcs(DCS2_AUDIO_2104(config, "dcs", 0));
dcs.set_maincpu_tag(m_maincpu);
- dcs.add_route(0, "rspeaker", 1.0);
- dcs.add_route(1, "lspeaker", 1.0);
+ dcs.add_route(0, "speaker", 1.0, 1);
+ dcs.add_route(1, "speaker", 1.0, 0);
MIDWAY_IOASIC(config, m_ioasic, 0);
m_ioasic->in_port_cb<0>().set_ioport("DIPS");
@@ -1437,13 +1436,12 @@ void midzeus2_state::midzeus2(machine_config &config)
m_zeus->irq_callback().set(FUNC(midzeus2_state::zeus_irq));
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
dcs2_audio_2104_device &dcs(DCS2_AUDIO_2104(config, "dcs", 0));
dcs.set_maincpu_tag(m_maincpu);
- dcs.add_route(0, "rspeaker", 1.0);
- dcs.add_route(1, "lspeaker", 1.0);
+ dcs.add_route(0, "speaker", 1.0, 1);
+ dcs.add_route(1, "speaker", 1.0, 0);
M48T35(config, m_m48t35, 0);
diff --git a/src/mame/midway/pinball2k.cpp b/src/mame/midway/pinball2k.cpp
index 4da67aac7a2..2f883a80747 100644
--- a/src/mame/midway/pinball2k.cpp
+++ b/src/mame/midway/pinball2k.cpp
@@ -653,8 +653,7 @@ void pinball2k_state::mediagx(machine_config &config)
PALETTE(config, m_palette).set_entries(256);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
diff --git a/src/mame/midway/seattle.cpp b/src/mame/midway/seattle.cpp
index 8d40b30c7fa..09aa71fb2d1 100644
--- a/src/mame/midway/seattle.cpp
+++ b/src/mame/midway/seattle.cpp
@@ -2119,15 +2119,14 @@ void seattle_state::wg3dh(machine_config &config)
{
phoenix(config);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DCS2_AUDIO_2115(config, m_dcs, 0);
m_dcs->set_maincpu_tag(m_maincpu);
m_dcs->set_dram_in_mb(2);
m_dcs->set_polling_offset(0x3839);
- m_dcs->add_route(0, "rspeaker", 1.0);
- m_dcs->add_route(1, "lspeaker", 1.0);
+ m_dcs->add_route(0, "speaker", 1.0, 1);
+ m_dcs->add_route(1, "speaker", 1.0, 0);
MIDWAY_IOASIC(config, m_ioasic, 0);
m_ioasic->in_port_cb<0>().set_ioport("DIPS");
@@ -2145,15 +2144,14 @@ void seattle_state::mace(machine_config &config)
{
seattle150(config);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DCS2_AUDIO_2115(config, m_dcs, 0);
m_dcs->set_maincpu_tag(m_maincpu);
m_dcs->set_dram_in_mb(2);
m_dcs->set_polling_offset(0x3839);
- m_dcs->add_route(0, "rspeaker", 1.0);
- m_dcs->add_route(1, "lspeaker", 1.0);
+ m_dcs->add_route(0, "speaker", 1.0, 1);
+ m_dcs->add_route(1, "speaker", 1.0, 0);
MIDWAY_IOASIC(config, m_ioasic, 0);
m_ioasic->in_port_cb<0>().set_ioport("DIPS");
@@ -2172,20 +2170,17 @@ void seattle_state::sfrush(machine_config &config)
flagstaff(config);
// 5 Channel output (4 Channel input connected to Quad Amp PCB)
- SPEAKER(config, "flspeaker").front_left();
- SPEAKER(config, "frspeaker").front_right();
- SPEAKER(config, "rlspeaker").headrest_left();
- SPEAKER(config, "rrspeaker").headrest_right();
+ SPEAKER(config, "speaker", 4).corners();
//SPEAKER(config, "subwoofer").seat(); Not implemented, Quad Amp PCB output;
ATARI_CAGE_SEATTLE(config, m_cage, 0);
m_cage->set_speedup(0x5236);
m_cage->irq_handler().set(m_ioasic, FUNC(midway_ioasic_device::cage_irq_handler));
// TODO: copied from atarigt.cpp; Same configurations as T-Mek?
- m_cage->add_route(0, "frspeaker", 1.0); // Foward Right
- m_cage->add_route(1, "rlspeaker", 1.0); // Back Left
- m_cage->add_route(2, "flspeaker", 1.0); // Foward Left
- m_cage->add_route(3, "rrspeaker", 1.0); // Back Right
+ m_cage->add_route(0, "speaker", 1.0, 1); // Forward Right
+ m_cage->add_route(1, "speaker", 1.0, 2); // Back Left
+ m_cage->add_route(2, "speaker", 1.0, 0); // Forward Left
+ m_cage->add_route(3, "speaker", 1.0, 3); // Back Right
MIDWAY_IOASIC(config, m_ioasic, 0);
m_ioasic->in_port_cb<0>().set_ioport("DIPS");
@@ -2205,20 +2200,17 @@ void seattle_state::sfrushrk(machine_config &config)
flagstaff(config);
// 5 Channel output (4 Channel input connected to Quad Amp PCB)
- SPEAKER(config, "flspeaker").front_left();
- SPEAKER(config, "frspeaker").front_right();
- SPEAKER(config, "rlspeaker").headrest_left();
- SPEAKER(config, "rrspeaker").headrest_right();
+ SPEAKER(config, "speaker", 4).corners();
//SPEAKER(config, "subwoofer").seat(); Not implemented, Quad Amp PCB output;
ATARI_CAGE_SEATTLE(config, m_cage, 0);
m_cage->set_speedup(0x5329);
m_cage->irq_handler().set(m_ioasic, FUNC(midway_ioasic_device::cage_irq_handler));
// TODO: copied from atarigt.cpp; Same configurations as T-Mek?
- m_cage->add_route(0, "frspeaker", 1.0); // Foward Right
- m_cage->add_route(1, "rlspeaker", 1.0); // Back Left
- m_cage->add_route(2, "flspeaker", 1.0); // Foward Left
- m_cage->add_route(3, "rrspeaker", 1.0); // Back Right
+ m_cage->add_route(0, "speaker", 1.0, 1); // Forward Right
+ m_cage->add_route(1, "speaker", 1.0, 2); // Back Left
+ m_cage->add_route(2, "speaker", 1.0, 0); // Forward Left
+ m_cage->add_route(3, "speaker", 1.0, 3); // Back Right
MIDWAY_IOASIC(config, m_ioasic, 0);
m_ioasic->in_port_cb<0>().set_ioport("DIPS");
@@ -2243,15 +2235,14 @@ void seattle_state::calspeed(machine_config &config)
{
seattle150_widget(config);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DCS2_AUDIO_2115(config, m_dcs, 0);
m_dcs->set_maincpu_tag(m_maincpu);
m_dcs->set_dram_in_mb(2);
m_dcs->set_polling_offset(0x39c0);
- m_dcs->add_route(0, "rspeaker", 1.0);
- m_dcs->add_route(1, "lspeaker", 1.0);
+ m_dcs->add_route(0, "speaker", 1.0, 1);
+ m_dcs->add_route(1, "speaker", 1.0, 0);
MIDWAY_IOASIC(config, m_ioasic, 0);
m_ioasic->in_port_cb<0>().set_ioport("DIPS");
@@ -2270,15 +2261,14 @@ void seattle_state::vaportrx(machine_config &config)
{
seattle200_widget(config);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DCS2_AUDIO_2115(config, m_dcs, 0);
m_dcs->set_maincpu_tag(m_maincpu);
m_dcs->set_dram_in_mb(2);
m_dcs->set_polling_offset(0x39c2);
- m_dcs->add_route(0, "rspeaker", 1.0);
- m_dcs->add_route(1, "lspeaker", 1.0);
+ m_dcs->add_route(0, "speaker", 1.0, 1);
+ m_dcs->add_route(1, "speaker", 1.0, 0);
MIDWAY_IOASIC(config, m_ioasic, 0);
m_ioasic->in_port_cb<0>().set_ioport("DIPS");
@@ -2296,15 +2286,14 @@ void seattle_state::biofreak(machine_config &config)
{
seattle150(config);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DCS2_AUDIO_2115(config, m_dcs, 0);
m_dcs->set_maincpu_tag(m_maincpu);
m_dcs->set_dram_in_mb(2);
m_dcs->set_polling_offset(0x3835);
- m_dcs->add_route(0, "rspeaker", 1.0);
- m_dcs->add_route(1, "lspeaker", 1.0);
+ m_dcs->add_route(0, "speaker", 1.0, 1);
+ m_dcs->add_route(1, "speaker", 1.0, 0);
MIDWAY_IOASIC(config, m_ioasic, 0);
m_ioasic->in_port_cb<0>().set_ioport("DIPS");
@@ -2322,15 +2311,14 @@ void seattle_state::blitz(machine_config &config)
{
seattle150(config);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DCS2_AUDIO_2115(config, m_dcs, 0);
m_dcs->set_maincpu_tag(m_maincpu);
m_dcs->set_dram_in_mb(2);
m_dcs->set_polling_offset(0x39c2);
- m_dcs->add_route(0, "rspeaker", 1.0);
- m_dcs->add_route(1, "lspeaker", 1.0);
+ m_dcs->add_route(0, "speaker", 1.0, 1);
+ m_dcs->add_route(1, "speaker", 1.0, 0);
MIDWAY_IOASIC(config, m_ioasic, 0);
m_ioasic->in_port_cb<0>().set_ioport("DIPS");
@@ -2349,15 +2337,14 @@ void seattle_state::blitz99(machine_config &config)
{
seattle150(config);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DCS2_AUDIO_2115(config, m_dcs, 0);
m_dcs->set_maincpu_tag(m_maincpu);
m_dcs->set_dram_in_mb(2);
m_dcs->set_polling_offset(0x0afb);
- m_dcs->add_route(0, "rspeaker", 1.0);
- m_dcs->add_route(1, "lspeaker", 1.0);
+ m_dcs->add_route(0, "speaker", 1.0, 1);
+ m_dcs->add_route(1, "speaker", 1.0, 0);
MIDWAY_IOASIC(config, m_ioasic, 0);
m_ioasic->in_port_cb<0>().set_ioport("DIPS");
@@ -2376,15 +2363,14 @@ void seattle_state::blitz2k(machine_config &config)
{
seattle150(config);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DCS2_AUDIO_2115(config, m_dcs, 0);
m_dcs->set_maincpu_tag(m_maincpu);
m_dcs->set_dram_in_mb(2);
m_dcs->set_polling_offset(0x0b5d);
- m_dcs->add_route(0, "rspeaker", 1.0);
- m_dcs->add_route(1, "lspeaker", 1.0);
+ m_dcs->add_route(0, "speaker", 1.0, 1);
+ m_dcs->add_route(1, "speaker", 1.0, 0);
MIDWAY_IOASIC(config, m_ioasic, 0);
m_ioasic->in_port_cb<0>().set_ioport("DIPS");
@@ -2404,15 +2390,14 @@ void seattle_state::carnevil(machine_config &config)
seattle150(config);
m_galileo->set_map(3, address_map_constructor(&seattle_state::carnevil_cs3_map, "carnevil_cs3_map", this), this);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DCS2_AUDIO_2115(config, m_dcs, 0);
m_dcs->set_maincpu_tag(m_maincpu);
m_dcs->set_dram_in_mb(2);
m_dcs->set_polling_offset(0x0af7);
- m_dcs->add_route(0, "rspeaker", 1.0);
- m_dcs->add_route(1, "lspeaker", 1.0);
+ m_dcs->add_route(0, "speaker", 1.0, 1);
+ m_dcs->add_route(1, "speaker", 1.0, 0);
MIDWAY_IOASIC(config, m_ioasic, 0);
m_ioasic->in_port_cb<0>().set_ioport("DIPS");
@@ -2430,15 +2415,14 @@ void seattle_state::hyprdriv(machine_config &config)
{
seattle200_widget(config);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DCS2_AUDIO_2115(config, m_dcs, 0);
m_dcs->set_maincpu_tag(m_maincpu);
m_dcs->set_dram_in_mb(2);
m_dcs->set_polling_offset(0x0af7);
- m_dcs->add_route(0, "rspeaker", 1.0);
- m_dcs->add_route(1, "lspeaker", 1.0);
+ m_dcs->add_route(0, "speaker", 1.0, 1);
+ m_dcs->add_route(1, "speaker", 1.0, 0);
MIDWAY_IOASIC(config, m_ioasic, 0);
m_ioasic->in_port_cb<0>().set_ioport("DIPS");
diff --git a/src/mame/midway/vegas.cpp b/src/mame/midway/vegas.cpp
index 0870ed2cdbc..603f8e4b946 100644
--- a/src/mame/midway/vegas.cpp
+++ b/src/mame/midway/vegas.cpp
@@ -2021,15 +2021,14 @@ void vegas_state::gauntleg(machine_config &config)
// Firmware frequency detection seems to have a bug, console reports 220MHz for a 200MHz cpu and 260MHz for a 250MHz cpu
vegas250(config);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DCS2_AUDIO_2104(config, m_dcs, 0);
m_dcs->set_maincpu_tag(m_maincpu);
m_dcs->set_dram_in_mb(4);
m_dcs->set_polling_offset(0x0b5d);
- m_dcs->add_route(0, "rspeaker", 1.0);
- m_dcs->add_route(1, "lspeaker", 1.0);
+ m_dcs->add_route(0, "speaker", 1.0, 1);
+ m_dcs->add_route(1, "speaker", 1.0, 0);
MIDWAY_IOASIC(config, m_ioasic, 0);
m_ioasic->in_port_cb<0>().set_ioport("DIPS");
@@ -2049,15 +2048,14 @@ void vegas_state::gauntdl(machine_config &config)
// Needs 250MHz MIPS or screen tearing occurs (See MT8064)
vegas250(config);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DCS2_AUDIO_2104(config, m_dcs, 0);
m_dcs->set_maincpu_tag(m_maincpu);
m_dcs->set_dram_in_mb(4);
m_dcs->set_polling_offset(0x0b5d);
- m_dcs->add_route(0, "rspeaker", 1.0);
- m_dcs->add_route(1, "lspeaker", 1.0);
+ m_dcs->add_route(0, "speaker", 1.0, 1);
+ m_dcs->add_route(1, "speaker", 1.0, 0);
MIDWAY_IOASIC(config, m_ioasic, 0);
m_ioasic->in_port_cb<0>().set_ioport("DIPS");
@@ -2076,15 +2074,14 @@ void vegas_state::warfa(machine_config &config)
{
vegas250(config);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DCS2_AUDIO_2104(config, m_dcs, 0);
m_dcs->set_maincpu_tag(m_maincpu);
m_dcs->set_dram_in_mb(4);
m_dcs->set_polling_offset(0x0b5d);
- m_dcs->add_route(0, "rspeaker", 1.0);
- m_dcs->add_route(1, "lspeaker", 1.0);
+ m_dcs->add_route(0, "speaker", 1.0, 1);
+ m_dcs->add_route(1, "speaker", 1.0, 0);
MIDWAY_IOASIC(config, m_ioasic, 0);
m_ioasic->in_port_cb<0>().set_ioport("DIPS");
@@ -2103,15 +2100,14 @@ void vegas_state::tenthdeg(machine_config &config)
{
vegas(config);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DCS2_AUDIO_2115(config, m_dcs, 0);
m_dcs->set_maincpu_tag(m_maincpu);
m_dcs->set_dram_in_mb(4);
m_dcs->set_polling_offset(0x0afb);
- m_dcs->add_route(0, "rspeaker", 1.0);
- m_dcs->add_route(1, "lspeaker", 1.0);
+ m_dcs->add_route(0, "speaker", 1.0, 1);
+ m_dcs->add_route(1, "speaker", 1.0, 0);
MIDWAY_IOASIC(config, m_ioasic, 0);
m_ioasic->in_port_cb<0>().set_ioport("DIPS");
@@ -2130,15 +2126,14 @@ void vegas_state::roadburn(machine_config &config)
{
vegas32m(config);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DCS2_AUDIO_DSIO(config, m_dcs, 0);
m_dcs->set_maincpu_tag(m_maincpu);
m_dcs->set_dram_in_mb(4);
m_dcs->set_polling_offset(0x0ddd);
- m_dcs->add_route(0, "rspeaker", 1.0);
- m_dcs->add_route(1, "lspeaker", 1.0);
+ m_dcs->add_route(0, "speaker", 1.0, 1);
+ m_dcs->add_route(1, "speaker", 1.0, 0);
MIDWAY_IOASIC(config, m_ioasic, 0);
m_ioasic->in_port_cb<0>().set_ioport("DIPS");
@@ -2157,15 +2152,14 @@ void vegas_state::nbashowt(machine_config &config)
{
vegasban(config);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DCS2_AUDIO_2104(config, m_dcs, 0);
m_dcs->set_maincpu_tag(m_maincpu);
m_dcs->set_dram_in_mb(4);
m_dcs->set_polling_offset(0x0b5d);
- m_dcs->add_route(0, "rspeaker", 1.0);
- m_dcs->add_route(1, "lspeaker", 1.0);
+ m_dcs->add_route(0, "speaker", 1.0, 1);
+ m_dcs->add_route(1, "speaker", 1.0, 0);
MIDWAY_IOASIC(config, m_ioasic, 0);
m_ioasic->in_port_cb<0>().set_ioport("DIPS");
@@ -2186,15 +2180,14 @@ void vegas_state::nbanfl(machine_config &config)
{
vegasban(config);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DCS2_AUDIO_2104(config, m_dcs, 0);
m_dcs->set_maincpu_tag(m_maincpu);
m_dcs->set_dram_in_mb(4);
m_dcs->set_polling_offset(0x0b5d);
- m_dcs->add_route(0, "rspeaker", 1.0);
- m_dcs->add_route(1, "lspeaker", 1.0);
+ m_dcs->add_route(0, "speaker", 1.0, 1);
+ m_dcs->add_route(1, "speaker", 1.0, 0);
MIDWAY_IOASIC(config, m_ioasic, 0);
m_ioasic->in_port_cb<0>().set_ioport("DIPS");
@@ -2220,15 +2213,14 @@ void vegas_state::nbagold(machine_config &config)
m_maincpu->set_system_clock(vegas_state::SYSTEM_CLOCK);
m_nile->set_sdram_size(0, 0x00800000);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DCS2_AUDIO_2104(config, m_dcs, 0);
m_dcs->set_maincpu_tag(m_maincpu);
m_dcs->set_dram_in_mb(4);
m_dcs->set_polling_offset(0x0b5d);
- m_dcs->add_route(0, "rspeaker", 1.0);
- m_dcs->add_route(1, "lspeaker", 1.0);
+ m_dcs->add_route(0, "speaker", 1.0, 1);
+ m_dcs->add_route(1, "speaker", 1.0, 0);
MIDWAY_IOASIC(config, m_ioasic, 0);
m_ioasic->in_port_cb<0>().set_ioport("DIPS");
@@ -2248,21 +2240,17 @@ void vegas_state::sf2049(machine_config &config)
{
denver(config);
- SPEAKER(config, "flspeaker").front_left();
- SPEAKER(config, "frspeaker").front_right();
- SPEAKER(config, "rlspeaker").headrest_left();
- SPEAKER(config, "rrspeaker").headrest_right();
- SPEAKER(config, "subwoofer").backrest();
+ SPEAKER(config, "speaker", 5).front().headrest_left(2).headrest_right(3).backrest(4);
DCS2_AUDIO_DENVER_5CH(config, m_dcs, 0);
m_dcs->set_maincpu_tag(m_maincpu);
m_dcs->set_dram_in_mb(8);
m_dcs->set_polling_offset(0x872);
- m_dcs->add_route(0, "flspeaker", 1.0);
- m_dcs->add_route(1, "frspeaker", 1.0);
- m_dcs->add_route(2, "rlspeaker", 1.0);
- m_dcs->add_route(3, "rrspeaker", 1.0);
- m_dcs->add_route(4, "subwoofer", 1.0);
+ m_dcs->add_route(0, "speaker", 1.0, 0);
+ m_dcs->add_route(1, "speaker", 1.0, 1);
+ m_dcs->add_route(2, "speaker", 1.0, 2);
+ m_dcs->add_route(3, "speaker", 1.0, 3);
+ m_dcs->add_route(4, "speaker", 1.0, 4);
MIDWAY_IOASIC(config, m_ioasic, 0);
m_ioasic->in_port_cb<0>().set_ioport("DIPS");
@@ -2282,21 +2270,17 @@ void vegas_state::sf2049se(machine_config &config)
{
denver(config);
- SPEAKER(config, "flspeaker").front_left();
- SPEAKER(config, "frspeaker").front_right();
- SPEAKER(config, "rlspeaker").headrest_left();
- SPEAKER(config, "rrspeaker").headrest_right();
- SPEAKER(config, "subwoofer").backrest();
+ SPEAKER(config, "speaker", 5).front().headrest_left(2).headrest_right(3).backrest(4);
DCS2_AUDIO_DENVER_5CH(config, m_dcs, 0);
m_dcs->set_maincpu_tag(m_maincpu);
m_dcs->set_dram_in_mb(8);
m_dcs->set_polling_offset(0x872);
- m_dcs->add_route(0, "flspeaker", 1.0);
- m_dcs->add_route(1, "frspeaker", 1.0);
- m_dcs->add_route(2, "rlspeaker", 1.0);
- m_dcs->add_route(3, "rrspeaker", 1.0);
- m_dcs->add_route(4, "subwoofer", 1.0);
+ m_dcs->add_route(0, "speaker", 1.0, 0);
+ m_dcs->add_route(1, "speaker", 1.0, 1);
+ m_dcs->add_route(2, "speaker", 1.0, 2);
+ m_dcs->add_route(3, "speaker", 1.0, 3);
+ m_dcs->add_route(4, "speaker", 1.0, 4);
MIDWAY_IOASIC(config, m_ioasic, 0);
m_ioasic->in_port_cb<0>().set_ioport("DIPS");
@@ -2316,21 +2300,17 @@ void vegas_state::sf2049te(machine_config &config)
{
denver(config);
- SPEAKER(config, "flspeaker").front_left();
- SPEAKER(config, "frspeaker").front_right();
- SPEAKER(config, "rlspeaker").headrest_left();
- SPEAKER(config, "rrspeaker").headrest_right();
- SPEAKER(config, "subwoofer").backrest();
+ SPEAKER(config, "speaker", 5).front().headrest_left(2).headrest_right(3).backrest(4);
DCS2_AUDIO_DENVER_5CH(config, m_dcs, 0);
m_dcs->set_maincpu_tag(m_maincpu);
m_dcs->set_dram_in_mb(8);
m_dcs->set_polling_offset(0x872);
- m_dcs->add_route(0, "flspeaker", 1.0);
- m_dcs->add_route(1, "frspeaker", 1.0);
- m_dcs->add_route(2, "rlspeaker", 1.0);
- m_dcs->add_route(3, "rrspeaker", 1.0);
- m_dcs->add_route(4, "subwoofer", 1.0);
+ m_dcs->add_route(0, "speaker", 1.0, 0);
+ m_dcs->add_route(1, "speaker", 1.0, 1);
+ m_dcs->add_route(2, "speaker", 1.0, 2);
+ m_dcs->add_route(3, "speaker", 1.0, 3);
+ m_dcs->add_route(4, "speaker", 1.0, 4);
MIDWAY_IOASIC(config, m_ioasic, 0);
m_ioasic->in_port_cb<0>().set_ioport("DIPS");
@@ -2350,15 +2330,14 @@ void vegas_state::cartfury(machine_config &config)
{
vegasv3(config);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DCS2_AUDIO_2104(config, m_dcs, 0);
m_dcs->set_maincpu_tag(m_maincpu);
m_dcs->set_dram_in_mb(4);
m_dcs->set_polling_offset(0x0b5d);
- m_dcs->add_route(0, "rspeaker", 1.0);
- m_dcs->add_route(1, "lspeaker", 1.0);
+ m_dcs->add_route(0, "speaker", 1.0, 1);
+ m_dcs->add_route(1, "speaker", 1.0, 0);
MIDWAY_IOASIC(config, m_ioasic, 0);
m_ioasic->in_port_cb<0>().set_ioport("DIPS");
diff --git a/src/mame/midway/williams.cpp b/src/mame/midway/williams.cpp
index 33cb34d7fc0..df483f85db5 100644
--- a/src/mame/midway/williams.cpp
+++ b/src/mame/midway/williams.cpp
@@ -1704,7 +1704,7 @@ void williams_state::sinistar_cockpit(machine_config &config)
// additional sound hardware
SPEAKER(config, "rspeaker").rear_center();
- MC1408(config, "rdac").add_route(ALL_OUTPUTS, "rspeaker", 0.25); // unknown DAC
+ MC1408(config, "rdac").add_route(ALL_OUTPUTS, "rspeaker", 0.25, 1); // unknown DAC
// pia
INPUT_MERGER_ANY_HIGH(config, "soundirq_b").output_handler().set_inputline("soundcpu_b", M6808_IRQ_LINE);
@@ -1814,10 +1814,9 @@ void blaster_state::blaster(machine_config &config)
config.device_remove("speaker");
config.device_remove("dac");
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
- MC1408(config, "ldac", 0).add_route(ALL_OUTPUTS, "lspeaker", 0.25); // unknown DAC
- MC1408(config, "rdac", 0).add_route(ALL_OUTPUTS, "rspeaker", 0.25); // unknown DAC
+ SPEAKER(config, "speaker", 2).front();
+ MC1408(config, "ldac", 0).add_route(ALL_OUTPUTS, "speaker", 0.25, 0); // unknown DAC
+ MC1408(config, "rdac", 0).add_route(ALL_OUTPUTS, "speaker", 0.25, 1); // unknown DAC
}
diff --git a/src/mame/miltonbradley/milton6805.cpp b/src/mame/miltonbradley/milton6805.cpp
index e7c5f21dd56..4d590550329 100644
--- a/src/mame/miltonbradley/milton6805.cpp
+++ b/src/mame/miltonbradley/milton6805.cpp
@@ -86,11 +86,12 @@ public:
protected:
virtual void device_start() 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;
private:
sound_stream *m_stream = nullptr;
output_finder<> m_led_out;
+ bool m_dummy_save = false; // needed for save-state support
};
DEFINE_DEVICE_TYPE(MILTON_LED_FILTER, milton_filter_device, "milton_led_filter", "Milton LED Filter")
@@ -106,22 +107,23 @@ void milton_filter_device::device_start()
{
m_stream = stream_alloc(1, 1, machine().sample_rate());
m_led_out.resolve();
+ save_item(NAME(m_dummy_save));
}
-void milton_filter_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void milton_filter_device::sound_stream_update(sound_stream &stream)
{
- stream_buffer::sample_t level = 0;
+ sound_stream::sample_t level = 0;
- for (int i = 0; i < outputs[0].samples(); i++)
- level += fabsf(inputs[0].get(i));
+ for (int i = 0; i < stream.samples(); i++)
+ level += fabsf(stream.get(0, i));
- outputs[0] = inputs[0];
+ stream.copy(0, 0);
- if (outputs[0].samples() > 0)
- level /= outputs[0].samples();
+ if (stream.samples() > 0)
+ level /= stream.samples();
// 2 leds connected to the audio circuit
- const stream_buffer::sample_t threshold = 1500.0 / 32768.0;
+ const sound_stream::sample_t threshold = 1500.0 / 32768.0;
m_led_out = (level > threshold) ? 1 : 0;
}
diff --git a/src/mame/misc/amspdwy.cpp b/src/mame/misc/amspdwy.cpp
index 06e841ef09e..b1ea7cac4f9 100644
--- a/src/mame/misc/amspdwy.cpp
+++ b/src/mame/misc/amspdwy.cpp
@@ -465,16 +465,15 @@ void amspdwy_state::amspdwy(machine_config &config)
PALETTE(config, m_palette).set_format(palette_device::BGR_233_inverted, 32);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
YM2151(config, m_ym2151, 3000000);
m_ym2151->irq_handler().set_inputline(m_audiocpu, 0);
- m_ym2151->add_route(0, "lspeaker", 1.0);
- m_ym2151->add_route(1, "rspeaker", 1.0);
+ m_ym2151->add_route(0, "speaker", 1.0, 0);
+ m_ym2151->add_route(1, "speaker", 1.0, 1);
}
diff --git a/src/mame/misc/amuzy.cpp b/src/mame/misc/amuzy.cpp
index 5c9607d5367..f5cdaedfa1e 100644
--- a/src/mame/misc/amuzy.cpp
+++ b/src/mame/misc/amuzy.cpp
@@ -300,12 +300,11 @@ void amuzy_state::amuzy(machine_config &config)
TIMER(config, "scantimer").configure_scanline(FUNC(amuzy_state::scanline), m_screen, 0, 1);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
OKIM9810(config, m_oki, XTAL(4'096'000));
- m_oki->add_route(0, "lspeaker", 1.00);
- m_oki->add_route(1, "rspeaker", 1.00);
+ m_oki->add_route(0, "speaker", 1.00, 0);
+ m_oki->add_route(1, "speaker", 1.00, 1);
}
static INPUT_PORTS_START( amuzy )
diff --git a/src/mame/misc/belatra.cpp b/src/mame/misc/belatra.cpp
index 5495b58e449..e96280ec7da 100644
--- a/src/mame/misc/belatra.cpp
+++ b/src/mame/misc/belatra.cpp
@@ -147,8 +147,7 @@ void belatra_state::belatra(machine_config &config)
// AT90S2313(config, "mcu", xxxx); // TODO: AVR 8-bit core, only the fairyl2 set has a dump
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
// unknown sound
}
diff --git a/src/mame/misc/brglitz.cpp b/src/mame/misc/brglitz.cpp
index 16a0bc0ab90..c858923593e 100644
--- a/src/mame/misc/brglitz.cpp
+++ b/src/mame/misc/brglitz.cpp
@@ -142,16 +142,15 @@ void brglitz_state::brglitz(machine_config &config)
PIC16C55(config, m_soundcpu, 8_MHz_XTAL); // Divider unknown, ZTA 8.00MT resonator
PIC16C55(config, m_soundcpu_2, 8_MHz_XTAL); // Divider unknown, ZTA 8.00MT resonator
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
msm6585_device &oki1(MSM6585(config, "oki1", 640_kHz_XTAL)); // CSB 640 P resonator
- oki1.add_route(ALL_OUTPUTS, "lspeaker", 0.45); // Guess
- oki1.add_route(ALL_OUTPUTS, "rspeaker", 0.45); // Guess
+ oki1.add_route(ALL_OUTPUTS, "speaker", 0.45, 0); // Guess
+ oki1.add_route(ALL_OUTPUTS, "speaker", 0.45, 1); // Guess
msm6585_device &oki2(MSM6585(config, "oki2", 640_kHz_XTAL)); // CSB 640 P resonator
- oki2.add_route(ALL_OUTPUTS, "lspeaker", 0.45); // Guess
- oki2.add_route(ALL_OUTPUTS, "rspeaker", 0.45); // Guess
+ oki2.add_route(ALL_OUTPUTS, "speaker", 0.45, 0); // Guess
+ oki2.add_route(ALL_OUTPUTS, "speaker", 0.45, 1); // Guess
}
ROM_START(brglitz)
diff --git a/src/mame/misc/calomega.cpp b/src/mame/misc/calomega.cpp
index bd33d6fbe8e..84279e4061f 100644
--- a/src/mame/misc/calomega.cpp
+++ b/src/mame/misc/calomega.cpp
@@ -4903,6 +4903,27 @@ ROM_START( comg079 ) // Cal Omega v7.9 (Arcade Poker)
ROM_LOAD( "clrprom_7.9.u28", 0x0000, 0x0100, CRC(a26a8fae) SHA1(d570fe9443a0912bd34b81ac4c3e4c5f8901f523) )
ROM_END
+ROM_START( comg079b )
+ ROM_REGION( 0x10000, "maincpu", 0 )
+ ROM_LOAD( "du_6502_u2.u2", 0x00000, 0x08000, CRC(fb457628) SHA1(a826e989e4d1eeb30d352202d69b22a1c8b12292) )
+
+ ROM_REGION( 0x1800, "gfx1", 0 )
+ ROM_LOAD( "du_6502_u21.u21", 0x0000, 0x0800, CRC(86825527) SHA1(278d58d92962be783462c4b18c3b9c72b8754531) )
+ ROM_IGNORE( 0x7800)
+
+ ROM_REGION( 0x1800, "gfx2", 0 )
+ ROM_LOAD( "du_6502_u23.u23", 0x0000, 0x0800, CRC(ccfe2548) SHA1(5d4cab918a241e4f39df4255f403f558cee3c379) )
+ ROM_IGNORE( 0x7800)
+ ROM_LOAD( "du_6502_u22.u22", 0x0800, 0x0800, CRC(5a96ce64) SHA1(fe18cea01d6bef5b4efcbf930469a3f1104d06d2) )
+ ROM_IGNORE( 0x7800)
+ // From COMG079 Romset
+ ROM_LOAD( "pkcga.u68", 0x1000, 0x0800, CRC(6e3e9b1d) SHA1(14eb8d14ce16719a6ad7d13db01e47c8f05955f0) )
+
+ ROM_REGION( 0x100, "proms", 0 )
+ ROM_LOAD( "82s129.u28", 0x0000, 0x0100, CRC(a26a8fae) SHA1(d570fe9443a0912bd34b81ac4c3e4c5f8901f523) )
+ROM_END
+
+
ROM_START( comg080 ) // Cal Omega v8.0 (Arcade Black Jack)
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_FILL( 0x1800, 0x0800, 0xff ) // empty socket
@@ -6216,6 +6237,7 @@ void calomega_state::init_any()
GAME( 1981, comg074, 0, sys903, comg074, calomega_state, empty_init, ROT0, "Cal Omega Inc.", "Cal Omega - Game 7.4 (Gaming Poker, W.Export)", MACHINE_SUPPORTS_SAVE )
GAME( 1981, comg076, 0, sys903, comg076, calomega_state, empty_init, ROT0, "Cal Omega Inc.", "Cal Omega - Game 7.6 (Arcade Poker)", MACHINE_SUPPORTS_SAVE )
GAME( 1981, comg079, 0, sys903, comg076, calomega_state, init_comg079, ROT0, "Cal Omega Inc.", "Cal Omega - Game 7.9 (Arcade Poker)", MACHINE_SUPPORTS_SAVE ) // bad dump
+GAME( 1981, comg079b, comg079, sys903, comg076, calomega_state, empty_init, ROT0, "Cal Omega Inc.", "Cal Omega - Game 7.9b (Arcade Poker, bootleg?)", MACHINE_SUPPORTS_SAVE )
GAME( 1981, comg080, 0, sys903, arcadebj, calomega_state, init_comg080, ROT0, "Cal Omega Inc.", "Cal Omega - Game 8.0 (Arcade Black Jack)", MACHINE_SUPPORTS_SAVE ) // bad dump
GAMEL( 1981, comg094, 0, sys903kb, keno_903, calomega_state, empty_init, ROT0, "Cal Omega Inc.", "Cal Omega - Game 9.4 (Keno)", MACHINE_SUPPORTS_SAVE, layout_kenokb )
GAME( 1982, comg107, 0, sys903, biggame, calomega_state, empty_init, ROT0, "Cal Omega Inc.", "Cal Omega - Game 10.7c (Big Game)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/misc/cardline.cpp b/src/mame/misc/cardline.cpp
index 347d5b7b34d..0e53214fd66 100644
--- a/src/mame/misc/cardline.cpp
+++ b/src/mame/misc/cardline.cpp
@@ -352,12 +352,11 @@ void cardline_state::cardline(machine_config &config)
config.set_default_layout(layout_cardline);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
okim6295_device &oki(OKIM6295(config, "oki", 1056000, okim6295_device::PIN7_HIGH)); // clock frequency & pin 7 not verified
- oki.add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- oki.add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
}
/***************************************************************************
diff --git a/src/mame/misc/coinmvga.cpp b/src/mame/misc/coinmvga.cpp
index 48fa2fcb823..d8685672ebc 100644
--- a/src/mame/misc/coinmvga.cpp
+++ b/src/mame/misc/coinmvga.cpp
@@ -686,13 +686,12 @@ void coinmvga_state::coinmvga(machine_config &config)
ramdac2.set_addrmap(0, &coinmvga_state::ramdac2_map);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ymz280b_device &ymz(YMZ280B(config, "ymz", SND_CLOCK));
ymz.irq_handler().set_inputline("maincpu", 2);
- ymz.add_route(0, "lspeaker", 1.0);
- ymz.add_route(1, "rspeaker", 1.0);
+ ymz.add_route(0, "speaker", 1.0, 0);
+ ymz.add_route(1, "speaker", 1.0, 1);
}
diff --git a/src/mame/misc/cowtipping.cpp b/src/mame/misc/cowtipping.cpp
index 73bb30b3861..0002f7d41be 100644
--- a/src/mame/misc/cowtipping.cpp
+++ b/src/mame/misc/cowtipping.cpp
@@ -99,8 +99,7 @@ void cowtipping_state::cowtipping(machine_config &config)
PALETTE(config, "palette").set_entries(65536); // wrong
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
diff --git a/src/mame/misc/cubeqst.cpp b/src/mame/misc/cubeqst.cpp
index 79397b29611..c4b82fcc2c1 100644
--- a/src/mame/misc/cubeqst.cpp
+++ b/src/mame/misc/cubeqst.cpp
@@ -556,19 +556,18 @@ void cubeqst_state::cubeqst(machine_config &config)
m_screen->set_screen_update("laserdisc", FUNC(laserdisc_device::screen_update));
m_screen->screen_vblank().set(FUNC(cubeqst_state::vblank_irq));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- m_laserdisc->add_route(0, "lspeaker", 1.0);
- m_laserdisc->add_route(1, "rspeaker", 1.0);
+ m_laserdisc->add_route(0, "speaker", 1.0, 0);
+ m_laserdisc->add_route(1, "speaker", 1.0, 1);
for (int i = 0; i < 8; i++)
{
// AD7521JN.2D (59) + CD4051BE.3D (24) + 1500pF.C6-C13 (34) + TL074CN.3B/3C (53) + 10K.RN3/4 (30)
- AD7521(config, m_ldacs[i]).add_route(0, "lspeaker", 0.125);
+ AD7521(config, m_ldacs[i]).add_route(0, "speaker", 0.125, 0);
// AD7521JN.2D (59) + CD4051BE.1D (24) + 1500pF.C15-C22 (34) + TL074CN.1B/1C (53) + 10K.RN1/2 (30)
- AD7521(config, m_rdacs[i]).add_route(0, "rspeaker", 0.125);
+ AD7521(config, m_rdacs[i]).add_route(0, "speaker", 0.125, 1);
}
}
diff --git a/src/mame/misc/cupidon.cpp b/src/mame/misc/cupidon.cpp
index 9e5a2114780..0dc6ed242f6 100644
--- a/src/mame/misc/cupidon.cpp
+++ b/src/mame/misc/cupidon.cpp
@@ -114,8 +114,7 @@ void cupidon_state::cupidon(machine_config &config)
PALETTE(config, "palette").set_entries(0x10000);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
/* unknown sound, probably DAC driven using 68340 DMA */
}
diff --git a/src/mame/misc/cybertnk.cpp b/src/mame/misc/cybertnk.cpp
index b411548fbbd..a18ce84fe11 100644
--- a/src/mame/misc/cybertnk.cpp
+++ b/src/mame/misc/cybertnk.cpp
@@ -860,16 +860,15 @@ void cybertnk_state::cybertnk(machine_config &config)
PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x4000);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, 0, HOLD_LINE);
// Split output per chip
- Y8950(config, "ym1", XTAL(3'579'545)).add_route(ALL_OUTPUTS, "lspeaker", 1.0);
+ Y8950(config, "ym1", XTAL(3'579'545)).add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
- Y8950(config, "ym2", XTAL(3'579'545)).add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ Y8950(config, "ym2", XTAL(3'579'545)).add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
}
/***************************************************************************
diff --git a/src/mame/misc/dcheese.cpp b/src/mame/misc/dcheese.cpp
index 454ad5d1bde..3784b4c19b7 100644
--- a/src/mame/misc/dcheese.cpp
+++ b/src/mame/misc/dcheese.cpp
@@ -404,15 +404,14 @@ void dcheese_state::dcheese(machine_config &config)
PALETTE(config, "palette", FUNC(dcheese_state::dcheese_palette), 65536);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, 0);
BSMT2000(config, m_bsmt, SOUND_OSC);
- m_bsmt->add_route(0, "lspeaker", 1.2);
- m_bsmt->add_route(1, "rspeaker", 1.2);
+ m_bsmt->add_route(0, "speaker", 1.2, 0);
+ m_bsmt->add_route(1, "speaker", 1.2, 1);
}
diff --git a/src/mame/misc/dgpix.cpp b/src/mame/misc/dgpix.cpp
index 8caaf4c18e6..cb783a78bbf 100644
--- a/src/mame/misc/dgpix.cpp
+++ b/src/mame/misc/dgpix.cpp
@@ -508,12 +508,11 @@ void dgpix_state::dgpix_base(machine_config &config)
PALETTE(config, "palette", palette_device::BGR_555);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
KS0164(config, m_sound, 16.9344_MHz_XTAL);
- m_sound->add_route(0, "lspeaker", 1.0);
- m_sound->add_route(1, "rspeaker", 1.0);
+ m_sound->add_route(0, "speaker", 1.0, 0);
+ m_sound->add_route(1, "speaker", 1.0, 1);
INTEL_28F320J5(config, m_flash[6]);
INTEL_28F320J5(config, m_flash[7]);
diff --git a/src/mame/misc/discoboy.cpp b/src/mame/misc/discoboy.cpp
index 2d232eb744b..e233ba2bcee 100644
--- a/src/mame/misc/discoboy.cpp
+++ b/src/mame/misc/discoboy.cpp
@@ -450,14 +450,13 @@ void discoboy_state::discoboy(machine_config &config)
PALETTE(config, m_palette).set_entries(0x1000);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, "soundlatch").data_pending_callback().set_inputline(m_audiocpu, 0);
ym3812_device &ymsnd(YM3812(config, "ymsnd", XTAL(10'000'000) / 4)); // 2.5 MHz?
- ymsnd.add_route(ALL_OUTPUTS, "lspeaker", 0.6);
- ymsnd.add_route(ALL_OUTPUTS, "rspeaker", 0.6);
+ ymsnd.add_route(ALL_OUTPUTS, "speaker", 0.6, 0);
+ ymsnd.add_route(ALL_OUTPUTS, "speaker", 0.6, 1);
LS157(config, m_adpcm_select, 0);
m_adpcm_select->out_callback().set("msm", FUNC(msm5205_device::data_w));
@@ -465,8 +464,8 @@ void discoboy_state::discoboy(machine_config &config)
MSM5205(config, m_msm, XTAL(400'000));
m_msm->vck_legacy_callback().set(FUNC(discoboy_state::adpcm_int)); // interrupt function
m_msm->set_prescaler_selector(msm5205_device::S96_4B); // 4KHz, 4 Bits
- m_msm->add_route(ALL_OUTPUTS, "lspeaker", 0.80);
- m_msm->add_route(ALL_OUTPUTS, "rspeaker", 0.80);
+ m_msm->add_route(ALL_OUTPUTS, "speaker", 0.80, 0);
+ m_msm->add_route(ALL_OUTPUTS, "speaker", 0.80, 1);
}
diff --git a/src/mame/misc/esh.cpp b/src/mame/misc/esh.cpp
index f88e2ec6ee9..0ec36b83bfe 100644
--- a/src/mame/misc/esh.cpp
+++ b/src/mame/misc/esh.cpp
@@ -356,8 +356,8 @@ void esh_state::esh(machine_config &config)
PIONEER_LDV1000(config, m_laserdisc, 0);
m_laserdisc->command_strobe_callback().set(FUNC(esh_state::ld_command_strobe_cb));
m_laserdisc->set_overlay(256, 256, FUNC(esh_state::screen_update_esh));
- m_laserdisc->add_route(0, "lspeaker", 1.0);
- m_laserdisc->add_route(1, "rspeaker", 1.0);
+ m_laserdisc->add_route(0, "speaker", 1.0, 0);
+ m_laserdisc->add_route(1, "speaker", 1.0, 1);
/* video hardware */
m_laserdisc->add_ntsc_screen(config, "screen");
@@ -366,8 +366,7 @@ void esh_state::esh(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_esh);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
SPEAKER(config, "mono").front_center();
BEEP(config, m_beep, 2000).add_route(ALL_OUTPUTS, "mono", 0.25);
diff --git a/src/mame/misc/flower_a.cpp b/src/mame/misc/flower_a.cpp
index 176d367f491..34694792520 100644
--- a/src/mame/misc/flower_a.cpp
+++ b/src/mame/misc/flower_a.cpp
@@ -121,13 +121,12 @@ void flower_sound_device::device_reset()
}
}
-void flower_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void flower_sound_device::sound_stream_update(sound_stream &stream)
{
- auto &buffer = outputs[0];
short *mix;
u8 raw_sample;
- std::fill_n(&m_mixer_buffer[0], buffer.samples(), 0);
+ std::fill_n(&m_mixer_buffer[0], stream.samples(), 0);
for (auto &voice : m_channel_list)
{
@@ -139,7 +138,7 @@ void flower_sound_device::sound_stream_update(sound_stream &stream, std::vector<
mix = &m_mixer_buffer[0];
- for (int i = 0; i < buffer.samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
// Volume LUT ROM address bit:
// Bit 0-7: Sample ROM data
@@ -173,8 +172,8 @@ void flower_sound_device::sound_stream_update(sound_stream &stream, std::vector<
/* mix it down */
mix = &m_mixer_buffer[0];
- for (int i = 0; i < buffer.samples(); i++)
- buffer.put_int(i, m_mixer_lookup[*mix++], 32768);
+ for (int i = 0; i < stream.samples(); i++)
+ stream.put_int(0, i, m_mixer_lookup[*mix++], 32768);
}
//-------------------------------------------------
diff --git a/src/mame/misc/flower_a.h b/src/mame/misc/flower_a.h
index 84100bd3c37..dca4e99f61b 100644
--- a/src/mame/misc/flower_a.h
+++ b/src/mame/misc/flower_a.h
@@ -39,7 +39,7 @@ protected:
virtual void device_start() override ATTR_COLD;
virtual void device_reset() override ATTR_COLD;
virtual space_config_vector memory_space_config() const 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;
address_space *m_iospace = nullptr;
private:
diff --git a/src/mame/misc/funkball.cpp b/src/mame/misc/funkball.cpp
index 076a76ec8c2..cfbff8144f5 100644
--- a/src/mame/misc/funkball.cpp
+++ b/src/mame/misc/funkball.cpp
@@ -786,12 +786,11 @@ void funkball_state::funkball(machine_config &config)
INTEL_28F320J5(config, "u30");
INTEL_28F320J5(config, "u3");
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
KS0164(config, m_sound, 16.9344_MHz_XTAL);
- m_sound->add_route(0, "lspeaker", 1.0);
- m_sound->add_route(1, "rspeaker", 1.0);
+ m_sound->add_route(0, "speaker", 1.0, 0);
+ m_sound->add_route(1, "speaker", 1.0, 1);
}
ROM_START( funkball )
diff --git a/src/mame/misc/gamtor.cpp b/src/mame/misc/gamtor.cpp
index 382d10e674b..1745d6b49b6 100644
--- a/src/mame/misc/gamtor.cpp
+++ b/src/mame/misc/gamtor.cpp
@@ -179,8 +179,7 @@ void gaminator_state::gaminator(machine_config &config)
vga.set_screen("screen");
vga.set_vram_size(0x100000);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
/* unknown sound */
}
diff --git a/src/mame/misc/gms.cpp b/src/mame/misc/gms.cpp
index 7781c7c952b..c35e44609ca 100644
--- a/src/mame/misc/gms.cpp
+++ b/src/mame/misc/gms.cpp
@@ -2274,16 +2274,15 @@ void gms_2layers_state::rbmk(machine_config &config)
EEPROM_93C46_16BIT(config, m_eeprom);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
OKIM6295(config, m_oki, 22_MHz_XTAL / 20, okim6295_device::PIN7_HIGH); // pin 7 not verified, but seems to match recordings
- m_oki->add_route(ALL_OUTPUTS, "lspeaker", 0.47);
- m_oki->add_route(ALL_OUTPUTS, "rspeaker", 0.47);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 0.47, 0);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 0.47, 1);
YM2151(config, m_ymsnd, 22_MHz_XTAL / 8);
- m_ymsnd->add_route(0, "lspeaker", 0.60);
- m_ymsnd->add_route(1, "rspeaker", 0.60);
+ m_ymsnd->add_route(0, "speaker", 0.60, 0);
+ m_ymsnd->add_route(1, "speaker", 0.60, 1);
}
void gms_2layers_state::rbspm(machine_config &config)
@@ -2305,8 +2304,8 @@ void gms_2layers_state::ssanguoj(machine_config &config)
config.device_remove("ymsnd");
ym3812_device &ym(YM3812(config, "ym3812", 22_MHz_XTAL / 8));
- ym.add_route(0, "lspeaker", 0.60);
- ym.add_route(1, "rspeaker", 0.60);
+ ym.add_route(0, "speaker", 0.60, 0);
+ ym.add_route(1, "speaker", 0.60, 1);
}
void gms_2layers_state::super555(machine_config &config)
diff --git a/src/mame/misc/good.cpp b/src/mame/misc/good.cpp
index 4ba1762bc76..97aa72c1f0b 100644
--- a/src/mame/misc/good.cpp
+++ b/src/mame/misc/good.cpp
@@ -311,12 +311,11 @@ void good_state::good(machine_config &config)
PALETTE(config, "palette").set_format(palette_device::xRGB_555, 0x400);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
okim6295_device &oki(OKIM6295(config, "oki", 1000000, okim6295_device::PIN7_HIGH)); // clock frequency & pin 7 not verified
- oki.add_route(ALL_OUTPUTS, "lspeaker", 0.47);
- oki.add_route(ALL_OUTPUTS, "rspeaker", 0.47);
+ oki.add_route(ALL_OUTPUTS, "speaker", 0.47, 0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 0.47, 1);
}
diff --git a/src/mame/misc/gumbo.cpp b/src/mame/misc/gumbo.cpp
index c542fb2ea5d..a64ab57a7f0 100644
--- a/src/mame/misc/gumbo.cpp
+++ b/src/mame/misc/gumbo.cpp
@@ -342,12 +342,11 @@ void gumbo_state::gumbo(machine_config &config)
PALETTE(config, "palette").set_format(palette_device::xRGB_555, 0x200);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
okim6295_device &oki(OKIM6295(config, "oki", XTAL(14'318'181) / 16, okim6295_device::PIN7_HIGH)); // clock frequency & pin 7 not verified
- oki.add_route(ALL_OUTPUTS, "lspeaker", 0.47);
- oki.add_route(ALL_OUTPUTS, "rspeaker", 0.47);
+ oki.add_route(ALL_OUTPUTS, "speaker", 0.47, 0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 0.47, 1);
}
void gumbo_state::mspuzzle(machine_config &config)
diff --git a/src/mame/misc/gunpey.cpp b/src/mame/misc/gunpey.cpp
index 56e5abcce20..0a91fa18b2d 100644
--- a/src/mame/misc/gunpey.cpp
+++ b/src/mame/misc/gunpey.cpp
@@ -1174,16 +1174,15 @@ void gunpey_state::gunpey(machine_config &config)
PALETTE(config, m_palette, palette_device::RGB_555);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
OKIM6295(config, m_oki, XTAL(16'934'400) / 8, okim6295_device::PIN7_LOW);
- m_oki->add_route(ALL_OUTPUTS, "lspeaker", 0.125);
- m_oki->add_route(ALL_OUTPUTS, "rspeaker", 0.125);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 0.125, 0);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 0.125, 1);
ymz280b_device &ymz(YMZ280B(config, "ymz", XTAL(16'934'400)));
- ymz.add_route(0, "lspeaker", 0.25);
- ymz.add_route(1, "rspeaker", 0.25);
+ ymz.add_route(0, "speaker", 0.25, 0);
+ ymz.add_route(1, "speaker", 0.25, 1);
}
/***************************************************************************************/
diff --git a/src/mame/misc/hapyfish.cpp b/src/mame/misc/hapyfish.cpp
index 4adefeb3cac..59526bedb1e 100644
--- a/src/mame/misc/hapyfish.cpp
+++ b/src/mame/misc/hapyfish.cpp
@@ -519,10 +519,9 @@ void hapyfish_state::hapyfish(machine_config &config)
screen.set_visarea(0, 639, 0, 479);
screen.set_screen_update("s3c2440", FUNC(s3c2440_device::screen_update));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
- UDA1341TS(config, m_ldac, 0).add_route(ALL_OUTPUTS, "lspeaker", 1.0); // uda1341ts.u12
- UDA1341TS(config, m_rdac, 0).add_route(ALL_OUTPUTS, "rspeaker", 1.0); // uda1341ts.u12
+ SPEAKER(config, "speaker", 2).front();
+ UDA1341TS(config, m_ldac, 0).add_route(ALL_OUTPUTS, "speaker", 1.0, 0); // uda1341ts.u12
+ UDA1341TS(config, m_rdac, 0).add_route(ALL_OUTPUTS, "speaker", 1.0, 1); // uda1341ts.u12
S3C2440(config, m_s3c2440, 12000000);
m_s3c2440->set_palette_tag("palette");
diff --git a/src/mame/misc/hideseek.cpp b/src/mame/misc/hideseek.cpp
index 0656aff82fa..6e91de9e3a3 100644
--- a/src/mame/misc/hideseek.cpp
+++ b/src/mame/misc/hideseek.cpp
@@ -124,8 +124,7 @@ void hideseek_state::hideseek(machine_config &config)
PALETTE(config, "palette", FUNC(hideseek_state::hideseek_palette), 0x10000);
GFXDECODE(config, "gfxdecode", "palette", gfx_hideseek);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
/* sound : M9810 */
}
diff --git a/src/mame/misc/inder_sb.cpp b/src/mame/misc/inder_sb.cpp
index 33de7c663ac..6c9fdb12bd4 100644
--- a/src/mame/misc/inder_sb.cpp
+++ b/src/mame/misc/inder_sb.cpp
@@ -14,7 +14,7 @@ DEFINE_DEVICE_TYPE(INDER_AUDIO, inder_sb_device, "indersb", "Inder 4xDAC Sound B
inder_sb_device::inder_sb_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, INDER_AUDIO, tag, owner, clock)
- , device_mixer_interface(mconfig, *this, 2)
+ , device_mixer_interface(mconfig, *this)
, m_audiocpu(*this, "audiocpu")
, m_ctc(*this, "ctc")
, m_audiocpu_rom(*this, "audiocpu")
diff --git a/src/mame/misc/istellar.cpp b/src/mame/misc/istellar.cpp
index 5e5c70621bb..b40ea961fd1 100644
--- a/src/mame/misc/istellar.cpp
+++ b/src/mame/misc/istellar.cpp
@@ -381,8 +381,8 @@ void istellar_state::istellar(machine_config &config)
PIONEER_LDV1000(config, m_laserdisc, 0);
m_laserdisc->set_overlay(256, 256, FUNC(istellar_state::screen_update));
- m_laserdisc->add_route(0, "lspeaker", 1.0);
- m_laserdisc->add_route(1, "rspeaker", 1.0);
+ m_laserdisc->add_route(0, "speaker", 1.0, 0);
+ m_laserdisc->add_route(1, "speaker", 1.0, 1);
// video hardware
m_laserdisc->add_ntsc_screen(config, "screen");
@@ -394,8 +394,7 @@ void istellar_state::istellar(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_istellar);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
diff --git a/src/mame/misc/jungleyo.cpp b/src/mame/misc/jungleyo.cpp
index 593f64e35e9..073401cdf2d 100644
--- a/src/mame/misc/jungleyo.cpp
+++ b/src/mame/misc/jungleyo.cpp
@@ -884,12 +884,11 @@ void jungleyo_state::jungleyo(machine_config &config)
PALETTE(config, m_palette).set_entries(0x8000);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
okim6295_device &oki(OKIM6295(config, "oki", 24_MHz_XTAL / 20, okim6295_device::PIN7_HIGH)); // clock frequency & pin 7 not verified
- oki.add_route(ALL_OUTPUTS, "lspeaker", 0.47);
- oki.add_route(ALL_OUTPUTS, "rspeaker", 0.47);
+ oki.add_route(ALL_OUTPUTS, "speaker", 0.47, 0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 0.47, 1);
}
diff --git a/src/mame/misc/laz_ribrac.cpp b/src/mame/misc/laz_ribrac.cpp
index 72b72dd15a2..0e78e8b37bc 100644
--- a/src/mame/misc/laz_ribrac.cpp
+++ b/src/mame/misc/laz_ribrac.cpp
@@ -306,14 +306,13 @@ void ribrac_state::ribrac(machine_config &config)
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); // 6264 + MAX694 + battery
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
OKIM6295(config, m_oki[0], 2.097152_MHz_XTAL, okim6295_device::PIN7_HIGH);
- m_oki[0]->add_route(ALL_OUTPUTS, "lspeaker", 1.0);
+ m_oki[0]->add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
OKIM6295(config, m_oki[1], 2.097152_MHz_XTAL, okim6295_device::PIN7_HIGH);
- m_oki[1]->add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ m_oki[1]->add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
}
diff --git a/src/mame/misc/limenko.cpp b/src/mame/misc/limenko.cpp
index 80e57a98466..f3a16cf7be9 100644
--- a/src/mame/misc/limenko.cpp
+++ b/src/mame/misc/limenko.cpp
@@ -712,8 +712,7 @@ void limenko_state::limenko(machine_config &config)
PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x1000);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set(m_qs1000, FUNC(qs1000_device::set_irq));
@@ -725,8 +724,8 @@ void limenko_state::limenko(machine_config &config)
m_qs1000->p1_out().set(FUNC(limenko_state::qs1000_p1_w));
m_qs1000->p2_out().set(FUNC(limenko_state::qs1000_p2_w));
m_qs1000->p3_out().set(FUNC(limenko_state::qs1000_p3_w));
- m_qs1000->add_route(0, "lspeaker", 1.0);
- m_qs1000->add_route(1, "rspeaker", 1.0);
+ m_qs1000->add_route(0, "speaker", 1.0, 0);
+ m_qs1000->add_route(1, "speaker", 1.0, 1);
}
void limenko_state::spotty(machine_config &config)
diff --git a/src/mame/misc/magictg.cpp b/src/mame/misc/magictg.cpp
index 7112bbdc002..4980ad3c287 100644
--- a/src/mame/misc/magictg.cpp
+++ b/src/mame/misc/magictg.cpp
@@ -928,11 +928,10 @@ void magictg_state::magictg(machine_config &config)
m_adsp->set_addrmap(AS_DATA, &magictg_state::adsp_data_map);
m_adsp->set_addrmap(AS_IO, &magictg_state::adsp_io_map);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- DMADAC(config, "dac1").add_route(ALL_OUTPUTS, "rspeaker", 1.0);
- DMADAC(config, "dac2").add_route(ALL_OUTPUTS, "lspeaker", 1.0);
+ DMADAC(config, "dac1").add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
+ DMADAC(config, "dac2").add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
pci_bus_legacy_device &pcibus(PCI_BUS_LEGACY(config, "pcibus", 0, 0));
pcibus.set_device(0, FUNC(magictg_state::pci_dev0_r), FUNC(magictg_state::pci_dev0_w));
diff --git a/src/mame/misc/micro3d.cpp b/src/mame/misc/micro3d.cpp
index 5759ca49830..cf9c44a6732 100644
--- a/src/mame/misc/micro3d.cpp
+++ b/src/mame/misc/micro3d.cpp
@@ -381,24 +381,23 @@ void micro3d_state::micro3d(machine_config &config)
m_adc->ch1_callback().set_ioport("THROTTLE");
m_adc->ch2_callback().set(FUNC(micro3d_state::adc_volume_r));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
UPD7759(config, m_upd7759);
- m_upd7759->add_route(ALL_OUTPUTS, "lspeaker", 0.35);
- m_upd7759->add_route(ALL_OUTPUTS, "rspeaker", 0.35);
+ m_upd7759->add_route(ALL_OUTPUTS, "speaker", 0.35, 0);
+ m_upd7759->add_route(ALL_OUTPUTS, "speaker", 0.35, 1);
ym2151_device &ym2151(YM2151(config, "ym2151", 3.579545_MHz_XTAL));
- ym2151.add_route(0, "lspeaker", 0.35);
- ym2151.add_route(1, "rspeaker", 0.35);
+ ym2151.add_route(0, "speaker", 0.35, 0);
+ ym2151.add_route(1, "speaker", 0.35, 1);
MICRO3D_SOUND(config, m_noise[0]);
- m_noise[0]->add_route(0, "lspeaker", 1.0);
- m_noise[0]->add_route(1, "rspeaker", 1.0);
+ m_noise[0]->add_route(0, "speaker", 1.0, 0);
+ m_noise[0]->add_route(1, "speaker", 1.0, 1);
MICRO3D_SOUND(config, m_noise[1]);
- m_noise[1]->add_route(0, "lspeaker", 1.0);
- m_noise[1]->add_route(1, "rspeaker", 1.0);
+ m_noise[1]->add_route(0, "speaker", 1.0, 0);
+ m_noise[1]->add_route(1, "speaker", 1.0, 1);
}
void micro3d_state::botss11(machine_config &config)
diff --git a/src/mame/misc/micro3d_a.cpp b/src/mame/misc/micro3d_a.cpp
index 6db60dddcc3..02971a77c17 100644
--- a/src/mame/misc/micro3d_a.cpp
+++ b/src/mame/misc/micro3d_a.cpp
@@ -222,24 +222,17 @@ void micro3d_sound_device::device_reset()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void micro3d_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void micro3d_sound_device::sound_stream_update(sound_stream &stream)
{
lp_filter *iir = &m_filter;
- auto &fl = outputs[0];
- auto &fr = outputs[1];
-
- // Clear the buffers
- fl.fill(0);
- fr.fill(0);
-
if (m_gain == 0)
return;
float const pan_l = float(255 - m_dac[PAN]) / 255.0f;
float const pan_r = float(m_dac[PAN]) / 255.0f;
- for (int sampindex = 0; sampindex < fl.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
int step;
@@ -289,7 +282,7 @@ void micro3d_sound_device::sound_stream_update(sound_stream &stream, std::vector
}
output *= 3.5f / 32768.f;
- fl.put_clamp(sampindex, output * pan_l, 1.0);
- fr.put_clamp(sampindex, output * pan_r, 1.0);
+ stream.put_clamp(0, sampindex, output * pan_l, 1.0);
+ stream.put_clamp(1, sampindex, output * pan_r, 1.0);
}
}
diff --git a/src/mame/misc/micro3d_a.h b/src/mame/misc/micro3d_a.h
index c47833cf9b2..2940041f4d1 100644
--- a/src/mame/misc/micro3d_a.h
+++ b/src/mame/misc/micro3d_a.h
@@ -24,7 +24,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;
private:
enum dac_registers
diff --git a/src/mame/misc/mindset.cpp b/src/mame/misc/mindset.cpp
index fca02a2fd58..8ac5ae2fc90 100644
--- a/src/mame/misc/mindset.cpp
+++ b/src/mame/misc/mindset.cpp
@@ -245,9 +245,7 @@ void mindset_sound_module::device_add_mconfig(machine_config &config)
I8042(config, m_soundcpu, 12_MHz_XTAL/2);
m_soundcpu->p1_out_cb().set(FUNC(mindset_sound_module::p1_w));
m_soundcpu->p2_out_cb().set(FUNC(mindset_sound_module::p2_w));
-
- SPEAKER(config, "rspeaker").front_right();
- DAC_8BIT_R2R(config, m_dac, 0).add_route(ALL_OUTPUTS, "rspeaker", 0.5);
+ DAC_8BIT_R2R(config, m_dac, 0).add_route(ALL_OUTPUTS, ":speaker", 0.5, 1);
}
@@ -1346,8 +1344,8 @@ void mindset_state::mindset(machine_config &config)
FLOPPY_CONNECTOR(config, m_fdco[0], pc_dd_floppies, "525dd", floppy_image_device::default_pc_floppy_formats);
FLOPPY_CONNECTOR(config, m_fdco[1], pc_dd_floppies, "525dd", floppy_image_device::default_pc_floppy_formats);
- SPEAKER(config, "lspeaker").front_left();
- DAC_8BIT_R2R(config, m_dac, 0).add_route(ALL_OUTPUTS, "lspeaker", 0.5);
+ SPEAKER(config, "speaker", 2).front();
+ DAC_8BIT_R2R(config, m_dac, 0).add_route(ALL_OUTPUTS, "speaker", 0.5, 0);
MINDSET_MODULE(config, "m0", mindset_modules, "stereo", false);
MINDSET_MODULE(config, "m1", mindset_modules, "rs232", false);
diff --git a/src/mame/misc/neoprint.cpp b/src/mame/misc/neoprint.cpp
index 506f4963a0f..86027b296b7 100644
--- a/src/mame/misc/neoprint.cpp
+++ b/src/mame/misc/neoprint.cpp
@@ -536,17 +536,16 @@ void neoprint_state::neoprint(machine_config &config)
PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x10000);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
ym2610_device &ymsnd(YM2610(config, "ymsnd", 24000000 / 3));
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
- ymsnd.add_route(0, "lspeaker", 0.60);
- ymsnd.add_route(0, "rspeaker", 0.60);
- ymsnd.add_route(1, "lspeaker", 1.0);
- ymsnd.add_route(2, "rspeaker", 1.0);
+ ymsnd.add_route(0, "speaker", 0.60, 0);
+ ymsnd.add_route(0, "speaker", 0.60, 1);
+ ymsnd.add_route(1, "speaker", 1.0, 0);
+ ymsnd.add_route(2, "speaker", 1.0, 1);
}
MACHINE_RESET_MEMBER(neoprint_state,nprsp)
@@ -582,17 +581,16 @@ void neoprint_state::nprsp(machine_config &config)
PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x10000);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
ym2610_device &ymsnd(YM2610(config, "ymsnd", 24000000 / 3));
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
- ymsnd.add_route(0, "lspeaker", 0.60);
- ymsnd.add_route(0, "rspeaker", 0.60);
- ymsnd.add_route(1, "lspeaker", 1.0);
- ymsnd.add_route(2, "rspeaker", 1.0);
+ ymsnd.add_route(0, "speaker", 0.60, 0);
+ ymsnd.add_route(0, "speaker", 0.60, 1);
+ ymsnd.add_route(1, "speaker", 1.0, 0);
+ ymsnd.add_route(2, "speaker", 1.0, 1);
}
diff --git a/src/mame/misc/policetr.cpp b/src/mame/misc/policetr.cpp
index 17a949e5ea0..68b66dda0f0 100644
--- a/src/mame/misc/policetr.cpp
+++ b/src/mame/misc/policetr.cpp
@@ -452,12 +452,11 @@ void policetr_state::policetr(machine_config &config)
BT481(config, m_ramdac, 0); // Bt481AKPJ110
/* sound hardware */
- SPEAKER(config, m_lspeaker).front_left();
- SPEAKER(config, m_rspeaker).front_right();
+ SPEAKER(config, m_speaker, 2).front();
BSMT2000(config, m_bsmt, MASTER_CLOCK/2);
- m_bsmt->add_route(0, *m_lspeaker, 1.0);
- m_bsmt->add_route(1, *m_rspeaker, 1.0);
+ m_bsmt->add_route(0, *m_speaker, 1.0, 0);
+ m_bsmt->add_route(1, *m_speaker, 1.0, 1);
}
void sshooter_state::sshooter(machine_config &config)
diff --git a/src/mame/misc/policetr.h b/src/mame/misc/policetr.h
index d692ad5c89b..ff625e16650 100644
--- a/src/mame/misc/policetr.h
+++ b/src/mame/misc/policetr.h
@@ -32,8 +32,7 @@ protected:
m_maincpu(*this, "maincpu"),
m_bsmt(*this, "bsmt"),
m_bsmt_region(*this, "bsmt"),
- m_lspeaker(*this, "lspeaker"),
- m_rspeaker(*this, "rspeaker"),
+ m_speaker(*this, "speaker"),
m_eeprom(*this, "eeprom"),
m_screen(*this, "screen"),
m_ramdac(*this, "ramdac"),
@@ -67,8 +66,7 @@ protected:
required_device<r3041_device> m_maincpu;
required_device<bsmt2000_device> m_bsmt;
required_region_ptr<uint8_t> m_bsmt_region;
- required_device<speaker_device> m_lspeaker;
- required_device<speaker_device> m_rspeaker;
+ required_device<speaker_device> m_speaker;
required_device<eeprom_serial_93cxx_device> m_eeprom;
required_device<screen_device> m_screen;
required_device<bt481_device> m_ramdac;
diff --git a/src/mame/misc/proconn.cpp b/src/mame/misc/proconn.cpp
index 4f6f0ceee65..5840b10f26e 100644
--- a/src/mame/misc/proconn.cpp
+++ b/src/mame/misc/proconn.cpp
@@ -328,15 +328,14 @@ void proconn_state::proconn(machine_config &config)
Z80SIO(config, m_z80sio, 4000000); /* ?? Mhz */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
config.set_default_layout(layout_proconn);
AY8910(config, m_ay, 1000000); /* ?? Mhz */ // YM2149F on PC92?
m_ay->port_b_write_callback().set(FUNC(proconn_state::meter_w));
- m_ay->add_route(ALL_OUTPUTS, "rspeaker", 0.33);
+ m_ay->add_route(ALL_OUTPUTS, "speaker", 0.33, 1);
METERS(config, m_meters, 0);
m_meters->set_number(8);
diff --git a/src/mame/misc/skimaxx.cpp b/src/mame/misc/skimaxx.cpp
index c5ef1f693e9..dbd6e2ce5b1 100644
--- a/src/mame/misc/skimaxx.cpp
+++ b/src/mame/misc/skimaxx.cpp
@@ -560,16 +560,15 @@ void skimaxx_state::skimaxx(machine_config &config)
PALETTE(config, "palette", palette_device::RGB_555);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- OKIM6295(config, "oki1", XTAL(4'000'000), okim6295_device::PIN7_LOW).add_route(ALL_OUTPUTS, "lspeaker", 1.0); // ?
+ OKIM6295(config, "oki1", XTAL(4'000'000), okim6295_device::PIN7_LOW).add_route(ALL_OUTPUTS, "speaker", 1.0, 0); // ?
- OKIM6295(config, "oki2", XTAL(4'000'000)/2, okim6295_device::PIN7_HIGH).add_route(ALL_OUTPUTS, "lspeaker", 1.0); // ?
+ OKIM6295(config, "oki2", XTAL(4'000'000)/2, okim6295_device::PIN7_HIGH).add_route(ALL_OUTPUTS, "speaker", 1.0, 0); // ?
- OKIM6295(config, "oki3", XTAL(4'000'000), okim6295_device::PIN7_LOW).add_route(ALL_OUTPUTS, "rspeaker", 1.0); // ?
+ OKIM6295(config, "oki3", XTAL(4'000'000), okim6295_device::PIN7_LOW).add_route(ALL_OUTPUTS, "speaker", 1.0, 1); // ?
- OKIM6295(config, "oki4", XTAL(4'000'000)/2, okim6295_device::PIN7_HIGH).add_route(ALL_OUTPUTS, "rspeaker", 1.0); // ?
+ OKIM6295(config, "oki4", XTAL(4'000'000)/2, okim6295_device::PIN7_HIGH).add_route(ALL_OUTPUTS, "speaker", 1.0, 1); // ?
}
diff --git a/src/mame/misc/sliver.cpp b/src/mame/misc/sliver.cpp
index 47ef5538120..fc40e885cea 100644
--- a/src/mame/misc/sliver.cpp
+++ b/src/mame/misc/sliver.cpp
@@ -541,15 +541,14 @@ void sliver_state::sliver(machine_config &config)
ramdac_device &ramdac(RAMDAC(config, "ramdac", 0, "palette"));
ramdac.set_addrmap(0, &sliver_state::ramdac_map);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
okim6295_device &oki(OKIM6295(config, "oki", 1000000, okim6295_device::PIN7_HIGH));
oki.set_addrmap(0, &sliver_state::oki_map);
- oki.add_route(ALL_OUTPUTS, "lspeaker", 0.6);
- oki.add_route(ALL_OUTPUTS, "rspeaker", 0.6);
+ oki.add_route(ALL_OUTPUTS, "speaker", 0.6, 0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 0.6, 1);
}
ROM_START( sliver )
diff --git a/src/mame/misc/spool99.cpp b/src/mame/misc/spool99.cpp
index 5875f3529bb..ff8f39ed1c0 100644
--- a/src/mame/misc/spool99.cpp
+++ b/src/mame/misc/spool99.cpp
@@ -391,12 +391,11 @@ void spool99_state::spool99(machine_config &config)
EEPROM_93C46_16BIT(config, "eeprom");
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
OKIM6295(config, m_oki, 1000000, okim6295_device::PIN7_HIGH); // clock frequency & pin 7 not verified
- m_oki->add_route(ALL_OUTPUTS, "lspeaker", 0.47);
- m_oki->add_route(ALL_OUTPUTS, "rspeaker", 0.47);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 0.47, 0);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 0.47, 1);
}
void spool99_state::vcarn(machine_config &config)
diff --git a/src/mame/misc/sshanghai.cpp b/src/mame/misc/sshanghai.cpp
new file mode 100644
index 00000000000..9a5eb3e6b74
--- /dev/null
+++ b/src/mame/misc/sshanghai.cpp
@@ -0,0 +1,592 @@
+// license:BSD-3-Clause
+// copyright-holders: Roberto Fresca, Grull Osgo
+
+/********************************************************************************************
+
+ Super Shanghai 2000.
+ Super Shanghai 2000 - Wrestle Fiesta.
+
+ Driver by Roberto Fresca & Grull Osgo.
+
+
+ 3-reel 5-liner with an extra reel.
+ Rare video slots machine platform based on a Z80 CPU and a AY-3-8910 for sound.
+ 5 DIP switchs banks.
+
+ Unknown manufacturer.
+
+
+********************************************************************************************/
+
+#include "emu.h"
+
+#include "cpu/z80/z80.h"
+#include "machine/nvram.h"
+#include "machine/ticket.h"
+#include "sound/ay8910.h"
+
+#include "emupal.h"
+#include "screen.h"
+#include "speaker.h"
+#include "tilemap.h"
+
+
+constexpr XTAL MASTER_CLOCK = 12_MHz_XTAL;
+constexpr XTAL CPU_CLOCK = MASTER_CLOCK / 4;
+constexpr XTAL AY_CLOCK = MASTER_CLOCK / 8;
+
+
+namespace {
+
+class ssh2000_state : public driver_device
+{
+public:
+ ssh2000_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
+ m_bg_vidram(*this, "bg_vidram"),
+ m_bg_atrram(*this, "bg_atrram"),
+ m_fg_vidram(*this, "fg_vidram"),
+ m_fg_atrram(*this, "fg_atrram"),
+ m_maincpu(*this, "maincpu"),
+ m_gfxdecode(*this, "gfxdecode"),
+ m_palette(*this, "palette")
+ { }
+
+ void ssh2000(machine_config &config);
+
+protected:
+ void ssh2000_map(address_map &map) ATTR_COLD;
+ void ssh2000_portmap(address_map &map) ATTR_COLD;
+
+ void fg_vidram_w(offs_t offset, uint8_t data);
+ void fg_atrram_w(offs_t offset, uint8_t data);
+ void bg_vidram_w(offs_t offset, uint8_t data);
+ void bg_atrram_w(offs_t offset, uint8_t data);
+ void ssh2000_palette(palette_device &palette) const;
+ DECLARE_VIDEO_START(ssh2000);
+ uint32_t screen_update_ssh2000(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
+ void portout_w(uint8_t data);
+
+ TILE_GET_INFO_MEMBER(get_bg_tile_info);
+ TILE_GET_INFO_MEMBER(get_fg_tile_info);
+
+ required_shared_ptr<uint8_t> m_bg_vidram;
+ required_shared_ptr<uint8_t> m_bg_atrram;
+
+ required_shared_ptr<uint8_t> m_fg_vidram;
+ required_shared_ptr<uint8_t> m_fg_atrram;
+
+ tilemap_t *m_bg_tilemap = nullptr;
+ tilemap_t *m_fg_tilemap = nullptr;
+
+ required_device<cpu_device> m_maincpu;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<palette_device> m_palette;
+};
+
+
+/*****************************************************
+* Video Hardware emulation *
+*****************************************************/
+
+VIDEO_START_MEMBER(ssh2000_state, ssh2000)
+{
+ m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(ssh2000_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8,8, 64, 32);
+ m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(ssh2000_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8,8, 64, 32);
+
+ m_bg_tilemap->set_transparent_pen(0);
+}
+
+
+uint32_t ssh2000_state::screen_update_ssh2000(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
+{
+ bitmap.fill(rgb_t::black(), cliprect);
+
+ m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
+ m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
+
+ return 0;
+}
+
+
+void ssh2000_state::bg_vidram_w(offs_t offset, uint8_t data)
+{
+ m_bg_vidram[offset] = data;
+ m_bg_tilemap->mark_tile_dirty(offset);
+}
+
+void ssh2000_state::bg_atrram_w(offs_t offset, uint8_t data)
+{
+ m_bg_atrram[offset] = data;
+ m_bg_tilemap->mark_tile_dirty(offset);
+}
+
+void ssh2000_state::fg_vidram_w(offs_t offset, uint8_t data)
+{
+ m_fg_vidram[offset] = data;
+ m_fg_tilemap->mark_tile_dirty(offset);
+}
+
+void ssh2000_state::fg_atrram_w(offs_t offset, uint8_t data)
+{
+ m_fg_atrram[offset] = data;
+ m_fg_tilemap->mark_tile_dirty(offset);
+}
+
+
+TILE_GET_INFO_MEMBER(ssh2000_state::get_fg_tile_info)
+{
+ int const code = m_fg_vidram[tile_index];
+ int const attr = m_fg_atrram[tile_index];
+ int tilepos = code | (attr & 0x1f) << 8;
+ uint8_t color = (attr & 0xe0) >> 5;
+ uint8_t bank = 0;
+
+ tileinfo.set(bank, tilepos, color, 0);
+}
+
+TILE_GET_INFO_MEMBER(ssh2000_state::get_bg_tile_info)
+{
+ int const code = m_bg_vidram[tile_index];
+ int const attr = m_bg_atrram[tile_index];
+ int tilepos = code | (attr & 0x1f) << 8;
+ uint8_t color = (attr & 0xe0) >> 5;
+ uint8_t bank = 1;
+
+ tileinfo.set(bank, tilepos, color, 0);
+}
+
+
+void ssh2000_state::ssh2000_palette(palette_device &palette) const
+{
+ // BBGGGRRR
+ uint8_t const *const proms = memregion("proms")->base();
+ for (int i = 0; i < 0x100; i++)
+ {
+ uint8_t const data = proms[0x000 + i] | (proms[0x100 + i] << 4);
+ palette.set_pen_color(i, pal3bit(data >> 0), pal3bit(data >> 3), pal2bit(data >> 6));
+ }
+}
+
+
+/*****************************************************
+* Graphics Layouts & Decode *
+*****************************************************/
+
+static const gfx_layout tiles8x8x4_layout =
+{
+ 8, 8,
+ RGN_FRAC(1,4),
+ 4,
+ { 0, RGN_FRAC(1,4), RGN_FRAC(2,4), RGN_FRAC(3,4) }, // bitplanes are separated
+ { 0, 1, 2, 3, 4, 5, 6, 7 },
+ { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
+ 8*8 // every char takes 8 consecutive bytes
+};
+
+
+static GFXDECODE_START( gfx_ss2001 )
+ GFXDECODE_ENTRY( "gfx1", 0, tiles8x8x4_layout, 0, 16 )
+ GFXDECODE_ENTRY( "gfx2", 0, tiles8x8x4_layout, 0, 16 )
+GFXDECODE_END
+
+
+/*****************************************************
+* Memory Maps / Addressing *
+*****************************************************/
+
+void ssh2000_state::ssh2000_map(address_map &map)
+{
+ map(0x0000, 0xcfff).rom().nopw();
+
+ map(0xd000, 0xd7ff).ram().share("nvram");
+ map(0xd800, 0xdfff).ram();
+
+ map(0xe000, 0xe7ff).ram().w(FUNC(ssh2000_state::fg_vidram_w)).share("fg_vidram");
+ map(0xe800, 0xefff).ram().w(FUNC(ssh2000_state::fg_atrram_w)).share("fg_atrram");
+
+ map(0xf000, 0xf7ff).ram().w(FUNC(ssh2000_state::bg_vidram_w)).share("bg_vidram");
+ map(0xf800, 0xffff).ram().w(FUNC(ssh2000_state::bg_atrram_w)).share("bg_atrram");
+}
+
+void ssh2000_state::ssh2000_portmap(address_map &map)
+{
+ map.global_mask(0xff);
+ map(0x01, 0x01).r("aysnd", FUNC(ay8910_device::data_r));
+ map(0x02, 0x03).w("aysnd", FUNC(ay8910_device::data_address_w));
+ map(0x10, 0x10).nopw(); // watchdog
+
+ map(0x12, 0x12).w(FUNC(ssh2000_state::portout_w));
+ map(0x13, 0x13).portr("IN0");
+ map(0x14, 0x14).portr("IN1");
+ map(0x15, 0x15).portr("DSWB");
+ map(0x16, 0x16).portr("DSWC");
+ map(0x17, 0x17).portr("DSWA");
+}
+
+/*****************************************************
+* Output Ports *
+*****************************************************/
+
+void ssh2000_state::portout_w(uint8_t data)
+{
+ machine().bookkeeping().coin_counter_w(0, BIT(data, 2)); // Coins in
+ machine().bookkeeping().coin_counter_w(1, BIT(data, 0)); // Coins Out
+}
+
+
+/*****************************************************
+* Input Ports *
+*****************************************************/
+
+static INPUT_PORTS_START( ssh2000 )
+
+ PORT_START("IN0")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_NAME("Start / Down")
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_9) PORT_NAME("Clear/Reset")
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_CODE(KEYCODE_Z) PORT_NAME("Fire 1")
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("Port Test")
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_CODE(KEYCODE_X) PORT_NAME("Fire 2")
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_CODE(KEYCODE_C) PORT_NAME("Fire 3")
+
+ PORT_START("IN1")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT )
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Service Coin")
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_A) PORT_NAME("Test 1")
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_S) PORT_NAME("Test 2")
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2) PORT_NAME("Coin A")
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(2) PORT_NAME("Coin B")
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("Start (Automatic)")
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_NAME("Bet / Stop / Up")
+
+ PORT_START("DSWA")
+ PORT_DIPNAME( 0x03, 0x00, "Percentage" ) PORT_DIPLOCATION("DSWA:8,7")
+ PORT_DIPSETTING( 0x00, "80%" )
+ PORT_DIPSETTING( 0x01, "75%" )
+ PORT_DIPSETTING( 0x02, "70%" )
+ PORT_DIPSETTING( 0x03, "65%" )
+ PORT_DIPNAME( 0x04, 0x04, "Sprites" ) PORT_DIPLOCATION("DSWA:6")
+ PORT_DIPSETTING( 0x04, "Fruits")
+ PORT_DIPSETTING( 0x00, "Tiles")
+ PORT_DIPNAME( 0x08, 0x00, "Game Name" ) PORT_DIPLOCATION("DSWA:5")
+ PORT_DIPSETTING( 0x08, "NAME 2")
+ PORT_DIPSETTING( 0x00, "NAME 1")
+ PORT_DIPNAME( 0x10, 0x00, "Extra Take") PORT_DIPLOCATION("DSWA:4")
+ PORT_DIPSETTING( 0x10, "OFF: NO" )
+ PORT_DIPSETTING( 0x00, "ON: YES" )
+ PORT_DIPNAME( 0x20, 0x00, "Demo Sound" ) PORT_DIPLOCATION("DSWA:3")
+ PORT_DIPSETTING( 0x20, "OFF: NO" )
+ PORT_DIPSETTING( 0x00, "ON: YES" )
+ PORT_DIPNAME( 0x40, 0x00, "Max. BET" ) PORT_DIPLOCATION("DSWA:2")
+ PORT_DIPSETTING( 0x40, "OFF: 9" )
+ PORT_DIPSETTING( 0x00, "ON: 5" )
+ PORT_DIPNAME( 0x80, 0x00, "Demostration") PORT_DIPLOCATION("DSWA:1")
+ PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( On ) )
+
+ PORT_START("DSWB")
+ PORT_DIPNAME( 0x0f, 0x0f, "Coinage A") PORT_DIPLOCATION("DSWB:8,7,6,5")
+ PORT_DIPSETTING( 0x00, "1" )
+ PORT_DIPSETTING( 0x1, "2" )
+ PORT_DIPSETTING( 0x2, "5" )
+ PORT_DIPSETTING( 0x3, "10" )
+ PORT_DIPSETTING( 0x4, "20" )
+ PORT_DIPSETTING( 0x5, "50" )
+ PORT_DIPSETTING( 0x6, "100" )
+ PORT_DIPSETTING( 0x7, "500" )
+ PORT_DIPSETTING( 0x8, "1000" )
+ PORT_DIPSETTING( 0x9, "4" )
+ PORT_DIPSETTING( 0xa, "8" )
+ PORT_DIPSETTING( 0xb, "20" )
+ PORT_DIPSETTING( 0xc, "40" )
+ PORT_DIPSETTING( 0xd, "200" )
+ PORT_DIPSETTING( 0xe, "400" )
+ PORT_DIPSETTING( 0xf, "10" )
+ PORT_DIPNAME( 0xf0, 0xf0, "Coinage B") PORT_DIPLOCATION("DSWB:4,3,2,1")
+ PORT_DIPSETTING( 0x00, "1" )
+ PORT_DIPSETTING( 0x10, "2" )
+ PORT_DIPSETTING( 0x20, "5" )
+ PORT_DIPSETTING( 0x30, "10" )
+ PORT_DIPSETTING( 0x40, "20" )
+ PORT_DIPSETTING( 0x50, "50" )
+ PORT_DIPSETTING( 0x60, "100" )
+ PORT_DIPSETTING( 0x70, "500" )
+ PORT_DIPSETTING( 0x80, "1000" )
+ PORT_DIPSETTING( 0x90, "4" )
+ PORT_DIPSETTING( 0xa0, "8" )
+ PORT_DIPSETTING( 0xb0, "20" )
+ PORT_DIPSETTING( 0xc0, "40" )
+ PORT_DIPSETTING( 0xd0, "200" )
+ PORT_DIPSETTING( 0xe0, "400" )
+ PORT_DIPSETTING( 0xf0, "10" )
+
+ PORT_START("DSWC")
+ PORT_DIPNAME( 0x01, 0x01, "Found") PORT_DIPLOCATION("DSWC:8")
+ PORT_DIPSETTING( 0x01, "Auto" )
+ PORT_DIPSETTING( 0x00, "Hand" )
+ PORT_DIPNAME( 0x02, 0x02, "Found Pay" ) PORT_DIPLOCATION("DSWC:7")
+ PORT_DIPSETTING( 0x02, "By One" )
+ PORT_DIPSETTING( 0x00, "All" )
+ PORT_DIPNAME( 0x04, 0x04, "Papas Pay" ) PORT_DIPLOCATION("DSWC:6")
+ PORT_DIPSETTING( 0x04, "By One" )
+ PORT_DIPSETTING( 0x00, "All" )
+ PORT_DIPNAME( 0x08, 0x08, "Flip Type" ) PORT_DIPLOCATION("DSWC:5")
+ PORT_DIPSETTING( 0x08, "on Tape" )
+ PORT_DIPSETTING( 0x00, "on Kare" )
+ PORT_DIPNAME( 0xf0, 0xf0, "Coinage C") PORT_DIPLOCATION("DSWC:4,3,2,1")
+ PORT_DIPSETTING( 0x00, "1" )
+ PORT_DIPSETTING( 0x10, "2" )
+ PORT_DIPSETTING( 0x20, "5" )
+ PORT_DIPSETTING( 0x30, "10" )
+ PORT_DIPSETTING( 0x40, "20" )
+ PORT_DIPSETTING( 0x50, "50" )
+ PORT_DIPSETTING( 0x60, "100" )
+ PORT_DIPSETTING( 0x70, "500" )
+ PORT_DIPSETTING( 0x80, "1000" )
+ PORT_DIPSETTING( 0x90, "4" )
+ PORT_DIPSETTING( 0xa0, "8" )
+ PORT_DIPSETTING( 0xb0, "20" )
+ PORT_DIPSETTING( 0xc0, "40" )
+ PORT_DIPSETTING( 0xd0, "200" )
+ PORT_DIPSETTING( 0xe0, "400" )
+ PORT_DIPSETTING( 0xf0, "10" )
+
+ PORT_START("DSWD")
+ PORT_DIPNAME( 0x0f, 0x0f, "Credit Limit") PORT_DIPLOCATION("DSWD:8,7,6,5")
+ PORT_DIPSETTING( 0x00, " 5000" )
+ PORT_DIPSETTING( 0x01, " 7500" )
+ PORT_DIPSETTING( 0x02, "10000" )
+ PORT_DIPSETTING( 0x03, "15000" )
+ PORT_DIPSETTING( 0x04, "20000" )
+ PORT_DIPSETTING( 0x05, "25000" )
+ PORT_DIPSETTING( 0x06, "30000" )
+ PORT_DIPSETTING( 0x07, "35000" )
+ PORT_DIPSETTING( 0x08, "40000" )
+ PORT_DIPSETTING( 0x09, "45000" )
+ PORT_DIPSETTING( 0x0a, "50000" )
+ PORT_DIPSETTING( 0x0b, "60000" )
+ PORT_DIPSETTING( 0x0c, "70000" )
+ PORT_DIPSETTING( 0x0d, "80000" )
+ PORT_DIPSETTING( 0x0e, "90000" )
+ PORT_DIPSETTING( 0x0f, "20000" )
+ PORT_DIPNAME( 0x10, 0x10, "Swap Code" ) PORT_DIPLOCATION("DSWD:4")
+ PORT_DIPSETTING( 0x10, "Code 2" )
+ PORT_DIPSETTING( 0x00, "Code 1" )
+ PORT_DIPNAME( 0x20, 0x20, "Return In" ) PORT_DIPLOCATION("DSWD:3")
+ PORT_DIPSETTING( 0x20, "Main" )
+ PORT_DIPSETTING( 0x00, "Amusement" )
+ PORT_DIPNAME( 0x40, 0x40, "Must be Off" ) PORT_DIPLOCATION("DSWD:2")
+ PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
+ PORT_DIPNAME( 0x80, 0x80, "Amusement" ) PORT_DIPLOCATION("DSWD:1")
+ PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( On ) )
+
+ PORT_START("DSWE")
+ PORT_DIPNAME( 0x0f, 0x0f, "CoinIn Limit") PORT_DIPLOCATION("DSWE:8,7,6,5")
+ PORT_DIPSETTING( 0x00, " 1000" )
+ PORT_DIPSETTING( 0x01, " 2000" )
+ PORT_DIPSETTING( 0x02, " 3000" )
+ PORT_DIPSETTING( 0x03, " 4000" )
+ PORT_DIPSETTING( 0x04, " 5000" )
+ PORT_DIPSETTING( 0x05, " 6000" )
+ PORT_DIPSETTING( 0x06, " 7000" )
+ PORT_DIPSETTING( 0x07, " 8000" )
+ PORT_DIPSETTING( 0x08, " 9000" )
+ PORT_DIPSETTING( 0x09, "10000" )
+ PORT_DIPSETTING( 0x0a, "15000" )
+ PORT_DIPSETTING( 0x0b, "20000" )
+ PORT_DIPSETTING( 0x0c, "30000" )
+ PORT_DIPSETTING( 0x0d, "40000" )
+ PORT_DIPSETTING( 0x0e, "50000" )
+ PORT_DIPSETTING( 0x0f, " 5000" )
+ PORT_DIPNAME( 0x30, 0x30, "Preset BONUS" ) PORT_DIPLOCATION("DSWE:4,3")
+ PORT_DIPSETTING( 0x00, "1000" )
+ PORT_DIPSETTING( 0x10, "2000" )
+ PORT_DIPSETTING( 0x20, "3000" )
+ PORT_DIPSETTING( 0x30, "4000" )
+ PORT_DIPNAME( 0xc0, 0xc0, "Preset LEFT" ) PORT_DIPLOCATION("DSWE:2,1")
+ PORT_DIPSETTING( 0x00, "1000" )
+ PORT_DIPSETTING( 0x40, "2000" )
+ PORT_DIPSETTING( 0x80, "3000" )
+ PORT_DIPSETTING( 0xc0, "6000" )
+INPUT_PORTS_END
+
+
+static INPUT_PORTS_START( ssh2000a )
+ PORT_INCLUDE( ssh2000 )
+
+ // alt gfx (easter and fish themes)
+ PORT_MODIFY("DSWA")
+ PORT_DIPNAME( 0x04, 0x00, "Sprites" ) PORT_DIPLOCATION("DSWA:6")
+ PORT_DIPSETTING( 0x04, "Fruits")
+ PORT_DIPSETTING( 0x00, "Tiles")
+INPUT_PORTS_END
+
+
+/*****************************************************
+* Machine Config *
+*****************************************************/
+
+void ssh2000_state::ssh2000(machine_config &config)
+{
+ // basic machine hardware
+ Z80(config, m_maincpu, CPU_CLOCK);
+ m_maincpu->set_addrmap(AS_PROGRAM, &ssh2000_state::ssh2000_map);
+ m_maincpu->set_addrmap(AS_IO, &ssh2000_state::ssh2000_portmap);
+
+ // video hardware
+ screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
+ screen.set_refresh_hz(60);
+ screen.set_size(64*8, 32*8);
+ screen.set_visarea(0*8, 64*8-1, 2*8, 30*8-1);
+ screen.set_screen_update(FUNC(ssh2000_state::screen_update_ssh2000));
+ screen.screen_vblank().set_inputline(m_maincpu, 0, HOLD_LINE);
+
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_ss2001);
+
+ PALETTE(config, m_palette, FUNC(ssh2000_state::ssh2000_palette), 256);
+ NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1);
+
+ MCFG_VIDEO_START_OVERRIDE(ssh2000_state, ssh2000)
+
+ // sound hardware
+ SPEAKER(config, "mono").front_center();
+ ay8910_device &aysnd(AY8910(config, "aysnd", AY_CLOCK));
+ aysnd.port_a_read_callback().set_ioport("DSWD");
+ aysnd.port_b_read_callback().set_ioport("DSWE");
+ aysnd.add_route(ALL_OUTPUTS, "mono", 0.50);
+}
+
+
+/*****************************************************
+* ROMs Load *
+*****************************************************/
+
+/*
+ Super Shanghai 2000 (set 1)
+
+ type: SHG-47
+ version: 2000
+
+ green board.
+
+ Zilog Z80,
+ Winbond WF19054,
+ 5x 8 DSW banks
+
+*/
+ROM_START( ssh2000 )
+ ROM_REGION( 0x10000, "maincpu", 0 )
+ ROM_LOAD( "9.u26", 0x00000, 0x10000, CRC(9ddb0239) SHA1(15733481996de9becccd5b920e40220c6101becf) )
+
+ ROM_REGION( 0x40000, "gfx1", 0 ) // all devices are double size, with identical halves.
+ ROM_LOAD( "4.u4", 0x00000, 0x10000, CRC(bdca2cd5) SHA1(6139a697321475ac6fefac5b5a9f76c8de30f2f8) )
+ ROM_IGNORE(0x10000)
+ ROM_LOAD( "3.u3", 0x10000, 0x10000, CRC(c8db92f7) SHA1(3a77d9a21125e47396b06dc8c54625aa8ad54386) )
+ ROM_IGNORE(0x10000)
+ ROM_LOAD( "2.u2", 0x20000, 0x10000, CRC(7df72d1b) SHA1(ad61c3de89be547014ca123b72bb9775bad55cdd) )
+ ROM_IGNORE(0x10000)
+ ROM_LOAD( "1.u1", 0x30000, 0x10000, CRC(f4075f1c) SHA1(16513735e181e14a01fe24be6de0b22ef5a894eb) )
+ ROM_IGNORE(0x10000)
+
+ ROM_REGION( 0x40000, "gfx2", 0 ) // all devices are double size, with identical halves.
+ ROM_LOAD( "8.u8", 0x00000, 0x10000, CRC(2ad9778b) SHA1(05d8e0be028060cbe78ff1ff927f15f8114f8508) )
+ ROM_IGNORE(0x10000)
+ ROM_LOAD( "7.u7", 0x10000, 0x10000, CRC(03375cf9) SHA1(d336c4dff53a7368c9264a02fbc53afd0776a9cd) )
+ ROM_IGNORE(0x10000)
+ ROM_LOAD( "6.u6", 0x20000, 0x10000, CRC(a6194545) SHA1(74ddda87ad55e8bce1e986dde8fd371ab8843ceb) )
+ ROM_IGNORE(0x10000)
+ ROM_LOAD( "5.u5", 0x30000, 0x10000, CRC(c01acca1) SHA1(f2caed0b8624fb224f41323f15eaa9ce3fadd886) )
+ ROM_IGNORE(0x10000)
+
+ ROM_REGION( 0x2000, "other", 0 ) // bipolar PROM replacement, colour data is at 0x1800-0x18ff
+ ROM_LOAD( "d27hc65d.bin", 0x0000, 0x02000, CRC(af8ce88d) SHA1(59d59b6b739aed4f6ee618db04af9ab9d2873bed) )
+
+ ROM_REGION( 0x200, "proms", 0 )
+ ROM_COPY( "other", 0x1800, 0x0000, 0x0100 )
+ROM_END
+
+/*
+ Super Shanghai 2000 (set 2)
+
+ type: SHG-47
+ version: 2000
+
+ green board.
+
+ Zilog Z80,
+ Winbond WF19054,
+ 5x 8 DSW banks
+
+*/
+ROM_START( ssh2000a ) // main program (green board)
+ ROM_REGION( 0x10000, "maincpu", 0 )
+ ROM_LOAD( "main_program_set_2_green_board.bin", 0x00000, 0x10000, CRC(a5017fa0) SHA1(af985a15fe2c6195b3310ece8dc9e431d1b8c673) )
+
+ ROM_REGION( 0x40000, "gfx1", 0 ) // all 27c512, same gfx set as ss2001 but half size roms
+ ROM_LOAD( "rom4_m27c512.u4", 0x00000, 0x10000, CRC(2cd3eb2d) SHA1(31f804cf9ddcd7dd8501946f9bf2f8a13b5b48f3) )
+ ROM_LOAD( "rom3_m27c512.u3", 0x10000, 0x10000, CRC(56e6e11b) SHA1(0a20ef1e05ded62b0aece5a94565736cbc83edf7) )
+ ROM_LOAD( "rom2_m27c512.u2", 0x20000, 0x10000, CRC(d5d50ef8) SHA1(60016d62922b369ce78130b8a94d967585657cd1) )
+ ROM_LOAD( "rom1_m27c512.u1", 0x30000, 0x10000, CRC(52d1914b) SHA1(f8e5e7ba8809006e4109b82dd84e019d0d1e5447) )
+
+ ROM_REGION( 0x40000, "gfx2", 0 )
+ ROM_LOAD( "rom8_m27c512.u8", 0x00000, 0x10000, CRC(f6ef214c) SHA1(1f50ea87214b86416feda58fb5065175eb18df6a) )
+ ROM_LOAD( "rom7_m27c512.u7", 0x10000, 0x10000, CRC(a7c2a38b) SHA1(149ccc4b36bca6a149f3a26f5a580f34f4020ef3) )
+ ROM_LOAD( "rom6_m27c512.u6", 0x20000, 0x10000, CRC(dd228316) SHA1(2d618758e870224284efc0dc8d3a83f3447d0e48) )
+ ROM_LOAD( "rom5_m27c512.u5", 0x30000, 0x10000, CRC(57328ec5) SHA1(0f5cddb4b45ddef8f6d352220e32cff27edac2b4) )
+
+ ROM_REGION( 0x200, "proms", 0 )
+ ROM_LOAD( "am27s29.bin", 0x0000, 0x0200, CRC(3ad40503) SHA1(5f7516001ac4286df3ca4f6ab36882a15019546a) )
+ROM_END
+
+/*
+ Super Shanghai 2000
+ Wrestle Fiesta.
+ Main program 30% bonus by Vegas (red board)
+
+ type: SHG-47
+ version: 2000
+
+ red board.
+
+ TMPZ84C00AP-8,
+ Winbond WF19054,
+ 5x 8 DSW banks
+
+*/
+ROM_START( ssh2000wf )
+ ROM_REGION( 0x10000, "maincpu", 0 )
+ ROM_LOAD( "main_program_set_3_red_board.bin", 0x00000, 0x10000, CRC(4aaa348c) SHA1(a33656798807906ce72351a1740f77563c5b2640) )
+
+ ROM_REGION( 0x40000, "gfx1", 0 )
+ ROM_LOAD( "27c512.u4", 0x00000, 0x10000, CRC(e3adb317) SHA1(817a885236c28dc5dee02cc1d7e9e1c780560cae) )
+ ROM_LOAD( "27c512.u3", 0x10000, 0x10000, CRC(0c2cd067) SHA1(a1c749ee0c0c3d25a80af6d56c41057430646ce9) )
+ ROM_LOAD( "27c512.u2", 0x20000, 0x10000, CRC(5983a654) SHA1(6374e1fb0eda2454370e54d4dd8bf6c82b2f177e) )
+ ROM_LOAD( "27c512.u1", 0x30000, 0x10000, CRC(26df6ee7) SHA1(3221639174b432ea93e0db33b7554f2ce8125052) )
+
+ ROM_REGION( 0x40000, "gfx2", 0 )
+ ROM_LOAD( "27c512.u8", 0x00000, 0x10000, CRC(1444ee50) SHA1(6e6137869d4c46762bab92ed54071d9292243532) )
+ ROM_LOAD( "27c512.u7", 0x10000, 0x10000, CRC(f26a3eeb) SHA1(83bbe0b068549f3bceb083d17894fb080e9b58a1) )
+ ROM_LOAD( "27c512.u6", 0x20000, 0x10000, CRC(096c691a) SHA1(59a45ad654981cdfecaa3390253850491baccb9f) )
+ ROM_LOAD( "27c512.u5", 0x30000, 0x10000, CRC(e693e419) SHA1(8834419d02eb0f4f4a1619195a87b00e3f315a39) )
+
+ ROM_REGION( 0x200, "proms", 0 )
+ ROM_LOAD( "am27s29.bin", 0x0000, 0x0200, CRC(3ad40503) SHA1(5f7516001ac4286df3ca4f6ab36882a15019546a) )
+ROM_END
+
+
+/*********************************************************************************************************************/
+
+} // anonymous namespace
+
+
+/*********************************************
+* Game Drivers *
+*********************************************/
+
+// YEAR NAME PARENT MACHINE INPUT STATE INIT ROT COMPANY FULLNAME FLAGS
+GAME( 2001, ssh2000, 0, ssh2000, ssh2000, ssh2000_state, empty_init, ROT0, "bootleg", "Super Shanghai 2000 (set 1, green board)", 0 )
+GAME( 2000, ssh2000a, ssh2000, ssh2000, ssh2000a, ssh2000_state, empty_init, ROT0, "bootleg", "Super Shanghai 2000 (set 2, green board)", 0 )
+GAME( 2000, ssh2000wf, 0, ssh2000, ssh2000a, ssh2000_state, empty_init, ROT0, "bootleg", "Super Shanghai 2000 - Wrestle Fiesta (30% bonus, red board)", 0 )
diff --git a/src/mame/misc/sttechno.cpp b/src/mame/misc/sttechno.cpp
index 87ee840a839..db1f54c861f 100644
--- a/src/mame/misc/sttechno.cpp
+++ b/src/mame/misc/sttechno.cpp
@@ -595,13 +595,12 @@ void sttechno_state::shambros(machine_config &config)
FUJITSU_29F160TE_16BIT(config, m_flash[1]);
FUJITSU_29F160TE_16BIT(config, m_video_flash);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
STT_SA1(config, m_sound, XTAL(42'954'545) / 3);
m_sound->set_addrmap(0, &sttechno_state::sound_map);
- m_sound->add_route(0, "lspeaker", 1.0);
- m_sound->add_route(1, "rspeaker", 1.0);
+ m_sound->add_route(0, "speaker", 1.0, 0);
+ m_sound->add_route(1, "speaker", 1.0, 1);
TIMER(config, "irq6_timer").configure_periodic(FUNC(sttechno_state::irq6_timer), attotime::from_hz(XTAL(42'954'545) / 3 / 448 / 128)); // probably some interrupt?
RS232_PORT(config, m_rs232, sttechno_debug_serial_devices, nullptr);
diff --git a/src/mame/misc/tapatune.cpp b/src/mame/misc/tapatune.cpp
index a10dc98bdb9..454d4646a1f 100644
--- a/src/mame/misc/tapatune.cpp
+++ b/src/mame/misc/tapatune.cpp
@@ -542,12 +542,11 @@ void tapatune_state::tapatune_base(machine_config &config)
TICKET_DISPENSER(config, "ticket", attotime::from_msec(100));
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
BSMT2000(config, m_bsmt, XTAL(24'000'000));
- m_bsmt->add_route(0, "lspeaker", 1.0);
- m_bsmt->add_route(1, "rspeaker", 1.0);
+ m_bsmt->add_route(0, "speaker", 1.0, 0);
+ m_bsmt->add_route(1, "speaker", 1.0, 1);
}
void tapatune_state::tapatune(machine_config &config)
diff --git a/src/mame/misc/thayers.cpp b/src/mame/misc/thayers.cpp
index cebe0e792e1..f9247fadbf7 100644
--- a/src/mame/misc/thayers.cpp
+++ b/src/mame/misc/thayers.cpp
@@ -680,15 +680,14 @@ void thayers_state::thayers(machine_config &config)
screen.set_screen_update(m_player, FUNC(pioneer_ldv1000hle_device::screen_update));
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
- m_player->add_route(0, "lspeaker", 1.0);
- m_player->add_route(1, "rspeaker", 1.0);
+ SPEAKER(config, "speaker", 2).front();
+ m_player->add_route(0, "speaker", 1.0, 0);
+ m_player->add_route(1, "speaker", 1.0, 1);
SSI263HLE(config, m_ssi, 860000);
m_ssi->ar_callback().set(FUNC(thayers_state::ssi_data_request_w));
- m_ssi->add_route(0, "lspeaker", 1.0);
- m_ssi->add_route(1, "lspeaker", 1.0);
+ m_ssi->add_route(0, "speaker", 1.0, 0);
+ m_ssi->add_route(1, "speaker", 1.0, 0);
}
diff --git a/src/mame/misc/tomsadvs.cpp b/src/mame/misc/tomsadvs.cpp
index 2071932a48a..f817a85c671 100644
--- a/src/mame/misc/tomsadvs.cpp
+++ b/src/mame/misc/tomsadvs.cpp
@@ -73,16 +73,15 @@ void tomsadvs_state::tomsadvs(machine_config &config)
{
I80C32(config, m_maincpu, 12.288_MHz_XTAL); // Actually a Winbond W87C32C-40
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
okim6295_device &oki1(OKIM6295(config, "oki1", 12.288_MHz_XTAL/16, okim6295_device::PIN7_HIGH)); // Clock frequency & pin 7 not verified
- oki1.add_route(ALL_OUTPUTS, "lspeaker", 0.45); // Guess
- oki1.add_route(ALL_OUTPUTS, "rspeaker", 0.45); // Guess
+ oki1.add_route(ALL_OUTPUTS, "speaker", 0.45, 0); // Guess
+ oki1.add_route(ALL_OUTPUTS, "speaker", 0.45, 1); // Guess
okim6295_device &oki2(OKIM6295(config, "oki2", 12.288_MHz_XTAL/16, okim6295_device::PIN7_HIGH)); // Clock frequency & pin 7 not verified
- oki2.add_route(ALL_OUTPUTS, "lspeaker", 0.45); // Guess
- oki2.add_route(ALL_OUTPUTS, "rspeaker", 0.45); // Guess
+ oki2.add_route(ALL_OUTPUTS, "speaker", 0.45, 0); // Guess
+ oki2.add_route(ALL_OUTPUTS, "speaker", 0.45, 1); // Guess
}
ROM_START(tomsadvs)
diff --git a/src/mame/misc/vamphalf.cpp b/src/mame/misc/vamphalf.cpp
index aa647cb0631..5c03e37be18 100644
--- a/src/mame/misc/vamphalf.cpp
+++ b/src/mame/misc/vamphalf.cpp
@@ -1148,14 +1148,13 @@ void vamphalf_state::common(machine_config &config)
void vamphalf_state::sound_ym_oki(machine_config &config)
{
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- YM2151(config, "ymsnd", 28_MHz_XTAL / 8).add_route(0, "lspeaker", 1.0).add_route(1, "rspeaker", 1.0); // 3.5MHz
+ YM2151(config, "ymsnd", 28_MHz_XTAL / 8).add_route(0, "speaker", 1.0, 0).add_route(1, "speaker", 1.0, 1); // 3.5MHz
okim6295_device &oki1(OKIM6295(config, "oki1", 28_MHz_XTAL / 16 , okim6295_device::PIN7_HIGH)); // 1.75MHz
- oki1.add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- oki1.add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ oki1.add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ oki1.add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
}
void vamphalf_state::sound_ym_banked_oki(machine_config &config)
@@ -1166,21 +1165,19 @@ void vamphalf_state::sound_ym_banked_oki(machine_config &config)
void vamphalf_state::sound_suplup(machine_config &config)
{
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- YM2151(config, "ymsnd", 14.318181_MHz_XTAL / 4).add_route(0, "lspeaker", 1.0).add_route(1, "rspeaker", 1.0); // 3.579545 MHz
+ YM2151(config, "ymsnd", 14.318181_MHz_XTAL / 4).add_route(0, "speaker", 1.0, 0).add_route(1, "speaker", 1.0, 1); // 3.579545 MHz
okim6295_device &oki1(OKIM6295(config, "oki1", 14.318181_MHz_XTAL / 8, okim6295_device::PIN7_HIGH)); // 1.75MHz
- oki1.add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- oki1.add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ oki1.add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ oki1.add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
}
void vamphalf_state::sound_qs1000(machine_config &config)
{
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set("qs1000", FUNC(qs1000_device::set_irq));
@@ -1190,8 +1187,8 @@ void vamphalf_state::sound_qs1000(machine_config &config)
qs1000.set_external_rom(true);
qs1000.p1_in().set("soundlatch", FUNC(generic_latch_8_device::read));
qs1000.p3_out().set(FUNC(vamphalf_state::qs1000_p3_w));
- qs1000.add_route(0, "lspeaker", 1.0);
- qs1000.add_route(1, "rspeaker", 1.0);
+ qs1000.add_route(0, "speaker", 1.0, 0);
+ qs1000.add_route(1, "speaker", 1.0, 1);
}
void vamphalf_state::vamphalf(machine_config &config)
@@ -1351,19 +1348,18 @@ void vamphalf_state::aoh(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_vamphalf);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- YM2151(config, "ymsnd", 3.579545_MHz_XTAL).add_route(0, "lspeaker", 1.0).add_route(1, "rspeaker", 1.0);
+ YM2151(config, "ymsnd", 3.579545_MHz_XTAL).add_route(0, "speaker", 1.0, 0).add_route(1, "speaker", 1.0, 1);
okim6295_device &oki1(OKIM6295(config, "oki1", 32_MHz_XTAL / 8, okim6295_device::PIN7_HIGH)); // 4MHz
- oki1.add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- oki1.add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ oki1.add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ oki1.add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
okim6295_device &oki2(OKIM6295(config, "oki2", 32_MHz_XTAL / 32, okim6295_device::PIN7_HIGH)); // 1MHz
oki2.set_addrmap(0, &vamphalf_state::banked_oki_map);
- oki2.add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- oki2.add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ oki2.add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ oki2.add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
}
void vamphalf_state::boonggab(machine_config &config)
diff --git a/src/mame/misc/vocalizer.cpp b/src/mame/misc/vocalizer.cpp
index 7b8d73a1455..2ee04be9816 100644
--- a/src/mame/misc/vocalizer.cpp
+++ b/src/mame/misc/vocalizer.cpp
@@ -522,8 +522,7 @@ void vocalizer_state::vocalizer(machine_config &config)
m_lcdc->set_lcd_size(2, 8);
m_lcdc->set_pixel_update_cb(FUNC(vocalizer_state::lcd_pixel_update));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ES5503(config, m_es5503, 8_MHz_XTAL).set_channels(16);
m_es5503->set_addrmap(0, &vocalizer_state::sound_map);
@@ -531,14 +530,14 @@ void vocalizer_state::vocalizer(machine_config &config)
for (int i = 0; i < 16; i++)
{
if (i <= 8)
- m_es5503->add_route(i, "lspeaker", 1.0);
+ m_es5503->add_route(i, "speaker", 1.0, 0);
else if (i < 15)
- m_es5503->add_route(i, "lspeaker", (15 - i) / 7.0);
+ m_es5503->add_route(i, "speaker", (15 - i) / 7.0, 0);
if (i >= 8)
- m_es5503->add_route(i, "rspeaker", 1.0);
+ m_es5503->add_route(i, "speaker", 1.0, 1);
else if (i > 0)
- m_es5503->add_route(i, "rspeaker", i / 8.0);
+ m_es5503->add_route(i, "speaker", i / 8.0, 1);
}
}
diff --git a/src/mame/misc/xtom3d.cpp b/src/mame/misc/xtom3d.cpp
index 6352416a705..d714f134d9b 100644
--- a/src/mame/misc/xtom3d.cpp
+++ b/src/mame/misc/xtom3d.cpp
@@ -365,12 +365,11 @@ void isa16_xtom3d_io_sound::device_add_mconfig(machine_config &config)
// explicitly wants 16, cfr. pumpit1 eeprom test
EEPROM_93C46_16BIT(config, "eeprom");
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
YMZ280B(config, m_ymz, XTAL(16'934'400));
- m_ymz->add_route(0, "lspeaker", 0.5);
- m_ymz->add_route(1, "rspeaker", 0.5);
+ m_ymz->add_route(0, "speaker", 0.5, 0);
+ m_ymz->add_route(1, "speaker", 0.5, 1);
}
static INPUT_PORTS_START(xtom3d)
diff --git a/src/mame/misc/yuvomz80.cpp b/src/mame/misc/yuvomz80.cpp
index aa308c49e30..55cdf63fedf 100644
--- a/src/mame/misc/yuvomz80.cpp
+++ b/src/mame/misc/yuvomz80.cpp
@@ -132,12 +132,11 @@ void yuvomz80_state::hexaprsz(machine_config &config)
I8255A(config, "ppi2", 0);
I8255A(config, "ppi3", 0);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ymz280b_device &ymz(YMZ280B(config, "ymz", XTAL(16'934'400)));
- ymz.add_route(0, "lspeaker", 1.00);
- ymz.add_route(1, "rspeaker", 1.00);
+ ymz.add_route(0, "speaker", 1.00, 0);
+ ymz.add_route(1, "speaker", 1.00, 1);
}
ROM_START( hexaprs )
diff --git a/src/mame/moog/nl_source.cpp b/src/mame/moog/nl_source.cpp
new file mode 100644
index 00000000000..04c41d91ab5
--- /dev/null
+++ b/src/mame/moog/nl_source.cpp
@@ -0,0 +1,102 @@
+#include "netlist/devices/net_lib.h"
+
+NETLIST_START(moogsource)
+{
+ SOLVER(Solver, 1000) // Used for DC calculations, so a low frequency is fine.
+
+ ANALOG_INPUT(VPLUS, 15)
+ ANALOG_INPUT(VMINUS, -15)
+ // Voltage at the CA3080's Iabc input. One diode drop above -15V.
+ ANALOG_INPUT(CA3080_VABC, -14.3)
+
+
+ // Voltage-to-exponential-current converter for the filter contour generator.
+ // Generates the control current for U44 (CA3080A).
+
+ // Inputs.
+ ANALOG_INPUT(FLT_CNTR_RATE)
+ POT(R201, RES_K(100)) // 'Range' pot.
+
+ RES(R199, RES_K(43.2)) // 1% tolerance.
+ RES(R200, RES_K(470))
+ RES(R202, RES_M(1))
+ RES(R203, RES_K(1)) // 1% tolerance.
+ QBJT_EB(Q35, "2N3904")
+ RES(R204, RES_K(100))
+ QBJT_EB(Q36, "2N3906")
+ RES(R198, RES_K(10))
+
+ NET_C(FLT_CNTR_RATE, R199.1)
+ NET_C(R199.2, R200.1, R202.1, R203.1, Q35.B)
+ NET_C(R200.2, R201.2)
+ NET_C(Q35.E, R204.1, Q36.B)
+ NET_C(Q36.C, R198.1)
+ NET_C(R198.2, CA3080_VABC)
+ NET_C(VPLUS, Q35.C)
+ NET_C(GND, R201.1, R203.2, Q36.E)
+ NET_C(VMINUS, R201.3, R202.2, R204.2)
+
+ ALIAS(FLT_CNTR_CV, R198.1) // Output.
+
+
+ // Voltage-to-exponential-current converter for the loudness contour generator.
+ // Generates the control current for U42 (CA3080A). Identical to the circuit
+ // above.
+
+ // Inputs.
+ ANALOG_INPUT(LOUD_CNTR_RATE, 0)
+ POT(R179, RES_K(100)) // 'Range' pot.
+
+ RES(R177, RES_K(43.2)) // 1% tolerance.
+ RES(R178, RES_K(470))
+ RES(R180, RES_M(1))
+ RES(R181, RES_K(1)) // 1% tolerance.
+ QBJT_EB(Q33, "2N3904")
+ RES(R185, RES_K(100))
+ QBJT_EB(Q34, "2N3906")
+ RES(R186, RES_K(10))
+
+ NET_C(LOUD_CNTR_RATE, R177.1)
+ NET_C(R177.2, R178.1, R180.1, R181.1, Q33.B)
+ NET_C(R178.2, R179.2)
+ NET_C(Q33.E, R185.1, Q34.B)
+ NET_C(Q34.C, R186.1)
+ NET_C(R186.2, CA3080_VABC)
+ NET_C(VPLUS, Q33.C)
+ NET_C(GND, R179.1, R181.2, Q34.E)
+ NET_C(VMINUS, R179.3, R180.2, R185.2)
+
+ ALIAS(LOUD_CNTR_CV, R186.1) // Output.
+
+
+ // Voltage-to-exponential-current converter for the LFO. Generates the
+ // control current for U49 (CA3080A). Almost identical to the circuit above,
+ // except for a resistor value and the 'range' potentiometer being connected
+ // to +15V instead of -15V.
+
+ // Inputs.
+ ANALOG_INPUT(MOD_RATE, 0)
+ POT(R223, RES_K(100)) // 'Range' pot.
+
+ RES(R221, RES_K(49.9)) // 1% tolerance.
+ RES(R222, RES_K(470))
+ RES(R224, RES_M(1))
+ RES(R225, RES_K(1)) // 1% tolerance.
+ QBJT_EB(Q38, "2N3904")
+ RES(R226, RES_K(100))
+ QBJT_EB(Q39, "2N3906")
+ RES(R227, RES_K(10))
+
+ NET_C(MOD_RATE, R221.1)
+ NET_C(R221.2, R222.1, R224.1, R225.1, Q38.B)
+ NET_C(R222.2, R223.2)
+ NET_C(Q38.E, R226.1, Q39.B)
+ NET_C(Q39.C, R227.1)
+ NET_C(R227.2, CA3080_VABC)
+ NET_C(VPLUS, R223.3, Q38.C)
+ NET_C(GND, R223.1, R225.2, Q39.E)
+ NET_C(VMINUS, R224.2, R226.2)
+
+ ALIAS(MOD_CV, R227.1) // Output.
+}
+
diff --git a/src/mame/moog/source.cpp b/src/mame/moog/source.cpp
index eadb32ca697..939c39c1dc3 100644
--- a/src/mame/moog/source.cpp
+++ b/src/mame/moog/source.cpp
@@ -29,21 +29,20 @@ comments refer to Board 3, unless otherwise noted.
This driver attempts to accurately emulate the digital and digital-analog
interface of the synthesizer, including all analog behavior that is relevant to
-the firmware. There are still some TODOs left to fully achieve this goal. There
-is no attempt to emulate the analogue audio circuit. The driver includes an
+the firmware. The analog audio circuit is not emulated. The driver includes an
interactive layout, and is intended as an educational tool.
-
-TODO:
-- Emulation of MOD input to the CPU.
-- Emulation of envelope generator timing.
-- Cassette input/output.
*/
#include "emu.h"
#include "cpu/z80/z80.h"
+#include "machine/netlist.h"
#include "machine/nvram.h"
#include "machine/rescap.h"
+#include "machine/timer.h"
+#include "sound/va_eg.h"
+
+#include "netlist/nl_setup.h"
#include "moog_source.lh"
@@ -52,12 +51,17 @@ TODO:
#define LOG_ENCODER (1U << 3)
#define LOG_KEYBOARD (1U << 4)
#define LOG_CV_KEYBOARD_APPROX (1U << 5)
+#define LOG_LFO (1U << 6)
+#define LOG_LFO_TIMER (1U << 7)
+#define LOG_CONTOUR (1U << 8)
#define VERBOSE (LOG_GENERAL | LOG_CV)
//#define LOG_OUTPUT_FUNC osd_printf_info
#include "logmacro.h"
+NETLIST_EXTERNAL(moogsource) // In nl_source.cpp.
+
namespace {
constexpr const char MAINCPU_TAG[] = "z80";
@@ -66,17 +70,25 @@ constexpr const char NVRAM_TAG[] = "nvram";
class source_state : public driver_device
{
public:
+ static constexpr feature_type unemulated_features() { return feature::TAPE; }
+
source_state(const machine_config &mconfig, device_type type, const char *tag) ATTR_COLD
: driver_device(mconfig, type, tag)
, m_maincpu(*this, MAINCPU_TAG)
+ , m_contour(*this, "contour_%d", 0)
+ , m_contour_rate(*this, "source_nl:cntr_rate_%d", 0)
+ , m_contour_range(*this, "contour_range_%d",0)
+ , m_lfo_timer(*this, "lfo_timer")
+ , m_lfo_rate(*this, "source_nl:lfo_rate")
+ , m_lfo_range(*this, "lfo_range")
, m_octave_io(*this, "octave_buttons")
, m_button_a_io(*this, "button_group_a_%d", 0U)
, m_button_b_io(*this, "button_group_b_%d", 0U)
, m_keyboard_io(*this, "keyboard_oct_%d", 1U)
, m_encoder(*this, "incremental_controller")
, m_trigger_io(*this, "trigger_in")
- , m_contour_peaked_io(*this, "contour_peaked")
, m_octave_led(*this, "octave_led_%d")
+ , m_lfo_rate_led(*this, "mod_rate_led")
, m_program_display(*this, "program_digit_%d")
, m_edit_display(*this, "edit_digit_%d")
, m_edit_led(*this, "edit_led")
@@ -87,7 +99,7 @@ public:
, m_lfo_to_osc(*this, "lfo_to_osc")
, m_lfo_shape(*this, "lfo_shape")
, m_trigger_out(*this, "trigger_out")
- , m_cv(static_cast<int>(CV::SIZE), -1)
+ , m_cv(int(CV::SIZE), 0)
{}
void source(machine_config &config) ATTR_COLD;
@@ -110,6 +122,7 @@ private:
void cassette_w(u8 data);
void cv_w(offs_t offset, u8 data);
+ bool contour_peaked(const va_rc_eg_device &eg) const;
float get_keyboard_v() const;
u8 keyboard_r();
u8 buttons_r(const required_ioport_array<6> &button_io, const char *name) const;
@@ -117,19 +130,35 @@ private:
u8 buttons_b_r();
u8 encoder_r();
+ template<int Which> NETDEV_ANALOG_CALLBACK_MEMBER(contour_cv_changed);
+ template<int Which> TIMER_CALLBACK_MEMBER(update_contour);
+
+ NETDEV_ANALOG_CALLBACK_MEMBER(lfo_cv_changed);
+ TIMER_CALLBACK_MEMBER(update_lfo_timer);
+ TIMER_DEVICE_CALLBACK_MEMBER(lfo_timer_tick);
+
void memory_map(address_map &map) ATTR_COLD;
void io_map(address_map &map) ATTR_COLD;
required_device<z80_device> m_maincpu;
+
+ required_device_array<va_rc_eg_device, 2> m_contour;
+ required_device_array<netlist_mame_analog_input_device, 2> m_contour_rate;
+ required_ioport_array<2> m_contour_range;
+
+ required_device<timer_device> m_lfo_timer;
+ required_device<netlist_mame_analog_input_device> m_lfo_rate;
+ required_ioport m_lfo_range;
+
required_ioport m_octave_io;
required_ioport_array<6> m_button_a_io;
required_ioport_array<6> m_button_b_io;
required_ioport_array<4> m_keyboard_io;
required_ioport m_encoder;
required_ioport m_trigger_io;
- required_ioport m_contour_peaked_io;
output_finder<2> m_octave_led;
+ output_finder<> m_lfo_rate_led;
output_finder<2> m_program_display;
output_finder<2> m_edit_display;
output_finder<> m_edit_led;
@@ -144,9 +173,18 @@ private:
bool m_octave_hi = true; // `true` due to internal pullups of 74LS367 and 7404.
u8 m_button_row_latch = 0xff;
bool m_encoder_incr = false;
+ bool m_lfo_state = false; // Square output of the LFO. -14V (false) to 14V (true).
+ float m_lfo_cc = 0; // Control current into the LFO OTA.
+ std::array<float, 2> m_contour_cc = { 0, 0 }; // Control currents into the EG OTAs.
std::vector<float> m_cv;
+ enum contour_type
+ {
+ FILTER_CONTOUR = 0,
+ LOUDNESS_CONTOUR
+ };
+
// All MUXes are CD4051B.
// Component designations refer to board 2 (synthesizer board).
// The enum names match the CV labels in the schematic, but some
@@ -167,7 +205,7 @@ private:
FILTER_CONTOUR_LEVEL,
OCT_1,
GLIDE,
- LOUDNESS_COUNTOUR_LEVEL,
+ LOUDNESS_CONTOUR_LEVEL,
OSC_2,
NOISE,
UNUSED, // Sampled in (C22, U10A), but not used.
@@ -177,7 +215,7 @@ private:
EMPHASIS,
NOT_CONNECTED, // U5, Y1 (pin 14) is not connected.
AMT, // Filter contout amount.
- RATE, // Modulation (LFO) rate.
+ MOD_RATE, // Modulation (LFO) rate.
KEYBOARD_APPROX,
KEYBOARD_CV,
FILTER_CONTOUR_RATE,
@@ -186,7 +224,10 @@ private:
SIZE
};
+ static constexpr const float VMINUS = -15; // In Volts.
static constexpr const float MAX_CV = 10; // In Volts.
+ static constexpr const float CA3080_VABC = VMINUS + 0.7; // 1 diode drop above -15.
+ static constexpr const float CONTOUR_C = CAP_U(0.047); // C57 (filter), C56 (loudness).
static constexpr const u8 PATTERNS_7447[16] =
{
0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7c, 0x07,
@@ -363,7 +404,7 @@ void source_state::cv_w(offs_t offset, u8 data)
// Z80 A3,A4 select which MUX to enable via decoder 74LS155.
// The fourth output of the decoder is not connected. There are 3 muxes.
- if (offset >= static_cast<int>(CV::SIZE))
+ if (offset >= offs_t(CV::SIZE))
return;
const float cv = MAX_CV * data / 255.0F;
@@ -371,13 +412,75 @@ void source_state::cv_w(offs_t offset, u8 data)
return;
m_cv[offset] = cv;
- if (offset == static_cast<int>(CV::KEYBOARD_APPROX))
- LOGMASKED(LOG_CV_KEYBOARD_APPROX,
- "CV %d: 0x%02x, %f\n", offset, data, cv);
+ switch (offset)
+ {
+ case offs_t(CV::MOD_RATE):
+ m_lfo_rate->write(cv);
+ break;
+ case offs_t(CV::LOUDNESS_CONTOUR_RATE):
+ m_contour_rate[LOUDNESS_CONTOUR]->write(cv);
+ break;
+ case offs_t(CV::LOUDNESS_CONTOUR_LEVEL):
+ machine().scheduler().synchronize(timer_expired_delegate(FUNC(source_state::update_contour<LOUDNESS_CONTOUR>), this));
+ break;
+ case offs_t(CV::FILTER_CONTOUR_RATE):
+ m_contour_rate[FILTER_CONTOUR]->write(cv);
+ break;
+ case offs_t(CV::FILTER_CONTOUR_LEVEL):
+ machine().scheduler().synchronize(timer_expired_delegate(FUNC(source_state::update_contour<FILTER_CONTOUR>), this));
+ break;
+ }
+
+ if (offset == offs_t(CV::KEYBOARD_APPROX))
+ LOGMASKED(LOG_CV_KEYBOARD_APPROX, "CV %d: 0x%02x, %f\n", offset, data, cv);
else
LOGMASKED(LOG_CV, "CV %d: 0x%02x, %f\n", offset, data, cv);
}
+bool source_state::contour_peaked(const va_rc_eg_device &eg) const
+{
+ // The peak detector circuits for the filter and loudness contour generators
+ // are identical. They are located on board 2, and based on an LM393 comparator
+ // (U41B and U41A respectively). The threshold is set to ~9.984V, with a
+ // +-0.005V hysteresis. The EG output is connected to the inverting input.
+ // The comparator output is 0V when the EG output is above the threshold, and
+ // 5V otherwise (open collector output pulled to 5V via 10K resistors, R193
+ // and R190 respectively).
+
+ static constexpr const float R192 = RES_M(4.7); // R188 for loudness EG.
+ static constexpr const float R191 = RES_K(10); // R189 for loudness EG.
+ static constexpr const float RISING_THRESHOLD = 5 * RES_VOLTAGE_DIVIDER(R191, R192) + 5;
+ static constexpr const float FALLING_THRESHOLD = 10 * RES_VOLTAGE_DIVIDER(R191, R192);
+ static_assert(RISING_THRESHOLD > FALLING_THRESHOLD);
+
+ const float eg_v = eg.get_v();
+ if (eg_v > RISING_THRESHOLD)
+ {
+ return true;
+ }
+ else if (eg_v < FALLING_THRESHOLD)
+ {
+ return false;
+ }
+ else // eg_v is within the hysteresis range.
+ {
+ // Proper emulation of hysteresis would require a streaming (or otherwise
+ // stateful) comparator. But a heuristic tailored to this use case works
+ // fine: if the EG voltage is falling, assume we hit the 'rising' threshold
+ // in the past, so the 'falling' threshold is the active one.
+
+ // This heuristic will pick the wrong threshold if a key is released while
+ // the EG is within the hysteresis range. But that should be rare (the
+ // hysteresis range is ~0.01V), and inconsequential. The difference in
+ // thresholds is very small, and the firmware is the one that initiates
+ // the EG release and is probably ignoring this input until the next
+ // attack.
+
+ const float future_eg_v = eg.get_v(machine().time() + attotime::from_msec(1));
+ return future_eg_v < eg_v;
+ }
+}
+
float source_state::get_keyboard_v() const
{
// *** Detect which key is pressed.
@@ -445,19 +548,15 @@ u8 source_state::keyboard_r()
// firmware does a binary search by checking the result of the comparison
// and updating the "KYBD APPROX" CV accordingly.
// TODO: Compute keyboard voltage in an input callback.
- static constexpr const int KB_APPROX_INDEX =
- static_cast<int>(CV::KEYBOARD_APPROX);
- const u8 d0 = (get_keyboard_v() >= m_cv[KB_APPROX_INDEX]) ? 1 : 0;
-
- // D1, D2: Loudness and Filter contour peaks.
- // D1 <- U32, FILT CNTR <- S22-11: 0 when envolope reaches almost 10V
- // (with some hysteresis).
- // D2 <- U32, LOUD CNTR <- S22-10: 0 when envelope reaches almost 10V
- // (with some hysteresis).
- // TODO: Treating as inputs for now, until contour timing is emulated.
- const u8 contour_peaked = m_contour_peaked_io->read();
- const u8 d1 = BIT(contour_peaked, 0);
- const u8 d2 = BIT(contour_peaked, 1);
+ const u8 d0 = (get_keyboard_v() >= m_cv[int(CV::KEYBOARD_APPROX)]) ? 1 : 0;
+
+ // D1 - Filter contour peak reached (active low).
+ // D1 <- U32, FILT CNTR <- S22-11 <- Comparator (U41B, LM393).
+ const u8 d1 = contour_peaked(*m_contour[FILTER_CONTOUR]) ? 0 : 1;
+
+ // D2 - Loudness contour peak reached (active low).
+ // D2 <- U32, LOUD CNTR <- S22-10 <- Comparator (U41A, LM393).
+ const u8 d2 = contour_peaked(*m_contour[LOUDNESS_CONTOUR]) ? 0 : 1;
// D3: Octave. <- U32, OCT (P34-2 (octave 0 button) and P34-1 (octave +1
// button) via U2B and U2C).
@@ -466,8 +565,12 @@ u8 source_state::keyboard_r()
// D4 <- J1-4, CASSETTE IN (through "cassette return" circuit and U18D).
const u8 d4 = 1; // TODO: Implement.
- // D5 <- U32, MOD (->P34-5) 1 when s22-5 low, otherwise 0.
- const u8 d5 = 0; // TODO: Implement.
+ // D5 <- U32 D5 <- MOD.
+ // The square wave output of the LFO (~ -14V - 14V, connection S33-5) is
+ // inverted and level-shifted by Q5, R85, R86. The emitter of Q4 (signal
+ // name "MOD") is connected to U32's D5, and to the cathode of the "MOD
+ // RATE" LED (connection P34-5).
+ const u8 d5 = m_lfo_state ? 0 : 1;
// D6 <- J2-5, S-TRIG IN, through U18C, pulled up by R23 and protected by
// R22.
@@ -489,7 +592,7 @@ u8 source_state::buttons_r(
for (int i = 0; i < 6; ++i)
{
if (!BIT(m_button_row_latch, i))
- pressed |= static_cast<u8>(~button_io[i]->read() & 0xff);
+ pressed |= u8(~button_io[i]->read() & 0xff);
}
// Bits 6 and 7 are not connected to the button input and pulled high.
pressed |= 0xc0;
@@ -526,6 +629,138 @@ u8 source_state::encoder_r()
return m_encoder_incr ? 1 : 0;
}
+template<int Which> NETDEV_ANALOG_CALLBACK_MEMBER(source_state::contour_cv_changed)
+{
+ // The control current (Iabc) into each envelope generator ("contour") CA3080
+ // is determined by a voltage-to-exponential-current converter (see relevant
+ // netlist).
+
+ // This callback is invoked by the netlist simulation when the control current
+ // changes. This happens when the firmware sets a new (dis)charge rate, or if
+ // the "range" trimmer is adjusted.
+
+ static_assert(Which == FILTER_CONTOUR || Which == LOUDNESS_CONTOUR);
+ static constexpr const char *CONTOUR_NAME = (Which == FILTER_CONTOUR) ? "Filter" : "Loudness";
+ static constexpr const int RATE_CV_INDEX =
+ (Which == FILTER_CONTOUR) ? int(CV::FILTER_CONTOUR_RATE) : int(CV::LOUDNESS_CONTOUR_RATE);
+
+ // The netlist outputs a voltage. Convert it to a current.
+ m_contour_cc[Which] = (data - CA3080_VABC) / RES_K(10); // R198 for filter, R186 for loudness.
+ machine().scheduler().synchronize(timer_expired_delegate(FUNC(source_state::update_contour<Which>), this));
+
+ LOGMASKED(LOG_CONTOUR, "%s contour CC: %f uA, rate CV: %f, range trimmer: %d\n",
+ CONTOUR_NAME, m_contour_cc[Which] * 1e6F, m_cv[RATE_CV_INDEX], m_contour_range[Which]->read());
+}
+
+// Must be called with machine().scheduler().synchronize(...), to ensure the EG
+// updates use the global time.
+template<int Which> TIMER_CALLBACK_MEMBER(source_state::update_contour)
+{
+ // Each of the voltage-controlled envelope generators (called "contours" on
+ // the schematic) are based on a CA3080 OTA configured as a current-controlled
+ // resistor. This configuration is explained in the first 10 minutes of
+ // https://www.youtube.com/watch?v=pTHHzFsa4Ss
+
+ // The OTA (dis)charges a capacitor to the level set by the firmware.
+ // Charge rate is controlled by the Iabc current into the OTA, which is
+ // also contrlled by the firmware (see contour_cv_changed()).
+
+ static_assert(Which == FILTER_CONTOUR || Which == LOUDNESS_CONTOUR);
+ static constexpr const char *CONTOUR_NAME = (Which == FILTER_CONTOUR) ? "Filter" : "Loudness";
+ static constexpr const int LEVEL_CV_INDEX =
+ (Which == FILTER_CONTOUR) ? int(CV::FILTER_CONTOUR_LEVEL) : int(CV::LOUDNESS_CONTOUR_LEVEL);
+
+ // All componets are on board 2. All resistors have 1% tolerance.
+ // Filter contour Loudness contour
+ static constexpr const float R196 = RES_K(18.2); // R183
+ static constexpr const float R197 = RES_R(100); // R184
+ static constexpr const float R195 = RES_K(20); // R187
+ static constexpr const float R194 = RES_R(100); // R182
+
+ // Voltage dividers at the OTA's + and - inputs.
+ static constexpr const float OTA_DIVIDER_PLUS = RES_VOLTAGE_DIVIDER(R196, R197);
+ static constexpr const float OTA_DIVIDER_MINUS = RES_VOLTAGE_DIVIDER(R195, R194);
+
+ if (m_contour_cc[Which] <= 0)
+ {
+ // The netlist solver might transiently send negative values.
+ LOG("%s EG received a non-positive control current. Skipping update.\n", CONTOUR_NAME);
+ return;
+ }
+
+ // Ideal OTA transconductance at room temparature.
+ const float g = 19.2F * m_contour_cc[Which];
+ // Note the sligh difference in the calculations below, compared to the video
+ // linked above, due to the resistive dividers at the two OTA inputs not
+ // being identical.
+ const float effective_r = 1.0F / (g * OTA_DIVIDER_MINUS);
+ m_contour[Which]->set_r(effective_r);
+
+ const float level_cv = m_cv[LEVEL_CV_INDEX]; // 0V - 10V.
+ const float target_v = level_cv * OTA_DIVIDER_PLUS / OTA_DIVIDER_MINUS; // 0V - ~10.98V.
+ m_contour[Which]->set_target_v(target_v);
+
+ LOGMASKED(LOG_CONTOUR, "%s EG update - Level CV: %f, target_v: %f, R: %f, tau: %f\n",
+ CONTOUR_NAME, level_cv, target_v, effective_r, effective_r * CONTOUR_C);
+}
+
+NETDEV_ANALOG_CALLBACK_MEMBER(source_state::lfo_cv_changed)
+{
+ // The calculation of the LFO control current is very similar to that of the
+ // EGs. See contour_cv_changed().
+ m_lfo_cc = (data - CA3080_VABC) / RES_K(10); // R227
+ machine().scheduler().synchronize(timer_expired_delegate(FUNC(source_state::update_lfo_timer), this));
+ LOGMASKED(LOG_LFO, "LFO CC: %f uA, rate CV: %f, range trimmer: %d\n",
+ m_lfo_cc * 1e6F, m_cv[int(CV::MOD_RATE)], m_lfo_range->read());
+}
+
+TIMER_CALLBACK_MEMBER(source_state::update_lfo_timer)
+{
+ // The LFO ("MOD OSC" in the schematic) is a triangle core oscillator based
+ // on a CA3080 OTA (U49). The OTA's Iabc is determined by a voltage-to-exponential-current
+ // converter, whose voltage is set by the firmware.
+ // The OTA is configured to (dis)charges the capacitor (C58) with a constant
+ // current, resulting in a triangle wave (-/+ ~1.5V). The oscillator also
+ // produces a square wave (-/+ ~14V) as part of its operation.
+
+ // All components on board 2.
+ static constexpr const float R219 = RES_K(100);
+ static constexpr const float R220 = RES_K(12);
+ static constexpr const float C58 = CAP_U(0.33);
+
+ // Approximate max magnitude of opamp output, according to schematic (supply voltage is 15V).
+ static constexpr const float V_PEAK_SQUARE = 14;
+ static constexpr const float V_PEAK_TRIANGLE = V_PEAK_SQUARE * RES_VOLTAGE_DIVIDER(R219, R220); // ~1.5V
+
+ // The differential input at the OTA will be +/- V_PEAK_TRIANGLE. This is well
+ // beyond the "linear" range (-/+ ~10-20mV), so the output current will be
+ // saturated to (almost) +/- Iabc (m_lfo_cc).
+ const float i_out = m_lfo_cc;
+
+ // Time it takes to charge the capacitor from -V_PEAK_TRIANGLE to +V_PEAK_TRIANGLE
+ // with a constant current. This is the half-period of the LFO, which is what
+ // we need for our timer.
+ const float t_half = 2 * V_PEAK_TRIANGLE * C58 / i_out;
+
+ // Continue from the current position in the cycle.
+ const double t_remaining = t_half * m_lfo_timer->remaining().as_double() / m_lfo_timer->period().as_double();
+
+ if (i_out > 0)
+ m_lfo_timer->adjust(attotime::from_double(t_remaining), 0, attotime::from_double(t_half));
+ else
+ m_lfo_timer->reset();
+
+ LOGMASKED(LOG_LFO, "LFO frequency updated - Icharge: %f uA, t_remaining: %f, t_half: %f, f: %f\n",
+ i_out * 1e6F, t_remaining, t_half, 1.0F / (2.0F * t_half));
+}
+
+TIMER_DEVICE_CALLBACK_MEMBER(source_state::lfo_timer_tick)
+{
+ m_lfo_state = !m_lfo_state;
+ m_lfo_rate_led = !m_lfo_state; // LED (LED 3, board 5) is active low.
+ LOGMASKED(LOG_LFO_TIMER, "LFO Timer ticked: %d\n", m_lfo_state);
+}
+
void source_state::memory_map(address_map &map)
{
// Address decoding done through U26, 74LS138, E1=E2=0, E3=1,
@@ -585,6 +820,7 @@ void source_state::io_map(address_map &map)
void source_state::machine_start()
{
m_octave_led.resolve();
+ m_lfo_rate_led.resolve();
m_program_display.resolve();
m_edit_display.resolve();
m_edit_led.resolve();
@@ -599,12 +835,25 @@ void source_state::machine_start()
save_item(NAME(m_octave_hi));
save_item(NAME(m_button_row_latch));
save_item(NAME(m_encoder_incr));
+ save_item(NAME(m_lfo_state));
+ save_item(NAME(m_lfo_cc));
+ save_item(NAME(m_contour_cc));
save_item(NAME(m_cv));
}
void source_state::machine_reset()
{
update_octave_leds();
+ update_contour<FILTER_CONTOUR>(0);
+ update_contour<LOUDNESS_CONTOUR>(0);
+ update_lfo_timer(0);
+
+ // If an input port has its default value at startup, its write callback will
+ // not be invoked. Ensure the netlist inputs are initialized even in that
+ // scenario.
+ subdevice<netlist_mame_analog_input_device>("source_nl:cntr_range_0")->write(m_contour_range[0]->read());
+ subdevice<netlist_mame_analog_input_device>("source_nl:cntr_range_1")->write(m_contour_range[1]->read());
+ subdevice<netlist_mame_analog_input_device>("source_nl:lfo_range")->write(m_lfo_range->read());
}
void source_state::source(machine_config &config)
@@ -617,7 +866,29 @@ void source_state::source(machine_config &config)
NVRAM(config, NVRAM_TAG, nvram_device::DEFAULT_ALL_0); // 2x6514: U27, U28.
+ VA_RC_EG(config, m_contour[FILTER_CONTOUR]).set_c(CONTOUR_C); // C57 (Board 2).
+ VA_RC_EG(config, m_contour[LOUDNESS_CONTOUR]).set_c(CONTOUR_C); // C56 (Board 2).
+ TIMER(config, m_lfo_timer).configure_generic(FUNC(source_state::lfo_timer_tick));
+
config.set_default_layout(layout_moog_source);
+
+
+ NETLIST_CPU(config, "source_nl", netlist::config::DEFAULT_CLOCK()).set_source(NETLIST_NAME(moogsource));
+
+ NETLIST_ANALOG_INPUT(config, "source_nl:cntr_range_0", "R201.DIAL");
+ NETLIST_ANALOG_INPUT(config, m_contour_rate[FILTER_CONTOUR], "FLT_CNTR_RATE.IN");
+ NETLIST_ANALOG_OUTPUT(config, "source_nl:cntr_cv_0")
+ .set_params("FLT_CNTR_CV", FUNC(source_state::contour_cv_changed<FILTER_CONTOUR>));
+
+ NETLIST_ANALOG_INPUT(config, "source_nl:cntr_range_1", "R179.DIAL");
+ NETLIST_ANALOG_INPUT(config, m_contour_rate[LOUDNESS_CONTOUR], "LOUD_CNTR_RATE.IN");
+ NETLIST_ANALOG_OUTPUT(config, "source_nl:cntr_cv_1")
+ .set_params("LOUD_CNTR_CV", FUNC(source_state::contour_cv_changed<LOUDNESS_CONTOUR>));
+
+ NETLIST_ANALOG_INPUT(config, "source_nl:lfo_range", "R223.DIAL");
+ NETLIST_ANALOG_INPUT(config, m_lfo_rate, "MOD_RATE.IN");
+ NETLIST_ANALOG_OUTPUT(config, "source_nl:lfo_cv")
+ .set_params("MOD_CV", FUNC(source_state::lfo_cv_changed));
}
DECLARE_INPUT_CHANGED_MEMBER(source_state::octave_button_pressed)
@@ -818,10 +1089,15 @@ INPUT_PORTS_START(source)
PORT_START("trigger_in") // External trigger input (see keyboard_r()).
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("S TRIG IN") PORT_CODE(KEYCODE_T)
- // TODO: User can control when contours peak, until those are emulated.
- PORT_START("contour_peaked")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Filter Contour Peaked") PORT_CODE(KEYCODE_Z)
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Loudness Contour Peaked") PORT_CODE(KEYCODE_X)
+ PORT_START("contour_range_0") // R201 (Board 2), 100K trimpot.
+ PORT_ADJUSTER(50, "FILTER_CONTOUR_RANGE") NETLIST_ANALOG_PORT_CHANGED("source_nl", "cntr_range_0")
+
+ PORT_START("contour_range_1") // R179 (Board 2), 100K trimpot.
+ PORT_ADJUSTER(50, "LOUDNESS_CONTOUR_RANGE") NETLIST_ANALOG_PORT_CHANGED("source_nl", "cntr_range_1")
+
+ PORT_START("lfo_range") // R223 (Board 2), 100K trimpot.
+ // A default of 0 takes us the closest to the advertised highest LFO frequency of 30 Hz.
+ PORT_ADJUSTER(0, "LFO RANGE") NETLIST_ANALOG_PORT_CHANGED("source_nl", "lfo_range")
INPUT_PORTS_END
// It seems like the Source was launched with firmware Revision 2.2.
diff --git a/src/mame/namco/dkmb.cpp b/src/mame/namco/dkmb.cpp
index ba1d8256061..d3c75fcc131 100644
--- a/src/mame/namco/dkmb.cpp
+++ b/src/mame/namco/dkmb.cpp
@@ -137,8 +137,7 @@ void dkmb_state::dkmb(machine_config &config)
PALETTE(config, "palette").set_entries(65536);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
diff --git a/src/mame/namco/gal3.cpp b/src/mame/namco/gal3.cpp
index b946491b57b..0f7588a8b40 100644
--- a/src/mame/namco/gal3.cpp
+++ b/src/mame/namco/gal3.cpp
@@ -681,19 +681,18 @@ void gal3_state::gal3(machine_config &config)
m_namcos21_dsp_c67[1]->set_renderer_tag("namcos21_3d_2");
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
// TODO: Total 5 of C140s in sound board, verified from gal3zlgr PCB - gal3 uses same board?
C140(config, m_c140_16g, 49152000/2304);
//m_c140_16g->set_addrmap(0, &gal3_state::c140_16g_map); //to be verified
- m_c140_16g->add_route(0, "lspeaker", 0.50);
- m_c140_16g->add_route(1, "rspeaker", 0.50);
+ m_c140_16g->add_route(0, "speaker", 0.50, 0);
+ m_c140_16g->add_route(1, "speaker", 0.50, 1);
C140(config, m_c140_16a, 49152000/2304);
//m_c140_16a->set_addrmap(0, &gal3_state::c140_16a_map); //to be verified
- m_c140_16a->add_route(0, "lspeaker", 0.50);
- m_c140_16a->add_route(1, "rspeaker", 0.50);
+ m_c140_16a->add_route(0, "speaker", 0.50, 0);
+ m_c140_16a->add_route(1, "speaker", 0.50, 1);
}
/*
diff --git a/src/mame/namco/geebee.cpp b/src/mame/namco/geebee.cpp
index e05ba694a58..839b7296025 100644
--- a/src/mame/namco/geebee.cpp
+++ b/src/mame/namco/geebee.cpp
@@ -99,13 +99,11 @@ void geebee_sound_device::sound_w(u8 data)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void geebee_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void geebee_sound_device::sound_stream_update(sound_stream &stream)
{
- auto &buffer = outputs[0];
-
- for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
- buffer.put_int(sampindex, m_sound_signal, 32768);
+ stream.put_int(0, sampindex, m_sound_signal, 32768);
// 1V = HSYNC = 18.432MHz / 3 / 2 / 384 = 8000Hz
m_vcount++;
diff --git a/src/mame/namco/geebee.h b/src/mame/namco/geebee.h
index 7ec36b3bf69..1b4e3253b27 100644
--- a/src/mame/namco/geebee.h
+++ b/src/mame/namco/geebee.h
@@ -17,7 +17,7 @@ protected:
virtual void device_start() 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;
TIMER_CALLBACK_MEMBER(volume_decay_tick);
diff --git a/src/mame/namco/namcofl.cpp b/src/mame/namco/namcofl.cpp
index 3e9bd011d53..7556a76f3e1 100644
--- a/src/mame/namco/namcofl.cpp
+++ b/src/mame/namco/namcofl.cpp
@@ -707,13 +707,12 @@ void namcofl_state::namcofl(machine_config &config)
NAMCO_C116(config, m_c116, 0);
m_c116->enable_shadows();
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
c352_device &c352(C352(config, "c352", 48.384_MHz_XTAL / 2, 288));
- c352.add_route(0, "lspeaker", 1.00);
- c352.add_route(1, "rspeaker", 1.00);
- //c352.add_route(2, "lspeaker", 1.00); // Second DAC not present.
- //c352.add_route(3, "rspeaker", 1.00);
+ c352.add_route(0, "speaker", 1.00, 0);
+ c352.add_route(1, "speaker", 1.00, 1);
+ //c352.add_route(2, "speaker", 1.00); // Second DAC not present.
+ //c352.add_route(3, "speaker", 1.00);
}
ROM_START( speedrcr )
diff --git a/src/mame/namco/namcona1.cpp b/src/mame/namco/namcona1.cpp
index 153b6452d03..20a2f517588 100644
--- a/src/mame/namco/namcona1.cpp
+++ b/src/mame/namco/namcona1.cpp
@@ -1067,13 +1067,12 @@ void namcona1_state::namcona_base(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_namcona1);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
C219(config, m_c219, 44100);
m_c219->set_addrmap(0, &namcona1_state::namcona1_c219_map);
- m_c219->add_route(0, "rspeaker", 1.00);
- m_c219->add_route(1, "lspeaker", 1.00);
+ m_c219->add_route(0, "speaker", 1.00, 1);
+ m_c219->add_route(1, "speaker", 1.00, 0);
}
void namcona1_state::namcona1(machine_config &config)
diff --git a/src/mame/namco/namconb1.cpp b/src/mame/namco/namconb1.cpp
index 0b1631abec2..0f693d1362e 100644
--- a/src/mame/namco/namconb1.cpp
+++ b/src/mame/namco/namconb1.cpp
@@ -1012,14 +1012,13 @@ void namconb1_state::namconb1(machine_config &config)
NAMCO_C116(config, m_c116);
m_c116->enable_shadows();
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
c352_device &c352(C352(config, "c352", XTAL(48'384'000) / 2, 288));
- c352.add_route(0, "lspeaker", 1.00);
- c352.add_route(1, "rspeaker", 1.00);
- //c352.add_route(2, "lspeaker", 1.00); // Second DAC not present.
- //c352.add_route(3, "rspeaker", 1.00);
+ c352.add_route(0, "speaker", 1.00, 0);
+ c352.add_route(1, "speaker", 1.00, 1);
+ //c352.add_route(2, "speaker", 1.00); // Second DAC not present.
+ //c352.add_route(3, "speaker", 1.00);
}
void gunbulet_state::gunbulet(machine_config &config)
diff --git a/src/mame/namco/namcond1.cpp b/src/mame/namco/namcond1.cpp
index dce25c7a58f..7d2ff628c4b 100644
--- a/src/mame/namco/namcond1.cpp
+++ b/src/mame/namco/namcond1.cpp
@@ -522,14 +522,13 @@ void namcond1_state::namcond1(machine_config &config)
screen.set_palette("ygv608");
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
c352_device &c352(C352(config, "c352", XTAL(49'152'000) / 2, 288));
- c352.add_route(0, "lspeaker", 1.00);
- c352.add_route(1, "rspeaker", 1.00);
- //c352.add_route(2, "lspeaker", 1.00); // Second DAC not present.
- //c352.add_route(3, "rspeaker", 1.00);
+ c352.add_route(0, "speaker", 1.00, 0);
+ c352.add_route(1, "speaker", 1.00, 1);
+ //c352.add_route(2, "speaker", 1.00); // Second DAC not present.
+ //c352.add_route(3, "speaker", 1.00);
AT28C16(config, "at28c16", 0);
}
diff --git a/src/mame/namco/namcos1.cpp b/src/mame/namco/namcos1.cpp
index ecd7ccb4da5..689639ec716 100644
--- a/src/mame/namco/namcos1.cpp
+++ b/src/mame/namco/namcos1.cpp
@@ -1057,27 +1057,26 @@ void namcos1_state::ns1(machine_config &config)
m_c123tmap->set_tmap3_half_height();
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2151_device &ymsnd(YM2151(config, "ymsnd", XTAL(3'579'545)));
ymsnd.irq_handler().set_inputline(m_audiocpu, M6809_FIRQ_LINE);
- ymsnd.add_route(0, "lspeaker", 0.50);
- ymsnd.add_route(1, "rspeaker", 0.50);
+ ymsnd.add_route(0, "speaker", 0.50, 0);
+ ymsnd.add_route(1, "speaker", 0.50, 1);
namco_cus30_device &cus30(NAMCO_CUS30(config, "namco", XTAL(49'152'000)/2048/2));
cus30.set_voices(8);
cus30.set_stereo(1);
- cus30.add_route(0, "lspeaker", 0.50);
- cus30.add_route(1, "rspeaker", 0.50);
+ cus30.add_route(0, "speaker", 0.50, 0);
+ cus30.add_route(1, "speaker", 0.50, 1);
DAC_8BIT_R2R(config, m_dac[0], 0); // 10-pin 1Kx8R SIP with HC374 latch
- m_dac[0]->add_route(ALL_OUTPUTS, "lspeaker", 0.5);
- m_dac[0]->add_route(ALL_OUTPUTS, "rspeaker", 0.5);
+ m_dac[0]->add_route(ALL_OUTPUTS, "speaker", 0.5, 0);
+ m_dac[0]->add_route(ALL_OUTPUTS, "speaker", 0.5, 1);
DAC_8BIT_R2R(config, m_dac[1], 0); // 10-pin 1Kx8R SIP with HC374 latch
- m_dac[1]->add_route(ALL_OUTPUTS, "lspeaker", 0.5);
- m_dac[1]->add_route(ALL_OUTPUTS, "rspeaker", 0.5);
+ m_dac[1]->add_route(ALL_OUTPUTS, "speaker", 0.5, 0);
+ m_dac[1]->add_route(ALL_OUTPUTS, "speaker", 0.5, 1);
}
void quester_state::quester(machine_config &config)
diff --git a/src/mame/namco/namcos10.cpp b/src/mame/namco/namcos10.cpp
index f8833e33dd2..b6f50ff71fd 100644
--- a/src/mame/namco/namcos10.cpp
+++ b/src/mame/namco/namcos10.cpp
@@ -1101,15 +1101,14 @@ void namcos10_state::namcos10_base(machine_config &config)
SCREEN(config, "screen", SCREEN_TYPE_RASTER);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
// CXD2938Q; SPU with CD-ROM controller - also seen in PSone, 101.4912MHz / 2
// TODO: This must be replaced with a proper CXD2938Q device, CD-ROM functionality of chip not used
spu_device &spu(SPU(config, "spu", XTAL(101'491'200)/2, m_maincpu.target()));
spu.set_stream_flags(STREAM_SYNCHRONOUS);
- spu.add_route(0, "lspeaker", 0.75);
- spu.add_route(1, "rspeaker", 0.75);
+ spu.add_route(0, "speaker", 0.75, 0);
+ spu.add_route(1, "speaker", 0.75, 1);
// TODO: Trace main PCB to see where JAMMA I/O goes and/or how int10 can be triggered (SM10MA3?)
m_io_update_interrupt.bind().set("maincpu:irq", FUNC(psxirq_device::intin10));
@@ -2899,8 +2898,8 @@ void namcos10_memp3_state::namcos10_memp3_base(machine_config &config)
});
LC82310(config, m_lc82310, XTAL(16'934'400));
- m_lc82310->add_route(0, "lspeaker", 1.0);
- m_lc82310->add_route(1, "rspeaker", 1.0);
+ m_lc82310->add_route(0, "speaker", 1.0, 0);
+ m_lc82310->add_route(1, "speaker", 1.0, 1);
}
void namcos10_memp3_state::machine_start()
diff --git a/src/mame/namco/namcos11.cpp b/src/mame/namco/namcos11.cpp
index be8856df52d..294fba09a38 100644
--- a/src/mame/namco/namcos11.cpp
+++ b/src/mame/namco/namcos11.cpp
@@ -775,14 +775,13 @@ void namcos11_state::coh110(machine_config &config)
SCREEN(config, "screen", SCREEN_TYPE_RASTER);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
c352_device &c352(C352(config, "c352", 25401600, 288));
- c352.add_route(0, "lspeaker", 1.00);
- c352.add_route(1, "rspeaker", 1.00);
- //c352.add_route(2, "lspeaker", 1.00); // Second DAC not present.
- //c352.add_route(3, "rspeaker", 1.00);
+ c352.add_route(0, "speaker", 1.00, 0);
+ c352.add_route(1, "speaker", 1.00, 1);
+ //c352.add_route(2, "speaker", 1.00); // Second DAC not present.
+ //c352.add_route(3, "speaker", 1.00);
AT28C16(config, "at28c16", 0);
}
diff --git a/src/mame/namco/namcos12.cpp b/src/mame/namco/namcos12.cpp
index 713c6d91cbf..203cee1f160 100644
--- a/src/mame/namco/namcos12.cpp
+++ b/src/mame/namco/namcos12.cpp
@@ -1191,14 +1191,13 @@ public:
AT28C16(config, "at28c16", 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
c352_device &c352(C352(config, "c352", 25401600, 288));
- c352.add_route(0, "lspeaker", 1.00);
- c352.add_route(1, "rspeaker", 1.00);
- //c352.add_route(2, "lspeaker", 1.00); // Second DAC not present.
- //c352.add_route(3, "rspeaker", 1.00);
+ c352.add_route(0, "speaker", 1.00, 0);
+ c352.add_route(1, "speaker", 1.00, 1);
+ //c352.add_route(2, "speaker", 1.00); // Second DAC not present.
+ //c352.add_route(3, "speaker", 1.00);
}
void aplarail(machine_config &config) ATTR_COLD
@@ -1558,8 +1557,8 @@ public:
coh700b(config);
NAMCOS12_CDXA(config, m_cdxa_pcb, XTAL(14'745'600));
- m_cdxa_pcb->add_route(0, "lspeaker", 0.30); // roughly matched the volume of speaking lines between the CDXA audio vs non-CDXA audio
- m_cdxa_pcb->add_route(1, "rspeaker", 0.30);
+ m_cdxa_pcb->add_route(0, "speaker", 0.30, 0); // roughly matched the volume of speaking lines between the CDXA audio vs non-CDXA audio
+ m_cdxa_pcb->add_route(1, "speaker", 0.30, 1);
m_cdxa_pcb->psx_int10_callback().set("maincpu:irq", FUNC(psxirq_device::intin10));
}
diff --git a/src/mame/namco/namcos12_cdxa.cpp b/src/mame/namco/namcos12_cdxa.cpp
index 1ff4cf8841a..304f591c68b 100644
--- a/src/mame/namco/namcos12_cdxa.cpp
+++ b/src/mame/namco/namcos12_cdxa.cpp
@@ -292,7 +292,8 @@ void namcos12_cdxa_device::cdrom_cs0_w(offs_t offset, uint16_t data, uint16_t me
void namcos12_cdxa_device::mb87078_gain_changed(offs_t offset, uint8_t data)
{
- m_lc78836m->set_output_gain(offset, m_mb87078->gain_factor_r(offset));
+ if (offset < m_lc78836m->outputs())
+ m_lc78836m->set_output_gain(offset, m_mb87078->gain_factor_r(offset));
}
void namcos12_cdxa_device::audio_dac_w(int state)
diff --git a/src/mame/namco/namcos2.cpp b/src/mame/namco/namcos2.cpp
index 3dbfc3f441b..e9cfa29f8f8 100644
--- a/src/mame/namco/namcos2.cpp
+++ b/src/mame/namco/namcos2.cpp
@@ -1713,8 +1713,7 @@ void namcos2_state::configure_common_standard(machine_config &config)
m_screen->set_raw(MAIN_OSC_CLOCK/8, 384, 0*8, 36*8, 264, 0*8, 28*8);
m_screen->set_palette(m_c116);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
C140(config, m_c140, C140_SOUND_CLOCK); /* 21.333kHz */
m_c140->set_addrmap(0, &namcos2_state::c140_default_am);
@@ -1820,10 +1819,10 @@ void namcos2_state::base_noio(machine_config &config)
configure_c123tmap_standard(config);
configure_namcos2_roz_standard(config);
- m_c140->add_route(0, "lspeaker", 0.75);
- m_c140->add_route(1, "rspeaker", 0.75);
+ m_c140->add_route(0, "speaker", 0.75, 0);
+ m_c140->add_route(1, "speaker", 0.75, 1);
- YM2151(config, "ymsnd", YM2151_SOUND_CLOCK).add_route(0, "lspeaker", 0.80).add_route(1, "rspeaker", 0.80); /* 3.579545MHz */
+ YM2151(config, "ymsnd", YM2151_SOUND_CLOCK).add_route(0, "speaker", 0.80, 0).add_route(1, "speaker", 0.80, 1); /* 3.579545MHz */
}
@@ -1844,8 +1843,8 @@ void namcos2_state::base2(machine_config &config)
base(config);
m_c140->reset_routes();
- m_c140->add_route(0, "lspeaker", 1.0);
- m_c140->add_route(1, "rspeaker", 1.0);
+ m_c140->add_route(0, "speaker", 1.0, 0);
+ m_c140->add_route(1, "speaker", 1.0, 1);
}
void namcos2_state::assaultp(machine_config &config)
@@ -1860,10 +1859,10 @@ void namcos2_state::base3(machine_config &config)
base(config);
m_c140->reset_routes();
- m_c140->add_route(0, "lspeaker", 0.45);
- m_c140->add_route(1, "rspeaker", 0.45);
+ m_c140->add_route(0, "speaker", 0.45, 0);
+ m_c140->add_route(1, "speaker", 0.45, 1);
- YM2151(config.replace(), "ymsnd", YM2151_SOUND_CLOCK).add_route(0, "lspeaker", 1.0).add_route(1, "rspeaker", 1.0); /* 3.579545MHz */
+ YM2151(config.replace(), "ymsnd", YM2151_SOUND_CLOCK).add_route(0, "speaker", 1.0, 0).add_route(1, "speaker", 1.0, 1); /* 3.579545MHz */
}
@@ -1887,10 +1886,10 @@ void namcos2_state::finallap_noio(machine_config &config)
configure_c123tmap_standard(config);
configure_c45road_standard(config);
- m_c140->add_route(0, "lspeaker", 0.75);
- m_c140->add_route(1, "rspeaker", 0.75);
+ m_c140->add_route(0, "speaker", 0.75, 0);
+ m_c140->add_route(1, "speaker", 0.75, 1);
- YM2151(config, "ymsnd", YM2151_SOUND_CLOCK).add_route(0, "lspeaker", 0.80).add_route(1, "rspeaker", 0.80); /* 3.579545MHz */
+ YM2151(config, "ymsnd", YM2151_SOUND_CLOCK).add_route(0, "speaker", 0.80, 0).add_route(1, "speaker", 0.80, 1); /* 3.579545MHz */
}
void namcos2_state::base_fl(machine_config &config)
@@ -1954,10 +1953,10 @@ void namcos2_state::sgunner(machine_config &config)
MCFG_VIDEO_START_OVERRIDE(namcos2_state, sgunner)
- m_c140->add_route(0, "lspeaker", 0.75);
- m_c140->add_route(1, "rspeaker", 0.75);
+ m_c140->add_route(0, "speaker", 0.75, 0);
+ m_c140->add_route(1, "speaker", 0.75, 1);
- YM2151(config, "ymsnd", YM2151_SOUND_CLOCK).add_route(0, "lspeaker", 0.80).add_route(1, "rspeaker", 0.80); /* 3.579545MHz */
+ YM2151(config, "ymsnd", YM2151_SOUND_CLOCK).add_route(0, "speaker", 0.80, 0).add_route(1, "speaker", 0.80, 1); /* 3.579545MHz */
}
void namcos2_state::sgunner2(machine_config &config)
@@ -1983,10 +1982,10 @@ void namcos2_state::sgunner2(machine_config &config)
MCFG_VIDEO_START_OVERRIDE(namcos2_state, sgunner)
- m_c140->add_route(0, "lspeaker", 0.75);
- m_c140->add_route(1, "rspeaker", 0.75);
+ m_c140->add_route(0, "speaker", 0.75, 0);
+ m_c140->add_route(1, "speaker", 0.75, 1);
- YM2151(config, "ymsnd", YM2151_SOUND_CLOCK).add_route(0, "lspeaker", 0.80).add_route(1, "rspeaker", 0.80); /* 3.579545MHz */
+ YM2151(config, "ymsnd", YM2151_SOUND_CLOCK).add_route(0, "speaker", 0.80, 0).add_route(1, "speaker", 0.80, 1); /* 3.579545MHz */
}
void namcos2_state::suzuka8h(machine_config &config)
@@ -2016,10 +2015,10 @@ void namcos2_state::suzuka8h(machine_config &config)
MCFG_VIDEO_START_OVERRIDE(namcos2_state, luckywld)
- m_c140->add_route(0, "lspeaker", 0.75);
- m_c140->add_route(1, "rspeaker", 0.75);
+ m_c140->add_route(0, "speaker", 0.75, 0);
+ m_c140->add_route(1, "speaker", 0.75, 1);
- YM2151(config, "ymsnd", YM2151_SOUND_CLOCK).add_route(0, "lspeaker", 0.80).add_route(1, "rspeaker", 0.80); /* 3.579545MHz */
+ YM2151(config, "ymsnd", YM2151_SOUND_CLOCK).add_route(0, "speaker", 0.80, 0).add_route(1, "speaker", 0.80, 1); /* 3.579545MHz */
}
void namcos2_state::luckywld(machine_config &config)
@@ -2061,10 +2060,10 @@ void namcos2_state::metlhawk(machine_config &config)
MCFG_VIDEO_START_OVERRIDE(namcos2_state, metlhawk)
- m_c140->add_route(0, "lspeaker", 1.0);
- m_c140->add_route(1, "rspeaker", 1.0);
+ m_c140->add_route(0, "speaker", 1.0, 0);
+ m_c140->add_route(1, "speaker", 1.0, 1);
- YM2151(config, "ymsnd", YM2151_SOUND_CLOCK).add_route(0, "lspeaker", 0.80).add_route(1, "rspeaker", 0.80); /* 3.579545MHz */
+ YM2151(config, "ymsnd", YM2151_SOUND_CLOCK).add_route(0, "speaker", 0.80, 0).add_route(1, "speaker", 0.80, 1); /* 3.579545MHz */
// ymsnd.irq_handler().set_inputline("audiocpu", 1);
}
diff --git a/src/mame/namco/namcos21.cpp b/src/mame/namco/namcos21.cpp
index f54550b1d28..50a66156140 100644
--- a/src/mame/namco/namcos21.cpp
+++ b/src/mame/namco/namcos21.cpp
@@ -923,16 +923,15 @@ void namcos21_state::winrun(machine_config &config)
m_namcos21_3d->set_depth_reverse(true);
m_namcos21_3d->set_framebuffer_size(496,480);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
C140(config, m_c140, 49.152_MHz_XTAL / 2304);
m_c140->set_addrmap(0, &namcos21_state::c140_map);
m_c140->int1_callback().set_inputline(m_audiocpu, M6809_FIRQ_LINE);
- m_c140->add_route(0, "lspeaker", 0.50);
- m_c140->add_route(1, "rspeaker", 0.50);
+ m_c140->add_route(0, "speaker", 0.50, 0);
+ m_c140->add_route(1, "speaker", 0.50, 1);
- YM2151(config, "ymsnd", 3.579545_MHz_XTAL).add_route(0, "lspeaker", 0.30).add_route(1, "rspeaker", 0.30);
+ YM2151(config, "ymsnd", 3.579545_MHz_XTAL).add_route(0, "speaker", 0.30, 0).add_route(1, "speaker", 0.30, 1);
}
diff --git a/src/mame/namco/namcos21_c67.cpp b/src/mame/namco/namcos21_c67.cpp
index 927cb1fef69..4ac77ad478e 100644
--- a/src/mame/namco/namcos21_c67.cpp
+++ b/src/mame/namco/namcos21_c67.cpp
@@ -840,16 +840,15 @@ void namcos21_c67_state::namcos21(machine_config &config)
m_c355spr->set_color_base(0x1000);
m_c355spr->set_external_prifill(true);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
C140(config, m_c140, 49.152_MHz_XTAL / 2304);
m_c140->set_addrmap(0, &namcos21_c67_state::c140_map);
m_c140->int1_callback().set_inputline(m_audiocpu, M6809_FIRQ_LINE);
- m_c140->add_route(0, "lspeaker", 0.50);
- m_c140->add_route(1, "rspeaker", 0.50);
+ m_c140->add_route(0, "speaker", 0.50, 0);
+ m_c140->add_route(1, "speaker", 0.50, 1);
- YM2151(config, "ymsnd", 3.579545_MHz_XTAL).add_route(0, "lspeaker", 0.30).add_route(1, "rspeaker", 0.30);
+ YM2151(config, "ymsnd", 3.579545_MHz_XTAL).add_route(0, "speaker", 0.30, 0).add_route(1, "speaker", 0.30, 1);
}
void namcos21_c67_state::aircomb(machine_config &config)
diff --git a/src/mame/namco/namcos21_de.cpp b/src/mame/namco/namcos21_de.cpp
index 8bb7565ea8c..6b41f9c75ce 100644
--- a/src/mame/namco/namcos21_de.cpp
+++ b/src/mame/namco/namcos21_de.cpp
@@ -201,16 +201,15 @@ void namco_de_pcbstack_device::device_add_mconfig(machine_config &config)
m_c355spr->set_color_base(0x1000);
m_c355spr->set_external_prifill(true);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
C140(config, m_c140, 49.152_MHz_XTAL / 2304);
m_c140->set_addrmap(0, &namco_de_pcbstack_device::c140_map);
m_c140->int1_callback().set_inputline(m_audiocpu, M6809_FIRQ_LINE);
- m_c140->add_route(0, "lspeaker", 0.50);
- m_c140->add_route(1, "rspeaker", 0.50);
+ m_c140->add_route(0, "speaker", 0.50, 0);
+ m_c140->add_route(1, "speaker", 0.50, 1);
- YM2151(config, "ymsnd", 3.579545_MHz_XTAL).add_route(0, "lspeaker", 0.30).add_route(1, "rspeaker", 0.30);
+ YM2151(config, "ymsnd", 3.579545_MHz_XTAL).add_route(0, "speaker", 0.30, 0).add_route(1, "speaker", 0.30, 1);
}
diff --git a/src/mame/namco/namcos22.cpp b/src/mame/namco/namcos22.cpp
index e44cc4d40a0..777bde6e38a 100644
--- a/src/mame/namco/namcos22.cpp
+++ b/src/mame/namco/namcos22.cpp
@@ -3787,12 +3787,11 @@ void namcos22_state::namcos22(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_namcos22);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
C352(config, m_c352, 49.152_MHz_XTAL/2, 288);
- m_c352->add_route(0, "lspeaker", 1.0);
- m_c352->add_route(1, "rspeaker", 1.0);
+ m_c352->add_route(0, "speaker", 1.0, 0);
+ m_c352->add_route(1, "speaker", 1.0, 1);
}
void namcos22_state::cybrcomm(machine_config &config)
diff --git a/src/mame/namco/namcos23.cpp b/src/mame/namco/namcos23.cpp
index 0cebfe9efae..ca36fc6b82e 100644
--- a/src/mame/namco/namcos23.cpp
+++ b/src/mame/namco/namcos23.cpp
@@ -6177,14 +6177,13 @@ void gorgon_state::gorgon(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_gorgon);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
c352_device &c352(C352(config, "c352", C352CLOCK, C352DIV));
- c352.add_route(0, "lspeaker", 1.00);
- c352.add_route(1, "rspeaker", 1.00);
- c352.add_route(2, "lspeaker", 1.00);
- c352.add_route(3, "rspeaker", 1.00);
+ c352.add_route(0, "speaker", 1.00, 0);
+ c352.add_route(1, "speaker", 1.00, 1);
+ c352.add_route(2, "speaker", 1.00, 0);
+ c352.add_route(3, "speaker", 1.00, 1);
JVS_PORT(config, m_jvs, jvs_port_devices, nullptr);
m_jvs->rxd().set(m_subcpu, FUNC(h8_device::sci_rx_w<0>));
@@ -6254,14 +6253,13 @@ void namcos23_state::s23(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_namcos23);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
c352_device &c352(C352(config, "c352", C352CLOCK, C352DIV));
- c352.add_route(0, "lspeaker", 1.00);
- c352.add_route(1, "rspeaker", 1.00);
- c352.add_route(2, "lspeaker", 1.00);
- c352.add_route(3, "rspeaker", 1.00);
+ c352.add_route(0, "speaker", 1.00, 0);
+ c352.add_route(1, "speaker", 1.00, 1);
+ c352.add_route(2, "speaker", 1.00, 0);
+ c352.add_route(3, "speaker", 1.00, 1);
JVS_PORT(config, m_jvs, jvs_port_devices, nullptr);
m_jvs->rxd().set(m_subcpu, FUNC(h8_device::sci_rx_w<0>));
diff --git a/src/mame/namco/polepos.cpp b/src/mame/namco/polepos.cpp
index a0e5b05ff14..3331bfdf9a1 100644
--- a/src/mame/namco/polepos.cpp
+++ b/src/mame/namco/polepos.cpp
@@ -430,8 +430,8 @@ void polepos_state::z80_map(address_map &map)
map(0xa000, 0xa000).mirror(0x0cff).r(FUNC(polepos_state::ready_r)); /* READY */
map(0xa000, 0xa007).mirror(0x0cf8).w(m_latch, FUNC(ls259_device::write_d0));
map(0xa100, 0xa100).mirror(0x0cff).w("watchdog", FUNC(watchdog_timer_device::reset_w));
- map(0xa200, 0xa200).mirror(0x0cff).w("polepos", FUNC(polepos_sound_device::polepos_engine_sound_lsb_w)); /* Car Sound ( Lower Nibble ) */
- map(0xa300, 0xa300).mirror(0x0cff).w("polepos", FUNC(polepos_sound_device::polepos_engine_sound_msb_w)); /* Car Sound ( Upper Nibble ) */
+ map(0xa200, 0xa200).mirror(0x0cff).w("engine", FUNC(polepos_sound_device::polepos_engine_sound_lsb_w)); /* Car Sound ( Lower Nibble ) */
+ map(0xa300, 0xa300).mirror(0x0cff).w("engine", FUNC(polepos_sound_device::polepos_engine_sound_msb_w)); /* Car Sound ( Upper Nibble ) */
}
void polepos_state::z80_io(address_map &map)
@@ -909,7 +909,7 @@ void polepos_state::polepos(machine_config &config)
m_latch->q_out_cb<1>().append("53xx", FUNC(namco_53xx_device::reset));
m_latch->q_out_cb<1>().append("54xx", FUNC(namco_54xx_device::reset));
m_latch->q_out_cb<2>().set(m_namco_sound, FUNC(namco_device::sound_enable_w));
- m_latch->q_out_cb<2>().append("polepos", FUNC(polepos_sound_device::clson_w));
+ m_latch->q_out_cb<2>().append("engine", FUNC(polepos_sound_device::clson_w));
m_latch->q_out_cb<3>().set(FUNC(polepos_state::gasel_w));
m_latch->q_out_cb<4>().set_inputline(m_subcpu, INPUT_LINE_RESET).invert();
m_latch->q_out_cb<5>().set_inputline(m_subcpu2, INPUT_LINE_RESET).invert();
@@ -932,24 +932,23 @@ void polepos_state::polepos(machine_config &config)
config.set_default_layout(layout_polepos);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
NAMCO(config, m_namco_sound, MASTER_CLOCK/512);
m_namco_sound->set_voices(8);
m_namco_sound->set_stereo(true);
- m_namco_sound->add_route(0, "lspeaker", 0.80);
- m_namco_sound->add_route(1, "rspeaker", 0.80);
+ m_namco_sound->add_route(0, "speaker", 0.80, 0);
+ m_namco_sound->add_route(1, "speaker", 0.80, 1);
/* discrete circuit on the 54XX outputs */
discrete_sound_device &discrete(DISCRETE(config, "discrete", polepos_discrete));
- discrete.add_route(ALL_OUTPUTS, "lspeaker", 0.90);
- discrete.add_route(ALL_OUTPUTS, "rspeaker", 0.90);
+ discrete.add_route(ALL_OUTPUTS, "speaker", 0.90, 0);
+ discrete.add_route(ALL_OUTPUTS, "speaker", 0.90, 1);
/* engine sound */
- polepos_sound_device &polepos(POLEPOS_SOUND(config, "polepos", MASTER_CLOCK/8));
- polepos.add_route(ALL_OUTPUTS, "lspeaker", 0.90 * 0.77);
- polepos.add_route(ALL_OUTPUTS, "rspeaker", 0.90 * 0.77);
+ polepos_sound_device &polepos(POLEPOS_SOUND(config, "engine", MASTER_CLOCK/8));
+ polepos.add_route(ALL_OUTPUTS, "speaker", 0.90 * 0.77, 0);
+ polepos.add_route(ALL_OUTPUTS, "speaker", 0.90 * 0.77, 1);
}
void polepos_state::bootleg_soundlatch_w(uint8_t data)
@@ -1017,7 +1016,7 @@ void polepos_state::topracern(machine_config &config)
LS259(config, m_latch);
m_latch->q_out_cb<0>().set_inputline(m_maincpu, 0, CLEAR_LINE).invert();
m_latch->q_out_cb<2>().set(m_namco_sound, FUNC(namco_device::sound_enable_w));
- m_latch->q_out_cb<2>().append("polepos", FUNC(polepos_sound_device::clson_w));
+ m_latch->q_out_cb<2>().append("engine", FUNC(polepos_sound_device::clson_w));
m_latch->q_out_cb<3>().set(FUNC(polepos_state::gasel_w));
m_latch->q_out_cb<4>().set_inputline(m_subcpu, INPUT_LINE_RESET).invert();
m_latch->q_out_cb<5>().set_inputline(m_subcpu2, INPUT_LINE_RESET).invert();
@@ -1040,23 +1039,22 @@ void polepos_state::topracern(machine_config &config)
config.set_default_layout(layout_topracer);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
NAMCO(config, m_namco_sound, MASTER_CLOCK/512);
m_namco_sound->set_voices(8);
m_namco_sound->set_stereo(true);
- m_namco_sound->add_route(0, "lspeaker", 0.80);
- m_namco_sound->add_route(1, "rspeaker", 0.80);
+ m_namco_sound->add_route(0, "speaker", 0.80, 0);
+ m_namco_sound->add_route(1, "speaker", 0.80, 1);
/* engine sound */
- polepos_sound_device &polepos(POLEPOS_SOUND(config, "polepos", 0));
- polepos.add_route(ALL_OUTPUTS, "lspeaker", 0.90 * 0.77);
- polepos.add_route(ALL_OUTPUTS, "rspeaker", 0.90 * 0.77);
+ polepos_sound_device &polepos(POLEPOS_SOUND(config, "engine", 0));
+ polepos.add_route(ALL_OUTPUTS, "speaker", 0.90 * 0.77, 0);
+ polepos.add_route(ALL_OUTPUTS, "speaker", 0.90 * 0.77, 1);
dac_4bit_r2r_device &dac(DAC_4BIT_R2R(config, "dac", 0)); // unknown resistor configuration
- dac.add_route(ALL_OUTPUTS, "lspeaker", 0.12);
- dac.add_route(ALL_OUTPUTS, "rspeaker", 0.12);
+ dac.add_route(ALL_OUTPUTS, "speaker", 0.12, 0);
+ dac.add_route(ALL_OUTPUTS, "speaker", 0.12, 1);
}
void polepos_state::polepos2bi(machine_config &config)
@@ -1072,8 +1070,8 @@ void polepos_state::polepos2bi(machine_config &config)
m_soundlatch->set_separate_acknowledge(true);
TMS5220(config, "tms", 600000) /* ? Mhz */
- .add_route(ALL_OUTPUTS, "lspeaker", 0.80)
- .add_route(ALL_OUTPUTS, "rspeaker", 0.80);
+ .add_route(ALL_OUTPUTS, "speaker", 0.80, 0)
+ .add_route(ALL_OUTPUTS, "speaker", 0.80, 1);
}
diff --git a/src/mame/namco/polepos_a.cpp b/src/mame/namco/polepos_a.cpp
index 95a52451207..e461d4ca961 100644
--- a/src/mame/namco/polepos_a.cpp
+++ b/src/mame/namco/polepos_a.cpp
@@ -210,10 +210,11 @@ DEFINE_DEVICE_TYPE(POLEPOS_SOUND, polepos_sound_device, "polepos_sound", "Pole P
polepos_sound_device::polepos_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, POLEPOS_SOUND, tag, owner, clock),
device_sound_interface(mconfig, *this),
+ m_data(*this, DEVICE_SELF),
m_current_position(0),
m_sample_msb(0),
m_sample_lsb(0),
- m_sample_enable(0),
+ m_sample_enable(false),
m_stream(nullptr)
{
}
@@ -227,7 +228,7 @@ void polepos_sound_device::device_start()
{
m_stream = stream_alloc(0, 1, OUTPUT_RATE);
m_sample_msb = m_sample_lsb = 0;
- m_sample_enable = 0;
+ m_sample_enable = false;
/* setup the filters */
m_filter_engine[0].opamp_m_bandpass_setup(this, RES_K(220), RES_K(33), RES_K(390), CAP_U(.01), CAP_U(.01));
@@ -235,6 +236,22 @@ void polepos_sound_device::device_start()
/* Filter 3 is a little different. Because of the input capacitor, it is
* a high pass filter. */
m_filter_engine[2].setup(this, FILTER_HIGHPASS, 950, Q_TO_DAMP(.707), 1);
+
+ save_item(NAME(m_current_position));
+ save_item(NAME(m_sample_msb));
+ save_item(NAME(m_sample_lsb));
+ save_item(NAME(m_sample_enable));
+ save_item(STRUCT_MEMBER(m_filter_engine, x0));
+ save_item(STRUCT_MEMBER(m_filter_engine, x1));
+ save_item(STRUCT_MEMBER(m_filter_engine, x2));
+ save_item(STRUCT_MEMBER(m_filter_engine, y0));
+ save_item(STRUCT_MEMBER(m_filter_engine, y1));
+ save_item(STRUCT_MEMBER(m_filter_engine, y2));
+ save_item(STRUCT_MEMBER(m_filter_engine, a1));
+ save_item(STRUCT_MEMBER(m_filter_engine, a2));
+ save_item(STRUCT_MEMBER(m_filter_engine, b0));
+ save_item(STRUCT_MEMBER(m_filter_engine, b1));
+ save_item(STRUCT_MEMBER(m_filter_engine, b2));
}
@@ -244,8 +261,7 @@ void polepos_sound_device::device_start()
void polepos_sound_device::device_reset()
{
- int loop;
- for (loop = 0; loop < 3; loop++)
+ for (int loop = 0; loop < 3; loop++)
m_filter_engine[loop].reset();
}
@@ -254,39 +270,30 @@ void polepos_sound_device::device_reset()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void polepos_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void polepos_sound_device::sound_stream_update(sound_stream &stream)
{
- uint32_t step, clock, slot;
- uint8_t *base;
- double volume, i_total;
- auto &buffer = outputs[0];
- int loop;
-
/* if we're not enabled, just fill with 0 */
if (!m_sample_enable)
- {
- buffer.fill(0);
return;
- }
/* determine the effective clock rate */
- clock = (unscaled_clock() / 16) * ((m_sample_msb + 1) * 64 + m_sample_lsb + 1) / (64*64);
- step = (clock << 12) / OUTPUT_RATE;
+ uint32_t clock = (unscaled_clock() / 16) * ((m_sample_msb + 1) * 64 + m_sample_lsb + 1) / (64*64);
+ uint32_t step = (clock << 12) / OUTPUT_RATE;
/* determine the volume */
- slot = (m_sample_msb >> 3) & 7;
- volume = volume_table[slot];
- base = &machine().root_device().memregion("engine")->base()[slot * 0x800];
+ unsigned slot = (m_sample_msb >> 3) & 7;
+ double volume = volume_table[slot];
+ const uint8_t *base = &m_data[slot * 0x800];
/* fill in the sample */
- for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
m_filter_engine[0].x0 = (3.4 / 255 * base[(m_current_position >> 12) & 0x7ff] - 2) * volume;
m_filter_engine[1].x0 = m_filter_engine[0].x0;
m_filter_engine[2].x0 = m_filter_engine[0].x0;
- i_total = 0;
- for (loop = 0; loop < 3; loop++)
+ double i_total = 0;
+ for (int loop = 0; loop < 3; loop++)
{
m_filter_engine[loop].step();
/* The op-amp powered @ 5V will clip to 0V & 3.5V.
@@ -298,7 +305,7 @@ void polepos_sound_device::sound_stream_update(sound_stream &stream, std::vector
}
i_total *= r_filt_total/2; /* now contains voltage adjusted by final gain */
- buffer.put(sampindex, i_total);
+ stream.put(0, sampindex, i_total);
m_current_position += step;
}
}
diff --git a/src/mame/namco/polepos_a.h b/src/mame/namco/polepos_a.h
index 069a1d796c5..6ee284e0630 100644
--- a/src/mame/namco/polepos_a.h
+++ b/src/mame/namco/polepos_a.h
@@ -19,7 +19,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;
public:
void clson_w(int state);
@@ -42,10 +42,12 @@ private:
double b0 = 0.0, b1 = 0.0, b2 = 0.0; /* digital filter coefficients, numerator */
};
+ required_region_ptr<uint8_t> m_data;
+
uint32_t m_current_position;
- int m_sample_msb;
- int m_sample_lsb;
- int m_sample_enable;
+ uint8_t m_sample_msb;
+ uint8_t m_sample_lsb;
+ bool m_sample_enable;
sound_stream *m_stream;
filter2_context m_filter_engine[3];
};
diff --git a/src/mame/namco/sweetland4.cpp b/src/mame/namco/sweetland4.cpp
index 4155c960aad..007ff6e3017 100644
--- a/src/mame/namco/sweetland4.cpp
+++ b/src/mame/namco/sweetland4.cpp
@@ -134,24 +134,22 @@ void sweetland4_state::sweetland4(machine_config &config)
RTC72423(config, "rtc", 32'768); // no evident XTAL on PCB
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
okim9810_device &oki(OKIM9810(config, "oki", 4'096'000)); // no evident XTAL on PCB
- oki.add_route(0, "lspeaker", 1.00);
- oki.add_route(1, "rspeaker", 1.00);
+ oki.add_route(0, "speaker", 1.00, 0);
+ oki.add_route(1, "speaker", 1.00, 1);
}
void sweetland4_state::tairyodk(machine_config &config)
{
H83002(config, m_maincpu, 14.746_MHz_XTAL); // H8/3002 6413002F17
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
okim9810_device &oki(OKIM9810(config, "oki", 4.096_MHz_XTAL));
- oki.add_route(0, "lspeaker", 1.00);
- oki.add_route(1, "rspeaker", 1.00);
+ oki.add_route(0, "speaker", 1.00, 0);
+ oki.add_route(1, "speaker", 1.00, 1);
}
diff --git a/src/mame/namco/tceptor.cpp b/src/mame/namco/tceptor.cpp
index 226b9432f70..6741981c454 100644
--- a/src/mame/namco/tceptor.cpp
+++ b/src/mame/namco/tceptor.cpp
@@ -333,22 +333,21 @@ void tceptor_state::tceptor(machine_config &config)
m_screen->set_palette(m_palette);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2151_device &ym(YM2151(config, "ymsnd", XTAL(14'318'181)/4));
- ym.add_route(0, "lspeaker", 1.0);
- ym.add_route(1, "rspeaker", 1.0);
+ ym.add_route(0, "speaker", 1.0, 0);
+ ym.add_route(1, "speaker", 1.0, 1);
NAMCO_CUS30(config, m_cus30, XTAL(49'152'000)/2048);
m_cus30->set_voices(8);
m_cus30->set_stereo(true);
- m_cus30->add_route(0, "lspeaker", 0.40);
- m_cus30->add_route(1, "rspeaker", 0.40);
+ m_cus30->add_route(0, "speaker", 0.40, 0);
+ m_cus30->add_route(1, "speaker", 0.40, 1);
dac_8bit_r2r_device &dac(DAC_8BIT_R2R(config, "dac", 0)); // unknown DAC
- dac.add_route(ALL_OUTPUTS, "lspeaker", 0.4);
- dac.add_route(ALL_OUTPUTS, "rspeaker", 0.4);
+ dac.add_route(ALL_OUTPUTS, "speaker", 0.4, 0);
+ dac.add_route(ALL_OUTPUTS, "speaker", 0.4, 1);
}
diff --git a/src/mame/namco/turrett.cpp b/src/mame/namco/turrett.cpp
index f4221b7e5b3..cdf913d5f36 100644
--- a/src/mame/namco/turrett.cpp
+++ b/src/mame/namco/turrett.cpp
@@ -372,13 +372,12 @@ void turrett_state::turrett(machine_config &config)
PALETTE(config, "palette", palette_device::RGB_555);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
turrett_device &ttsound(TURRETT(config, "ttsound", R3041_CLOCK)); // ?
ttsound.set_addrmap(0, &turrett_state::turrett_sound_map);
- ttsound.add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- ttsound.add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ ttsound.add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ ttsound.add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
}
diff --git a/src/mame/namco/turrett.h b/src/mame/namco/turrett.h
index 78fc37228a2..e4b755e25ac 100644
--- a/src/mame/namco/turrett.h
+++ b/src/mame/namco/turrett.h
@@ -121,7 +121,7 @@ protected:
virtual void device_reset() override ATTR_COLD;
// device_sound_interface 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;
// device_memory_interface overrides
virtual space_config_vector memory_space_config() const override;
diff --git a/src/mame/namco/turrett_a.cpp b/src/mame/namco/turrett_a.cpp
index 72d0d61e35d..5d919b680d7 100644
--- a/src/mame/namco/turrett_a.cpp
+++ b/src/mame/namco/turrett_a.cpp
@@ -81,12 +81,8 @@ void turrett_device::device_reset()
// sound_stream_update - update sound stream
//-------------------------------------------------
-void turrett_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void turrett_device::sound_stream_update(sound_stream &stream)
{
- // Silence the buffers
- outputs[0].fill(0);
- outputs[1].fill(0);
-
for (int ch = 0; ch < SOUND_CHANNELS; ++ch)
{
if (m_channels[ch].m_playing)
@@ -101,7 +97,7 @@ void turrett_device::sound_stream_update(sound_stream &stream, std::vector<read_
// Channels 30 and 31 expect interleaved stereo samples
uint32_t incr = (ch >= 30) ? 2 : 1;
- for (int s = 0; s < outputs[0].samples(); ++s)
+ for (int s = 0; s < stream.samples(); ++s)
{
int16_t sample = m_cache.read_word(addr << 1);
@@ -113,8 +109,8 @@ void turrett_device::sound_stream_update(sound_stream &stream, std::vector<read_
addr += incr;
- outputs[0].add_int(s, (sample * lvol) >> 17, 32768);
- outputs[1].add_int(s, (sample * rvol) >> 17, 32768);
+ stream.add_int(0, s, (sample * lvol) >> 17, 32768);
+ stream.add_int(1, s, (sample * rvol) >> 17, 32768);
}
}
}
diff --git a/src/mame/namco/warpwarp_a.cpp b/src/mame/namco/warpwarp_a.cpp
index 79a3c06936a..f6e119a86f8 100644
--- a/src/mame/namco/warpwarp_a.cpp
+++ b/src/mame/namco/warpwarp_a.cpp
@@ -168,13 +168,11 @@ void warpwarp_sound_device::music2_w(u8 data)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void warpwarp_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void warpwarp_sound_device::sound_stream_update(sound_stream &stream)
{
- auto &buffer = outputs[0];
-
- for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
- buffer.put_int(sampindex, m_sound_signal + m_music_signal, 32768 * 2);
+ stream.put_int(0, sampindex, m_sound_signal + m_music_signal, 32768 * 2);
/*
* The music signal is selected at a rate of 2H (1.536MHz) from the
diff --git a/src/mame/namco/warpwarp_a.h b/src/mame/namco/warpwarp_a.h
index 1f7e3f76e27..2f235146dc9 100644
--- a/src/mame/namco/warpwarp_a.h
+++ b/src/mame/namco/warpwarp_a.h
@@ -19,7 +19,7 @@ protected:
virtual void device_start() 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;
TIMER_CALLBACK_MEMBER(sound_decay_tick);
TIMER_CALLBACK_MEMBER(music_decay_tick);
diff --git a/src/mame/nec/pc8801.cpp b/src/mame/nec/pc8801.cpp
index 42a825c1821..f61514b8051 100644
--- a/src/mame/nec/pc8801.cpp
+++ b/src/mame/nec/pc8801.cpp
@@ -1706,18 +1706,16 @@ void pc8801_state::pc8801(machine_config &config)
// Note: original models up to OPNA variants really have an internal mono speaker,
// but user eventually can have a stereo mixing audio card mounted so for simplicity we MCM here.
- SPEAKER(config, m_lspeaker).front_left();
- SPEAKER(config, m_rspeaker).front_right();
+ SPEAKER(config, m_speaker, 2).front();
// TODO: DAC_1BIT
// 2400 Hz according to schematics, unaffected by clock speed setting (confirmed on real HW)
BEEP(config, m_beeper, MASTER_CLOCK / 16 / 13 / 8);
- for (auto &speaker : { m_lspeaker, m_rspeaker })
- {
- m_cassette->add_route(ALL_OUTPUTS, speaker, 0.025);
- m_beeper->add_route(ALL_OUTPUTS, speaker, 0.10);
- }
+ m_cassette->add_route(ALL_OUTPUTS, m_speaker, 0.025, 0);
+ m_cassette->add_route(ALL_OUTPUTS, m_speaker, 0.025, 1);
+ m_beeper->add_route(ALL_OUTPUTS, m_speaker, 0.10, 0);
+ m_beeper->add_route(ALL_OUTPUTS, m_speaker, 0.10, 1);
MSX_GENERAL_PURPOSE_PORT(config, m_mouse_port, msx_general_purpose_port_devices, "joystick");
@@ -1738,14 +1736,15 @@ void pc8801mk2sr_state::pc8801mk2sr(machine_config &config)
m_opn->port_b_read_callback().set(FUNC(pc8801mk2sr_state::opn_portb_r));
m_opn->port_b_write_callback().set(FUNC(pc8801mk2sr_state::opn_portb_w));
- for (auto &speaker : { m_lspeaker, m_rspeaker })
- {
- // TODO: per-channel mixing is unconfirmed
- m_opn->add_route(0, speaker, 0.125);
- m_opn->add_route(1, speaker, 0.125);
- m_opn->add_route(2, speaker, 0.125);
- m_opn->add_route(3, speaker, 0.125);
- }
+ // TODO: per-channel mixing is unconfirmed
+ m_opn->add_route(0, m_speaker, 0.125, 0);
+ m_opn->add_route(1, m_speaker, 0.125, 0);
+ m_opn->add_route(2, m_speaker, 0.125, 0);
+ m_opn->add_route(3, m_speaker, 0.125, 0);
+ m_opn->add_route(0, m_speaker, 0.125, 1);
+ m_opn->add_route(1, m_speaker, 0.125, 1);
+ m_opn->add_route(2, m_speaker, 0.125, 1);
+ m_opn->add_route(3, m_speaker, 0.125, 1);
}
void pc8801mk2sr_state::pc8801mk2mr(machine_config &config)
@@ -1768,10 +1767,10 @@ void pc8801fh_state::pc8801fh(machine_config &config)
m_opna->port_b_write_callback().set(FUNC(pc8801fh_state::opn_portb_w));
// TODO: per-channel mixing is unconfirmed
- m_opna->add_route(0, m_lspeaker, 0.75);
- m_opna->add_route(0, m_rspeaker, 0.75);
- m_opna->add_route(1, m_lspeaker, 0.75);
- m_opna->add_route(2, m_rspeaker, 0.75);
+ m_opna->add_route(0, m_speaker, 0.75, 0);
+ m_opna->add_route(0, m_speaker, 0.75, 1);
+ m_opna->add_route(1, m_speaker, 0.75, 0);
+ m_opna->add_route(2, m_speaker, 0.75, 1);
// TODO: add possible configuration override for baudrate here
// ...
diff --git a/src/mame/nec/pc8801.h b/src/mame/nec/pc8801.h
index 7b9d5114426..68465a8934c 100644
--- a/src/mame/nec/pc8801.h
+++ b/src/mame/nec/pc8801.h
@@ -49,8 +49,7 @@ public:
, m_usart(*this, "usart")
// , m_cassette(*this, "cassette")
, m_beeper(*this, "beeper")
- , m_lspeaker(*this, "lspeaker")
- , m_rspeaker(*this, "rspeaker")
+ , m_speaker(*this, "speaker")
, m_palette(*this, "palette")
, m_n80rom(*this, "n80rom")
, m_n88rom(*this, "n88rom")
@@ -91,8 +90,7 @@ protected:
required_device<i8251_device> m_usart;
// required_device<cassette_image_device> m_cassette;
required_device<beep_device> m_beeper;
- required_device<speaker_device> m_lspeaker;
- required_device<speaker_device> m_rspeaker;
+ required_device<speaker_device> m_speaker;
required_device<palette_device> m_palette;
required_region_ptr<u8> m_n80rom;
required_region_ptr<u8> m_n88rom;
diff --git a/src/mame/nec/pc88va.cpp b/src/mame/nec/pc88va.cpp
index 87e761d39b0..f9d4141f00d 100644
--- a/src/mame/nec/pc88va.cpp
+++ b/src/mame/nec/pc88va.cpp
@@ -1503,8 +1503,7 @@ void pc88va_state::pc88va(machine_config &config)
MSX_GENERAL_PURPOSE_PORT(config, m_mouse_port, msx_general_purpose_port_devices, "joystick");
- SPEAKER(config, m_lspeaker).front_left();
- SPEAKER(config, m_rspeaker).front_right();
+ SPEAKER(config, m_speaker, 2).front();
// TODO: YM2203 for vanilla pc88va
// PC-88VA-12 "Sound Board II", YM2608B
@@ -1515,10 +1514,10 @@ void pc88va_state::pc88va(machine_config &config)
m_opna->port_b_read_callback().set(FUNC(pc88va_state::opn_portb_r));
m_opna->port_b_write_callback().set(FUNC(pc88va_state::opn_portb_w));
// TODO: per-channel mixing is unconfirmed
- m_opna->add_route(0, m_lspeaker, 0.75);
- m_opna->add_route(0, m_rspeaker, 0.75);
- m_opna->add_route(1, m_lspeaker, 0.75);
- m_opna->add_route(2, m_rspeaker, 0.75);
+ m_opna->add_route(0, m_speaker, 0.75, 0);
+ m_opna->add_route(0, m_speaker, 0.75, 1);
+ m_opna->add_route(1, m_speaker, 0.75, 0);
+ m_opna->add_route(2, m_speaker, 0.75, 1);
// TODO: set pc98 compatible
// Needs a MS-Engine disk dump first, that applies an overlay on PC Engine OS so that it can run PC-98 software
diff --git a/src/mame/nec/pc88va.h b/src/mame/nec/pc88va.h
index 42d92d8650d..572ff1480c5 100644
--- a/src/mame/nec/pc88va.h
+++ b/src/mame/nec/pc88va.h
@@ -65,8 +65,7 @@ public:
, m_cbus(*this, "cbus%d", 0)
, m_mouse_port(*this, "mouseport") // labelled "マウス" (mouse) - can't use "mouse" because of core -mouse option
, m_opna(*this, "opna")
- , m_lspeaker(*this, "lspeaker")
- , m_rspeaker(*this, "rspeaker")
+ , m_speaker(*this, "speaker")
, m_palram(*this, "palram")
, m_sysbank(*this, "sysbank")
, m_workram(*this, "workram")
@@ -136,8 +135,7 @@ private:
required_device_array<pc9801_slot_device, 2> m_cbus;
required_device<msx_general_purpose_port_device> m_mouse_port;
required_device<ym2608_device> m_opna;
- required_device<speaker_device> m_lspeaker;
- required_device<speaker_device> m_rspeaker;
+ required_device<speaker_device> m_speaker;
required_shared_ptr<uint16_t> m_palram;
required_device<address_map_bank_device> m_sysbank;
required_shared_ptr<uint16_t> m_workram;
diff --git a/src/mame/nec/pc9801.cpp b/src/mame/nec/pc9801.cpp
index 6e665c36de7..c9e7bcb0211 100644
--- a/src/mame/nec/pc9801.cpp
+++ b/src/mame/nec/pc9801.cpp
@@ -1246,7 +1246,7 @@ void pc9801us_state::pc9801us_io(address_map &map)
NAME([this] (offs_t offset) { return m_sdip->read((offset >> 8) + 4); }),
NAME([this] (offs_t offset, u8 data) { m_sdip->write((offset >> 8) + 4, data); })
);
-// map(0x8f1f, 0x8f1f).w(m_sdip, FUNC(pc98_sdip_device::bank_w));
+// map(0x8f1f, 0x8f1f).w(m_sdip, FUNC(pc98_sdip_device::bank_w));
}
void pc9801bx_state::pc9801bx2_map(address_map &map)
@@ -2640,8 +2640,8 @@ void pc9801us_state::pc9801fs(machine_config &config)
pit_clock_config(config, xtal / 4);
-// PC98_119_KBD(config.replace(), m_keyb, 0);
-// m_keyb->rxd_callback().set("sio_kbd", FUNC(i8251_device::write_rxd));
+// PC98_119_KBD(config.replace(), m_keyb, 0);
+// m_keyb->rxd_callback().set("sio_kbd", FUNC(i8251_device::write_rxd));
PC98_SDIP(config, "sdip", 0);
}
@@ -2945,6 +2945,11 @@ ROM_START( pc9801fs )
ROM_LOAD16_BYTE( "kqx02_00.bin", 0x000001, 0x020000, CRC(f55e42d6) SHA1(2ab0ae817e9abed984544c920182689127550ce3) )
ROM_REGION16_LE( 0x30000, "ipl", ROMREGION_ERASEFF )
+ // 0x0c000-0x0ffff sound ROM BIOS
+ // 0x10000-0x13fff ^ mirror
+ // 0x14000-0x16fff <unknown>
+ // 0x17000-0x17fff SCSI disk BIOS?
+ // 0x18000-0x1ffff <empty>
ROM_COPY( "biosrom", 0x20000, 0x10000, 0x08000 ) //ITF ROM
ROM_COPY( "biosrom", 0x28000, 0x18000, 0x08000 ) //BIOS ROM
ROM_COPY( "biosrom", 0x30000, 0x20000, 0x08000 )
diff --git a/src/mame/nec/pc9821.cpp b/src/mame/nec/pc9821.cpp
index c74a4f30555..ae3ac171650 100644
--- a/src/mame/nec/pc9821.cpp
+++ b/src/mame/nec/pc9821.cpp
@@ -533,8 +533,10 @@ void pc9821_state::pc9821_io(address_map &map)
* 98MATE A overrides
*/
// TODO: SDIP extended access for 9821Ap, As, Ae
-// It never r/w the conventional ports, at least on POST.
+// Undocumented, it never r/w the conventional ports, at least on POST.
// I also suspect a few ports here not being direct RAM r/w but actual regs instead.
+// 0xf834f: checks against aa55, throws "ROM SUM ERROR" if bypassed
+// 0xf8363: sum8 contents of [0x02], 10 times (???)
u8 pc9821_mate_a_state::ext_sdip_data_r(offs_t offset)
{
logerror("%s: EXT SDIP access read %02x %02x\n", machine().describe_context(), m_ext_sdip_addr, m_ext_sdip[m_ext_sdip_addr]);
@@ -543,6 +545,8 @@ u8 pc9821_mate_a_state::ext_sdip_data_r(offs_t offset)
void pc9821_mate_a_state::ext_sdip_data_w(offs_t offset, u8 data)
{
+ logerror("%s: EXT SDIP access write [%02x] -> %02x\n", machine().describe_context(), m_ext_sdip_addr, data);
+
m_ext_sdip[m_ext_sdip_addr] = data;
}
@@ -589,6 +593,9 @@ void pc9821_mate_a_state::pc9821as_map(address_map &map)
pc9821_map(map);
map(0x000f8000, 0x000fffff).view(m_bios_view);
// TODO: remaining settings
+ // pc9821as uses this
+ m_bios_view[4](0x000f8000, 0x000fffff).rom().region("biosrom", 0x10000);
+ // setup mode
m_bios_view[6](0x000f8000, 0x000fffff).rom().region("biosrom", 0x18000);
}
@@ -1069,9 +1076,16 @@ ROM_START( pc9821as )
ROM_LOAD( "mvs0100-1.bin", 0x00000, 0x80000, CRC(ca37b631) SHA1(8c481dd0608d6c27235bc88bd77e345628dc28a1) )
ROM_REGION16_LE( 0x30000, "ipl", ROMREGION_ERASEFF )
- // backported from pc9821ap2
+ // 0x00000-0x04fff KBCRT X47 891105
+ // 0x0c000-0x0ffff sound BIOS
+ // 0x10000-0x13fff ^ mirror
+ // 0x14000-0x16fff <unknown>
+ // 0x17000-0x17fff SCSI disk BIOS?
+ // 0x18000-0x19fff <unknown>
+ // 0x1a000-0x1ffff setup menu
ROM_COPY( "biosrom", 0x20000, 0x10000, 0x08000 ) // ITF
ROM_COPY( "biosrom", 0x28000, 0x18000, 0x18000 ) // BIOS
+ // 0x50000-0x57fff ? (copies stuff from $e4000, jumps there)
ROM_REGION( 0x80000, "chargen", 0 )
ROM_LOAD( "font_as.rom", 0x000000, 0x046800, BAD_DUMP CRC(456d9fc7) SHA1(78ba9960f135372825ab7244b5e4e73a810002ff) )
@@ -1104,7 +1118,7 @@ ROM_START( pc9821ap2 )
// 0x10000-0x13fff ^ mirror of above?
// 0x14000-0x14ff0 <unknown>
// 0x16000-0x19fff contains refs to 765 and HDDs "Conner Peripherals", IDE BIOS?
- // 0x1c000-0x1ffff contains refs to SDIP setup
+ // 0x1a000-0x1ffff setup menu
ROM_COPY( "biosrom", 0x20000, 0x10000, 0x08000 ) // ITF
ROM_COPY( "biosrom", 0x28000, 0x18000, 0x18000 ) // BIOS
// 0x40000-0x4ffff empty
@@ -1117,7 +1131,9 @@ ROM_START( pc9821ap2 )
ROM_LOAD( "font.rom", 0x00000, 0x46800, BAD_DUMP CRC(a61c0649) SHA1(554b87377d176830d21bd03964dc71f8e98676b1) )
LOAD_KANJI_ROMS
- LOAD_IDE_ROM
+
+ ROM_REGION( 0x4000, "ide", ROMREGION_ERASEVAL(0xcb) )
+ ROM_COPY( "biosrom", 0x18000, 0x00000, 0x02000 )
ROM_END
@@ -1178,7 +1194,9 @@ ROM_START( pc9821cx3 )
// 0x40000: IDE BIOS (NEC D3766 / Caviar CP30344 / WDC AC2340H)
// 0x42000: setup menu
ROM_COPY( "biosrom", 0x78000, 0x10000, 0x08000 ) // ITF
- ROM_COPY( "biosrom", 0x60000, 0x18000, 0x18000 ) // BIOS, probably wrong (reset vector at 0x67ff0)
+ ROM_COPY( "biosrom", 0x70000, 0x18000, 0x08000 ) // BIOS, probably wrong (reset vector at 0x67ff0)
+ ROM_COPY( "biosrom", 0x68000, 0x20000, 0x08000 )
+ ROM_COPY( "biosrom", 0x60000, 0x28000, 0x08000 )
// "microcode" memory dump, probably identical to above but shuffled
// left for consultation
@@ -1242,7 +1260,9 @@ ROM_START( pc9821xa16 )
ROM_REGION16_LE( 0x30000, "ipl", ROMREGION_ERASEFF )
// TODO: all of the 256k space seems valid
ROM_COPY( "biosrom", 0x28000, 0x00000, 0x18000 )
- ROM_COPY( "biosrom", 0x00000, 0x18000, 0x18000 )
+ ROM_COPY( "biosrom", 0x20000, 0x28000, 0x08000 )
+ ROM_COPY( "biosrom", 0x18000, 0x20000, 0x08000 )
+ ROM_COPY( "biosrom", 0x10000, 0x18000, 0x08000 )
ROM_REGION( 0x80000, "chargen", 0 )
ROM_LOAD( "font.rom", 0x00000, 0x46800, BAD_DUMP CRC(a61c0649) SHA1(554b87377d176830d21bd03964dc71f8e98676b1) )
diff --git a/src/mame/nec/pce.cpp b/src/mame/nec/pce.cpp
index 99ae503303a..3cffb9a5a8a 100644
--- a/src/mame/nec/pce.cpp
+++ b/src/mame/nec/pce.cpp
@@ -190,8 +190,8 @@ void pce_state::pce_common(machine_config &config)
m_maincpu->set_addrmap(AS_IO, &pce_state::pce_io);
m_maincpu->port_in_cb().set(FUNC(pce_state::controller_r));
m_maincpu->port_out_cb().set(FUNC(pce_state::controller_w));
- m_maincpu->add_route(0, "lspeaker", 1.00);
- m_maincpu->add_route(1, "rspeaker", 1.00);
+ m_maincpu->add_route(0, "speaker", 1.00, 0);
+ m_maincpu->add_route(1, "speaker", 1.00, 1);
config.set_maximum_quantum(attotime::from_hz(60));
@@ -211,8 +211,7 @@ void pce_state::pce_common(machine_config &config)
huc6270.set_vram_size(0x10000);
huc6270.irq().set_inputline(m_maincpu, 0);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
PCE_CONTROL_PORT(config, m_port_ctrl, pce_control_port_devices, "joypad2");
@@ -220,8 +219,8 @@ void pce_state::pce_common(machine_config &config)
PCE_CD(config, m_cd, 0);
m_cd->irq().set_inputline(m_maincpu, 1);
m_cd->set_maincpu(m_maincpu);
- m_cd->add_route(0, "lspeaker", 1.0);
- m_cd->add_route(1, "rspeaker", 1.0);
+ m_cd->add_route(0, "speaker", 1.0, 0);
+ m_cd->add_route(1, "speaker", 1.0, 1);
SOFTWARE_LIST(config, "cd_list").set_original("pcecd");
}
@@ -258,8 +257,8 @@ void pce_state::sgx(machine_config &config)
m_maincpu->set_addrmap(AS_IO, &pce_state::sgx_io);
m_maincpu->port_in_cb().set(FUNC(pce_state::controller_r));
m_maincpu->port_out_cb().set(FUNC(pce_state::controller_w));
- m_maincpu->add_route(0, "lspeaker", 1.00);
- m_maincpu->add_route(1, "rspeaker", 1.00);
+ m_maincpu->add_route(0, "speaker", 1.00, 0);
+ m_maincpu->add_route(1, "speaker", 1.00, 1);
config.set_maximum_quantum(attotime::from_hz(60));
@@ -297,8 +296,7 @@ void pce_state::sgx(machine_config &config)
huc6202.read_1_callback().set("huc6270_1", FUNC(huc6270_device::read));
huc6202.write_1_callback().set("huc6270_1", FUNC(huc6270_device::write));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
// turbo pad bundled
PCE_CONTROL_PORT(config, m_port_ctrl, pce_control_port_devices, "joypad2_turbo");
@@ -312,8 +310,8 @@ void pce_state::sgx(machine_config &config)
PCE_CD(config, m_cd, 0);
m_cd->irq().set_inputline(m_maincpu, 1);
m_cd->set_maincpu(m_maincpu);
- m_cd->add_route(0, "lspeaker", 1.0);
- m_cd->add_route(1, "rspeaker", 1.0);
+ m_cd->add_route(0, "speaker", 1.0, 0);
+ m_cd->add_route(1, "speaker", 1.0, 1);
SOFTWARE_LIST(config, "cd_list").set_original("pcecd");
}
diff --git a/src/mame/nec/pce_cd.cpp b/src/mame/nec/pce_cd.cpp
index 7785200ce69..54ccffdf7de 100644
--- a/src/mame/nec/pce_cd.cpp
+++ b/src/mame/nec/pce_cd.cpp
@@ -82,7 +82,7 @@ void pce_cd_device::regs_map(address_map &map)
pce_cd_device::pce_cd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, PCE_CD, tag, owner, clock)
, device_memory_interface(mconfig, *this)
- , device_mixer_interface(mconfig, *this, 2)
+ , device_mixer_interface(mconfig, *this)
, m_space_config("io", ENDIANNESS_LITTLE, 8, 4, 0, address_map_constructor(FUNC(pce_cd_device::regs_map), this))
, m_maincpu(*this, finder_base::DUMMY_TAG)
, m_irq_cb(*this)
@@ -263,14 +263,14 @@ void pce_cd_device::device_add_mconfig(machine_config &config)
MSM5205(config, m_msm, PCE_CD_CLOCK / 6);
m_msm->vck_legacy_callback().set(FUNC(pce_cd_device::msm5205_int)); /* interrupt function */
m_msm->set_prescaler_selector(msm5205_device::S48_4B); /* 1/48 prescaler, 4bit data */
- m_msm->add_route(ALL_OUTPUTS, *this, 0.50, AUTO_ALLOC_INPUT, 0);
- m_msm->add_route(ALL_OUTPUTS, *this, 0.50, AUTO_ALLOC_INPUT, 1);
+ m_msm->add_route(ALL_OUTPUTS, *this, 0.50, 0);
+ m_msm->add_route(ALL_OUTPUTS, *this, 0.50, 1);
CDDA(config, m_cdda);
m_cdda->set_cdrom_tag(m_cdrom);
m_cdda->audio_end_cb().set(FUNC(pce_cd_device::cdda_end_mark_cb));
- m_cdda->add_route(0, *this, 1.00, AUTO_ALLOC_INPUT, 0);
- m_cdda->add_route(1, *this, 1.00, AUTO_ALLOC_INPUT, 1);
+ m_cdda->add_route(0, *this, 1.00, 0);
+ m_cdda->add_route(1, *this, 1.00, 1);
}
void pce_cd_device::adpcm_stop(uint8_t irq_flag)
diff --git a/src/mame/nec/pcfx.cpp b/src/mame/nec/pcfx.cpp
index 4c2d7b0c5c2..74839194b62 100644
--- a/src/mame/nec/pcfx.cpp
+++ b/src/mame/nec/pcfx.cpp
@@ -453,15 +453,14 @@ void pcfx_state::pcfx(machine_config &config)
SOFTWARE_LIST(config, "cd_list").set_original("pcfx");
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
huc6230_device &huc6230(HuC6230(config, "huc6230", XTAL(21'477'272)));
huc6230.adpcm_update_cb<0>().set("huc6272", FUNC(huc6272_device::adpcm_update_0));
huc6230.adpcm_update_cb<1>().set("huc6272", FUNC(huc6272_device::adpcm_update_1));
huc6230.vca_callback().set("huc6272", FUNC(huc6272_device::cdda_update));
- huc6230.add_route(0, "lspeaker", 1.0);
- huc6230.add_route(1, "rspeaker", 1.0);
+ huc6230.add_route(0, "speaker", 1.0, 0);
+ huc6230.add_route(1, "speaker", 1.0, 1);
}
diff --git a/src/mame/neogeo/midas.cpp b/src/mame/neogeo/midas.cpp
index d4fa0b0a088..9b13ff10010 100644
--- a/src/mame/neogeo/midas.cpp
+++ b/src/mame/neogeo/midas.cpp
@@ -671,12 +671,11 @@ void midas_state::livequiz(machine_config &config)
PALETTE(config, m_palette).set_format(palette_device::xRGB_888, 0x10000);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ymz280b_device &ymz(YMZ280B(config, "ymz", XTAL(16'934'400)));
- ymz.add_route(0, "lspeaker", 0.80);
- ymz.add_route(1, "rspeaker", 0.80);
+ ymz.add_route(0, "speaker", 0.80, 0);
+ ymz.add_route(1, "speaker", 0.80, 1);
}
void hammer_state::hammer(machine_config &config)
diff --git a/src/mame/neogeo/neogeo.cpp b/src/mame/neogeo/neogeo.cpp
index 84c9c968b82..fdb465143d7 100644
--- a/src/mame/neogeo/neogeo.cpp
+++ b/src/mame/neogeo/neogeo.cpp
@@ -1968,13 +1968,12 @@ void neogeo_base_state::neogeo_base(machine_config &config)
void neogeo_base_state::neogeo_stereo(machine_config &config)
{
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- m_ym->add_route(0, "lspeaker", 0.84);
- m_ym->add_route(0, "rspeaker", 0.84);
- m_ym->add_route(1, "lspeaker", 0.98);
- m_ym->add_route(2, "rspeaker", 0.98);
+ m_ym->add_route(0, "speaker", 0.84, 0);
+ m_ym->add_route(0, "speaker", 0.84, 1);
+ m_ym->add_route(1, "speaker", 0.98, 0);
+ m_ym->add_route(2, "speaker", 0.98, 1);
}
diff --git a/src/mame/nichibutsu/gomoku_a.cpp b/src/mame/nichibutsu/gomoku_a.cpp
index 30e08c94711..509e2cf087e 100644
--- a/src/mame/nichibutsu/gomoku_a.cpp
+++ b/src/mame/nichibutsu/gomoku_a.cpp
@@ -79,22 +79,18 @@ void gomoku_sound_device::device_start()
// sound_stream_update - handle a stream update in mono
//-------------------------------------------------
-void gomoku_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void gomoku_sound_device::sound_stream_update(sound_stream &stream)
{
- auto &buffer = outputs[0];
sound_channel *voice;
short *mix;
int ch;
// if no sound, we're done
if (m_sound_enable == 0)
- {
- buffer.fill(0);
return;
- }
// zap the contents of the mixer buffer
- std::fill_n(&m_mixer_buffer[0], buffer.samples(), 0);
+ std::fill_n(&m_mixer_buffer[0], stream.samples(), 0);
// loop over each voice and add its contribution
for (ch = 0, voice = std::begin(m_channel_list); voice < std::end(m_channel_list); ch++, voice++)
@@ -116,7 +112,7 @@ void gomoku_sound_device::sound_stream_update(sound_stream &stream, std::vector<
mix = &m_mixer_buffer[0];
// add our contribution
- for (int i = 0; i < buffer.samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
c += f;
@@ -157,8 +153,8 @@ void gomoku_sound_device::sound_stream_update(sound_stream &stream, std::vector<
// mix it down
mix = &m_mixer_buffer[0];
- for (int i = 0; i < buffer.samples(); i++)
- buffer.put_int(i, *mix++, 128 * MAX_VOICES);
+ for (int i = 0; i < stream.samples(); i++)
+ stream.put_int(0, i, *mix++, 128 * MAX_VOICES);
}
diff --git a/src/mame/nichibutsu/gomoku_a.h b/src/mame/nichibutsu/gomoku_a.h
index 87497169cf8..01d017b4ae2 100644
--- a/src/mame/nichibutsu/gomoku_a.h
+++ b/src/mame/nichibutsu/gomoku_a.h
@@ -23,7 +23,7 @@ protected:
virtual void device_start() 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;
private:
void make_mixer_table(int voices, int gain);
diff --git a/src/mame/nichibutsu/hrdvd.cpp b/src/mame/nichibutsu/hrdvd.cpp
index 2670170e97f..d15455ba29a 100644
--- a/src/mame/nichibutsu/hrdvd.cpp
+++ b/src/mame/nichibutsu/hrdvd.cpp
@@ -79,8 +79,7 @@ public:
m_mpega(*this, "mpeg_audio"),
m_pll(*this, "pll"),
m_nichisnd(*this, "nichisnd"),
- m_lspeaker(*this, "lspeaker"),
- m_rspeaker(*this, "rspeaker"),
+ m_speaker(*this, "speaker"),
m_screen(*this, "screen"),
m_key(*this, "KEY.%u", 0),
m_region_maincpu(*this, "maincpu")
@@ -94,8 +93,7 @@ public:
required_device<nn71003f_device> m_mpega;
required_device<tc9223_device> m_pll;
required_device<nichisnd_device> m_nichisnd;
- required_device<speaker_device> m_lspeaker;
- required_device<speaker_device> m_rspeaker;
+ required_device<speaker_device> m_speaker;
required_device<screen_device> m_screen;
required_ioport_array<5> m_key;
required_memory_region m_region_maincpu;
@@ -516,16 +514,15 @@ void hrdvd_state::hrdvd(machine_config &config)
m_mpeg->drq_w().set(FUNC(hrdvd_state::mpeg_dreq_w));
NN71003F(config, m_mpega, 0);
- m_mpega->add_route(0, m_lspeaker, 1.0);
- m_mpega->add_route(1, m_rspeaker, 1.0);
+ m_mpega->add_route(0, m_speaker, 1.0, 0);
+ m_mpega->add_route(1, m_speaker, 1.0, 1);
m_mpeg->sp2_frm_w().set(m_mpega, FUNC(nn71003f_device::frm_w));
m_mpeg->sp2_clk_w().set(m_mpega, FUNC(nn71003f_device::clk_w));
m_mpeg->sp2_dat_w().set(m_mpega, FUNC(nn71003f_device::dat_w));
NICHISND(config, m_nichisnd, 0);
- SPEAKER(config, m_lspeaker).front_left();
- SPEAKER(config, m_rspeaker).front_right();
+ SPEAKER(config, m_speaker, 2).front();
}
diff --git a/src/mame/nichibutsu/wiping_a.cpp b/src/mame/nichibutsu/wiping_a.cpp
index 8d43425f7d3..b82403e0f32 100644
--- a/src/mame/nichibutsu/wiping_a.cpp
+++ b/src/mame/nichibutsu/wiping_a.cpp
@@ -125,22 +125,18 @@ void wiping_sound_device::sound_w(offs_t offset, uint8_t data)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void wiping_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void wiping_sound_device::sound_stream_update(sound_stream &stream)
{
- auto &buffer = outputs[0];
wp_sound_channel *voice;
short *mix;
int i;
/* if no sound, we're done */
if (m_sound_enable == 0)
- {
- buffer.fill(0);
return;
- }
/* zap the contents of the mixer buffer */
- std::fill_n(&m_mixer_buffer[0], buffer.samples(), 0);
+ std::fill_n(&m_mixer_buffer[0], stream.samples(), 0);
/* loop over each voice and add its contribution */
for (voice = m_channel_list; voice < m_last_channel; voice++)
@@ -157,7 +153,7 @@ void wiping_sound_device::sound_stream_update(sound_stream &stream, std::vector<
mix = &m_mixer_buffer[0];
/* add our contribution */
- for (i = 0; i < buffer.samples(); i++)
+ for (i = 0; i < stream.samples(); i++)
{
int offs;
@@ -202,6 +198,6 @@ void wiping_sound_device::sound_stream_update(sound_stream &stream, std::vector<
/* mix it down */
mix = &m_mixer_buffer[0];
- for (i = 0; i < buffer.samples(); i++)
- buffer.put_int(i, *mix++, 128 * MAX_VOICES);
+ for (i = 0; i < stream.samples(); i++)
+ stream.put_int(0, i, *mix++, 128 * MAX_VOICES);
}
diff --git a/src/mame/nichibutsu/wiping_a.h b/src/mame/nichibutsu/wiping_a.h
index 7794f7884bc..4a38a582b0c 100644
--- a/src/mame/nichibutsu/wiping_a.h
+++ b/src/mame/nichibutsu/wiping_a.h
@@ -17,7 +17,7 @@ protected:
virtual void device_start() 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;
private:
// 8 voices max
diff --git a/src/mame/nintendo/aleck64.cpp b/src/mame/nintendo/aleck64.cpp
index 94935040290..449c8b71b9b 100644
--- a/src/mame/nintendo/aleck64.cpp
+++ b/src/mame/nintendo/aleck64.cpp
@@ -1060,11 +1060,10 @@ void aleck64_state::aleck64(machine_config &config)
PALETTE(config, "palette").set_entries(0x1000);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- DMADAC(config, "dac1").add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- DMADAC(config, "dac2").add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ DMADAC(config, "dac1").add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ DMADAC(config, "dac2").add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
N64PERIPH(config, m_rcp_periphs, 0);
}
diff --git a/src/mame/nintendo/gb.cpp b/src/mame/nintendo/gb.cpp
index 878bb83c878..17b552aa546 100644
--- a/src/mame/nintendo/gb.cpp
+++ b/src/mame/nintendo/gb.cpp
@@ -1059,12 +1059,11 @@ void gb_state::gameboy(machine_config &config)
DMG_PPU(config, m_ppu, m_maincpu);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DMG_APU(config, m_apu, MASTER_CLOCK);
- m_apu->add_route(0, "lspeaker", 0.50);
- m_apu->add_route(1, "rspeaker", 0.50);
+ m_apu->add_route(0, "speaker", 0.50, 0);
+ m_apu->add_route(1, "speaker", 0.50, 1);
// cartslot
GB_CART_SLOT(config, m_cartslot, gameboy_cartridges, nullptr);
@@ -1098,12 +1097,11 @@ void sgb_state::supergb(machine_config &config)
SGB_PPU(config, m_ppu, m_maincpu);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DMG_APU(config, m_apu, 4'295'454);
- m_apu->add_route(0, "lspeaker", 0.50);
- m_apu->add_route(1, "rspeaker", 0.50);
+ m_apu->add_route(0, "speaker", 0.50, 0);
+ m_apu->add_route(1, "speaker", 0.50, 1);
// cartslot
GB_CART_SLOT(config, m_cartslot, gameboy_cartridges, nullptr);
@@ -1161,12 +1159,11 @@ void gbc_state::gbcolor(machine_config &config)
CGB_PPU(config, m_ppu, m_maincpu);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
CGB04_APU(config, m_apu, GBC_CLOCK / 2);
- m_apu->add_route(0, "lspeaker", 0.50);
- m_apu->add_route(1, "rspeaker", 0.50);
+ m_apu->add_route(0, "speaker", 0.50, 0);
+ m_apu->add_route(1, "speaker", 0.50, 1);
// cartslot
GB_CART_SLOT(config, m_cartslot, gameboy_cartridges, nullptr);
@@ -1199,11 +1196,10 @@ void megaduck_state::megaduck(machine_config &config)
DMG_PPU(config, m_ppu, m_maincpu);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DMG_APU(config, m_apu, XTAL(4'194'304));
- m_apu->add_route(0, "lspeaker", 0.50);
- m_apu->add_route(1, "rspeaker", 0.50);
+ m_apu->add_route(0, "speaker", 0.50, 0);
+ m_apu->add_route(1, "speaker", 0.50, 1);
// cartslot
MEGADUCK_CART_SLOT(config, m_cartslot, megaduck_cartridges, nullptr);
diff --git a/src/mame/nintendo/gba.cpp b/src/mame/nintendo/gba.cpp
index af5bdbba8e7..c9ab50537b1 100644
--- a/src/mame/nintendo/gba.cpp
+++ b/src/mame/nintendo/gba.cpp
@@ -1455,16 +1455,15 @@ void gba_state::gbadv(machine_config &config)
lcd.dma_hblank_callback().set(FUNC(gba_state::dma_hblank_callback));
lcd.dma_vblank_callback().set(FUNC(gba_state::dma_vblank_callback));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
AGB_APU(config, m_gbsound, 4.194304_MHz_XTAL);
- m_gbsound->add_route(0, "lspeaker", 0.5);
- m_gbsound->add_route(1, "rspeaker", 0.5);
+ m_gbsound->add_route(0, "speaker", 0.5, 0);
+ m_gbsound->add_route(1, "speaker", 0.5, 1);
- DAC_8BIT_R2R_TWOS_COMPLEMENT(config, m_ldac[0], 0).add_route(ALL_OUTPUTS, "lspeaker", 0.5); // unknown DAC
- DAC_8BIT_R2R_TWOS_COMPLEMENT(config, m_rdac[0], 0).add_route(ALL_OUTPUTS, "rspeaker", 0.5); // unknown DAC
- DAC_8BIT_R2R_TWOS_COMPLEMENT(config, m_ldac[1], 0).add_route(ALL_OUTPUTS, "lspeaker", 0.5); // unknown DAC
- DAC_8BIT_R2R_TWOS_COMPLEMENT(config, m_rdac[1], 0).add_route(ALL_OUTPUTS, "rspeaker", 0.5); // unknown DAC
+ DAC_8BIT_R2R_TWOS_COMPLEMENT(config, m_ldac[0], 0).add_route(ALL_OUTPUTS, "speaker", 0.5, 0); // unknown DAC
+ DAC_8BIT_R2R_TWOS_COMPLEMENT(config, m_rdac[0], 0).add_route(ALL_OUTPUTS, "speaker", 0.5, 1); // unknown DAC
+ DAC_8BIT_R2R_TWOS_COMPLEMENT(config, m_ldac[1], 0).add_route(ALL_OUTPUTS, "speaker", 0.5, 0); // unknown DAC
+ DAC_8BIT_R2R_TWOS_COMPLEMENT(config, m_rdac[1], 0).add_route(ALL_OUTPUTS, "speaker", 0.5, 1); // unknown DAC
}
diff --git a/src/mame/nintendo/n64.cpp b/src/mame/nintendo/n64.cpp
index d6936a46b5c..ea389fdb726 100644
--- a/src/mame/nintendo/n64.cpp
+++ b/src/mame/nintendo/n64.cpp
@@ -420,11 +420,10 @@ void n64_console_state::n64(machine_config &config)
PALETTE(config, "palette").set_entries(0x1000);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- DMADAC(config, "dac2").add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- DMADAC(config, "dac1").add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ DMADAC(config, "dac2").add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ DMADAC(config, "dac1").add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
N64PERIPH(config, m_rcp_periphs, 0);
diff --git a/src/mame/nintendo/n64_gateway.cpp b/src/mame/nintendo/n64_gateway.cpp
index 59974992707..d3a33d5227c 100644
--- a/src/mame/nintendo/n64_gateway.cpp
+++ b/src/mame/nintendo/n64_gateway.cpp
@@ -341,11 +341,10 @@ void n64_gateway_state::n64_lodgenet(machine_config &config)
PALETTE(config, "palette").set_entries(0x1000);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- DMADAC(config, "dac2").add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- DMADAC(config, "dac1").add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ DMADAC(config, "dac2").add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ DMADAC(config, "dac1").add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
N64PERIPH(config, m_rcp_periphs, 0);
diff --git a/src/mame/nintendo/nss.cpp b/src/mame/nintendo/nss.cpp
index 27c381bea95..7d985c6042c 100644
--- a/src/mame/nintendo/nss.cpp
+++ b/src/mame/nintendo/nss.cpp
@@ -848,13 +848,12 @@ void nss_state::nss(machine_config &config)
M6M80011AP(config, "m6m80011ap");
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
S_DSP(config, m_s_dsp, XTAL(24'576'000));
m_s_dsp->set_addrmap(0, &nss_state::spc_map);
- m_s_dsp->add_route(0, "lspeaker", 1.00);
- m_s_dsp->add_route(1, "rspeaker", 1.00);
+ m_s_dsp->add_route(0, "speaker", 1.00, 0);
+ m_s_dsp->add_route(1, "speaker", 1.00, 1);
/* video hardware */
/* TODO: the screen should actually superimpose, but for the time being let's just separate outputs */
diff --git a/src/mame/nintendo/popeye_v.cpp b/src/mame/nintendo/popeye_v.cpp
index 44427141856..cfa2cd8920a 100644
--- a/src/mame/nintendo/popeye_v.cpp
+++ b/src/mame/nintendo/popeye_v.cpp
@@ -192,31 +192,15 @@ void tnx1_state::update_palette()
void tnx1_state::background_w(offs_t offset, uint8_t data)
{
- // TODO: confirm the memory layout
- bool lsn = (data & 0x80) == 0;
- if (lsn)
- {
- m_background_ram[offset] = (m_background_ram[offset] & 0xf0) | (data & 0xf);
- }
- else
- {
- m_background_ram[offset] = (m_background_ram[offset] & 0x0f) | (data << 4);
- }
+ int shift = BIT(data, 7) ? 4 : 0;
+ m_background_ram[offset] = (m_background_ram[offset] & ~(0x0f << shift)) | ((data & 0xf) << shift);
}
void tpp2_state::background_w(offs_t offset, uint8_t data)
{
- // TODO: confirm the memory layout
- bool lsn = (offset & 0x40) == 0;
- offset = (offset & 0x3f) | ((offset & ~0x7f) >> 1);
- if (lsn)
- {
- m_background_ram[offset] = (m_background_ram[offset] & 0xf0) | (data & 0xf);
- }
- else
- {
- m_background_ram[offset] = (m_background_ram[offset] & 0x0f) | (data << 4);
- }
+ int shift = BIT(offset, 12) ? 4 : 0;
+ offset = BIT(offset, 0, 12);
+ m_background_ram[offset] = (m_background_ram[offset] & ~(0x0f << shift)) | ((data & 0xf) << shift);
}
void tnx1_state::popeye_videoram_w(offs_t offset, uint8_t data)
@@ -367,80 +351,47 @@ void tnx1_state::draw_field(bitmap_ind16 &bitmap, const rectangle &cliprect)
bitmap.pix(y, x) = 0;
}
-void tnx1_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect)
+void tnx1_state::draw_background(bitmap_ind16& bitmap, const rectangle& cliprect)
{
for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
{
- int sy = y;
- if (flip_screen())
- sy ^= 0x1ff;
-
- sy -= 0x200 - (2 * m_background_scroll[1]);
+ uint16_t rovi = (flip_screen() ? (y / 2) ^ 0xff : (y / 2)) + m_background_scroll[1];
for (int x = cliprect.min_x; x <= cliprect.max_x; x++)
{
- if (sy < 0)
- bitmap.pix(y, x) = m_background_ram[0] & 0xf; // TODO: find out exactly where the data is fetched from
- else
- {
- // TODO: confirm the memory layout
- int sx = x + (2 * (m_background_scroll[0] | ((m_background_scroll[2] & 1) << 8))) + 0x70;
- int shift = (sx & 0x200) / 0x80;
-
- bitmap.pix(y, x) = (m_background_ram[((sx / 8) & 0x3f) + ((sy / 8) * 0x40)] >> shift) & 0xf;
- }
+ uint16_t roh = 0x38 + (x / 2) + m_background_scroll[0] + (BIT(m_background_scroll[2], 0) << 8);
+ int shift = BIT(roh, 8) ? 4 : 0;
+ bitmap.pix(y, x) = (m_background_ram[BIT(rovi, 8) ? (BIT(rovi, 2, 6) << 6) | BIT(roh, 2, 6) : 0] >> shift) & 0xf;
}
}
}
-void tpp1_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect)
+void tpp1_state::draw_background(bitmap_ind16& bitmap, const rectangle& cliprect)
{
for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
{
- int sy = y;
- if (flip_screen())
- sy ^= 0x1ff;
-
- sy -= 0x200 - (2 * m_background_scroll[1]);
+ uint16_t rovi = (flip_screen() ? (y / 2) ^ 0xff : (y / 2)) + m_background_scroll[1];
for (int x = cliprect.min_x; x <= cliprect.max_x; x++)
{
- if (sy < 0)
- bitmap.pix(y, x) = m_background_ram[0] & 0xf; // TODO: find out exactly where the data is fetched from
- else
- {
- // TODO: confirm the memory layout
- int sx = x + (2 * m_background_scroll[0]) + 0x70;
- int shift = (sy & 4);
-
- bitmap.pix(y, x) = (m_background_ram[((sx / 8) & 0x3f) + ((sy / 8) * 0x40)] >> shift) & 0xf;
- }
+ uint16_t roh = 0x38 + (x / 2) + m_background_scroll[0] + (BIT(m_background_scroll[2], 0) << 8);
+ int shift = BIT(rovi, 1) ? 4 : 0;
+ bitmap.pix(y, x) = (m_background_ram[BIT(rovi, 8) ? (BIT(rovi, 2, 6) << 6) | BIT(roh, 2, 6) : 0] >> shift) & 0xf;
}
}
}
-void tpp2_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect)
+void tpp2_state::draw_background(bitmap_ind16& bitmap, const rectangle& cliprect)
{
for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
{
- int sy = y;
- if (flip_screen())
- sy ^= 0x1ff;
-
- sy -= 0x200 - (2 * m_background_scroll[1]);
+ uint16_t rovi = (flip_screen() ? (y / 2) ^ 0xff : (y / 2)) + m_background_scroll[1];
for (int x = cliprect.min_x; x <= cliprect.max_x; x++)
{
- if (sy < 0)
- bitmap.pix(y, x) = m_background_ram[((sy & 0x100) / 8) * 0x40] & 0xf;
- else
- {
- // TODO: confirm the memory layout
- int sx = x + (2 * m_background_scroll[0]) + 0x70;
- int shift = (sy & 4);
-
- bitmap.pix(y, x) = (m_background_ram[((sx / 8) & 0x3f) + ((sy / 8) * 0x40)] >> shift) & 0xf;
- }
+ uint8_t roh = 0x38 + (x / 2) + m_background_scroll[0];
+ int shift = BIT(rovi, 7) ? 4 : 0;
+ bitmap.pix(y, x) = (m_background_ram[BIT(rovi, 8) ? (BIT(rovi, 1, 6) << 6) | BIT(roh, 2, 6) : 0] >> shift) & 0xf;
}
}
}
diff --git a/src/mame/nintendo/punchout.cpp b/src/mame/nintendo/punchout.cpp
index fbe0d95bad3..f8649010ebc 100644
--- a/src/mame/nintendo/punchout.cpp
+++ b/src/mame/nintendo/punchout.cpp
@@ -652,16 +652,15 @@ void punchout_state::punchout(machine_config &config)
bottom.set_palette(m_palette);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, "soundlatch");
GENERIC_LATCH_8(config, "soundlatch2");
VLM5030(config, m_vlm, RP2A03_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);
+ m_vlm->add_route(ALL_OUTPUTS, "speaker", 0.50, 0);
+ m_audiocpu->add_route(ALL_OUTPUTS, "speaker", 0.50, 1);
}
diff --git a/src/mame/nintendo/sfcbox.cpp b/src/mame/nintendo/sfcbox.cpp
index d4702cea3e4..2458dab5e7a 100644
--- a/src/mame/nintendo/sfcbox.cpp
+++ b/src/mame/nintendo/sfcbox.cpp
@@ -468,13 +468,12 @@ void sfcbox_state::sfcbox(machine_config &config)
S3520CF(config, m_s3520cf); /* RTC */
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
S_DSP(config, m_s_dsp, XTAL(24'576'000));
m_s_dsp->set_addrmap(0, &sfcbox_state::spc_map);
- m_s_dsp->add_route(0, "lspeaker", 1.00);
- m_s_dsp->add_route(1, "rspeaker", 1.00);
+ m_s_dsp->add_route(0, "speaker", 1.00, 0);
+ m_s_dsp->add_route(1, "speaker", 1.00, 1);
/* video hardware */
/* TODO: the screen should actually superimpose, but for the time being let's just separate outputs */
diff --git a/src/mame/nintendo/snes.cpp b/src/mame/nintendo/snes.cpp
index 27e32acabb2..5ffa20d5779 100644
--- a/src/mame/nintendo/snes.cpp
+++ b/src/mame/nintendo/snes.cpp
@@ -1365,13 +1365,12 @@ void snes_console_state::snes(machine_config &config)
m_ctrl2->set_gunlatch_callback(FUNC(snes_console_state::gun_latch_cb));
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
S_DSP(config, m_s_dsp, XTAL(24'576'000));
m_s_dsp->set_addrmap(0, &snes_console_state::spc_map);
- m_s_dsp->add_route(0, "lspeaker", 1.00);
- m_s_dsp->add_route(1, "rspeaker", 1.00);
+ m_s_dsp->add_route(0, "speaker", 1.00, 0);
+ m_s_dsp->add_route(1, "speaker", 1.00, 1);
SNS_CART_SLOT(config, m_cartslot, MCLK_NTSC, snes_cart, nullptr);
m_cartslot->set_must_be_loaded(true);
diff --git a/src/mame/nintendo/snesb.cpp b/src/mame/nintendo/snesb.cpp
index 9b5111e5717..d3d3fdf6590 100644
--- a/src/mame/nintendo/snesb.cpp
+++ b/src/mame/nintendo/snesb.cpp
@@ -1016,13 +1016,12 @@ void snesb_state::base(machine_config &config)
m_ppu->set_screen("screen");
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
S_DSP(config, m_s_dsp, XTAL(24'576'000));
m_s_dsp->set_addrmap(0, &snesb_state::spc_map);
- m_s_dsp->add_route(0, "lspeaker", 1.00);
- m_s_dsp->add_route(1, "rspeaker", 1.00);
+ m_s_dsp->add_route(0, "speaker", 1.00, 0);
+ m_s_dsp->add_route(1, "speaker", 1.00, 1);
}
void snesb_state::extrainp(machine_config &config)
diff --git a/src/mame/nintendo/snesb51.cpp b/src/mame/nintendo/snesb51.cpp
index c1fdd2d59b8..07f94623866 100644
--- a/src/mame/nintendo/snesb51.cpp
+++ b/src/mame/nintendo/snesb51.cpp
@@ -271,13 +271,12 @@ void snesb51_state::base(machine_config &config)
m_ppu->set_screen("screen");
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
S_DSP(config, m_s_dsp, XTAL(24'576'000));
m_s_dsp->set_addrmap(0, &snesb51_state::spc_map);
- m_s_dsp->add_route(0, "lspeaker", 1.00);
- m_s_dsp->add_route(1, "rspeaker", 1.00);
+ m_s_dsp->add_route(0, "speaker", 1.00, 0);
+ m_s_dsp->add_route(1, "speaker", 1.00, 1);
}
void snesb51_state::mk3snes(machine_config &config)
diff --git a/src/mame/nintendo/vboy.cpp b/src/mame/nintendo/vboy.cpp
index 0a75ed431bc..98bf25c4d21 100644
--- a/src/mame/nintendo/vboy.cpp
+++ b/src/mame/nintendo/vboy.cpp
@@ -1273,11 +1273,10 @@ void vboy_state::vboy(machine_config &config)
SOFTWARE_LIST(config, "cart_list").set_original("vboy");
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
vboysnd_device &vbsnd(VBOYSND(config, "vbsnd"));
- vbsnd.add_route(0, "lspeaker", 1.0);
- vbsnd.add_route(1, "rspeaker", 1.0);
+ vbsnd.add_route(0, "speaker", 1.0, 0);
+ vbsnd.add_route(1, "speaker", 1.0, 1);
}
/* ROM definition */
diff --git a/src/mame/nintendo/vsnes.cpp b/src/mame/nintendo/vsnes.cpp
index 714350e8e27..0f88a601dda 100644
--- a/src/mame/nintendo/vsnes.cpp
+++ b/src/mame/nintendo/vsnes.cpp
@@ -2588,10 +2588,9 @@ void vs_dual_state::vsdual(machine_config &config)
m_ppu2->int_callback().set_inputline(m_subcpu, INPUT_LINE_NMI);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
- maincpu.add_route(ALL_OUTPUTS, "lspeaker", 0.50);
- subcpu.add_route(ALL_OUTPUTS, "rspeaker", 0.50);
+ SPEAKER(config, "speaker", 2).front();
+ maincpu.add_route(ALL_OUTPUTS, "speaker", 0.50, 0);
+ subcpu.add_route(ALL_OUTPUTS, "speaker", 0.50, 1);
// watchdog resets system between 1.23s and 1.33s in hardware tests, exact timing unknown
WATCHDOG_TIMER(config, m_watchdog).set_time(attotime::from_msec(1300));
diff --git a/src/mame/nintendo/vt1682.cpp b/src/mame/nintendo/vt1682.cpp
index 676ff96b795..c91f691f12a 100644
--- a/src/mame/nintendo/vt1682.cpp
+++ b/src/mame/nintendo/vt1682.cpp
@@ -5789,11 +5789,10 @@ void vt_vt1682_state::vt_vt1682_common(machine_config& config)
VT_VT1682_IO(config, m_io, 0);
VT_VT1682_UIO(config, m_uio, 0);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- DAC_12BIT_R2R(config, m_leftdac, 0).add_route(0, "lspeaker", 0.5); // unknown 12-bit DAC
- DAC_12BIT_R2R(config, m_rightdac, 0).add_route(0, "rspeaker", 0.5); // unknown 12-bit DAC
+ DAC_12BIT_R2R(config, m_leftdac, 0).add_route(0, "speaker", 0.5, 0); // unknown 12-bit DAC
+ DAC_12BIT_R2R(config, m_rightdac, 0).add_route(0, "speaker", 0.5, 1); // unknown 12-bit DAC
}
@@ -6178,8 +6177,7 @@ void intec_interact_state::intech_interact(machine_config& config)
m_leftdac->reset_routes();
m_rightdac->reset_routes();
- config.device_remove(":lspeaker");
- config.device_remove(":rspeaker");
+ config.device_remove(":speaker");
SPEAKER(config, "mono").front_center();
m_leftdac->add_route(0, "mono", 0.5);
@@ -6241,8 +6239,7 @@ void vt1682_dance_state::vt1682_dance(machine_config& config)
m_leftdac->reset_routes();
m_rightdac->reset_routes();
- config.device_remove(":lspeaker");
- config.device_remove(":rspeaker");
+ config.device_remove(":speaker");
SPEAKER(config, "mono").front_center();
m_leftdac->add_route(0, "mono", 0.5);
@@ -6271,8 +6268,7 @@ void vt1682_lxts3_state::vt1682_lxts3(machine_config& config)
m_leftdac->reset_routes();
m_rightdac->reset_routes();
- config.device_remove(":lspeaker");
- config.device_remove(":rspeaker");
+ config.device_remove(":speaker");
SPEAKER(config, "mono").front_center();
m_leftdac->add_route(0, "mono", 0.5);
@@ -6296,8 +6292,7 @@ void vt1682_mx10_state::mx10(machine_config& config)
m_leftdac->reset_routes();
m_rightdac->reset_routes();
- config.device_remove(":lspeaker");
- config.device_remove(":rspeaker");
+ config.device_remove(":speaker");
SPEAKER(config, "mono").front_center();
m_leftdac->add_route(0, "mono", 0.5);
@@ -6315,8 +6310,7 @@ void vt1682_lxts3_state::vt1682_unk1682(machine_config& config)
m_leftdac->reset_routes();
m_rightdac->reset_routes();
- config.device_remove(":lspeaker");
- config.device_remove(":rspeaker");
+ config.device_remove(":speaker");
SPEAKER(config, "mono").front_center();
m_leftdac->add_route(0, "mono", 0.5);
diff --git a/src/mame/nmk/macrossp.cpp b/src/mame/nmk/macrossp.cpp
index 5e6d021e1e4..f4628b3528e 100644
--- a/src/mame/nmk/macrossp.cpp
+++ b/src/mame/nmk/macrossp.cpp
@@ -1016,8 +1016,7 @@ void macrossp_state::macrossp(machine_config &config)
PALETTE(config, m_palette).set_format(palette_device::RGBx_888, 4096);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_16(config, m_soundlatch);
@@ -1026,8 +1025,8 @@ void macrossp_state::macrossp(machine_config &config)
ensoniq.set_addrmap(1, &macrossp_state::es5506_bank1_map);
ensoniq.set_channels(1);
ensoniq.irq_cb().set(FUNC(macrossp_state::irqhandler));
- ensoniq.add_route(0, "lspeaker", 0.1);
- ensoniq.add_route(1, "rspeaker", 0.1);
+ ensoniq.add_route(0, "speaker", 0.1, 0);
+ ensoniq.add_route(1, "speaker", 0.1, 1);
}
void macrossp_state::quizmoon(machine_config &config)
diff --git a/src/mame/nmk/nmkmedal.cpp b/src/mame/nmk/nmkmedal.cpp
index 503aec9330c..ca66536f9e6 100644
--- a/src/mame/nmk/nmkmedal.cpp
+++ b/src/mame/nmk/nmkmedal.cpp
@@ -372,12 +372,11 @@ void omatsuri_state::omatsuri(machine_config &config)
TMP90841(config, m_maincpu, 16_MHz_XTAL / 2);
m_maincpu->set_addrmap(AS_PROGRAM, &omatsuri_state::mem_map);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ymz280b_device &ymz(YMZ280B(config, "ymz", 16_MHz_XTAL));
- ymz.add_route(0, "lspeaker", 1.0);
- ymz.add_route(1, "rspeaker", 1.0);
+ ymz.add_route(0, "speaker", 1.0, 0);
+ ymz.add_route(1, "speaker", 1.0, 1);
}
diff --git a/src/mame/oberheim/dmx.cpp b/src/mame/oberheim/dmx.cpp
index b7b95b1653f..9e69528908b 100644
--- a/src/mame/oberheim/dmx.cpp
+++ b/src/mame/oberheim/dmx.cpp
@@ -184,7 +184,7 @@ protected:
void device_add_mconfig(machine_config &config) override ATTR_COLD;
void device_start() override ATTR_COLD;
void device_reset() override ATTR_COLD;
- void sound_stream_update(sound_stream &stream, const std::vector<read_stream_view> &inputs, std::vector<write_stream_view> &outputs) override;
+ void sound_stream_update(sound_stream &stream) override;
private:
void reset_counter();
@@ -339,9 +339,9 @@ void dmx_voice_card_device::device_reset()
m_eg->set_instant_v(0);
}
-void dmx_voice_card_device::sound_stream_update(sound_stream &stream, const std::vector<read_stream_view> &inputs, std::vector<write_stream_view> &outputs)
+void dmx_voice_card_device::sound_stream_update(sound_stream &stream)
{
- outputs[0].copy(inputs[0]);
+ stream.copy(0, 0);
}
void dmx_voice_card_device::reset_counter()
@@ -786,8 +786,8 @@ public:
, m_voice_rc(*this, "voice_rc_filter_%d", 0)
, m_left_mixer(*this, "left_mixer")
, m_right_mixer(*this, "right_mixer")
- , m_left_speaker(*this, "lspeaker")
- , m_right_speaker(*this, "rspeaker")
+ , m_mono_mixer(*this, "mono_mixer")
+ , m_speaker(*this, "speaker")
, m_samples(*this, "sample_%d", 0)
{
}
@@ -852,8 +852,8 @@ private:
required_device_array<filter_rc_device, 9> m_voice_rc;
required_device<mixer_device> m_left_mixer;
required_device<mixer_device> m_right_mixer;
- required_device<speaker_device> m_left_speaker;
- required_device<speaker_device> m_right_speaker;
+ required_device<mixer_device> m_mono_mixer;
+ required_device<speaker_device> m_speaker;
required_memory_region_array<8> m_samples;
// 40103 timer (U11 in Processor Board)
@@ -1177,10 +1177,10 @@ template<int GROUP> void dmx_state::gen_trigger_w(u8 data)
void dmx_state::update_output()
{
const float stereo_gain = (m_output_select->read() & 0x01) ? 1 : 0;
- m_left_speaker->set_input_gain(0, stereo_gain); // left
- m_left_speaker->set_input_gain(1, 1 - stereo_gain); // mono
- m_right_speaker->set_input_gain(0, stereo_gain); // right
- m_right_speaker->set_input_gain(1, 1 - stereo_gain); // mono
+ m_left_mixer ->set_route_gain(0, m_speaker, 0, stereo_gain);
+ m_mono_mixer ->set_route_gain(0, m_speaker, 0, 1 - stereo_gain);
+ m_right_mixer->set_route_gain(0, m_speaker, 1, stereo_gain);
+ m_mono_mixer ->set_route_gain(0, m_speaker, 1, 1 - stereo_gain);
LOGMASKED(LOG_FADERS, "Output changed to: %d\n", m_output_select->read());
}
@@ -1222,8 +1222,8 @@ void dmx_state::update_mix_level(int voice)
const float rc_c = (voice == METRONOME_INDEX) ? PB_C24 : VC_C10;
m_voice_rc[voice]->filter_rc_set_RC(filter_rc_device::HIGHPASS, rc_r, 0, 0, rc_c);
- m_left_mixer->set_input_gain(voice, gain_left);
- m_right_mixer->set_input_gain(voice, gain_right);
+ m_voice_rc[voice]->set_route_gain(0, m_left_mixer, 0, gain_left);
+ m_voice_rc[voice]->set_route_gain(0, m_right_mixer, 0, gain_right);
LOGMASKED(LOG_FADERS, "Voice %d volume changed to: %d (gain L:%f, R:%f), HPF cutoff: %.2f Hz\n",
voice, pot_percent, gain_left, gain_right, 1.0F / (2 * float(M_PI) * r_gnd * rc_c));
@@ -1364,20 +1364,18 @@ void dmx_state::dmx(machine_config &config)
m_voice_rc[METRONOME_INDEX]->add_route(ALL_OUTPUTS, m_right_mixer, 1.0);
// Passive mixer using 1K resistors (R33 and R34).
- mixer_device &mono_mixer = MIXER(config, "mono_mixer");
- m_left_mixer->add_route(ALL_OUTPUTS, mono_mixer, 0.5);
- m_right_mixer->add_route(ALL_OUTPUTS, mono_mixer, 0.5);
+ MIXER(config, m_mono_mixer);
+ m_left_mixer->add_route(ALL_OUTPUTS, m_mono_mixer, 0.5);
+ m_right_mixer->add_route(ALL_OUTPUTS, m_mono_mixer, 0.5);
// Only one of the left (right) or mono will be active for each speaker at
// runtime. Controlled by a config setting (see update_output()).
- SPEAKER(config, m_left_speaker).front_left();
- m_left_mixer->add_route(ALL_OUTPUTS, m_left_speaker, 1.0);
- mono_mixer.add_route(ALL_OUTPUTS, m_left_speaker, 1.0);
-
- SPEAKER(config, m_right_speaker).front_right();
- m_right_mixer->add_route(ALL_OUTPUTS, m_right_speaker, 1.0);
- mono_mixer.add_route(ALL_OUTPUTS, m_right_speaker, 1.0);
+ SPEAKER(config, m_speaker, 2).front();
+ m_left_mixer->add_route(ALL_OUTPUTS, m_speaker, 1.0, 0);
+ m_mono_mixer->add_route(ALL_OUTPUTS, m_speaker, 1.0, 0);
+ m_right_mixer->add_route(ALL_OUTPUTS, m_speaker, 1.0, 1);
+ m_mono_mixer->add_route(ALL_OUTPUTS, m_speaker, 1.0, 1);
}
DECLARE_INPUT_CHANGED_MEMBER(dmx_state::clk_in_changed)
diff --git a/src/mame/pc/calchase.cpp b/src/mame/pc/calchase.cpp
index 110d0b3bc38..cf7d58bb784 100644
--- a/src/mame/pc/calchase.cpp
+++ b/src/mame/pc/calchase.cpp
@@ -183,10 +183,9 @@ void isa16_calchase_jamma_if::device_add_mconfig(machine_config &config)
{
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); // DS1220Y
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
- DAC_12BIT_R2R(config, "ldac", 0).add_route(ALL_OUTPUTS, "lspeaker", 0.25); // unknown DAC
- DAC_12BIT_R2R(config, "rdac", 0).add_route(ALL_OUTPUTS, "rspeaker", 0.25); // unknown DAC
+ SPEAKER(config, "speaker", 2).front();
+ DAC_12BIT_R2R(config, "ldac", 0).add_route(ALL_OUTPUTS, "speaker", 0.25, 0); // unknown DAC
+ DAC_12BIT_R2R(config, "rdac", 0).add_route(ALL_OUTPUTS, "speaker", 0.25, 1); // unknown DAC
}
void isa16_calchase_jamma_if::device_start()
diff --git a/src/mame/pce/ggconnie.cpp b/src/mame/pce/ggconnie.cpp
index 47811c284e3..570c8529eff 100644
--- a/src/mame/pce/ggconnie.cpp
+++ b/src/mame/pce/ggconnie.cpp
@@ -406,8 +406,8 @@ void ggconnie_state::ggconnie(machine_config &config)
m_maincpu->set_addrmap(AS_IO, &ggconnie_state::sgx_io);
m_maincpu->port_in_cb().set_ioport("IN0");
m_maincpu->port_out_cb().set(FUNC(ggconnie_state::lamp_w));
- m_maincpu->add_route(0, "lspeaker", 1.00);
- m_maincpu->add_route(1, "rspeaker", 1.00);
+ m_maincpu->add_route(0, "speaker", 1.00, 0);
+ m_maincpu->add_route(1, "speaker", 1.00, 1);
// video hardware
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
@@ -447,13 +447,12 @@ void ggconnie_state::ggconnie(machine_config &config)
MSM6242(config, m_rtc, XTAL(32'768));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
OKIM6295(config, m_oki, 2_MHz_XTAL, okim6295_device::PIN7_HIGH); // 2MHz resonator, pin 7 verified
m_oki->set_addrmap(0, &ggconnie_state::oki_map);
- m_oki->add_route(ALL_OUTPUTS, "lspeaker", 1.00);
- m_oki->add_route(ALL_OUTPUTS, "rspeaker", 1.00);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 1.00, 0);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 1.00, 1);
}
ROM_START(ggconnie)
diff --git a/src/mame/pce/paranoia.cpp b/src/mame/pce/paranoia.cpp
index 2d859ac48b4..6201622422b 100644
--- a/src/mame/pce/paranoia.cpp
+++ b/src/mame/pce/paranoia.cpp
@@ -175,8 +175,8 @@ void paranoia_state::paranoia(machine_config &config)
m_maincpu->set_addrmap(AS_IO, &paranoia_state::pce_io);
m_maincpu->port_in_cb().set(FUNC(paranoia_state::pce_joystick_r));
m_maincpu->port_out_cb().set(FUNC(paranoia_state::pce_joystick_w));
- m_maincpu->add_route(0, "lspeaker", 1.00);
- m_maincpu->add_route(1, "rspeaker", 1.00);
+ m_maincpu->add_route(0, "speaker", 1.00, 0);
+ m_maincpu->add_route(1, "speaker", 1.00, 1);
config.set_maximum_quantum(attotime::from_hz(60));
@@ -210,8 +210,7 @@ void paranoia_state::paranoia(machine_config &config)
huc6270.set_vram_size(0x10000);
huc6270.irq().set_inputline(m_maincpu, 0);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
ROM_START(paranoia)
diff --git a/src/mame/pce/tourvis.cpp b/src/mame/pce/tourvis.cpp
index bfd0ea18c4c..b56900fd930 100644
--- a/src/mame/pce/tourvis.cpp
+++ b/src/mame/pce/tourvis.cpp
@@ -400,8 +400,8 @@ void tourvision_state::tourvision(machine_config &config)
m_maincpu->set_addrmap(AS_IO, &tourvision_state::pce_io);
m_maincpu->port_in_cb().set(FUNC(tourvision_state::pce_joystick_r));
m_maincpu->port_out_cb().set(FUNC(tourvision_state::pce_joystick_w));
- m_maincpu->add_route(0, "lspeaker", 1.00);
- m_maincpu->add_route(1, "rspeaker", 1.00);
+ m_maincpu->add_route(0, "speaker", 1.00, 0);
+ m_maincpu->add_route(1, "speaker", 1.00, 1);
config.set_maximum_quantum(attotime::from_hz(60));
@@ -430,8 +430,7 @@ void tourvision_state::tourvision(machine_config &config)
i8155.out_pc_callback().set(FUNC(tourvision_state::tourvision_i8155_c_w));
i8155.out_to_callback().set(FUNC(tourvision_state::tourvision_timer_out));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
generic_cartslot_device &cartslot(GENERIC_CARTSLOT(config, "cartslot", generic_plain_slot, "tourvision_cart", "bin"));
cartslot.set_device_load(FUNC(tourvision_state::cart_load));
diff --git a/src/mame/pce/uapce.cpp b/src/mame/pce/uapce.cpp
index e8d84becebc..563acc56026 100644
--- a/src/mame/pce/uapce.cpp
+++ b/src/mame/pce/uapce.cpp
@@ -331,8 +331,8 @@ void uapce_state::uapce(machine_config &config)
m_maincpu->set_addrmap(AS_IO, &uapce_state::pce_io);
m_maincpu->port_in_cb().set(FUNC(uapce_state::pce_joystick_r));
m_maincpu->port_out_cb().set(FUNC(uapce_state::pce_joystick_w));
- m_maincpu->add_route(0, "lspeaker", 0.5);
- m_maincpu->add_route(1, "rspeaker", 0.5);
+ m_maincpu->add_route(0, "speaker", 0.5, 0);
+ m_maincpu->add_route(1, "speaker", 0.5, 1);
z80_device &sub(Z80(config, "sub", 1400000));
sub.set_addrmap(AS_PROGRAM, &uapce_state::z80_map);
@@ -355,10 +355,9 @@ void uapce_state::uapce(machine_config &config)
huc6270.set_vram_size(0x10000);
huc6270.irq().set_inputline(m_maincpu, 0);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- DISCRETE(config, m_discrete, uapce_discrete).add_route(0, "rspeaker", 1.00);
+ DISCRETE(config, m_discrete, uapce_discrete).add_route(0, "speaker", 1.00, 1);
}
ROM_START(blazlaz)
diff --git a/src/mame/philips/cdi.cpp b/src/mame/philips/cdi.cpp
index 09d376931d8..37f74a9b004 100644
--- a/src/mame/philips/cdi.cpp
+++ b/src/mame/philips/cdi.cpp
@@ -462,14 +462,13 @@ void cdi_state::cdimono1_base(machine_config &config)
m_cdrom->set_interface("cdrom");
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DMADAC(config, m_dmadac[0]);
- m_dmadac[0]->add_route(ALL_OUTPUTS, "lspeaker", 1.0);
+ m_dmadac[0]->add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
DMADAC(config, m_dmadac[1]);
- m_dmadac[1]->add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ m_dmadac[1]->add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
MK48T08(config, "mk48t08");
}
@@ -508,14 +507,13 @@ void cdi_state::cdimono2(machine_config &config)
SOFTWARE_LIST(config, "photocd_list").set_compatible("photo_cd");
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DMADAC(config, m_dmadac[0]);
- m_dmadac[0]->add_route(ALL_OUTPUTS, "lspeaker", 1.0);
+ m_dmadac[0]->add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
DMADAC(config, m_dmadac[1]);
- m_dmadac[1]->add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ m_dmadac[1]->add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
MK48T08(config, "mk48t08");
}
@@ -553,14 +551,13 @@ void cdi_state::cdi910(machine_config &config)
SOFTWARE_LIST(config, "photocd_list").set_compatible("photo_cd");
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DMADAC(config, m_dmadac[0]);
- m_dmadac[0]->add_route(ALL_OUTPUTS, "lspeaker", 1.0);
+ m_dmadac[0]->add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
DMADAC(config, m_dmadac[1]);
- m_dmadac[1]->add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ m_dmadac[1]->add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
MK48T08(config, "mk48t08");
}
diff --git a/src/mame/phoenix/phoenix_a.cpp b/src/mame/phoenix/phoenix_a.cpp
index 0f24cd62de4..f02882de6d0 100644
--- a/src/mame/phoenix/phoenix_a.cpp
+++ b/src/mame/phoenix/phoenix_a.cpp
@@ -522,15 +522,14 @@ void phoenix_sound_device::control_b_w(uint8_t data)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void phoenix_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void phoenix_sound_device::sound_stream_update(sound_stream &stream)
{
- auto &buffer = outputs[0];
- int samplerate = buffer.sample_rate();
+ int samplerate = stream.sample_rate();
- for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
int sum = 0;
sum = noise(samplerate) / 2;
- buffer.put_int_clamp(sampindex, sum, 32768);
+ stream.put_int_clamp(0, sampindex, sum, 32768);
}
}
diff --git a/src/mame/phoenix/phoenix_a.h b/src/mame/phoenix/phoenix_a.h
index 7cb6097f487..5a9be29e71f 100644
--- a/src/mame/phoenix/phoenix_a.h
+++ b/src/mame/phoenix/phoenix_a.h
@@ -22,7 +22,7 @@ protected:
virtual void device_start() 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;
private:
struct c_state
diff --git a/src/mame/phoenix/pleiads.cpp b/src/mame/phoenix/pleiads.cpp
index f2fdf14e2ee..9698a84434f 100644
--- a/src/mame/phoenix/pleiads.cpp
+++ b/src/mame/phoenix/pleiads.cpp
@@ -694,24 +694,23 @@ void pleiads_sound_device::common_start()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void pleiads_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void pleiads_sound_device::sound_stream_update(sound_stream &stream)
{
- auto &buffer = outputs[0];
- int rate = buffer.sample_rate();
+ int rate = stream.sample_rate();
- for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
int sum = tone1(rate)/2 + tone23(rate)/2 + tone4(rate) + noise(rate);
- buffer.put_int_clamp(sampindex, sum, 32768);
+ stream.put_int_clamp(0, sampindex, sum, 32768);
}
}
-void naughtyb_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void naughtyb_sound_device::sound_stream_update(sound_stream &stream)
{
- pleiads_sound_device::sound_stream_update(stream, inputs, outputs);
+ pleiads_sound_device::sound_stream_update(stream);
}
-void popflame_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void popflame_sound_device::sound_stream_update(sound_stream &stream)
{
- pleiads_sound_device::sound_stream_update(stream, inputs, outputs);
+ pleiads_sound_device::sound_stream_update(stream);
}
diff --git a/src/mame/phoenix/pleiads.h b/src/mame/phoenix/pleiads.h
index 8ae08cb88a2..a93bd6d3e32 100644
--- a/src/mame/phoenix/pleiads.h
+++ b/src/mame/phoenix/pleiads.h
@@ -51,7 +51,7 @@ protected:
virtual void device_start() 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;
void common_start();
inline int tone1(int samplerate);
@@ -105,7 +105,7 @@ protected:
virtual void device_start() 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;
};
@@ -119,7 +119,7 @@ protected:
virtual void device_start() 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;
};
diff --git a/src/mame/pinball/alvg.cpp b/src/mame/pinball/alvg.cpp
index 2fad5e6a868..409ff508ea5 100644
--- a/src/mame/pinball/alvg.cpp
+++ b/src/mame/pinball/alvg.cpp
@@ -559,13 +559,12 @@ void alvg_state::pca008(machine_config &config)
m_audiocpu->set_addrmap(AS_PROGRAM, &alvg_state::pca008_map);
m_via1->writepa_handler().set(FUNC(alvg_state::via1_pa_w));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
BSMT2000(config, m_bsmt, XTAL(24'000'000));
m_bsmt->set_ready_callback(FUNC(alvg_state::bsmt_ready_w));
- m_bsmt->add_route(0, "lspeaker", 1.2);
- m_bsmt->add_route(1, "rspeaker", 1.2);
+ m_bsmt->add_route(0, "speaker", 1.2, 0);
+ m_bsmt->add_route(1, "speaker", 1.2, 1);
CLOCK(config, "fclock", 2'000'000 / 4096).signal_handler().set_inputline(m_audiocpu, 1);
}
diff --git a/src/mame/pinball/de_3.cpp b/src/mame/pinball/de_3.cpp
index 2522e3f90b4..cb657e58560 100644
--- a/src/mame/pinball/de_3.cpp
+++ b/src/mame/pinball/de_3.cpp
@@ -527,12 +527,11 @@ void de_3_state::de_3_dmd2(machine_config &config)
de_3(config);
DECODMD2(config, m_dmdtype2, 0);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DECOBSMT(config, m_decobsmt, 0);
- m_decobsmt->add_route(0, "lspeaker", 1.0);
- m_decobsmt->add_route(1, "rspeaker", 1.0);
+ m_decobsmt->add_route(0, "speaker", 1.0, 0);
+ m_decobsmt->add_route(1, "speaker", 1.0, 1);
}
void de_3_state::de_3_dmd1(machine_config &config)
@@ -540,12 +539,11 @@ void de_3_state::de_3_dmd1(machine_config &config)
de_3(config);
DECODMD1(config, m_dmdtype1, 0);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DECOBSMT(config, m_decobsmt, 0);
- m_decobsmt->add_route(0, "lspeaker", 1.0);
- m_decobsmt->add_route(1, "rspeaker", 1.0);
+ m_decobsmt->add_route(0, "speaker", 1.0, 0);
+ m_decobsmt->add_route(1, "speaker", 1.0, 1);
}
void de_3_state::de_3_dmdo(machine_config &config)
@@ -573,12 +571,11 @@ void de_3_state::de_3b(machine_config &config)
DECODMD3(config, m_dmdtype3, 0);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DECOBSMT(config, m_decobsmt, 0);
- m_decobsmt->add_route(0, "lspeaker", 1.0);
- m_decobsmt->add_route(1, "rspeaker", 1.0);
+ m_decobsmt->add_route(0, "speaker", 1.0, 0);
+ m_decobsmt->add_route(1, "speaker", 1.0, 1);
}
void de_3_state::detest(machine_config &config)
diff --git a/src/mame/pinball/idsa.cpp b/src/mame/pinball/idsa.cpp
index 6aded4eb558..6ba4ffdc3db 100644
--- a/src/mame/pinball/idsa.cpp
+++ b/src/mame/pinball/idsa.cpp
@@ -356,20 +356,19 @@ void idsa_state::idsa(machine_config &config)
/* sound hardware */
genpin_audio(config);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
SP0256(config, m_speech, 3120000); // unknown variant
- m_speech->add_route(ALL_OUTPUTS, "lspeaker", 1.5);
+ m_speech->add_route(ALL_OUTPUTS, "speaker", 1.5, 0);
ay8910_device &aysnd1(AY8910(config, "aysnd1", 2000000)); // 2Mhz according to pinmame, schematic omits the clock line
aysnd1.port_a_write_callback().set(FUNC(idsa_state::ay1_a_w));
aysnd1.port_b_write_callback().set(FUNC(idsa_state::ay1_b_w));
- aysnd1.add_route(ALL_OUTPUTS, "lspeaker", 0.75);
+ aysnd1.add_route(ALL_OUTPUTS, "speaker", 0.75, 0);
ay8910_device &aysnd2(AY8910(config, "aysnd2", 2000000));
aysnd2.port_a_write_callback().set(FUNC(idsa_state::ay2_a_w));
aysnd2.port_b_write_callback().set(FUNC(idsa_state::ay2_b_w));
- aysnd2.add_route(ALL_OUTPUTS, "rspeaker", 0.75);
+ aysnd2.add_route(ALL_OUTPUTS, "speaker", 0.75, 1);
}
void idsa_state::bsktbllp(machine_config &config)
diff --git a/src/mame/pinball/lancelot.cpp b/src/mame/pinball/lancelot.cpp
index 71d89d112eb..01c06954ba5 100644
--- a/src/mame/pinball/lancelot.cpp
+++ b/src/mame/pinball/lancelot.cpp
@@ -183,14 +183,14 @@ void lancelot_state::lancelot(machine_config &config)
OKIM6295(config, m_oki, 1'656'000, okim6295_device::PIN7_HIGH); // pin7 is controlled by P63 from the audio cpu
m_oki->add_route(ALL_OUTPUTS, "mono", 0.50);
- SPEAKER(config, "lspeaker").front_left(); // YAC512 left
- SPEAKER(config, "rspeaker").front_right(); // YAC512 right
+ SPEAKER(config, "speaker", 2).front(); // YAC512 left
+ // YAC512 right
ymf262_device &ymf(YMF262(config, "ymf", 14'318'180));
ymf.irq_handler().set_inputline("audiocpu", 2); // to P82/INT2 of the audio cpu
- ymf.add_route(0, "lspeaker", 0.50);
- ymf.add_route(1, "rspeaker", 0.50);
- ymf.add_route(2, "lspeaker", 0.50);
- ymf.add_route(3, "rspeaker", 0.50);
+ ymf.add_route(0, "speaker", 0.50, 0);
+ ymf.add_route(1, "speaker", 0.50, 1);
+ ymf.add_route(2, "speaker", 0.50, 0);
+ ymf.add_route(3, "speaker", 0.50, 1);
}
/*-------------------------------------------------------------------
diff --git a/src/mame/pinball/mrgame.cpp b/src/mame/pinball/mrgame.cpp
index f56cbeddedd..79ef944620f 100644
--- a/src/mame/pinball/mrgame.cpp
+++ b/src/mame/pinball/mrgame.cpp
@@ -715,10 +715,9 @@ void mrgame_state::mrgame(machine_config &config)
/* Sound */
genpin_audio(config);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
- DAC_8BIT_R2R(config, "ldac", 0).add_route(ALL_OUTPUTS, "lspeaker", 0.25); // unknown DAC
- DAC_8BIT_R2R(config, "rdac", 0).add_route(ALL_OUTPUTS, "rspeaker", 0.25); // unknown DAC
+ SPEAKER(config, "speaker", 2).front();
+ DAC_8BIT_R2R(config, "ldac", 0).add_route(ALL_OUTPUTS, "speaker", 0.25, 0); // unknown DAC
+ DAC_8BIT_R2R(config, "rdac", 0).add_route(ALL_OUTPUTS, "speaker", 0.25, 1); // unknown DAC
dac_8bit_r2r_device &dacvol(DAC_8BIT_R2R(config, "dacvol", 0));
dacvol.set_output_range(0, 1); // unknown DAC
@@ -729,8 +728,8 @@ void mrgame_state::mrgame(machine_config &config)
tms5220_device &tms(TMS5220(config, "tms", 672000)); // uses a RC combination. 672k copied from jedi.h
tms.ready_cb().set_inputline("audiocpu2", Z80_INPUT_LINE_WAIT);
- tms.add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- tms.add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ tms.add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ tms.add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
/* Devices */
TIMER(config, "irq_timer").configure_periodic(FUNC(mrgame_state::irq_timer), attotime::from_hz(16000)); //ugh
diff --git a/src/mame/pinball/nsm.cpp b/src/mame/pinball/nsm.cpp
index df5b2b8fff0..d6a8bbcb8e6 100644
--- a/src/mame/pinball/nsm.cpp
+++ b/src/mame/pinball/nsm.cpp
@@ -433,13 +433,12 @@ void nsm_state::nsm(machine_config &config)
/* Sound */
genpin_audio(config);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ay8912_device &ay1(AY8912(config, "ay1", 11052000/8));
- ay1.add_route(ALL_OUTPUTS, "lspeaker", 0.75);
+ ay1.add_route(ALL_OUTPUTS, "speaker", 0.75, 0);
ay1.port_a_write_callback().set(FUNC(nsm_state::ay1a_w));
ay8912_device &ay2(AY8912(config, "ay2", 11052000/8));
- ay2.add_route(ALL_OUTPUTS, "rspeaker", 0.75);
+ ay2.add_route(ALL_OUTPUTS, "speaker", 0.75, 1);
ay2.port_a_write_callback().set(FUNC(nsm_state::ay2a_w));
}
diff --git a/src/mame/pinball/pinsnd88.cpp b/src/mame/pinball/pinsnd88.cpp
index bcd66da5c40..9fd44832258 100644
--- a/src/mame/pinball/pinsnd88.cpp
+++ b/src/mame/pinball/pinsnd88.cpp
@@ -112,7 +112,7 @@ DEFINE_DEVICE_TYPE(PINSND88, pinsnd88_device, "pinsnd88", "Williams Pin Sound '8
pinsnd88_device::pinsnd88_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig,PINSND88,tag,owner,clock)
- , device_mixer_interface(mconfig, *this, 2) // 2 channels
+ , device_mixer_interface(mconfig, *this)
, m_cpu(*this, "cpu")
, m_dac(*this, "dac")
, m_ym2151(*this, "ym2151")
@@ -208,16 +208,16 @@ void pinsnd88_device::device_add_mconfig(machine_config &config)
// TODO: analog filters and "volume" controls for the two channels
AD7224(config, m_dac, 0);
- m_dac->add_route(ALL_OUTPUTS, *this, 0.41/2.0, AUTO_ALLOC_INPUT, 0); // 470K
- m_dac->add_route(ALL_OUTPUTS, *this, 0.5/2.0, AUTO_ALLOC_INPUT, 1); // 330K
+ m_dac->add_route(ALL_OUTPUTS, *this, 0.41/2.0, 0); // 470K
+ m_dac->add_route(ALL_OUTPUTS, *this, 0.5/2.0, 1); // 330K
GENERIC_LATCH_8(config, m_inputlatch);
m_inputlatch->data_pending_callback().set_inputline(m_cpu, M6809_IRQ_LINE);
YM2151(config, m_ym2151, XTAL(3'579'545)); // "3.58 MHz" on schematics and parts list
m_ym2151->irq_handler().set_inputline(m_cpu, M6809_FIRQ_LINE); // IRQ is not true state, but neither is the M6809_FIRQ_LINE so we're fine.
- m_ym2151->add_route(ALL_OUTPUTS, *this, 0.59/2.0, AUTO_ALLOC_INPUT, 0); // 330K
- m_ym2151->add_route(ALL_OUTPUTS, *this, 0.5/2.0, AUTO_ALLOC_INPUT, 1); // 330K
+ m_ym2151->add_route(ALL_OUTPUTS, *this, 0.59/2.0, 0); // 330K
+ m_ym2151->add_route(ALL_OUTPUTS, *this, 0.5/2.0, 1); // 330K
}
void pinsnd88_device::device_start()
diff --git a/src/mame/pinball/play_3.cpp b/src/mame/pinball/play_3.cpp
index 67624c18c66..a9dd656ccbe 100644
--- a/src/mame/pinball/play_3.cpp
+++ b/src/mame/pinball/play_3.cpp
@@ -596,10 +596,9 @@ void play_3_state::play_3(machine_config &config)
m_audiocpu->wait_cb().set_constant(1);
m_audiocpu->clear_cb().set(FUNC(play_3_state::clear_a_r));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
- AY8910(config, m_ay1, 3.579545_MHz_XTAL / 2).add_route(ALL_OUTPUTS, "lspeaker", 0.75);
- AY8910(config, m_ay2, 3.579545_MHz_XTAL / 2).add_route(ALL_OUTPUTS, "rspeaker", 0.75);
+ SPEAKER(config, "speaker", 2).front();
+ AY8910(config, m_ay1, 3.579545_MHz_XTAL / 2).add_route(ALL_OUTPUTS, "speaker", 0.75, 0);
+ AY8910(config, m_ay2, 3.579545_MHz_XTAL / 2).add_route(ALL_OUTPUTS, "speaker", 0.75, 1);
m_ay1->set_resistors_load(6900, 6900, 6900);
m_ay2->set_resistors_load(6900, 6900, 6900);
m_ay1->port_a_write_callback().set_nop();
@@ -614,8 +613,7 @@ void play_3_state::spain82(machine_config &config)
config.device_remove("audiocpu");
config.device_remove("ay1");
config.device_remove("ay2");
- config.device_remove("lspeaker");
- config.device_remove("rspeaker");
+ config.device_remove("speaker");
EFO_SOUND3(config, m_sound3);
}
@@ -640,8 +638,7 @@ void play_3_state::sklflite(machine_config &config)
config.device_remove("audiocpu");
config.device_remove("ay1");
config.device_remove("ay2");
- config.device_remove("lspeaker");
- config.device_remove("rspeaker");
+ config.device_remove("speaker");
EFO_ZSU1(config, m_zsu);
}
diff --git a/src/mame/pinball/s11b.cpp b/src/mame/pinball/s11b.cpp
index f1a53f35778..ab225e6b074 100644
--- a/src/mame/pinball/s11b.cpp
+++ b/src/mame/pinball/s11b.cpp
@@ -388,10 +388,10 @@ void s11b_state::s11b_jokerz(machine_config &config)
PINSND88(config, m_ps88);
// the dac and cvsd volumes should be equally mixed on the s11 board send to the audio board, whatever type it is
// the 4 gain values in the add_route statements are actually irrelevant, the ps88 device will override them
- m_dac->add_route(ALL_OUTPUTS, m_ps88, 0.29, AUTO_ALLOC_INPUT, 0);
- m_dac->add_route(ALL_OUTPUTS, m_ps88, 0.25, AUTO_ALLOC_INPUT, 1);
- m_cvsd_filter2->add_route(ALL_OUTPUTS, m_ps88, (0.29*4.0), AUTO_ALLOC_INPUT, 0);
- m_cvsd_filter2->add_route(ALL_OUTPUTS, m_ps88, (0.25*4.0), AUTO_ALLOC_INPUT, 1);
+ m_dac->add_route(ALL_OUTPUTS, m_ps88, 0.29, 0);
+ m_dac->add_route(ALL_OUTPUTS, m_ps88, 0.25, 1);
+ m_cvsd_filter2->add_route(ALL_OUTPUTS, m_ps88, (0.29*4.0), 0);
+ m_cvsd_filter2->add_route(ALL_OUTPUTS, m_ps88, (0.25*4.0), 1);
m_pia34->ca2_handler().set(m_ps88, FUNC(pinsnd88_device::resetq_w));
m_ps88->syncq_cb().set(m_pia34, FUNC(pia6821_device::ca1_w)); // the sync connection comes from sound connector pin 16 to MCA1, not the usual pin 12 to MCB1
SPEAKER(config, "cabinet").front_floor(); // the cabinet speaker is aimed down underneath the pinball table itself
diff --git a/src/mame/pinball/techno.cpp b/src/mame/pinball/techno.cpp
index 56c672e0e0e..a32fcf8e513 100644
--- a/src/mame/pinball/techno.cpp
+++ b/src/mame/pinball/techno.cpp
@@ -401,10 +401,9 @@ void techno_state::techno(machine_config &config)
// Sound
genpin_audio(config);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
- DAC_8BIT_R2R(config, m_dac, 0).add_route(ALL_OUTPUTS, "rspeaker", 0.5); // DAC0808
- Y8950(config, "ym1", 3580000).add_route(ALL_OUTPUTS, "lspeaker", 0.5); // TKY2016 - no crystal, just a random oscillator, sch says 3.58MHz
+ SPEAKER(config, "speaker", 2).front();
+ DAC_8BIT_R2R(config, m_dac, 0).add_route(ALL_OUTPUTS, "speaker", 0.5, 1); // DAC0808
+ Y8950(config, "ym1", 3580000).add_route(ALL_OUTPUTS, "speaker", 0.5, 0); // TKY2016 - no crystal, just a random oscillator, sch says 3.58MHz
}
ROM_START(xforce)
diff --git a/src/mame/pinball/vd.cpp b/src/mame/pinball/vd.cpp
index c556f3a6456..c10c7fa64d7 100644
--- a/src/mame/pinball/vd.cpp
+++ b/src/mame/pinball/vd.cpp
@@ -315,14 +315,13 @@ void vd_state::vd(machine_config &config)
/* Sound */
genpin_audio(config);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ay8910_device &ay1(AY8910(config, "ay1", 2000000)); //?
- ay1.add_route(ALL_OUTPUTS, "lspeaker", 0.5);
+ ay1.add_route(ALL_OUTPUTS, "speaker", 0.5, 0);
ay1.port_a_read_callback().set_ioport("DSW2");
ay1.port_b_read_callback().set_ioport("DSW1");
ay8910_device &ay2(AY8910(config, "ay2", 2000000)); //?
- ay2.add_route(ALL_OUTPUTS, "rspeaker", 0.5);
+ ay2.add_route(ALL_OUTPUTS, "speaker", 0.5, 1);
ay2.port_b_read_callback().set_ioport("DSW3");
/* Video */
diff --git a/src/mame/pinball/whitestar.cpp b/src/mame/pinball/whitestar.cpp
index cfe9ab72984..f90dc1b1686 100644
--- a/src/mame/pinball/whitestar.cpp
+++ b/src/mame/pinball/whitestar.cpp
@@ -328,12 +328,11 @@ void whitestar_state::whitestar(machine_config &config)
// sound hardware
genpin_audio(config);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DECOBSMT(config, m_decobsmt, 0);
- m_decobsmt->add_route(0, "lspeaker", 1.0);
- m_decobsmt->add_route(1, "rspeaker", 1.0);
+ m_decobsmt->add_route(0, "speaker", 1.0, 0);
+ m_decobsmt->add_route(1, "speaker", 1.0, 1);
DECODMD2(config, m_decodmd, 0);
}
diff --git a/src/mame/psikyo/psikyo4.cpp b/src/mame/psikyo/psikyo4.cpp
index e29872ff2af..8d0f3e9f645 100644
--- a/src/mame/psikyo/psikyo4.cpp
+++ b/src/mame/psikyo/psikyo4.cpp
@@ -633,18 +633,17 @@ void psikyo4_state::ps4big(machine_config &config)
m_rscreen->set_palette(m_palette[1]);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ymf278b_device &ymf(YMF278B(config, "ymf", 57272700/2));
ymf.set_addrmap(0, &psikyo4_state::ps4_ymf_map);
ymf.irq_handler().set_inputline("maincpu", 12);
- ymf.add_route(0, "rspeaker", 1.0); // Output for each screen
- ymf.add_route(1, "lspeaker", 1.0);
- ymf.add_route(2, "rspeaker", 1.0);
- ymf.add_route(3, "lspeaker", 1.0);
- ymf.add_route(4, "rspeaker", 1.0);
- ymf.add_route(5, "lspeaker", 1.0);
+ ymf.add_route(0, "speaker", 1.0, 1); // Output for each screen
+ ymf.add_route(1, "speaker", 1.0, 0);
+ ymf.add_route(2, "speaker", 1.0, 1);
+ ymf.add_route(3, "speaker", 1.0, 0);
+ ymf.add_route(4, "speaker", 1.0, 1);
+ ymf.add_route(5, "speaker", 1.0, 0);
}
void psikyo4_state::ps4small(machine_config &config)
diff --git a/src/mame/psion/psion3a.cpp b/src/mame/psion/psion3a.cpp
index 5092a98cf42..21f524e0b96 100644
--- a/src/mame/psion/psion3a.cpp
+++ b/src/mame/psion/psion3a.cpp
@@ -39,7 +39,7 @@ public:
protected:
void device_start() override ATTR_COLD;
- void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
+ void sound_stream_update(sound_stream &stream) override;
private:
sound_stream *m_stream;
@@ -61,9 +61,9 @@ void psion3a_codec_device::device_start()
m_stream = stream_alloc(0, 1, 8000);
}
-void psion3a_codec_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void psion3a_codec_device::sound_stream_update(sound_stream &stream)
{
- outputs[0].fill(stream_buffer::sample_t(m_audio_out) * (1.0 / 4096.0));
+ stream.fill(0, sound_stream::sample_t(m_audio_out) * (1.0 / 4096.0));
}
void psion3a_codec_device::pcm_in(uint8_t data)
diff --git a/src/mame/rare/btoads.cpp b/src/mame/rare/btoads.cpp
index 208fc593e9c..dec3a659790 100644
--- a/src/mame/rare/btoads.cpp
+++ b/src/mame/rare/btoads.cpp
@@ -946,12 +946,11 @@ void btoads_state::btoads(machine_config &config)
m_screen->set_screen_update("maincpu", FUNC(tms34020_device::tms340x0_rgb32));
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
BSMT2000(config, m_bsmt, SOUND_CLOCK);
- m_bsmt->add_route(0, "lspeaker", 1.0);
- m_bsmt->add_route(1, "rspeaker", 1.0);
+ m_bsmt->add_route(0, "speaker", 1.0, 0);
+ m_bsmt->add_route(1, "speaker", 1.0, 1);
}
diff --git a/src/mame/roland/roland_cm32p.cpp b/src/mame/roland/roland_cm32p.cpp
index 892a0854711..7042325222f 100644
--- a/src/mame/roland/roland_cm32p.cpp
+++ b/src/mame/roland/roland_cm32p.cpp
@@ -631,13 +631,12 @@ void cm32p_state::cm32p(machine_config &config)
maincpu.serial_tx_cb().set(FUNC(cm32p_state::midi_w));
maincpu.in_p0_cb().set(FUNC(cm32p_state::port0_r));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
MB87419_MB87420(config, pcm, 32.768_MHz_XTAL);
pcm->int_callback().set_inputline(cpu, i8x9x_device::EXTINT_LINE);
- pcm->add_route(0, "lspeaker", 1.0);
- pcm->add_route(1, "rspeaker", 1.0);
+ pcm->add_route(0, "speaker", 1.0, 0);
+ pcm->add_route(1, "speaker", 1.0, 1);
RAM(config, some_ram).set_default_size("8K");
diff --git a/src/mame/roland/roland_d70.cpp b/src/mame/roland/roland_d70.cpp
index 2e568c06f6c..280ee8e395d 100644
--- a/src/mame/roland/roland_d70.cpp
+++ b/src/mame/roland/roland_d70.cpp
@@ -514,13 +514,12 @@ void roland_d70_state::d70(machine_config &config) {
maincpu.ach3_cb().set(FUNC(roland_d70_state::ach3_r));
maincpu.ach4_cb().set(FUNC(roland_d70_state::ach4_r));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
MB87419_MB87420(config, m_pcm, 32.768_MHz_XTAL);
m_pcm->int_callback().set_inputline(m_cpu, i8x9x_device::EXTINT_LINE);
- m_pcm->add_route(0, "lspeaker", 1.0);
- m_pcm->add_route(1, "rspeaker", 1.0);
+ m_pcm->add_route(0, "speaker", 1.0, 0);
+ m_pcm->add_route(1, "speaker", 1.0, 1);
T6963C(config, m_lcd, 0);
m_lcd->set_addrmap(0, &roland_d70_state::lcd_map);
diff --git a/src/mame/roland/roland_r8.cpp b/src/mame/roland/roland_r8.cpp
index 2b19e450e39..9f4a98243ae 100644
--- a/src/mame/roland/roland_r8.cpp
+++ b/src/mame/roland/roland_r8.cpp
@@ -256,14 +256,13 @@ void roland_r8_base_state::r8_common(machine_config &config)
//bu3904s_device &fsk(BU3904S(config, "fsk", 12_MHz_XTAL));
//fsk.xint_callback().set_inputline(m_maincpu, upd78k2_device::INTP0_LINE);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
MB87419_MB87420(config, m_pcm, 33.8688_MHz_XTAL);
//m_pcm->int_callback().set_inputline(m_maincpu, upd78k2_device::INTP1_LINE);
m_pcm->set_device_rom_tag("pcm");
- m_pcm->add_route(0, "lspeaker", 1.0);
- m_pcm->add_route(1, "rspeaker", 1.0);
+ m_pcm->add_route(0, "speaker", 1.0, 0);
+ m_pcm->add_route(1, "speaker", 1.0, 1);
}
void roland_r8_state::r8(machine_config &config)
@@ -306,14 +305,13 @@ void roland_r8mk2_state::r8mk2(machine_config &config)
//bu3904s_device &fsk(BU3904S(config, "fsk", 12_MHz_XTAL));
//fsk.xint_callback().set_inputline(m_maincpu, upd78k2_device::INTP0_LINE);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
MB87419_MB87420(config, m_pcm, 33.8688_MHz_XTAL);
//m_pcm->int_callback().set_inputline(m_maincpu, upd78k2_device::INTP1_LINE);
m_pcm->set_device_rom_tag("pcm");
- m_pcm->add_route(0, "lspeaker", 1.0);
- m_pcm->add_route(1, "rspeaker", 1.0);
+ m_pcm->add_route(0, "speaker", 1.0, 0);
+ m_pcm->add_route(1, "speaker", 1.0, 1);
GENERIC_CARTSLOT(config, m_pcmcard, generic_romram_plain_slot, "r8_card", "bin");
m_pcmcard->set_device_load(FUNC(roland_r8mk2_state::pcmcard_load));
diff --git a/src/mame/roland/roland_u20.cpp b/src/mame/roland/roland_u20.cpp
index ec16bc69acc..68611cd0754 100644
--- a/src/mame/roland/roland_u20.cpp
+++ b/src/mame/roland/roland_u20.cpp
@@ -51,14 +51,13 @@ void roland_u20_state::u20(machine_config &config)
//R15239124(config, "keyscan", 12_MHz_XTAL);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
MB87419_MB87420(config, m_pcm, 32.768_MHz_XTAL);
m_pcm->int_callback().set_inputline(m_maincpu, i8x9x_device::EXTINT_LINE);
m_pcm->set_device_rom_tag("waverom");
- m_pcm->add_route(0, "lspeaker", 1.0);
- m_pcm->add_route(1, "rspeaker", 1.0);
+ m_pcm->add_route(0, "speaker", 1.0, 0);
+ m_pcm->add_route(1, "speaker", 1.0, 1);
}
void roland_u20_state::u220(machine_config &config)
diff --git a/src/mame/sega/bingoc.cpp b/src/mame/sega/bingoc.cpp
index 8eb8c130f81..f00024035f3 100644
--- a/src/mame/sega/bingoc.cpp
+++ b/src/mame/sega/bingoc.cpp
@@ -217,16 +217,16 @@ void bingoc_state::bingoc(machine_config &config)
PALETTE(config, "palette").set_entries(0x100);
- SPEAKER(config, "lspeaker").front_left(); //might just be mono...
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front(); //might just be mono...
+
GENERIC_LATCH_8(config, m_soundlatch);
- YM2151(config, "ymsnd", 7159160/2).add_route(0, "lspeaker", 1.0).add_route(1, "rspeaker", 1.0);
+ YM2151(config, "ymsnd", 7159160/2).add_route(0, "speaker", 1.0, 0).add_route(1, "speaker", 1.0, 1);
UPD7759(config, m_upd7759);
- m_upd7759->add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- m_upd7759->add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ m_upd7759->add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ m_upd7759->add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
// terminals
BINGOCT(config, "term1");
diff --git a/src/mame/sega/calcune.cpp b/src/mame/sega/calcune.cpp
index bf1628f9f69..79b70ebe91c 100644
--- a/src/mame/sega/calcune.cpp
+++ b/src/mame/sega/calcune.cpp
@@ -274,8 +274,8 @@ void calcune_state::calcune(machine_config &config)
m_vdp[0]->lv6_irq().set(FUNC(calcune_state::vdp_lv6irqline_callback_genesis_68k));
m_vdp[0]->lv4_irq().set(FUNC(calcune_state::vdp_lv4irqline_callback_genesis_68k));
m_vdp[0]->set_alt_timing(1);
- m_vdp[0]->add_route(ALL_OUTPUTS, "lspeaker", 0.25);
- m_vdp[0]->add_route(ALL_OUTPUTS, "rspeaker", 0.25);
+ m_vdp[0]->add_route(ALL_OUTPUTS, "speaker", 0.25, 0);
+ m_vdp[0]->add_route(ALL_OUTPUTS, "speaker", 0.25, 1);
SEGA315_5313(config, m_vdp[1], OSC1_CLOCK, m_maincpu);
m_vdp[1]->set_is_pal(false);
@@ -284,8 +284,8 @@ void calcune_state::calcune(machine_config &config)
// m_vdp[1]->lv6_irq().set(FUNC(calcune_state::vdp_lv6irqline_callback_genesis_68k));
// m_vdp[1]->lv4_irq().set(FUNC(calcune_state::vdp_lv4irqline_callback_genesis_68k));
m_vdp[1]->set_alt_timing(1);
- m_vdp[1]->add_route(ALL_OUTPUTS, "lspeaker", 0.25);
- m_vdp[1]->add_route(ALL_OUTPUTS, "rspeaker", 0.25);
+ m_vdp[1]->add_route(ALL_OUTPUTS, "speaker", 0.25, 0);
+ m_vdp[1]->add_route(ALL_OUTPUTS, "speaker", 0.25, 1);
TIMER(config, "scantimer").configure_scanline(m_vdp[0], FUNC(sega315_5313_device::megadriv_scanline_timer_callback_alt_timing), "megadriv", 0, 1);
TIMER(config, "scantimer2").configure_scanline(m_vdp[1], FUNC(sega315_5313_device::megadriv_scanline_timer_callback_alt_timing), "megadriv", 0, 1);
@@ -293,12 +293,11 @@ void calcune_state::calcune(machine_config &config)
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ymz280b_device &ymz(YMZ280B(config, "ymz", XTAL(16'934'400)));
- ymz.add_route(0, "lspeaker", 1.0);
- ymz.add_route(1, "rspeaker", 1.0);
+ ymz.add_route(0, "speaker", 1.0, 0);
+ ymz.add_route(1, "speaker", 1.0, 1);
}
void calcune_state::init_calcune()
diff --git a/src/mame/sega/coolridr.cpp b/src/mame/sega/coolridr.cpp
index cbd052ebb98..9cdc9b40da3 100644
--- a/src/mame/sega/coolridr.cpp
+++ b/src/mame/sega/coolridr.cpp
@@ -3268,21 +3268,20 @@ void coolridr_state::coolridr(machine_config &config)
config.set_default_layout(layout_dualhsxs);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
scsp_device &scsp1(SCSP(config, "scsp1", XTAL(22'579'000))); // 22.579 MHz
scsp1.set_addrmap(0, &coolridr_state::scsp_map<0>);
scsp1.irq_cb().set(FUNC(coolridr_state::scsp_irq));
scsp1.main_irq_cb().set(FUNC(coolridr_state::scsp1_to_sh1_irq));
- scsp1.add_route(0, "lspeaker", 1.0);
- scsp1.add_route(1, "rspeaker", 1.0);
+ scsp1.add_route(0, "speaker", 1.0, 0);
+ scsp1.add_route(1, "speaker", 1.0, 1);
scsp_device &scsp2(SCSP(config, "scsp2", XTAL(22'579'000))); // 22.579 MHz
scsp2.set_addrmap(0, &coolridr_state::scsp_map<1>);
scsp2.main_irq_cb().set(FUNC(coolridr_state::scsp2_to_sh1_irq));
- scsp2.add_route(0, "lspeaker", 1.0);
- scsp2.add_route(1, "rspeaker", 1.0);
+ scsp2.add_route(0, "speaker", 1.0, 0);
+ scsp2.add_route(1, "speaker", 1.0, 1);
}
void coolridr_state::aquastge(machine_config &config)
diff --git a/src/mame/sega/dccons.cpp b/src/mame/sega/dccons.cpp
index 0189913539d..bb6e47db32b 100644
--- a/src/mame/sega/dccons.cpp
+++ b/src/mame/sega/dccons.cpp
@@ -415,15 +415,14 @@ void dc_cons_state::dc_base(machine_config &config)
POWERVR2(config, m_powervr2, 0);
m_powervr2->irq_callback().set(FUNC(dc_state::pvr_irq));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
AICA(config, m_aica, (XTAL(33'868'800)*2)/3); // 67.7376MHz(2*33.8688MHz), div 3 for audio block
m_aica->irq().set(FUNC(dc_state::aica_irq));
m_aica->main_irq().set(FUNC(dc_state::sh4_aica_irq));
m_aica->set_addrmap(0, &dc_cons_state::aica_map);
- m_aica->add_route(0, "lspeaker", 0.4);
- m_aica->add_route(1, "rspeaker", 0.4);
+ m_aica->add_route(0, "speaker", 0.4, 0);
+ m_aica->add_route(1, "speaker", 0.4, 1);
AICARTC(config, "aicartc", XTAL(32'768));
diff --git a/src/mame/sega/dsbz80.cpp b/src/mame/sega/dsbz80.cpp
index f6060d890cb..581bd6c0e9a 100644
--- a/src/mame/sega/dsbz80.cpp
+++ b/src/mame/sega/dsbz80.cpp
@@ -267,12 +267,9 @@ void dsbz80_device::mpeg_stereo_w(uint8_t data)
m_mp_pan = data & 3; // 0 = stereo, 1 = left on both channels, 2 = right on both channels
}
-void dsbz80_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void dsbz80_device::sound_stream_update(sound_stream &stream)
{
- auto &out_l = outputs[0];
- auto &out_r = outputs[1];
-
- int samples = out_l.samples();
+ int samples = stream.samples();
int sampindex = 0;
for (;;)
{
@@ -281,20 +278,20 @@ void dsbz80_device::sound_stream_update(sound_stream &stream, std::vector<read_s
switch (m_mp_pan)
{
case 0: // stereo
- out_l.put_int(sampindex, m_audio_buf[m_audio_pos*2] * m_mp_vol, 32768 * 128);
- out_r.put_int(sampindex, m_audio_buf[m_audio_pos*2+1] * m_mp_vol, 32768 * 128);
+ stream.put_int(0, sampindex, m_audio_buf[m_audio_pos*2] * m_mp_vol, 32768 * 128);
+ stream.put_int(1, sampindex, m_audio_buf[m_audio_pos*2+1] * m_mp_vol, 32768 * 128);
sampindex++;
break;
case 1: // left only
- out_l.put_int(sampindex, m_audio_buf[m_audio_pos*2] * m_mp_vol, 32768 * 128);
- out_r.put_int(sampindex, m_audio_buf[m_audio_pos*2] * m_mp_vol, 32768 * 128);
+ stream.put_int(0, sampindex, m_audio_buf[m_audio_pos*2] * m_mp_vol, 32768 * 128);
+ stream.put_int(1, sampindex, m_audio_buf[m_audio_pos*2] * m_mp_vol, 32768 * 128);
sampindex++;
break;
case 2: // right only
- out_l.put_int(sampindex, m_audio_buf[m_audio_pos*2+1] * m_mp_vol, 32768 * 128);
- out_r.put_int(sampindex, m_audio_buf[m_audio_pos*2+1] * m_mp_vol, 32768 * 128);
+ stream.put_int(0, sampindex, m_audio_buf[m_audio_pos*2+1] * m_mp_vol, 32768 * 128);
+ stream.put_int(1, sampindex, m_audio_buf[m_audio_pos*2+1] * m_mp_vol, 32768 * 128);
sampindex++;
break;
}
@@ -309,8 +306,6 @@ void dsbz80_device::sound_stream_update(sound_stream &stream, std::vector<read_s
if (m_mp_state == 0)
{
- out_l.fill(0, sampindex);
- out_r.fill(0, sampindex);
break;
}
diff --git a/src/mame/sega/dsbz80.h b/src/mame/sega/dsbz80.h
index 1d2813aef32..197354137d3 100644
--- a/src/mame/sega/dsbz80.h
+++ b/src/mame/sega/dsbz80.h
@@ -35,7 +35,7 @@ protected:
virtual void device_add_mconfig(machine_config &config) override ATTR_COLD;
// device_sound_interface implementation
- 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;
private:
required_device<cpu_device> m_ourcpu;
diff --git a/src/mame/sega/flashbeats.cpp b/src/mame/sega/flashbeats.cpp
index 6b58033e564..bfdea31ddc0 100644
--- a/src/mame/sega/flashbeats.cpp
+++ b/src/mame/sega/flashbeats.cpp
@@ -143,14 +143,13 @@ void flashbeats_state::flashbeats(machine_config &config)
//te7752.out_port6_cb().set(FUNC(flashbeats_state::te7752_port6_w));
//te7752.out_port7_cb().set(FUNC(flashbeats_state::te7752_port7_w));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
SCSP(config, m_scsp, 22579200); // TODO : Unknown clock, divider
m_scsp->set_addrmap(0, &flashbeats_state::scsp_mem);
m_scsp->irq_cb().set(FUNC(flashbeats_state::scsp_irq));
- m_scsp->add_route(0, "lspeaker", 1.0);
- m_scsp->add_route(1, "rspeaker", 1.0);
+ m_scsp->add_route(0, "speaker", 1.0, 0);
+ m_scsp->add_route(1, "speaker", 1.0, 1);
}
void flashbeats_state::scsp_irq(offs_t offset, uint8_t data)
diff --git a/src/mame/sega/gpworld.cpp b/src/mame/sega/gpworld.cpp
index 888378c8cf1..afd86580e52 100644
--- a/src/mame/sega/gpworld.cpp
+++ b/src/mame/sega/gpworld.cpp
@@ -495,8 +495,8 @@ void gpworld_state::gpworld(machine_config &config)
PIONEER_LDV1000(config, m_laserdisc, 0);
m_laserdisc->set_overlay(512, 256, FUNC(gpworld_state::screen_update));
- m_laserdisc->add_route(0, "lspeaker", 1.0);
- m_laserdisc->add_route(1, "rspeaker", 1.0);
+ m_laserdisc->add_route(0, "speaker", 1.0, 0);
+ m_laserdisc->add_route(1, "speaker", 1.0, 1);
/* video hardware */
m_laserdisc->add_ntsc_screen(config, "screen");
@@ -505,8 +505,7 @@ void gpworld_state::gpworld(machine_config &config)
PALETTE(config, m_palette).set_entries(1024);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
diff --git a/src/mame/sega/hikaru.cpp b/src/mame/sega/hikaru.cpp
index 97d64f376e7..e6d4ab6dd4e 100644
--- a/src/mame/sega/hikaru.cpp
+++ b/src/mame/sega/hikaru.cpp
@@ -544,14 +544,13 @@ void hikaru_state::hikaru(machine_config &config)
PALETTE(config, "palette").set_entries(0x1000);
-// SPEAKER(config, "lspeaker").front_left();
-// SPEAKER(config, "rspeaker").front_right();
+// SPEAKER(config, "speaker").front();
// 67.7376MHz(2*33.8688MHz), div 3 for audio block
-// AICA(config, "aica", (XTAL(33'868'800)*2)/3).add_route(0, "lspeaker", 1.0).add_route(1, "rspeaker", 1.0);
+// AICA(config, "aica", (XTAL(33'868'800)*2)/3).add_route(0, "speaker", 1.0).add_route(1, "speaker", 1.0);
// 33.8688MHz on Board
-// AICA(config, "aica_pcb", (XTAL(33'868'800)*2)/3).add_route(0, "lspeaker", 1.0).add_route(1, "rspeaker", 1.0); // AICA PCB
+// AICA(config, "aica_pcb", (XTAL(33'868'800)*2)/3).add_route(0, "speaker", 1.0).add_route(1, "speaker", 1.0); // AICA PCB
}
diff --git a/src/mame/sega/mdconsole.cpp b/src/mame/sega/mdconsole.cpp
index 981eff4ff75..064d5e4fb57 100644
--- a/src/mame/sega/mdconsole.cpp
+++ b/src/mame/sega/mdconsole.cpp
@@ -510,21 +510,21 @@ void md_cons_state::genesis_32x(machine_config &config)
m_vdp->set_md_32x_scanline_helper(FUNC(md_cons_state::_32x_scanline_helper_callback));
m_vdp->set_md_32x_interrupt(FUNC(md_cons_state::_32x_interrupt_callback));
m_vdp->reset_routes();
- m_vdp->add_route(ALL_OUTPUTS, "lspeaker", (0.50)/2);
- m_vdp->add_route(ALL_OUTPUTS, "rspeaker", (0.50)/2);
+ m_vdp->add_route(ALL_OUTPUTS, "speaker", (0.50)/2);
+ m_vdp->add_route(ALL_OUTPUTS, "speaker", (0.50)/2);
SEGA_32X_NTSC(config, m_32x, (MASTER_CLOCK_NTSC * 3) / 7, m_maincpu, m_scan_timer);
m_32x->set_screen("megadriv");
- m_32x->add_route(0, "lspeaker", 1.00);
- m_32x->add_route(1, "rspeaker", 1.00);
+ m_32x->add_route(0, "speaker", 1.00);
+ m_32x->add_route(1, "speaker", 1.00);
m_screen->screen_vblank().set(FUNC(md_cons_state::screen_vblank_console));
// we need to remove and re-add the YM because the balance is different
// due to MAME having severe issues if the dac output is > 0.40? (sound is corrupted even if DAC is silent?!)
m_ymsnd->reset_routes();
- m_ymsnd->add_route(0, "lspeaker", (0.50)/2);
- m_ymsnd->add_route(1, "rspeaker", (0.50)/2);
+ m_ymsnd->add_route(0, "speaker", (0.50)/2);
+ m_ymsnd->add_route(1, "speaker", (0.50)/2);
md_ctrl_ports(config);
md_exp_port(config);
@@ -545,21 +545,21 @@ void md_cons_state::mdj_32x(machine_config &config)
m_vdp->set_md_32x_scanline_helper(FUNC(md_cons_state::_32x_scanline_helper_callback));
m_vdp->set_md_32x_interrupt(FUNC(md_cons_state::_32x_interrupt_callback));
m_vdp->reset_routes();
- m_vdp->add_route(ALL_OUTPUTS, "lspeaker", (0.50)/2);
- m_vdp->add_route(ALL_OUTPUTS, "rspeaker", (0.50)/2);
+ m_vdp->add_route(ALL_OUTPUTS, "speaker", (0.50)/2);
+ m_vdp->add_route(ALL_OUTPUTS, "speaker", (0.50)/2);
SEGA_32X_NTSC(config, m_32x, (MASTER_CLOCK_NTSC * 3) / 7, m_maincpu, m_scan_timer);
m_32x->set_screen("megadriv");
- m_32x->add_route(0, "lspeaker", 1.00);
- m_32x->add_route(1, "rspeaker", 1.00);
+ m_32x->add_route(0, "speaker", 1.00);
+ m_32x->add_route(1, "speaker", 1.00);
m_screen->screen_vblank().set(FUNC(md_cons_state::screen_vblank_console));
// we need to remove and re-add the sound system because the balance is different
// due to MAME having severe issues if the dac output is > 0.40? (sound is corrupted even if DAC is silent?!)
m_ymsnd->reset_routes();
- m_ymsnd->add_route(0, "lspeaker", (0.50)/2);
- m_ymsnd->add_route(1, "rspeaker", (0.50)/2);
+ m_ymsnd->add_route(0, "speaker", (0.50)/2);
+ m_ymsnd->add_route(1, "speaker", (0.50)/2);
md_ctrl_ports(config);
md_exp_port(config);
@@ -580,21 +580,21 @@ void md_cons_state::md_32x(machine_config &config)
m_vdp->set_md_32x_scanline_helper(FUNC(md_cons_state::_32x_scanline_helper_callback));
m_vdp->set_md_32x_interrupt(FUNC(md_cons_state::_32x_interrupt_callback));
m_vdp->reset_routes();
- m_vdp->add_route(ALL_OUTPUTS, "lspeaker", (0.50)/2);
- m_vdp->add_route(ALL_OUTPUTS, "rspeaker", (0.50)/2);
+ m_vdp->add_route(ALL_OUTPUTS, "speaker", (0.50)/2);
+ m_vdp->add_route(ALL_OUTPUTS, "speaker", (0.50)/2);
SEGA_32X_PAL(config, m_32x, (MASTER_CLOCK_PAL * 3) / 7, m_maincpu, m_scan_timer);
m_32x->set_screen("megadriv");
- m_32x->add_route(0, "lspeaker", 1.00);
- m_32x->add_route(1, "rspeaker", 1.00);
+ m_32x->add_route(0, "speaker", 1.00);
+ m_32x->add_route(1, "speaker", 1.00);
m_screen->screen_vblank().set(FUNC(md_cons_state::screen_vblank_console));
// we need to remove and re-add the sound system because the balance is different
// due to MAME having severe issues if the dac output is > 0.40? (sound is corrupted even if DAC is silent?!)
m_ymsnd->reset_routes();
- m_ymsnd->add_route(0, "lspeaker", (0.50)/2);
- m_ymsnd->add_route(1, "rspeaker", (0.50)/2);
+ m_ymsnd->add_route(0, "speaker", (0.50)/2);
+ m_ymsnd->add_route(1, "speaker", (0.50)/2);
md_ctrl_ports(config);
md_exp_port(config);
diff --git a/src/mame/sega/megacd.cpp b/src/mame/sega/megacd.cpp
index 8f288cdcdf8..a35d2814a26 100644
--- a/src/mame/sega/megacd.cpp
+++ b/src/mame/sega/megacd.cpp
@@ -296,8 +296,8 @@ void sega_segacd_device::device_add_mconfig(machine_config &config)
config.set_default_layout(layout_megacd);
RF5C164(config, m_rfsnd, SEGACD_CLOCK); // or Sega 315-5476A
- m_rfsnd->add_route( 0, ":lspeaker", 0.50 );
- m_rfsnd->add_route( 1, ":rspeaker", 0.50 );
+ m_rfsnd->add_route( 0, ":speaker", 0.50, 0 );
+ m_rfsnd->add_route( 1, ":speaker", 0.50, 1 );
m_rfsnd->set_addrmap(0, &sega_segacd_device::segacd_pcm_map);
NVRAM(config, "backupram", nvram_device::DEFAULT_ALL_0);
diff --git a/src/mame/sega/megadriv.cpp b/src/mame/sega/megadriv.cpp
index 226e890ba8e..7cc00059936 100644
--- a/src/mame/sega/megadriv.cpp
+++ b/src/mame/sega/megadriv.cpp
@@ -880,16 +880,15 @@ void md_base_state::md_ntsc(machine_config &config)
megadriv_ioports(config);
m_vdp->snd_irq().set(FUNC(md_base_state::vdp_sndirqline_callback_genesis_z80));
- m_vdp->add_route(ALL_OUTPUTS, "lspeaker", 0.50);
- m_vdp->add_route(ALL_OUTPUTS, "rspeaker", 0.50);
+ m_vdp->add_route(ALL_OUTPUTS, "speaker", 0.50, 0);
+ m_vdp->add_route(ALL_OUTPUTS, "speaker", 0.50, 1);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
YM2612(config, m_ymsnd, MASTER_CLOCK_NTSC / 7); // 7.67 MHz
- m_ymsnd->add_route(0, "lspeaker", 0.50);
- m_ymsnd->add_route(1, "rspeaker", 0.50);
+ m_ymsnd->add_route(0, "speaker", 0.50, 0);
+ m_ymsnd->add_route(1, "speaker", 0.50, 1);
}
void md_base_state::md2_ntsc(machine_config &config)
@@ -898,8 +897,8 @@ void md_base_state::md2_ntsc(machine_config &config)
// Internalized YM3438 in VDP ASIC
YM3438(config.replace(), m_ymsnd, MASTER_CLOCK_NTSC / 7); // 7.67 MHz
- m_ymsnd->add_route(0, "lspeaker", 0.50);
- m_ymsnd->add_route(1, "rspeaker", 0.50);
+ m_ymsnd->add_route(0, "speaker", 0.50, 0);
+ m_ymsnd->add_route(1, "speaker", 0.50, 1);
}
/************ PAL hardware has a different master clock *************/
@@ -919,16 +918,15 @@ void md_base_state::md_pal(machine_config &config)
megadriv_ioports(config);
m_vdp->snd_irq().set(FUNC(md_base_state::vdp_sndirqline_callback_genesis_z80));
- m_vdp->add_route(ALL_OUTPUTS, "lspeaker", 0.50);
- m_vdp->add_route(ALL_OUTPUTS, "rspeaker", 0.50);
+ m_vdp->add_route(ALL_OUTPUTS, "speaker", 0.50, 0);
+ m_vdp->add_route(ALL_OUTPUTS, "speaker", 0.50, 1);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
YM2612(config, m_ymsnd, MASTER_CLOCK_PAL / 7); // 7.67 MHz
- m_ymsnd->add_route(0, "lspeaker", 0.50);
- m_ymsnd->add_route(1, "rspeaker", 0.50);
+ m_ymsnd->add_route(0, "speaker", 0.50, 0);
+ m_ymsnd->add_route(1, "speaker", 0.50, 1);
}
void md_base_state::md2_pal(machine_config &config)
@@ -937,8 +935,8 @@ void md_base_state::md2_pal(machine_config &config)
// Internalized YM3438 in VDP ASIC
YM3438(config.replace(), m_ymsnd, MASTER_CLOCK_PAL / 7); /* 7.67 MHz */
- m_ymsnd->add_route(0, "lspeaker", 0.50);
- m_ymsnd->add_route(1, "rspeaker", 0.50);
+ m_ymsnd->add_route(0, "speaker", 0.50, 0);
+ m_ymsnd->add_route(1, "speaker", 0.50, 1);
}
diff --git a/src/mame/sega/megaplay.cpp b/src/mame/sega/megaplay.cpp
index 1e3a9014642..f3845526efd 100644
--- a/src/mame/sega/megaplay.cpp
+++ b/src/mame/sega/megaplay.cpp
@@ -707,8 +707,8 @@ void mplay_state::megaplay(machine_config &config)
m_vdp1->set_hcounter_divide(5);
m_vdp1->set_is_pal(false);
m_vdp1->n_int().set_inputline(m_bioscpu, 0);
- m_vdp1->add_route(ALL_OUTPUTS, "lspeaker", 0.25);
- m_vdp1->add_route(ALL_OUTPUTS, "rspeaker", 0.25);
+ m_vdp1->add_route(ALL_OUTPUTS, "speaker", 0.25);
+ m_vdp1->add_route(ALL_OUTPUTS, "speaker", 0.25);
}
diff --git a/src/mame/sega/megatech.cpp b/src/mame/sega/megatech.cpp
index 12291378237..08f3686d644 100644
--- a/src/mame/sega/megatech.cpp
+++ b/src/mame/sega/megatech.cpp
@@ -745,8 +745,8 @@ void mtech_state::megatech(machine_config &config)
m_vdp1->set_screen("menu");
m_vdp1->set_is_pal(false);
m_vdp1->n_int().set_inputline(m_bioscpu, 0);
- m_vdp1->add_route(ALL_OUTPUTS, "lspeaker", 0.25);
- m_vdp1->add_route(ALL_OUTPUTS, "rspeaker", 0.25);
+ m_vdp1->add_route(ALL_OUTPUTS, "speaker", 0.25);
+ m_vdp1->add_route(ALL_OUTPUTS, "speaker", 0.25);
}
diff --git a/src/mame/sega/model2.cpp b/src/mame/sega/model2.cpp
index 382d55331d2..e2033e2311c 100644
--- a/src/mame/sega/model2.cpp
+++ b/src/mame/sega/model2.cpp
@@ -2508,14 +2508,13 @@ void model2_state::model2_scsp(machine_config &config)
M68000(config, m_audiocpu, 45.1584_MHz_XTAL / 4); // SCSP Clock / 2
m_audiocpu->set_addrmap(AS_PROGRAM, &model2_state::model2_snd);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
SCSP(config, m_scsp, 45.1584_MHz_XTAL / 2); // 45.158MHz XTAL at Video board(Model 2A-CRX)
m_scsp->set_addrmap(0, &model2_state::scsp_map);
m_scsp->irq_cb().set(FUNC(model2_state::scsp_irq));
- m_scsp->add_route(0, "lspeaker", 1.0);
- m_scsp->add_route(1, "rspeaker", 1.0);
+ m_scsp->add_route(0, "speaker", 1.0, 0);
+ m_scsp->add_route(1, "speaker", 1.0, 1);
I8251(config, m_uart, 8000000); // uPD71051C, clock unknown
// m_uart->rxrdy_handler().set(FUNC(model2_state::sound_ready_w));
@@ -3004,8 +3003,8 @@ void model2c_state::stcc(machine_config &config)
io.an_port_callback<2>().set_ioport("BRAKE");
DSBZ80(config, m_dsbz80, 0);
- m_dsbz80->add_route(0, "lspeaker", 1.0);
- m_dsbz80->add_route(1, "rspeaker", 1.0);
+ m_dsbz80->add_route(0, "speaker", 1.0, 0);
+ m_dsbz80->add_route(1, "speaker", 1.0, 1);
m_uart->txd_handler().set(m_dsbz80, FUNC(dsbz80_device::write_txd));
}
diff --git a/src/mame/sega/model2_v.cpp b/src/mame/sega/model2_v.cpp
index be446430a2d..f0405ee7e2e 100644
--- a/src/mame/sega/model2_v.cpp
+++ b/src/mame/sega/model2_v.cpp
@@ -260,7 +260,7 @@ inline bool model2_state::check_culling( raster_state *raster, u32 attr, float m
return true;
/* if the minimum z value is bigger than the master z clip value, don't render */
- if (raster->master_z_clip != 0xFF && (int32_t)(1.0 / min_z) > raster->master_z_clip)
+ if (raster->master_z_clip != 0xff && (int32_t)(1.0 / min_z) > raster->master_z_clip)
return true;
/* if the maximum z value is < 0 then we can safely clip the entire polygon */
@@ -311,7 +311,7 @@ void model2_state::raster_init( memory_region *texture_rom )
void model2_state::model2_3d_zclip_w(u32 data)
{
- // setting this register to 0xFF disables z-clip
+ // setting this register to 0xff disables z-clip
m_raster->master_z_clip = data;
}
@@ -374,7 +374,7 @@ void model2_state::model2_3d_process_quad( raster_state *raster, u32 attr )
/* texture point data */
if ( raster->command_buffer[0] & 0x800000 )
- tp = &raster->texture_ram[raster->command_buffer[0] & 0xFFFF];
+ tp = &raster->texture_ram[raster->command_buffer[0] & 0xffff];
else
tp = &raster->texture_rom[raster->command_buffer[0] & raster->texture_rom_mask];
@@ -392,7 +392,7 @@ void model2_state::model2_3d_process_quad( raster_state *raster, u32 attr )
/* texture header data */
if ( raster->command_buffer[1] & 0x800000 )
- th = &raster->texture_ram[raster->command_buffer[1] & 0xFFFF];
+ th = &raster->texture_ram[raster->command_buffer[1] & 0xffff];
else
th = &raster->texture_rom[raster->command_buffer[1] & raster->texture_rom_mask];
@@ -402,7 +402,7 @@ void model2_state::model2_3d_process_quad( raster_state *raster, u32 attr )
object.texheader[3] = *th++;
/* extract the texture header offset */
- tho = (attr >> 12) & 0x1F;
+ tho = (attr >> 12) & 0x1f;
/* adjust for sign */
if ( tho & 0x10 )
@@ -412,7 +412,7 @@ void model2_state::model2_3d_process_quad( raster_state *raster, u32 attr )
raster->command_buffer[1] += tho * 4;
/* set the luma value of this quad */
- object.luma = (raster->command_buffer[9] >> 15) & 0xFF;
+ object.luma = (raster->command_buffer[9] >> 15) & 0xff;
/* determine whether we can cull this quad */
cull = check_culling(raster,attr,min_z,max_z);
@@ -602,7 +602,7 @@ void model2_state::model2_3d_process_triangle( raster_state *raster, u32 attr )
/* texture point data */
if ( raster->command_buffer[0] & 0x800000 )
- tp = &raster->texture_ram[raster->command_buffer[0] & 0xFFFF];
+ tp = &raster->texture_ram[raster->command_buffer[0] & 0xffff];
else
tp = &raster->texture_rom[raster->command_buffer[0] & raster->texture_rom_mask];
@@ -618,7 +618,7 @@ void model2_state::model2_3d_process_triangle( raster_state *raster, u32 attr )
/* texture header data */
if ( raster->command_buffer[1] & 0x800000 )
- th = &raster->texture_ram[raster->command_buffer[1] & 0xFFFF];
+ th = &raster->texture_ram[raster->command_buffer[1] & 0xffff];
else
th = &raster->texture_rom[raster->command_buffer[1] & raster->texture_rom_mask];
@@ -628,7 +628,7 @@ void model2_state::model2_3d_process_triangle( raster_state *raster, u32 attr )
object.texheader[3] = *th++;
/* extract the texture header offset */
- tho = (attr >> 12) & 0x1F;
+ tho = (attr >> 12) & 0x1f;
/* adjust for sign */
if ( tho & 0x10 )
@@ -638,7 +638,7 @@ void model2_state::model2_3d_process_triangle( raster_state *raster, u32 attr )
raster->command_buffer[1] += tho * 4;
/* set the luma value of this quad */
- object.luma = (raster->command_buffer[9] >> 15) & 0xFF;
+ object.luma = (raster->command_buffer[9] >> 15) & 0xff;
/* determine whether we can cull this quad */
cull = check_culling(raster,attr,min_z,max_z);
@@ -804,8 +804,8 @@ void model2_renderer::model2_3d_render(triangle *tri, const rectangle &cliprect)
vp &= cliprect;
extra.state = &m_state;
- extra.lumabase = ((tri->texheader[1] & 0xFF) << 7) + ((tri->luma >> 5) ^ 0x7);
- extra.colorbase = (tri->texheader[3] >> 6) & 0x3FF;
+ extra.lumabase = ((tri->texheader[1] & 0xff) << 7) + ((tri->luma >> 5) ^ 0x7);
+ extra.colorbase = (tri->texheader[3] >> 6) & 0x3ff;
if (renderer & 2)
{
@@ -917,7 +917,7 @@ void model2_state::model2_3d_frame_start( void )
memset( raster->tri_sorted_list, 0, 0x10000 * sizeof( triangle * ) );
/* reset the min-max sortable Z values */
- raster->min_z = 0xFFFF;
+ raster->min_z = 0xffff;
raster->max_z = 0;
/* reset the triangle z value */
@@ -1065,43 +1065,43 @@ void model2_state::model2_3d_push( raster_state *raster, u32 input )
/* coordinates are 12 bit signed */
/* extract the viewport start x */
- raster->viewport[0] = (raster->command_buffer[0] >> 12) & 0xFFF;
+ raster->viewport[0] = (raster->command_buffer[0] >> 12) & 0xfff;
if ( raster->viewport[0] & 0x800 )
- raster->viewport[0] = -( 0x800 - (raster->viewport[0] & 0x7FF) );
+ raster->viewport[0] = -( 0x800 - (raster->viewport[0] & 0x7ff) );
/* extract the viewport start y */
- raster->viewport[1] = raster->command_buffer[0] & 0xFFF;
+ raster->viewport[1] = raster->command_buffer[0] & 0xfff;
if ( raster->viewport[1] & 0x800 )
- raster->viewport[1] = -( 0x800 - (raster->viewport[1] & 0x7FF) );
+ raster->viewport[1] = -( 0x800 - (raster->viewport[1] & 0x7ff) );
/* extract the viewport end x */
- raster->viewport[2] = (raster->command_buffer[1] >> 12) & 0xFFF;
+ raster->viewport[2] = (raster->command_buffer[1] >> 12) & 0xfff;
if ( raster->viewport[2] & 0x800 )
- raster->viewport[2] = -( 0x800 - (raster->viewport[2] & 0x7FF) );
+ raster->viewport[2] = -( 0x800 - (raster->viewport[2] & 0x7ff) );
/* extract the viewport end y */
- raster->viewport[3] = raster->command_buffer[1] & 0xFFF;
+ raster->viewport[3] = raster->command_buffer[1] & 0xfff;
if ( raster->viewport[3] & 0x800 )
- raster->viewport[3] = -( 0x800 - (raster->viewport[3] & 0x7FF) );
+ raster->viewport[3] = -( 0x800 - (raster->viewport[3] & 0x7ff) );
/* extract the centers */
for( i = 0; i < 4; i++ )
{
/* center x */
- raster->center[i][0] = (raster->command_buffer[2+i] >> 12) & 0xFFF;
+ raster->center[i][0] = (raster->command_buffer[2+i] >> 12) & 0xffF;
if ( raster->center[i][0] & 0x800 )
- raster->center[i][0] = -( 0x800 - (raster->center[i][0] & 0x7FF) );
+ raster->center[i][0] = -( 0x800 - (raster->center[i][0] & 0x7ff) );
/* center y */
- raster->center[i][1] = raster->command_buffer[2+i] & 0xFFF;
+ raster->center[i][1] = raster->command_buffer[2+i] & 0xfff;
if ( raster->center[i][1] & 0x800 )
- raster->center[i][1] = -( 0x800 - (raster->center[i][1] & 0x7FF) );
+ raster->center[i][1] = -( 0x800 - (raster->center[i][1] & 0x7ff) );
// calculate clipping planes
float left_plane = float(raster->center[i][0] - raster->viewport[0]);
@@ -1148,9 +1148,9 @@ void model2_state::model2_3d_push( raster_state *raster, u32 input )
/* do the write */
if ( address & 0x800000 )
- raster->texture_ram[address&0xFFFF] = raster->command_buffer[2];
+ raster->texture_ram[address & 0xffff] = raster->command_buffer[2];
else
- raster->log_ram[address&0xFFFF] = raster->command_buffer[2];
+ raster->log_ram[address & 0xffff] = raster->command_buffer[2];
/* increment the address and decrease the count */
raster->command_buffer[0]++;
@@ -1186,7 +1186,7 @@ void model2_state::model2_3d_push( raster_state *raster, u32 input )
else
{
/* new command */
- raster->cur_command = input & 0x0F;
+ raster->cur_command = input & 0x0f;
raster->command_index = 0;
/* see if it's object data */
@@ -1278,7 +1278,7 @@ void model2_state::geo_parse_np_ns( geo_state *geo, u32 *input, u32 count )
attr = *input++;
/* push to the 3d rasterizer */
- model2_3d_push( raster, attr & 0x0003FFFF );
+ model2_3d_push(raster, attr & 0x0003ffff);
/* read in the normal */
normal.x = u2f(*input++);
@@ -1426,7 +1426,7 @@ void model2_state::geo_parse_np_s( geo_state *geo, u32 *input, u32 count )
attr = *input++;
/* push to the 3d rasterizer */
- model2_3d_push( raster, attr & 0x0003FFFF );
+ model2_3d_push(raster, attr & 0x0003ffff);
/* read in the normal */
normal.x = u2f(*input++);
@@ -1440,7 +1440,7 @@ void model2_state::geo_parse_np_s( geo_state *geo, u32 *input, u32 count )
{
float dotl, dotp, luminance, distance, specular;
float coef, face;
- int32_t luma;
+ int32_t luma;
texture_parameter * texparam;
/* read in the next point */
@@ -1545,42 +1545,42 @@ void model2_state::geo_parse_nn_ns( geo_state *geo, u32 *input, u32 count )
u32 attr, i;
/* read the 1st point */
- point.x = u2f( *input++ );
- point.y = u2f( *input++ );
- point.pz = u2f( *input++ );
+ point.x = u2f(*input++);
+ point.y = u2f(*input++);
+ point.pz = u2f(*input++);
/* transform with the current matrix */
- transform_point( &point, geo->matrix );
+ transform_point(&point, geo->matrix);
/* save for normal calculation */
p0.x = point.x; p0.y = point.y; p0.pz = point.pz;
/* apply focus */
- apply_focus( geo, &point );
+ apply_focus(geo, &point);
/* push it to the 3d rasterizer */
- model2_3d_push( raster, f2u(point.x) >> 8 );
- model2_3d_push( raster, f2u(point.y) >> 8 );
- model2_3d_push( raster, f2u(point.pz) >> 8 );
+ model2_3d_push(raster, f2u(point.x) >> 8);
+ model2_3d_push(raster, f2u(point.y) >> 8);
+ model2_3d_push(raster, f2u(point.pz) >> 8);
/* read the 2nd point */
- point.x = u2f( *input++ );
- point.y = u2f( *input++ );
- point.pz = u2f( *input++ );
+ point.x = u2f(*input++);
+ point.y = u2f(*input++);
+ point.pz = u2f(*input++);
/* transform with the current matrix */
- transform_point( &point, geo->matrix );
+ transform_point(&point, geo->matrix);
/* save for normal calculation */
p1.x = point.x; p1.y = point.y; p1.pz = point.pz;
/* apply focus */
- apply_focus( geo, &point );
+ apply_focus(geo, &point);
/* push it to the 3d rasterizer */
- model2_3d_push( raster, f2u(point.x) >> 8 );
- model2_3d_push( raster, f2u(point.y) >> 8 );
- model2_3d_push( raster, f2u(point.pz) >> 8 );
+ model2_3d_push(raster, f2u(point.x) >> 8);
+ model2_3d_push(raster, f2u(point.y) >> 8);
+ model2_3d_push(raster, f2u(point.pz) >> 8);
/* loop through the following links */
for( i = 0; i < count; i++ )
@@ -1589,22 +1589,22 @@ void model2_state::geo_parse_nn_ns( geo_state *geo, u32 *input, u32 count )
attr = *input++;
/* push to the 3d rasterizer */
- model2_3d_push( raster, attr & 0x0003FFFF );
+ model2_3d_push(raster, attr & 0x0003ffff);
if ( (attr & 3) != 0 ) /* quad or triangle */
{
float dotl, dotp, luminance, distance;
float coef, face;
- int32_t luma;
+ int32_t luma;
texture_parameter * texparam;
/* Skip normal */
input += 3;
/* read in the next point */
- point.x = u2f( *input++ );
- point.y = u2f( *input++ );
- point.pz = u2f( *input++ );
+ point.x = u2f(*input++);
+ point.y = u2f(*input++);
+ point.pz = u2f(*input++);
/* transform with the current matrix */
transform_point( &point, geo->matrix );
@@ -1780,13 +1780,13 @@ void model2_state::geo_parse_nn_s( geo_state *geo, u32 *input, u32 count )
attr = *input++;
/* push to the 3d rasterizer */
- model2_3d_push( raster, attr & 0x0003FFFF );
+ model2_3d_push(raster, attr & 0x0003ffff);
if ( (attr & 3) != 0 ) /* quad or triangle */
{
float dotl, dotp, luminance, distance, specular;
float coef, face;
- int32_t luma;
+ int32_t luma;
texture_parameter * texparam;
/* Skip normal */
@@ -1965,7 +1965,7 @@ u32 *model2_state::geo_object_data( geo_state *geo, u32 opcode, u32 *input )
if ( oba & 0x01000000 )
{
/* Fast polygon RAM */
- obp = &geo->polygon_ram1[oba & 0x7FFF];
+ obp = &geo->polygon_ram1[oba & 0x7fff];
}
else if ( oba & 0x00800000 )
{
@@ -1975,7 +1975,7 @@ u32 *model2_state::geo_object_data( geo_state *geo, u32 opcode, u32 *input )
else
{
/* Slow Polygon RAM */
- obp = &geo->polygon_ram0[oba & 0x7FFF];
+ obp = &geo->polygon_ram0[oba & 0x7fff];
}
// if count == 0 then rolls over to max size
@@ -2008,55 +2008,50 @@ u32 *model2_state::geo_direct_data( geo_state *geo, u32 opcode, u32 *input )
raster_state *raster = geo->raster;
u32 tpa = *input++; /* Texture Point Address */
u32 tha = *input++; /* Texture Header Address */
- u32 attr;
/* push the initial set of data to the 3d rasterizer */
- model2_3d_push( raster, (opcode >> 23) - 1 );
- model2_3d_push( raster, tpa );
- model2_3d_push( raster, tha );
+ model2_3d_push(raster, (opcode >> 23) - 1);
+ model2_3d_push(raster, tpa);
+ model2_3d_push(raster, tha);
/* push the initial points */
- model2_3d_push( raster, (*input++) >> 8 ); /* x */
- model2_3d_push( raster, (*input++) >> 8 ); /* y */
- model2_3d_push( raster, (*input++) >> 8 ); /* z */
+ model2_3d_push(raster, (*input++) >> 8); /* x */
+ model2_3d_push(raster, (*input++) >> 8); /* y */
+ model2_3d_push(raster, (*input++) >> 8); /* z */
- model2_3d_push( raster, (*input++) >> 8 ); /* x */
- model2_3d_push( raster, (*input++) >> 8 ); /* y */
- model2_3d_push( raster, (*input++) >> 8 ); /* z */
+ model2_3d_push(raster, (*input++) >> 8); /* x */
+ model2_3d_push(raster, (*input++) >> 8); /* y */
+ model2_3d_push(raster, (*input++) >> 8); /* z */
- do
+ /* read in the attributes */
+ u32 attr;
+ while (((attr = *input++) & 3) != 0)
{
- /* read in the attributes */
- attr = *input++;
-
- if ( (attr & 3) == 0 )
- break;
-
/* push attributes */
- model2_3d_push( raster, attr & 0x00FFFFFF );
+ model2_3d_push(raster, attr & 0x00ffffff);
/* push luma */
- model2_3d_push( raster, (*input++) >> 8 );
+ model2_3d_push(raster, (*input++) >> 8);
/* push distance */
- model2_3d_push( raster, (*input++) >> 8 );
+ model2_3d_push(raster, (*input++) >> 8);
/* push the next point */
- model2_3d_push( raster, (*input++) >> 8 ); /* x */
- model2_3d_push( raster, (*input++) >> 8 ); /* y */
- model2_3d_push( raster, (*input++) >> 8 ); /* z */
+ model2_3d_push(raster, (*input++) >> 8); /* x */
+ model2_3d_push(raster, (*input++) >> 8); /* y */
+ model2_3d_push(raster, (*input++) >> 8); /* z */
/* if it's a quad, output another point */
- if ( attr & 1 )
+ if (attr & 1)
{
- model2_3d_push( raster, (*input++) >> 8 ); /* x */
- model2_3d_push( raster, (*input++) >> 8 ); /* y */
- model2_3d_push( raster, (*input++) >> 8 ); /* z */
+ model2_3d_push(raster, (*input++) >> 8); /* x */
+ model2_3d_push(raster, (*input++) >> 8); /* y */
+ model2_3d_push(raster, (*input++) >> 8); /* z */
}
- } while( 1 );
+ }
/* we're done */
- model2_3d_push( raster, 0 );
+ model2_3d_push(raster, 0);
return input;
}
@@ -2065,7 +2060,6 @@ u32 *model2_state::geo_direct_data( geo_state *geo, u32 opcode, u32 *input )
u32 *model2_state::geo_window_data( geo_state *geo, u32 opcode, u32 *input )
{
raster_state *raster = geo->raster;
- u32 x, y, i;
/* start by pushing the opcode */
model2_3d_push( raster, opcode >> 23 );
@@ -2082,17 +2076,17 @@ u32 *model2_state::geo_window_data( geo_state *geo, u32 opcode, u32 *input )
- vanishing point 3 (eye mode 3)
*/
- for( i = 0; i < 6; i++ )
+ for (u32 i = 0; i < 6; i++)
{
/* read in the coordinate */
- y = *input++;
+ u32 y = *input++;
/* convert to the 3d rasterizer format (00XXXYYY) */
- x = ( y & 0x0FFF0000 ) >> 4 ;
- y &= 0xFFF;
+ u32 x = (y & 0x0fff0000) >> 4 ;
+ y &= 0xfff;
/* push it */
- model2_3d_push( raster, x | y );
+ model2_3d_push(raster, x | y);
}
return input;
@@ -2102,29 +2096,28 @@ u32 *model2_state::geo_window_data( geo_state *geo, u32 opcode, u32 *input )
u32 *model2_state::geo_texture_data( geo_state *geo, u32 opcode, u32 *input )
{
raster_state *raster = geo->raster;
- u32 i, count;
/* start by pushing the opcode */
- model2_3d_push( raster, opcode >> 23 );
+ model2_3d_push(raster, opcode >> 23);
/* push the starting address/dsp id */
- model2_3d_push( raster, *input++ );
+ model2_3d_push(raster, *input++);
/* get the count */
- count = *input++;
+ u32 count = *input++;
/* push the count */
- model2_3d_push( raster, count );
+ model2_3d_push(raster, count);
/* loop and send the data */
- for( i = 0; i < count; i++ )
- model2_3d_push( raster, *input++ );
+ for (u32 i = 0; i < count; i++)
+ model2_3d_push(raster, *input++);
return input;
}
/* Command 05: Polygon Data */
-u32 *model2_state::geo_polygon_data( geo_state *geo, u32 opcode, u32 *input )
+u32 *model2_state::geo_polygon_data(geo_state *geo, u32 opcode, u32 *input)
{
u32 address, count, i;
u32 *p;
@@ -2138,12 +2131,12 @@ u32 *model2_state::geo_polygon_data( geo_state *geo, u32 opcode, u32 *input )
if ( address & 0x01000000 )
{
/* Fast polygon RAM */
- p = &geo->polygon_ram1[address & 0x7FFF];
+ p = &geo->polygon_ram1[address & 0x7fff];
}
else
{
/* Slow Polygon RAM */
- p = &geo->polygon_ram0[address & 0x7FFF];
+ p = &geo->polygon_ram0[address & 0x7fff];
}
/* read the count */
@@ -2174,22 +2167,22 @@ u32 *model2_state::geo_texture_parameters( geo_state *geo, u32 opcode, u32 *inpu
/* read in the texture parameters */
param = *input++;
- geo->texture_parameters[index].diffuse = (float)( param & 0xFF );
- geo->texture_parameters[index].ambient = (float)( (param >> 8) & 0xFF );
- geo->texture_parameters[index].specular_control = (param >> 24) & 0xFF;
- geo->texture_parameters[index].specular_scale = (float)( (param >> 16) & 0xFF );
+ geo->texture_parameters[index].diffuse = float(param & 0xff);
+ geo->texture_parameters[index].ambient = float((param >> 8) & 0xff);
+ geo->texture_parameters[index].specular_control = (param >> 24) & 0xff;
+ geo->texture_parameters[index].specular_scale = float((param >> 16) & 0xff);
/* read in the distance coefficient */
geo->coef_table[index] = u2f(*input++);
- index = (index + 1) & 0x1F;
+ index = (index + 1) & 0x1f;
}
return input;
}
/* Command 07: Geo Mode */
-u32 *model2_state::geo_mode( geo_state *geo, u32 opcode, u32 *input )
+u32 *model2_state::geo_mode(geo_state *geo, u32 opcode, u32 *input)
{
(void)opcode;
@@ -2200,15 +2193,15 @@ u32 *model2_state::geo_mode( geo_state *geo, u32 opcode, u32 *input )
}
/* Command 08: ZSort Mode */
-u32 *model2_state::geo_zsort_mode( geo_state *geo, u32 opcode, u32 *input )
+u32 *model2_state::geo_zsort_mode(geo_state *geo, u32 opcode, u32 *input)
{
raster_state *raster = geo->raster;
/* push the opcode */
- model2_3d_push( raster, opcode >> 23 );
+ model2_3d_push(raster, opcode >> 23);
/* push the mode */
- model2_3d_push( raster, (*input++) >> 8 );
+ model2_3d_push(raster, (*input++) >> 8);
return input;
}
@@ -2338,7 +2331,7 @@ u32 *model2_state::geo_test( geo_state *geo, u32 opcode, u32 *input )
u32 sum_even, sum_odd, j;
/* read in the address */
- address = (*input++) & 0x7FFFFF;
+ address = (*input++) & 0x7fffff;
/* read in the count */
count = *input++;
@@ -2357,17 +2350,17 @@ u32 *model2_state::geo_test( geo_state *geo, u32 opcode, u32 *input )
address &= geo->polygon_rom_mask;
sum_even += data >> 16;
- sum_even &= 0xFFFF;
+ sum_even &= 0xffff;
- sum_odd += data & 0xFFFF;
- sum_odd &= 0xFFFF;
+ sum_odd += data & 0xffff;
+ sum_odd &= 0xffff;
}
sum_even += checksum >> 16;
- sum_even &= 0xFFFF;
+ sum_even &= 0xffff;
- sum_odd += checksum & 0xFFFF;
- sum_odd &= 0xFFFF;
+ sum_odd += checksum & 0xffff;
+ sum_odd &= 0xffff;
if ( sum_even != 0 || sum_odd != 0 )
{
@@ -2387,7 +2380,7 @@ u32 *model2_state::geo_end( geo_state *geo, u32 opcode, u32 *input )
(void)opcode;
/* signal the end of this data block the rasterizer */
- model2_3d_push( raster, 0xFF000000 );
+ model2_3d_push( raster, 0xff000000 );
/* signal end by returning nullptr */
return nullptr;
@@ -2515,7 +2508,7 @@ u32 *model2_state::geo_code_jump( geo_state *geo, u32 opcode, u32 *input )
(void)opcode;
-// address = *input++ & 0x3FF;
+// address = *input++ & 0x3ff;
input++;
/*
@@ -2538,12 +2531,12 @@ u32 *model2_state::geo_process_command( geo_state *geo, u32 opcode, u32 *input,
case 0x07: input = geo_mode( geo, opcode, input ); break;
case 0x08: input = geo_zsort_mode( geo, opcode, input ); break;
case 0x09: input = geo_focal_distance( geo, opcode, input ); break;
- case 0x0A: input = geo_light_source( geo, opcode, input ); break;
- case 0x0B: input = geo_matrix_write( geo, opcode, input ); break;
- case 0x0C: input = geo_translate_write( geo, opcode, input ); break;
- case 0x0D: input = geo_data_mem_push( geo, opcode, input ); break;
- case 0x0E: input = geo_test( geo, opcode, input ); break;
- case 0x0F: input = geo_end( geo, opcode, input ); *end_code = true; break;
+ case 0x0a: input = geo_light_source( geo, opcode, input ); break;
+ case 0x0b: input = geo_matrix_write( geo, opcode, input ); break;
+ case 0x0c: input = geo_translate_write( geo, opcode, input ); break;
+ case 0x0d: input = geo_data_mem_push( geo, opcode, input ); break;
+ case 0x0e: input = geo_test( geo, opcode, input ); break;
+ case 0x0f: input = geo_end( geo, opcode, input ); *end_code = true; break;
case 0x10: input = geo_dummy( geo, opcode, input ); break;
case 0x11: input = geo_object_data( geo, opcode, input ); break;
case 0x12: input = geo_direct_data( geo, opcode, input ); break;
@@ -2554,12 +2547,12 @@ u32 *model2_state::geo_process_command( geo_state *geo, u32 opcode, u32 *input,
case 0x17: input = geo_mode( geo, opcode, input ); break;
case 0x18: input = geo_zsort_mode( geo, opcode, input ); break;
case 0x19: input = geo_focal_distance( geo, opcode, input ); break;
- case 0x1A: input = geo_light_source( geo, opcode, input ); break;
- case 0x1B: input = geo_matrix_write( geo, opcode, input ); break;
- case 0x1C: input = geo_translate_write( geo, opcode, input ); break;
- case 0x1D: input = geo_code_upload( geo, opcode, input ); break;
- case 0x1E: input = geo_code_jump( geo, opcode, input ); break;
- case 0x1F: input = geo_end( geo, opcode, input ); *end_code = true; break;
+ case 0x1a: input = geo_light_source( geo, opcode, input ); break;
+ case 0x1b: input = geo_matrix_write( geo, opcode, input ); break;
+ case 0x1c: input = geo_translate_write( geo, opcode, input ); break;
+ case 0x1d: input = geo_code_upload( geo, opcode, input ); break;
+ case 0x1e: input = geo_code_jump( geo, opcode, input ); break;
+ case 0x1f: input = geo_end( geo, opcode, input ); *end_code = true; break;
}
return input;
@@ -2581,7 +2574,7 @@ void model2_state::geo_parse( void )
if ( opcode & 0x80000000 )
{
/* get the address */
- address = (opcode & 0x1FFFF) / 4;
+ address = (opcode & 0x1ffff) / 4;
/* update our pointer */
input = &m_bufferram[address];
diff --git a/src/mame/sega/model3.cpp b/src/mame/sega/model3.cpp
index b4ed68a1dfb..7bca87e8e49 100644
--- a/src/mame/sega/model3.cpp
+++ b/src/mame/sega/model3.cpp
@@ -6357,19 +6357,18 @@ void model3_state::add_base_devices(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfxdecode_device::empty);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
SCSP(config, m_scsp1, 45.1584_MHz_XTAL / 2); // 45.158 MHz XTAL
m_scsp1->set_addrmap(0, &model3_state::scsp1_map);
m_scsp1->irq_cb().set(FUNC(model3_state::scsp_irq));
- m_scsp1->add_route(0, "lspeaker", 1.0);
- m_scsp1->add_route(1, "rspeaker", 1.0);
+ m_scsp1->add_route(0, "speaker", 1.0, 0);
+ m_scsp1->add_route(1, "speaker", 1.0, 1);
scsp_device &scsp2(SCSP(config, "scsp2", 45.1584_MHz_XTAL / 2));
scsp2.set_addrmap(0, &model3_state::scsp2_map);
- scsp2.add_route(0, "lspeaker", 1.0);
- scsp2.add_route(1, "rspeaker", 1.0);
+ scsp2.add_route(0, "speaker", 1.0, 0);
+ scsp2.add_route(1, "speaker", 1.0, 1);
SEGA_BILLBOARD(config, m_billboard, 0);
@@ -6458,8 +6457,8 @@ void model3_state::scud(machine_config &config)
model3_15(config);
DSBZ80(config, m_dsbz80, 0);
- m_dsbz80->add_route(0, "lspeaker", 1.0);
- m_dsbz80->add_route(1, "rspeaker", 1.0);
+ m_dsbz80->add_route(0, "speaker", 1.0, 0);
+ m_dsbz80->add_route(1, "speaker", 1.0, 1);
I8251(config, m_uart, 8000000); // uPD71051
m_uart->txd_handler().set(m_dsbz80, FUNC(dsbz80_device::write_txd));
diff --git a/src/mame/sega/naomi.cpp b/src/mame/sega/naomi.cpp
index 159db6e8628..b3a7dfca5e1 100644
--- a/src/mame/sega/naomi.cpp
+++ b/src/mame/sega/naomi.cpp
@@ -2444,15 +2444,14 @@ void dc_state::naomi_aw_base(machine_config &config)
POWERVR2(config, m_powervr2, 0);
m_powervr2->irq_callback().set(FUNC(dc_state::pvr_irq));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
AICA(config, m_aica, (XTAL(33'868'800)*2)/3); // 67.7376MHz(2*33.8688MHz), div 3 for audio block
m_aica->irq().set(FUNC(dc_state::aica_irq));
m_aica->main_irq().set(FUNC(dc_state::sh4_aica_irq));
m_aica->set_addrmap(0, &dc_state::aica_map);
- m_aica->add_route(0, "lspeaker", 1.0);
- m_aica->add_route(1, "rspeaker", 1.0);
+ m_aica->add_route(0, "speaker", 1.0, 0);
+ m_aica->add_route(1, "speaker", 1.0, 1);
AICARTC(config, "aicartc", XTAL(32'768));
}
diff --git a/src/mame/sega/puckpkmn.cpp b/src/mame/sega/puckpkmn.cpp
index ba640ac2c8c..aded3db7cfe 100644
--- a/src/mame/sega/puckpkmn.cpp
+++ b/src/mame/sega/puckpkmn.cpp
@@ -403,21 +403,20 @@ void puckpkmn_state::puckpkmn(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &puckpkmn_state::puckpkmn_map);
- m_vdp->add_route(ALL_OUTPUTS, "lspeaker", 0.50);
- m_vdp->add_route(ALL_OUTPUTS, "rspeaker", 0.50);
+ m_vdp->add_route(ALL_OUTPUTS, "speaker", 0.50, 0);
+ m_vdp->add_route(ALL_OUTPUTS, "speaker", 0.50, 1);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
// Internalized YM3438 in VDP ASIC
YM3438(config, m_ymsnd, MASTER_CLOCK_NTSC / 7); // 7.67 MHz
- m_ymsnd->add_route(0, "lspeaker", 0.50);
- m_ymsnd->add_route(1, "rspeaker", 0.50);
+ m_ymsnd->add_route(0, "speaker", 0.50, 0);
+ m_ymsnd->add_route(1, "speaker", 0.50, 1);
okim6295_device &oki(OKIM6295(config, "oki", XTAL(4'000'000) / 4, okim6295_device::PIN7_HIGH));
- oki.add_route(ALL_OUTPUTS, "lspeaker", 0.25);
- oki.add_route(ALL_OUTPUTS, "rspeaker", 0.25);
+ oki.add_route(ALL_OUTPUTS, "speaker", 0.25, 0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 0.25, 1);
}
void puckpkmn_state::jingling(machine_config &config)
diff --git a/src/mame/sega/saturn.cpp b/src/mame/sega/saturn.cpp
index 2c32097969b..378b8053cca 100644
--- a/src/mame/sega/saturn.cpp
+++ b/src/mame/sega/saturn.cpp
@@ -864,15 +864,14 @@ void sat_console_state::saturn(machine_config &config)
MCFG_VIDEO_START_OVERRIDE(sat_console_state,stv_vdp2)
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
SCSP(config, m_scsp, 8467200*8/3); // 8.4672 MHz EXTCLK * 8 / 3 = 22.5792 MHz
m_scsp->set_addrmap(0, &sat_console_state::scsp_mem);
m_scsp->irq_cb().set(FUNC(saturn_state::scsp_irq));
m_scsp->main_irq_cb().set(m_scu, FUNC(sega_scu_device::sound_req_w));
- m_scsp->add_route(0, "lspeaker", 1.0);
- m_scsp->add_route(1, "rspeaker", 1.0);
+ m_scsp->add_route(0, "speaker", 1.0, 0);
+ m_scsp->add_route(1, "speaker", 1.0, 1);
stvcd_device &stvcd(STVCD(config, "stvcd", 0));
stvcd.add_route(0, "scsp", 1.0, 0);
diff --git a/src/mame/sega/segaatom.cpp b/src/mame/sega/segaatom.cpp
index d5f5d4475f8..eb71dc6f3af 100644
--- a/src/mame/sega/segaatom.cpp
+++ b/src/mame/sega/segaatom.cpp
@@ -112,12 +112,11 @@ void atom2_state::atom2(machine_config &config)
PALETTE(config, "palette").set_entries(65536);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ymz770_device &ymz770(YMZ770(config, "ymz770", 16.384_MHz_XTAL));
- ymz770.add_route(0, "lspeaker", 1.0);
- ymz770.add_route(1, "rspeaker", 1.0);
+ ymz770.add_route(0, "speaker", 1.0, 0);
+ ymz770.add_route(1, "speaker", 1.0, 1);
}
diff --git a/src/mame/sega/segafruit.cpp b/src/mame/sega/segafruit.cpp
index 51aa9223cf2..6a90fab3d15 100644
--- a/src/mame/sega/segafruit.cpp
+++ b/src/mame/sega/segafruit.cpp
@@ -303,13 +303,12 @@ void segafruit_state::segafruit(machine_config & config)
GENERIC_LATCH_8(config, m_soundlatch);//.data_pending_callback().set_inputline(m_soundcpu, INPUT_LINE_IRQ0);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
RF5C68(config, m_rf5c68, 16_MHz_XTAL / 2); // divider not verified;
m_rf5c68->set_addrmap(0, &segafruit_state::pcm_map);
- m_rf5c68->add_route(0, "lspeaker", 0.40);
- m_rf5c68->add_route(1, "rspeaker", 0.40);
+ m_rf5c68->add_route(0, "speaker", 0.40, 0);
+ m_rf5c68->add_route(1, "speaker", 0.40, 1);
}
ROM_START(m4001)
diff --git a/src/mame/sega/segag80r.cpp b/src/mame/sega/segag80r.cpp
index f8898ba8b4e..dcf8262040a 100644
--- a/src/mame/sega/segag80r.cpp
+++ b/src/mame/sega/segag80r.cpp
@@ -862,7 +862,7 @@ void segag80r_state::astrob(machine_config &config)
SPEAKER(config, "speaker").front_center();
/* sound boards */
- ASTRO_BLASTER_AUDIO(config, m_g80_audio, 0).add_route(ALL_OUTPUTS, "speech", 1.0);
+ ASTRO_BLASTER_AUDIO(config, m_g80_audio, 0).add_route(ALL_OUTPUTS, "speech", 1.0, 1);
SEGA_SPEECH_BOARD(config, "speech", 0).add_route(ALL_OUTPUTS, "speaker", 0.5);
}
diff --git a/src/mame/sega/segag80r.h b/src/mame/sega/segag80r.h
index a1257d9e55b..af44db4d1e1 100644
--- a/src/mame/sega/segag80r.h
+++ b/src/mame/sega/segag80r.h
@@ -204,7 +204,7 @@ protected:
virtual void device_start() 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;
private:
// internal state
diff --git a/src/mame/sega/segag80r_a.cpp b/src/mame/sega/segag80r_a.cpp
index 858d8b00a10..50a84d4a094 100644
--- a/src/mame/sega/segag80r_a.cpp
+++ b/src/mame/sega/segag80r_a.cpp
@@ -59,14 +59,14 @@ void sega005_sound_device::device_start()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void sega005_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void sega005_sound_device::sound_stream_update(sound_stream &stream)
{
segag80r_state *state = machine().driver_data<segag80r_state>();
const uint8_t *sound_prom = state->memregion("proms")->base();
int i;
/* no implementation yet */
- for (i = 0; i < outputs[0].samples(); i++)
+ for (i = 0; i < stream.samples(); i++)
{
if (!(state->m_sound_state[1] & 0x10) && (++state->m_square_count & 0xff) == 0)
{
@@ -77,7 +77,7 @@ void sega005_sound_device::sound_stream_update(sound_stream &stream, std::vector
state->m_square_state += 2;
}
- outputs[0].put(i, (state->m_square_state & 2) ? 1.0 : 0.0);
+ stream.put(0, i, (state->m_square_state & 2) ? 1.0 : 0.0);
}
}
diff --git a/src/mame/sega/segag80v.cpp b/src/mame/sega/segag80v.cpp
index ba0413e745c..67b3aea09a9 100644
--- a/src/mame/sega/segag80v.cpp
+++ b/src/mame/sega/segag80v.cpp
@@ -939,7 +939,7 @@ void segag80v_state::elim2(machine_config &config)
void segag80v_state::spacfury(machine_config &config)
{
g80v_base(config);
- SPACE_FURY_AUDIO(config, m_g80_audio, 0).add_route(ALL_OUTPUTS, "speech", 1.0);
+ SPACE_FURY_AUDIO(config, m_g80_audio, 0).add_route(ALL_OUTPUTS, "speech", 1.0, 1);
SEGA_SPEECH_BOARD(config, "speech", 0).add_route(ALL_OUTPUTS, "speaker", 1.0);
}
@@ -959,7 +959,7 @@ void segag80v_state::spacfurybl(machine_config &config)
void segag80v_state::zektor(machine_config &config)
{
g80v_base(config);
- ZEKTOR_AUDIO(config, m_g80_audio, 0).add_route(ALL_OUTPUTS, "speech", 0.7);
+ ZEKTOR_AUDIO(config, m_g80_audio, 0).add_route(ALL_OUTPUTS, "speech", 0.7, 1);
SEGA_SPEECH_BOARD(config, "speech", 0).add_route(ALL_OUTPUTS, "speaker", 1.0);
}
@@ -972,7 +972,7 @@ void segag80v_state::tacscan(machine_config &config)
void segag80v_state::startrek(machine_config &config)
{
g80v_base(config);
- SEGAUSB(config, m_usb, 0, m_maincpu).add_route(ALL_OUTPUTS, "speech", 1.0);
+ SEGAUSB(config, m_usb, 0, m_maincpu).add_route(ALL_OUTPUTS, "speech", 1.0, 1);
SEGA_SPEECH_BOARD(config, "speech", 0).add_route(ALL_OUTPUTS, "speaker", 1.0);
}
diff --git a/src/mame/sega/segahang.cpp b/src/mame/sega/segahang.cpp
index 1a0f0bbbaf8..c11159505d3 100644
--- a/src/mame/sega/segahang.cpp
+++ b/src/mame/sega/segahang.cpp
@@ -821,24 +821,23 @@ void segahang_state::sound_board_2203(machine_config &config)
m_soundcpu->set_addrmap(AS_IO, &segahang_state::sound_portmap_2203);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2203_device &ymsnd(YM2203(config, "ymsnd", MASTER_CLOCK_8MHz/2));
ymsnd.irq_handler().set_inputline("soundcpu", 0);
- ymsnd.add_route(0, "lspeaker", 0.13);
- ymsnd.add_route(0, "rspeaker", 0.13);
- ymsnd.add_route(1, "lspeaker", 0.13);
- ymsnd.add_route(1, "rspeaker", 0.13);
- ymsnd.add_route(2, "lspeaker", 0.13);
- ymsnd.add_route(2, "rspeaker", 0.13);
- ymsnd.add_route(3, "lspeaker", 0.37);
- ymsnd.add_route(3, "rspeaker", 0.37);
+ ymsnd.add_route(0, "speaker", 0.13, 0);
+ ymsnd.add_route(0, "speaker", 0.13, 1);
+ ymsnd.add_route(1, "speaker", 0.13, 0);
+ ymsnd.add_route(1, "speaker", 0.13, 1);
+ ymsnd.add_route(2, "speaker", 0.13, 0);
+ ymsnd.add_route(2, "speaker", 0.13, 1);
+ ymsnd.add_route(3, "speaker", 0.37, 0);
+ ymsnd.add_route(3, "speaker", 0.37, 1);
segapcm_device &pcm(SEGAPCM(config, "pcm", MASTER_CLOCK_8MHz));
pcm.set_bank(segapcm_device::BANK_512);
- pcm.add_route(0, "lspeaker", 1.0);
- pcm.add_route(1, "rspeaker", 1.0);
+ pcm.add_route(0, "speaker", 1.0, 0);
+ pcm.add_route(1, "speaker", 1.0, 1);
}
void segahang_state::sound_board_2203x2(machine_config &config)
@@ -849,34 +848,33 @@ void segahang_state::sound_board_2203x2(machine_config &config)
m_soundcpu->set_addrmap(AS_IO, &segahang_state::sound_portmap_2203x2);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2203_device &ym1(YM2203(config, "ym1", MASTER_CLOCK_8MHz/2));
ym1.irq_handler().set_inputline("soundcpu", 0);
- ym1.add_route(0, "lspeaker", 0.13);
- ym1.add_route(0, "rspeaker", 0.13);
- ym1.add_route(1, "lspeaker", 0.13);
- ym1.add_route(1, "rspeaker", 0.13);
- ym1.add_route(2, "lspeaker", 0.13);
- ym1.add_route(2, "rspeaker", 0.13);
- ym1.add_route(3, "lspeaker", 0.37);
- ym1.add_route(3, "rspeaker", 0.37);
+ ym1.add_route(0, "speaker", 0.13, 0);
+ ym1.add_route(0, "speaker", 0.13, 1);
+ ym1.add_route(1, "speaker", 0.13, 0);
+ ym1.add_route(1, "speaker", 0.13, 1);
+ ym1.add_route(2, "speaker", 0.13, 0);
+ ym1.add_route(2, "speaker", 0.13, 1);
+ ym1.add_route(3, "speaker", 0.37, 0);
+ ym1.add_route(3, "speaker", 0.37, 1);
ym2203_device &ym2(YM2203(config, "ym2", MASTER_CLOCK_8MHz/2));
- ym2.add_route(0, "lspeaker", 0.13);
- ym2.add_route(0, "rspeaker", 0.13);
- ym2.add_route(1, "lspeaker", 0.13);
- ym2.add_route(1, "rspeaker", 0.13);
- ym2.add_route(2, "lspeaker", 0.13);
- ym2.add_route(2, "rspeaker", 0.13);
- ym2.add_route(3, "lspeaker", 0.37);
- ym2.add_route(3, "rspeaker", 0.37);
+ ym2.add_route(0, "speaker", 0.13, 0);
+ ym2.add_route(0, "speaker", 0.13, 1);
+ ym2.add_route(1, "speaker", 0.13, 0);
+ ym2.add_route(1, "speaker", 0.13, 1);
+ ym2.add_route(2, "speaker", 0.13, 0);
+ ym2.add_route(2, "speaker", 0.13, 1);
+ ym2.add_route(3, "speaker", 0.37, 0);
+ ym2.add_route(3, "speaker", 0.37, 1);
segapcm_device &pcm(SEGAPCM(config, "pcm", MASTER_CLOCK_8MHz/2));
pcm.set_bank(segapcm_device::BANK_512);
- pcm.add_route(0, "lspeaker", 1.0);
- pcm.add_route(1, "rspeaker", 1.0);
+ pcm.add_route(0, "speaker", 1.0, 0);
+ pcm.add_route(1, "speaker", 1.0, 1);
}
void segahang_state::sound_board_2151(machine_config &config)
@@ -887,18 +885,17 @@ void segahang_state::sound_board_2151(machine_config &config)
m_soundcpu->set_addrmap(AS_IO, &segahang_state::sound_portmap_2151);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2151_device &ymsnd(YM2151(config, "ymsnd", MASTER_CLOCK_8MHz/2));
ymsnd.irq_handler().set_inputline(m_soundcpu, 0);
- ymsnd.add_route(0, "lspeaker", 0.43);
- ymsnd.add_route(1, "rspeaker", 0.43);
+ ymsnd.add_route(0, "speaker", 0.43, 0);
+ ymsnd.add_route(1, "speaker", 0.43, 1);
segapcm_device &pcm(SEGAPCM(config, "pcm", MASTER_CLOCK_8MHz/2));
pcm.set_bank(segapcm_device::BANK_512);
- pcm.add_route(0, "lspeaker", 1.0);
- pcm.add_route(1, "rspeaker", 1.0);
+ pcm.add_route(0, "speaker", 1.0, 0);
+ pcm.add_route(1, "speaker", 1.0, 1);
}
diff --git a/src/mame/sega/segald.cpp b/src/mame/sega/segald.cpp
index a557f4e8067..9c522dc6ddb 100644
--- a/src/mame/sega/segald.cpp
+++ b/src/mame/sega/segald.cpp
@@ -384,8 +384,8 @@ void segald_state::astron(machine_config &config)
PIONEER_LDV1000(config, m_laserdisc, 0);
m_laserdisc->set_overlay(256, 256, FUNC(segald_state::screen_update_astron));
- m_laserdisc->add_route(0, "lspeaker", 1.0);
- m_laserdisc->add_route(1, "rspeaker", 1.0);
+ m_laserdisc->add_route(0, "speaker", 1.0, 0);
+ m_laserdisc->add_route(1, "speaker", 1.0, 1);
/* video hardware */
m_laserdisc->add_ntsc_screen(config, "screen");
@@ -394,8 +394,7 @@ void segald_state::astron(machine_config &config)
PALETTE(config, m_palette).set_entries(256);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
diff --git a/src/mame/sega/segaorun.cpp b/src/mame/sega/segaorun.cpp
index 786063ce037..05b3e974f03 100644
--- a/src/mame/sega/segaorun.cpp
+++ b/src/mame/sega/segaorun.cpp
@@ -1202,15 +1202,14 @@ void segaorun_state::outrun_base(machine_config &config)
SEGAIC16_ROAD(config, m_segaic16road, 0);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- YM2151(config, "ymsnd", SOUND_CLOCK/4).add_route(0, "lspeaker", 0.43).add_route(1, "rspeaker", 0.43);
+ YM2151(config, "ymsnd", SOUND_CLOCK/4).add_route(0, "speaker", 0.43, 0).add_route(1, "speaker", 0.43, 1);
segapcm_device &pcm(SEGAPCM(config, "pcm", SOUND_CLOCK/4));
pcm.set_bank(segapcm_device::BANK_512);
- pcm.add_route(0, "lspeaker", 1.0);
- pcm.add_route(1, "rspeaker", 1.0);
+ pcm.add_route(0, "speaker", 1.0, 0);
+ pcm.add_route(1, "speaker", 1.0, 1);
}
diff --git a/src/mame/sega/segapico.cpp b/src/mame/sega/segapico.cpp
index a97a3ca06cd..dff6f2ae139 100644
--- a/src/mame/sega/segapico.cpp
+++ b/src/mame/sega/segapico.cpp
@@ -404,19 +404,18 @@ void pico_state::pico_ntsc(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &pico_state::pico_mem);
- m_vdp->add_route(ALL_OUTPUTS, "lspeaker", 0.50);
- m_vdp->add_route(ALL_OUTPUTS, "rspeaker", 0.50);
+ m_vdp->add_route(ALL_OUTPUTS, "speaker", 0.50, 0);
+ m_vdp->add_route(ALL_OUTPUTS, "speaker", 0.50, 1);
PICO_CART_SLOT(config, m_picocart, pico_cart, nullptr).set_must_be_loaded(true);
SOFTWARE_LIST(config, "cart_list").set_original("pico");
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
SEGA_315_5641_PCM(config, m_sega_315_5641_pcm, upd7759_device::STANDARD_CLOCK*2);
m_sega_315_5641_pcm->fifo_cb().set(FUNC(pico_state::sound_cause_irq));
- m_sega_315_5641_pcm->add_route(ALL_OUTPUTS, "lspeaker", 0.16);
- m_sega_315_5641_pcm->add_route(ALL_OUTPUTS, "rspeaker", 0.16);
+ m_sega_315_5641_pcm->add_route(ALL_OUTPUTS, "speaker", 0.16, 0);
+ m_sega_315_5641_pcm->add_route(ALL_OUTPUTS, "speaker", 0.16, 1);
}
void pico_state::pico_pal(machine_config &config)
@@ -425,19 +424,18 @@ void pico_state::pico_pal(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &pico_state::pico_mem);
- m_vdp->add_route(ALL_OUTPUTS, "lspeaker", 0.50);
- m_vdp->add_route(ALL_OUTPUTS, "rspeaker", 0.50);
+ m_vdp->add_route(ALL_OUTPUTS, "speaker", 0.50, 0);
+ m_vdp->add_route(ALL_OUTPUTS, "speaker", 0.50, 1);
PICO_CART_SLOT(config, m_picocart, pico_cart, nullptr).set_must_be_loaded(true);
SOFTWARE_LIST(config, "cart_list").set_original("pico");
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
SEGA_315_5641_PCM(config, m_sega_315_5641_pcm, upd7759_device::STANDARD_CLOCK*2);
m_sega_315_5641_pcm->fifo_cb().set(FUNC(pico_state::sound_cause_irq));
- m_sega_315_5641_pcm->add_route(ALL_OUTPUTS, "lspeaker", 0.16);
- m_sega_315_5641_pcm->add_route(ALL_OUTPUTS, "rspeaker", 0.16);
+ m_sega_315_5641_pcm->add_route(ALL_OUTPUTS, "speaker", 0.16, 0);
+ m_sega_315_5641_pcm->add_route(ALL_OUTPUTS, "speaker", 0.16, 1);
}
@@ -683,19 +681,18 @@ void copera_state::copera(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &copera_state::copera_mem);
- m_vdp->add_route(ALL_OUTPUTS, "lspeaker", 0.50);
- m_vdp->add_route(ALL_OUTPUTS, "rspeaker", 0.50);
+ m_vdp->add_route(ALL_OUTPUTS, "speaker", 0.50, 0);
+ m_vdp->add_route(ALL_OUTPUTS, "speaker", 0.50, 1);
COPERA_CART_SLOT(config, m_picocart, copera_cart, nullptr).set_must_be_loaded(true);
SOFTWARE_LIST(config, "cart_list").set_original("copera");
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
SEGA_315_5641_PCM(config, m_sega_315_5641_pcm, upd7759_device::STANDARD_CLOCK);
m_sega_315_5641_pcm->fifo_cb().set(FUNC(copera_state::copera_pcm_cb));
- m_sega_315_5641_pcm->add_route(ALL_OUTPUTS, "lspeaker", 0.16);
- m_sega_315_5641_pcm->add_route(ALL_OUTPUTS, "rspeaker", 0.16);
+ m_sega_315_5641_pcm->add_route(ALL_OUTPUTS, "speaker", 0.16, 0);
+ m_sega_315_5641_pcm->add_route(ALL_OUTPUTS, "speaker", 0.16, 1);
}
void copera_state::copera_pcm_cb(int state)
diff --git a/src/mame/sega/segas24.cpp b/src/mame/sega/segas24.cpp
index 9d7409c93d8..a30b65073b6 100644
--- a/src/mame/sega/segas24.cpp
+++ b/src/mame/sega/segas24.cpp
@@ -1951,15 +1951,14 @@ void segas24_state::system24(machine_config &config)
PALETTE(config, m_palette).set_entries(8192*2);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2151_device &ymsnd(YM2151(config, "ymsnd", 4000000));
ymsnd.irq_handler().set(FUNC(segas24_state::irq_ym));
- ymsnd.add_route(0, "lspeaker", 0.50);
- ymsnd.add_route(1, "rspeaker", 0.50);
+ ymsnd.add_route(0, "speaker", 0.50, 0);
+ ymsnd.add_route(1, "speaker", 0.50, 1);
- DAC_8BIT_R2R(config, "dac", 0).add_route(ALL_OUTPUTS, "lspeaker", 0.5).add_route(ALL_OUTPUTS, "rspeaker", 0.5); // unknown DAC
+ DAC_8BIT_R2R(config, "dac", 0).add_route(ALL_OUTPUTS, "speaker", 0.5, 0).add_route(ALL_OUTPUTS, "speaker", 0.5, 1); // unknown DAC
}
void segas24_state::system24_rom(machine_config &config)
diff --git a/src/mame/sega/segas32.cpp b/src/mame/sega/segas32.cpp
index 0c5659741b7..10bf23e5a40 100644
--- a/src/mame/sega/segas32.cpp
+++ b/src/mame/sega/segas32.cpp
@@ -2274,21 +2274,20 @@ void segas32_state::device_add_mconfig(machine_config &config)
m_screen->set_screen_update(FUNC(segas32_state::screen_update_system32));
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym3438_device &ym1(YM3438(config, "ym1", MASTER_CLOCK/4));
ym1.irq_handler().set(FUNC(segas32_state::ym3438_irq_handler));
- ym1.add_route(0, "lspeaker", 0.40);
- ym1.add_route(1, "rspeaker", 0.40);
+ ym1.add_route(0, "speaker", 0.40, 0);
+ ym1.add_route(1, "speaker", 0.40, 1);
ym3438_device &ym2(YM3438(config, "ym2", MASTER_CLOCK/4));
- ym2.add_route(0, "lspeaker", 0.40);
- ym2.add_route(1, "rspeaker", 0.40);
+ ym2.add_route(0, "speaker", 0.40, 0);
+ ym2.add_route(1, "speaker", 0.40, 1);
rf5c68_device &rfsnd(RF5C68(config, "rfsnd", 50_MHz_XTAL/4)); // ASSP (RF)5C105 or Sega 315-5476A
- rfsnd.add_route(0, "lspeaker", 0.55);
- rfsnd.add_route(1, "rspeaker", 0.55);
+ rfsnd.add_route(0, "speaker", 0.55, 0);
+ rfsnd.add_route(1, "speaker", 0.55, 1);
rfsnd.set_addrmap(0, &segas32_state::rf5c68_map);
S32COMM(config, m_s32comm, 0);
@@ -2510,8 +2509,8 @@ void segas32_cd_state::device_add_mconfig(machine_config &config)
NSCSI_CONNECTOR(config, "scsi:0").option_set("cdrom", NSCSI_CDROM).machine_config(
[](device_t *device)
{
- device->subdevice<cdda_device>("cdda")->add_route(0, "^^lspeaker", 1.0);
- device->subdevice<cdda_device>("cdda")->add_route(1, "^^rspeaker", 1.0);
+ device->subdevice<cdda_device>("cdda")->add_route(0, "^^speaker", 1.0, 0);
+ device->subdevice<cdda_device>("cdda")->add_route(1, "^^speaker", 1.0, 1);
});
NSCSI_CONNECTOR(config, "scsi:1", scsi_devices, nullptr);
NSCSI_CONNECTOR(config, "scsi:2", scsi_devices, nullptr);
@@ -2607,18 +2606,17 @@ void sega_multi32_state::device_add_mconfig(machine_config &config)
screen2.set_screen_update(FUNC(segas32_state::screen_update_multi32_right));
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym3438_device &ymsnd(YM3438(config, "ymsnd", MASTER_CLOCK/4));
ymsnd.irq_handler().set(FUNC(segas32_state::ym3438_irq_handler));
- ymsnd.add_route(1, "lspeaker", 0.40);
- ymsnd.add_route(0, "rspeaker", 0.40);
+ ymsnd.add_route(1, "speaker", 0.40, 0);
+ ymsnd.add_route(0, "speaker", 0.40, 1);
MULTIPCM(config, m_multipcm, MULTI32_CLOCK/4);
m_multipcm->set_addrmap(0, &sega_multi32_state::multipcm_map);
- m_multipcm->add_route(1, "lspeaker", 1.0);
- m_multipcm->add_route(0, "rspeaker", 1.0);
+ m_multipcm->add_route(1, "speaker", 1.0, 0);
+ m_multipcm->add_route(0, "speaker", 1.0, 1);
S32COMM(config, m_s32comm, 0);
}
diff --git a/src/mame/sega/segasm1.cpp b/src/mame/sega/segasm1.cpp
index 1559c4cb9f1..22ed734ce46 100644
--- a/src/mame/sega/segasm1.cpp
+++ b/src/mame/sega/segasm1.cpp
@@ -615,12 +615,11 @@ void systemm1_state::m1base(machine_config &config)
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
YM3438(config, m_ym, XTAL(8'000'000));
- m_ym->add_route(0, "lspeaker", 0.40);
- m_ym->add_route(1, "rspeaker", 0.40);
+ m_ym->add_route(0, "speaker", 0.40, 0);
+ m_ym->add_route(1, "speaker", 0.40, 1);
SEGA_315_5296(config, m_io1, XTAL(16'000'000));
m_io1->in_pa_callback().set_ioport("IN1_PA");
diff --git a/src/mame/sega/segausb.cpp b/src/mame/sega/segausb.cpp
index e8e45d4cd79..66c5ff94fa0 100644
--- a/src/mame/sega/segausb.cpp
+++ b/src/mame/sega/segausb.cpp
@@ -454,12 +454,10 @@ void usb_sound_device::env_w(int which, u8 offset, u8 data)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void usb_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void usb_sound_device::sound_stream_update(sound_stream &stream)
{
- auto &dest = outputs[0];
-
// iterate over samples
- for (int sampindex = 0; sampindex < dest.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
/*----------------
Noise Source
@@ -590,7 +588,7 @@ void usb_sound_device::sound_stream_update(sound_stream &stream, std::vector<rea
WEIGHT
*/
- dest.put(sampindex, 0.1 * m_final_filter.step_cr(sample));
+ stream.put(0, sampindex, 0.1 * m_final_filter.step_cr(sample));
}
}
diff --git a/src/mame/sega/segausb.h b/src/mame/sega/segausb.h
index 598fb9a96d4..1791f2142c9 100644
--- a/src/mame/sega/segausb.h
+++ b/src/mame/sega/segausb.h
@@ -62,7 +62,7 @@ protected:
#if (!ENABLE_SEGAUSB_NETLIST)
// 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;
#endif
private:
diff --git a/src/mame/sega/segaxbd.cpp b/src/mame/sega/segaxbd.cpp
index 9e6f246b2b8..1dfa93eba58 100644
--- a/src/mame/sega/segaxbd.cpp
+++ b/src/mame/sega/segaxbd.cpp
@@ -1753,18 +1753,17 @@ void segaxbd_state::xboard_base_mconfig(machine_config &config)
SEGAIC16_ROAD(config, m_segaic16road, 0);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2151_device &ymsnd(YM2151(config, "ymsnd", SOUND_CLOCK/4));
ymsnd.irq_handler().set_inputline(m_soundcpu, 0);
- ymsnd.add_route(0, "lspeaker", 0.43);
- ymsnd.add_route(1, "rspeaker", 0.43);
+ ymsnd.add_route(0, "speaker", 0.43, 0);
+ ymsnd.add_route(1, "speaker", 0.43, 1);
segapcm_device &pcm(SEGAPCM(config, "pcm", SOUND_CLOCK/4));
pcm.set_bank(segapcm_device::BANK_512);
- pcm.add_route(0, "lspeaker", 1.0);
- pcm.add_route(1, "rspeaker", 1.0);
+ pcm.add_route(0, "speaker", 1.0, 0);
+ pcm.add_route(1, "speaker", 1.0, 1);
}
@@ -1866,8 +1865,8 @@ void segaxbd_lastsurv_fd1094_state::device_add_mconfig(machine_config &config)
// sound hardware - ym2151 stereo is reversed
subdevice<ym2151_device>("ymsnd")->reset_routes();
- subdevice<ym2151_device>("ymsnd")->add_route(0, "rspeaker", 0.43);
- subdevice<ym2151_device>("ymsnd")->add_route(1, "lspeaker", 0.43);
+ subdevice<ym2151_device>("ymsnd")->add_route(0, "speaker", 0.43, 1);
+ subdevice<ym2151_device>("ymsnd")->add_route(1, "speaker", 0.43, 0);
}
void segaxbd_new_state::sega_lastsurv_fd1094(machine_config &config)
@@ -1895,8 +1894,8 @@ void segaxbd_lastsurv_state::device_add_mconfig(machine_config &config)
// sound hardware - ym2151 stereo is reversed
subdevice<ym2151_device>("ymsnd")->reset_routes();
- subdevice<ym2151_device>("ymsnd")->add_route(0, "rspeaker", 0.43);
- subdevice<ym2151_device>("ymsnd")->add_route(1, "lspeaker", 0.43);
+ subdevice<ym2151_device>("ymsnd")->add_route(0, "speaker", 0.43, 1);
+ subdevice<ym2151_device>("ymsnd")->add_route(1, "speaker", 0.43, 0);
}
void segaxbd_new_state::sega_lastsurv(machine_config &config)
@@ -2019,8 +2018,7 @@ void segaxbd_rascot_state::device_add_mconfig(machine_config &config)
config.device_remove("soundcpu");
config.device_remove("ymsnd");
config.device_remove("pcm");
- config.device_remove("lspeaker");
- config.device_remove("rspeaker");
+ config.device_remove("speaker");
m_cmptimer_1->zint_callback().set_nop();
cpu_device &commcpu(Z80(config, "commcpu", 8'000'000)); // clock unknown
diff --git a/src/mame/sega/segaybd.cpp b/src/mame/sega/segaybd.cpp
index 1325d5e72a0..30d5fb419e6 100644
--- a/src/mame/sega/segaybd.cpp
+++ b/src/mame/sega/segaybd.cpp
@@ -1487,20 +1487,19 @@ void segaybd_state::yboard(machine_config &config)
PALETTE(config, m_palette).set_entries(8192*2);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, "soundlatch").data_pending_callback().set_inputline(m_soundcpu, INPUT_LINE_NMI);
ym2151_device &ymsnd(YM2151(config, "ymsnd", SOUND_CLOCK/8));
ymsnd.irq_handler().set_inputline(m_soundcpu, 0);
- ymsnd.add_route(0, "lspeaker", 0.43);
- ymsnd.add_route(1, "rspeaker", 0.43);
+ ymsnd.add_route(0, "speaker", 0.43, 0);
+ ymsnd.add_route(1, "speaker", 0.43, 1);
segapcm_device &pcm(SEGAPCM(config, "pcm", SOUND_CLOCK/8));
pcm.set_bank(segapcm_device::BANK_12M | segapcm_device::BANK_MASKF8);
- pcm.add_route(0, "lspeaker", 1.0);
- pcm.add_route(1, "rspeaker", 1.0);
+ pcm.add_route(0, "speaker", 1.0, 0);
+ pcm.add_route(1, "speaker", 1.0, 1);
}
diff --git a/src/mame/sega/sms.cpp b/src/mame/sega/sms.cpp
index 83efcc78d90..e4de133d9d6 100644
--- a/src/mame/sega/sms.cpp
+++ b/src/mame/sega/sms.cpp
@@ -975,8 +975,7 @@ void gamegear_state::gamegear(machine_config &config)
m_main_scr->set_screen_update(FUNC(gamegear_state::screen_update_gamegear));
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
/* VDP chip of the Gamegear 2 ASIC version */
SEGA315_5377(config, m_vdp, MASTER_CLOCK_GG/3);
@@ -984,8 +983,8 @@ void gamegear_state::gamegear(machine_config &config)
m_vdp->set_is_pal(false);
m_vdp->n_int().set_inputline(m_maincpu, 0);
m_vdp->vblank().set(FUNC(gamegear_state::gg_pause_callback));
- m_vdp->add_route(0, "lspeaker", 1.00);
- m_vdp->add_route(1, "rspeaker", 1.00);
+ m_vdp->add_route(0, "speaker", 1.00, 0);
+ m_vdp->add_route(1, "speaker", 1.00, 1);
/* cartridge */
GAMEGEAR_CART_SLOT(config, "slot", gg_cart, nullptr).set_must_be_loaded(true);
diff --git a/src/mame/sega/stv.cpp b/src/mame/sega/stv.cpp
index 63848660521..d884c03d418 100644
--- a/src/mame/sega/stv.cpp
+++ b/src/mame/sega/stv.cpp
@@ -1160,15 +1160,14 @@ void stv_state::stv(machine_config &config)
MCFG_VIDEO_START_OVERRIDE(stv_state,stv_vdp2)
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
SCSP(config, m_scsp, 22579200); // TODO : Unknown clock, divider
m_scsp->set_addrmap(0, &stv_state::scsp_mem);
m_scsp->irq_cb().set(FUNC(saturn_state::scsp_irq));
m_scsp->main_irq_cb().set(m_scu, FUNC(sega_scu_device::sound_req_w));
- m_scsp->add_route(0, "lspeaker", 1.0);
- m_scsp->add_route(1, "rspeaker", 1.0);
+ m_scsp->add_route(0, "speaker", 1.0, 0);
+ m_scsp->add_route(1, "speaker", 1.0, 1);
SEGA_BILLBOARD(config, m_billboard, 0);
@@ -1253,8 +1252,8 @@ void stv_state::batmanfr(machine_config &config)
stv(config);
ACCLAIM_RAX(config, m_rax, 0);
// TODO: RAX output connected to SCSP?
- m_rax->add_route(0, "lspeaker", 1.0);
- m_rax->add_route(1, "rspeaker", 1.0);
+ m_rax->add_route(0, "speaker", 1.0, 0);
+ m_rax->add_route(1, "speaker", 1.0, 1);
}
void stv_state::shienryu(machine_config &config)
diff --git a/src/mame/sega/stvcd.cpp b/src/mame/sega/stvcd.cpp
index ff6f8e0d9b6..ad6dc32e767 100644
--- a/src/mame/sega/stvcd.cpp
+++ b/src/mame/sega/stvcd.cpp
@@ -101,7 +101,7 @@ DEFINE_DEVICE_TYPE(STVCD, stvcd_device, "stvcd", "Sega Saturn/ST-V CD Block HLE"
stvcd_device::stvcd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, STVCD, tag, owner, clock)
- , device_mixer_interface(mconfig, *this, 2)
+ , device_mixer_interface(mconfig, *this)
, device_memory_interface(mconfig, *this)
, m_space_config("regs", ENDIANNESS_LITTLE, 32, 20, 0, address_map_constructor(FUNC(stvcd_device::io_regs), this))
, m_cdrom_image(*this, "cdrom")
@@ -120,8 +120,8 @@ void stvcd_device::device_add_mconfig(machine_config &config)
TIMER(config, m_sh1_timer).configure_generic(FUNC(stvcd_device::stv_sh1_sim));
CDDA(config, m_cdda);
- m_cdda->add_route(0, *this, 1.0, AUTO_ALLOC_INPUT, 0);
- m_cdda->add_route(1, *this, 1.0, AUTO_ALLOC_INPUT, 1);
+ m_cdda->add_route(0, *this, 1.0, 0);
+ m_cdda->add_route(1, *this, 1.0, 1);
m_cdda->set_cdrom_tag("cdrom");
}
diff --git a/src/mame/sega/system16.cpp b/src/mame/sega/system16.cpp
index ea22399b411..7c93915bc78 100644
--- a/src/mame/sega/system16.cpp
+++ b/src/mame/sega/system16.cpp
@@ -2078,10 +2078,9 @@ void segas1x_bootleg_state::z80_ym2151(machine_config &config)
m_soundcpu->set_addrmap(AS_IO, &segas1x_bootleg_state::sound_io_map);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- YM2151(config, "ymsnd", 4000000).add_route(0, "lspeaker", 0.32).add_route(1, "rspeaker", 0.32);
+ YM2151(config, "ymsnd", 4000000).add_route(0, "speaker", 0.32, 0).add_route(1, "speaker", 0.32, 1);
}
void segas1x_bootleg_state::sound_cause_nmi(int state)
@@ -2097,15 +2096,14 @@ void segas1x_bootleg_state::z80_ym2151_upd7759(machine_config &config)
m_soundcpu->set_addrmap(AS_IO, &segas1x_bootleg_state::sound_7759_io_map);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- YM2151(config, "ymsnd", 4000000).add_route(0, "lspeaker", 0.32).add_route(1, "rspeaker", 0.32);
+ YM2151(config, "ymsnd", 4000000).add_route(0, "speaker", 0.32, 0).add_route(1, "speaker", 0.32, 1);
UPD7759(config, m_upd7759);
m_upd7759->drq().set(FUNC(segas1x_bootleg_state::sound_cause_nmi));
- m_upd7759->add_route(ALL_OUTPUTS, "lspeaker", 0.48);
- m_upd7759->add_route(ALL_OUTPUTS, "rspeaker", 0.48);
+ m_upd7759->add_route(ALL_OUTPUTS, "speaker", 0.48, 0);
+ m_upd7759->add_route(ALL_OUTPUTS, "speaker", 0.48, 1);
}
void segas1x_bootleg_state::datsu_ym2151_msm5205(machine_config &config)
@@ -2119,16 +2117,15 @@ void segas1x_bootleg_state::datsu_ym2151_msm5205(machine_config &config)
m_soundcpu->set_addrmap(AS_PROGRAM, &segas1x_bootleg_state::tturfbl_sound_map);
m_soundcpu->set_addrmap(AS_IO, &segas1x_bootleg_state::tturfbl_sound_io_map);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- YM2151(config, "ymsnd", 4000000).add_route(0, "lspeaker", 0.32).add_route(1, "rspeaker", 0.32);
+ YM2151(config, "ymsnd", 4000000).add_route(0, "speaker", 0.32, 0).add_route(1, "speaker", 0.32, 1);
MSM5205(config, m_msm, 220000);
m_msm->vck_legacy_callback().set(FUNC(segas1x_bootleg_state::tturfbl_msm5205_callback));
m_msm->set_prescaler_selector(msm5205_device::S48_4B);
- m_msm->add_route(ALL_OUTPUTS, "lspeaker", 0.80);
- m_msm->add_route(ALL_OUTPUTS, "rspeaker", 0.80);
+ m_msm->add_route(ALL_OUTPUTS, "speaker", 0.80, 0);
+ m_msm->add_route(ALL_OUTPUTS, "speaker", 0.80, 1);
}
void segas1x_bootleg_state::datsu_2x_ym2203_msm5205(machine_config &config)
@@ -2458,22 +2455,21 @@ void segas1x_bootleg_state::system18(machine_config &config)
m_sprites->set_local_originx(64);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
ym3438_device &ym3438_0(YM3438(config, "3438.0", 8000000));
- ym3438_0.add_route(0, "lspeaker", 0.40);
- ym3438_0.add_route(1, "rspeaker", 0.40);
+ ym3438_0.add_route(0, "speaker", 0.40, 0);
+ ym3438_0.add_route(1, "speaker", 0.40, 1);
ym3438_device &ym3438_1(YM3438(config, "3438.1", 8000000));
- ym3438_1.add_route(0, "lspeaker", 0.40);
- ym3438_1.add_route(1, "rspeaker", 0.40);
+ ym3438_1.add_route(0, "speaker", 0.40, 0);
+ ym3438_1.add_route(1, "speaker", 0.40, 1);
rf5c68_device &rf5c68(RF5C68(config, "5c68", 8000000));
- rf5c68.add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- rf5c68.add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ rf5c68.add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ rf5c68.add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
rf5c68.set_addrmap(0, &segas1x_bootleg_state::pcm_map);
}
@@ -2530,8 +2526,8 @@ void segas1x_bootleg_state::shdancbl(machine_config &config)
MSM5205(config, m_msm, 200000);
m_msm->vck_legacy_callback().set(FUNC(segas1x_bootleg_state::shdancbl_msm5205_callback));
m_msm->set_prescaler_selector(msm5205_device::S48_4B);
- m_msm->add_route(ALL_OUTPUTS, "lspeaker", 0.80);
- m_msm->add_route(ALL_OUTPUTS, "rspeaker", 0.80);
+ m_msm->add_route(ALL_OUTPUTS, "speaker", 0.80, 0);
+ m_msm->add_route(ALL_OUTPUTS, "speaker", 0.80, 1);
}
void segas1x_bootleg_state::shdancbla(machine_config &config)
@@ -2549,8 +2545,8 @@ void segas1x_bootleg_state::shdancbla(machine_config &config)
MSM5205(config, m_msm, 200000);
m_msm->vck_legacy_callback().set(FUNC(segas1x_bootleg_state::shdancbl_msm5205_callback));
m_msm->set_prescaler_selector(msm5205_device::S48_4B);
- m_msm->add_route(ALL_OUTPUTS, "lspeaker", 0.80);
- m_msm->add_route(ALL_OUTPUTS, "rspeaker", 0.80);
+ m_msm->add_route(ALL_OUTPUTS, "speaker", 0.80, 0);
+ m_msm->add_route(ALL_OUTPUTS, "speaker", 0.80, 1);
}
diff --git a/src/mame/sega/turbo_a.cpp b/src/mame/sega/turbo_a.cpp
index db99ba87673..f49e176958c 100644
--- a/src/mame/sega/turbo_a.cpp
+++ b/src/mame/sega/turbo_a.cpp
@@ -193,49 +193,46 @@ static const char *const turbo_sample_names[] =
void turbo_state::turbo_samples(machine_config &config)
{
// this is the cockpit speaker configuration
- SPEAKER(config, "fspeaker", 0.0, 0.0, 1.0); // front
- SPEAKER(config, "bspeaker", 0.0, 0.0, -0.5); // back
- SPEAKER(config, "lspeaker", -0.2, 0.0, 1.0); // left
- SPEAKER(config, "rspeaker", 0.2, 0.0, 1.0); // right
+ SPEAKER(config, "speaker", 4).front().front_center(2).rear_center(3);
SAMPLES(config, m_samples);
m_samples->set_channels(10);
m_samples->set_samples_names(turbo_sample_names);
// channel 0 = CRASH.S -> CRASH.S/SM
- m_samples->add_route(0, "fspeaker", 0.25);
+ m_samples->add_route(0, "speaker", 0.25, 2);
// channel 1 = TRIG1-4 -> ALARM.M/F/R/L
- m_samples->add_route(1, "fspeaker", 0.25);
- m_samples->add_route(1, "rspeaker", 0.25);
- m_samples->add_route(1, "lspeaker", 0.25);
+ m_samples->add_route(1, "speaker", 0.25, 2);
+ m_samples->add_route(1, "speaker", 0.25, 1);
+ m_samples->add_route(1, "speaker", 0.25, 0);
// channel 2 = SLIP/SPIN -> SKID.F/R/L/M
- m_samples->add_route(2, "fspeaker", 0.25);
- m_samples->add_route(2, "rspeaker", 0.25);
- m_samples->add_route(2, "lspeaker", 0.25);
+ m_samples->add_route(2, "speaker", 0.25, 2);
+ m_samples->add_route(2, "speaker", 0.25, 1);
+ m_samples->add_route(2, "speaker", 0.25, 0);
// channel 3 = CRASH.L -> CRASH.L/LM
- m_samples->add_route(3, "bspeaker", 0.25);
+ m_samples->add_route(3, "speaker", 0.25, 3);
// channel 4 = AMBU -> AMBULANCE/AMBULANCE.M
- m_samples->add_route(4, "fspeaker", 0.25);
+ m_samples->add_route(4, "speaker", 0.25, 2);
// channel 5 = ACCEL+BSEL -> MYCAR.F/W/M + MYCAR0.F/M + MYCAR1.F/M
- m_samples->add_route(5, "fspeaker", 0.25);
- m_samples->add_route(5, "bspeaker", 0.25);
+ m_samples->add_route(5, "speaker", 0.25, 2);
+ m_samples->add_route(5, "speaker", 0.25, 3);
// channel 6 = OSEL -> OCAR.F/FM
- m_samples->add_route(6, "fspeaker", 0.25);
+ m_samples->add_route(6, "speaker", 0.25, 2);
// channel 7 = OSEL -> OCAR.L/LM
- m_samples->add_route(7, "lspeaker", 0.25);
+ m_samples->add_route(7, "speaker", 0.25, 0);
// channel 8 = OSEL -> OCAR.R/RM
- m_samples->add_route(8, "rspeaker", 0.25);
+ m_samples->add_route(8, "speaker", 0.25, 1);
// channel 9 = OSEL -> OCAR.W/WM
- m_samples->add_route(9, "bspeaker", 0.25);
+ m_samples->add_route(9, "speaker", 0.25, 3);
}
/*
@@ -438,44 +435,43 @@ static const char *const subroc3d_sample_names[] =
void subroc3d_state::subroc3d_samples(machine_config &config)
{
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
SAMPLES(config, m_samples);
m_samples->set_channels(12);
m_samples->set_samples_names(subroc3d_sample_names);
// MISSILE in channels 0 and 1
- m_samples->add_route(0, "lspeaker", 0.25);
- m_samples->add_route(1, "rspeaker", 0.25);
+ m_samples->add_route(0, "speaker", 0.25, 0);
+ m_samples->add_route(1, "speaker", 0.25, 1);
// TORPEDO in channels 2 and 3
- m_samples->add_route(2, "lspeaker", 0.25);
- m_samples->add_route(3, "rspeaker", 0.25);
+ m_samples->add_route(2, "speaker", 0.25, 0);
+ m_samples->add_route(3, "speaker", 0.25, 1);
// FIGHTER in channels 4 and 5
- m_samples->add_route(4, "lspeaker", 0.25);
- m_samples->add_route(5, "rspeaker", 0.25);
+ m_samples->add_route(4, "speaker", 0.25, 0);
+ m_samples->add_route(5, "speaker", 0.25, 1);
// HIT in channels 6 and 7
- m_samples->add_route(6, "lspeaker", 0.25);
- m_samples->add_route(7, "rspeaker", 0.25);
+ m_samples->add_route(6, "speaker", 0.25, 0);
+ m_samples->add_route(7, "speaker", 0.25, 1);
// FIRE sound in channel 8
- m_samples->add_route(8, "lspeaker", 0.25);
- m_samples->add_route(8, "rspeaker", 0.25);
+ m_samples->add_route(8, "speaker", 0.25, 0);
+ m_samples->add_route(8, "speaker", 0.25, 1);
// SHIP EXP sound in channel 9
- m_samples->add_route(9, "lspeaker", 0.25);
- m_samples->add_route(9, "rspeaker", 0.25);
+ m_samples->add_route(9, "speaker", 0.25, 0);
+ m_samples->add_route(9, "speaker", 0.25, 1);
// ALARM TRIG sound in channel 10
- m_samples->add_route(10, "lspeaker", 0.25);
- m_samples->add_route(10, "rspeaker", 0.25);
+ m_samples->add_route(10, "speaker", 0.25, 0);
+ m_samples->add_route(10, "speaker", 0.25, 1);
// PROLOGUE sound in channel 11
- m_samples->add_route(11, "lspeaker", 0.25);
- m_samples->add_route(11, "rspeaker", 0.25);
+ m_samples->add_route(11, "speaker", 0.25, 0);
+ m_samples->add_route(11, "speaker", 0.25, 1);
}
diff --git a/src/mame/sega/winclub.cpp b/src/mame/sega/winclub.cpp
index 6d94800e7da..a198bdb938e 100644
--- a/src/mame/sega/winclub.cpp
+++ b/src/mame/sega/winclub.cpp
@@ -101,12 +101,11 @@ void winclub_state::winclub(machine_config &config)
screen.set_screen_update(FUNC(winclub_state::screen_update));
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ymz770_device &ymz770(YMZ770(config, "ymz", 16'384'000)); // internal clock?
- ymz770.add_route(0, "lspeaker", 1.0);
- ymz770.add_route(1, "rspeaker", 1.0);
+ ymz770.add_route(0, "speaker", 1.0, 0);
+ ymz770.add_route(1, "speaker", 1.0, 1);
}
diff --git a/src/mame/seibu/seibucats.cpp b/src/mame/seibu/seibucats.cpp
index 89ef9b6bce1..8e18612f46a 100644
--- a/src/mame/seibu/seibucats.cpp
+++ b/src/mame/seibu/seibucats.cpp
@@ -337,12 +337,11 @@ void seibucats_state::seibucats(machine_config &config)
PALETTE(config, m_palette, palette_device::BLACK, 8192);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ymz280b_device &ymz(YMZ280B(config, "ymz", XTAL(16'384'000)));
- ymz.add_route(0, "lspeaker", 1.0);
- ymz.add_route(1, "rspeaker", 1.0);
+ ymz.add_route(0, "speaker", 1.0, 0);
+ ymz.add_route(1, "speaker", 1.0, 1);
}
diff --git a/src/mame/seibu/seibuspi.cpp b/src/mame/seibu/seibuspi.cpp
index 1108752b18c..2bb6907a258 100644
--- a/src/mame/seibu/seibuspi.cpp
+++ b/src/mame/seibu/seibuspi.cpp
@@ -1793,17 +1793,16 @@ void seibuspi_state::spi(machine_config &config)
crtc.layer_scroll_callback().set(FUNC(seibuspi_state::scroll_w));
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ymf271_device &ymf(YMF271(config, "ymf", 16.9344_MHz_XTAL));
ymf.irq_handler().set(FUNC(seibuspi_state::ymf_irqhandler));
ymf.set_addrmap(0, &seibuspi_state::spi_ymf271_map);
- ymf.add_route(0, "lspeaker", 1.0);
- ymf.add_route(1, "rspeaker", 1.0);
-// ymf.add_route(2, "lspeaker", 1.0); Output 2/3 not used?
-// ymf.add_route(3, "rspeaker", 1.0);
+ ymf.add_route(0, "speaker", 1.0, 0);
+ ymf.add_route(1, "speaker", 1.0, 1);
+// ymf.add_route(2, "speaker", 1.0); Output 2/3 not used?
+// ymf.add_route(3, "speaker", 1.0);
}
void seibuspi_state::ejanhs(machine_config &config)
@@ -1848,8 +1847,7 @@ void seibuspi_state::sxx2e(machine_config &config)
/* sound hardware */
// Single PCBs only output mono sound, SXX2E : unverified
- config.device_remove("lspeaker");
- config.device_remove("rspeaker");
+ config.device_remove("speaker");
SPEAKER(config, "mono").front_center();
ymf271_device &ymf(YMF271(config.replace(), "ymf", 16.9344_MHz_XTAL));
diff --git a/src/mame/seta/champbwl.cpp b/src/mame/seta/champbwl.cpp
index dae7b4def64..269bcb680f1 100644
--- a/src/mame/seta/champbwl.cpp
+++ b/src/mame/seta/champbwl.cpp
@@ -571,12 +571,11 @@ void champbwl_state::champbwl(machine_config &config)
PALETTE(config, "palette", FUNC(champbwl_state::palette), 512);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
x1_010_device &x1snd(X1_010(config, "x1snd", 16_MHz_XTAL));
- x1snd.add_route(0, "lspeaker", 1.0);
- x1snd.add_route(1, "rspeaker", 1.0);
+ x1snd.add_route(0, "speaker", 1.0, 0);
+ x1snd.add_route(1, "speaker", 1.0, 1);
}
diff --git a/src/mame/seta/jclub2.cpp b/src/mame/seta/jclub2.cpp
index db8a6cbdacd..9eee5dccd0a 100644
--- a/src/mame/seta/jclub2.cpp
+++ b/src/mame/seta/jclub2.cpp
@@ -1190,11 +1190,10 @@ void jclub2o_state::jclub2o(machine_config &config)
config.set_default_layout(layout_jclub2o);
// TODO: Mono?
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- m_soundcpu->add_route(0, "lspeaker", 1.0);
- m_soundcpu->add_route(1, "rspeaker", 1.0);
+ m_soundcpu->add_route(0, "speaker", 1.0, 0);
+ m_soundcpu->add_route(1, "speaker", 1.0, 1);
}
@@ -1234,12 +1233,11 @@ void jclub2_state::jclub2(machine_config &config)
// sound hardware
// TODO: Mono?
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
st0032_sound_device &st0032_snd(ST0032_SOUND(config, "st0032_snd", XTAL(42'954'545) / 3)); // 14.318181MHz (42.954545MHz / 3)
- st0032_snd.add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- st0032_snd.add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ st0032_snd.add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ st0032_snd.add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
}
diff --git a/src/mame/seta/kiwame.cpp b/src/mame/seta/kiwame.cpp
index 4d4991c70b9..3ed0a808317 100644
--- a/src/mame/seta/kiwame.cpp
+++ b/src/mame/seta/kiwame.cpp
@@ -292,12 +292,11 @@ void kiwame_state::kiwame(machine_config &config)
PALETTE(config, "palette").set_format(palette_device::xRGB_555, 512); // sprites only
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
x1_010_device &x1snd(X1_010(config, "x1snd", 16000000));
- x1snd.add_route(0, "lspeaker", 1.0);
- x1snd.add_route(1, "rspeaker", 1.0);
+ x1snd.add_route(0, "speaker", 1.0, 0);
+ x1snd.add_route(1, "speaker", 1.0, 1);
}
diff --git a/src/mame/seta/namcoeva.cpp b/src/mame/seta/namcoeva.cpp
index 86aedea0aff..226784c7021 100644
--- a/src/mame/seta/namcoeva.cpp
+++ b/src/mame/seta/namcoeva.cpp
@@ -409,14 +409,13 @@ void namcoeva_state::hammerch(machine_config &config)
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x8000+0xf0); // extra 0xf0 because we might draw 256-color object with 16-color granularity
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
c352_device &c352(C352(config, "c352", 50_MHz_XTAL / 2, 288)); // TODO: clock and divider not verified
- c352.add_route(0, "lspeaker", 1.00);
- c352.add_route(1, "rspeaker", 1.00);
- c352.add_route(2, "lspeaker", 1.00);
- c352.add_route(3, "rspeaker", 1.00);
+ c352.add_route(0, "speaker", 1.00, 0);
+ c352.add_route(1, "speaker", 1.00, 1);
+ c352.add_route(2, "speaker", 1.00, 0);
+ c352.add_route(3, "speaker", 1.00, 1);
}
diff --git a/src/mame/seta/seta.cpp b/src/mame/seta/seta.cpp
index 1764747ef23..1ed94028d5f 100644
--- a/src/mame/seta/seta.cpp
+++ b/src/mame/seta/seta.cpp
@@ -7827,12 +7827,11 @@ void setaroul_state::setaroul(machine_config &config)
PALETTE(config, m_palette, FUNC(setaroul_state::setaroul_palette), 512);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
X1_010(config, m_x1snd, 16_MHz_XTAL); // 16 MHz
- m_x1snd->add_route(0, "lspeaker", 1.0);
- m_x1snd->add_route(1, "rspeaker", 1.0);
+ m_x1snd->add_route(0, "speaker", 1.0, 0);
+ m_x1snd->add_route(1, "speaker", 1.0, 1);
// layout
config.set_default_layout(layout_setaroul);
@@ -7931,12 +7930,11 @@ void seta_state::extdwnhl(machine_config &config)
PALETTE(config, m_palette, FUNC(seta_state::zingzip_palette), 16*32 + 16*32 + 64*32*2, 0x600); // sprites, layer2, layer1 - layer 1 gfx is 6 planes deep
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
X1_010(config, m_x1snd, 16000000); // 16 MHz
- m_x1snd->add_route(0, "lspeaker", 1.0);
- m_x1snd->add_route(1, "rspeaker", 1.0);
+ m_x1snd->add_route(0, "speaker", 1.0, 0);
+ m_x1snd->add_route(1, "speaker", 1.0, 1);
}
@@ -8186,12 +8184,11 @@ void seta_state::orbs(machine_config &config)
PALETTE(config, m_palette).set_entries(512); // sprites only
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
X1_010(config, m_x1snd, 14.318181_MHz_XTAL); // 14.318180 MHz
- m_x1snd->add_route(0, "lspeaker", 1.0);
- m_x1snd->add_route(1, "rspeaker", 1.0);
+ m_x1snd->add_route(0, "speaker", 1.0, 0);
+ m_x1snd->add_route(1, "speaker", 1.0, 1);
}
@@ -8225,12 +8222,11 @@ void keroppi_state::keroppi(machine_config &config)
PALETTE(config, m_palette).set_entries(512); // sprites only
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
X1_010(config, m_x1snd, 14318180); // 14.318180 MHz
- m_x1snd->add_route(0, "lspeaker", 1.0);
- m_x1snd->add_route(1, "rspeaker", 1.0);
+ m_x1snd->add_route(0, "speaker", 1.0, 0);
+ m_x1snd->add_route(1, "speaker", 1.0, 1);
}
@@ -8510,12 +8506,11 @@ void seta_state::oisipuzl(machine_config &config)
set_tilemaps_flip(1); // flip is inverted for the tilemaps
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
X1_010(config, m_x1snd, 16000000); // 16 MHz
- m_x1snd->add_route(0, "lspeaker", 1.0);
- m_x1snd->add_route(1, "rspeaker", 1.0);
+ m_x1snd->add_route(0, "speaker", 1.0, 0);
+ m_x1snd->add_route(1, "speaker", 1.0, 1);
}
@@ -8557,12 +8552,11 @@ void seta_state::triplfun(machine_config &config)
set_tilemaps_flip(1); // flip is inverted for the tilemaps
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
okim6295_device &oki(OKIM6295(config, "oki", 792000, okim6295_device::PIN7_HIGH)); // clock frequency & pin 7 not verified
- oki.add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- oki.add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
}
@@ -9126,12 +9120,11 @@ void jockeyc_state::jockeyc(machine_config &config)
PALETTE(config, m_palette, FUNC(seta_state::palette_init_RRRRRGGGGGBBBBB_proms), 512 * 1);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
X1_010(config, m_x1snd, 16000000);
- m_x1snd->add_route(0, "lspeaker", 1.0);
- m_x1snd->add_route(1, "rspeaker", 1.0);
+ m_x1snd->add_route(0, "speaker", 1.0, 0);
+ m_x1snd->add_route(1, "speaker", 1.0, 1);
// layout
config.set_default_layout(layout_jockeyc);
diff --git a/src/mame/seta/seta2.cpp b/src/mame/seta/seta2.cpp
index 66e5873b89c..4c95669bada 100644
--- a/src/mame/seta/seta2.cpp
+++ b/src/mame/seta/seta2.cpp
@@ -2498,12 +2498,11 @@ void funcube_state::funcube(machine_config &config)
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x8000+0xf0); // extra 0xf0 because we might draw 256-color object with 16-color granularity
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
OKIM9810(config, m_oki, XTAL(4'096'000));
- m_oki->add_route(0, "lspeaker", 0.80);
- m_oki->add_route(1, "rspeaker", 0.80);
+ m_oki->add_route(0, "speaker", 0.80, 0);
+ m_oki->add_route(1, "speaker", 0.80, 1);
}
@@ -2542,12 +2541,11 @@ void seta2_state::namcostr(machine_config &config)
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x8000+0xf0); // extra 0xf0 because we might draw 256-color object with 16-color granularity
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
OKIM9810(config, m_oki, XTAL(4'096'000));
- m_oki->add_route(0, "lspeaker", 0.80);
- m_oki->add_route(1, "rspeaker", 0.80);
+ m_oki->add_route(0, "speaker", 0.80, 0);
+ m_oki->add_route(1, "speaker", 0.80, 1);
}
diff --git a/src/mame/seta/simple_st0016.cpp b/src/mame/seta/simple_st0016.cpp
index d0a1d8e5d6f..51d0fbc901c 100644
--- a/src/mame/seta/simple_st0016.cpp
+++ b/src/mame/seta/simple_st0016.cpp
@@ -14,6 +14,7 @@
Todo:
- find NMI source, and NMI enable/disable (timer ? video hw ?)
+- test modes for crownpkr and dcrown show flip support problems
Dips verified for Neratte Chu (nratechu) from manual
*/
@@ -51,6 +52,7 @@ public:
void mayjinsn(machine_config &config) ATTR_COLD;
void init_crownpkr() ATTR_COLD;
+ void init_dcrown() ATTR_COLD;
void init_nratechu() ATTR_COLD;
void init_mayjinsn() ATTR_COLD;
void init_mayjisn2() ATTR_COLD;
@@ -445,6 +447,36 @@ static INPUT_PORTS_START( crownpkr )
PORT_SERVICE( 0x08, IP_ACTIVE_LOW ) // only works if pressed during boot
INPUT_PORTS_END
+static INPUT_PORTS_START( dcrown )
+ PORT_INCLUDE( st0016 )
+
+ PORT_MODIFY("P1")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT )
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no effect in test mode
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SLOT_STOP1 ) PORT_NAME("Stop Reel 1 / Double Up")
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SLOT_STOP3 ) PORT_NAME("Stop Reel 3 / Bet on Black" )
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no effect in test mode
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no effect in test mode
+ PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_OTHER ) // TODO: hopper
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_GAMBLE_TAKE )
+
+ PORT_MODIFY("P2")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_BET )
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 )
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SLOT_STOP2 ) PORT_NAME("Stop Reel 2 / Bet on Red / Show Paytable" )
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no effect in test mode
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no effect in test mode
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no effect in test mode
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME( "Modern Equipment" ) // TODO: what's this? machine translation doesn't seem correct
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no effect in test mode
+
+ PORT_MODIFY("SYSTEM")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(10) // TODO: simulate coin drop sensor
+ PORT_SERVICE( 0x08, IP_ACTIVE_LOW )
+INPUT_PORTS_END
+
static INPUT_PORTS_START( mayjisn2 )
PORT_INCLUDE( st0016 )
@@ -578,11 +610,10 @@ void st0016_state::st0016(machine_config &config)
m_screen->set_palette("maincpu:palette");
// TODO: Mono?
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- m_maincpu->add_route(0, "lspeaker", 1.0);
- m_maincpu->add_route(1, "rspeaker", 1.0);
+ m_maincpu->add_route(0, "speaker", 1.0, 0);
+ m_maincpu->add_route(1, "speaker", 1.0, 1);
}
void st0016_state::mayjinsn(machine_config &config)
@@ -825,6 +856,11 @@ void st0016_state::init_crownpkr()
m_maincpu->set_game_flag(2);
}
+void st0016_state::init_dcrown()
+{
+ m_maincpu->set_game_flag(3);
+}
+
void st0016_state::init_mayjinsn()
{
m_maincpu->set_game_flag(4 /*| 0x80*/);
@@ -853,5 +889,5 @@ GAME( 2001, gostop, 0, st0016, gostop, st0016_state, init_renju,
// Not working
GAME( 1994, mayjinsn, 0, mayjinsn, st0016, st0016_state, init_mayjinsn, ROT0, "Seta", "Mayjinsen", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING | MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
GAME( 1997, crownpkr, 0, st0016, crownpkr, st0016_state, init_crownpkr, ROT0, "<unknown>", "Crown Poker (ver. 1.20)", MACHINE_NOT_WORKING | MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) // coining in doesn't work
-GAME( 1994, dcrown, 0, st0016, crownpkr, st0016_state, init_crownpkr, ROT0, "Nippon Data Kiki", "Dream Crown (set 1)", MACHINE_NOT_WORKING | MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) // (c) 1994 Nippon Data Kiki is uploaded near the Japanese Insert coin text
-GAME( 1994, dcrowna, dcrown, st0016, crownpkr, st0016_state, init_crownpkr, ROT0, "Nippon Data Kiki", "Dream Crown (set 2)", MACHINE_NOT_WORKING | MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) // the Insert Coin text has been translated to English and no (c) is uploaded
+GAME( 1994, dcrown, 0, st0016, dcrown, st0016_state, init_dcrown, ROT0, "Nippon Data Kiki", "Dream Crown (set 1)", MACHINE_NOT_WORKING | MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) // (c) 1994 Nippon Data Kiki is uploaded near the Japanese Insert coin text
+GAME( 1994, dcrowna, dcrown, st0016, dcrown, st0016_state, init_dcrown, ROT0, "Nippon Data Kiki", "Dream Crown (set 2)", MACHINE_NOT_WORKING | MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) // the Insert Coin text has been translated to English and no (c) is uploaded
diff --git a/src/mame/seta/speglsht.cpp b/src/mame/seta/speglsht.cpp
index d967f023ed7..7a924e0dae0 100644
--- a/src/mame/seta/speglsht.cpp
+++ b/src/mame/seta/speglsht.cpp
@@ -444,11 +444,10 @@ void speglsht_state::speglsht(machine_config &config)
screen.set_screen_update(FUNC(speglsht_state::screen_update));
// TODO: Mono?
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- m_maincpu->add_route(0, "lspeaker", 1.0);
- m_maincpu->add_route(1, "rspeaker", 1.0);
+ m_maincpu->add_route(0, "speaker", 1.0, 0);
+ m_maincpu->add_route(1, "speaker", 1.0, 1);
}
ROM_START( speglsht )
diff --git a/src/mame/seta/srmp5.cpp b/src/mame/seta/srmp5.cpp
index 2e78563f45c..aca1fffb654 100644
--- a/src/mame/seta/srmp5.cpp
+++ b/src/mame/seta/srmp5.cpp
@@ -599,11 +599,10 @@ void srmp5_state::srmp5(machine_config &config)
#endif
// TODO: Mono?
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- m_soundcpu->add_route(0, "lspeaker", 1.0);
- m_soundcpu->add_route(1, "rspeaker", 1.0);
+ m_soundcpu->add_route(0, "speaker", 1.0, 0);
+ m_soundcpu->add_route(1, "speaker", 1.0, 1);
}
diff --git a/src/mame/seta/srmp6.cpp b/src/mame/seta/srmp6.cpp
index b7e2b1bcea4..bc976023a83 100644
--- a/src/mame/seta/srmp6.cpp
+++ b/src/mame/seta/srmp6.cpp
@@ -703,13 +703,12 @@ void srmp6_state::srmp6(machine_config &config)
BUFFERED_SPRITERAM16(config, m_sprram);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
// matches video, needs to verified; playback rate: (42.9545Mhz / 7) / 160 or (42.9545Mhz / 5) / 224 or (42.9545Mhz / 4) / 280?
nile_sound_device &nile(NILE_SOUND(config, "nile", XTAL(42'954'545) / 7));
- nile.add_route(0, "lspeaker", 1.0);
- nile.add_route(1, "rspeaker", 1.0);
+ nile.add_route(0, "speaker", 1.0, 0);
+ nile.add_route(1, "speaker", 1.0, 1);
}
diff --git a/src/mame/seta/ssv.cpp b/src/mame/seta/ssv.cpp
index 995fe595a81..79526b18a8d 100644
--- a/src/mame/seta/ssv.cpp
+++ b/src/mame/seta/ssv.cpp
@@ -2445,8 +2445,7 @@ void ssv_state::ssv(machine_config &config)
PALETTE(config, m_palette).set_format(palette_device::xRGB_888, 0x8000);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ES5506(config, m_ensoniq, SSV_MASTER_CLOCK);
m_ensoniq->set_region0("ensoniq.0");
@@ -2454,8 +2453,8 @@ void ssv_state::ssv(machine_config &config)
m_ensoniq->set_region2("ensoniq.2");
m_ensoniq->set_region3("ensoniq.3");
m_ensoniq->set_channels(1);
- m_ensoniq->add_route(0, "lspeaker", 0.075);
- m_ensoniq->add_route(1, "rspeaker", 0.075);
+ m_ensoniq->add_route(0, "speaker", 0.075, 0);
+ m_ensoniq->add_route(1, "speaker", 0.075, 1);
}
void drifto94_state::drifto94(machine_config &config)
diff --git a/src/mame/seta/st0016.cpp b/src/mame/seta/st0016.cpp
index c50e5940e47..efbd80d2a32 100644
--- a/src/mame/seta/st0016.cpp
+++ b/src/mame/seta/st0016.cpp
@@ -48,7 +48,7 @@ st0016_cpu_device::st0016_cpu_device(const machine_config &mconfig, const char *
: z80_device(mconfig, ST0016_CPU, tag, owner, clock)
, device_gfx_interface(mconfig, *this, nullptr, "palette")
, device_video_interface(mconfig, *this, false)
- , device_mixer_interface(mconfig, *this, 2)
+ , device_mixer_interface(mconfig, *this)
, m_io_space_config("io", ENDIANNESS_LITTLE, 8, 16, 0, address_map_constructor(FUNC(st0016_cpu_device::cpu_internal_io_map), this))
, m_space_config("regs", ENDIANNESS_LITTLE, 8, 16, 0, address_map_constructor(FUNC(st0016_cpu_device::cpu_internal_map), this))
, m_charam_space_config("charam", ENDIANNESS_LITTLE, 8, 21, 0, address_map_constructor(FUNC(st0016_cpu_device::charam_map), this))
@@ -123,6 +123,12 @@ void st0016_cpu_device::device_reset()
break;
case 2: // Crown Poker
+ screen().set_visible_area(8,42*8-1,0,29*8-1);
+ m_spr_dx = 4;
+ m_spr_dy = 4;
+ break;
+
+ case 3: // Dream Crown
screen().set_visible_area(8,42*8-1,0,30*8-1);
m_spr_dx = 4;
break;
@@ -150,8 +156,8 @@ void st0016_cpu_device::device_add_mconfig(machine_config &config)
st0016_device &stsnd(ST0016(config, "stsnd", DERIVED_CLOCK(1,1)));
stsnd.set_addrmap(0, &st0016_cpu_device::charam_map);
- stsnd.add_route(0, *this, 1.0, AUTO_ALLOC_INPUT, 0);
- stsnd.add_route(1, *this, 1.0, AUTO_ALLOC_INPUT, 1);
+ stsnd.add_route(0, *this, 1.0, 0);
+ stsnd.add_route(1, *this, 1.0, 1);
}
@@ -664,8 +670,8 @@ void st0016_cpu_device::draw_bgmap(bitmap_ind16 &bitmap, const rectangle &clipre
code = m_spriteram[i] + 256 * m_spriteram[i + 1];
color = m_spriteram[i + 2] & 0x3f;
- flipx = m_spriteram[i + 3] & 0x80;
- flipy = m_spriteram[i + 3] & 0x40;
+ flipx = m_spriteram[i + 3] & 0x80; // crownpkr test mode doesn't seem to agree with this
+ flipy = m_spriteram[i + 3] & 0x40; // "
if (priority)
{
@@ -694,6 +700,7 @@ void st0016_cpu_device::draw_bgmap(bitmap_ind16 &bitmap, const rectangle &clipre
if (!flipy) { drawypos = ypos + yloop; }
else { drawypos = (ypos + 8 - 1) - yloop; }
destline = &bitmap.pix(drawypos);
+ // destline = &bitmap.pix(drawypos ^ 0x07); // hack for dcrown test mode
for (xloop = 0; xloop < 8; xloop++)
{
diff --git a/src/mame/sgi/hal2.cpp b/src/mame/sgi/hal2.cpp
index 7c0d25e4f52..28bd7e3f05f 100644
--- a/src/mame/sgi/hal2.cpp
+++ b/src/mame/sgi/hal2.cpp
@@ -379,12 +379,11 @@ void hal2_device::dma_write(uint32_t channel, int16_t data)
void hal2_device::device_add_mconfig(machine_config &config)
{
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_ldac, 0);
- m_ldac->add_route(ALL_OUTPUTS, "lspeaker", 0.25);
+ m_ldac->add_route(ALL_OUTPUTS, "speaker", 0.25, 0);
DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_rdac, 0);
- m_rdac->add_route(ALL_OUTPUTS, "rspeaker", 0.25);
+ m_rdac->add_route(ALL_OUTPUTS, "speaker", 0.25, 1);
}
diff --git a/src/mame/sgi/ip4.cpp b/src/mame/sgi/ip4.cpp
index 50345d578cd..b546316df3f 100644
--- a/src/mame/sgi/ip4.cpp
+++ b/src/mame/sgi/ip4.cpp
@@ -323,12 +323,11 @@ void sgi_ip4_device::device_add_mconfig(machine_config &config)
m_serial[3]->dcd_handler().set(m_duart[2], FUNC(scn2681_device::ip2_w));
// TODO: move speakers to host
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
SAA1099(config, m_saa, 8_MHz_XTAL);
- m_saa->add_route(0, "lspeaker", 0.5);
- m_saa->add_route(1, "rspeaker", 0.5);
+ m_saa->add_route(0, "speaker", 0.5, 0);
+ m_saa->add_route(1, "speaker", 0.5, 1);
// TODO: ACFAIL -> vme_irq<0>
device_vme_card_interface::vme_irq<1>().set(*this, FUNC(sgi_ip4_device::vme_irq<1>));
diff --git a/src/mame/sgi/kbd.cpp b/src/mame/sgi/kbd.cpp
index 9cd59afb8b0..d78c7c242e8 100644
--- a/src/mame/sgi/kbd.cpp
+++ b/src/mame/sgi/kbd.cpp
@@ -123,7 +123,8 @@ enum p3_mask : u8
void sgi_kbd_device::device_add_mconfig(machine_config &config)
{
- speaker_device &speaker(SPEAKER(config, "speaker").front_center());
+ speaker_device &speaker(SPEAKER(config, "speaker"));
+ speaker.front_center();
beep_device &beeper(BEEP(config, "beeper", 480));
beeper.add_route(ALL_OUTPUTS, speaker, 0.25);
diff --git a/src/mame/shared/ballysound.cpp b/src/mame/shared/ballysound.cpp
index 466c61769c2..167304b5bc2 100644
--- a/src/mame/shared/ballysound.cpp
+++ b/src/mame/shared/ballysound.cpp
@@ -125,7 +125,7 @@ TIMER_CALLBACK_MEMBER(bally_as2888_device::sound_int_sync)
void bally_as2888_device::device_add_mconfig(machine_config &config)
{
DISCRETE(config, m_discrete, as2888_discrete);
- m_discrete->add_route(ALL_OUTPUTS, *this, 1.00, AUTO_ALLOC_INPUT, 0);
+ m_discrete->add_route(ALL_OUTPUTS, *this, 1.00, 0);
TIMER(config, "timer_s_freq").configure_periodic(FUNC(bally_as2888_device::timer_s), attotime::from_hz(353000)); // Inverter clock on AS-2888 sound board
TIMER(config, m_snd_sustain_timer).configure_generic(FUNC(bally_as2888_device::timer_as2888));
@@ -270,7 +270,7 @@ void bally_as3022_device::device_add_mconfig(machine_config &config)
m_ay->add_route(1, "ay_filter1", 0.33);
m_ay->add_route(2, "ay_filter2", 0.33);
m_ay->port_a_read_callback().set(FUNC(bally_as3022_device::ay_io_r));
- m_ay->add_route(ALL_OUTPUTS, *this, 0.33, AUTO_ALLOC_INPUT, 0);
+ m_ay->add_route(ALL_OUTPUTS, *this, 0.33, 0);
}
@@ -528,7 +528,7 @@ void bally_cheap_squeak_device::device_add_mconfig(machine_config &config)
m_cpu->in_p2_cb().set(FUNC(bally_cheap_squeak_device::in_p2_cb));
m_cpu->out_p2_cb().set(FUNC(bally_cheap_squeak_device::out_p2_cb));
- ZN429E(config, "dac", 0).add_route(ALL_OUTPUTS, *this, 1.00, AUTO_ALLOC_INPUT, 0);
+ ZN429E(config, "dac", 0).add_route(ALL_OUTPUTS, *this, 1.00, 0);
}
//-------------------------------------------------
diff --git a/src/mame/shared/cage.cpp b/src/mame/shared/cage.cpp
index e87188361ee..3d7703a8b79 100644
--- a/src/mame/shared/cage.cpp
+++ b/src/mame/shared/cage.cpp
@@ -194,7 +194,7 @@ atari_cage_device::atari_cage_device(const machine_config &mconfig, const char *
atari_cage_device::atari_cage_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, type, tag, owner, clock),
- device_mixer_interface(mconfig, *this, 5), // 5 output routines in JSPKR
+ device_mixer_interface(mconfig, *this),
m_cpu(*this, "cpu"),
m_cageram(*this, "cageram"),
m_soundlatch(*this, "soundlatch"),
@@ -693,19 +693,19 @@ void atari_cage_device::device_add_mconfig(machine_config &config)
GENERIC_LATCH_16(config, m_soundlatch);
#if (DAC_BUFFER_CHANNELS == 4)
- DMADAC(config, m_dmadac[0]).add_route(ALL_OUTPUTS, *this, 0.50, AUTO_ALLOC_INPUT, 0);
+ DMADAC(config, m_dmadac[0]).add_route(ALL_OUTPUTS, *this, 0.50, 0);
- DMADAC(config, m_dmadac[1]).add_route(ALL_OUTPUTS, *this, 0.50, AUTO_ALLOC_INPUT, 1);
+ DMADAC(config, m_dmadac[1]).add_route(ALL_OUTPUTS, *this, 0.50, 1);
- DMADAC(config, m_dmadac[2]).add_route(ALL_OUTPUTS, *this, 0.50, AUTO_ALLOC_INPUT, 2);
+ DMADAC(config, m_dmadac[2]).add_route(ALL_OUTPUTS, *this, 0.50, 2);
- DMADAC(config, m_dmadac[3]).add_route(ALL_OUTPUTS, *this, 0.50, AUTO_ALLOC_INPUT, 3);
+ DMADAC(config, m_dmadac[3]).add_route(ALL_OUTPUTS, *this, 0.50, 3);
#else
- DMADAC(config, m_dmadac[0]).add_route(ALL_OUTPUTS, *this, 1.0, AUTO_ALLOC_INPUT, 0);
+ DMADAC(config, m_dmadac[0]).add_route(ALL_OUTPUTS, *this, 1.0, 0);
- DMADAC(config, m_dmadac[1]).add_route(ALL_OUTPUTS, *this, 1.0, AUTO_ALLOC_INPUT, 1);
+ DMADAC(config, m_dmadac[1]).add_route(ALL_OUTPUTS, *this, 1.0, 1);
#endif
- //add_route(ALL_OUTPUTS, *this, 0.50, AUTO_ALLOC_INPUT, 4); Subwoofer output
+ //add_route(ALL_OUTPUTS, *this, 0.50, 4); Subwoofer output
}
// Embedded in San francisco Rush Motherboard, 4 channel output connected to Quad Amp PCB and expanded to 5 channel (4 channel + subwoofer)
diff --git a/src/mame/shared/dcs.cpp b/src/mame/shared/dcs.cpp
index f206dca836a..1c5bd615716 100644
--- a/src/mame/shared/dcs.cpp
+++ b/src/mame/shared/dcs.cpp
@@ -682,9 +682,9 @@ void dcs_audio_device::denver_postload()
// dcs_audio_device - constructor
//-------------------------------------------------
-dcs_audio_device::dcs_audio_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int rev, int outputs) :
+dcs_audio_device::dcs_audio_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int rev) :
device_t(mconfig, type, tag, owner, clock),
- device_mixer_interface(mconfig, *this, outputs),
+ device_mixer_interface(mconfig, *this),
m_maincpu(*this, finder_base::DUMMY_TAG),
m_reg_timer(*this, "dcs_reg_timer"),
m_sport0_timer(*this, "dcs_sport0_timer"),
@@ -2462,7 +2462,7 @@ void dcs_audio_device::add_mconfig_dcs(machine_config &config)
TIMER(config, m_reg_timer).configure_generic(FUNC(dcs_audio_device::dcs_irq));
TIMER(config, m_internal_timer).configure_generic(FUNC(dcs_audio_device::internal_timer_callback));
- DMADAC(config, "dac").add_route(ALL_OUTPUTS, *this, 1.0, AUTO_ALLOC_INPUT, 0); // AD-1851 16bit mono
+ DMADAC(config, "dac").add_route(ALL_OUTPUTS, *this, 1.0, 0); // AD-1851 16bit mono
}
DEFINE_DEVICE_TYPE(DCS_AUDIO_2K, dcs_audio_2k_device, "dcs_audio_2k", "DCS Audio 2K")
@@ -2472,7 +2472,7 @@ DEFINE_DEVICE_TYPE(DCS_AUDIO_2K, dcs_audio_2k_device, "dcs_audio_2k", "DCS Audio
//-------------------------------------------------
dcs_audio_2k_device::dcs_audio_2k_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- dcs_audio_device(mconfig, DCS_AUDIO_2K, tag, owner, clock, REV_DCS1, 1)
+ dcs_audio_device(mconfig, DCS_AUDIO_2K, tag, owner, clock, REV_DCS1)
{
}
@@ -2488,7 +2488,7 @@ DEFINE_DEVICE_TYPE(DCS_AUDIO_2K_UART, dcs_audio_2k_uart_device, "dcs_audio_2k_ua
//-------------------------------------------------
dcs_audio_2k_uart_device::dcs_audio_2k_uart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- dcs_audio_device(mconfig, DCS_AUDIO_2K_UART, tag, owner, clock, REV_DCS1, 1)
+ dcs_audio_device(mconfig, DCS_AUDIO_2K_UART, tag, owner, clock, REV_DCS1)
{
}
@@ -2506,7 +2506,7 @@ DEFINE_DEVICE_TYPE(DCS_AUDIO_8K, dcs_audio_8k_device, "dcs_audio_8k", "DCS Audio
//-------------------------------------------------
dcs_audio_8k_device::dcs_audio_8k_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- dcs_audio_device(mconfig, DCS_AUDIO_8K, tag, owner, clock, REV_DCS1, 1)
+ dcs_audio_device(mconfig, DCS_AUDIO_8K, tag, owner, clock, REV_DCS1)
{
}
@@ -2525,7 +2525,7 @@ DEFINE_DEVICE_TYPE(DCS_AUDIO_WPC, dcs_audio_wpc_device, "dcs_audio_wpc", "DCS Au
//-------------------------------------------------
dcs_audio_wpc_device::dcs_audio_wpc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- dcs_audio_device(mconfig, DCS_AUDIO_WPC, tag, owner, clock, REV_DCS1P5, 1)
+ dcs_audio_device(mconfig, DCS_AUDIO_WPC, tag, owner, clock, REV_DCS1P5)
{
}
@@ -2541,8 +2541,8 @@ void dcs_audio_wpc_device::device_add_mconfig(machine_config &config)
// dcs2_audio_device - constructor
//-------------------------------------------------
-dcs2_audio_device::dcs2_audio_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int outputs) :
- dcs_audio_device(mconfig, type, tag, owner, clock, REV_DCS1, outputs)
+dcs2_audio_device::dcs2_audio_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
+ dcs_audio_device(mconfig, type, tag, owner, clock, REV_DCS1)
{
}
@@ -2559,8 +2559,8 @@ void dcs2_audio_device::add_mconfig_dcs2(machine_config &config)
TIMER(config, m_internal_timer).configure_generic(FUNC(dcs2_audio_device::internal_timer_callback));
TIMER(config, "dcs_hle_timer").configure_generic(FUNC(dcs2_audio_device::transfer_watchdog_callback));
- DMADAC(config, "dac1").add_route(ALL_OUTPUTS, *this, 1.0, AUTO_ALLOC_INPUT, 0);
- DMADAC(config, "dac2").add_route(ALL_OUTPUTS, *this, 1.0, AUTO_ALLOC_INPUT, 1);
+ DMADAC(config, "dac1").add_route(ALL_OUTPUTS, *this, 1.0, 0);
+ DMADAC(config, "dac2").add_route(ALL_OUTPUTS, *this, 1.0, 1);
}
DEFINE_DEVICE_TYPE(DCS2_AUDIO_2115, dcs2_audio_2115_device, "dcs2_audio_2115", "DCS2 Audio 2115")
@@ -2570,7 +2570,7 @@ DEFINE_DEVICE_TYPE(DCS2_AUDIO_2115, dcs2_audio_2115_device, "dcs2_audio_2115", "
//-------------------------------------------------
dcs2_audio_2115_device::dcs2_audio_2115_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- dcs2_audio_device(mconfig, DCS2_AUDIO_2115, tag, owner, clock, 2)
+ dcs2_audio_device(mconfig, DCS2_AUDIO_2115, tag, owner, clock)
{
}
@@ -2587,7 +2587,7 @@ DEFINE_DEVICE_TYPE(DCS2_AUDIO_2104, dcs2_audio_2104_device, "dcs2_audio_2104", "
dcs2_audio_2104_device::dcs2_audio_2104_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- dcs2_audio_device(mconfig, DCS2_AUDIO_2104, tag, owner, clock, 2)
+ dcs2_audio_device(mconfig, DCS2_AUDIO_2104, tag, owner, clock)
{
}
@@ -2609,7 +2609,7 @@ DEFINE_DEVICE_TYPE(DCS2_AUDIO_DSIO, dcs2_audio_dsio_device, "dcs2_audio_dsio", "
//-------------------------------------------------
dcs2_audio_dsio_device::dcs2_audio_dsio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- dcs2_audio_device(mconfig, DCS2_AUDIO_DSIO, tag, owner, clock, 2)
+ dcs2_audio_device(mconfig, DCS2_AUDIO_DSIO, tag, owner, clock)
{
}
@@ -2629,16 +2629,16 @@ void dcs2_audio_dsio_device::device_add_mconfig(machine_config &config)
TIMER(config, m_internal_timer).configure_generic(FUNC(dcs2_audio_dsio_device::internal_timer_callback));
TIMER(config, m_sport0_timer).configure_generic(FUNC(dcs2_audio_dsio_device::sport0_irq)); // roadburn needs this to pass hardware test
- DMADAC(config, "dac1").add_route(ALL_OUTPUTS, *this, 1.0, AUTO_ALLOC_INPUT, 0);
- DMADAC(config, "dac2").add_route(ALL_OUTPUTS, *this, 1.0, AUTO_ALLOC_INPUT, 1);
+ DMADAC(config, "dac1").add_route(ALL_OUTPUTS, *this, 1.0, 0);
+ DMADAC(config, "dac2").add_route(ALL_OUTPUTS, *this, 1.0, 1);
}
//-------------------------------------------------
// dcs2_audio_denver_device - constructor
//-------------------------------------------------
-dcs2_audio_denver_device::dcs2_audio_denver_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int outputs) :
- dcs2_audio_device(mconfig, type, tag, owner, clock, outputs)
+dcs2_audio_denver_device::dcs2_audio_denver_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
+ dcs2_audio_device(mconfig, type, tag, owner, clock)
{
}
@@ -2660,7 +2660,7 @@ void dcs2_audio_denver_device::device_add_mconfig(machine_config &config)
}
dcs2_audio_denver_5ch_device::dcs2_audio_denver_5ch_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- dcs2_audio_denver_device(mconfig, DCS2_AUDIO_DENVER_5CH, tag, owner, clock, 5)
+ dcs2_audio_denver_device(mconfig, DCS2_AUDIO_DENVER_5CH, tag, owner, clock)
{
}
@@ -2668,18 +2668,18 @@ void dcs2_audio_denver_5ch_device::device_add_mconfig(machine_config &config)
{
dcs2_audio_denver_device::device_add_mconfig(config);
- DMADAC(config, "dac1").add_route(ALL_OUTPUTS, *this, 1.0, AUTO_ALLOC_INPUT, 0);
- DMADAC(config, "dac2").add_route(ALL_OUTPUTS, *this, 1.0, AUTO_ALLOC_INPUT, 1);
- DMADAC(config, "dac3").add_route(ALL_OUTPUTS, *this, 1.0, AUTO_ALLOC_INPUT, 2);
- DMADAC(config, "dac4").add_route(ALL_OUTPUTS, *this, 1.0, AUTO_ALLOC_INPUT, 3);
- DMADAC(config, "dac5").add_route(ALL_OUTPUTS, *this, 1.0, AUTO_ALLOC_INPUT, 4);
+ DMADAC(config, "dac1").add_route(ALL_OUTPUTS, *this, 1.0, 0);
+ DMADAC(config, "dac2").add_route(ALL_OUTPUTS, *this, 1.0, 1);
+ DMADAC(config, "dac3").add_route(ALL_OUTPUTS, *this, 1.0, 2);
+ DMADAC(config, "dac4").add_route(ALL_OUTPUTS, *this, 1.0, 3);
+ DMADAC(config, "dac5").add_route(ALL_OUTPUTS, *this, 1.0, 4);
DMADAC(config, "dac6"); // Does not produce sound
}
DEFINE_DEVICE_TYPE(DCS2_AUDIO_DENVER_5CH, dcs2_audio_denver_5ch_device, "dcs2_audio_denver_5ch", "DCS2 Audio Denver 5 Channel")
dcs2_audio_denver_2ch_device::dcs2_audio_denver_2ch_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- dcs2_audio_denver_device(mconfig, DCS2_AUDIO_DENVER_2CH, tag, owner, clock, 2)
+ dcs2_audio_denver_device(mconfig, DCS2_AUDIO_DENVER_2CH, tag, owner, clock)
{
}
@@ -2687,8 +2687,8 @@ void dcs2_audio_denver_2ch_device::device_add_mconfig(machine_config &config)
{
dcs2_audio_denver_device::device_add_mconfig(config);
- DMADAC(config, "dac1").add_route(ALL_OUTPUTS, *this, 1.0, AUTO_ALLOC_INPUT, 0);
- DMADAC(config, "dac2").add_route(ALL_OUTPUTS, *this, 1.0, AUTO_ALLOC_INPUT, 1);
+ DMADAC(config, "dac1").add_route(ALL_OUTPUTS, *this, 1.0, 0);
+ DMADAC(config, "dac2").add_route(ALL_OUTPUTS, *this, 1.0, 1);
}
DEFINE_DEVICE_TYPE(DCS2_AUDIO_DENVER_2CH, dcs2_audio_denver_2ch_device, "dcs2_audio_denver_2ch", "DCS2 Audio Denver 2 Channel")
diff --git a/src/mame/shared/dcs.h b/src/mame/shared/dcs.h
index 41583d966ee..9c1125cb25b 100644
--- a/src/mame/shared/dcs.h
+++ b/src/mame/shared/dcs.h
@@ -55,7 +55,7 @@ public:
protected:
// construction/destruction
- dcs_audio_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int rev, int outputs);
+ dcs_audio_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int rev);
// device_t implementation
virtual void device_start() override ATTR_COLD;
@@ -317,7 +317,7 @@ class dcs2_audio_device : public dcs_audio_device
{
protected:
// construction/destruction
- dcs2_audio_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int outputs);
+ dcs2_audio_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device_t implementation
virtual void device_start() override ATTR_COLD;
@@ -374,7 +374,7 @@ class dcs2_audio_denver_device : public dcs2_audio_device
{
protected:
// construction/destruction
- dcs2_audio_denver_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int outputs);
+ dcs2_audio_denver_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device_t implementation
virtual void device_add_mconfig(machine_config &config) override ATTR_COLD;
diff --git a/src/mame/shared/decobsmt.cpp b/src/mame/shared/decobsmt.cpp
index b787358d8e2..2846bdaebcf 100644
--- a/src/mame/shared/decobsmt.cpp
+++ b/src/mame/shared/decobsmt.cpp
@@ -54,8 +54,8 @@ void decobsmt_device::device_add_mconfig(machine_config &config)
BSMT2000(config, m_bsmt, XTAL(24'000'000));
m_bsmt->set_addrmap(0, &decobsmt_device::bsmt_map);
m_bsmt->set_ready_callback(FUNC(decobsmt_device::bsmt_ready_callback));
- m_bsmt->add_route(0, *this, 1.0, AUTO_ALLOC_INPUT, 0);
- m_bsmt->add_route(1, *this, 1.0, AUTO_ALLOC_INPUT, 1);
+ m_bsmt->add_route(0, *this, 1.0, 0);
+ m_bsmt->add_route(1, *this, 1.0, 1);
}
//**************************************************************************
@@ -68,7 +68,7 @@ void decobsmt_device::device_add_mconfig(machine_config &config)
decobsmt_device::decobsmt_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, DECOBSMT, tag, owner, clock)
- , device_mixer_interface(mconfig, *this, 2)
+ , device_mixer_interface(mconfig, *this)
, m_ourcpu(*this, "soundcpu")
, m_bsmt(*this, "bsmt")
, m_bsmt_latch(0)
diff --git a/src/mame/shared/exidysound.cpp b/src/mame/shared/exidysound.cpp
index 311fa60dea4..15d8e127dc2 100644
--- a/src/mame/shared/exidysound.cpp
+++ b/src/mame/shared/exidysound.cpp
@@ -277,16 +277,15 @@ void exidy_sound_device::device_reset()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void exidy_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void exidy_sound_device::sound_stream_update(sound_stream &stream)
{
sh6840_timer_channel *sh6840_timer = m_sh6840_timer;
// hack to skip the expensive lfsr noise generation unless at least one of the 3 channels actually depends on it being generated
bool noisy = ((sh6840_timer[0].cr & sh6840_timer[1].cr & sh6840_timer[2].cr & 0x02) == 0);
- auto &buffer = outputs[0];
// loop over samples
- for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
sh6840_timer_channel *t;
int clocks;
@@ -346,7 +345,7 @@ void exidy_sound_device::sound_stream_update(sound_stream &stream, std::vector<r
sample += generate_music_sample();
// stash
- buffer.put_int(sampindex, sample, 32768);
+ stream.put_int(0, sampindex, sample, 32768);
}
}
diff --git a/src/mame/shared/exidysound.h b/src/mame/shared/exidysound.h
index 28fbcafadfd..1e564dabd4a 100644
--- a/src/mame/shared/exidysound.h
+++ b/src/mame/shared/exidysound.h
@@ -51,7 +51,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 s32 generate_music_sample() { return 0; }
static inline void sh6840_apply_clock(sh6840_timer_channel *t, int clocks);
diff --git a/src/mame/shared/gottlieb_a.cpp b/src/mame/shared/gottlieb_a.cpp
index 59f9450576f..c54d4c0f3b3 100644
--- a/src/mame/shared/gottlieb_a.cpp
+++ b/src/mame/shared/gottlieb_a.cpp
@@ -151,7 +151,7 @@ void gottlieb_sound_p2_device::device_add_mconfig(machine_config &config)
void gottlieb_sound_p2_device::device_start()
{
// register for save states
- save_item(NAME(m_dummy));
+ save_item(NAME(m_dummy_save));
}
@@ -370,7 +370,7 @@ void gottlieb_sound_r1_device::device_add_mconfig(machine_config &config)
void gottlieb_sound_r1_device::device_start()
{
// register for save states
- save_item(NAME(m_dummy));
+ save_item(NAME(m_dummy_save));
}
diff --git a/src/mame/shared/gottlieb_a.h b/src/mame/shared/gottlieb_a.h
index a246f884444..7ec6bc6de12 100644
--- a/src/mame/shared/gottlieb_a.h
+++ b/src/mame/shared/gottlieb_a.h
@@ -71,7 +71,7 @@ protected:
required_device<mos6530_device> m_r6530;
private:
- u8 m_dummy; // needed for save-state support
+ bool m_dummy_save = false; // needed for save-state support
};
@@ -129,7 +129,7 @@ protected:
required_device<mos6532_device> m_riot;
private:
- u8 m_dummy; // needed for save-state support
+ bool m_dummy_save = false; // needed for save-state support
};
diff --git a/src/mame/shared/mega32x.cpp b/src/mame/shared/mega32x.cpp
index 277d2d9c102..2983c96af22 100644
--- a/src/mame/shared/mega32x.cpp
+++ b/src/mame/shared/mega32x.cpp
@@ -935,10 +935,10 @@ void sega_32x_device::m68k_pwm_w(offs_t offset, uint16_t data)
pwm_w(offset,data);
}
-void sega_32x_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void sega_32x_device::sound_stream_update(sound_stream &stream)
{
- outputs[0] = inputs[0];
- outputs[1] = inputs[1];
+ stream.copy(0, 0);
+ stream.copy(1, 1);
}
/**********************************************************************************************/
diff --git a/src/mame/shared/mega32x.h b/src/mame/shared/mega32x.h
index 5c447ddc841..81c1e0066f9 100644
--- a/src/mame/shared/mega32x.h
+++ b/src/mame/shared/mega32x.h
@@ -111,7 +111,7 @@ protected:
virtual uint32_t palette_entries() const noexcept override { return 32*32*32/**2*/; }
// device_sound_interface 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;
void update_total_scanlines(bool mode3) { m_total_scanlines = mode3 ? (m_base_total_scanlines * 2) : m_base_total_scanlines; } // this gets set at each EOF
diff --git a/src/mame/shared/megacdcd.cpp b/src/mame/shared/megacdcd.cpp
index 35c64e9386a..a1245dfc59b 100644
--- a/src/mame/shared/megacdcd.cpp
+++ b/src/mame/shared/megacdcd.cpp
@@ -1161,8 +1161,8 @@ void lc89510_temp_device::device_add_mconfig(machine_config &config)
TIMER(config, "hock_timer").configure_periodic(FUNC(lc89510_temp_device::segacd_access_timer_callback), attotime::from_hz(75));
cdda_device &cdda(CDDA(config, "cdda"));
- cdda.add_route(0, ":lspeaker", 0.50); // TODO: accurate volume balance
- cdda.add_route(1, ":rspeaker", 0.50);
+ cdda.add_route(0, ":speaker", 0.50, 0); // TODO: accurate volume balance
+ cdda.add_route(1, ":speaker", 0.50, 1);
cdda.set_cdrom_tag(m_cdrom);
}
diff --git a/src/mame/shared/rax.cpp b/src/mame/shared/rax.cpp
index 5dbf32aef55..076f09bd5db 100644
--- a/src/mame/shared/rax.cpp
+++ b/src/mame/shared/rax.cpp
@@ -494,7 +494,7 @@ DEFINE_DEVICE_TYPE(ACCLAIM_RAX, acclaim_rax_device, "rax_audio", "Acclaim RAX")
acclaim_rax_device::acclaim_rax_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, ACCLAIM_RAX, tag, owner, clock)
- , device_mixer_interface(mconfig, *this, 2)
+ , device_mixer_interface(mconfig, *this)
, m_cpu(*this, "adsp")
, m_dmadac(*this, { "dacl", "dacr" })
, m_reg_timer(*this, "adsp_reg_timer")
@@ -527,9 +527,8 @@ void acclaim_rax_device::device_add_mconfig(machine_config &config)
GENERIC_LATCH_16(config, m_data_in);
GENERIC_LATCH_16(config, m_data_out);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- DMADAC(config, m_dmadac[0]).add_route(ALL_OUTPUTS, *this, 1.0, AUTO_ALLOC_INPUT, 0);
- DMADAC(config, m_dmadac[1]).add_route(ALL_OUTPUTS, *this, 1.0, AUTO_ALLOC_INPUT, 1);
+ DMADAC(config, m_dmadac[0]).add_route(ALL_OUTPUTS, *this, 1.0, 0);
+ DMADAC(config, m_dmadac[1]).add_route(ALL_OUTPUTS, *this, 1.0, 1);
}
diff --git a/src/mame/shared/segam1audio.cpp b/src/mame/shared/segam1audio.cpp
index a486eb15343..e8971ea58d9 100644
--- a/src/mame/shared/segam1audio.cpp
+++ b/src/mame/shared/segam1audio.cpp
@@ -55,22 +55,21 @@ void segam1audio_device::device_add_mconfig(machine_config &config)
M68000(config, m_audiocpu, 20_MHz_XTAL / 2); // verified on real h/w
m_audiocpu->set_addrmap(AS_PROGRAM, &segam1audio_device::segam1audio_map);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
YM3438(config, m_ym, 16_MHz_XTAL / 2);
- m_ym->add_route(0, "lspeaker", 0.30);
- m_ym->add_route(1, "rspeaker", 0.30);
+ m_ym->add_route(0, "speaker", 0.30, 0);
+ m_ym->add_route(1, "speaker", 0.30, 1);
MULTIPCM(config, m_multipcm_1, 20_MHz_XTAL / 2);
m_multipcm_1->set_addrmap(0, &segam1audio_device::mpcm1_map);
- m_multipcm_1->add_route(0, "lspeaker", 0.5);
- m_multipcm_1->add_route(1, "rspeaker", 0.5);
+ m_multipcm_1->add_route(0, "speaker", 0.5, 0);
+ m_multipcm_1->add_route(1, "speaker", 0.5, 1);
MULTIPCM(config, m_multipcm_2, 20_MHz_XTAL / 2);
m_multipcm_2->set_addrmap(0, &segam1audio_device::mpcm2_map);
- m_multipcm_2->add_route(0, "lspeaker", 0.5);
- m_multipcm_2->add_route(1, "rspeaker", 0.5);
+ m_multipcm_2->add_route(0, "speaker", 0.5, 0);
+ m_multipcm_2->add_route(1, "speaker", 0.5, 1);
I8251(config, m_uart, 16_MHz_XTAL / 2); // T82C51
m_uart->rxrdy_handler().set_inputline(m_audiocpu, M68K_IRQ_2);
diff --git a/src/mame/shared/vboysound.cpp b/src/mame/shared/vboysound.cpp
index a4c39921dcf..59cd1f27c62 100644
--- a/src/mame/shared/vboysound.cpp
+++ b/src/mame/shared/vboysound.cpp
@@ -269,14 +269,11 @@ TIMER_CALLBACK_MEMBER(vboysnd_device::delayed_stream_update)
// our sound stream
//-------------------------------------------------
-void vboysnd_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void vboysnd_device::sound_stream_update(sound_stream &stream)
{
int len, i, j, channel;
- auto &outL = outputs[0];
- auto &outR = outputs[1];
-
- len = outL.samples();
+ len = stream.samples();
// if (mgetb(m_aram+SST0P) & 0x1) // Sound Stop Reg
// goto end;
@@ -384,8 +381,8 @@ void vboysnd_device::sound_stream_update(sound_stream &stream, std::vector<read_
note_left = (note_left << 5) | ((note_left >> 6) & 0x1f);
note_right = (note_right << 5) | ((note_right >> 6) & 0x1f);
- outL.put_int_clamp(j, note_left, 32768);
- outR.put_int_clamp(j, note_right, 32768);
+ stream.put_int_clamp(0, j, note_left, 32768);
+ stream.put_int_clamp(1, j, note_right, 32768);
}
}
diff --git a/src/mame/shared/vboysound.h b/src/mame/shared/vboysound.h
index 73210dc8fe8..d9f62f55fd0 100644
--- a/src/mame/shared/vboysound.h
+++ b/src/mame/shared/vboysound.h
@@ -71,7 +71,7 @@ protected:
virtual void device_clock_changed() override;
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;
TIMER_CALLBACK_MEMBER(delayed_stream_update);
diff --git a/src/mame/shared/williamssound.cpp b/src/mame/shared/williamssound.cpp
index 5c88c4c3264..dd7df345a6b 100644
--- a/src/mame/shared/williamssound.cpp
+++ b/src/mame/shared/williamssound.cpp
@@ -915,7 +915,7 @@ void williams_s4_sound_device::device_add_mconfig(machine_config &config)
void williams_s4_sound_device::device_start()
{
// register for save states
- save_item(NAME(m_dummy));
+ save_item(NAME(m_dummy_save));
}
//-------------------------------------------------
@@ -1032,7 +1032,7 @@ void williams_s6_sound_device::device_add_mconfig(machine_config &config)
void williams_s6_sound_device::device_start()
{
// register for save states
- save_item(NAME(m_dummy));
+ save_item(NAME(m_dummy_save));
}
//-------------------------------------------------
@@ -1143,7 +1143,7 @@ void williams_s9_sound_device::device_add_mconfig(machine_config &config)
void williams_s9_sound_device::device_start()
{
// register for save states
- save_item(NAME(m_dummy));
+ save_item(NAME(m_dummy_save));
}
//-------------------------------------------------
@@ -1262,7 +1262,7 @@ void williams_s11_sound_device::device_start()
membank("bank1")->configure_entries(0, 2, &ROM[0x8000], 0x4000);
// register for save states
- save_item(NAME(m_dummy));
+ save_item(NAME(m_dummy_save));
}
//-------------------------------------------------
diff --git a/src/mame/shared/williamssound.h b/src/mame/shared/williamssound.h
index 29434ca990f..67b92f760ab 100644
--- a/src/mame/shared/williamssound.h
+++ b/src/mame/shared/williamssound.h
@@ -223,7 +223,7 @@ private:
void williams_s4_map(address_map &map) ATTR_COLD;
required_device<m6808_cpu_device> m_cpu;
required_device<pia6821_device> m_pia;
- u8 m_dummy = 0; // needed for save-state support
+ bool m_dummy_save = false; // needed for save-state support
};
@@ -254,7 +254,7 @@ private:
required_device<m6802_cpu_device> m_cpu;
required_device<pia6821_device> m_pia;
required_device<hc55516_device> m_hc;
- u8 m_dummy = 0; // needed for save-state support
+ bool m_dummy_save = false; // needed for save-state support
};
@@ -285,7 +285,7 @@ private:
required_device<m6802_cpu_device> m_cpu;
required_device<pia6821_device> m_pia;
required_device<hc55516_device> m_hc;
- u8 m_dummy = 0; // needed for save-state support
+ bool m_dummy_save = false; // needed for save-state support
};
@@ -317,7 +317,7 @@ private:
required_device<m6802_cpu_device> m_cpu;
required_device<pia6821_device> m_pia;
required_device<hc55516_device> m_hc;
- u8 m_dummy = 0; // needed for save-state support
+ bool m_dummy_save = false; // needed for save-state support
};
#endif // MAME_SHARED_WILLIAMSSOUND_H
diff --git a/src/mame/shared/wswansound.cpp b/src/mame/shared/wswansound.cpp
index 73c42b7d520..6f250241988 100644
--- a/src/mame/shared/wswansound.cpp
+++ b/src/mame/shared/wswansound.cpp
@@ -158,11 +158,9 @@ u8 wswan_sound_device::fetch_sample(int channel, int offset)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void wswan_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void wswan_sound_device::sound_stream_update(sound_stream &stream)
{
- auto &outputl = outputs[0];
- auto &outputr = outputs[1];
- for (int sampindex = 0; sampindex < outputl.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
m_loutput = m_routput = 0;
if (m_headphone_connected ? m_headphone_enable : m_speaker_enable)
@@ -270,20 +268,20 @@ void wswan_sound_device::sound_stream_update(sound_stream &stream, std::vector<r
}
}
// TODO: clamped?
- outputl.put_int_clamp(sampindex, left, 32768);
- outputr.put_int_clamp(sampindex, right, 32768);
+ stream.put_int_clamp(0, sampindex, left, 32768);
+ stream.put_int_clamp(1, sampindex, right, 32768);
}
else
{
u8 const mono = (((m_loutput & 0x3ff) + (m_routput & 0x3ff)) >> m_speaker_volume) & 0xff;
- outputl.put_int(sampindex, mono, 256);
- outputr.put_int(sampindex, mono, 256);
+ stream.put_int(0, sampindex, mono, 256);
+ stream.put_int(1, sampindex, mono, 256);
}
}
else
{
- outputl.put(sampindex, 0.0);
- outputr.put(sampindex, 0.0);
+ stream.put(0, sampindex, 0.0);
+ stream.put(1, sampindex, 0.0);
}
}
}
diff --git a/src/mame/shared/wswansound.h b/src/mame/shared/wswansound.h
index f300a597b29..cdce7b8aeff 100644
--- a/src/mame/shared/wswansound.h
+++ b/src/mame/shared/wswansound.h
@@ -40,7 +40,7 @@ protected:
virtual void rom_bank_pre_change() override;
// 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;
private:
struct channel_t
diff --git a/src/mame/sharp/x1.cpp b/src/mame/sharp/x1.cpp
index f9929d5e4f5..e8528e40b07 100644
--- a/src/mame/sharp/x1.cpp
+++ b/src/mame/sharp/x1.cpp
@@ -2237,20 +2237,19 @@ void x1_state::x1(machine_config &config)
GENERIC_CARTSLOT(config, m_cart, generic_plain_slot, "x1_cart", "bin,rom");
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
// TODO: fix thru schematics (formation of resistors tied to ABC outputs)
ay8910_device &ay(AY8910(config, "ay", MAIN_CLOCK/8));
ay.port_a_read_callback().set_ioport("P1");
ay.port_b_read_callback().set_ioport("P2");
- ay.add_route(ALL_OUTPUTS, "lspeaker", 0.25);
- ay.add_route(ALL_OUTPUTS, "rspeaker", 0.25);
+ ay.add_route(ALL_OUTPUTS, "speaker", 0.25, 0);
+ ay.add_route(ALL_OUTPUTS, "speaker", 0.25, 1);
CASSETTE(config, m_cassette);
m_cassette->set_formats(x1_cassette_formats);
m_cassette->set_default_state(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED);
- m_cassette->add_route(ALL_OUTPUTS, "lspeaker", 0.25).add_route(ALL_OUTPUTS, "rspeaker", 0.10);
+ m_cassette->add_route(ALL_OUTPUTS, "speaker", 0.25, 0).add_route(ALL_OUTPUTS, "speaker", 0.10, 1);
m_cassette->set_interface("x1_cass");
SOFTWARE_LIST(config, "cass_list").set_original("x1_cass");
@@ -2289,8 +2288,8 @@ void x1turbo_state::x1turbo(machine_config &config)
m_ctc_ym->zc_callback<0>().set(m_ctc_ym, FUNC(z80ctc_device::trg3));
YM2151(config, m_ym, MAIN_CLOCK/8);
- m_ym->add_route(0, "lspeaker", 0.50);
- m_ym->add_route(1, "rspeaker", 0.50);
+ m_ym->add_route(0, "speaker", 0.50, 0);
+ m_ym->add_route(1, "speaker", 0.50, 1);
}
/*************************************
diff --git a/src/mame/sharp/x1twin.cpp b/src/mame/sharp/x1twin.cpp
index 4a4c8f3419e..a8a4a747fe2 100644
--- a/src/mame/sharp/x1twin.cpp
+++ b/src/mame/sharp/x1twin.cpp
@@ -496,8 +496,7 @@ void x1twin_state::x1twin(machine_config &config)
SPEAKER(config, "pce_l").front_left();
SPEAKER(config, "pce_r").front_right();
-// SPEAKER(config, "lspeaker").front_left();
-// SPEAKER(config, "rspeaker").front_right();
+// SPEAKER(config, "speaker", 2).front();
/* TODO:is the AY mono or stereo? Also volume balance isn't right. */
ay8910_device &ay(AY8910(config, "ay", MAIN_CLOCK/8));
diff --git a/src/mame/sharp/x68k.cpp b/src/mame/sharp/x68k.cpp
index e702030c437..0f4d8efe2bd 100644
--- a/src/mame/sharp/x68k.cpp
+++ b/src/mame/sharp/x68k.cpp
@@ -1075,13 +1075,12 @@ void x68k_state::x68000_base(machine_config &config)
config.set_default_layout(layout_x68000);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
YM2151(config, m_ym2151, 16_MHz_XTAL / 4);
m_ym2151->irq_handler().set(FUNC(x68k_state::fm_irq));
m_ym2151->port_write_handler().set(FUNC(x68k_state::ct_w)); // CT1, CT2 from YM2151 port 0x1b
- m_ym2151->add_route(0, "lspeaker", 0.50);
- m_ym2151->add_route(1, "rspeaker", 0.50);
+ m_ym2151->add_route(0, "speaker", 0.50, 0);
+ m_ym2151->add_route(1, "speaker", 0.50, 1);
OKIM6258(config, m_okim6258, 16_MHz_XTAL / 4);
m_okim6258->set_start_div(okim6258_device::FOSC_DIV_BY_512);
@@ -1090,8 +1089,8 @@ void x68k_state::x68000_base(machine_config &config)
m_okim6258->add_route(ALL_OUTPUTS, "adpcm_outl", 0.50);
m_okim6258->add_route(ALL_OUTPUTS, "adpcm_outr", 0.50);
- FILTER_VOLUME(config, m_adpcm_out[0]).add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- FILTER_VOLUME(config, m_adpcm_out[1]).add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ FILTER_VOLUME(config, m_adpcm_out[0]).add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ FILTER_VOLUME(config, m_adpcm_out[1]).add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
UPD72065(config, m_upd72065, 16_MHz_XTAL / 2, true, false); // clocked through SED9420CAC
m_upd72065->intrq_wr_callback().set(FUNC(x68k_state::ioc_irq<IOC_FDC_INT>));
diff --git a/src/mame/sigma/sigmab98.cpp b/src/mame/sigma/sigmab98.cpp
index 97ccf2827d4..c737097f606 100644
--- a/src/mame/sigma/sigmab98.cpp
+++ b/src/mame/sigma/sigmab98.cpp
@@ -1464,12 +1464,11 @@ void sigmab98_state::sigmab98(machine_config &config)
BUFFERED_SPRITERAM8(config, m_buffered_spriteram);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ymz280b_device &ymz(YMZ280B(config, "ymz", 16934400)); // clock @X2?
- ymz.add_route(0, "lspeaker", 1.0);
- ymz.add_route(1, "rspeaker", 1.0);
+ ymz.add_route(0, "speaker", 1.0, 0);
+ ymz.add_route(1, "speaker", 1.0, 1);
}
void sigmab98_state::dodghero(machine_config &config)
@@ -1545,11 +1544,10 @@ void lufykzku_state::lufykzku(machine_config &config)
//BUFFERED_SPRITERAM8(config, m_buffered_spriteram); // same as sammymdl?
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
okim9810_device &oki(OKIM9810(config, "oki", XTAL(4'096'000)));
- oki.add_route(0, "lspeaker", 0.80);
- oki.add_route(1, "rspeaker", 0.80);
+ oki.add_route(0, "speaker", 0.80, 0);
+ oki.add_route(1, "speaker", 0.80, 1);
}
void lufykzku_state::rockman(machine_config& config)
@@ -1616,12 +1614,11 @@ void sammymdl_state::sammymdl(machine_config &config)
//BUFFERED_SPRITERAM8(config, m_buffered_spriteram); // not on sammymdl?
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
okim9810_device &oki(OKIM9810(config, "oki", XTAL(4'096'000)));
- oki.add_route(0, "lspeaker", 0.80);
- oki.add_route(1, "rspeaker", 0.80);
+ oki.add_route(0, "speaker", 0.80, 0);
+ oki.add_route(1, "speaker", 0.80, 1);
}
void sammymdl_state::animalc(machine_config &config)
diff --git a/src/mame/sinclair/chloe.cpp b/src/mame/sinclair/chloe.cpp
index 03f9e8cc73a..e613ba36101 100644
--- a/src/mame/sinclair/chloe.cpp
+++ b/src/mame/sinclair/chloe.cpp
@@ -954,24 +954,23 @@ void chloe_state::chloe(machine_config &config)
PALETTE(config, m_palette, FUNC(chloe_state::spectrum_palette), 256);
SCREEN_ULA_PLUS(config, m_ula, 0).set_raster_offset(SCR_256x192.left(), SCR_256x192.top()).set_palette(m_palette->device().tag(), 0x000, 0x000);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker2", 2).front();
config.device_remove("ay8912");
AY8912(config, m_ay[0], 28_MHz_XTAL / 16)
- .add_route(0, "lspeaker", 0.50)
- .add_route(2, "lspeaker", 0.25)
- .add_route(2, "rspeaker", 0.25)
- .add_route(1, "rspeaker", 0.50);
+ .add_route(0, "speaker2", 0.50, 0)
+ .add_route(2, "speaker2", 0.25, 0)
+ .add_route(2, "speaker2", 0.25, 1)
+ .add_route(1, "speaker2", 0.50, 1);
AY8912(config, m_ay[1], 28_MHz_XTAL / 16)
- .add_route(0, "lspeaker", 0.50)
- .add_route(2, "lspeaker", 0.25)
- .add_route(2, "rspeaker", 0.25)
- .add_route(1, "rspeaker", 0.50);
+ .add_route(0, "speaker2", 0.50, 0)
+ .add_route(2, "speaker2", 0.25, 0)
+ .add_route(2, "speaker2", 0.25, 1)
+ .add_route(1, "speaker2", 0.50, 1);
DAC_8BIT_R2R(config, m_covox, 0)
- .add_route(ALL_OUTPUTS, "lspeaker", 0.75)
- .add_route(ALL_OUTPUTS, "rspeaker", 0.75);
+ .add_route(ALL_OUTPUTS, "speaker2", 0.75, 0)
+ .add_route(ALL_OUTPUTS, "speaker2", 0.75, 1);
KBDC8042(config, m_kbdc);
m_kbdc->set_keyboard_type(kbdc8042_device::KBDC8042_STANDARD);
diff --git a/src/mame/sinclair/pentagon.cpp b/src/mame/sinclair/pentagon.cpp
index 25313d44b9b..9b71459ec63 100644
--- a/src/mame/sinclair/pentagon.cpp
+++ b/src/mame/sinclair/pentagon.cpp
@@ -203,14 +203,13 @@ void pentagon_state::pentagon(machine_config &config)
BETA_DISK(config, m_beta, 0);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speakers", 2).front();
ay8912_device &ay8912(AY8912(config.replace(), "ay8912", 14_MHz_XTAL / 8));
- ay8912.add_route(0, "lspeaker", 0.50);
- ay8912.add_route(1, "lspeaker", 0.25);
- ay8912.add_route(1, "rspeaker", 0.25);
- ay8912.add_route(2, "rspeaker", 0.50);
+ ay8912.add_route(0, "speakers", 0.50, 0);
+ ay8912.add_route(1, "speakers", 0.25, 0);
+ ay8912.add_route(1, "speakers", 0.25, 1);
+ ay8912.add_route(2, "speakers", 0.50, 1);
config.device_remove("exp");
diff --git a/src/mame/sinclair/pentevo.cpp b/src/mame/sinclair/pentevo.cpp
index c1ac0017368..f4597e478df 100644
--- a/src/mame/sinclair/pentevo.cpp
+++ b/src/mame/sinclair/pentevo.cpp
@@ -768,20 +768,19 @@ void pentevo_state::pentevo(machine_config &config)
m_sdcard->set_prefer_sdhc();
m_sdcard->spi_miso_callback().set(FUNC(pentevo_state::spi_miso_w));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speakers", 2).front();
config.device_remove("ay8912");
YM2149(config, m_ay[0], 14_MHz_XTAL / 8)
- .add_route(0, "lspeaker", 0.50)
- .add_route(1, "lspeaker", 0.25)
- .add_route(1, "rspeaker", 0.25)
- .add_route(2, "rspeaker", 0.50);
+ .add_route(0, "speakers", 0.50, 0)
+ .add_route(1, "speakers", 0.25, 0)
+ .add_route(1, "speakers", 0.25, 1)
+ .add_route(2, "speakers", 0.50, 1);
YM2149(config, m_ay[1], 14_MHz_XTAL / 8)
- .add_route(0, "lspeaker", 0.50)
- .add_route(1, "lspeaker", 0.25)
- .add_route(1, "rspeaker", 0.25)
- .add_route(2, "rspeaker", 0.50);
+ .add_route(0, "speakers", 0.50, 0)
+ .add_route(1, "speakers", 0.25, 0)
+ .add_route(1, "speakers", 0.25, 1)
+ .add_route(2, "speakers", 0.50, 1);
AT_KEYB(config, m_keyboard, pc_keyboard_device::KEYBOARD_TYPE::AT, 3);
diff --git a/src/mame/sinclair/scorpion.cpp b/src/mame/sinclair/scorpion.cpp
index 9ca8a898f40..26480e94e09 100644
--- a/src/mame/sinclair/scorpion.cpp
+++ b/src/mame/sinclair/scorpion.cpp
@@ -509,19 +509,18 @@ void scorpion_state::scorpion(machine_config &config)
subdevice<gfxdecode_device>("gfxdecode")->set_info(gfx_scorpion);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker2", 2).front();
AY8912(config, m_ay[0], 14_MHz_XTAL / 8) // BAC
- .add_route(1, "lspeaker", 0.50)
- .add_route(0, "lspeaker", 0.25)
- .add_route(0, "rspeaker", 0.25)
- .add_route(2, "rspeaker", 0.50);
+ .add_route(1, "speaker2", 0.50, 0)
+ .add_route(0, "speaker2", 0.25, 0)
+ .add_route(0, "speaker2", 0.25, 1)
+ .add_route(2, "speaker2", 0.50, 1);
AY8912(config, m_ay[1], 14_MHz_XTAL / 8)
- .add_route(1, "lspeaker", 0.50)
- .add_route(0, "lspeaker", 0.25)
- .add_route(0, "rspeaker", 0.25)
- .add_route(2, "rspeaker", 0.50);
+ .add_route(1, "speaker2", 0.50, 0)
+ .add_route(0, "speaker2", 0.25, 0)
+ .add_route(0, "speaker2", 0.25, 1)
+ .add_route(2, "speaker2", 0.50, 1);
BETA_DISK(config, m_beta, 0);
diff --git a/src/mame/sinclair/specnext.cpp b/src/mame/sinclair/specnext.cpp
index 8bfb4e7a79b..2d623b51341 100644
--- a/src/mame/sinclair/specnext.cpp
+++ b/src/mame/sinclair/specnext.cpp
@@ -3466,22 +3466,21 @@ void specnext_state::tbblue(machine_config &config)
m_sdcard->set_prefer_sdhc();
m_sdcard->spi_miso_callback().set(FUNC(specnext_state::spi_miso_w));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speakers", 2).front();
- DAC_8BIT_R2R(config, m_dac[0], 0).add_route(ALL_OUTPUTS, "lspeaker", 0.75);
- DAC_8BIT_R2R(config, m_dac[1], 0).add_route(ALL_OUTPUTS, "lspeaker", 0.75);
- DAC_8BIT_R2R(config, m_dac[2], 0).add_route(ALL_OUTPUTS, "rspeaker", 0.75);
- DAC_8BIT_R2R(config, m_dac[3], 0).add_route(ALL_OUTPUTS, "rspeaker", 0.75);
+ DAC_8BIT_R2R(config, m_dac[0], 0).add_route(ALL_OUTPUTS, "speakers", 0.75, 0);
+ DAC_8BIT_R2R(config, m_dac[1], 0).add_route(ALL_OUTPUTS, "speakers", 0.75, 0);
+ DAC_8BIT_R2R(config, m_dac[2], 0).add_route(ALL_OUTPUTS, "speakers", 0.75, 1);
+ DAC_8BIT_R2R(config, m_dac[3], 0).add_route(ALL_OUTPUTS, "speakers", 0.75, 1);
config.device_remove("ay8912");
for (auto i = 0; i < 3; ++i)
{
YM2149(config, m_ay[i], 14_MHz_XTAL / 8)
- .add_route(0, "lspeaker", 0.50)
- .add_route(1, "lspeaker", 0.25)
- .add_route(1, "rspeaker", 0.25)
- .add_route(2, "rspeaker", 0.50);
+ .add_route(0, "speakers", 0.50, 0)
+ .add_route(1, "speakers", 0.25, 0)
+ .add_route(1, "speakers", 0.25, 1)
+ .add_route(2, "speakers", 0.50, 1);
}
SPECNEXT_MULTIFACE(config, m_mf, 0);
diff --git a/src/mame/sinclair/sprinter.cpp b/src/mame/sinclair/sprinter.cpp
index c75066d83db..cfdeb8cc744 100644
--- a/src/mame/sinclair/sprinter.cpp
+++ b/src/mame/sinclair/sprinter.cpp
@@ -1932,17 +1932,16 @@ void sprinter_state::sprinter(machine_config &config)
m_maincpu->zc_callback<0>().append(m_maincpu, FUNC(z84c015_device::txcb_w));
m_maincpu->zc_callback<2>().set(m_maincpu, FUNC(z84c015_device::trg3));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speakers", 2).front();
ay8910_device &ay8910(AY8910(config.replace(), "ay8912", X_SP / 24));
- ay8910.add_route(0, "lspeaker", 0.50);
- ay8910.add_route(1, "lspeaker", 0.25);
- ay8910.add_route(1, "rspeaker", 0.25);
- ay8910.add_route(2, "rspeaker", 0.50);
+ ay8910.add_route(0, "speakers", 0.50, 0);
+ ay8910.add_route(1, "speakers", 0.25, 0);
+ ay8910.add_route(1, "speakers", 0.25, 1);
+ ay8910.add_route(2, "speakers", 0.50, 1);
- DAC_16BIT_R2R(config, m_ldac, 0).add_route(ALL_OUTPUTS, "lspeaker", 0.5);
- DAC_16BIT_R2R(config, m_rdac, 0).add_route(ALL_OUTPUTS, "rspeaker", 0.5);
+ DAC_16BIT_R2R(config, m_ldac, 0).add_route(ALL_OUTPUTS, "speakers", 0.5, 0);
+ DAC_16BIT_R2R(config, m_rdac, 0).add_route(ALL_OUTPUTS, "speakers", 0.5, 1);
subdevice<gfxdecode_device>("gfxdecode")->set_info(gfx_sprinter);
}
diff --git a/src/mame/sinclair/tsconf.cpp b/src/mame/sinclair/tsconf.cpp
index cc6f12dd4c0..28f2b5a54a6 100644
--- a/src/mame/sinclair/tsconf.cpp
+++ b/src/mame/sinclair/tsconf.cpp
@@ -299,20 +299,19 @@ void tsconf_state::tsconf(machine_config &config)
m_dma->on_ready_callback().set(FUNC(tsconf_state::dma_ready));
BETA_DISK(config, m_beta, 0);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speakers", 2).front();
config.device_remove("ay8912");
YM2149(config, m_ay[0], 14_MHz_XTAL / 8)
- .add_route(0, "lspeaker", 0.50)
- .add_route(1, "lspeaker", 0.25)
- .add_route(1, "rspeaker", 0.25)
- .add_route(2, "rspeaker", 0.50);
+ .add_route(0, "speakers", 0.50, 0)
+ .add_route(1, "speakers", 0.25, 0)
+ .add_route(1, "speakers", 0.25, 1)
+ .add_route(2, "speakers", 0.50, 1);
YM2149(config, m_ay[1], 14_MHz_XTAL / 8)
- .add_route(0, "lspeaker", 0.50)
- .add_route(1, "lspeaker", 0.25)
- .add_route(1, "rspeaker", 0.25)
- .add_route(2, "rspeaker", 0.50);
+ .add_route(0, "speakers", 0.50, 0)
+ .add_route(1, "speakers", 0.25, 0)
+ .add_route(1, "speakers", 0.25, 1)
+ .add_route(2, "speakers", 0.50, 1);
DAC_8BIT_R2R(config, m_dac, 0).add_route(ALL_OUTPUTS, "mono", 0.75);;
diff --git a/src/mame/skeleton/banpresto_tomy_h8s.cpp b/src/mame/skeleton/banpresto_tomy_h8s.cpp
index 9e3986760bc..2177d4ad33f 100644
--- a/src/mame/skeleton/banpresto_tomy_h8s.cpp
+++ b/src/mame/skeleton/banpresto_tomy_h8s.cpp
@@ -116,12 +116,11 @@ void banpresto_tomy_h8s_state::base(machine_config &config)
PALETTE(config, "palette").set_entries(65536); // TODO
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
okim9810_device &oki(OKIM9810(config, "oki", 4.096_MHz_XTAL)); // M9810B or M9811
- oki.add_route(0, "lspeaker", 0.80);
- oki.add_route(1, "rspeaker", 0.80);
+ oki.add_route(0, "speaker", 0.80, 0);
+ oki.add_route(1, "speaker", 0.80, 1);
}
diff --git a/src/mame/skeleton/biorhythm_fp.cpp b/src/mame/skeleton/biorhythm_fp.cpp
new file mode 100644
index 00000000000..06569c51f8f
--- /dev/null
+++ b/src/mame/skeleton/biorhythm_fp.cpp
@@ -0,0 +1,128 @@
+// license:BSD-3-Clause
+// copyright-holders:
+
+/*
+Biorhythm machine by For-Play
+
+Two different PCB sets were dumped, with identical ROM contents
+
+First PCB:
+
+Etched in copper on main board BIO-RHYTHM LOGIC
+ FOR-PLAY MADE IN USA REV G
+ ADJUST FOR 2V ON BLACK
+ WILL BE LESS THAN 1V ON WHITE
+
+Etched in copper on CPU board FP 4X-1280 COMPUTER REV A FOR-PLAY
+ MADE IN USA
+
+Etched in copper on back of driver board BIO-RHYTHM DRIVER
+ REV E
+ FOR-PLAY
+ MADE IN USA
+
+Etched in copper on back of little vertical board PHOTOCELL
+ AUTO
+ ADJUST
+
+Second PCB:
+
+Etched in copper on main board BIO-RHYTHM LOGIC
+ FOR-PLAY MADE IN USA REV H
+
+Etched in copper on CPU board FP 4X-1280 COMPUTER REV A FOR-PLAY
+ MADE IN USA
+
+Etched in copper on back of driver board BIO-RHYTHM DRIVER
+ REV E
+ FOR-PLAY
+ MADE IN USA
+
+Main components:
+C4004 CPU
+P4002-1 RAM
+5x P4001 ROM
+various TTL chips
+*/
+
+
+#include "emu.h"
+
+#include "cpu/mcs40/mcs40.h"
+
+#include "speaker.h"
+
+
+namespace {
+
+class biorhythm_fp_state : public driver_device
+{
+public:
+ biorhythm_fp_state(const machine_config &mconfig, device_type type, const char *tag)
+ : driver_device(mconfig, type, tag),
+ m_maincpu(*this, "maincpu")
+ {
+ }
+
+ void biortmfp(machine_config &config) ATTR_COLD;
+
+private:
+ required_device<cpu_device> m_maincpu;
+
+ void memory_map(address_map &map) ATTR_COLD;
+ void rom_map(address_map &map) ATTR_COLD;
+ void status_map(address_map &map) ATTR_COLD;
+};
+
+
+void biorhythm_fp_state::rom_map(address_map &map)
+{
+ map(0x0000, 0x04ff).rom().region("maincpu", 0x0000);
+}
+
+void biorhythm_fp_state::memory_map(address_map &map)
+{
+ map(0x0000, 0x003f).ram();
+}
+
+void biorhythm_fp_state::status_map(address_map &map)
+{
+ map(0x0000, 0x000f).ram();
+}
+
+
+static INPUT_PORTS_START(biortmfp)
+ PORT_START("IN0")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
+INPUT_PORTS_END
+
+
+void biorhythm_fp_state::biortmfp(machine_config &config)
+{
+ i4040_cpu_device &cpu(I4040(config, "maincpu", 750'000)); // clock unknown
+ cpu.set_rom_map(&biorhythm_fp_state::rom_map);
+ cpu.set_ram_memory_map(&biorhythm_fp_state::memory_map);
+ cpu.set_ram_status_map(&biorhythm_fp_state::status_map);
+}
+
+
+ROM_START( biortmfp )
+ ROM_REGION( 0x500, "maincpu", 0 )
+ ROM_LOAD( "p4001_0846.0", 0x000, 0x100, CRC(bd483c96) SHA1(c73ca9446a5da4d78d9a918350db26a3071d2940) )
+ ROM_LOAD( "p4001_0848.1", 0x100, 0x100, CRC(9799470a) SHA1(b0ece482b3369cb8907554f509ca1c21424119d9) )
+ ROM_LOAD( "p4001_0849.2", 0x200, 0x100, CRC(81bea767) SHA1(b8d413916530bf55333a7bb69eaa9f478e456361) )
+ ROM_LOAD( "p4001_0847.3", 0x300, 0x100, CRC(eddf6e11) SHA1(01fac158e330b8c7f6336e9b66eeb20e535dc5b3) )
+ ROM_LOAD( "p4001_0850.4", 0x400, 0x100, CRC(6c66b740) SHA1(03013ee965c95d0e08830e3b95532b6430573909) )
+ROM_END
+
+} // anonymous namespace
+
+
+GAME( 197?, biortmfp, 0, biortmfp, biortmfp, biorhythm_fp_state, empty_init, ROT0, "For-Play", "Biorhythm (For-Play)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING )
diff --git a/src/mame/skeleton/ct909e_segadvd.cpp b/src/mame/skeleton/ct909e_segadvd.cpp
index c90c50476a7..67c8452cc32 100644
--- a/src/mame/skeleton/ct909e_segadvd.cpp
+++ b/src/mame/skeleton/ct909e_segadvd.cpp
@@ -104,8 +104,7 @@ void ct909e_megatrix_state::megatrix(machine_config &config)
m_screen->set_visarea(0, 320-1, 0, 240-1);
m_screen->set_screen_update(FUNC(ct909e_megatrix_state::screen_update));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
ROM_START( megatrix )
diff --git a/src/mame/skeleton/e100.cpp b/src/mame/skeleton/e100.cpp
index 6a6831f131b..14139420b5d 100644
--- a/src/mame/skeleton/e100.cpp
+++ b/src/mame/skeleton/e100.cpp
@@ -7,7 +7,7 @@
* See didact.cpp
*
* The Esselte 100 was an original design with a CRT and a full Keyboard that also had a BASIC interpreter
- * extended with commands suitable for educational experiments using the exapansion bus and its built in
+ * extended with commands suitable for educational experiments using the expansion bus and its built in
* io control capabilities.
*
* The Esselte 1000 was an educational package based on Apple II plus software and literature but the relation
@@ -29,17 +29,18 @@
****************************************************************************/
#include "emu.h"
+
+#include "bus/rs232/rs232.h"
#include "cpu/m6800/m6800.h"
+#include "imagedev/cassette.h"
#include "machine/6821pia.h"
#include "machine/74145.h"
#include "machine/timer.h"
-// Features
-#include "imagedev/cassette.h"
-#include "bus/rs232/rs232.h"
-#include "speaker.h"
#include "emupal.h"
#include "screen.h"
+#include "speaker.h"
+
//**************************************************************************
// MACROS / CONSTANTS
@@ -69,8 +70,6 @@
#define FUNCNAME __PRETTY_FUNCTION__
#endif
-#define PIA1_TAG "pia1"
-#define PIA2_TAG "pia2"
/* __________________________________________________________________________________________________________________________________________
* | The Didact Esselte 100 CPU board rev1, 14/8 1980 in-PCB coil +----
@@ -98,7 +97,7 @@
* |___________________________________________________________________________________________________________+----+__+----+__+----+_____+----
*
* rev2 board had 4Kb more ROM memory, 2 x 2764 instead of the 6 x 2716 (note the rev1 piggyback on rightmost 2716) with funny address decoding.
- * Once we get a rom dump for rev 1 the driver need to accomodate another keymap too so probably needs to be splitted somehow.
+ * Once we get a rom dump for rev 1 the driver need to accommodate another keymap too so probably needs to be split somehow.
* __________________________________________________________________________________________________________________________________________
* | The Didact Esselte 100 CPU board rev2, 15/4 1983 in-PCB coil +----
* | +--+ +--+ +--+ +--+ +--+ +--+ +--------+ |VHF
@@ -128,38 +127,31 @@
*/
- namespace {
+namespace {
-/* Esselte 100 driver class */
class e100_state : public driver_device
{
public:
e100_state(const machine_config &mconfig, device_type type, const char * tag)
: driver_device(mconfig, type, tag)
- ,m_maincpu(*this, "maincpu")
- ,m_kbd_74145(*this, "kbd_74145")
- ,m_vram(*this, "vram")
- ,m_cassette(*this, "cassette")
- ,m_rs232(*this, "rs232")
- ,m_chargen(*this, "chargen")
- ,m_io_line0(*this, "LINE0")
- ,m_io_line1(*this, "LINE1")
- ,m_io_line2(*this, "LINE2")
- ,m_io_line3(*this, "LINE3")
- ,m_io_line4(*this, "LINE4")
- ,m_io_line5(*this, "LINE5")
- ,m_io_line6(*this, "LINE6")
- ,m_io_line7(*this, "LINE7")
- ,m_io_line8(*this, "LINE8")
- ,m_io_line9(*this, "LINE9")
- ,m_pia1(*this, PIA1_TAG)
- ,m_pia2(*this, PIA2_TAG)
- ,m_pia1_B(0)
- ,m_50hz(0)
- { }
+ , m_maincpu(*this, "maincpu")
+ , m_kbd_74145(*this, "kbd_74145")
+ , m_vram(*this, "vram")
+ , m_cassette(*this, "cassette")
+ , m_rs232(*this, "rs232")
+ , m_chargen(*this, "chargen")
+ , m_io_line(*this, "LINE%u", 0)
+ , m_pia(*this, "pia%u", 1)
+ , m_pia1_B(0)
+ , m_50hz(0)
+ { }
void e100(machine_config &config);
+protected:
+ virtual void machine_reset() override { m_maincpu->reset(); LOG("--->%s()\n", FUNCNAME); };
+ virtual void machine_start() override ATTR_COLD;
+
private:
required_device<m6802_cpu_device> m_maincpu;
required_device<ttl74145_device> m_kbd_74145;
@@ -167,9 +159,11 @@ private:
required_device<cassette_image_device> m_cassette;
optional_device<rs232_port_device> m_rs232;
required_region_ptr<uint8_t> m_chargen;
+ required_ioport_array<10> m_io_line;
+ required_device_array<pia6821_device, 2> m_pia;
+
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- virtual void machine_reset() override { m_maincpu->reset(); LOG("--->%s()\n", FUNCNAME); };
- virtual void machine_start() override ATTR_COLD;
+
uint8_t pia_r(offs_t offset);
void pia_w(offs_t offset, uint8_t data);
uint8_t pia1_kbA_r();
@@ -178,28 +172,18 @@ private:
void pia1_kbB_w(uint8_t data);
void pia1_ca2_w(int state);
void pia1_cb2_w(int state);
+
TIMER_DEVICE_CALLBACK_MEMBER(rtc_w);
+
void e100_map(address_map &map) ATTR_COLD;
- required_ioport m_io_line0;
- required_ioport m_io_line1;
- required_ioport m_io_line2;
- required_ioport m_io_line3;
- required_ioport m_io_line4;
- required_ioport m_io_line5;
- required_ioport m_io_line6;
- required_ioport m_io_line7;
- required_ioport m_io_line8;
- required_ioport m_io_line9;
- required_device<pia6821_device> m_pia1;
- required_device<pia6821_device> m_pia2;
uint8_t m_pia1_B;
uint8_t m_50hz;
};
TIMER_DEVICE_CALLBACK_MEMBER(e100_state::rtc_w)
{
- m_pia2->ca1_w((m_50hz++ & 1));
+ m_pia[1]->ca1_w(m_50hz++ & 1);
}
void e100_state::machine_start()
@@ -213,37 +197,20 @@ void e100_state::machine_start()
uint32_t e100_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- int x, y;
- int vramad;
- uint8_t *chardata;
- uint8_t charcode;
-
LOGSCREEN("%s()\n", FUNCNAME);
- vramad = 0;
- for (int row = 0; row < 32 * 8; row += 8)
+ for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
{
- for (int col = 0; col < 32 * 8; col += 8)
+ uint16_t vram_addr = (y >> 3) * 32;
+
+ for (int col = 0; col < 32 * 6; col += 6)
{
- /* look up the character data */
- charcode = m_vram[vramad];
- if (VERBOSE && charcode != 0x20 && charcode != 0) LOGSCREEN("\n %c at X=%d Y=%d: ", charcode, col, row);
- chardata = &m_chargen[(charcode * 8)];
- /* plot the character */
- for (y = 0; y < 8; y++)
+ for (int x = 0; x < 6; x++)
{
- if (VERBOSE && charcode != 0x20 && charcode != 0) LOGSCREEN("\n %02x: ", *chardata);
- for (x = 0; x < 8; x++)
- {
- if (VERBOSE && charcode != 0x20 && charcode != 0) LOGSCREEN(" %02x: ", *chardata);
- bitmap.pix(row + y, col + x) = (*chardata & (1 << x)) ? 1 : 0;
- }
- chardata++;
+ bitmap.pix(y, col + x) = BIT(m_chargen[(m_vram[vram_addr] << 3) | (y & 7)], x);
}
- vramad++;
+ vram_addr++;
}
- if (VERBOSE && charcode != 0x20 && charcode != 0) LOGSCREEN("\n");
}
-
return 0;
}
@@ -254,12 +221,12 @@ void e100_state::pia_w(offs_t offset, uint8_t data)
if ((offset & 0x08) == 0x08)
{
LOG("- PIA1\n");
- m_pia1->write(offset, data);
+ m_pia[0]->write(offset, data);
}
if ((offset & 0x10) == 0x10)
{
LOG("- PIA2\n");
- m_pia2->write(offset, data);
+ m_pia[1]->write(offset, data);
}
if (VERBOSE && (offset & 0x18) == 0x18)
{
@@ -280,23 +247,24 @@ uint8_t e100_state::pia_r(offs_t offset)
{
case 0x18: // read PIA1 and PIA2 at the same time, should really only happen for writes...
{
- uint8_t data1 = m_pia1->read(offset);
- uint8_t data2 = m_pia2->read(offset);
+ uint8_t data1 = m_pia[0]->read(offset);
+ uint8_t data2 = m_pia[1]->read(offset);
logerror("%s: Dual device read may have caused unpredictable results on real hardware\n", FUNCNAME);
data = data1 & data2; // We assume that the stable behaviour is that data lines with a low level by either device succeeds
- LOGCS("%s %s[%02x] %02x & %02x -> %02x Dual device read!!\n", PIA1_TAG "/" PIA2_TAG, FUNCNAME, offset, data1, data2, data);
+ LOGCS("%s %s[%02x] %02x & %02x -> %02x Dual device read!!\n", "pia1/pia2", FUNCNAME, offset, data1, data2, data);
}
break;
case 0x08: // PIA1
- data = m_pia1->read(offset);
- LOGCS("%s %s(%02x)\n", PIA1_TAG, FUNCNAME, data);
+ data = m_pia[0]->read(offset);
+ LOGCS("%s %s(%02x)\n", "pia1", FUNCNAME, data);
break;
case 0x10: // PIA2
- data = m_pia2->read(offset);
- LOGCS("%s %s(%02x)\n", PIA2_TAG, FUNCNAME, data);
+ data = m_pia[1]->read(offset);
+ LOGCS("%s %s(%02x)\n", "pia2", FUNCNAME, data);
break;
default: // None of the devices are selected
logerror("%s: Funny read at offset %02x\n", FUNCNAME, offset);
+ break;
}
return data;
}
@@ -308,31 +276,24 @@ void e100_state::pia1_kbA_w(uint8_t data)
uint8_t e100_state::pia1_kbA_r()
{
- int ls145;
- uint8_t pa = 0x00;
+ uint16_t ls145;
+ uint8_t pa = 0xff;
// Read out the selected column
ls145 = m_kbd_74145->read() & 0x3ff;
- // read out the artwork
- switch (ls145)
+ // read out the keyboard
+ for (int i = 0; i < 10; i++)
{
- case 0: pa = 0x00; break;
- case 1 << 0: pa = (~m_io_line0->read()) & 0xff; break;
- case 1 << 1: pa = (~m_io_line1->read()) & 0xff; break;
- case 1 << 2: pa = (~m_io_line2->read()) & 0xff; break;
- case 1 << 3: pa = (~m_io_line3->read()) & 0xff; break;
- case 1 << 4: pa = (~m_io_line4->read()) & 0xff; break;
- case 1 << 5: pa = (~m_io_line5->read()) & 0xff; break;
- case 1 << 6: pa = (~m_io_line6->read()) & 0xff; break;
- case 1 << 7: pa = (~m_io_line7->read()) & 0xff; break;
- case 1 << 8: pa = (~m_io_line8->read()) & 0xff; break;
- case 1 << 9: pa = (~m_io_line9->read()) & 0xff; break;
- default: logerror("Keyboard is misconfigured, please report!: %04x", ls145); break;
+ if (BIT(ls145, i))
+ {
+ pa = (m_io_line[i]->read()) & 0xff;
+ break;
+ }
}
if (VERBOSE && ls145 && pa) LOGSCAN("%s [%03x]%04x\n", FUNCNAME, ls145, pa);
- return ~pa;
+ return pa;
}
/*
@@ -343,7 +304,7 @@ uint8_t e100_state::pia1_kbA_r()
The serial bitbanging performs unreliably atm, can be poor original code or inexact CPU timing.
Best results is achieved with 8 bit at 9600 baud as follows:
- mame e100 -window -rs232 null_modem -bitbngr socket.127.0.0.1:4321
+ mame e100 -rs232 null_modem -bitbngr socket.127.0.0.1:4321
Start the favourite Telnet client towards the 4321 port and exit the startup screen of MAME.
At the "Esselte 100 #" prompt change to 8 bit communication and start the terminal mode:
@@ -356,7 +317,7 @@ uint8_t e100_state::pia1_kbA_r()
it receives a carriage return from the terminal at which point it will start sending again.
TODO:
- - Fix key mapping of the Ctl-PI exit sequence to get out of the TERM mode.
+ - Fix key mapping of the Ctrl-PI exit sequence to get out of the TERM mode.
- Fix timing issues for the PIA bit banging, could be related to that the CPU emulation is not
cycle exact or the ROM code is buggy
*/
@@ -367,13 +328,10 @@ uint8_t e100_state::pia1_kbA_r()
#define CASS_IN 0x80
void e100_state::pia1_kbB_w(uint8_t data)
{
- uint8_t col;
-
// Keyboard
// if (VERBOSE && data != m_pia1_B) LOGSCAN("%s(%02x)\n", FUNCNAME, data);
m_pia1_B = data;
- col = data & 0x0f;
- m_kbd_74145->write( col );
+ m_kbd_74145->write(data & 0x0f);
// Cassette
m_cassette->output(data & CASS_OUT ? 1.0 : -1.0);
@@ -395,7 +353,7 @@ uint8_t e100_state::pia1_kbB_r()
void e100_state::pia1_ca2_w(int state)
{
- // TODO: Make this a slot device to trigger time meassurements
+ // TODO: Make this a slot device to trigger time measurements
}
void e100_state::pia1_cb2_w(int state)
@@ -403,13 +361,13 @@ void e100_state::pia1_cb2_w(int state)
m_rs232->write_txd(!state);
}
-// This map is derived from info in "TEMAL 100 - teknisk manual Esselte 100"
+// This map is derived from info in "TEMAL 100 - Teknisk manual Esselte 100"
void e100_state::e100_map(address_map &map)
{
map(0x0000, 0x1fff).ram();
map(0x8000, 0x87ff).rom().region("roms", 0);
map(0xc000, 0xc3ff).ram().share(m_vram);
- map(0xc800, 0xc81f).rw(FUNC(e100_state::pia_r), FUNC(e100_state::pia_w)).mirror(0x07e0);
+ map(0xc800, 0xc81f).mirror(0x07e0).rw(FUNC(e100_state::pia_r), FUNC(e100_state::pia_w));
map(0xd000, 0xffff).rom().region("roms", 0x1000);
}
@@ -417,18 +375,18 @@ void e100_state::e100_map(address_map &map)
* Four e100 keys are not mapped yet,
* - The redundant '*' on the keyboard together with the '\'' single quote, both on same e100 key
* - The 'E' key on the keypad, presumably used for calculator applications to remove the last entered number
- * - The 'Break' key on rev2 will be mapped to NMI at some point, a recomended modification of the rev1 mother board
+ * - The 'Break' key on rev2 will be mapped to NMI at some point, a recommended modification of the rev1 mother board
* - The 'REPT' key has a so far unknown function
*/
static INPUT_PORTS_START( e100 )
-/* Bits read on PIA1 A when issueing line number on PIA1 B bits 0-3 through a 74145 demultiplexer */
+/* Bits read on PIA1 A when issuing line number on PIA1 B bits 0-3 through a 74145 demultiplexer */
PORT_START("LINE0")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2)
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REPT") /* Not mapped yet */
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REPT") PORT_CODE(KEYCODE_TAB)
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
@@ -453,43 +411,43 @@ static INPUT_PORTS_START( e100 )
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*')
PORT_START("LINE3")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(0xF6) PORT_CHAR(0xD6)
+ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(U'ö') PORT_CHAR(U'Ö')
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':')
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L')
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O')
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR(')') PORT_CHAR('9')
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')')
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P')
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=')
PORT_START("LINE4")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0xE4) PORT_CHAR(0xC4)
+ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(U'ä') PORT_CHAR(U'Ä')
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('-') PORT_CHAR('_')
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';')
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K')
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I')
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(')
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0xE5) PORT_CHAR(0xC5)
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(U'å') PORT_CHAR(U'Å')
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') PORT_CHAR('?')
PORT_START("LINE5")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("'/*") /* No good mapping */
+ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\'') PORT_CHAR('*')
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M')
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J')
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U')
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/')
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('^')
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PI") PORT_CODE(KEYCODE_ESC) PORT_CHAR(0x27)
+ PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(u8"π") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27)
PORT_START("LINE6")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_CHAR(UCHAR_MAMEKEY(UP))
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
+ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(u8"\u2190 \u2191") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_CHAR(UCHAR_MAMEKEY(UP)) // U+2190 = ←, U+2191 = ↑
+ PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(u8"\u2192 \u2193") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(DOWN))// U+2192 = →, U+2193 = ↓
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N')
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H')
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y')
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('&') PORT_CHAR('6')
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r')
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&')
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r')
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('<') PORT_CHAR('>')
PORT_START("LINE7")
@@ -504,7 +462,7 @@ static INPUT_PORTS_START( e100 )
PORT_START("LINE8")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD))
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(STOP))
+ PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(STOP))
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V')
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F')
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R')
@@ -513,8 +471,8 @@ static INPUT_PORTS_START( e100 )
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD))
PORT_START("LINE9")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD))
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad E") /* No good mapping */
+ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD))
+ PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad E") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD))
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C')
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D')
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E')
@@ -525,7 +483,7 @@ INPUT_PORTS_END
void e100_state::e100(machine_config &config)
{
- M6802(config, m_maincpu, XTAL(4'000'000));
+ M6802(config, m_maincpu, 4_MHz_XTAL);
m_maincpu->set_ram_enable(false);
m_maincpu->set_addrmap(AS_PROGRAM, &e100_state::e100_map);
@@ -547,26 +505,26 @@ void e100_state::e100(machine_config &config)
/* 0xF894 0xC818 (PIA2 Control A) = 0x34 - CA2 is low and lock DDRA */
/* 0xF896 0xC818 (PIA1 Control B) = 0x34 - CB2 is low and lock DDRB */
/* 0xF896 0xC818 (PIA2 Control B) = 0x34 - CB2 is low and lock DDRB */
- PIA6821(config, m_pia1);
- m_pia1->writepa_handler().set(FUNC(e100_state::pia1_kbA_w));
- m_pia1->readpa_handler().set(FUNC(e100_state::pia1_kbA_r));
- m_pia1->writepb_handler().set(FUNC(e100_state::pia1_kbB_w));
- m_pia1->readpb_handler().set(FUNC(e100_state::pia1_kbB_r));
- m_pia1->ca1_w(ASSERT_LINE); // TODO: Make this a slot device for time meassurements. Default is handshake for serial port TODO: Fix RS 232 handshake as default
- m_pia1->ca2_handler().set(FUNC(e100_state::pia1_ca2_w));
- m_pia1->cb2_handler().set(FUNC(e100_state::pia1_cb2_w));
+ PIA6821(config, m_pia[0]);
+ m_pia[0]->writepa_handler().set(FUNC(e100_state::pia1_kbA_w));
+ m_pia[0]->readpa_handler().set(FUNC(e100_state::pia1_kbA_r));
+ m_pia[0]->writepb_handler().set(FUNC(e100_state::pia1_kbB_w));
+ m_pia[0]->readpb_handler().set(FUNC(e100_state::pia1_kbB_r));
+ m_pia[0]->ca1_w(ASSERT_LINE); // TODO: Make this a slot device for time measurements. Default is handshake for serial port TODO: Fix RS232 handshake as default
+ m_pia[0]->ca2_handler().set(FUNC(e100_state::pia1_ca2_w));
+ m_pia[0]->cb2_handler().set(FUNC(e100_state::pia1_cb2_w));
/* The optional second PIA enables the expansion port on CA1 and a software RTC with 50Hz resolution */
- PIA6821(config, m_pia2);
- m_pia2->irqa_handler().set_inputline("maincpu", M6800_IRQ_LINE);
+ PIA6821(config, m_pia[1]);
+ m_pia[1]->irqa_handler().set_inputline("maincpu", M6800_IRQ_LINE);
/* Serial port support */
RS232_PORT(config, m_rs232, default_rs232_devices, nullptr);
- m_rs232->rxd_handler().set(m_pia1, FUNC(pia6821_device::cb1_w));
+ m_rs232->rxd_handler().set(m_pia[0], FUNC(pia6821_device::cb1_w));
SPEAKER(config, "mono").front_center();
/* Cassette support - E100 uses 300 baud Kansas City Standard with 1200/2400 Hz modulation */
- /* NOTE on usage: mame e100 -window -cass <wav file> -ui_active
+ /* NOTE on usage: mame e100 -cass <wav file>
* Once running enable/disable internal UI by pressing Scroll Lock in case it interferes with target keys
* Open the internal UI by pressing TAB and then select 'Tape Control' or use F2/Shift F2 for PLAY/PAUSE
* In order to use a wav file it has first to be created using TAB and select the 'File manager'
@@ -579,7 +537,7 @@ void e100_state::e100(machine_config &config)
/* screen TODO: simplify the screen config, look at zx.cpp */
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
- screen.set_raw(XTAL(4'000'000)/2, 265, 0, 265, 265, 0, 265);
+ screen.set_raw(4_MHz_XTAL, 265, 0, 256, 265, 0, 256);
screen.set_screen_update(FUNC(e100_state::screen_update));
screen.set_palette("palette");
PALETTE(config, "palette", palette_device::MONOCHROME);
@@ -602,7 +560,7 @@ ROM_START( e100 )
ROMX_LOAD( "e100r1u205.bin", 0x3000, 0x0800, NO_DUMP, ROM_BIOS(0) )
ROMX_LOAD( "e100r1u206.bin", 0x3800, 0x0800, NO_DUMP, ROM_BIOS(0) )
- /* This is a prototype ROM, commercial relase not verified. The prototype also have different keyboard and supports
+ /* This is a prototype ROM, commercial release not verified. The prototype also have different keyboard and supports
more ram so might need to be split out as a clone later */
ROM_SYSTEM_BIOS(1, "rev2-basic", "Esselte 100 rev2 BASIC")
ROMX_LOAD( "e100r2u201.bin", 0x0000, 0x2000, CRC(53513b67) SHA1(a91c5c32aead82dcc87db5d818ff286a7fc6a5c8), ROM_BIOS(1) )
diff --git a/src/mame/skeleton/easy_karaoke.cpp b/src/mame/skeleton/easy_karaoke.cpp
index a69b987f4e1..3f2a60ad2a3 100644
--- a/src/mame/skeleton/easy_karaoke.cpp
+++ b/src/mame/skeleton/easy_karaoke.cpp
@@ -212,8 +212,7 @@ void ivl_karaoke_state::ivl_karaoke_base(machine_config &config)
m_screen->set_visarea(0, 320-1, 0, 240-1);
m_screen->set_screen_update(FUNC(ivl_karaoke_state::screen_update));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
void easy_karaoke_cartslot_state::easy_karaoke(machine_config &config)
diff --git a/src/mame/skeleton/epoch_tv_globe.cpp b/src/mame/skeleton/epoch_tv_globe.cpp
index e8dde4bf09d..569761c456b 100644
--- a/src/mame/skeleton/epoch_tv_globe.cpp
+++ b/src/mame/skeleton/epoch_tv_globe.cpp
@@ -89,8 +89,7 @@ void epoch_tv_globe_state::epoch_tv_globe(machine_config &config)
m_screen->set_visarea(0, 320-1, 0, 240-1);
m_screen->set_screen_update(FUNC(epoch_tv_globe_state::screen_update));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
ROM_START( eptvglob )
diff --git a/src/mame/skeleton/koto_zevio.cpp b/src/mame/skeleton/koto_zevio.cpp
index 2fdeecae0a1..44d6213e984 100644
--- a/src/mame/skeleton/koto_zevio.cpp
+++ b/src/mame/skeleton/koto_zevio.cpp
@@ -92,8 +92,7 @@ void zevio_state::zevio(machine_config &config)
m_screen->set_visarea(0, 320-1, 0, 240-1);
m_screen->set_screen_update(FUNC(zevio_state::screen_update));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
diff --git a/src/mame/skeleton/leadsinger2.cpp b/src/mame/skeleton/leadsinger2.cpp
index 9fb032b84f9..77fdc2bf420 100644
--- a/src/mame/skeleton/leadsinger2.cpp
+++ b/src/mame/skeleton/leadsinger2.cpp
@@ -109,8 +109,7 @@ void leadsng2_state::leadsng2(machine_config &config)
m_screen->set_visarea(0, 320-1, 0, 240-1);
m_screen->set_screen_update(FUNC(leadsng2_state::screen_update));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
ROM_START( leadsng2 )
diff --git a/src/mame/skeleton/mini2440.cpp b/src/mame/skeleton/mini2440.cpp
index 923b58dfbb4..b01ec5b1073 100644
--- a/src/mame/skeleton/mini2440.cpp
+++ b/src/mame/skeleton/mini2440.cpp
@@ -241,10 +241,9 @@ void mini2440_state::mini2440(machine_config &config)
screen.set_visarea(0, 239, 0, 319);
screen.set_screen_update("s3c2440", FUNC(s3c2440_device::screen_update));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
- UDA1341TS(config, m_ldac, 0).add_route(ALL_OUTPUTS, "lspeaker", 1.0); // uda1341ts.u12
- UDA1341TS(config, m_rdac, 0).add_route(ALL_OUTPUTS, "rspeaker", 1.0); // uda1341ts.u12
+ SPEAKER(config, "speaker", 2).front();
+ UDA1341TS(config, m_ldac, 0).add_route(ALL_OUTPUTS, "speaker", 1.0, 0); // uda1341ts.u12
+ UDA1341TS(config, m_rdac, 0).add_route(ALL_OUTPUTS, "speaker", 1.0, 1); // uda1341ts.u12
S3C2440(config, m_s3c2440, 12000000);
m_s3c2440->set_palette_tag("palette");
diff --git a/src/mame/skeleton/picno.cpp b/src/mame/skeleton/picno.cpp
index 1d559e87841..44387bcaf1c 100644
--- a/src/mame/skeleton/picno.cpp
+++ b/src/mame/skeleton/picno.cpp
@@ -70,10 +70,9 @@ void picno_state::picno(machine_config &config)
HD6435328(config, m_maincpu, 20'000'000); // TODO: clock is a guess, divided by 2 in the cpu
m_maincpu->set_addrmap(AS_PROGRAM, &picno_state::mem_map);
- //SPEAKER(config, "lspeaker").front_left(); // no speaker in the unit, but there's a couple of sockets on the back
- //SPEAKER(config, "rspeaker").front_right();
- //sound.add_route(0, "lspeaker", 1.0);
- //sound.add_route(1, "rspeaker", 1.0);
+ //SPEAKER(config, "speaker", 2).front(); // no speaker in the unit, but there's a couple of sockets on the back
+ //sound.add_route(0, "speaker", 1.0, 0);
+ //sound.add_route(1, "speaker", 1.0, 1);
GENERIC_CARTSLOT(config, "cartslot", generic_linear_slot, "picno_cart");
diff --git a/src/mame/skeleton/sartorius.cpp b/src/mame/skeleton/sartorius.cpp
index 0e3680302e1..4e54c789db0 100644
--- a/src/mame/skeleton/sartorius.cpp
+++ b/src/mame/skeleton/sartorius.cpp
@@ -12,7 +12,7 @@
* National Semiconductor MM74C907N hex open-drain P-channel buffer
* Intersil IM6561AIJN 256*4 CMOS RAM
* RCA CD4007AE dual complementary pair plus inverter
- * National Semicondictor CD4049CN hex inverting buffer
+ * National Semiconductor CD4049CN hex inverting buffer
* Intel P4201A clock generator
* 4 * Motorola MC14099B 8-bit addressable latch
* 2 * RCA CD4052BE 2-channel 4:1 analog switch
diff --git a/src/mame/snk/bbusters.cpp b/src/mame/snk/bbusters.cpp
index 52020c6bd93..114fab322f6 100644
--- a/src/mame/snk/bbusters.cpp
+++ b/src/mame/snk/bbusters.cpp
@@ -517,18 +517,17 @@ void bbusters_state::bbusters(machine_config &config)
BUFFERED_SPRITERAM16(config, m_spriteram[1]);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch[0]);
GENERIC_LATCH_8(config, m_soundlatch[1]);
ym2610_device &ymsnd(YM2610(config, "ymsnd", 8000000));
ymsnd.irq_handler().set_inputline("audiocpu", 0);
- ymsnd.add_route(0, "lspeaker", 1.0);
- ymsnd.add_route(0, "rspeaker", 1.0);
- ymsnd.add_route(1, "lspeaker", 1.0);
- ymsnd.add_route(2, "rspeaker", 1.0);
+ ymsnd.add_route(0, "speaker", 1.0, 0);
+ ymsnd.add_route(0, "speaker", 1.0, 1);
+ ymsnd.add_route(1, "speaker", 1.0, 0);
+ ymsnd.add_route(2, "speaker", 1.0, 1);
}
/******************************************************************************/
diff --git a/src/mame/snk/hng64_a.cpp b/src/mame/snk/hng64_a.cpp
index d17d840cbc6..37ea9fa31d3 100644
--- a/src/mame/snk/hng64_a.cpp
+++ b/src/mame/snk/hng64_a.cpp
@@ -399,10 +399,9 @@ void hng64_state::hng64_audio(machine_config &config)
m_audiocpu->tout_handler<1>().set(FUNC(hng64_state::tcu_tm1_cb));
m_audiocpu->tout_handler<2>().set(FUNC(hng64_state::tcu_tm2_cb));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
L7A1045(config, m_dsp, 32000000/2); // ??
- m_dsp->add_route(0, "lspeaker", 0.1);
- m_dsp->add_route(1, "rspeaker", 0.1);
+ m_dsp->add_route(0, "speaker", 0.1, 0);
+ m_dsp->add_route(1, "speaker", 0.1, 1);
}
diff --git a/src/mame/snk/mechatt.cpp b/src/mame/snk/mechatt.cpp
index 40fa134705e..3f03948f0c9 100644
--- a/src/mame/snk/mechatt.cpp
+++ b/src/mame/snk/mechatt.cpp
@@ -516,18 +516,17 @@ void mechatt_state::mechatt(machine_config &config)
m_sprites->set_spriteram_tag("spriteram");
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch[0]);
GENERIC_LATCH_8(config, m_soundlatch[1]);
ym2608_device &ymsnd(YM2608(config, "ymsnd", 8000000));
ymsnd.irq_handler().set_inputline("audiocpu", 0);
- ymsnd.add_route(0, "lspeaker", 0.45);
- ymsnd.add_route(0, "rspeaker", 0.45);
- ymsnd.add_route(1, "lspeaker", 0.80);
- ymsnd.add_route(2, "rspeaker", 0.80);
+ ymsnd.add_route(0, "speaker", 0.45, 0);
+ ymsnd.add_route(0, "speaker", 0.45, 1);
+ ymsnd.add_route(1, "speaker", 0.80, 0);
+ ymsnd.add_route(2, "speaker", 0.80, 1);
}
/******************************************************************************/
diff --git a/src/mame/snk/ngp.cpp b/src/mame/snk/ngp.cpp
index 4573a5bceb9..2a02f528ff5 100644
--- a/src/mame/snk/ngp.cpp
+++ b/src/mame/snk/ngp.cpp
@@ -865,15 +865,14 @@ void ngp_state::ngp_common(machine_config &config)
m_screen->set_raw(6.144_MHz_XTAL, 515, 0, 160 /*480*/, 199, 0, 152);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
T6W28(config, m_t6w28, 6.144_MHz_XTAL/2);
- m_t6w28->add_route(0, "lspeaker", 0.50);
- m_t6w28->add_route(1, "rspeaker", 0.50);
+ m_t6w28->add_route(0, "speaker", 0.50, 0);
+ m_t6w28->add_route(1, "speaker", 0.50, 1);
- DAC_8BIT_R2R(config, m_ldac, 0).add_route(ALL_OUTPUTS, "lspeaker", 0.25); // unknown DAC
- DAC_8BIT_R2R(config, m_rdac, 0).add_route(ALL_OUTPUTS, "rspeaker", 0.25); // unknown DAC
+ DAC_8BIT_R2R(config, m_ldac, 0).add_route(ALL_OUTPUTS, "speaker", 0.25, 0); // unknown DAC
+ DAC_8BIT_R2R(config, m_rdac, 0).add_route(ALL_OUTPUTS, "speaker", 0.25, 1); // unknown DAC
}
diff --git a/src/mame/snk/snk6502_a.cpp b/src/mame/snk/snk6502_a.cpp
index 70c6618f09c..e6c847f9776 100644
--- a/src/mame/snk/snk6502_a.cpp
+++ b/src/mame/snk/snk6502_a.cpp
@@ -512,14 +512,12 @@ void snk6502_sound_device::speech_w(uint8_t data, const uint16_t *table, int sta
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void snk6502_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void snk6502_sound_device::sound_stream_update(sound_stream &stream)
{
- auto &buffer = outputs[0];
-
for (int i = 0; i < NUM_CHANNELS; i++)
validate_tone_channel(i);
- for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
int32_t data = 0;
@@ -541,7 +539,7 @@ void snk6502_sound_device::sound_stream_update(sound_stream &stream, std::vector
}
}
- buffer.put_int(sampindex, data, 3768);
+ stream.put_int(0, sampindex, data, 3768);
m_tone_clock += FRAC_ONE;
if (m_tone_clock >= m_tone_clock_expire)
diff --git a/src/mame/snk/snk6502_a.h b/src/mame/snk/snk6502_a.h
index 02b4c76b5b1..cbdeb03bbea 100644
--- a/src/mame/snk/snk6502_a.h
+++ b/src/mame/snk/snk6502_a.h
@@ -40,7 +40,7 @@ protected:
virtual void device_start() 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;
private:
static constexpr unsigned NUM_CHANNELS = 3;
diff --git a/src/mame/sony/psx.cpp b/src/mame/sony/psx.cpp
index 4ffed3c4216..dce49952c21 100644
--- a/src/mame/sony/psx.cpp
+++ b/src/mame/sony/psx.cpp
@@ -518,11 +518,10 @@ void psx1_state::psx_base(machine_config &config)
SCREEN(config, "screen", SCREEN_TYPE_RASTER);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
spu_device &spu(SPU(config, "spu", XTAL(67'737'600)/2, m_maincpu.target()));
- spu.add_route(0, "lspeaker", 1.00);
- spu.add_route(1, "rspeaker", 1.00);
+ spu.add_route(0, "speaker", 1.00, 0);
+ spu.add_route(1, "speaker", 1.00, 1);
QUICKLOAD(config, "quickload", "cpe,exe,psf,psx").set_load_callback(FUNC(psx1_state::quickload_exe));
diff --git a/src/mame/sony/taito_zm.cpp b/src/mame/sony/taito_zm.cpp
index 762a3e9658f..4df10aa5e47 100644
--- a/src/mame/sony/taito_zm.cpp
+++ b/src/mame/sony/taito_zm.cpp
@@ -42,7 +42,7 @@ DEFINE_DEVICE_TYPE(TAITO_ZOOM, taito_zoom_device, "taito_zoom", "Taito Zoom Soun
taito_zoom_device::taito_zoom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, TAITO_ZOOM, tag, owner, clock),
- device_mixer_interface(mconfig, *this, 2),
+ device_mixer_interface(mconfig, *this),
m_soundcpu(*this, "mn10200"),
m_tms57002(*this, "tms57002"),
m_zsg2(*this, "zsg2"),
@@ -198,8 +198,8 @@ void taito_zoom_device::device_add_mconfig(machine_config &config)
m_tms57002->empty_callback().set_inputline(m_soundcpu, MN10200_IRQ1).invert();
m_tms57002->set_addrmap(AS_DATA, &taito_zoom_device::tms57002_map);
- m_tms57002->add_route(2, *this, 1.0, AUTO_ALLOC_INPUT, 0);
- m_tms57002->add_route(3, *this, 1.0, AUTO_ALLOC_INPUT, 1);
+ m_tms57002->add_route(2, *this, 1.0, 0);
+ m_tms57002->add_route(3, *this, 1.0, 1);
ZSG2(config, m_zsg2, XTAL(25'000'000));
m_zsg2->add_route(0, *m_tms57002, 0.5, 0); // reverb effect
diff --git a/src/mame/sony/taitogn.cpp b/src/mame/sony/taitogn.cpp
index f022cf346a3..e38d1053a81 100644
--- a/src/mame/sony/taitogn.cpp
+++ b/src/mame/sony/taitogn.cpp
@@ -435,13 +435,13 @@ protected:
ADDRESS_MAP_BANK(config, m_flashbank).set_map(&taitogn_state::flashbank_map).set_options(ENDIANNESS_LITTLE, 16, 32, 0x8000000);
m_spu->reset_routes();
- m_spu->add_route(0, "lspeaker", 0.3);
- m_spu->add_route(1, "rspeaker", 0.3);
+ m_spu->add_route(0, "speaker", 0.3, 0);
+ m_spu->add_route(1, "speaker", 0.3, 1);
TAITO_ZOOM(config, m_zoom);
m_zoom->set_use_flash();
- m_zoom->add_route(0, "lspeaker", 1.0);
- m_zoom->add_route(1, "rspeaker", 1.0);
+ m_zoom->add_route(0, "speaker", 1.0, 0);
+ m_zoom->add_route(1, "speaker", 1.0, 1);
m_zoom->subdevice<zsg2_device>("zsg2")->ext_read().set(FUNC(taitogn_state::zsg2_ext_r));
}
diff --git a/src/mame/sony/zn.cpp b/src/mame/sony/zn.cpp
index eb8c7a536e0..394b76da2e4 100644
--- a/src/mame/sony/zn.cpp
+++ b/src/mame/sony/zn.cpp
@@ -54,7 +54,7 @@ zn_state::zn_state(const machine_config &mconfig, device_type type, const char *
m_spu(*this, "spu"),
m_gpu(*this, "gpu"),
m_screen(*this, "screen"),
- m_speaker(*this, { "lspeaker", "rspeaker" }),
+ m_speaker(*this, "speaker" ),
m_at28c16(*this, "at28c16"),
m_cat702(*this, "cat702_%u", 1),
m_ram(*this, "maincpu:ram"),
@@ -105,11 +105,10 @@ void zn_state::zn_base(machine_config &config)
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
- m_spu->add_route(0, m_speaker[0], 0.35);
- m_spu->add_route(1, m_speaker[1], 0.35);
+ m_spu->add_route(0, m_speaker, 0.35, 0);
+ m_spu->add_route(1, m_speaker, 0.35, 1);
- SPEAKER(config, m_speaker[0]).front_left();
- SPEAKER(config, m_speaker[1]).front_right();
+ SPEAKER(config, m_speaker, 2).front();
AT28C16(config, m_at28c16, 0);
@@ -579,8 +578,8 @@ protected:
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
QSOUND(config, m_qsound);
- m_qsound->add_route(0, m_speaker[0], 1.0);
- m_qsound->add_route(1, m_speaker[1], 1.0);
+ m_qsound->add_route(0, m_speaker, 1.0, 0);
+ m_qsound->add_route(1, m_speaker, 1.0, 1);
}
virtual void driver_start() override ATTR_COLD
@@ -966,10 +965,10 @@ public:
YM2610B(config, m_ym2610b, 16_MHz_XTAL / 2);
m_ym2610b->irq_handler().set_inputline(m_audiocpu, 0);
- m_ym2610b->add_route(0, m_speaker[0], 0.75);
- m_ym2610b->add_route(0, m_speaker[1], 0.75);
- m_ym2610b->add_route(1, m_speaker[0], 1.0);
- m_ym2610b->add_route(2, m_speaker[1], 1.0);
+ m_ym2610b->add_route(0, m_speaker, 0.75, 0);
+ m_ym2610b->add_route(0, m_speaker, 0.75, 1);
+ m_ym2610b->add_route(1, m_speaker, 1.0, 0);
+ m_ym2610b->add_route(2, m_speaker, 1.0, 1);
MB3773(config, m_mb3773);
@@ -1060,12 +1059,12 @@ protected:
MB3773(config, m_mb3773);
m_spu->reset_routes();
- m_spu->add_route(0, m_speaker[0], 0.3);
- m_spu->add_route(1, m_speaker[1], 0.3);
+ m_spu->add_route(0, m_speaker, 0.3, 0);
+ m_spu->add_route(1, m_speaker, 0.3, 1);
TAITO_ZOOM(config, m_zoom);
- m_zoom->add_route(0, m_speaker[0], 1.0);
- m_zoom->add_route(1, m_speaker[1], 1.0);
+ m_zoom->add_route(0, m_speaker, 1.0, 0);
+ m_zoom->add_route(1, m_speaker, 1.0, 1);
}
virtual void driver_start() override ATTR_COLD
@@ -1571,8 +1570,8 @@ public:
GENERIC_LATCH_8(config, m_soundlatch);
ymf271_device &ymf(YMF271(config, "ymf", XTAL(16'934'400)));
- ymf.add_route(0, m_speaker[0], 1.0);
- ymf.add_route(1, m_speaker[1], 1.0);
+ ymf.add_route(0, m_speaker, 1.0, 0);
+ ymf.add_route(1, m_speaker, 1.0, 1);
}
protected:
@@ -1666,8 +1665,8 @@ public:
GENERIC_LATCH_8(config, m_soundlatch);
okim6295_device &oki(OKIM6295(config, "oki", 1000000, okim6295_device::PIN7_LOW)); // clock frequency & pin 7 not verified
- oki.add_route(ALL_OUTPUTS, m_speaker[0], 1.0);
- oki.add_route(ALL_OUTPUTS, m_speaker[1], 1.0);
+ oki.add_route(ALL_OUTPUTS, m_speaker, 1.0, 0);
+ oki.add_route(ALL_OUTPUTS, m_speaker, 1.0, 1);
oki.set_addrmap(0, &beastrzrb_state::oki_map);
}
@@ -2242,8 +2241,8 @@ public:
ADDRESS_MAP_BANK(config, m_bankmap).set_map(&nbajamex_state::bank_map).set_options(ENDIANNESS_LITTLE, 32, 24, 0x800000);
ACCLAIM_RAX(config, m_rax, 0);
- m_rax->add_route(0, m_speaker[0], 1.0);
- m_rax->add_route(1, m_speaker[1], 1.0);
+ m_rax->add_route(0, m_speaker, 1.0, 0);
+ m_rax->add_route(1, m_speaker, 1.0, 1);
}
protected:
@@ -2502,13 +2501,13 @@ public:
m_soundlatch16->data_pending_callback().set_inputline(m_audiocpu, 3);
m_spu->reset_routes();
- m_spu->add_route(0, m_speaker[0], 0.175);
- m_spu->add_route(1, m_speaker[1], 0.175);
+ m_spu->add_route(0, m_speaker, 0.175, 0);
+ m_spu->add_route(1, m_speaker, 0.175, 1);
YMZ280B(config, m_ymz280b, XTAL(16'934'400));
m_ymz280b->irq_handler().set_inputline(m_audiocpu, 2);
- m_ymz280b->add_route(0, m_speaker[0], 0.35);
- m_ymz280b->add_route(1, m_speaker[1], 0.35);
+ m_ymz280b->add_route(0, m_speaker, 0.35, 0);
+ m_ymz280b->add_route(1, m_speaker, 0.35, 1);
}
protected:
@@ -2892,8 +2891,8 @@ public:
config.set_maximum_quantum(attotime::from_hz(6000));
YMZ280B(config, m_ymz280b, XTAL(16'934'400));
- m_ymz280b->add_route(0, m_speaker[0], 0.35);
- m_ymz280b->add_route(1, m_speaker[1], 0.35);
+ m_ymz280b->add_route(0, m_speaker, 0.35, 0);
+ m_ymz280b->add_route(1, m_speaker, 0.35, 1);
}
protected:
diff --git a/src/mame/sony/zn.h b/src/mame/sony/zn.h
index eb5704a18f6..c577011b853 100644
--- a/src/mame/sony/zn.h
+++ b/src/mame/sony/zn.h
@@ -52,7 +52,7 @@ protected:
required_device<spu_device> m_spu;
required_device<psxgpu_device> m_gpu;
required_device<screen_device> m_screen;
- required_device_array<speaker_device, 2> m_speaker;
+ required_device<speaker_device> m_speaker;
required_device<at28c16_device> m_at28c16;
optional_device_array<cat702_device, 2> m_cat702;
required_device<ram_device> m_ram;
diff --git a/src/mame/stern/cliffhgr.cpp b/src/mame/stern/cliffhgr.cpp
index 8d4b55bf18a..452f960b7dc 100644
--- a/src/mame/stern/cliffhgr.cpp
+++ b/src/mame/stern/cliffhgr.cpp
@@ -703,8 +703,8 @@ void cliffhgr_state::cliffhgr(machine_config &config)
PIONEER_PR8210(config, m_laserdisc, 0);
m_laserdisc->set_overlay(tms9928a_device::TOTAL_HORZ, tms9928a_device::TOTAL_VERT_NTSC, "tms9928a", FUNC(tms9928a_device::screen_update));
m_laserdisc->set_overlay_clip(tms9928a_device::HORZ_DISPLAY_START-12, tms9928a_device::HORZ_DISPLAY_START+32*8+12-1, tms9928a_device::VERT_DISPLAY_START_NTSC - 12, tms9928a_device::VERT_DISPLAY_START_NTSC+24*8+12-1);
- m_laserdisc->add_route(0, "lspeaker", 1.0);
- m_laserdisc->add_route(1, "rspeaker", 1.0);
+ m_laserdisc->add_route(0, "speaker", 1.0, 0);
+ m_laserdisc->add_route(1, "speaker", 1.0, 1);
/* start with the TMS9928a video configuration */
tms9128_device &vdp(TMS9128(config, "tms9928a", XTAL(10'738'635))); /* TMS9128NL on the board */
@@ -715,10 +715,9 @@ void cliffhgr_state::cliffhgr(machine_config &config)
m_laserdisc->add_ntsc_screen(config, "screen");
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- DISCRETE(config, m_discrete, cliffhgr_discrete).add_route(ALL_OUTPUTS, "lspeaker", 1.0);
+ DISCRETE(config, m_discrete, cliffhgr_discrete).add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
}
diff --git a/src/mame/suna/suna16.cpp b/src/mame/suna/suna16.cpp
index bae0c6936dc..0fdbd9b59b1 100644
--- a/src/mame/suna/suna16.cpp
+++ b/src/mame/suna/suna16.cpp
@@ -856,21 +856,20 @@ void suna16_state::bssoccer(machine_config &config)
PALETTE(config, m_palette).set_entries(512);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
GENERIC_LATCH_8(config, "soundlatch2");
GENERIC_LATCH_8(config, "soundlatch3");
ym2151_device &ymsnd(YM2151(config, "ymsnd", XTAL(14'318'181)/4)); /* 3.579545MHz */
- ymsnd.add_route(0, "lspeaker", 0.2);
- ymsnd.add_route(1, "rspeaker", 0.2);
+ ymsnd.add_route(0, "speaker", 0.2, 0);
+ ymsnd.add_route(1, "speaker", 0.2, 1);
- DAC_4BIT_R2R(config, "ldac", 0).add_route(ALL_OUTPUTS, "lspeaker", 0.2); // unknown DAC
- DAC_4BIT_R2R(config, "rdac", 0).add_route(ALL_OUTPUTS, "rspeaker", 0.2); // unknown DAC
- DAC_4BIT_R2R(config, "ldac2", 0).add_route(ALL_OUTPUTS, "lspeaker", 0.2); // unknown DAC
- DAC_4BIT_R2R(config, "rdac2", 0).add_route(ALL_OUTPUTS, "rspeaker", 0.2); // unknown DAC
+ DAC_4BIT_R2R(config, "ldac", 0).add_route(ALL_OUTPUTS, "speaker", 0.2, 0); // unknown DAC
+ DAC_4BIT_R2R(config, "rdac", 0).add_route(ALL_OUTPUTS, "speaker", 0.2, 1); // unknown DAC
+ DAC_4BIT_R2R(config, "ldac2", 0).add_route(ALL_OUTPUTS, "speaker", 0.2, 0); // unknown DAC
+ DAC_4BIT_R2R(config, "rdac2", 0).add_route(ALL_OUTPUTS, "speaker", 0.2, 1); // unknown DAC
}
@@ -912,18 +911,17 @@ void suna16_state::uballoon(machine_config &config)
PALETTE(config, m_palette).set_entries(512);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
GENERIC_LATCH_8(config, "soundlatch2");
ym2151_device &ymsnd(YM2151(config, "ymsnd", XTAL(14'318'181)/4)); /* 3.579545MHz */
- ymsnd.add_route(0, "lspeaker", 0.50);
- ymsnd.add_route(1, "rspeaker", 0.50);
+ ymsnd.add_route(0, "speaker", 0.50, 0);
+ ymsnd.add_route(1, "speaker", 0.50, 1);
- DAC_4BIT_R2R(config, "ldac", 0).add_route(ALL_OUTPUTS, "lspeaker", 0.25); // unknown DAC
- DAC_4BIT_R2R(config, "rdac", 0).add_route(ALL_OUTPUTS, "rspeaker", 0.25); // unknown DAC
+ DAC_4BIT_R2R(config, "ldac", 0).add_route(ALL_OUTPUTS, "speaker", 0.25, 0); // unknown DAC
+ DAC_4BIT_R2R(config, "rdac", 0).add_route(ALL_OUTPUTS, "speaker", 0.25, 1); // unknown DAC
}
@@ -964,18 +962,17 @@ void suna16_state::sunaq(machine_config &config)
PALETTE(config, m_palette).set_entries(512);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
GENERIC_LATCH_8(config, "soundlatch2");
ym2151_device &ymsnd(YM2151(config, "ymsnd", XTAL(14'318'181)/4)); /* 3.579545MHz */
- ymsnd.add_route(0, "lspeaker", 0.50);
- ymsnd.add_route(1, "rspeaker", 0.50);
+ ymsnd.add_route(0, "speaker", 0.50, 0);
+ ymsnd.add_route(1, "speaker", 0.50, 1);
- DAC_4BIT_R2R(config, "ldac", 0).add_route(ALL_OUTPUTS, "lspeaker", 0.25); // unknown DAC
- DAC_4BIT_R2R(config, "rdac", 0).add_route(ALL_OUTPUTS, "rspeaker", 0.25); // unknown DAC
+ DAC_4BIT_R2R(config, "ldac", 0).add_route(ALL_OUTPUTS, "speaker", 0.25, 0); // unknown DAC
+ DAC_4BIT_R2R(config, "rdac", 0).add_route(ALL_OUTPUTS, "speaker", 0.25, 1); // unknown DAC
}
@@ -1021,26 +1018,25 @@ void suna16_state::bestbest(machine_config &config)
PALETTE(config, m_palette).set_entries(256*8);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
GENERIC_LATCH_8(config, "soundlatch2");
ay8910_device &aysnd(AY8910(config, "aysnd", XTAL(24'000'000)/16)); /* 1.5MHz */
aysnd.port_a_write_callback().set(FUNC(suna16_state::bestbest_ay8910_port_a_w));
- aysnd.add_route(0, "lspeaker", 1.0);
- aysnd.add_route(1, "rspeaker", 1.0);
+ aysnd.add_route(0, "speaker", 1.0, 0);
+ aysnd.add_route(1, "speaker", 1.0, 1);
ym3526_device &ymsnd(YM3526(config, "ymsnd", XTAL(24'000'000)/8)); /* 3MHz */
ymsnd.irq_handler().set_inputline("audiocpu", INPUT_LINE_IRQ0);
- ymsnd.add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- ymsnd.add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ ymsnd.add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ ymsnd.add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
- DAC_4BIT_R2R(config, "ldac", 0).add_route(ALL_OUTPUTS, "lspeaker", 0.2); // unknown DAC
- DAC_4BIT_R2R(config, "rdac", 0).add_route(ALL_OUTPUTS, "rspeaker", 0.2); // unknown DAC
- DAC_4BIT_R2R(config, "ldac2", 0).add_route(ALL_OUTPUTS, "lspeaker", 0.2); // unknown DAC
- DAC_4BIT_R2R(config, "rdac2", 0).add_route(ALL_OUTPUTS, "rspeaker", 0.2); // unknown DAC
+ DAC_4BIT_R2R(config, "ldac", 0).add_route(ALL_OUTPUTS, "speaker", 0.2, 0); // unknown DAC
+ DAC_4BIT_R2R(config, "rdac", 0).add_route(ALL_OUTPUTS, "speaker", 0.2, 1); // unknown DAC
+ DAC_4BIT_R2R(config, "ldac2", 0).add_route(ALL_OUTPUTS, "speaker", 0.2, 0); // unknown DAC
+ DAC_4BIT_R2R(config, "rdac2", 0).add_route(ALL_OUTPUTS, "speaker", 0.2, 1); // unknown DAC
}
/***************************************************************************
diff --git a/src/mame/svision/svis_snd.cpp b/src/mame/svision/svis_snd.cpp
index 8a89e4e1880..587f4c28878 100644
--- a/src/mame/svision/svis_snd.cpp
+++ b/src/mame/svision/svis_snd.cpp
@@ -94,12 +94,9 @@ void svision_sound_device::device_start()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void svision_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void svision_sound_device::sound_stream_update(sound_stream &stream)
{
- auto &left = outputs[0];
- auto &right = outputs[1];
-
- for (int i = 0; i < left.samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
s32 lsum = 0;
s32 rsum = 0;
@@ -199,8 +196,8 @@ void svision_sound_device::sound_stream_update(sound_stream &stream, std::vector
m_irq_cb(1);
}
}
- left.put_int(i, lsum, 32768);
- right.put_int(i, rsum, 32768);
+ stream.put_int(0, i, lsum, 32768);
+ stream.put_int(1, i, rsum, 32768);
}
}
diff --git a/src/mame/svision/svis_snd.h b/src/mame/svision/svis_snd.h
index 29634596b15..18bc67f4d55 100644
--- a/src/mame/svision/svis_snd.h
+++ b/src/mame/svision/svis_snd.h
@@ -41,7 +41,7 @@ protected:
virtual void device_start() 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;
private:
struct NOISE
diff --git a/src/mame/svision/svision.cpp b/src/mame/svision/svision.cpp
index 2f7c65dd373..16982425abb 100644
--- a/src/mame/svision/svision.cpp
+++ b/src/mame/svision/svision.cpp
@@ -693,12 +693,11 @@ void svision_state::svision_base(machine_config &config)
{
config.set_default_layout(layout_svision);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
SVISION_SND(config, m_sound, 4'000'000, m_maincpu, m_bank[0]);
- m_sound->add_route(0, "lspeaker", 0.50);
- m_sound->add_route(1, "rspeaker", 0.50);
+ m_sound->add_route(0, "speaker", 0.50, 0);
+ m_sound->add_route(1, "speaker", 0.50, 1);
m_sound->irq_cb().set(FUNC(svision_state::sound_irq_w));
GENERIC_CARTSLOT(config, m_cart, generic_plain_slot, "svision_cart", "bin,ws,sv");
diff --git a/src/mame/taito/2mindril.cpp b/src/mame/taito/2mindril.cpp
index 3925f937357..093d42b9b7f 100644
--- a/src/mame/taito/2mindril.cpp
+++ b/src/mame/taito/2mindril.cpp
@@ -374,15 +374,14 @@ void _2mindril_state::drill(machine_config &config)
PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 0x2000);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2610b_device &ymsnd(YM2610B(config, "ymsnd", 16000000/2));
ymsnd.irq_handler().set(FUNC(_2mindril_state::irqhandler));
- ymsnd.add_route(0, "lspeaker", 0.75);
- ymsnd.add_route(0, "rspeaker", 0.75);
- ymsnd.add_route(1, "lspeaker", 1.0);
- ymsnd.add_route(2, "rspeaker", 1.0);
+ ymsnd.add_route(0, "speaker", 0.75, 0);
+ ymsnd.add_route(0, "speaker", 0.75, 1);
+ ymsnd.add_route(1, "speaker", 1.0, 0);
+ ymsnd.add_route(2, "speaker", 1.0, 1);
}
diff --git a/src/mame/taito/cpzodiac.cpp b/src/mame/taito/cpzodiac.cpp
index 7c1fbcc8702..4bbf275997b 100644
--- a/src/mame/taito/cpzodiac.cpp
+++ b/src/mame/taito/cpzodiac.cpp
@@ -190,15 +190,14 @@ void cpzodiac_state::cpzodiac(machine_config &config)
// TODO
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2610b_device &ymsnd(YM2610B(config, "ymsnd", 16_MHz_XTAL/2));
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
- ymsnd.add_route(0, "lspeaker", 0.75);
- ymsnd.add_route(0, "rspeaker", 0.75);
- ymsnd.add_route(1, "lspeaker", 1.0);
- ymsnd.add_route(2, "rspeaker", 1.0);
+ ymsnd.add_route(0, "speaker", 0.75, 0);
+ ymsnd.add_route(0, "speaker", 0.75, 1);
+ ymsnd.add_route(1, "speaker", 1.0, 0);
+ ymsnd.add_route(2, "speaker", 1.0, 1);
tc0140syt_device &syt(TC0140SYT(config, "syt", 0));
syt.nmi_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
diff --git a/src/mame/taito/darius.cpp b/src/mame/taito/darius.cpp
index d24bdb426c2..97336d5aaf3 100644
--- a/src/mame/taito/darius.cpp
+++ b/src/mame/taito/darius.cpp
@@ -971,8 +971,7 @@ void darius_state::darius(machine_config &config)
m_pc080sn->set_dblwidth(1);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2203_device &ym1(YM2203(config, "ym1", XTAL(8'000'000)/2)); /* 4 MHz */
ym1.irq_handler().set_inputline(m_audiocpu, 0); /* assumes Z80 sandwiched between 68Ks */
@@ -1009,13 +1008,13 @@ void darius_state::darius(machine_config &config)
{
for (int out = 0; out < 4; out++)
{
- FILTER_VOLUME(config, m_filter_l[chip][out]).add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- FILTER_VOLUME(config, m_filter_r[chip][out]).add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ FILTER_VOLUME(config, m_filter_l[chip][out]).add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ FILTER_VOLUME(config, m_filter_r[chip][out]).add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
}
}
- FILTER_VOLUME(config, m_msm5205_l).add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- FILTER_VOLUME(config, m_msm5205_r).add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ FILTER_VOLUME(config, m_msm5205_l).add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ FILTER_VOLUME(config, m_msm5205_r).add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
pc060ha_device &ciu(PC060HA(config, "ciu", 0));
ciu.nmi_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
diff --git a/src/mame/taito/dinoking.cpp b/src/mame/taito/dinoking.cpp
index ef367295c90..d61dd9c598f 100644
--- a/src/mame/taito/dinoking.cpp
+++ b/src/mame/taito/dinoking.cpp
@@ -163,12 +163,11 @@ void dinoking_state::dinoking(machine_config &config)
PALETTE(config, m_palette, palette_device::RGB_555);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
okim9810_device &oki(OKIM9810(config, "oki", XTAL(4'096'000)));
- oki.add_route(0, "lspeaker", 0.80);
- oki.add_route(1, "rspeaker", 0.80);
+ oki.add_route(0, "speaker", 0.80, 0);
+ oki.add_route(1, "speaker", 0.80, 1);
}
diff --git a/src/mame/taito/galastrm.cpp b/src/mame/taito/galastrm.cpp
index 7b0610b3a00..f61ee90982f 100644
--- a/src/mame/taito/galastrm.cpp
+++ b/src/mame/taito/galastrm.cpp
@@ -870,12 +870,11 @@ void galastrm_state::galastrm(machine_config &config)
TC0110PCR(config, m_tc0110pcr, 0);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
taito_en_device &taito_en(TAITO_EN(config, "taito_en", 0));
- taito_en.add_route(0, "lspeaker", 1.0);
- taito_en.add_route(1, "rspeaker", 1.0);
+ taito_en.add_route(0, "speaker", 1.0, 0);
+ taito_en.add_route(1, "speaker", 1.0, 1);
}
diff --git a/src/mame/taito/groundfx.cpp b/src/mame/taito/groundfx.cpp
index 8c54c18ef5a..64e8e6ed0b6 100644
--- a/src/mame/taito/groundfx.cpp
+++ b/src/mame/taito/groundfx.cpp
@@ -587,12 +587,11 @@ void groundfx_state::groundfx(machine_config &config)
m_tc0480scp->set_offsets_tx(-1, 0);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
taito_en_device &taito_en(TAITO_EN(config, "taito_en", 0));
- taito_en.add_route(0, "lspeaker", 1.0);
- taito_en.add_route(1, "rspeaker", 1.0);
+ taito_en.add_route(0, "speaker", 1.0, 0);
+ taito_en.add_route(1, "speaker", 1.0, 1);
}
/***************************************************************************
diff --git a/src/mame/taito/gunbustr.cpp b/src/mame/taito/gunbustr.cpp
index caee7ba8bd9..b036db2273a 100644
--- a/src/mame/taito/gunbustr.cpp
+++ b/src/mame/taito/gunbustr.cpp
@@ -567,12 +567,11 @@ void gunbustr_state::gunbustr(machine_config &config)
m_tc0480scp->set_offsets_flip(-1, 0);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
taito_en_device &taito_en(TAITO_EN(config, "taito_en", 0));
- taito_en.add_route(0, "lspeaker", 1.0);
- taito_en.add_route(1, "rspeaker", 1.0);
+ taito_en.add_route(0, "speaker", 1.0, 0);
+ taito_en.add_route(1, "speaker", 1.0, 1);
}
/***************************************************************************/
diff --git a/src/mame/taito/heromem.cpp b/src/mame/taito/heromem.cpp
index a4da7409257..1c2afced703 100644
--- a/src/mame/taito/heromem.cpp
+++ b/src/mame/taito/heromem.cpp
@@ -256,9 +256,7 @@ void heromem_state::heromem(machine_config &config)
vdp_r.set_addrmap(AS_PROGRAM, &heromem_state::tc0091lvc_r_prg_map);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
-
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
tc0140syt_device &syt_l(TC0140SYT(config, "tc0140syt_l", 0));
syt_l.nmi_callback().set_inputline("audiocpu_l", INPUT_LINE_NMI);
@@ -270,17 +268,17 @@ void heromem_state::heromem(machine_config &config)
ym2610b_device &ym_l(YM2610B(config, "ym_l", 16000000 / 2));
ym_l.irq_handler().set_inputline("audiocpu_l", 0);
- ym_l.add_route(0, "lspeaker", 0.75);
- ym_l.add_route(0, "lspeaker", 0.75);
- ym_l.add_route(1, "lspeaker", 1.0);
- ym_l.add_route(2, "lspeaker", 1.0);
+ ym_l.add_route(0, "speaker", 0.75, 0);
+ ym_l.add_route(0, "speaker", 0.75, 0);
+ ym_l.add_route(1, "speaker", 1.0, 0);
+ ym_l.add_route(2, "speaker", 1.0, 0);
ym2610b_device &ym_r(YM2610B(config, "ym_r", 16000000 / 2));
ym_r.irq_handler().set_inputline("audiocpu_r", 0);
- ym_r.add_route(0, "rspeaker", 0.75);
- ym_r.add_route(0, "rspeaker", 0.75);
- ym_r.add_route(1, "rspeaker", 1.0);
- ym_r.add_route(2, "rspeaker", 1.0);
+ ym_r.add_route(0, "speaker", 0.75, 1);
+ ym_r.add_route(0, "speaker", 0.75, 1);
+ ym_r.add_route(1, "speaker", 1.0, 1);
+ ym_r.add_route(2, "speaker", 1.0, 1);
}
diff --git a/src/mame/taito/invqix.cpp b/src/mame/taito/invqix.cpp
index e12989f5b07..48c57d581be 100644
--- a/src/mame/taito/invqix.cpp
+++ b/src/mame/taito/invqix.cpp
@@ -321,12 +321,11 @@ void invqix_state::invqix(machine_config &config)
screen.set_size(640, 480);
screen.set_visarea(0, 256-1, 0, 240-1);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
okim9810_device &oki(OKIM9810(config, "oki", XTAL(4'096'000)));
- oki.add_route(0, "lspeaker", 0.80);
- oki.add_route(1, "rspeaker", 0.80);
+ oki.add_route(0, "speaker", 0.80, 0);
+ oki.add_route(1, "speaker", 0.80, 1);
EEPROM_93C46_16BIT(config, "eeprom").default_value(0);
}
diff --git a/src/mame/taito/lgp.cpp b/src/mame/taito/lgp.cpp
index e530b3f102c..f84430f8be0 100644
--- a/src/mame/taito/lgp.cpp
+++ b/src/mame/taito/lgp.cpp
@@ -418,8 +418,8 @@ void lgp_state::lgp(machine_config &config)
PIONEER_LDV1000(config, m_laserdisc, 0);
m_laserdisc->command_strobe_callback().set(FUNC(lgp_state::ld_command_strobe_cb));
m_laserdisc->set_overlay(256, 256, FUNC(lgp_state::screen_update_lgp));
- m_laserdisc->add_route(0, "lspeaker", 1.0);
- m_laserdisc->add_route(1, "rspeaker", 1.0);
+ m_laserdisc->add_route(0, "speaker", 1.0, 0);
+ m_laserdisc->add_route(1, "speaker", 1.0, 1);
/* video hardware */
m_laserdisc->add_ntsc_screen(config, "screen");
@@ -429,8 +429,7 @@ void lgp_state::lgp(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_lgp);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
diff --git a/src/mame/taito/ninjaw.cpp b/src/mame/taito/ninjaw.cpp
index 9ca7efd01d0..e8003d56fe8 100644
--- a/src/mame/taito/ninjaw.cpp
+++ b/src/mame/taito/ninjaw.cpp
@@ -419,7 +419,7 @@ protected:
virtual void device_start();
// 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;
};
extern const device_type SUBWOOFER;
@@ -454,9 +454,8 @@ void subwoofer_device::device_start()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void subwoofer_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void subwoofer_device::sound_stream_update(sound_stream &stream)
{
- outputs[0].fill(0);
}
#endif
@@ -974,8 +973,7 @@ void ninjaw_state::ninjaw(machine_config &config)
TC0110PCR(config, m_tc0110pcr[2], 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
SPEAKER(config, "subwoofer").seat();
ym2610_device &ymsnd(YM2610(config, "ymsnd", 16000000/2));
@@ -986,10 +984,10 @@ void ninjaw_state::ninjaw(machine_config &config)
ymsnd.add_route(2, "2610.2.l", 1.0);
ymsnd.add_route(2, "2610.2.r", 1.0);
- FILTER_VOLUME(config, "2610.1.l").add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- FILTER_VOLUME(config, "2610.1.r").add_route(ALL_OUTPUTS, "rspeaker", 1.0);
- FILTER_VOLUME(config, "2610.2.l").add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- FILTER_VOLUME(config, "2610.2.r").add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ FILTER_VOLUME(config, "2610.1.l").add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ FILTER_VOLUME(config, "2610.1.r").add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
+ FILTER_VOLUME(config, "2610.2.l").add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ FILTER_VOLUME(config, "2610.2.r").add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
// SUBWOOFER(config, "subwoofer", 0);
@@ -1080,8 +1078,7 @@ void ninjaw_state::darius2(machine_config &config)
TC0110PCR(config, m_tc0110pcr[2], 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
SPEAKER(config, "subwoofer").seat();
ym2610_device &ymsnd(YM2610(config, "ymsnd", 16000000/2));
@@ -1092,10 +1089,10 @@ void ninjaw_state::darius2(machine_config &config)
ymsnd.add_route(2, "2610.2.l", 1.0);
ymsnd.add_route(2, "2610.2.r", 1.0);
- FILTER_VOLUME(config, "2610.1.l").add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- FILTER_VOLUME(config, "2610.1.r").add_route(ALL_OUTPUTS, "rspeaker", 1.0);
- FILTER_VOLUME(config, "2610.2.l").add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- FILTER_VOLUME(config, "2610.2.r").add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ FILTER_VOLUME(config, "2610.1.l").add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ FILTER_VOLUME(config, "2610.1.r").add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
+ FILTER_VOLUME(config, "2610.2.l").add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ FILTER_VOLUME(config, "2610.2.r").add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
// SUBWOOFER(config, "subwoofer", 0);
diff --git a/src/mame/taito/opwolf.cpp b/src/mame/taito/opwolf.cpp
index 7164cbe330a..512892905b3 100644
--- a/src/mame/taito/opwolf.cpp
+++ b/src/mame/taito/opwolf.cpp
@@ -876,8 +876,7 @@ void opwolf_state::opwolf(machine_config &config)
m_pc090oj->set_colpri_callback(FUNC(opwolf_state::colpri_cb));
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2151_device &ymsnd(YM2151(config, "ymsnd", 8_MHz_XTAL / 2)); /* 4 MHz */
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
@@ -902,8 +901,8 @@ void opwolf_state::opwolf(machine_config &config)
mixer.add_route(0, m_tc0060dca[1], 1.0, 1);
TC0060DCA(config, m_tc0060dca[1]);
- m_tc0060dca[1]->add_route(0, "lspeaker", 1.0);
- m_tc0060dca[1]->add_route(1, "rspeaker", 1.0);
+ m_tc0060dca[1]->add_route(0, "speaker", 1.0, 0);
+ m_tc0060dca[1]->add_route(1, "speaker", 1.0, 1);
}
void opwolf_state::opwolfp(machine_config &config)
diff --git a/src/mame/taito/qix_a.cpp b/src/mame/taito/qix_a.cpp
index a45643ec408..260ca6b849b 100644
--- a/src/mame/taito/qix_a.cpp
+++ b/src/mame/taito/qix_a.cpp
@@ -176,12 +176,11 @@ void qix_state::qix_audio(machine_config &config)
m_sndpia[2]->ca2_handler().set(FUNC(qix_state::sndpia_2_warning_w));
m_sndpia[2]->cb2_handler().set(FUNC(qix_state::sndpia_2_warning_w));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DISCRETE(config, m_discrete, qix_discrete);
- m_discrete->add_route(0, "lspeaker", 1.0);
- m_discrete->add_route(1, "rspeaker", 1.0);
+ m_discrete->add_route(0, "speaker", 1.0, 0);
+ m_discrete->add_route(1, "speaker", 1.0, 1);
}
void slither_state::audio(machine_config &config)
diff --git a/src/mame/taito/rollrace.cpp b/src/mame/taito/rollrace.cpp
index fe99ce69d6d..8f341c32258 100644
--- a/src/mame/taito/rollrace.cpp
+++ b/src/mame/taito/rollrace.cpp
@@ -573,14 +573,13 @@ void rollrace_state::rollace(machine_config &config)
PALETTE(config, m_palette, FUNC(rollrace_state::palette), 256);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, "soundlatch");
- AY8910(config, "ay1", XTAL(24'000'000) / 16).add_route(ALL_OUTPUTS, "rspeaker", 0.10); // verified on PCB
- AY8910(config, "ay2", XTAL(24'000'000) / 16).add_route(ALL_OUTPUTS, "rspeaker", 0.10); // verified on PCB
- AY8910(config, "ay3", XTAL(24'000'000) / 16).add_route(ALL_OUTPUTS, "lspeaker", 0.10); // verified on PCB
+ AY8910(config, "ay1", XTAL(24'000'000) / 16).add_route(ALL_OUTPUTS, "speaker", 0.10, 1); // verified on PCB
+ AY8910(config, "ay2", XTAL(24'000'000) / 16).add_route(ALL_OUTPUTS, "speaker", 0.10, 1); // verified on PCB
+ AY8910(config, "ay3", XTAL(24'000'000) / 16).add_route(ALL_OUTPUTS, "speaker", 0.10, 0); // verified on PCB
}
void rollrace_state::rollace2(machine_config &config)
diff --git a/src/mame/taito/slapshot.cpp b/src/mame/taito/slapshot.cpp
index a9f26d200fc..cf76af13282 100644
--- a/src/mame/taito/slapshot.cpp
+++ b/src/mame/taito/slapshot.cpp
@@ -437,15 +437,14 @@ void slapshot_state::slapshot(machine_config &config)
TC0360PRI(config, m_tc0360pri, 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2610b_device &ymsnd(YM2610B(config, "ymsnd", 32_MHz_XTAL/4)); /* 8 MHz */
ymsnd.irq_handler().set_inputline("audiocpu", 0);
- ymsnd.add_route(0, "lspeaker", 0.75);
- ymsnd.add_route(0, "rspeaker", 0.75);
- ymsnd.add_route(1, "lspeaker", 1.0);
- ymsnd.add_route(2, "rspeaker", 1.0);
+ ymsnd.add_route(0, "speaker", 0.75, 0);
+ ymsnd.add_route(0, "speaker", 0.75, 1);
+ ymsnd.add_route(1, "speaker", 1.0, 0);
+ ymsnd.add_route(2, "speaker", 1.0, 1);
MK48T08(config, "mk48t08", 0);
@@ -503,15 +502,14 @@ void slapshot_state::opwolf3(machine_config &config)
TC0360PRI(config, m_tc0360pri, 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2610b_device &ymsnd(YM2610B(config, "ymsnd", 32_MHz_XTAL/4)); /* 8 MHz */
ymsnd.irq_handler().set_inputline("audiocpu", 0);
- ymsnd.add_route(0, "lspeaker", 0.75);
- ymsnd.add_route(0, "rspeaker", 0.75);
- ymsnd.add_route(1, "lspeaker", 1.0);
- ymsnd.add_route(2, "rspeaker", 1.0);
+ ymsnd.add_route(0, "speaker", 0.75, 0);
+ ymsnd.add_route(0, "speaker", 0.75, 1);
+ ymsnd.add_route(1, "speaker", 1.0, 0);
+ ymsnd.add_route(2, "speaker", 1.0, 1);
MK48T08(config, "mk48t08", 0);
diff --git a/src/mame/taito/superchs.cpp b/src/mame/taito/superchs.cpp
index 09652827800..e930eccd750 100644
--- a/src/mame/taito/superchs.cpp
+++ b/src/mame/taito/superchs.cpp
@@ -249,12 +249,11 @@ void superchs_state::superchs(machine_config &config)
m_tc0480scp->set_offsets_tx(-1, 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
taito_en_device &taito_en(TAITO_EN(config, "taito_en", 0));
- taito_en.add_route(0, "lspeaker", 1.0);
- taito_en.add_route(1, "rspeaker", 1.0);
+ taito_en.add_route(0, "speaker", 1.0, 0);
+ taito_en.add_route(1, "speaker", 1.0, 1);
}
void superchs_state::chase3(machine_config &config)
diff --git a/src/mame/taito/taito_en.cpp b/src/mame/taito/taito_en.cpp
index 50e534d421a..35651d5b343 100644
--- a/src/mame/taito/taito_en.cpp
+++ b/src/mame/taito/taito_en.cpp
@@ -23,7 +23,7 @@ DEFINE_DEVICE_TYPE(TAITO_EN, taito_en_device, "taito_en", "Taito Ensoniq Sound S
taito_en_device::taito_en_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, TAITO_EN, tag, owner, clock)
- , device_mixer_interface(mconfig, *this, 2)
+ , device_mixer_interface(mconfig, *this)
, m_audiocpu(*this, "audiocpu")
, m_ensoniq(*this, "ensoniq")
, m_esp(*this, "esp")
@@ -241,8 +241,8 @@ void taito_en_device::device_add_mconfig(machine_config &config)
/* sound hardware */
ESQ_5505_5510_PUMP(config, m_pump, XTAL(30'476'180) / (2 * 16 * 32));
m_pump->set_esp(m_esp);
- m_pump->add_route(0, *this, 0.5, AUTO_ALLOC_INPUT, 0);
- m_pump->add_route(1, *this, 0.5, AUTO_ALLOC_INPUT, 1);
+ m_pump->add_route(0, *this, 0.5, 0);
+ m_pump->add_route(1, *this, 0.5, 1);
ES5505(config, m_ensoniq, XTAL(30'476'180) / 2);
m_ensoniq->sample_rate_changed().set(FUNC(taito_en_device::es5505_clock_changed));
diff --git a/src/mame/taito/taito_f2.cpp b/src/mame/taito/taito_f2.cpp
index 3d63b38278f..4bd291dd75f 100644
--- a/src/mame/taito/taito_f2.cpp
+++ b/src/mame/taito/taito_f2.cpp
@@ -2826,15 +2826,14 @@ void taitof2_state::taito_f2(machine_config &config)
PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 4096);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2610_device &ymsnd(YM2610(config, "ymsnd", 24000000/3)); /* Was 16000000/2, but only a 24Mhz OSC */
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
- ymsnd.add_route(0, "lspeaker", 0.75);
- ymsnd.add_route(0, "rspeaker", 0.75);
- ymsnd.add_route(1, "lspeaker", 1.0);
- ymsnd.add_route(2, "rspeaker", 1.0);
+ ymsnd.add_route(0, "speaker", 0.75, 0);
+ ymsnd.add_route(0, "speaker", 0.75, 1);
+ ymsnd.add_route(1, "speaker", 1.0, 0);
+ ymsnd.add_route(2, "speaker", 1.0, 1);
tc0140syt_device &tc0140syt(TC0140SYT(config, "tc0140syt", 0));
tc0140syt.nmi_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
diff --git a/src/mame/taito/taito_f3.cpp b/src/mame/taito/taito_f3.cpp
index 826947467b4..fe6c7e39cb6 100644
--- a/src/mame/taito/taito_f3.cpp
+++ b/src/mame/taito/taito_f3.cpp
@@ -460,12 +460,11 @@ void taito_f3_state::f3(machine_config &config)
PALETTE(config, m_palette).set_entries(0x2000);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
TAITO_EN(config, m_taito_en, 0);
- m_taito_en->add_route(0, "lspeaker", 1.0);
- m_taito_en->add_route(1, "rspeaker", 1.0);
+ m_taito_en->add_route(0, "speaker", 1.0, 0);
+ m_taito_en->add_route(1, "speaker", 1.0, 1);
}
/* These games reprogram the video output registers to display different scanlines,
diff --git a/src/mame/taito/taito_x.cpp b/src/mame/taito/taito_x.cpp
index 4c7a435cbf8..eb6b3d16613 100644
--- a/src/mame/taito/taito_x.cpp
+++ b/src/mame/taito/taito_x.cpp
@@ -1049,15 +1049,14 @@ void taitox_cchip_state::superman(machine_config &config)
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2610_device &ymsnd(YM2610(config, "ymsnd", 16_MHz_XTAL / 2)); // verified on PCB
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
- ymsnd.add_route(0, "lspeaker", 0.75);
- ymsnd.add_route(0, "rspeaker", 0.75);
- ymsnd.add_route(1, "lspeaker", 1.0);
- ymsnd.add_route(2, "rspeaker", 1.0);
+ ymsnd.add_route(0, "speaker", 0.75, 0);
+ ymsnd.add_route(0, "speaker", 0.75, 1);
+ ymsnd.add_route(1, "speaker", 1.0, 0);
+ ymsnd.add_route(2, "speaker", 1.0, 1);
tc0140syt_device &tc0140syt(TC0140SYT(config, "tc0140syt", 0));
tc0140syt.nmi_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
@@ -1093,13 +1092,12 @@ void taitox_state::daisenpu(machine_config &config)
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2151_device &ymsnd(YM2151(config, "ymsnd", 16_MHz_XTAL / 4)); // verified on PCB
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
- ymsnd.add_route(0, "lspeaker", 0.45);
- ymsnd.add_route(1, "rspeaker", 0.45);
+ ymsnd.add_route(0, "speaker", 0.45, 0);
+ ymsnd.add_route(1, "speaker", 0.45, 1);
pc060ha_device &ciu(PC060HA(config, "ciu", 0));
ciu.nmi_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
@@ -1134,15 +1132,14 @@ void taitox_state::gigandes(machine_config &config)
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2610_device &ymsnd(YM2610(config, "ymsnd", 8000000));
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
- ymsnd.add_route(0, "lspeaker", 0.75);
- ymsnd.add_route(0, "rspeaker", 0.75);
- ymsnd.add_route(1, "lspeaker", 1.0);
- ymsnd.add_route(2, "rspeaker", 1.0);
+ ymsnd.add_route(0, "speaker", 0.75, 0);
+ ymsnd.add_route(0, "speaker", 0.75, 1);
+ ymsnd.add_route(1, "speaker", 1.0, 0);
+ ymsnd.add_route(2, "speaker", 1.0, 1);
tc0140syt_device &tc0140syt(TC0140SYT(config, "tc0140syt", 0));
tc0140syt.nmi_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
@@ -1178,15 +1175,14 @@ void taitox_state::ballbros(machine_config &config)
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2610_device &ymsnd(YM2610(config, "ymsnd", 8000000));
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
- ymsnd.add_route(0, "lspeaker", 0.75);
- ymsnd.add_route(0, "rspeaker", 0.75);
- ymsnd.add_route(1, "lspeaker", 1.0);
- ymsnd.add_route(2, "rspeaker", 1.0);
+ ymsnd.add_route(0, "speaker", 0.75, 0);
+ ymsnd.add_route(0, "speaker", 0.75, 1);
+ ymsnd.add_route(1, "speaker", 1.0, 0);
+ ymsnd.add_route(2, "speaker", 1.0, 1);
tc0140syt_device &tc0140syt(TC0140SYT(config, "tc0140syt", 0));
tc0140syt.nmi_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
diff --git a/src/mame/taito/taito_z.cpp b/src/mame/taito/taito_z.cpp
index 11f417cb8da..9210c20fe15 100644
--- a/src/mame/taito/taito_z.cpp
+++ b/src/mame/taito/taito_z.cpp
@@ -3221,7 +3221,7 @@ void contcirc_state::contcirc(machine_config &config) //OSC: 26.686, 24.000, 16.
/* sound hardware */
SPEAKER(config, "front").front_center();
SPEAKER(config, "rear").rear_center();
- SPEAKER(config, "subwoofer").set_position(0.0, 0.0, 0.0); // FIXME: where is this speaker located?
+ SPEAKER(config, "subwoofer").set_position(0, 0.0, 0.0, 0.0); // FIXME: where is this speaker located?
ym2610_device &ymsnd(YM2610(config, "ymsnd", XTAL(16'000'000)/2)); // 8 MHz
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
@@ -3280,7 +3280,7 @@ void chasehq_state::chasehq(machine_config &config) //OSC: 26.686, 24.000, 16.00
/* sound hardware */
SPEAKER(config, "front").front_center();
SPEAKER(config, "rear").rear_center();
- SPEAKER(config, "subwoofer").set_position(0.0, 0.0, 0.0); // FIXME: where is this speaker located?
+ SPEAKER(config, "subwoofer").set_position(0, 0.0, 0.0, 0.0); // FIXME: where is this speaker located?
ym2610_device &ymsnd(YM2610(config, "ymsnd", XTAL(16'000'000)/2)); // 8 MHz
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
@@ -3340,22 +3340,21 @@ void contcirc_state::enforce(machine_config &config)
TC0110PCR(config, m_tc0110pcr, 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2610_device &ymsnd(YM2610(config, "ymsnd", XTAL(16'000'000)/2)); // 8 MHz
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
- ymsnd.add_route(0, "lspeaker", 0.75);
- ymsnd.add_route(0, "rspeaker", 0.75);
+ ymsnd.add_route(0, "speaker", 0.75, 0);
+ ymsnd.add_route(0, "speaker", 0.75, 1);
ymsnd.add_route(1, "2610.1.l", 20.0);
ymsnd.add_route(1, "2610.1.r", 20.0);
ymsnd.add_route(2, "2610.2.l", 20.0);
ymsnd.add_route(2, "2610.2.r", 20.0);
- FILTER_VOLUME(config, "2610.1.r").add_route(ALL_OUTPUTS, "rspeaker", 1.0);
- FILTER_VOLUME(config, "2610.1.l").add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- FILTER_VOLUME(config, "2610.2.r").add_route(ALL_OUTPUTS, "rspeaker", 1.0);
- FILTER_VOLUME(config, "2610.2.l").add_route(ALL_OUTPUTS, "lspeaker", 1.0);
+ FILTER_VOLUME(config, "2610.1.r").add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
+ FILTER_VOLUME(config, "2610.1.l").add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ FILTER_VOLUME(config, "2610.2.r").add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
+ FILTER_VOLUME(config, "2610.2.l").add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
TC0140SYT(config, m_tc0140syt, 0);
m_tc0140syt->nmi_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
@@ -3396,22 +3395,21 @@ void taitoz_state::bshark_base(machine_config &config)
TC0150ROD(config, m_tc0150rod, 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2610_device &ymsnd(YM2610(config, "ymsnd", 16000000/2));
//ymsnd.irq_handler().set_inputline(m_audiocpu, 0); // DG: this is probably specific to Z80 and wrong?
- ymsnd.add_route(0, "lspeaker", 0.75);
- ymsnd.add_route(0, "rspeaker", 0.75);
+ ymsnd.add_route(0, "speaker", 0.75, 0);
+ ymsnd.add_route(0, "speaker", 0.75, 1);
ymsnd.add_route(1, "2610.1.l", 28.0);
ymsnd.add_route(1, "2610.1.r", 28.0);
ymsnd.add_route(2, "2610.2.l", 28.0);
ymsnd.add_route(2, "2610.2.r", 28.0);
- FILTER_VOLUME(config, "2610.1.r").add_route(ALL_OUTPUTS, "rspeaker", 1.0);
- FILTER_VOLUME(config, "2610.1.l").add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- FILTER_VOLUME(config, "2610.2.r").add_route(ALL_OUTPUTS, "rspeaker", 1.0);
- FILTER_VOLUME(config, "2610.2.l").add_route(ALL_OUTPUTS, "lspeaker", 1.0);
+ FILTER_VOLUME(config, "2610.1.r").add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
+ FILTER_VOLUME(config, "2610.1.l").add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ FILTER_VOLUME(config, "2610.2.r").add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
+ FILTER_VOLUME(config, "2610.2.l").add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
}
void taitoz_state::bshark(machine_config &config)
@@ -3471,22 +3469,21 @@ void sci_state::sci(machine_config &config)
TC0150ROD(config, m_tc0150rod, 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2610_device &ymsnd(YM2610(config, "ymsnd", XTAL(32'000'000)/4)); // 8 MHz
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
- ymsnd.add_route(0, "lspeaker", 0.75);
- ymsnd.add_route(0, "rspeaker", 0.75);
+ ymsnd.add_route(0, "speaker", 0.75, 0);
+ ymsnd.add_route(0, "speaker", 0.75, 1);
ymsnd.add_route(1, "2610.1.l", 2.0);
ymsnd.add_route(1, "2610.1.r", 2.0);
ymsnd.add_route(2, "2610.2.l", 2.0);
ymsnd.add_route(2, "2610.2.r", 2.0);
- FILTER_VOLUME(config, "2610.1.r").add_route(ALL_OUTPUTS, "rspeaker", 1.0);
- FILTER_VOLUME(config, "2610.1.l").add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- FILTER_VOLUME(config, "2610.2.r").add_route(ALL_OUTPUTS, "rspeaker", 1.0);
- FILTER_VOLUME(config, "2610.2.l").add_route(ALL_OUTPUTS, "lspeaker", 1.0);
+ FILTER_VOLUME(config, "2610.1.r").add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
+ FILTER_VOLUME(config, "2610.1.l").add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ FILTER_VOLUME(config, "2610.2.r").add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
+ FILTER_VOLUME(config, "2610.2.l").add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
TC0140SYT(config, m_tc0140syt, 0);
m_tc0140syt->nmi_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
@@ -3542,7 +3539,7 @@ void nightstr_state::nightstr(machine_config &config) //OSC: 26.686, 24.000, 16.
/* sound hardware */
SPEAKER(config, "front").front_center();
SPEAKER(config, "rear").rear_center();
- SPEAKER(config, "subwoofer").set_position(0.0, 0.0, 0.0); // FIXME: where is this located in the cabinet?
+ SPEAKER(config, "subwoofer").set_position(0, 0.0, 0.0, 0.0); // FIXME: where is this located in the cabinet?
ym2610_device &ymsnd(YM2610(config, "ymsnd", XTAL(16'000'000)/2)); // 8 MHz
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
@@ -3601,22 +3598,21 @@ void taitoz_z80_sound_state::aquajack(machine_config &config) //OSC: 26.686, 24.
TC0110PCR(config, m_tc0110pcr, 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2610_device &ymsnd(YM2610(config, "ymsnd", XTAL(16'000'000)/2)); // 8 MHz
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
- ymsnd.add_route(0, "lspeaker", 0.75);
- ymsnd.add_route(0, "rspeaker", 0.75);
+ ymsnd.add_route(0, "speaker", 0.75, 0);
+ ymsnd.add_route(0, "speaker", 0.75, 1);
ymsnd.add_route(1, "2610.1.l", 2.0);
ymsnd.add_route(1, "2610.1.r", 2.0);
ymsnd.add_route(2, "2610.2.l", 2.0);
ymsnd.add_route(2, "2610.2.r", 2.0);
- FILTER_VOLUME(config, "2610.1.r").add_route(ALL_OUTPUTS, "rspeaker", 1.0);
- FILTER_VOLUME(config, "2610.1.l").add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- FILTER_VOLUME(config, "2610.2.r").add_route(ALL_OUTPUTS, "rspeaker", 1.0);
- FILTER_VOLUME(config, "2610.2.l").add_route(ALL_OUTPUTS, "lspeaker", 1.0);
+ FILTER_VOLUME(config, "2610.1.r").add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
+ FILTER_VOLUME(config, "2610.1.l").add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ FILTER_VOLUME(config, "2610.2.r").add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
+ FILTER_VOLUME(config, "2610.2.l").add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
TC0140SYT(config, m_tc0140syt, 0);
m_tc0140syt->nmi_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
@@ -3668,22 +3664,21 @@ void spacegun_state::spacegun(machine_config &config) //OSC: 26.686, 24.000, 16.
TC0110PCR(config, m_tc0110pcr, 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2610_device &ymsnd(YM2610(config, "ymsnd", XTAL(16'000'000)/2)); // 8 MHz
//ymsnd.irq_handler().set_inputline(m_audiocpu, 0); // DG: this is probably specific to Z80 and wrong?
- ymsnd.add_route(0, "lspeaker", 0.75);
- ymsnd.add_route(0, "rspeaker", 0.75);
+ ymsnd.add_route(0, "speaker", 0.75, 0);
+ ymsnd.add_route(0, "speaker", 0.75, 1);
ymsnd.add_route(1, "2610.1.l", 8.0);
ymsnd.add_route(1, "2610.1.r", 8.0);
ymsnd.add_route(2, "2610.2.l", 8.0);
ymsnd.add_route(2, "2610.2.r", 8.0);
- FILTER_VOLUME(config, "2610.1.r").add_route(ALL_OUTPUTS, "rspeaker", 1.0);
- FILTER_VOLUME(config, "2610.1.l").add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- FILTER_VOLUME(config, "2610.2.r").add_route(ALL_OUTPUTS, "rspeaker", 1.0);
- FILTER_VOLUME(config, "2610.2.l").add_route(ALL_OUTPUTS, "lspeaker", 1.0);
+ FILTER_VOLUME(config, "2610.1.r").add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
+ FILTER_VOLUME(config, "2610.1.l").add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ FILTER_VOLUME(config, "2610.2.r").add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
+ FILTER_VOLUME(config, "2610.2.l").add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
}
void taitoz_z80_sound_state::dblaxle(machine_config &config)
@@ -3726,22 +3721,21 @@ void taitoz_z80_sound_state::dblaxle(machine_config &config)
TC0150ROD(config, m_tc0150rod, 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2610_device &ymsnd(YM2610(config, "ymsnd", XTAL(32'000'000)/4)); // 8 MHz
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
- ymsnd.add_route(0, "lspeaker", 0.75);
- ymsnd.add_route(0, "rspeaker", 0.75);
+ ymsnd.add_route(0, "speaker", 0.75, 0);
+ ymsnd.add_route(0, "speaker", 0.75, 1);
ymsnd.add_route(1, "2610.1.l", 8.0);
ymsnd.add_route(1, "2610.1.r", 8.0);
ymsnd.add_route(2, "2610.2.l", 8.0);
ymsnd.add_route(2, "2610.2.r", 8.0);
- FILTER_VOLUME(config, "2610.1.r").add_route(ALL_OUTPUTS, "rspeaker", 1.0);
- FILTER_VOLUME(config, "2610.1.l").add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- FILTER_VOLUME(config, "2610.2.r").add_route(ALL_OUTPUTS, "rspeaker", 1.0);
- FILTER_VOLUME(config, "2610.2.l").add_route(ALL_OUTPUTS, "lspeaker", 1.0);
+ FILTER_VOLUME(config, "2610.1.r").add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
+ FILTER_VOLUME(config, "2610.1.l").add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ FILTER_VOLUME(config, "2610.2.r").add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
+ FILTER_VOLUME(config, "2610.2.l").add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
TC0140SYT(config, m_tc0140syt, 0);
m_tc0140syt->nmi_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
@@ -3787,22 +3781,21 @@ void sci_state::racingb(machine_config &config)
TC0150ROD(config, m_tc0150rod, 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2610_device &ymsnd(YM2610(config, "ymsnd", XTAL(32'000'000)/4)); // 8 MHz
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
- ymsnd.add_route(0, "lspeaker", 0.75);
- ymsnd.add_route(0, "rspeaker", 0.75);
+ ymsnd.add_route(0, "speaker", 0.75, 0);
+ ymsnd.add_route(0, "speaker", 0.75, 1);
ymsnd.add_route(1, "2610.1.l", 8.0);
ymsnd.add_route(1, "2610.1.r", 8.0);
ymsnd.add_route(2, "2610.2.l", 8.0);
ymsnd.add_route(2, "2610.2.r", 8.0);
- FILTER_VOLUME(config, "2610.1.r").add_route(ALL_OUTPUTS, "rspeaker", 1.0);
- FILTER_VOLUME(config, "2610.1.l").add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- FILTER_VOLUME(config, "2610.2.r").add_route(ALL_OUTPUTS, "rspeaker", 1.0);
- FILTER_VOLUME(config, "2610.2.l").add_route(ALL_OUTPUTS, "lspeaker", 1.0);
+ FILTER_VOLUME(config, "2610.1.r").add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
+ FILTER_VOLUME(config, "2610.1.l").add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ FILTER_VOLUME(config, "2610.2.r").add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
+ FILTER_VOLUME(config, "2610.2.l").add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
TC0140SYT(config, m_tc0140syt, 0);
m_tc0140syt->nmi_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
diff --git a/src/mame/taito/taitojc.cpp b/src/mame/taito/taitojc.cpp
index 6562c6ee10e..dad6ca5f292 100644
--- a/src/mame/taito/taitojc.cpp
+++ b/src/mame/taito/taitojc.cpp
@@ -1137,12 +1137,11 @@ void taitojc_state::taitojc(machine_config &config)
TC0780FPA(config, m_tc0780fpa, 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
taito_en_device &taito_en(TAITO_EN(config, "taito_en", 0));
- taito_en.add_route(0, "lspeaker", 1.0);
- taito_en.add_route(1, "rspeaker", 1.0);
+ taito_en.add_route(0, "speaker", 1.0, 0);
+ taito_en.add_route(1, "speaker", 1.0, 1);
}
void dendego_state::dendego(machine_config &config)
diff --git a/src/mame/taito/tc0060dca.cpp b/src/mame/taito/tc0060dca.cpp
index c5496ac0903..b740e50d3d8 100755
--- a/src/mame/taito/tc0060dca.cpp
+++ b/src/mame/taito/tc0060dca.cpp
@@ -44,13 +44,11 @@ void tc0060dca_device::device_start()
save_item(NAME(m_gain));
}
-void tc0060dca_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void tc0060dca_device::sound_stream_update(sound_stream &stream)
{
- for (int i = 0; i < outputs[0].samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
- const stream_buffer::sample_t l = inputs[0].get(i);
- const stream_buffer::sample_t r = inputs[1].get(i);
- outputs[0].put(i, l * m_gain[0]);
- outputs[1].put(i, r * m_gain[1]);
+ stream.put(0, i, stream.get(0, i) * m_gain[0]);
+ stream.put(1, i, stream.get(1, i) * m_gain[1]);
}
}
diff --git a/src/mame/taito/tc0060dca.h b/src/mame/taito/tc0060dca.h
index d2c00fa9732..c9dc68a13d1 100755
--- a/src/mame/taito/tc0060dca.h
+++ b/src/mame/taito/tc0060dca.h
@@ -18,7 +18,7 @@ protected:
virtual void device_start() override ATTR_COLD;
// device_sound_interface 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;
private:
sound_stream *m_stream;
diff --git a/src/mame/taito/topspeed.cpp b/src/mame/taito/topspeed.cpp
index 7e7ccfcf3c8..9f2fb25d657 100644
--- a/src/mame/taito/topspeed.cpp
+++ b/src/mame/taito/topspeed.cpp
@@ -993,8 +993,7 @@ void topspeed_state::topspeed(machine_config &config)
PALETTE(config, "palette").set_format(palette_device::xBGR_555, 8192);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2151_device &ymsnd(YM2151(config, "ymsnd", 16_MHz_XTAL / 4));
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
@@ -1011,12 +1010,12 @@ void topspeed_state::topspeed(machine_config &config)
m_msm[1]->set_prescaler_selector(msm5205_device::SEX_4B); // Slave mode, 4-bit
m_msm[1]->add_route(ALL_OUTPUTS, "filter3", 1.0);
- FILTER_VOLUME(config, "filter1l").add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- FILTER_VOLUME(config, "filter1r").add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ FILTER_VOLUME(config, "filter1l").add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ FILTER_VOLUME(config, "filter1r").add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
- FILTER_VOLUME(config, "filter2").add_route(ALL_OUTPUTS, "lspeaker", 1.0).add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ FILTER_VOLUME(config, "filter2").add_route(ALL_OUTPUTS, "speaker", 1.0, 0).add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
- FILTER_VOLUME(config, "filter3").add_route(ALL_OUTPUTS, "lspeaker", 1.0).add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ FILTER_VOLUME(config, "filter3").add_route(ALL_OUTPUTS, "speaker", 1.0, 0).add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
}
diff --git a/src/mame/taito/undrfire.cpp b/src/mame/taito/undrfire.cpp
index 397e0ffeabb..54b4764f205 100644
--- a/src/mame/taito/undrfire.cpp
+++ b/src/mame/taito/undrfire.cpp
@@ -551,12 +551,11 @@ void undrfire_state::undrfire(machine_config &config)
m_tc0480scp->set_offsets_tx(-1, 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
taito_en_device &taito_en(TAITO_EN(config, "taito_en", 0));
- taito_en.add_route(0, "lspeaker", 1.0);
- taito_en.add_route(1, "rspeaker", 1.0);
+ taito_en.add_route(0, "speaker", 1.0, 0);
+ taito_en.add_route(1, "speaker", 1.0, 1);
}
@@ -616,12 +615,11 @@ void undrfire_state::cbombers(machine_config &config)
TC0360PRI(config, m_tc0360pri, 0);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
taito_en_device &taito_en(TAITO_EN(config, "taito_en", 0));
- taito_en.add_route(0, "lspeaker", 1.0);
- taito_en.add_route(1, "rspeaker", 1.0);
+ taito_en.add_route(0, "speaker", 1.0, 0);
+ taito_en.add_route(1, "speaker", 1.0, 1);
}
diff --git a/src/mame/taito/warriorb.cpp b/src/mame/taito/warriorb.cpp
index 1c2ff4ed943..261fdc9bd33 100644
--- a/src/mame/taito/warriorb.cpp
+++ b/src/mame/taito/warriorb.cpp
@@ -629,8 +629,7 @@ void warriorb_state::darius2d(machine_config &config)
TC0110PCR(config, m_tc0110pcr[1], 0);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
SPEAKER(config, "subwoofer").seat();
ym2610_device &ymsnd(YM2610(config, "ymsnd", 16_MHz_XTAL / 2));
@@ -641,10 +640,10 @@ void warriorb_state::darius2d(machine_config &config)
ymsnd.add_route(2, "2610.2.l", 1.0);
ymsnd.add_route(2, "2610.2.r", 1.0);
- FILTER_VOLUME(config, "2610.1.l").add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- FILTER_VOLUME(config, "2610.1.r").add_route(ALL_OUTPUTS, "rspeaker", 1.0);
- FILTER_VOLUME(config, "2610.2.l").add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- FILTER_VOLUME(config, "2610.2.r").add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ FILTER_VOLUME(config, "2610.1.l").add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ FILTER_VOLUME(config, "2610.1.r").add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
+ FILTER_VOLUME(config, "2610.2.l").add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ FILTER_VOLUME(config, "2610.2.r").add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
TC0140SYT(config, m_tc0140syt, 0);
m_tc0140syt->nmi_callback().set_inputline("audiocpu", INPUT_LINE_NMI);
@@ -706,23 +705,22 @@ void warriorb_state::warriorb(machine_config &config)
TC0110PCR(config, m_tc0110pcr[1], 0);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
// is there a subwoofer under the seat like other Taito multiscreen games?
ym2610b_device &ymsnd(YM2610B(config, "ymsnd", 16_MHz_XTAL / 2));
ymsnd.irq_handler().set_inputline("audiocpu", 0);
- ymsnd.add_route(0, "lspeaker", 0.75);
- ymsnd.add_route(0, "rspeaker", 0.75);
+ ymsnd.add_route(0, "speaker", 0.75, 0);
+ ymsnd.add_route(0, "speaker", 0.75, 1);
ymsnd.add_route(1, "2610.1.l", 1.0);
ymsnd.add_route(1, "2610.1.r", 1.0);
ymsnd.add_route(2, "2610.2.l", 1.0);
ymsnd.add_route(2, "2610.2.r", 1.0);
- FILTER_VOLUME(config, "2610.1.l").add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- FILTER_VOLUME(config, "2610.1.r").add_route(ALL_OUTPUTS, "rspeaker", 1.0);
- FILTER_VOLUME(config, "2610.2.l").add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- FILTER_VOLUME(config, "2610.2.r").add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ FILTER_VOLUME(config, "2610.1.l").add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ FILTER_VOLUME(config, "2610.1.r").add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
+ FILTER_VOLUME(config, "2610.2.l").add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ FILTER_VOLUME(config, "2610.2.r").add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
TC0140SYT(config, m_tc0140syt, 0);
m_tc0140syt->nmi_callback().set_inputline("audiocpu", INPUT_LINE_NMI);
diff --git a/src/mame/taito/wgp.cpp b/src/mame/taito/wgp.cpp
index 06ebec3dfa8..3b504c8635c 100644
--- a/src/mame/taito/wgp.cpp
+++ b/src/mame/taito/wgp.cpp
@@ -895,15 +895,14 @@ void wgp_state::wgp(machine_config &config)
m_tc0100scn->set_palette(m_palette);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2610_device &ymsnd(YM2610(config, "ymsnd", 16000000/2));
ymsnd.irq_handler().set_inputline(m_audiocpu, 0); // assumes Z80 sandwiched between 68Ks
- ymsnd.add_route(0, "lspeaker", 0.75);
- ymsnd.add_route(0, "rspeaker", 0.75);
- ymsnd.add_route(1, "lspeaker", 1.0);
- ymsnd.add_route(2, "rspeaker", 1.0);
+ ymsnd.add_route(0, "speaker", 0.75, 0);
+ ymsnd.add_route(0, "speaker", 0.75, 1);
+ ymsnd.add_route(1, "speaker", 1.0, 0);
+ ymsnd.add_route(2, "speaker", 1.0, 1);
TC0140SYT(config, m_tc0140syt, 0);
m_tc0140syt->nmi_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
diff --git a/src/mame/tatsumi/apache3.cpp b/src/mame/tatsumi/apache3.cpp
index a601747a319..72538ad4c21 100644
--- a/src/mame/tatsumi/apache3.cpp
+++ b/src/mame/tatsumi/apache3.cpp
@@ -488,17 +488,16 @@ void apache3_state::apache3(machine_config &config)
*/
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
YM2151(config, m_ym2151, apache3_state::CLOCK_1 / 4);
m_ym2151->irq_handler().set_inputline(m_audiocpu, INPUT_LINE_IRQ0);
- m_ym2151->add_route(0, "lspeaker", 0.45);
- m_ym2151->add_route(1, "rspeaker", 0.45);
+ m_ym2151->add_route(0, "speaker", 0.45, 0);
+ m_ym2151->add_route(1, "speaker", 0.45, 1);
OKIM6295(config, m_oki, apache3_state::CLOCK_1 / 4 / 2, okim6295_device::PIN7_HIGH);
- m_oki->add_route(ALL_OUTPUTS, "lspeaker", 0.75);
- m_oki->add_route(ALL_OUTPUTS, "rspeaker", 0.75);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 0.75, 0);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 0.75, 1);
}
diff --git a/src/mame/tatsumi/cyclwarr.cpp b/src/mame/tatsumi/cyclwarr.cpp
index fad8486349f..04ed7732c11 100644
--- a/src/mame/tatsumi/cyclwarr.cpp
+++ b/src/mame/tatsumi/cyclwarr.cpp
@@ -974,20 +974,19 @@ void cyclwarr_state::cyclwarr(machine_config &config)
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 8192);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
// m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
YM2151(config, m_ym2151, cyclwarr_state::CLOCK_1 / 4);
m_ym2151->irq_handler().set_inputline(m_audiocpu, INPUT_LINE_IRQ0);
- m_ym2151->add_route(0, "lspeaker", 0.45);
- m_ym2151->add_route(1, "rspeaker", 0.45);
+ m_ym2151->add_route(0, "speaker", 0.45, 0);
+ m_ym2151->add_route(1, "speaker", 0.45, 1);
OKIM6295(config, m_oki, cyclwarr_state::CLOCK_1 / 8, okim6295_device::PIN7_HIGH);
- m_oki->add_route(ALL_OUTPUTS, "lspeaker", 0.75);
- m_oki->add_route(ALL_OUTPUTS, "rspeaker", 0.75);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 0.75, 0);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 0.75, 1);
}
void bigfight_state::bigfight(machine_config &config)
diff --git a/src/mame/tatsumi/lockon.cpp b/src/mame/tatsumi/lockon.cpp
index b9a78d3432d..27c6afc54cf 100644
--- a/src/mame/tatsumi/lockon.cpp
+++ b/src/mame/tatsumi/lockon.cpp
@@ -496,15 +496,14 @@ void lockon_state::lockon(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_lockon);
PALETTE(config, m_palette, FUNC(lockon_state::lockon_palette), 1024 + 2048);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2203_device &ymsnd(YM2203(config, "ymsnd", 16_MHz_XTAL / 4));
ymsnd.irq_handler().set(FUNC(lockon_state::ym2203_irq));
ymsnd.port_a_read_callback().set_ioport("YM2203");
ymsnd.port_b_write_callback().set(FUNC(lockon_state::ym2203_out_b));
- ymsnd.add_route(0, "lspeaker", 0.40);
- ymsnd.add_route(0, "rspeaker", 0.40);
+ ymsnd.add_route(0, "speaker", 0.40, 0);
+ ymsnd.add_route(0, "speaker", 0.40, 1);
ymsnd.add_route(1, "f2203.1l", 1.0);
ymsnd.add_route(1, "f2203.1r", 1.0);
ymsnd.add_route(2, "f2203.2l", 1.0);
@@ -512,12 +511,12 @@ void lockon_state::lockon(machine_config &config)
ymsnd.add_route(3, "f2203.3l", 1.0);
ymsnd.add_route(3, "f2203.3r", 1.0);
- FILTER_VOLUME(config, "f2203.1l").add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- FILTER_VOLUME(config, "f2203.1r").add_route(ALL_OUTPUTS, "rspeaker", 1.0);
- FILTER_VOLUME(config, "f2203.2l").add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- FILTER_VOLUME(config, "f2203.2r").add_route(ALL_OUTPUTS, "rspeaker", 1.0);
- FILTER_VOLUME(config, "f2203.3l").add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- FILTER_VOLUME(config, "f2203.3r").add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ FILTER_VOLUME(config, "f2203.1l").add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ FILTER_VOLUME(config, "f2203.1r").add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
+ FILTER_VOLUME(config, "f2203.2l").add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ FILTER_VOLUME(config, "f2203.2r").add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
+ FILTER_VOLUME(config, "f2203.3l").add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ FILTER_VOLUME(config, "f2203.3r").add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
}
diff --git a/src/mame/tatsumi/roundup5.cpp b/src/mame/tatsumi/roundup5.cpp
index 2d0fae361be..017fa486148 100644
--- a/src/mame/tatsumi/roundup5.cpp
+++ b/src/mame/tatsumi/roundup5.cpp
@@ -719,17 +719,16 @@ void roundup5_state::roundup5(machine_config &config)
m_palette->set_membits(8).set_endianness(ENDIANNESS_BIG);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
YM2151(config, m_ym2151, roundup5_state::CLOCK_1 / 4);
m_ym2151->irq_handler().set_inputline(m_audiocpu, INPUT_LINE_IRQ0);
- m_ym2151->add_route(0, "lspeaker", 0.45);
- m_ym2151->add_route(1, "rspeaker", 0.45);
+ m_ym2151->add_route(0, "speaker", 0.45, 0);
+ m_ym2151->add_route(1, "speaker", 0.45, 1);
OKIM6295(config, m_oki, roundup5_state::CLOCK_1 / 4 / 2, okim6295_device::PIN7_HIGH);
- m_oki->add_route(ALL_OUTPUTS, "lspeaker", 0.75);
- m_oki->add_route(ALL_OUTPUTS, "rspeaker", 0.75);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 0.75, 0);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 0.75, 1);
}
diff --git a/src/mame/tatsumi/tx1_a.cpp b/src/mame/tatsumi/tx1_a.cpp
index 036e37bad79..aa442fba2fd 100644
--- a/src/mame/tatsumi/tx1_a.cpp
+++ b/src/mame/tatsumi/tx1_a.cpp
@@ -365,14 +365,11 @@ static inline void update_engine(int eng[4])
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void tx1_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void tx1_sound_device::sound_stream_update(sound_stream &stream)
{
uint32_t step_0, step_1, step_2;
double /*gain_0, gain_1,*/ gain_2, gain_3;
- auto &fl = outputs[0];
- auto &fr = outputs[1];
-
/* 8253 outputs for the player/opponent engine sounds. */
step_0 = m_pit8253.counts[0].val ? (TX1_PIT_CLOCK / m_pit8253.counts[0].val * m_freq_to_step) : 0;
step_1 = m_pit8253.counts[1].val ? (TX1_PIT_CLOCK / m_pit8253.counts[1].val * m_freq_to_step) : 0;
@@ -383,7 +380,7 @@ void tx1_sound_device::sound_stream_update(sound_stream &stream, std::vector<rea
gain_2 = tx1_engine_gains[m_ay_outputb & 0xf];
gain_3 = BIT(m_ay_outputb, 5) ? 1.0f : 1.5f;
- for (int sampindex = 0; sampindex < fl.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
if (m_step0 & ((1 << TX1_FRAC)))
{
@@ -406,8 +403,8 @@ void tx1_sound_device::sound_stream_update(sound_stream &stream, std::vector<rea
m_step2 &= ((1 << TX1_FRAC) - 1);
}
- fl.put_int(sampindex, (m_pit0 + m_pit1)*gain_3 + 2*m_pit2*gain_2, 32768);
- fr.put_int(sampindex, (m_pit0 + m_pit1)*gain_3 + 2*m_pit2*gain_2, 32768);
+ stream.put_int(0, sampindex, (m_pit0 + m_pit1)*gain_3 + 2*m_pit2*gain_2, 32768);
+ stream.put_int(1, sampindex, (m_pit0 + m_pit1)*gain_3 + 2*m_pit2*gain_2, 32768);
m_step0 += step_0;
m_step1 += step_1;
@@ -761,7 +758,7 @@ void buggyboyjr_sound_device::ym2_b_w(uint8_t data)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void buggyboy_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void buggyboy_sound_device::sound_stream_update(sound_stream &stream)
{
/* This is admittedly a bit of a hack job... */
@@ -769,9 +766,6 @@ void buggyboy_sound_device::sound_stream_update(sound_stream &stream, std::vecto
int n1_en, n2_en;
double gain0, gain1_l, gain1_r;
- auto &fl = outputs[0];
- auto &fr = outputs[1];
-
/* 8253 outputs for the player/opponent buggy engine sounds. */
step_0 = m_pit8253.counts[0].val ? (BUGGYBOY_PIT_CLOCK / m_pit8253.counts[0].val * m_freq_to_step) : 0;
step_1 = m_pit8253.counts[1].val ? (BUGGYBOY_PIT_CLOCK / m_pit8253.counts[1].val * m_freq_to_step) : 0;
@@ -787,7 +781,7 @@ void buggyboy_sound_device::sound_stream_update(sound_stream &stream, std::vecto
gain1_l = bb_engine_gains[m_ym2_outputa >> 4] * 5;
gain1_r = bb_engine_gains[m_ym2_outputa & 0xf] * 5;
- for (int sampindex = 0; sampindex < fl.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
s32 pit0, pit1, n1, n2;
pit0 = m_eng_voltages[(m_step0 >> 24) & 0xf];
@@ -829,8 +823,8 @@ void buggyboy_sound_device::sound_stream_update(sound_stream &stream, std::vecto
else
n2 = 8192;
- fl.put_int(sampindex, n1 + n2 + (pit0 * gain0) + (pit1 * gain1_l), 32768);
- fr.put_int(sampindex, n1 + n2 + (pit0 * gain0) + (pit1 * gain1_r), 32768);
+ stream.put_int(0, sampindex, n1 + n2 + (pit0 * gain0) + (pit1 * gain1_l), 32768);
+ stream.put_int(1, sampindex, n1 + n2 + (pit0 * gain0) + (pit1 * gain1_r), 32768);
m_step0 += step_0;
m_step1 += step_1;
diff --git a/src/mame/tatsumi/tx1_a.h b/src/mame/tatsumi/tx1_a.h
index 3c630f090ee..6129392bd72 100644
--- a/src/mame/tatsumi/tx1_a.h
+++ b/src/mame/tatsumi/tx1_a.h
@@ -72,7 +72,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;
void tx1_sound_io(address_map &map) ATTR_COLD;
void tx1_sound_prg(address_map &map) ATTR_COLD;
@@ -149,7 +149,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;
void ym1_a_w(uint8_t data);
void ym2_a_w(uint8_t data);
diff --git a/src/mame/tch/littlerb.cpp b/src/mame/tch/littlerb.cpp
index 98bfae49e21..f1a74b205dc 100644
--- a/src/mame/tch/littlerb.cpp
+++ b/src/mame/tch/littlerb.cpp
@@ -310,11 +310,10 @@ void littlerb_state::littlerb(machine_config &config)
TIMER(config, "step_timer").configure_periodic(FUNC(littlerb_state::sound_step_cb), attotime::from_hz(7500/150));
TIMER(config, "sound_timer").configure_periodic(FUNC(littlerb_state::sound_cb), attotime::from_hz(7500));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- DAC_8BIT_R2R(config, m_ldac, 0).add_route(ALL_OUTPUTS, "lspeaker", 0.5); // unknown DAC
- DAC_8BIT_R2R(config, m_rdac, 0).add_route(ALL_OUTPUTS, "rspeaker", 0.5); // unknown DAC
+ DAC_8BIT_R2R(config, m_ldac, 0).add_route(ALL_OUTPUTS, "speaker", 0.5, 0); // unknown DAC
+ DAC_8BIT_R2R(config, m_rdac, 0).add_route(ALL_OUTPUTS, "speaker", 0.5, 1); // unknown DAC
}
ROM_START( littlerb )
diff --git a/src/mame/tch/wheelfir.cpp b/src/mame/tch/wheelfir.cpp
index 8ae5de6b7a7..20dfb0dc9e5 100644
--- a/src/mame/tch/wheelfir.cpp
+++ b/src/mame/tch/wheelfir.cpp
@@ -819,10 +819,9 @@ void wheelfir_state::wheelfir(machine_config &config)
GENERIC_LATCH_16(config, "soundlatch");
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
- DAC_10BIT_R2R(config, "ldac", 0).add_route(ALL_OUTPUTS, "lspeaker", 1.0); // unknown DAC
- DAC_10BIT_R2R(config, "rdac", 0).add_route(ALL_OUTPUTS, "rspeaker", 1.0); // unknown DAC
+ SPEAKER(config, "speaker", 2).front();
+ DAC_10BIT_R2R(config, "ldac", 0).add_route(ALL_OUTPUTS, "speaker", 1.0, 0); // unknown DAC
+ DAC_10BIT_R2R(config, "rdac", 0).add_route(ALL_OUTPUTS, "speaker", 1.0, 1); // unknown DAC
}
diff --git a/src/mame/technos/blockout.cpp b/src/mame/technos/blockout.cpp
index 0f6ac210064..0199eb8449a 100644
--- a/src/mame/technos/blockout.cpp
+++ b/src/mame/technos/blockout.cpp
@@ -456,20 +456,19 @@ void blockout_state::blockout(machine_config &config)
PALETTE(config, m_palette).set_format(2, &blockout_state::xBGR_444, 513);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
ym2151_device &ymsnd(YM2151(config, "ymsnd", AUDIO_CLOCK));
ymsnd.irq_handler().set(FUNC(blockout_state::irq_handler));
- ymsnd.add_route(0, "lspeaker", 0.60);
- ymsnd.add_route(1, "rspeaker", 0.60);
+ ymsnd.add_route(0, "speaker", 0.60, 0);
+ ymsnd.add_route(1, "speaker", 0.60, 1);
okim6295_device &oki(OKIM6295(config, "oki", 1'056'000, okim6295_device::PIN7_HIGH));
- oki.add_route(ALL_OUTPUTS, "lspeaker", 0.50);
- oki.add_route(ALL_OUTPUTS, "rspeaker", 0.50);
+ oki.add_route(ALL_OUTPUTS, "speaker", 0.50, 0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 0.50, 1);
}
diff --git a/src/mame/technos/ddragon3.cpp b/src/mame/technos/ddragon3.cpp
index 7734aee2f43..306e0ea7235 100644
--- a/src/mame/technos/ddragon3.cpp
+++ b/src/mame/technos/ddragon3.cpp
@@ -842,20 +842,19 @@ void ddragon3_state::ddragon3(machine_config &config)
BUFFERED_SPRITERAM16(config, m_spriteram);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
ym2151_device &ym2151(YM2151(config, "ym2151", XTAL(3'579'545)));
ym2151.irq_handler().set_inputline(m_audiocpu, 0);
- ym2151.add_route(0, "lspeaker", 0.50);
- ym2151.add_route(1, "rspeaker", 0.50);
+ ym2151.add_route(0, "speaker", 0.50, 0);
+ ym2151.add_route(1, "speaker", 0.50, 1);
OKIM6295(config, m_oki, 1.056_MHz_XTAL, okim6295_device::PIN7_HIGH);
- m_oki->add_route(ALL_OUTPUTS, "lspeaker", 1.50);
- m_oki->add_route(ALL_OUTPUTS, "rspeaker", 1.50);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 1.50, 0);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 1.50, 1);
}
void ddragon3_state::ddragon3b(machine_config &config)
@@ -882,12 +881,12 @@ void ddragon3_state::ctribe(machine_config &config)
ym2151_device &ym2151(*subdevice<ym2151_device>("ym2151"));
ym2151.reset_routes();
- ym2151.add_route(0, "lspeaker", 1.20);
- ym2151.add_route(1, "rspeaker", 1.20);
+ ym2151.add_route(0, "speaker", 1.20, 0);
+ ym2151.add_route(1, "speaker", 1.20, 1);
m_oki->reset_routes();
- m_oki->add_route(ALL_OUTPUTS, "lspeaker", 0.80);
- m_oki->add_route(ALL_OUTPUTS, "rspeaker", 0.80);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 0.80, 0);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 0.80, 1);
}
diff --git a/src/mame/technos/shadfrce.cpp b/src/mame/technos/shadfrce.cpp
index 76fcbcbf023..d166e7158b6 100644
--- a/src/mame/technos/shadfrce.cpp
+++ b/src/mame/technos/shadfrce.cpp
@@ -795,20 +795,19 @@ void shadfrce_state::shadfrce(machine_config &config)
BUFFERED_SPRITERAM16(config, m_spvideoram);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
ym2151_device &ymsnd(YM2151(config, "ymsnd", XTAL(3'579'545))); // verified on PCB
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
- ymsnd.add_route(0, "lspeaker", 0.50);
- ymsnd.add_route(1, "rspeaker", 0.50);
+ ymsnd.add_route(0, "speaker", 0.50, 0);
+ ymsnd.add_route(1, "speaker", 0.50, 1);
OKIM6295(config, m_oki, XTAL(13'495'200) / 8, okim6295_device::PIN7_HIGH); // verified on PCB
- m_oki->add_route(ALL_OUTPUTS, "lspeaker", 0.50);
- m_oki->add_route(ALL_OUTPUTS, "rspeaker", 0.50);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 0.50, 0);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 0.50, 1);
}
// Rom Defs.
diff --git a/src/mame/technos/spdodgeb.cpp b/src/mame/technos/spdodgeb.cpp
index d66a8e2396a..8cdc7bfc48a 100644
--- a/src/mame/technos/spdodgeb.cpp
+++ b/src/mame/technos/spdodgeb.cpp
@@ -590,28 +590,27 @@ void spdodgeb_state::spdodgeb(machine_config &config)
PALETTE(config, m_palette, FUNC(spdodgeb_state::palette), 1024);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, M6809_IRQ_LINE);
ym3812_device &ymsnd(YM3812(config, "ymsnd", XTAL(12'000'000) / 4));
ymsnd.irq_handler().set_inputline(m_audiocpu, M6809_FIRQ_LINE);
- ymsnd.add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- ymsnd.add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ ymsnd.add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ ymsnd.add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
MSM5205(config, m_msm[0], 384000);
m_msm[0]->vck_legacy_callback().set(FUNC(spdodgeb_state::adpcm_int<0>)); // interrupt function
m_msm[0]->set_prescaler_selector(msm5205_device::S48_4B); // 8kHz?
- m_msm[0]->add_route(ALL_OUTPUTS, "lspeaker", 0.50);
- m_msm[0]->add_route(ALL_OUTPUTS, "rspeaker", 0.50);
+ m_msm[0]->add_route(ALL_OUTPUTS, "speaker", 0.50, 0);
+ m_msm[0]->add_route(ALL_OUTPUTS, "speaker", 0.50, 1);
MSM5205(config, m_msm[1], 384000);
m_msm[1]->vck_legacy_callback().set(FUNC(spdodgeb_state::adpcm_int<1>)); // interrupt function
m_msm[1]->set_prescaler_selector(msm5205_device::S48_4B); // 8kHz?
- m_msm[1]->add_route(ALL_OUTPUTS, "lspeaker", 0.50);
- m_msm[1]->add_route(ALL_OUTPUTS, "rspeaker", 0.50);
+ m_msm[1]->add_route(ALL_OUTPUTS, "speaker", 0.50, 0);
+ m_msm[1]->add_route(ALL_OUTPUTS, "speaker", 0.50, 1);
}
diff --git a/src/mame/technos/vball.cpp b/src/mame/technos/vball.cpp
index 21552ab0e47..b6c99f7cad0 100644
--- a/src/mame/technos/vball.cpp
+++ b/src/mame/technos/vball.cpp
@@ -639,20 +639,19 @@ void vball_state::vball(machine_config &config)
PALETTE(config, m_palette).set_entries(256);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
// The sound system comes all but verbatim from Double Dragon
GENERIC_LATCH_8(config, "soundlatch").data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
ym2151_device &ymsnd(YM2151(config, "ymsnd", 3.579545_MHz_XTAL));
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
- ymsnd.add_route(0, "lspeaker", 0.60);
- ymsnd.add_route(1, "rspeaker", 0.60);
+ ymsnd.add_route(0, "speaker", 0.60, 0);
+ ymsnd.add_route(1, "speaker", 0.60, 1);
okim6295_device &oki(OKIM6295(config, "oki", 1.056_MHz_XTAL, okim6295_device::PIN7_HIGH));
- oki.add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- oki.add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
}
diff --git a/src/mame/technos/wwfsstar.cpp b/src/mame/technos/wwfsstar.cpp
index 31fb88cb6a8..9a483b79d61 100644
--- a/src/mame/technos/wwfsstar.cpp
+++ b/src/mame/technos/wwfsstar.cpp
@@ -637,20 +637,19 @@ void wwfsstar_state::wwfsstar(machine_config &config)
PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 384);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
ym2151_device &ymsnd(YM2151(config, "ymsnd", 3.579545_MHz_XTAL));
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
- ymsnd.add_route(0, "lspeaker", 0.45);
- ymsnd.add_route(1, "rspeaker", 0.45);
+ ymsnd.add_route(0, "speaker", 0.45, 0);
+ ymsnd.add_route(1, "speaker", 0.45, 1);
okim6295_device &oki(OKIM6295(config, "oki", 1.056_MHz_XTAL, okim6295_device::PIN7_HIGH));
- oki.add_route(ALL_OUTPUTS, "lspeaker", 0.47);
- oki.add_route(ALL_OUTPUTS, "rspeaker", 0.47);
+ oki.add_route(ALL_OUTPUTS, "speaker", 0.47, 0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 0.47, 1);
}
void wwfsstar_state::wwfsstarb2(machine_config &config)
diff --git a/src/mame/tecmo/tecmo16.cpp b/src/mame/tecmo/tecmo16.cpp
index 87595fcd819..b225b6e0677 100644
--- a/src/mame/tecmo/tecmo16.cpp
+++ b/src/mame/tecmo/tecmo16.cpp
@@ -698,19 +698,18 @@ void tecmo16_state::base(machine_config &config)
m_mixer->set_bgpen(0x000 + 0x300, 0x400 + 0x300);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, "soundlatch").data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
ym2151_device &ymsnd(YM2151(config, "ymsnd", MASTER_CLOCK/6)); // 4 MHz
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
- ymsnd.add_route(0, "lspeaker", 0.60);
- ymsnd.add_route(1, "rspeaker", 0.60);
+ ymsnd.add_route(0, "speaker", 0.60, 0);
+ ymsnd.add_route(1, "speaker", 0.60, 1);
okim6295_device &oki(OKIM6295(config, "oki", OKI_CLOCK / 8, okim6295_device::PIN7_HIGH)); // sample rate 1 MHz / 132
- oki.add_route(ALL_OUTPUTS, "lspeaker", 0.40);
- oki.add_route(ALL_OUTPUTS, "rspeaker", 0.40);
+ oki.add_route(ALL_OUTPUTS, "speaker", 0.40, 0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 0.40, 1);
}
void tecmo16_state::ginkun(machine_config &config)
diff --git a/src/mame/tecmo/tecmosys.cpp b/src/mame/tecmo/tecmosys.cpp
index c9e03f2f2e3..5370cb9a5e5 100644
--- a/src/mame/tecmo/tecmosys.cpp
+++ b/src/mame/tecmo/tecmosys.cpp
@@ -469,8 +469,7 @@ void tecmosys_state::tecmosys(machine_config &config)
PALETTE(config, m_palette).set_format(palette_device::xGRB_555, 0x4000+0x800);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set("soundnmi", FUNC(input_merger_device::in_w<0>));
@@ -480,19 +479,19 @@ void tecmosys_state::tecmosys(machine_config &config)
ymf262_device &ymf(YMF262(config, "ymf", XTAL(14'318'181)));
ymf.irq_handler().set_inputline("audiocpu", 0);
- ymf.add_route(0, "lspeaker", 0.50);
- ymf.add_route(1, "rspeaker", 0.50);
- ymf.add_route(2, "lspeaker", 0.50);
- ymf.add_route(3, "rspeaker", 0.50);
+ ymf.add_route(0, "speaker", 0.50, 0);
+ ymf.add_route(1, "speaker", 0.50, 1);
+ ymf.add_route(2, "speaker", 0.50, 0);
+ ymf.add_route(3, "speaker", 0.50, 1);
okim6295_device &oki(OKIM6295(config, "oki", XTAL(16'000'000)/8, okim6295_device::PIN7_HIGH));
- oki.add_route(ALL_OUTPUTS, "lspeaker", 0.25);
- oki.add_route(ALL_OUTPUTS, "rspeaker", 0.25);
+ oki.add_route(ALL_OUTPUTS, "speaker", 0.25, 0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 0.25, 1);
oki.set_addrmap(0, &tecmosys_state::oki_map);
ymz280b_device &ymz(YMZ280B(config, "ymz", XTAL(16'934'400)));
- ymz.add_route(0, "lspeaker", 0.30);
- ymz.add_route(1, "rspeaker", 0.30);
+ ymz.add_route(0, "speaker", 0.30, 0);
+ ymz.add_route(1, "speaker", 0.30, 1);
}
ROM_START( deroon )
diff --git a/src/mame/toaplan/dt7.cpp b/src/mame/toaplan/dt7.cpp
index a78b1933f60..749b7db1e16 100644
--- a/src/mame/toaplan/dt7.cpp
+++ b/src/mame/toaplan/dt7.cpp
@@ -446,18 +446,17 @@ void dt7_state::dt7(machine_config &config)
GFXDECODE(config, m_gfxdecode[1], m_palette[1], gfx_textrom_double_1);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- YM2151(config, "ymsnd", 27_MHz_XTAL/8).add_route(ALL_OUTPUTS, "lspeaker", 0.5);
+ YM2151(config, "ymsnd", 27_MHz_XTAL/8).add_route(ALL_OUTPUTS, "speaker", 0.5, 0);
OKIM6295(config, m_oki[0], 27_MHz_XTAL / 24, okim6295_device::PIN7_HIGH);
- m_oki[0]->add_route(ALL_OUTPUTS, "lspeaker", 0.5);
+ m_oki[0]->add_route(ALL_OUTPUTS, "speaker", 0.5, 0);
- YM2151(config, "ymsnd2", 27_MHz_XTAL/8).add_route(ALL_OUTPUTS, "rspeaker", 0.5);
+ YM2151(config, "ymsnd2", 27_MHz_XTAL/8).add_route(ALL_OUTPUTS, "speaker", 0.5, 1);
OKIM6295(config, m_oki[1], 27_MHz_XTAL/24, okim6295_device::PIN7_HIGH);
- m_oki[1]->add_route(ALL_OUTPUTS, "rspeaker", 0.5);
+ m_oki[1]->add_route(ALL_OUTPUTS, "speaker", 0.5, 1);
}
diff --git a/src/mame/toaplan/truxton2.cpp b/src/mame/toaplan/truxton2.cpp
index 01885e62dbc..af68dea56bd 100644
--- a/src/mame/toaplan/truxton2.cpp
+++ b/src/mame/toaplan/truxton2.cpp
@@ -339,14 +339,13 @@ void truxton2_state::truxton2(machine_config &config)
/* sound hardware */
#ifdef TRUXTON2_STEREO // music data is stereo...
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- YM2151(config, "ymsnd", 27_MHz_XTAL/8).add_route(0, "lspeaker", 0.5).add_route(1, "rspeaker", 0.5);
+ YM2151(config, "ymsnd", 27_MHz_XTAL/8).add_route(0, "speaker", 0.5, 0).add_route(1, "speaker", 0.5, 1);
OKIM6295(config, m_oki, 16_MHz_XTAL/4, okim6295_device::PIN7_LOW);
- m_oki->add_route(ALL_OUTPUTS, "lspeaker", 0.5);
- m_oki->add_route(ALL_OUTPUTS, "rspeaker", 0.5);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 0.5, 0);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 0.5, 1);
#else // ...but the hardware is mono
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/trs/vis.cpp b/src/mame/trs/vis.cpp
index 88deec374b5..ebf46d981f6 100644
--- a/src/mame/trs/vis.cpp
+++ b/src/mame/trs/vis.cpp
@@ -134,19 +134,18 @@ TIMER_CALLBACK_MEMBER(vis_audio_device::pcm_update)
void vis_audio_device::device_add_mconfig(machine_config &config)
{
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ymf262_device &ymf262(YMF262(config, "ymf262", XTAL(14'318'181)));
- ymf262.add_route(0, "lspeaker", 1.00);
- ymf262.add_route(1, "rspeaker", 1.00);
- ymf262.add_route(2, "lspeaker", 1.00);
- ymf262.add_route(3, "rspeaker", 1.00);
+ ymf262.add_route(0, "speaker", 1.00, 0);
+ ymf262.add_route(1, "speaker", 1.00, 1);
+ ymf262.add_route(2, "speaker", 1.00, 0);
+ ymf262.add_route(3, "speaker", 1.00, 1);
DAC_16BIT_R2R(config, m_ldac, 0);
DAC_16BIT_R2R(config, m_rdac, 0);
- m_ldac->add_route(ALL_OUTPUTS, "lspeaker", 1.0); // sanyo lc7883k
- m_rdac->add_route(ALL_OUTPUTS, "rspeaker", 1.0); // sanyo lc7883k
+ m_ldac->add_route(ALL_OUTPUTS, "speaker", 1.0, 0); // sanyo lc7883k
+ m_rdac->add_route(ALL_OUTPUTS, "speaker", 1.0, 1); // sanyo lc7883k
}
uint8_t vis_audio_device::pcm_r(offs_t offset)
diff --git a/src/mame/tvgames/actions_atj2279b.cpp b/src/mame/tvgames/actions_atj2279b.cpp
index 89d3e3d50f2..69325f2508b 100644
--- a/src/mame/tvgames/actions_atj2279b.cpp
+++ b/src/mame/tvgames/actions_atj2279b.cpp
@@ -89,8 +89,7 @@ void actions_atj2279b_state::actions_atj2279b(machine_config &config)
screen.set_visarea(0, 1280-1, 0, 720-1); // resolution unconfirmed (possibly 1080p as well, but this is unlikely)
screen.set_screen_update(FUNC(actions_atj2279b_state::screen_update));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
ROM_START( rbitgen )
diff --git a/src/mame/tvgames/elan_eu3a05_a.cpp b/src/mame/tvgames/elan_eu3a05_a.cpp
index fcdaed8a003..13fa89e0334 100644
--- a/src/mame/tvgames/elan_eu3a05_a.cpp
+++ b/src/mame/tvgames/elan_eu3a05_a.cpp
@@ -92,16 +92,13 @@ void elan_eu3a05_sound_device::device_reset()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void elan_eu3a05_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void elan_eu3a05_sound_device::sound_stream_update(sound_stream &stream)
{
- // reset the output stream
- outputs[0].fill(0);
-
int volume = m_volumes[0] | (m_volumes[1] << 8);
int outpos = 0;
// loop while we still have samples to generate
- int samples = outputs[0].samples();
+ int samples = stream.samples();
while (samples-- != 0)
{
int total = 0;
@@ -140,7 +137,7 @@ void elan_eu3a05_sound_device::sound_stream_update(sound_stream &stream, std::ve
//LOGMASKED( LOG_AUDIO, "m_isstopped %02x channel %d is NOT active %08x %06x\n", m_isstopped, channel, m_sound_byte_address[channel], m_sound_current_nib_pos[channel]);
}
}
- outputs[0].put_int(outpos, total, 32768 * 6);
+ stream.put_int(0, outpos, total, 32768 * 6);
outpos++;
}
}
diff --git a/src/mame/tvgames/elan_eu3a05_a.h b/src/mame/tvgames/elan_eu3a05_a.h
index 13e8bfc86ec..5c9cf303379 100644
--- a/src/mame/tvgames/elan_eu3a05_a.h
+++ b/src/mame/tvgames/elan_eu3a05_a.h
@@ -30,7 +30,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 space_config_vector memory_space_config() const override;
const address_space_config m_space_config;
diff --git a/src/mame/tvgames/generalplus_gpl16250.cpp b/src/mame/tvgames/generalplus_gpl16250.cpp
index 0cecae9e5d3..b4059ea7b79 100644
--- a/src/mame/tvgames/generalplus_gpl16250.cpp
+++ b/src/mame/tvgames/generalplus_gpl16250.cpp
@@ -144,8 +144,8 @@ void gcm394_game_state::base(machine_config &config)
m_maincpu->space_read_callback().set(FUNC(gcm394_game_state::read_external_space));
m_maincpu->space_write_callback().set(FUNC(gcm394_game_state::write_external_space));
m_maincpu->set_irq_acknowledge_callback(m_maincpu, FUNC(sunplus_gcm394_base_device::irq_vector_cb));
- m_maincpu->add_route(ALL_OUTPUTS, "lspeaker", 0.5);
- m_maincpu->add_route(ALL_OUTPUTS, "rspeaker", 0.5);
+ m_maincpu->add_route(ALL_OUTPUTS, "speaker", 0.5, 0);
+ m_maincpu->add_route(ALL_OUTPUTS, "speaker", 0.5, 1);
m_maincpu->set_bootmode(1); // boot from external ROM / CS mirror
m_maincpu->set_cs_config_callback(FUNC(gcm394_game_state::cs_callback));
@@ -158,8 +158,7 @@ void gcm394_game_state::base(machine_config &config)
m_screen->set_screen_update("maincpu", FUNC(sunplus_gcm394_device::screen_update));
m_screen->screen_vblank().set(m_maincpu, FUNC(sunplus_gcm394_device::vblank));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
diff --git a/src/mame/tvgames/generalplus_gpl16250_mobigo.cpp b/src/mame/tvgames/generalplus_gpl16250_mobigo.cpp
index 5d77132e9e8..6d398a4827b 100644
--- a/src/mame/tvgames/generalplus_gpl16250_mobigo.cpp
+++ b/src/mame/tvgames/generalplus_gpl16250_mobigo.cpp
@@ -109,8 +109,8 @@ void mobigo2_state::mobigo2(machine_config &config)
m_maincpu->space_read_callback().set(FUNC(mobigo2_state::read_external_space));
m_maincpu->space_write_callback().set(FUNC(mobigo2_state::write_external_space));
m_maincpu->set_irq_acknowledge_callback(m_maincpu, FUNC(sunplus_gcm394_base_device::irq_vector_cb));
- m_maincpu->add_route(ALL_OUTPUTS, "lspeaker", 0.5);
- m_maincpu->add_route(ALL_OUTPUTS, "rspeaker", 0.5);
+ m_maincpu->add_route(ALL_OUTPUTS, "speaker", 0.5, 0);
+ m_maincpu->add_route(ALL_OUTPUTS, "speaker", 0.5, 1);
m_maincpu->set_bootmode(0); // boot from internal ROM (NAND bootstrap)
m_maincpu->set_cs_config_callback(FUNC(mobigo2_state::cs_callback));
@@ -125,8 +125,7 @@ void mobigo2_state::mobigo2(machine_config &config)
m_screen->set_screen_update("maincpu", FUNC(sunplus_gcm394_device::screen_update));
m_screen->screen_vblank().set(m_maincpu, FUNC(sunplus_gcm394_device::vblank));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_CARTSLOT(config, m_cart, generic_plain_slot, "mobigo_cart");
m_cart->set_width(GENERIC_ROM16_WIDTH);
diff --git a/src/mame/tvgames/generalplus_gpl16250_nand.cpp b/src/mame/tvgames/generalplus_gpl16250_nand.cpp
index e3c2dccae1d..311e471a532 100644
--- a/src/mame/tvgames/generalplus_gpl16250_nand.cpp
+++ b/src/mame/tvgames/generalplus_gpl16250_nand.cpp
@@ -81,8 +81,8 @@ void generalplus_gpac800_game_state::generalplus_gpac800(machine_config &config)
m_maincpu->space_read_callback().set(FUNC(generalplus_gpac800_game_state::read_external_space));
m_maincpu->space_write_callback().set(FUNC(generalplus_gpac800_game_state::write_external_space));
m_maincpu->set_irq_acknowledge_callback(m_maincpu, FUNC(sunplus_gcm394_base_device::irq_vector_cb));
- m_maincpu->add_route(ALL_OUTPUTS, "lspeaker", 0.5);
- m_maincpu->add_route(ALL_OUTPUTS, "rspeaker", 0.5);
+ m_maincpu->add_route(ALL_OUTPUTS, "speaker", 0.5, 0);
+ m_maincpu->add_route(ALL_OUTPUTS, "speaker", 0.5, 1);
m_maincpu->set_bootmode(0); // boot from internal ROM (NAND bootstrap)
m_maincpu->set_cs_config_callback(FUNC(gcm394_game_state::cs_callback));
@@ -97,8 +97,7 @@ void generalplus_gpac800_game_state::generalplus_gpac800(machine_config &config)
m_screen->set_screen_update("maincpu", FUNC(sunplus_gcm394_device::screen_update));
m_screen->screen_vblank().set(m_maincpu, FUNC(sunplus_gcm394_device::vblank));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
DEVICE_IMAGE_LOAD_MEMBER(generalplus_gpac800_vbaby_game_state::cart_load)
diff --git a/src/mame/tvgames/generalplus_gpl16250_spi.cpp b/src/mame/tvgames/generalplus_gpl16250_spi.cpp
index 3be14982e29..0e84c04bf7f 100644
--- a/src/mame/tvgames/generalplus_gpl16250_spi.cpp
+++ b/src/mame/tvgames/generalplus_gpl16250_spi.cpp
@@ -83,8 +83,8 @@ void generalplus_gpspispi_game_state::generalplus_gpspispi(machine_config &confi
m_maincpu->space_read_callback().set(FUNC(generalplus_gpspispi_game_state::read_external_space));
m_maincpu->space_write_callback().set(FUNC(generalplus_gpspispi_game_state::write_external_space));
m_maincpu->set_irq_acknowledge_callback(m_maincpu, FUNC(sunplus_gcm394_base_device::irq_vector_cb));
- m_maincpu->add_route(ALL_OUTPUTS, "lspeaker", 0.5);
- m_maincpu->add_route(ALL_OUTPUTS, "rspeaker", 0.5);
+ m_maincpu->add_route(ALL_OUTPUTS, "speaker", 0.5, 0);
+ m_maincpu->add_route(ALL_OUTPUTS, "speaker", 0.5, 1);
m_maincpu->set_bootmode(0); // boot from internal ROM (SPI bootstrap)
m_maincpu->set_cs_config_callback(FUNC(gcm394_game_state::cs_callback));
@@ -97,8 +97,7 @@ void generalplus_gpspispi_game_state::generalplus_gpspispi(machine_config &confi
m_screen->set_screen_update("maincpu", FUNC(sunplus_gcm394_device::screen_update));
m_screen->screen_vblank().set(m_maincpu, FUNC(sunplus_gcm394_device::vblank));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
DEVICE_IMAGE_LOAD_MEMBER(generalplus_gpspispi_bkrankp_game_state::cart_load)
diff --git a/src/mame/tvgames/generalplus_gpl16250_spi_direct.cpp b/src/mame/tvgames/generalplus_gpl16250_spi_direct.cpp
index 00b8c13b12d..b3eb8e7207d 100644
--- a/src/mame/tvgames/generalplus_gpl16250_spi_direct.cpp
+++ b/src/mame/tvgames/generalplus_gpl16250_spi_direct.cpp
@@ -119,8 +119,8 @@ void generalplus_gpspi_direct_game_state::generalplus_gpspi_direct(machine_confi
m_maincpu->space_read_callback().set(FUNC(generalplus_gpspi_direct_game_state::read_external_space));
m_maincpu->space_write_callback().set(FUNC(generalplus_gpspi_direct_game_state::write_external_space));
m_maincpu->set_irq_acknowledge_callback(m_maincpu, FUNC(sunplus_gcm394_base_device::irq_vector_cb));
- m_maincpu->add_route(ALL_OUTPUTS, "lspeaker", 0.5);
- m_maincpu->add_route(ALL_OUTPUTS, "rspeaker", 0.5);
+ m_maincpu->add_route(ALL_OUTPUTS, "speaker", 0.5, 0);
+ m_maincpu->add_route(ALL_OUTPUTS, "speaker", 0.5, 1);
m_maincpu->set_bootmode(0);
m_maincpu->set_cs_config_callback(FUNC(gcm394_game_state::cs_callback));
@@ -134,8 +134,7 @@ void generalplus_gpspi_direct_game_state::generalplus_gpspi_direct(machine_confi
m_screen->set_screen_update("maincpu", FUNC(sunplus_gcm394_device::screen_update));
m_screen->screen_vblank().set(m_maincpu, FUNC(sunplus_gcm394_device::vblank));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
// Is there an internal ROM that gets mapped out or can this type really execute directly from scrambled SPI?
diff --git a/src/mame/tvgames/generalplus_gpl32612.cpp b/src/mame/tvgames/generalplus_gpl32612.cpp
index 61bae26c9aa..c6f592a0ac7 100644
--- a/src/mame/tvgames/generalplus_gpl32612.cpp
+++ b/src/mame/tvgames/generalplus_gpl32612.cpp
@@ -184,8 +184,7 @@ void generalplus_gpl32612_game_state::gpl32612(machine_config &config)
m_screen->set_visarea(0, 320-1, 0, 240-1);
m_screen->set_screen_update(FUNC(generalplus_gpl32612_game_state::screen_update_gpl32612));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
void generalplus_zippity_game_state::machine_start()
@@ -224,8 +223,7 @@ void generalplus_zippity_game_state::zippity(machine_config &config)
m_screen->set_visarea(0, 320-1, 0, 240-1);
m_screen->set_screen_update(FUNC(generalplus_zippity_game_state::screen_update_gpl32612));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_CARTSLOT(config, m_cart, generic_plain_slot, "leapfrog_zippity_cart");
m_cart->set_width(GENERIC_ROM16_WIDTH);
diff --git a/src/mame/tvgames/generalplus_gpm453x_sdcard.cpp b/src/mame/tvgames/generalplus_gpm453x_sdcard.cpp
index f1b6ae999c3..f12de9ef0fb 100644
--- a/src/mame/tvgames/generalplus_gpm453x_sdcard.cpp
+++ b/src/mame/tvgames/generalplus_gpm453x_sdcard.cpp
@@ -76,8 +76,7 @@ void gpm4530a_lexibook_state::gpm4530a_lexibook(machine_config &config)
SPI_SDCARD(config, m_sdcard, 0);
m_sdcard->set_prefer_sdhc();
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
ROM_START( lx_jg7420 )
diff --git a/src/mame/tvgames/magiceyes_pollux_vr3520f.cpp b/src/mame/tvgames/magiceyes_pollux_vr3520f.cpp
index fa4a9cf48f8..24354842dc0 100644
--- a/src/mame/tvgames/magiceyes_pollux_vr3520f.cpp
+++ b/src/mame/tvgames/magiceyes_pollux_vr3520f.cpp
@@ -100,8 +100,7 @@ void magiceyes_vr3520f_game_state::leapfrog_didj(machine_config &config)
screen.set_visarea(0, 640-1, 0, 480-1);
screen.set_screen_update(FUNC(magiceyes_vr3520f_game_state::screen_update));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_CARTSLOT(config, m_cart, generic_plain_slot, "leapfrog_didj_cart");
m_cart->set_width(GENERIC_ROM16_WIDTH);
diff --git a/src/mame/tvgames/spg110.cpp b/src/mame/tvgames/spg110.cpp
index db1df9e3ecd..64f71934efc 100644
--- a/src/mame/tvgames/spg110.cpp
+++ b/src/mame/tvgames/spg110.cpp
@@ -527,10 +527,9 @@ void spg110_game_state::spg110_base(machine_config &config)
m_screen->set_screen_update("maincpu", FUNC(spg110_device::screen_update));
m_screen->screen_vblank().set(m_maincpu, FUNC(spg110_device::vblank));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
- m_maincpu->add_route(ALL_OUTPUTS, "lspeaker", 0.5);
- m_maincpu->add_route(ALL_OUTPUTS, "rspeaker", 0.5);
+ SPEAKER(config, "speaker", 2).front();
+ m_maincpu->add_route(ALL_OUTPUTS, "speaker", 0.5, 0);
+ m_maincpu->add_route(ALL_OUTPUTS, "speaker", 0.5, 1);
}
void spg110_game_state::spg110_base_pal(machine_config &config)
diff --git a/src/mame/tvgames/spg2xx.cpp b/src/mame/tvgames/spg2xx.cpp
index 40a5df2d2f9..c97987db9db 100644
--- a/src/mame/tvgames/spg2xx.cpp
+++ b/src/mame/tvgames/spg2xx.cpp
@@ -1498,10 +1498,9 @@ void spg2xx_game_state::spg2xx_base(machine_config &config)
m_screen->set_screen_update("maincpu", FUNC(spg2xx_device::screen_update));
m_screen->screen_vblank().set(m_maincpu, FUNC(spg2xx_device::vblank));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
- m_maincpu->add_route(ALL_OUTPUTS, "lspeaker", 0.5);
- m_maincpu->add_route(ALL_OUTPUTS, "rspeaker", 0.5);
+ SPEAKER(config, "speaker", 2).front();
+ m_maincpu->add_route(ALL_OUTPUTS, "speaker", 0.5, 0);
+ m_maincpu->add_route(ALL_OUTPUTS, "speaker", 0.5, 1);
}
void spg2xx_game_state::non_spg_base(machine_config &config)
@@ -2470,6 +2469,11 @@ ROM_START( doraglob )
ROM_LOAD16_WORD_SWAP( "doraglobe.bin", 0x000000, 0x800000, CRC(6f454c50) SHA1(201e2de3d90abe017a8dc141613cbf6383423d13) )
ROM_END
+ROM_START( doraglobuk )
+ ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASE00 )
+ ROM_LOAD16_WORD_SWAP( "doraglobeuk.u4", 0x000000, 0x800000, CRC(b20a22b8) SHA1(f7e42a86479e68092b27068535cff90ca686f361) )
+ROM_END
+
ROM_START( doraglobf )
ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASE00 )
ROM_LOAD16_WORD_SWAP( "doraglobefrance.bin", 0x000000, 0x800000, CRC(7124edc1) SHA1(b144fc1f13a28299ef14f1d01f7acd2677e4ebb9) )
@@ -2558,6 +2562,13 @@ ROM_START( ban_krkk )
ROM_LOAD16_WORD_SWAP( "quiz.bin", 0x000000, 0x400000, CRC(6f51180a) SHA1(38017ecaae4eead38482aeb04c90b5a5eeebd6ca) )
ROM_END
+ROM_START( ban_tam2 )
+ // has "#12175 TV Game Tamagotchi 2" on PCB
+ ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASE00 )
+ ROM_LOAD16_WORD_SWAP( "tvgametamagotchi2.bin", 0x000000, 0x800000, CRC(cc4322fa) SHA1(7ba0d3e8b9012dfa631a921cc2c7da9a21e535bd) )
+ROM_END
+
+
ROM_START( epo_tetr )
ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASE00 )
ROM_LOAD16_WORD_SWAP( "mx29lv320mb.bin", 0x000000, 0x400000, CRC(b4ad30e0) SHA1(83e30e199854c647f9a197562d1bf1f3bc847fff) )
@@ -2709,7 +2720,8 @@ CONS( 2006, doraphonf, doraphon, 0, doraphonep,doraphonep,spg2xx_game_doraphone
// This was from a 'cost reduced' unit with the 'non-TV' mode switch and internal speaker removed, however it looks like the code was not disabled or removed as the mode is fully functional.
// The ZC-Infinity video for this on YouTube shows the map scrolling to center the continent, there doesn't appear to be an input for this, different revision?
// a Dutch localized version also exists, which again must be different code
-CONS( 2007, doraglob, 0, 0, doraphone, doraglobe, spg2xx_game_doraphone_state,empty_init, "VTech", "Dora the Explorer - Dora TV Adventure Globe", MACHINE_IMPERFECT_SOUND )
+CONS( 2007, doraglob, 0, 0, doraphone, doraglobe, spg2xx_game_doraphone_state,empty_init, "VTech", "Dora the Explorer - Dora TV Adventure Globe (US)", MACHINE_IMPERFECT_SOUND )
+CONS( 2007, doraglobuk, doraglob, 0, doraphone, doraglobe, spg2xx_game_doraphone_state,empty_init, "VTech", "Dora the Explorer - Dora TV Adventure Globe (UK)", MACHINE_IMPERFECT_SOUND )
CONS( 2007, doraglobf, doraglob, 0, doraphone, doraglobe, spg2xx_game_doraphone_state,empty_init, "VTech", "Dora the Explorer - Dora TV Globe-Trotter (France)", MACHINE_IMPERFECT_SOUND )
CONS( 2007, doraglobg, doraglob, 0, doraphone, doraglobe, spg2xx_game_doraphone_state,empty_init, "VTech", "Dora the Explorer - Doras Abenteuer-Globus (Germany)", MACHINE_IMPERFECT_SOUND )
@@ -2779,6 +2791,9 @@ CONS( 2006, dmbtjunc, 0, 0, spg2xx, dmbtjunc, spg2xx_game_state,
// Let's!TVプレイ 脳と体を鍛える 体感頭脳ファミリーマットレ - Let's! TV Play branding appears on the box
CONS( 2006, ban_krkk, 0, 0, spg2xx, ban_krkk, spg2xx_game_state, init_crc, "Bandai", "Let's! TV Play Nou to Karada o Kitaeru Taikan Zunou Family Mattore (Japan)", MACHINE_IMPERFECT_SOUND )
+// Let's!TVプレイ チームたいこー! カードでパワーUP! たまごっちスクール選手権 - has IR for optional connectivity with external Tamagotchi device, and a card scanner used for gameplay
+CONS( 2007, ban_tam2, 0, 0, spg2xx, spg2xx, spg2xx_game_state, init_crc, "Bandai", "Let's! TV Play Team Taikou! Card de Power Up! Tamagotchi School Senshuken (Japan)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND )
+
CONS( 2007, epo_tetr, 0, 0, epo_tetr, epo_tetr, epo_tetr_game_state, empty_init, "Epoch", "Minna no Tetris (Japan)", MACHINE_IMPERFECT_SOUND )
// Train Game V1.4 2012-08-15 on PCB. SPG243 headers in each chunk.
diff --git a/src/mame/tvgames/xavix.cpp b/src/mame/tvgames/xavix.cpp
index 48f09f4150b..04b228ebda2 100644
--- a/src/mame/tvgames/xavix.cpp
+++ b/src/mame/tvgames/xavix.cpp
@@ -1779,15 +1779,14 @@ void xavix_state::xavix(machine_config &config)
/* sound hardware */
//SPEAKER(config, "mono").front_center();
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
XAVIX_SOUND(config, m_sound, MAIN_CLOCK);
m_sound->read_regs_callback().set(FUNC(xavix_state::sound_regram_read_cb));
m_sound->read_samples_callback().set(FUNC(xavix_state::sample_read));
//m_sound->add_route(ALL_OUTPUTS, "mono", 1.0);
- m_sound->add_route(0, "lspeaker", 1.0);
- m_sound->add_route(1, "rspeaker", 1.0);
+ m_sound->add_route(0, "speaker", 1.0, 0);
+ m_sound->add_route(1, "speaker", 1.0, 1);
}
void xavix_state::xavix_4mb(machine_config &config)
diff --git a/src/mame/tvgames/xavix.h b/src/mame/tvgames/xavix.h
index 2a11c60d495..5102b0506e7 100644
--- a/src/mame/tvgames/xavix.h
+++ b/src/mame/tvgames/xavix.h
@@ -48,7 +48,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;
private:
sound_stream *m_stream = nullptr;
diff --git a/src/mame/tvgames/xavix2.cpp b/src/mame/tvgames/xavix2.cpp
index da3571e58bd..c51ddebfe34 100644
--- a/src/mame/tvgames/xavix2.cpp
+++ b/src/mame/tvgames/xavix2.cpp
@@ -730,8 +730,7 @@ void xavix2_state::config(machine_config &config)
m_screen->set_visarea(0, 639, 0, 399);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
// unknown sound hardware
}
diff --git a/src/mame/tvgames/xavix_a.cpp b/src/mame/tvgames/xavix_a.cpp
index ebddb577444..2baf87b1de6 100644
--- a/src/mame/tvgames/xavix_a.cpp
+++ b/src/mame/tvgames/xavix_a.cpp
@@ -40,15 +40,11 @@ void xavix_sound_device::device_reset()
}
-void xavix_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void xavix_sound_device::sound_stream_update(sound_stream &stream)
{
- // reset the output stream
- outputs[0].fill(0);
- outputs[1].fill(0);
-
int outpos = 0;
// loop while we still have samples to generate
- int samples = outputs[0].samples();
+ int samples = stream.samples();
while (samples-- != 0)
{
for (int channel = 0; channel < 2; channel++)
@@ -81,7 +77,7 @@ void xavix_sound_device::sound_stream_update(sound_stream &stream, std::vector<r
*/
}
- outputs[channel].add_int(outpos, sample * (m_voice[v].vol + 1), 32768);
+ stream.add_int(channel, outpos, sample * (m_voice[v].vol + 1), 32768);
m_voice[v].position[channel] += m_voice[v].rate;
}
else
diff --git a/src/mame/unico/goori.cpp b/src/mame/unico/goori.cpp
index 76888a82b30..1ca872b7a0d 100644
--- a/src/mame/unico/goori.cpp
+++ b/src/mame/unico/goori.cpp
@@ -290,14 +290,13 @@ void goori_state::goori(machine_config &config)
PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x2000);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
OKIM6295(config, m_oki, 16_MHz_XTAL/16, okim6295_device::PIN7_HIGH); // clock frequency & pin 7 not verified
- m_oki->add_route(ALL_OUTPUTS, "lspeaker", 0.80);
- m_oki->add_route(ALL_OUTPUTS, "rspeaker", 0.80);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 0.80, 0);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 0.80, 1);
- YM2151(config, "ymsnd", 3.579545_MHz_XTAL).add_route(0, "lspeaker", 0.40).add_route(1, "rspeaker", 0.40);
+ YM2151(config, "ymsnd", 3.579545_MHz_XTAL).add_route(0, "speaker", 0.40, 0).add_route(1, "speaker", 0.40, 1);
}
ROM_START( goori )
diff --git a/src/mame/unico/silkroad.cpp b/src/mame/unico/silkroad.cpp
index df60c211757..e52b65bd71b 100644
--- a/src/mame/unico/silkroad.cpp
+++ b/src/mame/unico/silkroad.cpp
@@ -459,19 +459,18 @@ void silkroad_state::silkroad(machine_config &config)
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x2000).set_membits(16);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- YM2151(config, "ymsnd", XTAL(3'579'545)).add_route(0, "lspeaker", 1.0).add_route(1, "rspeaker", 1.0);
+ YM2151(config, "ymsnd", XTAL(3'579'545)).add_route(0, "speaker", 1.0, 0).add_route(1, "speaker", 1.0, 1);
okim6295_device &oki1(OKIM6295(config, "oki1", XTAL(32'000'000) / 32, okim6295_device::PIN7_HIGH)); // clock frequency & pin 7 not verified (was 1056000)
oki1.set_addrmap(0, &silkroad_state::oki_map);
- oki1.add_route(ALL_OUTPUTS, "lspeaker", 0.45);
- oki1.add_route(ALL_OUTPUTS, "rspeaker", 0.45);
+ oki1.add_route(ALL_OUTPUTS, "speaker", 0.45, 0);
+ oki1.add_route(ALL_OUTPUTS, "speaker", 0.45, 1);
okim6295_device &oki2(OKIM6295(config, "oki2", XTAL(32'000'000) / 16, okim6295_device::PIN7_HIGH)); // clock frequency & pin 7 not verified (was 2112000)
- oki2.add_route(ALL_OUTPUTS, "lspeaker", 0.45);
- oki2.add_route(ALL_OUTPUTS, "rspeaker", 0.45);
+ oki2.add_route(ALL_OUTPUTS, "speaker", 0.45, 0);
+ oki2.add_route(ALL_OUTPUTS, "speaker", 0.45, 1);
}
diff --git a/src/mame/unico/unico.cpp b/src/mame/unico/unico.cpp
index 6da4cc62eae..10d29fbe590 100644
--- a/src/mame/unico/unico.cpp
+++ b/src/mame/unico/unico.cpp
@@ -933,16 +933,15 @@ void burglarx_state::burglarx(machine_config &config)
PALETTE(config, m_palette).set_format(4, &burglarx_state::unico_R6G6B6X, 8192);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym3812_device &ymsnd(YM3812(config, "ymsnd", XTAL(14'318'181) / 4)); // 3.579545 MHz
- ymsnd.add_route(ALL_OUTPUTS, "lspeaker", 0.40);
- ymsnd.add_route(ALL_OUTPUTS, "rspeaker", 0.40);
+ ymsnd.add_route(ALL_OUTPUTS, "speaker", 0.40, 0);
+ ymsnd.add_route(ALL_OUTPUTS, "speaker", 0.40, 1);
OKIM6295(config, m_oki, 32_MHz_XTAL / 32, okim6295_device::PIN7_HIGH); // clock frequency & pin 7 not verified
- m_oki->add_route(ALL_OUTPUTS, "lspeaker", 0.80);
- m_oki->add_route(ALL_OUTPUTS, "rspeaker", 0.80);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 0.80, 0);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 0.80, 1);
}
@@ -977,17 +976,16 @@ void zeropnt_state::zeropnt(machine_config &config)
PALETTE(config, m_palette).set_format(4, &zeropnt_state::unico_R6G6B6X, 8192);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym3812_device &ymsnd(YM3812(config, "ymsnd", XTAL(14'318'181) / 4)); // 3.579545 MHz
- ymsnd.add_route(ALL_OUTPUTS, "lspeaker", 0.40);
- ymsnd.add_route(ALL_OUTPUTS, "rspeaker", 0.40);
+ ymsnd.add_route(ALL_OUTPUTS, "speaker", 0.40, 0);
+ ymsnd.add_route(ALL_OUTPUTS, "speaker", 0.40, 1);
OKIM6295(config, m_oki, 32_MHz_XTAL / 32, okim6295_device::PIN7_HIGH); // clock frequency & pin 7 verified
m_oki->set_addrmap(0, &zeropnt_state::oki_map);
- m_oki->add_route(ALL_OUTPUTS, "lspeaker", 0.80);
- m_oki->add_route(ALL_OUTPUTS, "rspeaker", 0.80);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 0.80, 0);
+ m_oki->add_route(ALL_OUTPUTS, "speaker", 0.80, 1);
}
@@ -1024,19 +1022,18 @@ void zeropnt2_state::zeropnt2(machine_config &config)
PALETTE(config, m_palette).set_format(4, &zeropnt2_state::unico_R6G6B6X, 8192);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- YM2151(config, "ymsnd", XTAL(14'318'181) / 4).add_route(0, "lspeaker", 0.70).add_route(1, "rspeaker", 0.70); // 3.579545 MHz
+ YM2151(config, "ymsnd", XTAL(14'318'181) / 4).add_route(0, "speaker", 0.70, 0).add_route(1, "speaker", 0.70, 1); // 3.579545 MHz
okim6295_device &oki1(OKIM6295(config, "oki1", 32_MHz_XTAL/32, okim6295_device::PIN7_HIGH)); // clock frequency & pin 7 not verified
oki1.set_addrmap(0, &zeropnt2_state::oki_map);
- oki1.add_route(ALL_OUTPUTS, "lspeaker", 0.40);
- oki1.add_route(ALL_OUTPUTS, "rspeaker", 0.40);
+ oki1.add_route(ALL_OUTPUTS, "speaker", 0.40, 0);
+ oki1.add_route(ALL_OUTPUTS, "speaker", 0.40, 1);
okim6295_device &oki2(OKIM6295(config, "oki2", XTAL(14'318'181)/4, okim6295_device::PIN7_HIGH)); // clock frequency & pin 7 not verified
- oki2.add_route(ALL_OUTPUTS, "lspeaker", 0.20);
- oki2.add_route(ALL_OUTPUTS, "rspeaker", 0.20);
+ oki2.add_route(ALL_OUTPUTS, "speaker", 0.20, 0);
+ oki2.add_route(ALL_OUTPUTS, "speaker", 0.20, 1);
}
diff --git a/src/mame/unisonic/gic.cpp b/src/mame/unisonic/gic.cpp
index b8597203001..d890a2a75ac 100644
--- a/src/mame/unisonic/gic.cpp
+++ b/src/mame/unisonic/gic.cpp
@@ -245,10 +245,8 @@ TIMER_CALLBACK_MEMBER(gic_device::vblank_tick)
#define GIC_AUDIO_BYTE 0x96
-void gic_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void gic_device::sound_stream_update(sound_stream &stream)
{
- auto &buffer = outputs[0];
-
//Audio is basic and badly implemented (doubt that was the intent)
//The datasheet lists the 3 different frequencies the GIC can generate: 500,1000 and 2000Hz
//but it is clear (for an audio guy at least) that the resulting spectrum
@@ -291,8 +289,6 @@ void gic_device::sound_stream_update(sound_stream &stream, std::vector<read_stre
uint8_t audioByte = m_ram(GIC_AUDIO_BYTE)*2;
if(!audioByte){
- buffer.fill(0);
-
m_audioval = 0;
m_audiocnt = 0;
m_audioreset = 0;
@@ -306,12 +302,12 @@ void gic_device::sound_stream_update(sound_stream &stream, std::vector<read_stre
m_audioreset = 0;
}
- for(size_t i=0; i < buffer.samples(); i++){
+ for(size_t i=0; i < stream.samples(); i++){
m_audiocnt++;
if(m_audiocnt >= audioByte){
m_audioval = !m_audioval;
m_audiocnt=0;
}
- buffer.put(i, m_audioval ? 1.0 : 0.0);
+ stream.put(0, i, m_audioval ? 1.0 : 0.0);
}
}
diff --git a/src/mame/unisonic/gic.h b/src/mame/unisonic/gic.h
index 3be5ed2d54a..0e4b3150ff5 100644
--- a/src/mame/unisonic/gic.h
+++ b/src/mame/unisonic/gic.h
@@ -73,7 +73,7 @@ protected:
virtual const tiny_rom_entry *device_rom_region() const override ATTR_COLD;
// device_sound_interface 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;
/* timers */
TIMER_CALLBACK_MEMBER(vblank_tick);
diff --git a/src/mame/universal/superdq.cpp b/src/mame/universal/superdq.cpp
index fe9d485dfd1..dc83bebc58d 100644
--- a/src/mame/universal/superdq.cpp
+++ b/src/mame/universal/superdq.cpp
@@ -348,8 +348,8 @@ void superdq_state::superdq(machine_config &config)
PIONEER_LDV1000(config, m_laserdisc, 0);
m_laserdisc->set_overlay(256, 256, FUNC(superdq_state::screen_update_superdq));
- m_laserdisc->add_route(0, "lspeaker", 1.0);
- m_laserdisc->add_route(1, "rspeaker", 1.0);
+ m_laserdisc->add_route(0, "speaker", 1.0, 0);
+ m_laserdisc->add_route(1, "speaker", 1.0, 1);
/* video hardware */
m_laserdisc->add_ntsc_screen(config, "screen");
@@ -358,10 +358,9 @@ void superdq_state::superdq(machine_config &config)
PALETTE(config, m_palette, FUNC(superdq_state::superdq_palette), 32);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
- SN76496(config, "snsnd", MASTER_CLOCK/8).add_route(ALL_OUTPUTS, "lspeaker", 0.8);
+ SN76496(config, "snsnd", MASTER_CLOCK/8).add_route(ALL_OUTPUTS, "speaker", 0.8, 0);
}
diff --git a/src/mame/ussr/istrebiteli.cpp b/src/mame/ussr/istrebiteli.cpp
index 13177d1cecc..066b74b5b96 100644
--- a/src/mame/ussr/istrebiteli.cpp
+++ b/src/mame/ussr/istrebiteli.cpp
@@ -51,7 +51,7 @@ protected:
virtual void device_start() override ATTR_COLD;
// device_sound_interface 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;
private:
// internal state
@@ -97,11 +97,9 @@ void istrebiteli_sound_device::device_start()
save_item(NAME(m_prev_data));
}
-void istrebiteli_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void istrebiteli_sound_device::sound_stream_update(sound_stream &stream)
{
- auto &buffer = outputs[0];
-
- for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
int smpl = 0;
if (m_rom_out_en)
@@ -112,7 +110,7 @@ void istrebiteli_sound_device::sound_stream_update(sound_stream &stream, std::ve
smpl &= machine().rand() & 1;
smpl *= (m_prev_data & 0x80) ? 1000 : 4000; // b7 volume ?
- buffer.put_int(sampindex, smpl, 32768);
+ stream.put_int(0, sampindex, smpl, 32768);
m_rom_cnt = (m_rom_cnt + m_rom_incr) & 0x1ff;
}
}
diff --git a/src/mame/ussr/specialsound.cpp b/src/mame/ussr/specialsound.cpp
index c4d9665958e..4dac7c89708 100644
--- a/src/mame/ussr/specialsound.cpp
+++ b/src/mame/ussr/specialsound.cpp
@@ -49,16 +49,14 @@ void specimx_sound_device::device_start()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void specimx_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void specimx_sound_device::sound_stream_update(sound_stream &stream)
{
- auto &sample_left = outputs[0];
+ sound_stream::sample_t channel_0_signal = m_specimx_input[0] ? 0.1 : -0.1;
+ sound_stream::sample_t channel_1_signal = m_specimx_input[1] ? 0.1 : -0.1;
+ sound_stream::sample_t channel_2_signal = m_specimx_input[2] ? 0.1 : -0.1;
+ sound_stream::sample_t sum = channel_0_signal + channel_1_signal + channel_2_signal;
- stream_buffer::sample_t channel_0_signal = m_specimx_input[0] ? 0.1 : -0.1;
- stream_buffer::sample_t channel_1_signal = m_specimx_input[1] ? 0.1 : -0.1;
- stream_buffer::sample_t channel_2_signal = m_specimx_input[2] ? 0.1 : -0.1;
- stream_buffer::sample_t sum = channel_0_signal + channel_1_signal + channel_2_signal;
-
- sample_left.fill(sum);
+ stream.fill(0, sum);
}
diff --git a/src/mame/ussr/specialsound.h b/src/mame/ussr/specialsound.h
index 8b2cdb309d0..acee90e252c 100644
--- a/src/mame/ussr/specialsound.h
+++ b/src/mame/ussr/specialsound.h
@@ -26,7 +26,7 @@ protected:
virtual void device_start() 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;
private:
sound_stream *m_mixer_channel;
diff --git a/src/mame/ussr/tiamc1_a.cpp b/src/mame/ussr/tiamc1_a.cpp
index a6c25479ab3..07342f95795 100644
--- a/src/mame/ussr/tiamc1_a.cpp
+++ b/src/mame/ussr/tiamc1_a.cpp
@@ -107,11 +107,11 @@ void tiamc1_sound_device::device_start()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void tiamc1_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void tiamc1_sound_device::sound_stream_update(sound_stream &stream)
{
int count, o0, o1, o2, len, orval = 0;
- len = outputs[0].samples() * CLOCK_DIVIDER;
+ len = stream.samples() * CLOCK_DIVIDER;
for (count = 0; count < len; count++)
{
@@ -140,7 +140,7 @@ void tiamc1_sound_device::sound_stream_update(sound_stream &stream, std::vector<
if ((count + 1) % CLOCK_DIVIDER == 0)
{
- outputs[0].put(count / CLOCK_DIVIDER, orval ? 0.3 : 0.0);
+ stream.put(0, count / CLOCK_DIVIDER, orval ? 0.3 : 0.0);
orval = 0;
}
}
diff --git a/src/mame/ussr/tiamc1_a.h b/src/mame/ussr/tiamc1_a.h
index 48a7cebd90f..d1cea3c82df 100644
--- a/src/mame/ussr/tiamc1_a.h
+++ b/src/mame/ussr/tiamc1_a.h
@@ -25,7 +25,7 @@ protected:
virtual void device_start() 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;
private:
struct timer8253chan
diff --git a/src/mame/videoton/tvc_a.cpp b/src/mame/videoton/tvc_a.cpp
index 1537beb1922..1e5cce96c81 100644
--- a/src/mame/videoton/tvc_a.cpp
+++ b/src/mame/videoton/tvc_a.cpp
@@ -59,15 +59,14 @@ TIMER_CALLBACK_MEMBER(tvc_sound_device::trigger_int)
// our sound stream
//-------------------------------------------------
-void tvc_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void tvc_sound_device::sound_stream_update(sound_stream &stream)
{
- auto &output = outputs[0];
- int rate = output.sample_rate() / 2;
+ int rate = stream.sample_rate() / 2;
if (m_enabled && m_freq)
{
- for (int sampindex = 0; sampindex < output.samples(); sampindex++)
+ for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
- output.put_int(sampindex, m_signal * m_volume, 32768 / 0x0800);
+ stream.put_int(0, sampindex, m_signal * m_volume, 32768 / 0x0800);
m_incr -= m_freq;
while(m_incr < 0)
{
@@ -76,11 +75,6 @@ void tvc_sound_device::sound_stream_update(sound_stream &stream, std::vector<rea
}
}
}
- else
- {
- // fill output with 0 if the sound is disabled
- output.fill(0);
- }
}
diff --git a/src/mame/videoton/tvc_a.h b/src/mame/videoton/tvc_a.h
index 36c62349281..5bd8e76795b 100644
--- a/src/mame/videoton/tvc_a.h
+++ b/src/mame/videoton/tvc_a.h
@@ -33,7 +33,7 @@ protected:
// device-level overrides
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;
TIMER_CALLBACK_MEMBER(trigger_int);
diff --git a/src/mame/virtual/ldplayer.cpp b/src/mame/virtual/ldplayer.cpp
index 3e61d910029..91fd5fd144b 100644
--- a/src/mame/virtual/ldplayer.cpp
+++ b/src/mame/virtual/ldplayer.cpp
@@ -636,10 +636,9 @@ void ldv1000_state::ldv1000(machine_config &config)
{
ldplayer_ntsc(config, PIONEER_LDV1000, m_laserdisc);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
- m_laserdisc->add_route(0, "lspeaker", 1.0);
- m_laserdisc->add_route(1, "rspeaker", 1.0);
+ SPEAKER(config, "speaker", 2).front();
+ m_laserdisc->add_route(0, "speaker", 1.0, 0);
+ m_laserdisc->add_route(1, "speaker", 1.0, 1);
}
@@ -647,10 +646,9 @@ void pr8210_state::pr8210(machine_config &config)
{
ldplayer_ntsc(config, PIONEER_PR8210, m_laserdisc);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
- m_laserdisc->add_route(0, "lspeaker", 1.0);
- m_laserdisc->add_route(1, "rspeaker", 1.0);
+ SPEAKER(config, "speaker", 2).front();
+ m_laserdisc->add_route(0, "speaker", 1.0, 0);
+ m_laserdisc->add_route(1, "speaker", 1.0, 1);
}
diff --git a/src/mame/virtual/vgmplay.cpp b/src/mame/virtual/vgmplay.cpp
index 4371b096cbf..c38d269a26c 100644
--- a/src/mame/virtual/vgmplay.cpp
+++ b/src/mame/virtual/vgmplay.cpp
@@ -480,9 +480,8 @@ private:
uint32_t m_held_clock = 0;
std::vector<uint8_t> m_file_data;
required_device<vgmplay_device> m_vgmplay;
- required_device<vgmviz_device> m_mixer;
- required_device<speaker_device> m_lspeaker;
- required_device<speaker_device> m_rspeaker;
+ required_device<vgmviz_device> m_viz;
+ required_device<speaker_device> m_speaker;
required_device_array<sn76489_device, 2> m_sn76489;
required_device_array<ym2413_device, 2> m_ym2413;
required_device_array<ym2612_device, 2> m_ym2612;
@@ -2668,9 +2667,8 @@ uint8_t vgmplay_device::ga20_rom_r(offs_t offset)
vgmplay_state::vgmplay_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
, m_vgmplay(*this, "vgmplay")
- , m_mixer(*this, "mixer")
- , m_lspeaker(*this, "lspeaker")
- , m_rspeaker(*this, "rspeaker")
+ , m_viz(*this, "mixer")
+ , m_speaker(*this, "speaker")
, m_sn76489(*this, "sn76489.%d", 0)
, m_ym2413(*this, "ym2413.%d", 0)
, m_ym2612(*this, "ym2612.%d", 0)
@@ -3316,7 +3314,7 @@ INPUT_CHANGED_MEMBER(vgmplay_state::key_pressed)
m_vgmplay->toggle_loop();
break;
case VGMPLAY_VIZ:
- m_mixer->cycle_viz_mode();
+ m_viz->cycle_viz_mode();
break;
case VGMPLAY_RATE_DOWN:
m_vgmplay->set_unscaled_clock((uint32_t)(m_vgmplay->clock() * 0.95f));
@@ -3668,184 +3666,184 @@ void vgmplay_state::vgmplay(machine_config &config)
config.set_default_layout(layout_vgmplay);
SN76489(config, m_sn76489[0], 0);
- m_sn76489[0]->add_route(0, m_mixer, 0.5, AUTO_ALLOC_INPUT, 0);
- m_sn76489[0]->add_route(0, m_mixer, 0.5, AUTO_ALLOC_INPUT, 1);
+ m_sn76489[0]->add_route(0, m_viz, 0.5, 0);
+ m_sn76489[0]->add_route(0, m_viz, 0.5, 1);
SN76489(config, m_sn76489[1], 0);
- m_sn76489[1]->add_route(0, m_mixer, 0.5, AUTO_ALLOC_INPUT, 0);
- m_sn76489[1]->add_route(0, m_mixer, 0.5, AUTO_ALLOC_INPUT, 1);
+ m_sn76489[1]->add_route(0, m_viz, 0.5, 0);
+ m_sn76489[1]->add_route(0, m_viz, 0.5, 1);
YM2413(config, m_ym2413[0], 0);
- m_ym2413[0]->add_route(ALL_OUTPUTS, m_mixer, 1, AUTO_ALLOC_INPUT, 0);
- m_ym2413[0]->add_route(ALL_OUTPUTS, m_mixer, 1, AUTO_ALLOC_INPUT, 1);
+ m_ym2413[0]->add_route(ALL_OUTPUTS, m_viz, 1, 0);
+ m_ym2413[0]->add_route(ALL_OUTPUTS, m_viz, 1, 1);
YM2413(config, m_ym2413[1], 0);
- m_ym2413[1]->add_route(ALL_OUTPUTS, m_mixer, 1, AUTO_ALLOC_INPUT, 0);
- m_ym2413[1]->add_route(ALL_OUTPUTS, m_mixer, 1, AUTO_ALLOC_INPUT, 1);
+ m_ym2413[1]->add_route(ALL_OUTPUTS, m_viz, 1, 0);
+ m_ym2413[1]->add_route(ALL_OUTPUTS, m_viz, 1, 1);
YM2612(config, m_ym2612[0], 0);
- m_ym2612[0]->add_route(0, m_mixer, 1, AUTO_ALLOC_INPUT, 0);
- m_ym2612[0]->add_route(1, m_mixer, 1, AUTO_ALLOC_INPUT, 1);
+ m_ym2612[0]->add_route(0, m_viz, 1, 0);
+ m_ym2612[0]->add_route(1, m_viz, 1, 1);
YM2612(config, m_ym2612[1], 0);
- m_ym2612[1]->add_route(0, m_mixer, 1, AUTO_ALLOC_INPUT, 0);
- m_ym2612[1]->add_route(1, m_mixer, 1, AUTO_ALLOC_INPUT, 1);
+ m_ym2612[1]->add_route(0, m_viz, 1, 0);
+ m_ym2612[1]->add_route(1, m_viz, 1, 1);
YM2151(config, m_ym2151[0], 0);
- m_ym2151[0]->add_route(0, m_mixer, 1, AUTO_ALLOC_INPUT, 0);
- m_ym2151[0]->add_route(1, m_mixer, 1, AUTO_ALLOC_INPUT, 1);
+ m_ym2151[0]->add_route(0, m_viz, 1, 0);
+ m_ym2151[0]->add_route(1, m_viz, 1, 1);
YM2151(config, m_ym2151[1], 0);
- m_ym2151[1]->add_route(0, m_mixer, 1, AUTO_ALLOC_INPUT, 0);
- m_ym2151[1]->add_route(1, m_mixer, 1, AUTO_ALLOC_INPUT, 1);
+ m_ym2151[1]->add_route(0, m_viz, 1, 0);
+ m_ym2151[1]->add_route(1, m_viz, 1, 1);
SEGAPCM(config, m_segapcm[0], 0);
m_segapcm[0]->set_addrmap(0, &vgmplay_state::segapcm_map<0>);
- m_segapcm[0]->add_route(0, m_mixer, 1, AUTO_ALLOC_INPUT, 0);
- m_segapcm[0]->add_route(1, m_mixer, 1, AUTO_ALLOC_INPUT, 1);
+ m_segapcm[0]->add_route(0, m_viz, 1, 0);
+ m_segapcm[0]->add_route(1, m_viz, 1, 1);
SEGAPCM(config, m_segapcm[1], 0);
m_segapcm[1]->set_addrmap(0, &vgmplay_state::segapcm_map<1>);
- m_segapcm[1]->add_route(0, m_mixer, 1, AUTO_ALLOC_INPUT, 0);
- m_segapcm[1]->add_route(1, m_mixer, 1, AUTO_ALLOC_INPUT, 1);
+ m_segapcm[1]->add_route(0, m_viz, 1, 0);
+ m_segapcm[1]->add_route(1, m_viz, 1, 1);
RF5C68(config, m_rf5c68, 0);
m_rf5c68->set_addrmap(0, &vgmplay_state::rf5c68_map<0>);
- m_rf5c68->add_route(0, m_mixer, 1, AUTO_ALLOC_INPUT, 0);
- m_rf5c68->add_route(1, m_mixer, 1, AUTO_ALLOC_INPUT, 1);
+ m_rf5c68->add_route(0, m_viz, 1, 0);
+ m_rf5c68->add_route(1, m_viz, 1, 1);
// TODO: prevent error.log spew
YM2203(config, m_ym2203[0], 0);
- m_ym2203[0]->add_route(ALL_OUTPUTS, m_mixer, 0.25, AUTO_ALLOC_INPUT, 0);
- m_ym2203[0]->add_route(ALL_OUTPUTS, m_mixer, 0.25, AUTO_ALLOC_INPUT, 1);
+ m_ym2203[0]->add_route(ALL_OUTPUTS, m_viz, 0.25, 0);
+ m_ym2203[0]->add_route(ALL_OUTPUTS, m_viz, 0.25, 1);
YM2203(config, m_ym2203[1], 0);
- m_ym2203[1]->add_route(ALL_OUTPUTS, m_mixer, 0.25, AUTO_ALLOC_INPUT, 0);
- m_ym2203[1]->add_route(ALL_OUTPUTS, m_mixer, 0.25, AUTO_ALLOC_INPUT, 1);
+ m_ym2203[1]->add_route(ALL_OUTPUTS, m_viz, 0.25, 0);
+ m_ym2203[1]->add_route(ALL_OUTPUTS, m_viz, 0.25, 1);
// TODO: prevent error.log spew
YM2608(config, m_ym2608[0], 0);
m_ym2608[0]->set_addrmap(0, &vgmplay_state::ym2608_map<0>);
- m_ym2608[0]->add_route(0, m_mixer, 0.75, AUTO_ALLOC_INPUT, 0);
- m_ym2608[0]->add_route(0, m_mixer, 0.75, AUTO_ALLOC_INPUT, 1);
- m_ym2608[0]->add_route(1, m_mixer, 1.00, AUTO_ALLOC_INPUT, 0);
- m_ym2608[0]->add_route(2, m_mixer, 1.00, AUTO_ALLOC_INPUT, 1);
+ m_ym2608[0]->add_route(0, m_viz, 0.75, 0);
+ m_ym2608[0]->add_route(0, m_viz, 0.75, 1);
+ m_ym2608[0]->add_route(1, m_viz, 1.00, 0);
+ m_ym2608[0]->add_route(2, m_viz, 1.00, 1);
YM2608(config, m_ym2608[1], 0);
m_ym2608[1]->set_addrmap(0, &vgmplay_state::ym2608_map<1>);
- m_ym2608[1]->add_route(0, m_mixer, 0.75, AUTO_ALLOC_INPUT, 0);
- m_ym2608[1]->add_route(0, m_mixer, 0.75, AUTO_ALLOC_INPUT, 1);
- m_ym2608[1]->add_route(1, m_mixer, 1.00, AUTO_ALLOC_INPUT, 0);
- m_ym2608[1]->add_route(2, m_mixer, 1.00, AUTO_ALLOC_INPUT, 1);
+ m_ym2608[1]->add_route(0, m_viz, 0.75, 0);
+ m_ym2608[1]->add_route(0, m_viz, 0.75, 1);
+ m_ym2608[1]->add_route(1, m_viz, 1.00, 0);
+ m_ym2608[1]->add_route(2, m_viz, 1.00, 1);
// TODO: prevent error.log spew
YM2610(config, m_ym2610[0], 0);
m_ym2610[0]->set_addrmap(0, &vgmplay_state::ym2610_adpcm_a_map<0>);
m_ym2610[0]->set_addrmap(1, &vgmplay_state::ym2610_adpcm_b_map<0>);
- m_ym2610[0]->add_route(0, m_mixer, 0.75, AUTO_ALLOC_INPUT, 0);
- m_ym2610[0]->add_route(0, m_mixer, 0.75, AUTO_ALLOC_INPUT, 1);
- m_ym2610[0]->add_route(1, m_mixer, 0.50, AUTO_ALLOC_INPUT, 0);
- m_ym2610[0]->add_route(2, m_mixer, 0.50, AUTO_ALLOC_INPUT, 1);
+ m_ym2610[0]->add_route(0, m_viz, 0.75, 0);
+ m_ym2610[0]->add_route(0, m_viz, 0.75, 1);
+ m_ym2610[0]->add_route(1, m_viz, 0.50, 0);
+ m_ym2610[0]->add_route(2, m_viz, 0.50, 1);
YM2610(config, m_ym2610[1], 0);
m_ym2610[1]->set_addrmap(0, &vgmplay_state::ym2610_adpcm_a_map<1>);
m_ym2610[1]->set_addrmap(1, &vgmplay_state::ym2610_adpcm_b_map<1>);
- m_ym2610[1]->add_route(0, m_mixer, 0.75, AUTO_ALLOC_INPUT, 0);
- m_ym2610[1]->add_route(0, m_mixer, 0.75, AUTO_ALLOC_INPUT, 1);
- m_ym2610[1]->add_route(1, m_mixer, 0.50, AUTO_ALLOC_INPUT, 0);
- m_ym2610[1]->add_route(2, m_mixer, 0.50, AUTO_ALLOC_INPUT, 1);
+ m_ym2610[1]->add_route(0, m_viz, 0.75, 0);
+ m_ym2610[1]->add_route(0, m_viz, 0.75, 1);
+ m_ym2610[1]->add_route(1, m_viz, 0.50, 0);
+ m_ym2610[1]->add_route(2, m_viz, 0.50, 1);
YM3812(config, m_ym3812[0], 0);
- m_ym3812[0]->add_route(ALL_OUTPUTS, m_mixer, 0.5, AUTO_ALLOC_INPUT, 0);
- m_ym3812[0]->add_route(ALL_OUTPUTS, m_mixer, 0.5, AUTO_ALLOC_INPUT, 1);
+ m_ym3812[0]->add_route(ALL_OUTPUTS, m_viz, 0.5, 0);
+ m_ym3812[0]->add_route(ALL_OUTPUTS, m_viz, 0.5, 1);
YM3812(config, m_ym3812[1], 0);
- m_ym3812[1]->add_route(ALL_OUTPUTS, m_mixer, 0.5, AUTO_ALLOC_INPUT, 0);
- m_ym3812[1]->add_route(ALL_OUTPUTS, m_mixer, 0.5, AUTO_ALLOC_INPUT, 1);
+ m_ym3812[1]->add_route(ALL_OUTPUTS, m_viz, 0.5, 0);
+ m_ym3812[1]->add_route(ALL_OUTPUTS, m_viz, 0.5, 1);
YM3526(config, m_ym3526[0], 0);
- m_ym3526[0]->add_route(ALL_OUTPUTS, m_mixer, 0.5, AUTO_ALLOC_INPUT, 0);
- m_ym3526[0]->add_route(ALL_OUTPUTS, m_mixer, 0.5, AUTO_ALLOC_INPUT, 1);
+ m_ym3526[0]->add_route(ALL_OUTPUTS, m_viz, 0.5, 0);
+ m_ym3526[0]->add_route(ALL_OUTPUTS, m_viz, 0.5, 1);
YM3526(config, m_ym3526[1], 0);
- m_ym3526[1]->add_route(ALL_OUTPUTS, m_mixer, 0.5, AUTO_ALLOC_INPUT, 0);
- m_ym3526[1]->add_route(ALL_OUTPUTS, m_mixer, 0.5, AUTO_ALLOC_INPUT, 1);
+ m_ym3526[1]->add_route(ALL_OUTPUTS, m_viz, 0.5, 0);
+ m_ym3526[1]->add_route(ALL_OUTPUTS, m_viz, 0.5, 1);
Y8950(config, m_y8950[0], 0);
m_y8950[0]->set_addrmap(0, &vgmplay_state::y8950_map<0>);
- m_y8950[0]->add_route(ALL_OUTPUTS, m_mixer, 0.40, AUTO_ALLOC_INPUT, 0);
- m_y8950[0]->add_route(ALL_OUTPUTS, m_mixer, 0.40, AUTO_ALLOC_INPUT, 1);
+ m_y8950[0]->add_route(ALL_OUTPUTS, m_viz, 0.40, 0);
+ m_y8950[0]->add_route(ALL_OUTPUTS, m_viz, 0.40, 1);
Y8950(config, m_y8950[1], 0);
m_y8950[1]->set_addrmap(0, &vgmplay_state::y8950_map<1>);
- m_y8950[1]->add_route(ALL_OUTPUTS, m_mixer, 0.40, AUTO_ALLOC_INPUT, 0);
- m_y8950[1]->add_route(ALL_OUTPUTS, m_mixer, 0.40, AUTO_ALLOC_INPUT, 1);
+ m_y8950[1]->add_route(ALL_OUTPUTS, m_viz, 0.40, 0);
+ m_y8950[1]->add_route(ALL_OUTPUTS, m_viz, 0.40, 1);
YMF262(config, m_ymf262[0], 0);
- m_ymf262[0]->add_route(0, m_mixer, 1.00, AUTO_ALLOC_INPUT, 0);
- m_ymf262[0]->add_route(1, m_mixer, 1.00, AUTO_ALLOC_INPUT, 1);
- m_ymf262[0]->add_route(2, m_mixer, 1.00, AUTO_ALLOC_INPUT, 0);
- m_ymf262[0]->add_route(3, m_mixer, 1.00, AUTO_ALLOC_INPUT, 1);
+ m_ymf262[0]->add_route(0, m_viz, 1.00, 0);
+ m_ymf262[0]->add_route(1, m_viz, 1.00, 1);
+ m_ymf262[0]->add_route(2, m_viz, 1.00, 0);
+ m_ymf262[0]->add_route(3, m_viz, 1.00, 1);
YMF262(config, m_ymf262[1], 0);
- m_ymf262[1]->add_route(0, m_mixer, 1.00, AUTO_ALLOC_INPUT, 0);
- m_ymf262[1]->add_route(1, m_mixer, 1.00, AUTO_ALLOC_INPUT, 1);
- m_ymf262[1]->add_route(2, m_mixer, 1.00, AUTO_ALLOC_INPUT, 0);
- m_ymf262[1]->add_route(3, m_mixer, 1.00, AUTO_ALLOC_INPUT, 1);
+ m_ymf262[1]->add_route(0, m_viz, 1.00, 0);
+ m_ymf262[1]->add_route(1, m_viz, 1.00, 1);
+ m_ymf262[1]->add_route(2, m_viz, 1.00, 0);
+ m_ymf262[1]->add_route(3, m_viz, 1.00, 1);
// TODO: prevent error.log spew
YMF278B(config, m_ymf278b[0], 0);
m_ymf278b[0]->set_addrmap(0, &vgmplay_state::ymf278b_map<0>);
- m_ymf278b[0]->add_route(0, m_mixer, 1.00, AUTO_ALLOC_INPUT, 0);
- m_ymf278b[0]->add_route(1, m_mixer, 1.00, AUTO_ALLOC_INPUT, 1);
- m_ymf278b[0]->add_route(2, m_mixer, 1.00, AUTO_ALLOC_INPUT, 0);
- m_ymf278b[0]->add_route(3, m_mixer, 1.00, AUTO_ALLOC_INPUT, 1);
- m_ymf278b[0]->add_route(4, m_mixer, 1.00, AUTO_ALLOC_INPUT, 0);
- m_ymf278b[0]->add_route(5, m_mixer, 1.00, AUTO_ALLOC_INPUT, 1);
+ m_ymf278b[0]->add_route(0, m_viz, 1.00, 0);
+ m_ymf278b[0]->add_route(1, m_viz, 1.00, 1);
+ m_ymf278b[0]->add_route(2, m_viz, 1.00, 0);
+ m_ymf278b[0]->add_route(3, m_viz, 1.00, 1);
+ m_ymf278b[0]->add_route(4, m_viz, 1.00, 0);
+ m_ymf278b[0]->add_route(5, m_viz, 1.00, 1);
YMF278B(config, m_ymf278b[1], 0);
m_ymf278b[1]->set_addrmap(0, &vgmplay_state::ymf278b_map<1>);
- m_ymf278b[1]->add_route(0, m_mixer, 1.00, AUTO_ALLOC_INPUT, 0);
- m_ymf278b[1]->add_route(1, m_mixer, 1.00, AUTO_ALLOC_INPUT, 1);
- m_ymf278b[1]->add_route(2, m_mixer, 1.00, AUTO_ALLOC_INPUT, 0);
- m_ymf278b[1]->add_route(3, m_mixer, 1.00, AUTO_ALLOC_INPUT, 1);
- m_ymf278b[1]->add_route(4, m_mixer, 1.00, AUTO_ALLOC_INPUT, 0);
- m_ymf278b[1]->add_route(5, m_mixer, 1.00, AUTO_ALLOC_INPUT, 1);
+ m_ymf278b[1]->add_route(0, m_viz, 1.00, 0);
+ m_ymf278b[1]->add_route(1, m_viz, 1.00, 1);
+ m_ymf278b[1]->add_route(2, m_viz, 1.00, 0);
+ m_ymf278b[1]->add_route(3, m_viz, 1.00, 1);
+ m_ymf278b[1]->add_route(4, m_viz, 1.00, 0);
+ m_ymf278b[1]->add_route(5, m_viz, 1.00, 1);
YMF271(config, m_ymf271[0], 0);
m_ymf271[0]->set_addrmap(0, &vgmplay_state::ymf271_map<0>);
- m_ymf271[0]->add_route(0, m_mixer, 0.25, AUTO_ALLOC_INPUT, 0);
- m_ymf271[0]->add_route(1, m_mixer, 0.25, AUTO_ALLOC_INPUT, 1);
- m_ymf271[0]->add_route(2, m_mixer, 0.25, AUTO_ALLOC_INPUT, 0);
- m_ymf271[0]->add_route(3, m_mixer, 0.25, AUTO_ALLOC_INPUT, 1);
+ m_ymf271[0]->add_route(0, m_viz, 0.25, 0);
+ m_ymf271[0]->add_route(1, m_viz, 0.25, 1);
+ m_ymf271[0]->add_route(2, m_viz, 0.25, 0);
+ m_ymf271[0]->add_route(3, m_viz, 0.25, 1);
YMF271(config, m_ymf271[1], 0);
m_ymf271[1]->set_addrmap(0, &vgmplay_state::ymf271_map<0>);
- m_ymf271[1]->add_route(0, m_mixer, 0.25, AUTO_ALLOC_INPUT, 0);
- m_ymf271[1]->add_route(1, m_mixer, 0.25, AUTO_ALLOC_INPUT, 1);
- m_ymf271[1]->add_route(2, m_mixer, 0.25, AUTO_ALLOC_INPUT, 0);
- m_ymf271[1]->add_route(3, m_mixer, 0.25, AUTO_ALLOC_INPUT, 1);
+ m_ymf271[1]->add_route(0, m_viz, 0.25, 0);
+ m_ymf271[1]->add_route(1, m_viz, 0.25, 1);
+ m_ymf271[1]->add_route(2, m_viz, 0.25, 0);
+ m_ymf271[1]->add_route(3, m_viz, 0.25, 1);
// TODO: prevent error.log spew
YMZ280B(config, m_ymz280b[0], 0);
m_ymz280b[0]->set_addrmap(0, &vgmplay_state::ymz280b_map<0>);
- m_ymz280b[0]->add_route(0, m_mixer, 0.50, AUTO_ALLOC_INPUT, 0);
- m_ymz280b[0]->add_route(1, m_mixer, 0.50, AUTO_ALLOC_INPUT, 1);
+ m_ymz280b[0]->add_route(0, m_viz, 0.50, 0);
+ m_ymz280b[0]->add_route(1, m_viz, 0.50, 1);
YMZ280B(config, m_ymz280b[1], 0);
m_ymz280b[1]->set_addrmap(0, &vgmplay_state::ymz280b_map<1>);
- m_ymz280b[1]->add_route(0, m_mixer, 0.50, AUTO_ALLOC_INPUT, 0);
- m_ymz280b[1]->add_route(1, m_mixer, 0.50, AUTO_ALLOC_INPUT, 1);
+ m_ymz280b[1]->add_route(0, m_viz, 0.50, 0);
+ m_ymz280b[1]->add_route(1, m_viz, 0.50, 1);
RF5C164(config, m_rf5c164, 0);
m_rf5c164->set_addrmap(0, &vgmplay_state::rf5c164_map<0>);
- m_rf5c164->add_route(0, m_mixer, 1, AUTO_ALLOC_INPUT, 0);
- m_rf5c164->add_route(1, m_mixer, 1, AUTO_ALLOC_INPUT, 1);
+ m_rf5c164->add_route(0, m_viz, 1, 0);
+ m_rf5c164->add_route(1, m_viz, 1, 1);
/// TODO: rewrite to generate audio without using DAC devices
SEGA_32X_NTSC(config, m_sega32x, 0, "sega32x_maincpu", "sega32x_scanline_timer");
- m_sega32x->add_route(0, m_mixer, 1.00, AUTO_ALLOC_INPUT, 0);
- m_sega32x->add_route(1, m_mixer, 1.00, AUTO_ALLOC_INPUT, 1);
+ m_sega32x->add_route(0, m_viz, 1.00, 0);
+ m_sega32x->add_route(1, m_viz, 1.00, 1);
auto& sega32x_maincpu(M68000(config, "sega32x_maincpu", 0));
sega32x_maincpu.set_disable();
@@ -3857,249 +3855,248 @@ void vgmplay_state::vgmplay(machine_config &config)
// TODO: prevent error.log spew
AY8910(config, m_ay8910[0], 0);
- m_ay8910[0]->add_route(ALL_OUTPUTS, m_mixer, 0.33, AUTO_ALLOC_INPUT, 0);
- m_ay8910[0]->add_route(ALL_OUTPUTS, m_mixer, 0.33, AUTO_ALLOC_INPUT, 1);
+ m_ay8910[0]->add_route(ALL_OUTPUTS, m_viz, 0.33, 0);
+ m_ay8910[0]->add_route(ALL_OUTPUTS, m_viz, 0.33, 1);
AY8910(config, m_ay8910[1], 0);
- m_ay8910[1]->add_route(ALL_OUTPUTS, m_mixer, 0.33, AUTO_ALLOC_INPUT, 0);
- m_ay8910[1]->add_route(ALL_OUTPUTS, m_mixer, 0.33, AUTO_ALLOC_INPUT, 1);
+ m_ay8910[1]->add_route(ALL_OUTPUTS, m_viz, 0.33, 0);
+ m_ay8910[1]->add_route(ALL_OUTPUTS, m_viz, 0.33, 1);
DMG_APU(config, m_dmg[0], 0);
- m_dmg[0]->add_route(0, m_mixer, 1, AUTO_ALLOC_INPUT, 0);
- m_dmg[0]->add_route(0, m_mixer, 1, AUTO_ALLOC_INPUT, 1);
+ m_dmg[0]->add_route(0, m_viz, 1, 0);
+ m_dmg[0]->add_route(0, m_viz, 1, 1);
DMG_APU(config, m_dmg[1], 0);
- m_dmg[1]->add_route(0, m_mixer, 1, AUTO_ALLOC_INPUT, 0);
- m_dmg[1]->add_route(0, m_mixer, 1, AUTO_ALLOC_INPUT, 1);
+ m_dmg[1]->add_route(0, m_viz, 1, 0);
+ m_dmg[1]->add_route(0, m_viz, 1, 1);
RP2A03G(config, m_nescpu[0], 0);
m_nescpu[0]->set_addrmap(AS_PROGRAM, &vgmplay_state::nescpu_map<0>);
m_nescpu[0]->set_disable();
- m_nescpu[0]->add_route(ALL_OUTPUTS, m_mixer, 0.50, AUTO_ALLOC_INPUT, 0);
- m_nescpu[0]->add_route(ALL_OUTPUTS, m_mixer, 0.50, AUTO_ALLOC_INPUT, 1);
+ m_nescpu[0]->add_route(ALL_OUTPUTS, m_viz, 0.50, 0);
+ m_nescpu[0]->add_route(ALL_OUTPUTS, m_viz, 0.50, 1);
RP2A03G(config, m_nescpu[1], 0);
m_nescpu[1]->set_addrmap(AS_PROGRAM, &vgmplay_state::nescpu_map<1>);
m_nescpu[1]->set_disable();
- m_nescpu[1]->add_route(ALL_OUTPUTS, m_mixer, 0.50, AUTO_ALLOC_INPUT, 0);
- m_nescpu[1]->add_route(ALL_OUTPUTS, m_mixer, 0.50, AUTO_ALLOC_INPUT, 1);
+ m_nescpu[1]->add_route(ALL_OUTPUTS, m_viz, 0.50, 0);
+ m_nescpu[1]->add_route(ALL_OUTPUTS, m_viz, 0.50, 1);
MULTIPCM(config, m_multipcm[0], 0);
m_multipcm[0]->set_addrmap(0, &vgmplay_state::multipcm_map<0>);
- m_multipcm[0]->add_route(0, m_mixer, 1, AUTO_ALLOC_INPUT, 0);
- m_multipcm[0]->add_route(1, m_mixer, 1, AUTO_ALLOC_INPUT, 1);
+ m_multipcm[0]->add_route(0, m_viz, 1, 0);
+ m_multipcm[0]->add_route(1, m_viz, 1, 1);
MULTIPCM(config, m_multipcm[1], 0);
m_multipcm[1]->set_addrmap(0, &vgmplay_state::multipcm_map<1>);
- m_multipcm[1]->add_route(0, m_mixer, 1, AUTO_ALLOC_INPUT, 0);
- m_multipcm[1]->add_route(1, m_mixer, 1, AUTO_ALLOC_INPUT, 1);
+ m_multipcm[1]->add_route(0, m_viz, 1, 0);
+ m_multipcm[1]->add_route(1, m_viz, 1, 1);
UPD7759(config, m_upd7759[0], 0);
m_upd7759[0]->drq().set(FUNC(vgmplay_state::upd7759_drq_w<0>));
m_upd7759[0]->set_addrmap(0, &vgmplay_state::upd7759_map<0>);
- m_upd7759[0]->add_route(ALL_OUTPUTS, m_mixer, 1.0, AUTO_ALLOC_INPUT, 0);
- m_upd7759[0]->add_route(ALL_OUTPUTS, m_mixer, 1.0, AUTO_ALLOC_INPUT, 1);
+ m_upd7759[0]->add_route(ALL_OUTPUTS, m_viz, 1.0, 0);
+ m_upd7759[0]->add_route(ALL_OUTPUTS, m_viz, 1.0, 1);
UPD7759(config, m_upd7759[1], 0);
m_upd7759[1]->drq().set(FUNC(vgmplay_state::upd7759_drq_w<1>));
m_upd7759[1]->set_addrmap(0, &vgmplay_state::upd7759_map<1>);
- m_upd7759[1]->add_route(ALL_OUTPUTS, m_mixer, 1.0, AUTO_ALLOC_INPUT, 0);
- m_upd7759[1]->add_route(ALL_OUTPUTS, m_mixer, 1.0, AUTO_ALLOC_INPUT, 1);
+ m_upd7759[1]->add_route(ALL_OUTPUTS, m_viz, 1.0, 0);
+ m_upd7759[1]->add_route(ALL_OUTPUTS, m_viz, 1.0, 1);
OKIM6258(config, m_okim6258[0], 0);
- m_okim6258[0]->add_route(ALL_OUTPUTS, m_mixer, 0.5, AUTO_ALLOC_INPUT, 0);
- m_okim6258[0]->add_route(ALL_OUTPUTS, m_mixer, 0.5, AUTO_ALLOC_INPUT, 1);
+ m_okim6258[0]->add_route(ALL_OUTPUTS, m_viz, 0.5, 0);
+ m_okim6258[0]->add_route(ALL_OUTPUTS, m_viz, 0.5, 1);
OKIM6258(config, m_okim6258[1], 0);
- m_okim6258[1]->add_route(ALL_OUTPUTS, m_mixer, 0.5, AUTO_ALLOC_INPUT, 0);
- m_okim6258[1]->add_route(ALL_OUTPUTS, m_mixer, 0.5, AUTO_ALLOC_INPUT, 1);
+ m_okim6258[1]->add_route(ALL_OUTPUTS, m_viz, 0.5, 0);
+ m_okim6258[1]->add_route(ALL_OUTPUTS, m_viz, 0.5, 1);
OKIM6295(config, m_okim6295[0], 0, okim6295_device::PIN7_HIGH);
m_okim6295[0]->set_addrmap(0, &vgmplay_state::okim6295_map<0>);
- m_okim6295[0]->add_route(ALL_OUTPUTS, m_mixer, 0.25, AUTO_ALLOC_INPUT, 0);
- m_okim6295[0]->add_route(ALL_OUTPUTS, m_mixer, 0.25, AUTO_ALLOC_INPUT, 1);
+ m_okim6295[0]->add_route(ALL_OUTPUTS, m_viz, 0.25, 0);
+ m_okim6295[0]->add_route(ALL_OUTPUTS, m_viz, 0.25, 1);
OKIM6295(config, m_okim6295[1], 0, okim6295_device::PIN7_HIGH);
m_okim6295[1]->set_addrmap(0, &vgmplay_state::okim6295_map<1>);
- m_okim6295[1]->add_route(ALL_OUTPUTS, m_mixer, 0.25, AUTO_ALLOC_INPUT, 0);
- m_okim6295[1]->add_route(ALL_OUTPUTS, m_mixer, 0.25, AUTO_ALLOC_INPUT, 1);
+ m_okim6295[1]->add_route(ALL_OUTPUTS, m_viz, 0.25, 0);
+ m_okim6295[1]->add_route(ALL_OUTPUTS, m_viz, 0.25, 1);
K051649(config, m_k051649[0], 0);
- m_k051649[0]->add_route(ALL_OUTPUTS, m_mixer, 0.33, AUTO_ALLOC_INPUT, 0);
- m_k051649[0]->add_route(ALL_OUTPUTS, m_mixer, 0.33, AUTO_ALLOC_INPUT, 1);
+ m_k051649[0]->add_route(ALL_OUTPUTS, m_viz, 0.33, 0);
+ m_k051649[0]->add_route(ALL_OUTPUTS, m_viz, 0.33, 1);
K051649(config, m_k051649[1], 0);
- m_k051649[1]->add_route(ALL_OUTPUTS, m_mixer, 0.33, AUTO_ALLOC_INPUT, 0);
- m_k051649[1]->add_route(ALL_OUTPUTS, m_mixer, 0.33, AUTO_ALLOC_INPUT, 1);
+ m_k051649[1]->add_route(ALL_OUTPUTS, m_viz, 0.33, 0);
+ m_k051649[1]->add_route(ALL_OUTPUTS, m_viz, 0.33, 1);
K054539(config, m_k054539[0], 0);
m_k054539[0]->set_addrmap(0, &vgmplay_state::k054539_map<0>);
- m_k054539[0]->add_route(0, m_mixer, 1, AUTO_ALLOC_INPUT, 0);
- m_k054539[0]->add_route(1, m_mixer, 1, AUTO_ALLOC_INPUT, 1);
+ m_k054539[0]->add_route(0, m_viz, 1, 0);
+ m_k054539[0]->add_route(1, m_viz, 1, 1);
K054539(config, m_k054539[1], 0);
m_k054539[1]->set_addrmap(0, &vgmplay_state::k054539_map<1>);
- m_k054539[1]->add_route(0, m_mixer, 1, AUTO_ALLOC_INPUT, 0);
- m_k054539[1]->add_route(1, m_mixer, 1, AUTO_ALLOC_INPUT, 1);
+ m_k054539[1]->add_route(0, m_viz, 1, 0);
+ m_k054539[1]->add_route(1, m_viz, 1, 1);
// TODO: prevent error.log spew
H6280(config, m_huc6280[0], 0);
m_huc6280[0]->set_disable();
- m_huc6280[0]->add_route(0, m_mixer, 1, AUTO_ALLOC_INPUT, 0);
- m_huc6280[0]->add_route(1, m_mixer, 1, AUTO_ALLOC_INPUT, 1);
+ m_huc6280[0]->add_route(0, m_viz, 1, 0);
+ m_huc6280[0]->add_route(1, m_viz, 1, 1);
H6280(config, m_huc6280[1], 0);
m_huc6280[1]->set_disable();
- m_huc6280[1]->add_route(0, m_mixer, 1, AUTO_ALLOC_INPUT, 0);
- m_huc6280[1]->add_route(1, m_mixer, 1, AUTO_ALLOC_INPUT, 1);
+ m_huc6280[1]->add_route(0, m_viz, 1, 0);
+ m_huc6280[1]->add_route(1, m_viz, 1, 1);
C140(config, m_c140[0], 0);
m_c140[0]->set_addrmap(0, &vgmplay_state::c140_map<0>);
- m_c140[0]->add_route(0, m_mixer, 0.50, AUTO_ALLOC_INPUT, 0);
- m_c140[0]->add_route(1, m_mixer, 0.50, AUTO_ALLOC_INPUT, 1);
+ m_c140[0]->add_route(0, m_viz, 0.50, 0);
+ m_c140[0]->add_route(1, m_viz, 0.50, 1);
C140(config, m_c140[1], 0);
m_c140[1]->set_addrmap(0, &vgmplay_state::c140_map<1>);
- m_c140[1]->add_route(0, m_mixer, 0.50, AUTO_ALLOC_INPUT, 0);
- m_c140[1]->add_route(1, m_mixer, 0.50, AUTO_ALLOC_INPUT, 1);
+ m_c140[1]->add_route(0, m_viz, 0.50, 0);
+ m_c140[1]->add_route(1, m_viz, 0.50, 1);
C219(config, m_c219[0], 0);
m_c219[0]->set_addrmap(0, &vgmplay_state::c219_map<0>);
- m_c219[0]->add_route(0, m_mixer, 0.50, AUTO_ALLOC_INPUT, 0);
- m_c219[0]->add_route(1, m_mixer, 0.50, AUTO_ALLOC_INPUT, 1);
+ m_c219[0]->add_route(0, m_viz, 0.50, 0);
+ m_c219[0]->add_route(1, m_viz, 0.50, 1);
C219(config, m_c219[1], 0);
m_c219[1]->set_addrmap(0, &vgmplay_state::c219_map<1>);
- m_c219[1]->add_route(0, m_mixer, 0.50, AUTO_ALLOC_INPUT, 0);
- m_c219[1]->add_route(1, m_mixer, 0.50, AUTO_ALLOC_INPUT, 1);
+ m_c219[1]->add_route(0, m_viz, 0.50, 0);
+ m_c219[1]->add_route(1, m_viz, 0.50, 1);
K053260(config, m_k053260[0], 0);
m_k053260[0]->set_addrmap(0, &vgmplay_state::k053260_map<0>);
- m_k053260[0]->add_route(0, m_mixer, 1, AUTO_ALLOC_INPUT, 0);
- m_k053260[0]->add_route(1, m_mixer, 1, AUTO_ALLOC_INPUT, 1);
+ m_k053260[0]->add_route(0, m_viz, 1, 0);
+ m_k053260[0]->add_route(1, m_viz, 1, 1);
K053260(config, m_k053260[1], 0);
m_k053260[1]->set_addrmap(0, &vgmplay_state::k053260_map<1>);
- m_k053260[1]->add_route(0, m_mixer, 1, AUTO_ALLOC_INPUT, 0);
- m_k053260[1]->add_route(1, m_mixer, 1, AUTO_ALLOC_INPUT, 1);
+ m_k053260[1]->add_route(0, m_viz, 1, 0);
+ m_k053260[1]->add_route(1, m_viz, 1, 1);
POKEY(config, m_pokey[0], 0);
- m_pokey[0]->add_route(ALL_OUTPUTS, m_mixer, 0.5, AUTO_ALLOC_INPUT, 0);
- m_pokey[0]->add_route(ALL_OUTPUTS, m_mixer, 0.5, AUTO_ALLOC_INPUT, 1);
+ m_pokey[0]->add_route(ALL_OUTPUTS, m_viz, 0.5, 0);
+ m_pokey[0]->add_route(ALL_OUTPUTS, m_viz, 0.5, 1);
POKEY(config, m_pokey[1], 0);
- m_pokey[1]->add_route(ALL_OUTPUTS, m_mixer, 0.5, AUTO_ALLOC_INPUT, 0);
- m_pokey[1]->add_route(ALL_OUTPUTS, m_mixer, 0.5, AUTO_ALLOC_INPUT, 1);
+ m_pokey[1]->add_route(ALL_OUTPUTS, m_viz, 0.5, 0);
+ m_pokey[1]->add_route(ALL_OUTPUTS, m_viz, 0.5, 1);
QSOUND(config, m_qsound, 0);
m_qsound->set_addrmap(0, &vgmplay_state::qsound_map<0>);
- m_qsound->add_route(0, m_mixer, 1, AUTO_ALLOC_INPUT, 0);
- m_qsound->add_route(1, m_mixer, 1, AUTO_ALLOC_INPUT, 1);
+ m_qsound->add_route(0, m_viz, 1, 0);
+ m_qsound->add_route(1, m_viz, 1, 1);
SCSP(config, m_scsp[0], 0);
m_scsp[0]->set_addrmap(0, &vgmplay_state::scsp_map<0>);
- m_scsp[0]->add_route(0, m_mixer, 1, AUTO_ALLOC_INPUT, 0);
- m_scsp[0]->add_route(1, m_mixer, 1, AUTO_ALLOC_INPUT, 1);
+ m_scsp[0]->add_route(0, m_viz, 1, 0);
+ m_scsp[0]->add_route(1, m_viz, 1, 1);
SCSP(config, m_scsp[1], 0);
m_scsp[1]->set_addrmap(0, &vgmplay_state::scsp_map<1>);
- m_scsp[1]->add_route(0, m_mixer, 1, AUTO_ALLOC_INPUT, 0);
- m_scsp[1]->add_route(1, m_mixer, 1, AUTO_ALLOC_INPUT, 1);
+ m_scsp[1]->add_route(0, m_viz, 1, 0);
+ m_scsp[1]->add_route(1, m_viz, 1, 1);
WSWAN_SND(config, m_wswan[0], 0);
m_wswan[0]->set_headphone_connected(true);
m_wswan[0]->set_addrmap(0, &vgmplay_state::wswan_map<0>);
- m_wswan[0]->add_route(0, m_mixer, 0.50, AUTO_ALLOC_INPUT, 0);
- m_wswan[0]->add_route(1, m_mixer, 0.50, AUTO_ALLOC_INPUT, 1);
+ m_wswan[0]->add_route(0, m_viz, 0.50, 0);
+ m_wswan[0]->add_route(1, m_viz, 0.50, 1);
WSWAN_SND(config, m_wswan[1], 0);
m_wswan[1]->set_headphone_connected(true);
m_wswan[1]->set_addrmap(0, &vgmplay_state::wswan_map<1>);
- m_wswan[1]->add_route(0, m_mixer, 0.50, AUTO_ALLOC_INPUT, 0);
- m_wswan[1]->add_route(1, m_mixer, 0.50, AUTO_ALLOC_INPUT, 1);
+ m_wswan[1]->add_route(0, m_viz, 0.50, 0);
+ m_wswan[1]->add_route(1, m_viz, 0.50, 1);
VBOYSND(config, m_vsu_vue[0], 0);
- m_vsu_vue[0]->add_route(0, m_mixer, 1.0, AUTO_ALLOC_INPUT, 0);
- m_vsu_vue[0]->add_route(1, m_mixer, 1.0, AUTO_ALLOC_INPUT, 1);
+ m_vsu_vue[0]->add_route(0, m_viz, 1.0, 0);
+ m_vsu_vue[0]->add_route(1, m_viz, 1.0, 1);
VBOYSND(config, m_vsu_vue[1], 0);
- m_vsu_vue[1]->add_route(0, m_mixer, 1.0, AUTO_ALLOC_INPUT, 0);
- m_vsu_vue[1]->add_route(1, m_mixer, 1.0, AUTO_ALLOC_INPUT, 1);
+ m_vsu_vue[1]->add_route(0, m_viz, 1.0, 0);
+ m_vsu_vue[1]->add_route(1, m_viz, 1.0, 1);
SAA1099(config, m_saa1099[0], 0);
- m_saa1099[0]->add_route(0, m_mixer, 1.0, AUTO_ALLOC_INPUT, 0);
- m_saa1099[0]->add_route(1, m_mixer, 1.0, AUTO_ALLOC_INPUT, 1);
+ m_saa1099[0]->add_route(0, m_viz, 1.0, 0);
+ m_saa1099[0]->add_route(1, m_viz, 1.0, 1);
SAA1099(config, m_saa1099[1], 0);
- m_saa1099[1]->add_route(0, m_mixer, 1.0, AUTO_ALLOC_INPUT, 0);
- m_saa1099[1]->add_route(1, m_mixer, 1.0, AUTO_ALLOC_INPUT, 1);
+ m_saa1099[1]->add_route(0, m_viz, 1.0, 0);
+ m_saa1099[1]->add_route(1, m_viz, 1.0, 1);
ES5503(config, m_es5503[0], 0);
m_es5503[0]->set_channels(2);
m_es5503[0]->set_addrmap(0, &vgmplay_state::es5503_map<0>);
- m_es5503[0]->add_route(ALL_OUTPUTS, m_mixer, 0.5, AUTO_ALLOC_INPUT, 0);
- m_es5503[0]->add_route(ALL_OUTPUTS, m_mixer, 0.5, AUTO_ALLOC_INPUT, 1);
+ m_es5503[0]->add_route(ALL_OUTPUTS, m_viz, 0.5, 0);
+ m_es5503[0]->add_route(ALL_OUTPUTS, m_viz, 0.5, 1);
ES5503(config, m_es5503[1], 0);
m_es5503[1]->set_channels(2);
m_es5503[1]->set_addrmap(0, &vgmplay_state::es5503_map<1>);
- m_es5503[1]->add_route(ALL_OUTPUTS, m_mixer, 0.5, AUTO_ALLOC_INPUT, 0);
- m_es5503[1]->add_route(ALL_OUTPUTS, m_mixer, 0.5, AUTO_ALLOC_INPUT, 1);
+ m_es5503[1]->add_route(ALL_OUTPUTS, m_viz, 0.5, 0);
+ m_es5503[1]->add_route(ALL_OUTPUTS, m_viz, 0.5, 1);
ES5505(config, m_es5505[0], 0);
// TODO m_es5505[0]->set_addrmap(0, &vgmplay_state::es5505_map<0>);
// TODO m_es5505[0]->set_addrmap(1, &vgmplay_state::es5505_map<0>);
m_es5505[0]->set_channels(1);
- m_es5505[0]->add_route(0, m_mixer, 0.5, AUTO_ALLOC_INPUT, 0);
- m_es5505[0]->add_route(1, m_mixer, 0.5, AUTO_ALLOC_INPUT, 1);
+ m_es5505[0]->add_route(0, m_viz, 0.5, 0);
+ m_es5505[0]->add_route(1, m_viz, 0.5, 1);
ES5505(config, m_es5505[1], 0);
// TODO m_es5505[1]->set_addrmap(0, &vgmplay_state::es5505_map<1>);
// TODO m_es5505[1]->set_addrmap(1, &vgmplay_state::es5505_map<1>);
m_es5505[1]->set_channels(1);
- m_es5505[1]->add_route(0, m_mixer, 0.5, AUTO_ALLOC_INPUT, 0);
- m_es5505[1]->add_route(1, m_mixer, 0.5, AUTO_ALLOC_INPUT, 1);
+ m_es5505[1]->add_route(0, m_viz, 0.5, 0);
+ m_es5505[1]->add_route(1, m_viz, 0.5, 1);
X1_010(config, m_x1_010[0], 0);
m_x1_010[0]->set_addrmap(0, &vgmplay_state::x1_010_map<0>);
- m_x1_010[0]->add_route(0, m_mixer, 1, AUTO_ALLOC_INPUT, 0);
- m_x1_010[0]->add_route(1, m_mixer, 1, AUTO_ALLOC_INPUT, 1);
+ m_x1_010[0]->add_route(0, m_viz, 1, 0);
+ m_x1_010[0]->add_route(1, m_viz, 1, 1);
X1_010(config, m_x1_010[1], 0);
m_x1_010[1]->set_addrmap(0, &vgmplay_state::x1_010_map<1>);
- m_x1_010[1]->add_route(0, m_mixer, 1, AUTO_ALLOC_INPUT, 0);
- m_x1_010[1]->add_route(1, m_mixer, 1, AUTO_ALLOC_INPUT, 1);
+ m_x1_010[1]->add_route(0, m_viz, 1, 0);
+ m_x1_010[1]->add_route(1, m_viz, 1, 1);
C352(config, m_c352[0], 0, 1);
m_c352[0]->set_addrmap(0, &vgmplay_state::c352_map<0>);
- m_c352[0]->add_route(0, m_mixer, 1, AUTO_ALLOC_INPUT, 0);
- m_c352[0]->add_route(1, m_mixer, 1, AUTO_ALLOC_INPUT, 1);
- m_c352[0]->add_route(2, m_mixer, 1, AUTO_ALLOC_INPUT, 0);
- m_c352[0]->add_route(3, m_mixer, 1, AUTO_ALLOC_INPUT, 1);
+ m_c352[0]->add_route(0, m_viz, 1, 0);
+ m_c352[0]->add_route(1, m_viz, 1, 1);
+ m_c352[0]->add_route(2, m_viz, 1, 0);
+ m_c352[0]->add_route(3, m_viz, 1, 1);
C352(config, m_c352[1], 0, 1);
m_c352[1]->set_addrmap(0, &vgmplay_state::c352_map<1>);
- m_c352[1]->add_route(0, m_mixer, 1, AUTO_ALLOC_INPUT, 0);
- m_c352[1]->add_route(1, m_mixer, 1, AUTO_ALLOC_INPUT, 1);
- m_c352[1]->add_route(2, m_mixer, 1, AUTO_ALLOC_INPUT, 0);
- m_c352[1]->add_route(3, m_mixer, 1, AUTO_ALLOC_INPUT, 1);
+ m_c352[1]->add_route(0, m_viz, 1, 0);
+ m_c352[1]->add_route(1, m_viz, 1, 1);
+ m_c352[1]->add_route(2, m_viz, 1, 0);
+ m_c352[1]->add_route(3, m_viz, 1, 1);
IREMGA20(config, m_ga20[0], 0);
m_ga20[0]->set_addrmap(0, &vgmplay_state::ga20_map<0>);
- m_ga20[0]->add_route(0, m_mixer, 1, AUTO_ALLOC_INPUT, 0);
- m_ga20[0]->add_route(1, m_mixer, 1, AUTO_ALLOC_INPUT, 1);
+ m_ga20[0]->add_route(0, m_viz, 1, 0);
+ m_ga20[0]->add_route(1, m_viz, 1, 1);
IREMGA20(config, m_ga20[1], 0);
m_ga20[1]->set_addrmap(0, &vgmplay_state::ga20_map<1>);
- m_ga20[1]->add_route(0, m_mixer, 1, AUTO_ALLOC_INPUT, 0);
- m_ga20[1]->add_route(1, m_mixer, 1, AUTO_ALLOC_INPUT, 1);
+ m_ga20[1]->add_route(0, m_viz, 1, 0);
+ m_ga20[1]->add_route(1, m_viz, 1, 1);
- VGMVIZ(config, m_mixer, 0);
- m_mixer->add_route(0, "lspeaker", 1);
- m_mixer->add_route(1, "rspeaker", 1);
+ VGMVIZ(config, m_viz, 0);
+ m_viz->add_route(0, "speaker", 1, 0);
+ m_viz->add_route(1, "speaker", 1, 1);
- SPEAKER(config, m_lspeaker).front_left();
- SPEAKER(config, m_rspeaker).front_right();
+ SPEAKER(config, m_speaker, 2).front();
}
ROM_START( vgmplay )
diff --git a/src/mame/virtual/wavesynth.cpp b/src/mame/virtual/wavesynth.cpp
index 931c8d8b5c0..c5db150bf0d 100644
--- a/src/mame/virtual/wavesynth.cpp
+++ b/src/mame/virtual/wavesynth.cpp
@@ -40,11 +40,10 @@ void wavesynth_state::machine_start()
void wavesynth_state::wavesynth(machine_config &config)
{
WAVEBLASTER_CONNECTOR(config, m_waveblaster, waveblaster_intf, "omniwave");
- m_waveblaster->add_route(0, "lspeaker", 1.0);
- m_waveblaster->add_route(1, "rspeaker", 1.0);
+ m_waveblaster->add_route(0, "speaker", 1.0, 0);
+ m_waveblaster->add_route(1, "speaker", 1.0, 1);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
auto &mdin(MIDI_PORT(config, "mdin"));
midiin_slot(mdin);
diff --git a/src/mame/vsystem/aerofgt.cpp b/src/mame/vsystem/aerofgt.cpp
index dc0c4e8245c..0793a6282fe 100644
--- a/src/mame/vsystem/aerofgt.cpp
+++ b/src/mame/vsystem/aerofgt.cpp
@@ -400,8 +400,7 @@ void aerofgt_state::aerofgt(machine_config &config)
m_spr->set_pri_cb(FUNC(aerofgt_state::pri_callback));
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set(FUNC(aerofgt_state::soundlatch_pending_w));
@@ -409,10 +408,10 @@ void aerofgt_state::aerofgt(machine_config &config)
ym2610_device &ymsnd(YM2610(config, "ymsnd", XTAL(8'000'000))); // verified on pcb
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
- ymsnd.add_route(0, "lspeaker", 0.75);
- ymsnd.add_route(0, "rspeaker", 0.75);
- ymsnd.add_route(1, "lspeaker", 1.0);
- ymsnd.add_route(2, "rspeaker", 1.0);
+ ymsnd.add_route(0, "speaker", 0.75, 0);
+ ymsnd.add_route(0, "speaker", 0.75, 1);
+ ymsnd.add_route(1, "speaker", 1.0, 0);
+ ymsnd.add_route(2, "speaker", 1.0, 1);
}
diff --git a/src/mame/vsystem/crshrace.cpp b/src/mame/vsystem/crshrace.cpp
index 1e4c0c71904..a94134725cc 100644
--- a/src/mame/vsystem/crshrace.cpp
+++ b/src/mame/vsystem/crshrace.cpp
@@ -622,8 +622,7 @@ void crshrace_state::crshrace(machine_config &config) // TODO: PCB sports 32 MHz
m_k053936->set_offsets(-48, -21);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set(FUNC(crshrace_state::soundlatch_pending_w));
@@ -631,10 +630,10 @@ void crshrace_state::crshrace(machine_config &config) // TODO: PCB sports 32 MHz
ym2610_device &ymsnd(YM2610(config, "ymsnd", 8'000'000));
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
- ymsnd.add_route(0, "lspeaker", 0.75);
- ymsnd.add_route(0, "rspeaker", 0.75);
- ymsnd.add_route(1, "lspeaker", 1.0);
- ymsnd.add_route(2, "rspeaker", 1.0);
+ ymsnd.add_route(0, "speaker", 0.75, 0);
+ ymsnd.add_route(0, "speaker", 0.75, 1);
+ ymsnd.add_route(1, "speaker", 1.0, 0);
+ ymsnd.add_route(2, "speaker", 1.0, 1);
}
diff --git a/src/mame/vsystem/f1gp.cpp b/src/mame/vsystem/f1gp.cpp
index f8687e651d4..beec0fa904e 100644
--- a/src/mame/vsystem/f1gp.cpp
+++ b/src/mame/vsystem/f1gp.cpp
@@ -858,8 +858,7 @@ void f1gp_state::f1gp(machine_config &config)
m_k053936->set_offsets(-58, -2);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set(FUNC(f1gp_state::soundlatch_pending_w));
@@ -867,10 +866,10 @@ void f1gp_state::f1gp(machine_config &config)
ym2610_device &ymsnd(YM2610(config, "ymsnd", XTAL(8'000'000)));
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
- ymsnd.add_route(0, "lspeaker", 0.75);
- ymsnd.add_route(0, "rspeaker", 0.75);
- ymsnd.add_route(1, "lspeaker", 1.0);
- ymsnd.add_route(2, "rspeaker", 1.0);
+ ymsnd.add_route(0, "speaker", 0.75, 0);
+ ymsnd.add_route(0, "speaker", 0.75, 1);
+ ymsnd.add_route(1, "speaker", 1.0, 0);
+ ymsnd.add_route(2, "speaker", 1.0, 1);
}
void f1gp_state::f1gpbl(machine_config &config)
diff --git a/src/mame/vsystem/gstriker.cpp b/src/mame/vsystem/gstriker.cpp
index c30f57c1735..7c2d8fe5d8a 100644
--- a/src/mame/vsystem/gstriker.cpp
+++ b/src/mame/vsystem/gstriker.cpp
@@ -667,8 +667,7 @@ void gstriker_state::base(machine_config &config)
m_spr->set_pal_mask(0x1f);
m_spr->set_transpen(0);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
generic_latch_8_device &soundlatch(GENERIC_LATCH_8(config, "soundlatch"));
soundlatch.data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
@@ -676,10 +675,10 @@ void gstriker_state::base(machine_config &config)
ym2610_device &ymsnd(YM2610(config, "ymsnd", 8_MHz_XTAL));
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
- ymsnd.add_route(0, "lspeaker", 0.75);
- ymsnd.add_route(0, "rspeaker", 0.75);
- ymsnd.add_route(1, "lspeaker", 1.0);
- ymsnd.add_route(2, "rspeaker", 1.0);
+ ymsnd.add_route(0, "speaker", 0.75, 0);
+ ymsnd.add_route(0, "speaker", 0.75, 1);
+ ymsnd.add_route(1, "speaker", 1.0, 0);
+ ymsnd.add_route(2, "speaker", 1.0, 1);
}
void gstriker_state::gstriker(machine_config &config)
diff --git a/src/mame/vsystem/pspikes.cpp b/src/mame/vsystem/pspikes.cpp
index 846555a9f7b..3f1153e929b 100644
--- a/src/mame/vsystem/pspikes.cpp
+++ b/src/mame/vsystem/pspikes.cpp
@@ -2309,8 +2309,7 @@ void pspikes_banked_sound_state::pspikes(machine_config &config)
MCFG_VIDEO_START_OVERRIDE(pspikes_banked_sound_state,pspikes)
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set(FUNC(pspikes_banked_sound_state::soundlatch_pending_w));
@@ -2318,10 +2317,10 @@ void pspikes_banked_sound_state::pspikes(machine_config &config)
ym2610_device &ymsnd(YM2610(config, "ymsnd", 8000000));
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
- ymsnd.add_route(0, "lspeaker", 0.75);
- ymsnd.add_route(0, "rspeaker", 0.75);
- ymsnd.add_route(1, "lspeaker", 1.0);
- ymsnd.add_route(2, "rspeaker", 1.0);
+ ymsnd.add_route(0, "speaker", 0.75, 0);
+ ymsnd.add_route(0, "speaker", 0.75, 1);
+ ymsnd.add_route(1, "speaker", 1.0, 0);
+ ymsnd.add_route(2, "speaker", 1.0, 1);
}
void spikes91_state::spikes91(machine_config &config)
@@ -2510,8 +2509,7 @@ void pspikes_banked_sound_state::karatblz(machine_config &config)
MCFG_VIDEO_START_OVERRIDE(pspikes_banked_sound_state,karatblz)
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set(FUNC(pspikes_banked_sound_state::soundlatch_pending_w));
@@ -2519,10 +2517,10 @@ void pspikes_banked_sound_state::karatblz(machine_config &config)
ym2610_device &ymsnd(YM2610(config, "ymsnd", XTAL(8'000'000))); // verified on pcb
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
- ymsnd.add_route(0, "lspeaker", 0.75);
- ymsnd.add_route(0, "rspeaker", 0.75);
- ymsnd.add_route(1, "lspeaker", 1.0);
- ymsnd.add_route(2, "rspeaker", 1.0);
+ ymsnd.add_route(0, "speaker", 0.75, 0);
+ ymsnd.add_route(0, "speaker", 0.75, 1);
+ ymsnd.add_route(1, "speaker", 1.0, 0);
+ ymsnd.add_route(2, "speaker", 1.0, 1);
}
void karatblzbl_state::karatblzbl(machine_config &config)
@@ -2608,8 +2606,7 @@ void pspikes_banked_sound_state::spinlbrk(machine_config &config)
MCFG_VIDEO_START_OVERRIDE(pspikes_banked_sound_state,spinlbrk)
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set(FUNC(pspikes_banked_sound_state::soundlatch_pending_w));
@@ -2617,10 +2614,10 @@ void pspikes_banked_sound_state::spinlbrk(machine_config &config)
ym2610_device &ymsnd(YM2610(config, "ymsnd", XTAL(8'000'000))); // verified on pcb
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
- ymsnd.add_route(0, "lspeaker", 0.75);
- ymsnd.add_route(0, "rspeaker", 0.75);
- ymsnd.add_route(1, "lspeaker", 1.0);
- ymsnd.add_route(2, "rspeaker", 1.0);
+ ymsnd.add_route(0, "speaker", 0.75, 0);
+ ymsnd.add_route(0, "speaker", 0.75, 1);
+ ymsnd.add_route(1, "speaker", 1.0, 0);
+ ymsnd.add_route(2, "speaker", 1.0, 1);
}
void pspikes_banked_sound_state::turbofrc(machine_config &config)
@@ -2657,8 +2654,7 @@ void pspikes_banked_sound_state::turbofrc(machine_config &config)
MCFG_VIDEO_START_OVERRIDE(pspikes_banked_sound_state,turbofrc)
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set(FUNC(pspikes_banked_sound_state::soundlatch_pending_w));
@@ -2666,10 +2662,10 @@ void pspikes_banked_sound_state::turbofrc(machine_config &config)
ym2610_device &ymsnd(YM2610(config, "ymsnd", XTAL(8'000'000))); // verified on pcb
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
- ymsnd.add_route(0, "lspeaker", 0.75);
- ymsnd.add_route(0, "rspeaker", 0.75);
- ymsnd.add_route(1, "lspeaker", 1.0);
- ymsnd.add_route(2, "rspeaker", 1.0);
+ ymsnd.add_route(0, "speaker", 0.75, 0);
+ ymsnd.add_route(0, "speaker", 0.75, 1);
+ ymsnd.add_route(1, "speaker", 1.0, 0);
+ ymsnd.add_route(2, "speaker", 1.0, 1);
}
void pspikes_banked_sound_state::aerofgtb(machine_config &config)
@@ -2708,8 +2704,7 @@ void pspikes_banked_sound_state::aerofgtb(machine_config &config)
MCFG_VIDEO_START_OVERRIDE(pspikes_banked_sound_state,aerofgtb)
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set(FUNC(pspikes_banked_sound_state::soundlatch_pending_w));
@@ -2717,10 +2712,10 @@ void pspikes_banked_sound_state::aerofgtb(machine_config &config)
ym2610_device &ymsnd(YM2610(config, "ymsnd", 8000000));
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
- ymsnd.add_route(0, "lspeaker", 0.75);
- ymsnd.add_route(0, "rspeaker", 0.75);
- ymsnd.add_route(1, "lspeaker", 1.0);
- ymsnd.add_route(2, "rspeaker", 1.0);
+ ymsnd.add_route(0, "speaker", 0.75, 0);
+ ymsnd.add_route(1, "speaker", 0.75, 1);
+ ymsnd.add_route(2, "speaker", 1.0, 0);
+ ymsnd.add_route(2, "speaker", 1.0, 1);
}
void pspikes_sound_cpu_state::aerfboot(machine_config &config)
diff --git a/src/mame/vsystem/suprslam.cpp b/src/mame/vsystem/suprslam.cpp
index d64c43f3d6e..76a27881491 100644
--- a/src/mame/vsystem/suprslam.cpp
+++ b/src/mame/vsystem/suprslam.cpp
@@ -450,8 +450,7 @@ void suprslam_state::suprslam(machine_config &config)
m_k053936->set_wrap(1);
m_k053936->set_offsets(-45, -21);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
@@ -459,10 +458,10 @@ void suprslam_state::suprslam(machine_config &config)
ym2610_device &ymsnd(YM2610(config, "ymsnd", 32_MHz_XTAL / 4)); // not verified
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
- ymsnd.add_route(0, "lspeaker", 0.75);
- ymsnd.add_route(0, "rspeaker", 0.75);
- ymsnd.add_route(1, "lspeaker", 1.0);
- ymsnd.add_route(2, "rspeaker", 1.0);
+ ymsnd.add_route(0, "speaker", 0.75, 0);
+ ymsnd.add_route(0, "speaker", 0.75, 1);
+ ymsnd.add_route(1, "speaker", 1.0, 0);
+ ymsnd.add_route(2, "speaker", 1.0, 1);
}
/*** ROM LOADING *************************************************************/
diff --git a/src/mame/vsystem/tail2nos.cpp b/src/mame/vsystem/tail2nos.cpp
index 692cde85dd4..0ebffb27d19 100644
--- a/src/mame/vsystem/tail2nos.cpp
+++ b/src/mame/vsystem/tail2nos.cpp
@@ -516,8 +516,7 @@ void tail2nos_state::tail2nos(machine_config &config)
VSYSTEM_GGA(config, "gga", XTAL(14'318'181) / 2); // divider not verified
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set(FUNC(tail2nos_state::soundlatch_pending_w));
@@ -526,10 +525,10 @@ void tail2nos_state::tail2nos(machine_config &config)
ym2608_device &ymsnd(YM2608(config, "ymsnd", XTAL(8'000'000))); // verified on PCB
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
ymsnd.port_b_write_callback().set(FUNC(tail2nos_state::sound_bankswitch_w));
- ymsnd.add_route(0, "lspeaker", 0.75);
- ymsnd.add_route(0, "rspeaker", 0.75);
- ymsnd.add_route(1, "lspeaker", 1.0);
- ymsnd.add_route(2, "rspeaker", 1.0);
+ ymsnd.add_route(0, "speaker", 0.75, 0);
+ ymsnd.add_route(0, "speaker", 0.75, 1);
+ ymsnd.add_route(1, "speaker", 1.0, 0);
+ ymsnd.add_route(2, "speaker", 1.0, 1);
}
diff --git a/src/mame/vsystem/taotaido.cpp b/src/mame/vsystem/taotaido.cpp
index 82764ae6490..5d6475e160f 100644
--- a/src/mame/vsystem/taotaido.cpp
+++ b/src/mame/vsystem/taotaido.cpp
@@ -600,8 +600,7 @@ void taotaido_state::taotaido(machine_config &config)
m_spr->set_tile_indirect_cb(FUNC(taotaido_state::tile_callback));
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set(FUNC(taotaido_state::soundlatch_pending_w));
@@ -609,10 +608,10 @@ void taotaido_state::taotaido(machine_config &config)
ym2610_device &ymsnd(YM2610(config, "ymsnd", 8'000'000));
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
- ymsnd.add_route(0, "lspeaker", 0.75);
- ymsnd.add_route(0, "rspeaker", 0.75);
- ymsnd.add_route(1, "lspeaker", 1.0);
- ymsnd.add_route(2, "rspeaker", 1.0);
+ ymsnd.add_route(0, "speaker", 0.75, 0);
+ ymsnd.add_route(0, "speaker", 0.75, 1);
+ ymsnd.add_route(1, "speaker", 1.0, 0);
+ ymsnd.add_route(2, "speaker", 1.0, 1);
}
diff --git a/src/mame/vtech/clickstart.cpp b/src/mame/vtech/clickstart.cpp
index 16a2f2f3e67..01fa870e0db 100644
--- a/src/mame/vtech/clickstart.cpp
+++ b/src/mame/vtech/clickstart.cpp
@@ -450,8 +450,8 @@ void clickstart_state::clickstart(machine_config &config)
m_maincpu->portc_in().set(FUNC(clickstart_state::portc_r));
m_maincpu->adc_in<0>().set_constant(0x0fff);
m_maincpu->chip_select().set(FUNC(clickstart_state::chip_sel_w));
- m_maincpu->add_route(ALL_OUTPUTS, "lspeaker", 0.5);
- m_maincpu->add_route(ALL_OUTPUTS, "rspeaker", 0.5);
+ m_maincpu->add_route(ALL_OUTPUTS, "speaker", 0.5, 0);
+ m_maincpu->add_route(ALL_OUTPUTS, "speaker", 0.5, 1);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_refresh_hz(60);
@@ -460,8 +460,7 @@ void clickstart_state::clickstart(machine_config &config)
m_screen->set_screen_update("maincpu", FUNC(spg2xx_device::screen_update));
m_screen->screen_vblank().set(m_maincpu, FUNC(spg2xx_device::vblank));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_CARTSLOT(config, m_cart, generic_plain_slot, "clickstart_cart");
m_cart->set_width(GENERIC_ROM16_WIDTH);
diff --git a/src/mame/vtech/socrates_a.cpp b/src/mame/vtech/socrates_a.cpp
index 8f5c6dfbfed..4de898a24b8 100644
--- a/src/mame/vtech/socrates_a.cpp
+++ b/src/mame/vtech/socrates_a.cpp
@@ -51,12 +51,12 @@ void socrates_snd_device::device_start()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void socrates_snd_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void socrates_snd_device::sound_stream_update(sound_stream &stream)
{
- for (int i = 0; i < outputs[0].samples(); i++)
+ for (int i = 0; i < stream.samples(); i++)
{
snd_clock();
- outputs[0].put_int(i, (int)m_DAC_output, 32768 >> 4);
+ stream.put_int(0, i, (int)m_DAC_output, 32768 >> 4);
}
}
diff --git a/src/mame/vtech/socrates_a.h b/src/mame/vtech/socrates_a.h
index 2c041ae3389..eb311eb37fb 100644
--- a/src/mame/vtech/socrates_a.h
+++ b/src/mame/vtech/socrates_a.h
@@ -22,7 +22,7 @@ protected:
virtual void device_start() 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;
private:
void snd_clock();
static const uint8_t s_volumeLUT[];
diff --git a/src/mame/vtech/storio.cpp b/src/mame/vtech/storio.cpp
index 07188fae25c..9f5b01c6c4c 100644
--- a/src/mame/vtech/storio.cpp
+++ b/src/mame/vtech/storio.cpp
@@ -108,8 +108,7 @@ void vtech_storio_state::vtech_storio_base(machine_config &config)
m_screen->set_visarea(0, 320-1, 0, 240-1);
m_screen->set_screen_update(FUNC(vtech_storio_state::screen_update_storio));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_CARTSLOT(config, m_cart, generic_plain_slot, "vtech_storio_cart");
m_cart->set_width(GENERIC_ROM16_WIDTH);
diff --git a/src/mame/vtech/vsmile.cpp b/src/mame/vtech/vsmile.cpp
index 46e4a2fcd5a..43ac56d5e6b 100644
--- a/src/mame/vtech/vsmile.cpp
+++ b/src/mame/vtech/vsmile.cpp
@@ -309,8 +309,7 @@ void vsmile_base_state::vsmile_base(machine_config &config)
m_screen->set_screen_update("maincpu", FUNC(spg2xx_device::screen_update));
m_screen->screen_vblank().set(m_maincpu, FUNC(spg2xx_device::vblank));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ADDRESS_MAP_BANK(config, m_bankdev);
m_bankdev->set_endianness(ENDIANNESS_BIG);
@@ -327,8 +326,8 @@ void vsmile_state::vsmile(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &vsmile_state::mem_map);
m_maincpu->set_force_no_drc(true);
m_maincpu->chip_select().set(FUNC(vsmile_state::chip_sel_w));
- m_maincpu->add_route(ALL_OUTPUTS, "lspeaker", 0.5);
- m_maincpu->add_route(ALL_OUTPUTS, "rspeaker", 0.5);
+ m_maincpu->add_route(ALL_OUTPUTS, "speaker", 0.5, 0);
+ m_maincpu->add_route(ALL_OUTPUTS, "speaker", 0.5, 1);
m_maincpu->portb_in().set(FUNC(vsmile_state::portb_r));
m_maincpu->portb_out().set(FUNC(vsmile_state::portb_w));
m_maincpu->portc_in().set(FUNC(vsmile_state::portc_r));
diff --git a/src/mame/vtech/vsmileb.cpp b/src/mame/vtech/vsmileb.cpp
index 06aa0c5d502..f434c11edc0 100644
--- a/src/mame/vtech/vsmileb.cpp
+++ b/src/mame/vtech/vsmileb.cpp
@@ -142,8 +142,8 @@ void vsmileb_state::vsmileb(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &vsmileb_state::mem_map);
m_maincpu->set_force_no_drc(true);
m_maincpu->chip_select().set(FUNC(vsmileb_state::chip_sel_w));
- m_maincpu->add_route(ALL_OUTPUTS, "lspeaker", 0.5);
- m_maincpu->add_route(ALL_OUTPUTS, "rspeaker", 0.5);
+ m_maincpu->add_route(ALL_OUTPUTS, "speaker", 0.5);
+ m_maincpu->add_route(ALL_OUTPUTS, "speaker", 0.5);
m_maincpu->porta_in().set(FUNC(vsmileb_state::porta_r));
m_maincpu->portb_in().set(FUNC(vsmileb_state::portb_r));
diff --git a/src/mame/vtech/vtech_innotab.cpp b/src/mame/vtech/vtech_innotab.cpp
index a9f1bbb6e28..c534b0226f3 100644
--- a/src/mame/vtech/vtech_innotab.cpp
+++ b/src/mame/vtech/vtech_innotab.cpp
@@ -91,8 +91,7 @@ void vtech_innotab_state::vtech_innotab(machine_config& config)
m_screen->set_visarea(0, 320 - 1, 0, 240 - 1);
m_screen->set_screen_update(FUNC(vtech_innotab_state::screen_update_innotab));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_CARTSLOT(config, m_cart, generic_plain_slot, "vtech_innotab_cart");
m_cart->set_width(GENERIC_ROM16_WIDTH);
diff --git a/src/mame/xerox/notetaker.cpp b/src/mame/xerox/notetaker.cpp
index 253ff139294..e35b9b850e0 100644
--- a/src/mame/xerox/notetaker.cpp
+++ b/src/mame/xerox/notetaker.cpp
@@ -894,10 +894,9 @@ void notetaker_state::notetakr(machine_config &config)
FLOPPY_CONNECTOR(config, "wd1791:0", notetaker_floppies, "525dd", floppy_image_device::default_mfm_floppy_formats);
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
// TODO: hook DAC up to two HA2425 (sample and hold) chips and hook those up to the speakers
- DAC1200(config, m_dac, 0).add_route(ALL_OUTPUTS, "lspeaker", 0.5).add_route(ALL_OUTPUTS, "rspeaker", 0.5); // unknown DAC
+ DAC1200(config, m_dac, 0).add_route(ALL_OUTPUTS, "speaker", 0.5, 0).add_route(ALL_OUTPUTS, "speaker", 0.5, 1); // unknown DAC
}
void notetaker_state::driver_start()
diff --git a/src/mame/yamaha/fb01.cpp b/src/mame/yamaha/fb01.cpp
index 4aad62dae3b..52098e4ea26 100644
--- a/src/mame/yamaha/fb01.cpp
+++ b/src/mame/yamaha/fb01.cpp
@@ -203,12 +203,11 @@ void fb01_state::fb01(machine_config &config)
MIDI_PORT(config, "mdthru", midiout_slot, "midiout");
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2164_device &ym2164(YM2164(config, "ym2164", XTAL(4'000'000)));
ym2164.irq_handler().set(FUNC(fb01_state::ym2164_irq_w));
- ym2164.add_route(0, "lspeaker", 1.00);
- ym2164.add_route(1, "rspeaker", 1.00);
+ ym2164.add_route(0, "speaker", 1.00, 0);
+ ym2164.add_route(1, "speaker", 1.00, 1);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
}
diff --git a/src/mame/yamaha/tg100.cpp b/src/mame/yamaha/tg100.cpp
index 582e91a1b9e..3fbaa244117 100644
--- a/src/mame/yamaha/tg100.cpp
+++ b/src/mame/yamaha/tg100.cpp
@@ -77,13 +77,12 @@ void tg100_state::tg100(machine_config &config)
HD6435208(config, m_maincpu, XTAL(20'000'000));
m_maincpu->set_addrmap(AS_PROGRAM, &tg100_state::tg100_map);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
MULTIPCM(config, m_ymw258, 9400000);
m_ymw258->set_addrmap(0, &tg100_state::ymw258_map);
- m_ymw258->add_route(0, "lspeaker", 1.0);
- m_ymw258->add_route(1, "rspeaker", 1.0);
+ m_ymw258->add_route(0, "speaker", 1.0, 0);
+ m_ymw258->add_route(1, "speaker", 1.0, 1);
}
ROM_START( tg100 )
diff --git a/src/mame/yamaha/yman1x.cpp b/src/mame/yamaha/yman1x.cpp
index 0467d8ccf83..e2decac1c59 100644
--- a/src/mame/yamaha/yman1x.cpp
+++ b/src/mame/yamaha/yman1x.cpp
@@ -62,8 +62,7 @@ void an1x_state::an1x(machine_config &config)
MULCD(config, "lcd"); // LC7985ND (back-lit)
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
MEG(config, m_meg, 11.2896_MHz_XTAL);
}
diff --git a/src/mame/yamaha/ymdx100.cpp b/src/mame/yamaha/ymdx100.cpp
index 22ed94a1441..9492d8490b9 100644
--- a/src/mame/yamaha/ymdx100.cpp
+++ b/src/mame/yamaha/ymdx100.cpp
@@ -626,12 +626,11 @@ void yamaha_dx100_state::dx100(machine_config &config)
lcdc.set_lcd_size(1, 16);
lcdc.set_pixel_update_cb(FUNC(yamaha_dx100_state::lcd_pixel_update));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2164_device &ymsnd(YM2164(config, "ymsnd", 7.15909_MHz_XTAL / 2)); // with YM3014 DAC
- ymsnd.add_route(0, "lspeaker", 0.60);
- ymsnd.add_route(1, "rspeaker", 0.60);
+ ymsnd.add_route(0, "speaker", 0.60, 0);
+ ymsnd.add_route(1, "speaker", 0.60, 1);
CASSETTE(config, m_cassette);
m_cassette->set_default_state(CASSETTE_STOPPED);
diff --git a/src/mame/yamaha/ymdx11.cpp b/src/mame/yamaha/ymdx11.cpp
index bc25dd89870..9dab3c12bb1 100644
--- a/src/mame/yamaha/ymdx11.cpp
+++ b/src/mame/yamaha/ymdx11.cpp
@@ -117,13 +117,12 @@ void yamaha_dx11_state::dx11(machine_config &config)
lcdc.set_lcd_size(2, 16);
lcdc.set_pixel_update_cb(FUNC(yamaha_dx11_state::lcd_pixel_update));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2414_device &opz(YM2414(config, "opz", 3.579545_MHz_XTAL));
//opz.irq_handler().set_inputline(m_maincpu, hd6301y_cpu_device::IRQ2_LINE); // IRQ = P51
- opz.add_route(0, "lspeaker", 0.60);
- opz.add_route(1, "rspeaker", 0.60);
+ opz.add_route(0, "speaker", 0.60, 0);
+ opz.add_route(1, "speaker", 0.60, 1);
}
ROM_START(dx11)
diff --git a/src/mame/yamaha/ymmu10.cpp b/src/mame/yamaha/ymmu10.cpp
index ca9e52d510f..f34b6821587 100644
--- a/src/mame/yamaha/ymmu10.cpp
+++ b/src/mame/yamaha/ymmu10.cpp
@@ -138,12 +138,11 @@ void mu10_state::mu10(machine_config &config)
NVRAM(config, m_nvram, nvram_device::DEFAULT_NONE);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
SWP00(config, m_swp00);
- m_swp00->add_route(0, "lspeaker", 1.0);
- m_swp00->add_route(1, "rspeaker", 1.0);
+ m_swp00->add_route(0, "speaker", 1.0, 0);
+ m_swp00->add_route(1, "speaker", 1.0, 1);
auto &mdin(MIDI_PORT(config, "mdin"));
midiin_slot(mdin);
diff --git a/src/mame/yamaha/ymmu100.cpp b/src/mame/yamaha/ymmu100.cpp
index 3debaa5560c..1dc406bc95c 100644
--- a/src/mame/yamaha/ymmu100.cpp
+++ b/src/mame/yamaha/ymmu100.cpp
@@ -479,13 +479,12 @@ void mu100_state::mu100b(machine_config &config)
PLG1X0_CONNECTOR(config, m_ext1, plg1x0_intf, nullptr);
m_ext1->midi_tx().set(FUNC(mu100_state::e1_tx));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
SWP30(config, m_swp30);
m_swp30->set_addrmap(AS_DATA, &mu100_state::swp30_map);
- m_swp30->add_route(0, "lspeaker", 1.0);
- m_swp30->add_route(1, "rspeaker", 1.0);
+ m_swp30->add_route(0, "speaker", 1.0, 0);
+ m_swp30->add_route(1, "speaker", 1.0, 1);
auto &mdin_a(MIDI_PORT(config, "mdin_a"));
midiin_slot(mdin_a);
diff --git a/src/mame/yamaha/ymmu128.cpp b/src/mame/yamaha/ymmu128.cpp
index 849d06e9ff2..a8ae8340a0a 100644
--- a/src/mame/yamaha/ymmu128.cpp
+++ b/src/mame/yamaha/ymmu128.cpp
@@ -186,18 +186,17 @@ void mu128_state::mu128(machine_config &config)
MULCD(config, m_lcd);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
SWP30(config, m_swp30m);
m_swp30m->set_addrmap(AS_DATA, &mu128_state::swp30_map);
- m_swp30m->add_route(0, "lspeaker", 1.0);
- m_swp30m->add_route(1, "rspeaker", 1.0);
+ m_swp30m->add_route(0, "speaker", 1.0, 0);
+ m_swp30m->add_route(1, "speaker", 1.0, 1);
SWP30(config, m_swp30s);
m_swp30s->set_addrmap(AS_DATA, &mu128_state::swp30_map);
- m_swp30s->add_route(0, "lspeaker", 1.0);
- m_swp30s->add_route(1, "rspeaker", 1.0);
+ m_swp30s->add_route(0, "speaker", 1.0, 0);
+ m_swp30s->add_route(1, "speaker", 1.0, 1);
INPUT_MERGER_ANY_HIGH(config, "irq0").output_handler().set_inputline(m_maincpu, 0);
I8251(config, m_sci, 10_MHz_XTAL); // uPD71051GU-10
diff --git a/src/mame/yamaha/ymmu15.cpp b/src/mame/yamaha/ymmu15.cpp
index 9df5655bc78..eb35768cc9d 100644
--- a/src/mame/yamaha/ymmu15.cpp
+++ b/src/mame/yamaha/ymmu15.cpp
@@ -176,8 +176,8 @@ void mu15_state::mu15(machine_config &config)
m_maincpu->set_addrmap(swx00_device::AS_C, &mu15_state::c_map);
m_maincpu->set_addrmap(swx00_device::AS_S, &mu15_state::s_map);
- m_maincpu->add_route(0, "lspeaker", 1.0);
- m_maincpu->add_route(1, "rspeaker", 1.0);
+ m_maincpu->add_route(0, "speaker", 1.0, 0);
+ m_maincpu->add_route(1, "speaker", 1.0, 1);
// Nothing connected to sclki, yet...
m_maincpu->sci_set_external_clock_period(0, attotime::from_hz(500000));
@@ -197,8 +197,7 @@ void mu15_state::mu15(machine_config &config)
MU5LCD(config, m_lcd);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
// sci0 goes to the host connector
diff --git a/src/mame/yamaha/ymmu2000.cpp b/src/mame/yamaha/ymmu2000.cpp
index 29c7d9ee809..4ef450f7940 100644
--- a/src/mame/yamaha/ymmu2000.cpp
+++ b/src/mame/yamaha/ymmu2000.cpp
@@ -348,13 +348,12 @@ void mu500_state::mu500(machine_config &config)
MULCD(config, m_lcd);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
SWP30(config, m_swp30m);
m_swp30m->set_addrmap(AS_DATA, &mu500_state::swp30_map);
- m_swp30m->add_route(0, "lspeaker", 1.0);
- m_swp30m->add_route(1, "rspeaker", 1.0);
+ m_swp30m->add_route(0, "speaker", 1.0, 0);
+ m_swp30m->add_route(1, "speaker", 1.0, 1);
auto &mdin_a(MIDI_PORT(config, "mdin_a"));
midiin_slot(mdin_a);
@@ -390,8 +389,8 @@ void mu1000_state::mu1000(machine_config &config)
SWP30(config, m_swp30s);
m_swp30s->set_addrmap(AS_DATA, &mu1000_state::swp30_map);
- m_swp30s->add_route(0, "lspeaker", 1.0);
- m_swp30s->add_route(1, "rspeaker", 1.0);
+ m_swp30s->add_route(0, "speaker", 1.0, 0);
+ m_swp30s->add_route(1, "speaker", 1.0, 1);
}
void mu2000_state::mu2000(machine_config &config)
diff --git a/src/mame/yamaha/ymmu5.cpp b/src/mame/yamaha/ymmu5.cpp
index 7d9251ee176..62ef0795a6e 100644
--- a/src/mame/yamaha/ymmu5.cpp
+++ b/src/mame/yamaha/ymmu5.cpp
@@ -204,13 +204,12 @@ void mu5_state::mu5(machine_config &config)
MU5LCD(config, m_lcd);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
MULTIPCM(config, m_ymw258, 9.4_MHz_XTAL); // clock verified by schematics
m_ymw258->set_addrmap(0, &mu5_state::ymw258_map);
- m_ymw258->add_route(0, "lspeaker", 1.0);
- m_ymw258->add_route(1, "rspeaker", 1.0);
+ m_ymw258->add_route(0, "speaker", 1.0, 0);
+ m_ymw258->add_route(1, "speaker", 1.0, 1);
MIDI_PORT(config, "mdin", midiin_slot, "midiin").rxd_handler().set(m_maincpu, FUNC(h83002_device::sci_rx_w<1>));
diff --git a/src/mame/yamaha/ymmu50.cpp b/src/mame/yamaha/ymmu50.cpp
index 2b4c47f7dc8..032952a8026 100644
--- a/src/mame/yamaha/ymmu50.cpp
+++ b/src/mame/yamaha/ymmu50.cpp
@@ -21,6 +21,7 @@
#include "bus/midi/midioutport.h"
#include "cpu/h8/h83003.h"
#include "machine/nvram.h"
+#include "sound/adc.h"
#include "sound/swp00.h"
#include "mulcd.h"
@@ -70,6 +71,8 @@ public:
, m_ioport_o1(*this, "O1")
, m_ioport_o2(*this, "O2")
, m_ram(*this, "ram")
+ , m_ad(*this, "ad")
+ , m_adc(*this, "adc%u", 0U)
{ }
void mu50(machine_config &config);
@@ -89,6 +92,8 @@ private:
required_ioport m_ioport_o1;
required_ioport m_ioport_o2;
required_shared_ptr<u16> m_ram;
+ required_device<microphone_device> m_ad;
+ required_device_array<adc10_device, 2> m_adc;
u8 cur_p6, cur_p9, cur_pa, cur_pb, cur_pc;
@@ -135,13 +140,19 @@ void mu50_state::mu50_map(address_map &map)
// Analog input right (not sent to the swp, mixing is analog)
u16 mu50_state::adc_ar_r()
{
- return 0x3ff;
+ s16 v = m_adc[0]->read();
+ if(v < 0)
+ v = -v;
+ return 0x3ff - v;
}
// Analog input left (not sent to the swp, mixing is analog)
u16 mu50_state::adc_al_r()
{
- return 0x3ff;
+ s16 v = m_adc[1]->read();
+ if(v < 0)
+ v = -v;
+ return 0x3ff - v;
}
// Put the host switch to pure midi
@@ -269,12 +280,20 @@ void mu50_state::mu50(machine_config &config)
MULCD(config, m_lcd);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ MICROPHONE(config, m_ad, 2).front();
+ m_ad->add_route(0, "speakers", 1.0, 0);
+ m_ad->add_route(1, "speakers", 1.0, 1);
+ m_ad->add_route(0, "adc0", 1.0);
+ m_ad->add_route(1, "adc1", 1.0);
+
+ ADC10(config, m_adc[0]);
+ ADC10(config, m_adc[1]);
+
+ SPEAKER(config, "speakers", 2).front();
SWP00(config, m_swp00);
- m_swp00->add_route(0, "lspeaker", 1.0);
- m_swp00->add_route(1, "rspeaker", 1.0);
+ m_swp00->add_route(0, "speakers", 1.0, 0);
+ m_swp00->add_route(1, "speakers", 1.0, 1);
auto &mdin(MIDI_PORT(config, "mdin"));
midiin_slot(mdin);
diff --git a/src/mame/yamaha/ymmu80.cpp b/src/mame/yamaha/ymmu80.cpp
index 4ba4aa3a5ac..24f1b4397d3 100644
--- a/src/mame/yamaha/ymmu80.cpp
+++ b/src/mame/yamaha/ymmu80.cpp
@@ -339,18 +339,17 @@ void mu80_state::mu80(machine_config &config)
MULCD(config, m_lcd);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
SWP20(config, m_swp20_0);
m_swp20_0->set_device_rom_tag("swp20");
- m_swp20_0->add_route(0, "lspeaker", 1.0);
- m_swp20_0->add_route(1, "rspeaker", 1.0);
+ m_swp20_0->add_route(0, "speaker", 1.0, 0);
+ m_swp20_0->add_route(1, "speaker", 1.0, 1);
SWP20(config, m_swp20_1);
m_swp20_1->set_device_rom_tag("swp20");
- m_swp20_1->add_route(0, "lspeaker", 1.0);
- m_swp20_1->add_route(1, "rspeaker", 1.0);
+ m_swp20_1->add_route(0, "speaker", 1.0, 0);
+ m_swp20_1->add_route(1, "speaker", 1.0, 1);
MEG(config, m_meg);
diff --git a/src/mame/yamaha/ymmu90.cpp b/src/mame/yamaha/ymmu90.cpp
index ee4b2e7c950..8b125c9cf4c 100644
--- a/src/mame/yamaha/ymmu90.cpp
+++ b/src/mame/yamaha/ymmu90.cpp
@@ -213,13 +213,12 @@ void mu90_state::mu90b(machine_config &config)
m_maincpu->read_portb().set(FUNC(mu90_state::pb_r));
m_maincpu->write_portb().set(FUNC(mu90_state::pb_w));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
SWP30(config, m_swp30);
m_swp30->set_addrmap(AS_DATA, &mu90_state::swp30_map);
- m_swp30->add_route(0, "lspeaker", 1.0);
- m_swp30->add_route(1, "rspeaker", 1.0);
+ m_swp30->add_route(0, "speaker", 1.0, 0);
+ m_swp30->add_route(1, "speaker", 1.0, 1);
auto &mdin_a(MIDI_PORT(config, "mdin_a"));
midiin_slot(mdin_a);
diff --git a/src/mame/yamaha/ympsr150.cpp b/src/mame/yamaha/ympsr150.cpp
index a462949a14a..6796bbf0927 100644
--- a/src/mame/yamaha/ympsr150.cpp
+++ b/src/mame/yamaha/ympsr150.cpp
@@ -245,11 +245,10 @@ void psr150_state::psr150(machine_config &config)
// set up AC filters since the keyboard purposely outputs a DC offset when idle
// TODO: there is also a RLC lowpass with R=120, L=3.3mH, C=0.33uF (or R=150 for psr110)
- FILTER_RC(config, "lfilter").set_ac().add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- FILTER_RC(config, "rfilter").set_ac().add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ FILTER_RC(config, "lfilter").set_ac().add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ FILTER_RC(config, "rfilter").set_ac().add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
config.set_default_layout(layout_psr150);
}
@@ -362,11 +361,10 @@ void psr150_state::psr180(machine_config &config)
// set up AC filters since the keyboard purposely outputs a DC offset when idle
// TODO: there is also a RLC lowpass with R=120, L=3.3mH, C=0.39uF
- FILTER_RC(config, "lfilter").set_ac().add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- FILTER_RC(config, "rfilter").set_ac().add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ FILTER_RC(config, "lfilter").set_ac().add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ FILTER_RC(config, "rfilter").set_ac().add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
config.set_default_layout(layout_psr180);
}
@@ -448,11 +446,10 @@ void psr150_state::psr190(machine_config &config)
// set up AC filters since the keyboard purposely outputs a DC offset when idle
// TODO: there is also a RLC lowpass with R=120, L=3.3mH, C=0.33uF
- FILTER_RC(config, "lfilter").set_ac().add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- FILTER_RC(config, "rfilter").set_ac().add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ FILTER_RC(config, "lfilter").set_ac().add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ FILTER_RC(config, "rfilter").set_ac().add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
void psr150_state::psr78(machine_config &config)
diff --git a/src/mame/yamaha/ympsr2000.cpp b/src/mame/yamaha/ympsr2000.cpp
index fa9a11088c5..57e6a6a4d93 100644
--- a/src/mame/yamaha/ympsr2000.cpp
+++ b/src/mame/yamaha/ympsr2000.cpp
@@ -58,8 +58,7 @@ void psr2000_state::psr2000(machine_config &config)
m_lcdc->set_screen("screen");
m_lcdc->set_addrmap(0, &psr2000_state::lcdc_map);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
void psr2000_state::map(address_map &map)
diff --git a/src/mame/yamaha/ympsr340.cpp b/src/mame/yamaha/ympsr340.cpp
index d24c3cd6580..6cb11563dcf 100644
--- a/src/mame/yamaha/ympsr340.cpp
+++ b/src/mame/yamaha/ympsr340.cpp
@@ -219,8 +219,8 @@ void psr340_state::psr340(machine_config &config)
m_maincpu->read_pad().set(FUNC(psr340_state::pad_r));
m_maincpu->write_txd().set(FUNC(psr340_state::txd_w));
- m_maincpu->add_route(0, "lspeaker", 1.0);
- m_maincpu->add_route(1, "rspeaker", 1.0);
+ m_maincpu->add_route(0, "speaker", 1.0, 0);
+ m_maincpu->add_route(1, "speaker", 1.0, 1);
// mks3 is connected to sclki, sync comms on sci1
// something generates 500K for sci0, probably internal to the swx00
@@ -248,8 +248,7 @@ void psr340_state::psr340(machine_config &config)
auto &mdout(MIDI_PORT(config, "mdout", midiout_slot, "midiout"));
m_maincpu->write_sci_tx<0>().set(mdout, FUNC(midi_port_device::write_txd));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
}
ROM_START( psr340 )
diff --git a/src/mame/yamaha/ympsr400.cpp b/src/mame/yamaha/ympsr400.cpp
index 05a477ccc8c..d01c3d706c7 100644
--- a/src/mame/yamaha/ympsr400.cpp
+++ b/src/mame/yamaha/ympsr400.cpp
@@ -97,12 +97,11 @@ void psr400_state::psr500(machine_config &config)
HD6305V0(config, m_mpscpu, 8_MHz_XTAL).set_disable(); // HD63B05V0D73P (mislabeled HD63B50 on schematic)
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
multipcm_device &gew8(MULTIPCM(config, "gew8", 9.4_MHz_XTAL)); // YMW-258-F
- gew8.add_route(1, "lspeaker", 1.0);
- gew8.add_route(0, "rspeaker", 1.0);
+ gew8.add_route(1, "speaker", 1.0, 0);
+ gew8.add_route(0, "speaker", 1.0, 1);
//YM3413(config, "ldsp"); // PSR-500 only (has its own 256K-bit PSRAM)
}
diff --git a/src/mame/yamaha/ympsr540.cpp b/src/mame/yamaha/ympsr540.cpp
index 5b5a2b31e36..ff3ec5f94a3 100644
--- a/src/mame/yamaha/ympsr540.cpp
+++ b/src/mame/yamaha/ympsr540.cpp
@@ -135,8 +135,8 @@ void psr540_state::psr540(machine_config &config)
m_maincpu->read_portf().set(FUNC(psr540_state::pf_r));
SWX00_SOUND(config, m_swx00);
- m_swx00->add_route(0, "lspeaker", 1.0);
- m_swx00->add_route(1, "rspeaker", 1.0);
+ m_swx00->add_route(0, "speaker", 1.0, 0);
+ m_swx00->add_route(1, "speaker", 1.0, 1);
MKS3(config, m_mks3);
m_mks3->write_da().set(m_maincpu, FUNC(sh7042_device::sci_rx_w<1>));
@@ -164,8 +164,7 @@ void psr540_state::psr540(machine_config &config)
screen.set_visarea_full();
screen.screen_vblank().set(FUNC(psr540_state::render_w));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
auto &mdin(MIDI_PORT(config, "mdin"));
midiin_slot(mdin);
diff --git a/src/mame/yamaha/ympsr60.cpp b/src/mame/yamaha/ympsr60.cpp
index 6fda630242e..9ee89f86d1b 100644
--- a/src/mame/yamaha/ympsr60.cpp
+++ b/src/mame/yamaha/ympsr60.cpp
@@ -144,7 +144,10 @@ private:
void ppi_pc_w(u8 data);
void recalc_irqs();
- attoseconds_t cv_handler(attotime const &curtime);
+ TIMER_CALLBACK_MEMBER(bbd_tick);
+ void bbd_setup_next_tick();
+
+ emu_timer *m_bbd_timer;
int m_acia_irq, m_ym_irq, m_drvif_irq, m_ym2154_irq;
u16 m_keyboard_select;
@@ -227,9 +230,15 @@ void psr60_state::ryp4_out_w(u8 data)
// modulation, which we simulate in a periodic timer
}
-attoseconds_t psr60_state::cv_handler(attotime const &cvtime)
+TIMER_CALLBACK_MEMBER(psr60_state::bbd_tick)
{
- attotime curtime = cvtime;
+ m_bbd->tick();
+ bbd_setup_next_tick();
+}
+
+void psr60_state::bbd_setup_next_tick()
+{
+ attotime curtime = machine().time();
// only two states have been observed to be measured: CT1=1/CT2=0 and CT1=0/CT2=1
double bbd_freq;
@@ -252,7 +261,7 @@ attoseconds_t psr60_state::cv_handler(attotime const &cvtime)
}
// BBD driver provides two out-of-phase clocks to basically run the BBD at 2x
- return HZ_TO_ATTOSECONDS(bbd_freq * 2);
+ m_bbd_timer->adjust(attotime::from_ticks(1, bbd_freq * 2));
}
//
@@ -313,6 +322,8 @@ void psr60_state::recalc_irqs()
void psr60_state::machine_start()
{
+ m_bbd_timer = timer_alloc(FUNC(psr60_state::bbd_tick), this);
+
m_drvif_out.resolve();
m_rom2bank->configure_entries(0, 2, memregion("rom2")->base(), 0x4000);
m_rom2bank->set_entry(0);
@@ -324,6 +335,7 @@ void psr60_state::machine_start()
void psr60_state::machine_reset()
{
+ bbd_setup_next_tick();
}
#define DRVIF_PORT(num, sw1, sw2, sw3, sw4) \
@@ -628,14 +640,13 @@ void psr60_state::psr_common(machine_config &config)
clock_device &acia_clock(CLOCK(config, "acia_clock", 500_kHz_XTAL)); // 31250 * 16 = 500,000
acia_clock.signal_handler().set(FUNC(psr60_state::write_acia_clock));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
MIXER(config, m_lmixer);
- m_lmixer->add_route(0, "lspeaker", 1.0);
+ m_lmixer->add_route(0, "speaker", 1.0, 0);
MIXER(config, m_rmixer);
- m_rmixer->add_route(0, "rspeaker", 1.0);
+ m_rmixer->add_route(0, "speaker", 1.0, 1);
// begin BBD filter chain....
// thanks to Lord Nightmare for figuring this out
@@ -660,8 +671,7 @@ void psr60_state::psr_common(machine_config &config)
MIXER(config, m_bbd_mixer);
m_bbd_mixer->add_route(0, m_postbbd_rc, 1.0);
- MN3204P(config, m_bbd, 50000);
- m_bbd->set_cv_handler(FUNC(psr60_state::cv_handler));
+ MN3204P(config, m_bbd);
m_bbd->add_route(0, m_bbd_mixer, 0.5);
m_bbd->add_route(1, m_bbd_mixer, 0.5);
diff --git a/src/mame/yamaha/ymqs300.cpp b/src/mame/yamaha/ymqs300.cpp
index af5318aa70c..b86bb7220b2 100644
--- a/src/mame/yamaha/ymqs300.cpp
+++ b/src/mame/yamaha/ymqs300.cpp
@@ -214,8 +214,8 @@ void qs300_state::qs300(machine_config &config)
m_subcpu->read_porta().set(FUNC(qs300_state::spa_r));
SWP00(config, m_swp00);
- m_swp00->add_route(0, "lspeaker", 1.0);
- m_swp00->add_route(1, "rspeaker", 1.0);
+ m_swp00->add_route(0, "speaker", 1.0, 0);
+ m_swp00->add_route(1, "speaker", 1.0, 1);
T6963C(config, m_lcdc, 270000);
m_lcdc->set_addrmap(0, &qs300_state::lcdmap);
@@ -233,8 +233,7 @@ void qs300_state::qs300(machine_config &config)
NVRAM(config, m_nvram, nvram_device::DEFAULT_NONE);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
auto &mdin(MIDI_PORT(config, "mdin"));
midiin_slot(mdin);
diff --git a/src/mame/yamaha/ymqy70.cpp b/src/mame/yamaha/ymqy70.cpp
index 85b434e0943..fc4c8b5220f 100644
--- a/src/mame/yamaha/ymqy70.cpp
+++ b/src/mame/yamaha/ymqy70.cpp
@@ -180,8 +180,7 @@ void qy70_state::qy70(machine_config &config)
PALETTE(config, "palette", FUNC(qy70_state::lcd_palette), 2);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
auto &mdin_a(MIDI_PORT(config, "mdin_a"));
midiin_slot(mdin_a);
diff --git a/src/mame/yamaha/ymrx15.cpp b/src/mame/yamaha/ymrx15.cpp
index a370bc48efe..512999258a2 100644
--- a/src/mame/yamaha/ymrx15.cpp
+++ b/src/mame/yamaha/ymrx15.cpp
@@ -79,12 +79,11 @@ void rx15_state::rx15(machine_config &config)
lcdc.set_lcd_size(2, 8);
lcdc.set_pixel_update_cb(FUNC(rx15_state::pixel_update));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
YM2154(config, m_ryp4, 2.7_MHz_XTAL);
- m_ryp4->add_route(0, "lspeaker", 0.50);
- m_ryp4->add_route(1, "rspeaker", 0.50);
+ m_ryp4->add_route(0, "speaker", 0.50, 0);
+ m_ryp4->add_route(1, "speaker", 0.50, 1);
}
ROM_START(rx15)
diff --git a/src/mame/yamaha/ymtx81z.cpp b/src/mame/yamaha/ymtx81z.cpp
index a164ebada95..46733fb808c 100644
--- a/src/mame/yamaha/ymtx81z.cpp
+++ b/src/mame/yamaha/ymtx81z.cpp
@@ -157,13 +157,12 @@ void ymtx81z_state::tx81z(machine_config &config)
lcdc.set_lcd_size(2, 16);
lcdc.set_pixel_update_cb(FUNC(ymtx81z_state::lcd_pixel_update));
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
ym2414_device &ymsnd(YM2414(config, "ymsnd", 7.15909_MHz_XTAL / 2));
ymsnd.irq_handler().set_inputline(m_maincpu, HD6301_IRQ1_LINE);
- ymsnd.add_route(0, "lspeaker", 0.60);
- ymsnd.add_route(1, "rspeaker", 0.60);
+ ymsnd.add_route(0, "speaker", 0.60, 0);
+ ymsnd.add_route(1, "speaker", 0.60, 1);
}
ROM_START(tx81z)
diff --git a/src/mame/yamaha/ymvl70.cpp b/src/mame/yamaha/ymvl70.cpp
index c16717ae755..b8c77078008 100644
--- a/src/mame/yamaha/ymvl70.cpp
+++ b/src/mame/yamaha/ymvl70.cpp
@@ -199,8 +199,7 @@ void vl70_state::vl70(machine_config &config)
MULCD(config, m_lcd);
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
DSPV(config, m_dspv);
MEG(config, m_meg);
diff --git a/src/mame/yunsung/yunsun16.cpp b/src/mame/yunsung/yunsun16.cpp
index 344381eb9ef..93e74dc59d5 100644
--- a/src/mame/yunsung/yunsun16.cpp
+++ b/src/mame/yunsung/yunsun16.cpp
@@ -918,19 +918,18 @@ void magicbub_state::magicbub(machine_config &config)
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 8192);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, m_soundlatch);
ym3812_device &ymsnd(YM3812(config, "ymsnd", XTAL(16'000'000) / 4));
ymsnd.irq_handler().set_inputline("audiocpu", 0);
- ymsnd.add_route(ALL_OUTPUTS, "lspeaker", 0.80);
- ymsnd.add_route(ALL_OUTPUTS, "rspeaker", 0.80);
+ ymsnd.add_route(ALL_OUTPUTS, "speaker", 0.80, 0);
+ ymsnd.add_route(ALL_OUTPUTS, "speaker", 0.80, 1);
okim6295_device &oki(OKIM6295(config, "oki", XTAL(16'000'000) / 16, okim6295_device::PIN7_HIGH));
- oki.add_route(ALL_OUTPUTS, "lspeaker", 0.80);
- oki.add_route(ALL_OUTPUTS, "rspeaker", 0.80);
+ oki.add_route(ALL_OUTPUTS, "speaker", 0.80, 0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 0.80, 1);
}
@@ -955,12 +954,11 @@ void shocking_state::shocking(machine_config &config)
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 8192);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
okim6295_device &oki(OKIM6295(config, "oki", XTAL(16'000'000) / 16, okim6295_device::PIN7_HIGH));
- oki.add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- oki.add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ oki.add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
oki.set_addrmap(0, &shocking_state::oki_map);
}
diff --git a/src/mame/yunsung/yunsung8.cpp b/src/mame/yunsung/yunsung8.cpp
index e2168cc0926..be17279320f 100644
--- a/src/mame/yunsung/yunsung8.cpp
+++ b/src/mame/yunsung/yunsung8.cpp
@@ -603,14 +603,13 @@ void yunsung8_state::yunsung8(machine_config &config)
PALETTE(config, m_palette).set_entries(2048);
// sound hardware
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
+ SPEAKER(config, "speaker", 2).front();
GENERIC_LATCH_8(config, "soundlatch").data_pending_callback().set_inputline(m_audiocpu, 0);
ym3812_device &ymsnd(YM3812(config, "ymsnd", XTAL(16'000'000) / 4));
- ymsnd.add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- ymsnd.add_route(ALL_OUTPUTS, "rspeaker", 1.0);
+ ymsnd.add_route(ALL_OUTPUTS, "speaker", 1.0, 0);
+ ymsnd.add_route(ALL_OUTPUTS, "speaker", 1.0, 1);
LS157(config, m_adpcm_select, 0);
m_adpcm_select->out_callback().set("msm", FUNC(msm5205_device::data_w));
@@ -618,8 +617,8 @@ void yunsung8_state::yunsung8(machine_config &config)
MSM5205(config, m_msm, XTAL(400'000)); // verified on PCB
m_msm->vck_legacy_callback().set(FUNC(yunsung8_state::adpcm_int)); // interrupt function
m_msm->set_prescaler_selector(msm5205_device::S96_4B); // 4KHz, 4 Bits
- m_msm->add_route(ALL_OUTPUTS, "lspeaker", 0.80);
- m_msm->add_route(ALL_OUTPUTS, "rspeaker", 0.80);
+ m_msm->add_route(ALL_OUTPUTS, "speaker", 0.80, 0);
+ m_msm->add_route(ALL_OUTPUTS, "speaker", 0.80, 1);
}
diff --git a/src/mame/zaccaria/zaccaria_a.cpp b/src/mame/zaccaria/zaccaria_a.cpp
index 5bde9725b95..44b48a257f7 100644
--- a/src/mame/zaccaria/zaccaria_a.cpp
+++ b/src/mame/zaccaria/zaccaria_a.cpp
@@ -179,7 +179,7 @@ zac1b111xx_melody_base::zac1b111xx_melody_base(
device_t *owner,
u32 clock)
: device_t(mconfig, devtype, tag, owner, clock)
- , device_mixer_interface(mconfig, *this, 1)
+ , device_mixer_interface(mconfig, *this)
, m_melodycpu(*this, "melodycpu")
, m_melodypia(*this, "melodypia")
, m_melodypsg1(*this, "melodypsg1")
@@ -314,10 +314,10 @@ void zac1b11107_audio_device::device_add_mconfig(machine_config &config)
m_melodycpu->set_addrmap(AS_PROGRAM, &zac1b11107_audio_device::zac1b11107_melody_map);
m_melodypsg1->port_a_write_callback().set(FUNC(zac1b11107_audio_device::melodypsg1_porta_w));
- m_melodypsg1->add_route(ALL_OUTPUTS, *this, 0.5, AUTO_ALLOC_INPUT, 0);
+ m_melodypsg1->add_route(ALL_OUTPUTS, *this, 0.5, 0);
m_melodypsg2->port_a_write_callback().set(FUNC(zac1b11107_audio_device::melodypsg2_porta_w));
- m_melodypsg2->add_route(ALL_OUTPUTS, *this, 0.5, AUTO_ALLOC_INPUT, 0);
+ m_melodypsg2->add_route(ALL_OUTPUTS, *this, 0.5, 0);
}
@@ -435,7 +435,7 @@ void zac1b11142_audio_device::device_add_mconfig(machine_config &config)
m_pia_1i->writepa_handler().set(m_speech, FUNC(tms5220_device::data_w));
m_pia_1i->writepb_handler().set(FUNC(zac1b11142_audio_device::pia_1i_portb_w));
- //MC1408(config, "dac", 0).add_route(ALL_OUTPUTS, *this, 0.30, AUTO_ALLOC_INPUT, 0); // mc1408.1f
+ //MC1408(config, "dac", 0).add_route(ALL_OUTPUTS, *this, 0.30, 0); // mc1408.1f
MC1408(config, "dac").add_route(ALL_OUTPUTS, "sound_nl", 1.0, 7); // mc1408.1f
// There is no xtal, the clock is obtained from a RC oscillator as shown in the TMS5220 datasheet (R=100kOhm C=22pF)
@@ -447,7 +447,7 @@ void zac1b11142_audio_device::device_add_mconfig(machine_config &config)
NETLIST_SOUND(config, "sound_nl", 48000)
.set_source(netlist_zac1b11142)
- .add_route(ALL_OUTPUTS, *this, 1.0, AUTO_ALLOC_INPUT, 0);
+ .add_route(ALL_OUTPUTS, *this, 1.0, 0);
NETLIST_LOGIC_INPUT(config, "sound_nl:ioa0", "I_IOA0.IN", 0);
NETLIST_LOGIC_INPUT(config, "sound_nl:ioa1", "I_IOA1.IN", 0);
diff --git a/src/osd/interface/audio.h b/src/osd/interface/audio.h
new file mode 100644
index 00000000000..9e084cf53ab
--- /dev/null
+++ b/src/osd/interface/audio.h
@@ -0,0 +1,52 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+
+#ifndef MAME_OSD_INTERFACE_AUDIO_H
+#define MAME_OSD_INTERFACE_AUDIO_H
+
+#pragma once
+
+#include <string>
+#include <array>
+#include <vector>
+#include <math.h>
+
+namespace osd {
+
+struct audio_rate_range {
+ uint32_t m_default_rate;
+ uint32_t m_min_rate;
+ uint32_t m_max_rate;
+};
+
+struct audio_info {
+ struct node_info {
+ std::string m_name;
+ uint32_t m_id;
+ audio_rate_range m_rate;
+ std::vector<std::string> m_port_names;
+ std::vector<std::array<double, 3>> m_port_positions;
+ uint32_t m_sinks;
+ uint32_t m_sources;
+
+ std::string name() const { return (m_sinks ? "o:" : "i:") + m_name; }
+ };
+
+ struct stream_info {
+ uint32_t m_id;
+ uint32_t m_node;
+ std::vector<float> m_volumes;
+ };
+
+ uint32_t m_generation;
+ uint32_t m_default_sink;
+ uint32_t m_default_source;
+ std::vector<node_info> m_nodes;
+ std::vector<stream_info> m_streams;
+};
+
+static inline float db_to_linear(float db) { return db <= -96 ? 0.0 : pow(10, db/20); }
+static inline float linear_to_db(float linear) { return linear <= 1/65536.0 ? -96 : 20*log10(linear); }
+}
+
+#endif
diff --git a/src/osd/modules/lib/osdobj_common.cpp b/src/osd/modules/lib/osdobj_common.cpp
index eed73f3097b..24148889570 100644
--- a/src/osd/modules/lib/osdobj_common.cpp
+++ b/src/osd/modules/lib/osdobj_common.cpp
@@ -271,6 +271,9 @@ void osd_common_t::register_options()
#ifndef NO_USE_PULSEAUDIO
REGISTER_MODULE(m_mod_man, SOUND_PULSEAUDIO);
#endif
+#ifndef NO_USE_PIPEWIRE
+ REGISTER_MODULE(m_mod_man, SOUND_PIPEWIRE);
+#endif
REGISTER_MODULE(m_mod_man, SOUND_NONE);
REGISTER_MODULE(m_mod_man, MONITOR_SDL);
@@ -506,39 +509,58 @@ void osd_common_t::debugger_update()
}
-//-------------------------------------------------
-// update_audio_stream - update the stereo audio
-// stream
-//-------------------------------------------------
+bool osd_common_t::sound_external_per_channel_volume()
+{
+ return m_sound->external_per_channel_volume();
+}
-void osd_common_t::update_audio_stream(const int16_t *buffer, int samples_this_frame)
+bool osd_common_t::sound_split_streams_per_source()
{
- //
- // This method is called whenever the system has new audio data to stream.
- // It provides an array of stereo samples in L-R order which should be
- // output at the configured sample_rate.
- //
- m_sound->update_audio_stream(m_machine->video().throttled(), buffer,samples_this_frame);
+ return m_sound->split_streams_per_source();
}
+uint32_t osd_common_t::sound_get_generation()
+{
+ return m_sound->get_generation();
+}
-//-------------------------------------------------
-// set_mastervolume - set the system volume
-//-------------------------------------------------
+osd::audio_info osd_common_t::sound_get_information()
+{
+ return m_sound->get_information();
+}
-void osd_common_t::set_mastervolume(int attenuation)
+uint32_t osd_common_t::sound_stream_sink_open(uint32_t node, std::string name, uint32_t rate)
{
- //
- // Attenuation is the attenuation in dB (a negative number).
- // To convert from dB to a linear volume scale do the following:
- // volume = MAX_VOLUME;
- // while (attenuation++ < 0)
- // volume /= 1.122018454; // = (10 ^ (1/20)) = 1dB
- //
- if (m_sound != nullptr)
- m_sound->set_mastervolume(attenuation);
+ return m_sound->stream_sink_open(node, name, rate);
+}
+
+uint32_t osd_common_t::sound_stream_source_open(uint32_t node, std::string name, uint32_t rate)
+{
+ return m_sound->stream_source_open(node, name, rate);
+}
+
+void osd_common_t::sound_stream_set_volumes(uint32_t id, const std::vector<float> &db)
+{
+ m_sound->stream_set_volumes(id, db);
+}
+
+void osd_common_t::sound_stream_close(uint32_t id)
+{
+ m_sound->stream_close(id);
}
+void osd_common_t::sound_stream_sink_update(uint32_t id, const int16_t *buffer, int samples_this_frame)
+{
+ m_sound->stream_sink_update(id, buffer, samples_this_frame);
+}
+
+void osd_common_t::sound_stream_source_update(uint32_t id, int16_t *buffer, int samples_this_frame)
+{
+ m_sound->stream_source_update(id, buffer, samples_this_frame);
+}
+
+
+
//-------------------------------------------------
// customize_input_type_list - provide OSD
diff --git a/src/osd/modules/lib/osdobj_common.h b/src/osd/modules/lib/osdobj_common.h
index 991ebacfdce..ff0d0b9a6dd 100644
--- a/src/osd/modules/lib/osdobj_common.h
+++ b/src/osd/modules/lib/osdobj_common.h
@@ -224,9 +224,17 @@ public:
virtual void wait_for_debugger(device_t &device, bool firststop) override;
// audio overridables
- virtual void update_audio_stream(const int16_t *buffer, int samples_this_frame) override;
- virtual void set_mastervolume(int attenuation) override;
virtual bool no_sound() override;
+ virtual bool sound_external_per_channel_volume() override;
+ virtual bool sound_split_streams_per_source() override;
+ virtual uint32_t sound_get_generation() override;
+ virtual osd::audio_info sound_get_information() override;
+ virtual uint32_t sound_stream_sink_open(uint32_t node, std::string name, uint32_t rate) override;
+ virtual uint32_t sound_stream_source_open(uint32_t node, std::string name, uint32_t rate) override;
+ virtual void sound_stream_set_volumes(uint32_t id, const std::vector<float> &db) override;
+ virtual void sound_stream_close(uint32_t id) override;
+ virtual void sound_stream_sink_update(uint32_t id, const int16_t *buffer, int samples_this_frame) override;
+ virtual void sound_stream_source_update(uint32_t id, int16_t *buffer, int samples_this_frame) override;
// input overridables
virtual void customize_input_type_list(std::vector<input_type_entry> &typelist) override;
diff --git a/src/osd/modules/render/aviwrite.cpp b/src/osd/modules/render/aviwrite.cpp
index e86d8f99ba6..e758d467e37 100644
--- a/src/osd/modules/render/aviwrite.cpp
+++ b/src/osd/modules/render/aviwrite.cpp
@@ -72,7 +72,7 @@ void avi_write::begin_avi_recording(std::string_view name)
info.audio_timescale = m_machine.sample_rate();
info.audio_sampletime = 1;
info.audio_numsamples = 0;
- info.audio_channels = 2;
+ info.audio_channels = m_machine.sound().outputs_count();
info.audio_samplebits = 16;
info.audio_samplerate = m_machine.sample_rate();
@@ -142,9 +142,10 @@ void avi_write::audio_frame(const int16_t *buffer, int samples_this_frame)
if (m_output_file != nullptr)
{
// write the next frame
- avi_file::error avierr = m_output_file->append_sound_samples(0, buffer + 0, samples_this_frame, 1);
- if (avierr == avi_file::error::NONE)
- avierr = m_output_file->append_sound_samples(1, buffer + 1, samples_this_frame, 1);
+ int channels = m_machine.sound().outputs_count();
+ avi_file::error avierr = avi_file::error::NONE;
+ for (int channel = 0; channel != channels && avierr == avi_file::error::NONE; channel ++)
+ avierr = m_output_file->append_sound_samples(channel, buffer + channel, samples_this_frame, channels-1);
if (avierr != avi_file::error::NONE)
{
osd_printf_error("Error while logging AVI audio frame: %s\n", avi_file::error_string(avierr));
diff --git a/src/osd/modules/sound/coreaudio_sound.cpp b/src/osd/modules/sound/coreaudio_sound.cpp
index 3e5de546bcf..7e9814af117 100644
--- a/src/osd/modules/sound/coreaudio_sound.cpp
+++ b/src/osd/modules/sound/coreaudio_sound.cpp
@@ -46,7 +46,6 @@ public:
m_playpos(0),
m_writepos(0),
m_in_underrun(false),
- m_scale(128),
m_overflows(0),
m_underflows(0)
{
@@ -60,8 +59,7 @@ public:
// sound_module
- virtual void update_audio_stream(bool is_throttled, int16_t const *buffer, int samples_this_frame) override;
- virtual void set_mastervolume(int attenuation) override;
+ virtual void stream_sink_update(uint32_t, int16_t const *buffer, int samples_this_frame) override;
private:
struct node_detail
@@ -83,14 +81,6 @@ private:
uint32_t buffer_avail() const { return ((m_writepos >= m_playpos) ? m_buffer_size : 0) + m_playpos - m_writepos; }
uint32_t buffer_used() const { return ((m_playpos > m_writepos) ? m_buffer_size : 0) + m_writepos - m_playpos; }
- void copy_scaled(void *dst, void const *src, uint32_t bytes) const
- {
- bytes /= sizeof(int16_t);
- int16_t const *s = (int16_t const *)src;
- for (int16_t *d = (int16_t *)dst; bytes > 0; bytes--, s++, d++)
- *d = (*s * m_scale) >> 7;
- }
-
bool create_graph(osd_options const &options);
bool add_output(char const *name);
bool add_device_output(char const *name);
@@ -178,7 +168,6 @@ private:
uint32_t m_playpos;
uint32_t m_writepos;
bool m_in_underrun;
- int32_t m_scale;
unsigned m_overflows;
unsigned m_underflows;
};
@@ -240,7 +229,6 @@ int sound_coreaudio::init(osd_interface &osd, const osd_options &options)
m_playpos = 0;
m_writepos = m_headroom;
m_in_underrun = false;
- m_scale = 128;
m_overflows = m_underflows = 0;
// Initialise and start
@@ -290,7 +278,7 @@ void sound_coreaudio::exit()
}
-void sound_coreaudio::update_audio_stream(bool is_throttled, int16_t const *buffer, int samples_this_frame)
+void sound_coreaudio::stream_sink_update(uint32_t, int16_t const *buffer, int samples_this_frame)
{
if ((m_sample_rate == 0) || !m_buffer)
return;
@@ -318,13 +306,6 @@ void sound_coreaudio::update_audio_stream(bool is_throttled, int16_t const *buff
}
-void sound_coreaudio::set_mastervolume(int attenuation)
-{
- int const clamped_attenuation = std::clamp(attenuation, -32, 0);
- m_scale = (-32 == clamped_attenuation) ? 0 : (int32_t)(pow(10.0, clamped_attenuation / 20.0) * 128);
-}
-
-
bool sound_coreaudio::create_graph(osd_options const &options)
{
OSStatus err;
@@ -984,7 +965,7 @@ OSStatus sound_coreaudio::render(
}
uint32_t const chunk = std::min(m_buffer_size - m_playpos, number_bytes);
- copy_scaled((int8_t *)data->mBuffers[0].mData, &m_buffer[m_playpos], chunk);
+ memcpy((int8_t *)data->mBuffers[0].mData, &m_buffer[m_playpos], chunk);
m_playpos += chunk;
if (m_playpos >= m_buffer_size)
m_playpos = 0;
@@ -993,7 +974,7 @@ OSStatus sound_coreaudio::render(
{
assert(0U == m_playpos);
assert(m_writepos >= (number_bytes - chunk));
- copy_scaled((int8_t *)data->mBuffers[0].mData + chunk, &m_buffer[0], number_bytes - chunk);
+ memcpy((int8_t *)data->mBuffers[0].mData + chunk, &m_buffer[0], number_bytes - chunk);
m_playpos += number_bytes - chunk;
}
diff --git a/src/osd/modules/sound/direct_sound.cpp b/src/osd/modules/sound/direct_sound.cpp
index 0e89bb1ac0d..7417def934c 100644
--- a/src/osd/modules/sound/direct_sound.cpp
+++ b/src/osd/modules/sound/direct_sound.cpp
@@ -120,13 +120,6 @@ public:
assert(m_buffer);
return m_buffer->Stop();
}
- HRESULT set_volume(LONG volume) const
- {
- assert(m_buffer);
- return m_buffer->SetVolume(volume);
- }
- HRESULT set_min_volume() { return set_volume(DSBVOLUME_MIN); }
-
HRESULT get_current_positions(DWORD &play_pos, DWORD &write_pos) const
{
assert(m_buffer);
@@ -225,8 +218,7 @@ public:
virtual void exit() override;
// sound_module
- virtual void update_audio_stream(bool is_throttled, int16_t const *buffer, int samples_this_frame) override;
- virtual void set_mastervolume(int attenuation) override;
+ virtual void stream_sink_update(uint32_t, int16_t const *buffer, int samples_this_frame) override;
private:
HRESULT dsound_init();
@@ -297,11 +289,11 @@ void sound_direct_sound::exit()
//============================================================
-// update_audio_stream
+// stream_sink_update
//============================================================
-void sound_direct_sound::update_audio_stream(
- bool is_throttled,
+void sound_direct_sound::stream_sink_update(
+ uint32_t,
int16_t const *buffer,
int samples_this_frame)
{
@@ -318,7 +310,7 @@ void sound_direct_sound::update_audio_stream(
if (DS_OK != result)
return;
-//DWORD orig_write = write_position;
+ //DWORD orig_write = write_position;
// normalize the write position so it is always after the play position
if (write_position < play_position)
write_position += m_stream_buffer.size();
@@ -334,7 +326,7 @@ void sound_direct_sound::update_audio_stream(
// if we're between play and write positions, then bump forward, but only in full chunks
while (stream_in < write_position)
{
-//printf("Underflow: PP=%d WP=%d(%d) SI=%d(%d) BTF=%d\n", (int)play_position, (int)write_position, (int)orig_write, (int)stream_in, (int)m_stream_buffer_in, (int)bytes_this_frame);
+ //printf("Underflow: PP=%d WP=%d(%d) SI=%d(%d) BTF=%d\n", (int)play_position, (int)write_position, (int)orig_write, (int)stream_in, (int)m_stream_buffer_in, (int)bytes_this_frame);
m_buffer_underflows++;
stream_in += bytes_this_frame;
}
@@ -342,7 +334,7 @@ void sound_direct_sound::update_audio_stream(
// if we're going to overlap the play position, just skip this chunk
if ((stream_in + bytes_this_frame) > (play_position + m_stream_buffer.size()))
{
-//printf("Overflow: PP=%d WP=%d(%d) SI=%d(%d) BTF=%d\n", (int)play_position, (int)write_position, (int)orig_write, (int)stream_in, (int)m_stream_buffer_in, (int)bytes_this_frame);
+ //printf("Overflow: PP=%d WP=%d(%d) SI=%d(%d) BTF=%d\n", (int)play_position, (int)write_position, (int)orig_write, (int)stream_in, (int)m_stream_buffer_in, (int)bytes_this_frame);
m_buffer_overflows++;
return;
}
@@ -364,26 +356,6 @@ void sound_direct_sound::update_audio_stream(
//============================================================
-// set_mastervolume
-//============================================================
-
-void sound_direct_sound::set_mastervolume(int attenuation)
-{
- // clamp the attenuation to 0-32 range
- attenuation = std::clamp(attenuation, -32, 0);
-
- // set the master volume
- if (m_stream_buffer)
- {
- if (-32 == attenuation)
- m_stream_buffer.set_min_volume();
- else
- m_stream_buffer.set_volume(100 * attenuation);
- }
-}
-
-
-//============================================================
// dsound_init
//============================================================
diff --git a/src/osd/modules/sound/js_sound.cpp b/src/osd/modules/sound/js_sound.cpp
index 7375d014141..1473ef9de2a 100644
--- a/src/osd/modules/sound/js_sound.cpp
+++ b/src/osd/modules/sound/js_sound.cpp
@@ -29,26 +29,16 @@ public:
// sound_module
- virtual void update_audio_stream(bool is_throttled, const int16_t *buffer, int samples_this_frame)
+ virtual void stream_sink_update(uint32_t, const int16_t *buffer, int samples_this_frame)
{
EM_ASM_ARGS(
{
// Forward audio stream update on to JS backend implementation.
- jsmame_update_audio_stream($0, $1);
+ jsmame_steam_update($1, $2);
},
(unsigned int)buffer,
samples_this_frame);
}
-
- virtual void set_mastervolume(int attenuation)
- {
- EM_ASM_ARGS(
- {
- // Forward volume update on to JS backend implementation.
- jsmame_set_mastervolume($0);
- },
- attenuation);
- }
};
#else // SDLMAME_EMSCRIPTEN
diff --git a/src/osd/modules/sound/js_sound.js b/src/osd/modules/sound/js_sound.js
index 571a5227f2b..25f19231ae9 100644
--- a/src/osd/modules/sound/js_sound.js
+++ b/src/osd/modules/sound/js_sound.js
@@ -98,30 +98,7 @@ function disconnect_old_event() {
eventNode = null;
};
-function set_mastervolume (
- // even though it's 'attenuation' the value is negative, so...
- attenuation_in_decibels
-) {
- lazy_init();
- if (!context) return;
-
- // http://stackoverflow.com/questions/22604500/web-audio-api-working-with-decibels
- // seemingly incorrect/broken. figures. welcome to Web Audio
- // var gain_web_audio = 1.0 - Math.pow(10, 10 / attenuation_in_decibels);
-
- // HACK: Max attenuation in JSMESS appears to be 32.
- // Hit ' then left/right arrow to test.
- // FIXME: This is linear instead of log10 scale.
- var gain_web_audio = 1.0 + (+attenuation_in_decibels / +32);
- if (gain_web_audio < +0)
- gain_web_audio = +0;
- else if (gain_web_audio > +1)
- gain_web_audio = +1;
-
- gain_node.gain.value = gain_web_audio;
-};
-
-function update_audio_stream (
+function stream_sink_update (
pBuffer, // pointer into emscripten heap. int16 samples
samples_this_frame // int. number of samples at pBuffer address.
) {
@@ -207,14 +184,12 @@ function sample_count() {
}
return {
- set_mastervolume: set_mastervolume,
- update_audio_stream: update_audio_stream,
+ stream_sink_update: stream_sink_update,
get_context: get_context,
sample_count: sample_count
};
})();
-window.jsmame_set_mastervolume = jsmame_web_audio.set_mastervolume;
-window.jsmame_update_audio_stream = jsmame_web_audio.update_audio_stream;
+window.jsmame_stream_sink_update = jsmame_web_audio.stream_sink_update;
window.jsmame_sample_count = jsmame_web_audio.sample_count;
diff --git a/src/osd/modules/sound/none.cpp b/src/osd/modules/sound/none.cpp
index ba1085f436b..bdb219636d0 100644
--- a/src/osd/modules/sound/none.cpp
+++ b/src/osd/modules/sound/none.cpp
@@ -27,11 +27,6 @@ public:
virtual int init(osd_interface &osd, const osd_options &options) override { return 0; }
virtual void exit() override { }
-
- // sound_module
-
- virtual void update_audio_stream(bool is_throttled, const int16_t *buffer, int samples_this_frame) override { }
- virtual void set_mastervolume(int attenuation) override { }
};
} // anonymous namespace
diff --git a/src/osd/modules/sound/pa_sound.cpp b/src/osd/modules/sound/pa_sound.cpp
index d5bb96a25af..68200a9c3f1 100644
--- a/src/osd/modules/sound/pa_sound.cpp
+++ b/src/osd/modules/sound/pa_sound.cpp
@@ -52,8 +52,7 @@ public:
// sound_module
- virtual void update_audio_stream(bool is_throttled, const s16 *buffer, int samples_this_frame) override;
- virtual void set_mastervolume(int attenuation) override;
+ virtual void stream_sink_update(uint32_t, const s16 *buffer, int samples_this_frame) override;
private:
// Lock free SPSC ring buffer
@@ -80,14 +79,14 @@ private:
writepos.store((writepos + n) % size);
}
- int write(const T* src, int n, int attenuation) {
+ int write(const T* src, int n) {
n = std::min<int>(n, size - reserve - count());
if (writepos + n > size) {
- att_memcpy(buf + writepos, src, sizeof(T) * (size - writepos), attenuation);
- att_memcpy(buf, src + (size - writepos), sizeof(T) * (n - (size - writepos)), attenuation);
+ memcpy(buf + writepos, src, sizeof(T) * (size - writepos));
+ memcpy(buf, src + (size - writepos), sizeof(T) * (n - (size - writepos)));
} else {
- att_memcpy(buf + writepos, src, sizeof(T) * n, attenuation);
+ memcpy(buf + writepos, src, sizeof(T) * n);
}
increment_writepos(n);
@@ -128,13 +127,6 @@ private:
return n;
}
-
- void att_memcpy(T* dest, const T* data, int n, int attenuation) {
- int level = powf(10.0, attenuation / 20.0) * 32768;
- n /= sizeof(T);
- while (n--)
- *dest++ = (*data++ * level) >> 15;
- }
};
enum
@@ -159,7 +151,6 @@ private:
int m_sample_rate;
int m_audio_latency;
- int m_attenuation;
audio_buffer<s16>* m_ab;
@@ -193,7 +184,6 @@ int sound_pa::init(osd_interface &osd, osd_options const &options)
unsigned long frames_per_callback = paFramesPerBufferUnspecified;
double callback_interval;
- m_attenuation = options.volume();
m_underflows = 0;
m_overflows = 0;
m_has_overflowed = false;
@@ -389,7 +379,7 @@ int sound_pa::callback(s16* output_buffer, size_t number_of_samples)
m_ab->read(output_buffer, buf_ct);
std::memset(output_buffer + buf_ct, 0, (number_of_samples - buf_ct) * sizeof(s16));
- // if update_audio_stream has been called, note the underflow
+ // if stream_sink_update has been called, note the underflow
if (m_osd_ticks)
m_has_underflowed = true;
@@ -399,7 +389,7 @@ int sound_pa::callback(s16* output_buffer, size_t number_of_samples)
return paContinue;
}
-void sound_pa::update_audio_stream(bool is_throttled, const s16 *buffer, int samples_this_frame)
+void sound_pa::stream_sink_update(uint32_t, const s16 *buffer, int samples_this_frame)
{
if (!m_sample_rate)
return;
@@ -423,17 +413,12 @@ void sound_pa::update_audio_stream(bool is_throttled, const s16 *buffer, int sam
m_has_overflowed = false;
}
- m_ab->write(buffer, samples_this_frame * 2, m_attenuation);
+ m_ab->write(buffer, samples_this_frame * 2);
// for determining buffer overflows, take the sample here instead of in the callback
m_osd_ticks = osd_ticks();
}
-void sound_pa::set_mastervolume(int attenuation)
-{
- m_attenuation = attenuation;
-}
-
void sound_pa::exit()
{
if (!m_sample_rate)
diff --git a/src/osd/modules/sound/pipewire_sound.cpp b/src/osd/modules/sound/pipewire_sound.cpp
new file mode 100644
index 00000000000..8bf5b8e0afa
--- /dev/null
+++ b/src/osd/modules/sound/pipewire_sound.cpp
@@ -0,0 +1,823 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+/***************************************************************************
+
+ piepewire_sound.c
+
+ PipeWire interface.
+
+***************************************************************************/
+
+#include "sound_module.h"
+#include "modules/osdmodule.h"
+
+#ifndef NO_USE_PIPEWIRE
+
+#define GNU_SOURCE
+#include "modules/lib/osdobj_common.h"
+
+#include <pipewire/pipewire.h>
+#include <pipewire/extensions/metadata.h>
+#include <spa/debug/pod.h>
+#include <spa/debug/dict.h>
+#include <spa/pod/builder.h>
+#include <spa/param/audio/raw-utils.h>
+#include <rapidjson/document.h>
+
+#include <map>
+
+class sound_pipewire : public osd_module, public sound_module
+{
+public:
+ sound_pipewire()
+ : osd_module(OSD_SOUND_PROVIDER, "pipewire"), sound_module()
+ {
+ }
+ virtual ~sound_pipewire() { }
+
+ virtual int init(osd_interface &osd, osd_options const &options) override;
+ virtual void exit() override;
+
+ virtual bool external_per_channel_volume() override { return true; }
+ virtual bool split_streams_per_source() override { return true; }
+
+ virtual uint32_t get_generation() override;
+ virtual osd::audio_info get_information() override;
+ virtual uint32_t stream_sink_open(uint32_t node, std::string name, uint32_t rate) override;
+ virtual uint32_t stream_source_open(uint32_t node, std::string name, uint32_t rate) override;
+ virtual void stream_set_volumes(uint32_t id, const std::vector<float> &db) override;
+ virtual void stream_close(uint32_t id) override;
+ virtual void stream_sink_update(uint32_t id, const int16_t *buffer, int samples_this_frame) override;
+ virtual void stream_source_update(uint32_t id, int16_t *buffer, int samples_this_frame) override;
+
+private:
+ struct position_info {
+ uint32_t m_position;
+ std::array<double, 3> m_coords;
+ };
+
+ static const position_info position_infos[];
+
+ static const char *const typenames[];
+ enum { AREC, APLAY };
+
+ struct node_info {
+ sound_pipewire *m_wire;
+ uint32_t m_id, m_osdid;
+ int m_type;
+ std::string m_serial;
+ std::string m_name;
+ std::string m_text_id;
+
+ // Audio node info
+ uint32_t m_sinks, m_sources;
+ std::vector<uint32_t> m_position_codes;
+ std::vector<std::string> m_port_names;
+ std::vector<std::array<double, 3>> m_positions;
+
+ osd::audio_rate_range m_rate;
+ bool m_has_s16;
+ bool m_has_iec958;
+
+ pw_node *m_node;
+ spa_hook m_node_listener;
+
+ node_info(sound_pipewire *wire, uint32_t id, uint32_t osdid, int type, std::string serial, std::string name, std::string text_id) : m_wire(wire), m_id(id), m_osdid(osdid), m_type(type), m_serial(serial), m_name(name), m_text_id(text_id), m_sinks(0), m_sources(0), m_rate{0, 0, 0}, m_has_s16(false), m_has_iec958(false), m_node(nullptr) {
+ spa_zero(m_node_listener);
+ }
+ };
+
+ struct stream_info {
+ sound_pipewire *m_wire;
+ bool m_is_output;
+ uint32_t m_osdid;
+ uint32_t m_node_id;
+ node_info *m_node;
+ uint32_t m_channels;
+ pw_stream *m_stream;
+ std::vector<float> m_volumes;
+ abuffer m_buffer;
+
+ stream_info(sound_pipewire *wire, bool is_output, uint32_t osdid, uint32_t channels) : m_wire(wire), m_is_output(is_output), m_osdid(osdid), m_channels(channels), m_stream(nullptr), m_buffer(channels) {}
+ };
+
+ static const pw_core_events core_events;
+ static const pw_registry_events registry_events;
+ static const pw_node_events node_events;
+ static const pw_metadata_events default_events;
+ static const pw_stream_events stream_sink_events;
+ static const pw_stream_events stream_source_events;
+
+ std::map<uint32_t, node_info> m_nodes;
+ std::map<uint32_t, uint32_t> m_node_osdid_to_id;
+
+ std::map<uint32_t, stream_info> m_streams;
+
+ pw_thread_loop *m_loop;
+ pw_context *m_context;
+ pw_core *m_core;
+ spa_hook m_core_listener;
+ pw_registry *m_registry;
+ spa_hook m_registry_listener;
+ pw_metadata *m_default;
+ spa_hook m_default_listener;
+
+ std::string m_default_audio_sink;
+ std::string m_default_audio_source;
+
+ uint32_t m_node_current_id, m_stream_current_id;
+ uint32_t m_generation;
+ bool m_wait_sync, m_wait_stream;
+
+ void sync();
+
+ void core_event_done(uint32_t id, int seq);
+ static void s_core_event_done(void *data, uint32_t id, int seq);
+
+ void register_node(uint32_t id, const spa_dict *props);
+ void register_port(uint32_t id, const spa_dict *props);
+ void register_link(uint32_t id, const spa_dict *props);
+ void register_default_metadata(uint32_t id);
+ void register_metadata(uint32_t id, const spa_dict *props);
+ void registry_event_global(uint32_t id, uint32_t permissions, const char *type, uint32_t version, const spa_dict *props);
+ static void s_registry_event_global(void *data, uint32_t id, uint32_t permissions, const char *type, uint32_t version, const spa_dict *props);
+
+ void registry_event_global_remove(uint32_t id);
+ static void s_registry_event_global_remove(void *data, uint32_t id);
+
+ void node_event_param(node_info *node, int seq, uint32_t id, uint32_t index, uint32_t next, const spa_pod *param);
+ static void s_node_event_param(void *data, int seq, uint32_t id, uint32_t index, uint32_t next, const spa_pod *param);
+
+ int default_event_property(uint32_t subject, const char *key, const char *type, const char *value);
+ static int s_default_event_property(void *data, uint32_t subject, const char *key, const char *type, const char *value);
+
+ void stream_sink_event_process(stream_info *stream);
+ static void s_stream_sink_event_process(void *data);
+
+ void stream_source_event_process(stream_info *stream);
+ static void s_stream_source_event_process(void *data);
+
+ void stream_event_param_changed(stream_info *stream, uint32_t id, const spa_pod *param);
+ static void s_stream_event_param_changed(void *data, uint32_t id, const spa_pod *param);
+};
+
+// Try to more or less map to speaker.h positions
+
+const sound_pipewire::position_info sound_pipewire::position_infos[] = {
+ { SPA_AUDIO_CHANNEL_MONO, { 0.0, 0.0, 1.0 } },
+ { SPA_AUDIO_CHANNEL_FL, { -0.2, 0.0, 1.0 } },
+ { SPA_AUDIO_CHANNEL_FR, { 0.2, 0.0, 1.0 } },
+ { SPA_AUDIO_CHANNEL_FC, { 0.0, 0.0, 1.0 } },
+ { SPA_AUDIO_CHANNEL_LFE, { 0.0, -0.5, 1.0 } },
+ { SPA_AUDIO_CHANNEL_RL, { -0.2, 0.0, -0.5 } },
+ { SPA_AUDIO_CHANNEL_RR, { 0.2, 0.0, -0.5 } },
+ { SPA_AUDIO_CHANNEL_RC, { 0.0, 0.0, -0.5 } },
+ { SPA_AUDIO_CHANNEL_UNKNOWN, { 0.0, 0.0, 0.0 } }
+};
+
+
+const char *const sound_pipewire::typenames[] = {
+ "Audio recorder", "Speaker"
+};
+
+const pw_core_events sound_pipewire::core_events = {
+ PW_VERSION_CORE_EVENTS,
+ nullptr, // info
+ s_core_event_done,
+ nullptr, // ping
+ nullptr, // error
+ nullptr, // remove_id
+ nullptr, // bound_id
+ nullptr, // add_mem
+ nullptr, // remove_mem
+ nullptr // bound_props
+};
+
+const pw_registry_events sound_pipewire::registry_events = {
+ PW_VERSION_REGISTRY_EVENTS,
+ s_registry_event_global,
+ s_registry_event_global_remove
+};
+
+const pw_node_events sound_pipewire::node_events = {
+ PW_VERSION_NODE_EVENTS,
+ nullptr, // info
+ s_node_event_param
+};
+
+const pw_metadata_events sound_pipewire::default_events = {
+ PW_VERSION_METADATA_EVENTS,
+ s_default_event_property
+};
+
+const pw_stream_events sound_pipewire::stream_sink_events = {
+ PW_VERSION_STREAM_EVENTS,
+ nullptr, // destroy
+ nullptr, // state changed
+ nullptr, // control info
+ nullptr, // io changed
+ s_stream_event_param_changed,
+ nullptr, // add buffer
+ nullptr, // remove buffer
+ s_stream_sink_event_process,
+ nullptr, // drained
+ nullptr, // command
+ nullptr // trigger done
+};
+
+const pw_stream_events sound_pipewire::stream_source_events = {
+ PW_VERSION_STREAM_EVENTS,
+ nullptr, // destroy
+ nullptr, // state changed
+ nullptr, // control info
+ nullptr, // io changed
+ s_stream_event_param_changed,
+ nullptr, // add buffer
+ nullptr, // remove buffer
+ s_stream_source_event_process,
+ nullptr, // drained
+ nullptr, // command
+ nullptr // trigger done
+};
+
+void sound_pipewire::register_node(uint32_t id, const spa_dict *props)
+{
+ const spa_dict_item *cls = spa_dict_lookup_item(props, PW_KEY_MEDIA_CLASS);
+ const spa_dict_item *desc = spa_dict_lookup_item(props, PW_KEY_NODE_DESCRIPTION);
+ const spa_dict_item *name = spa_dict_lookup_item(props, PW_KEY_NODE_NAME);
+ const spa_dict_item *serial = spa_dict_lookup_item(props, PW_KEY_OBJECT_SERIAL);
+ if(!cls)
+ return;
+ int type;
+ if(!strcmp(cls->value, "Audio/Source"))
+ type = AREC;
+ else if(!strcmp(cls->value, "Audio/Sink"))
+ type = APLAY;
+ else
+ return;
+
+ m_node_osdid_to_id[m_node_current_id] = id;
+ auto &node = m_nodes.emplace(id, node_info(this, id, m_node_current_id++, type, serial->value, desc ? desc->value : "?", name ? name->value : "?")).first->second;
+
+ // printf("node %03x: %s %s %s | %s\n", node.m_id, serial->value, typenames[node.m_type], node.m_name.c_str(), node.m_text_id.c_str());
+
+ node.m_node = (pw_node *)pw_registry_bind(m_registry, id, PW_TYPE_INTERFACE_Node, PW_VERSION_NODE, 0);
+ pw_node_add_listener(node.m_node, &node.m_node_listener, &node_events, &node);
+ pw_node_enum_params(node.m_node, 0, 3, 0, 0xffffffff, nullptr);
+ m_generation++;
+}
+
+void sound_pipewire::register_port(uint32_t id, const spa_dict *props)
+{
+ uint32_t node = strtol(spa_dict_lookup_item(props, PW_KEY_NODE_ID)->value, nullptr, 10);
+ auto ind = m_nodes.find(node);
+ if(ind == m_nodes.end())
+ return;
+
+ const spa_dict_item *channel = spa_dict_lookup_item(props, PW_KEY_AUDIO_CHANNEL);
+ const spa_dict_item *dir = spa_dict_lookup_item(props, PW_KEY_PORT_DIRECTION);
+ bool is_in = dir && !strcmp(dir->value, "in") ;
+ uint32_t index = strtol(spa_dict_lookup_item(props, PW_KEY_PORT_ID)->value, nullptr, 10);
+
+ if(is_in && ind->second.m_sinks <= index)
+ ind->second.m_sinks = index+1;
+ if(!is_in && ind->second.m_sources <= index)
+ ind->second.m_sources = index+1;
+
+ auto &port_names = ind->second.m_port_names;
+ if(port_names.size() <= index)
+ port_names.resize(index+1);
+
+ if(is_in || port_names[index].empty())
+ port_names[index] = channel ? channel->value : "?";
+
+ m_generation++;
+ // printf("port %03x.%d %03x: %s\n", node, index, id, port_names[index].c_str());
+}
+
+void sound_pipewire::register_link(uint32_t id, const spa_dict *props)
+{
+ const spa_dict_item *input = spa_dict_lookup_item(props, PW_KEY_LINK_INPUT_NODE);
+ const spa_dict_item *output = spa_dict_lookup_item(props, PW_KEY_LINK_OUTPUT_NODE);
+ if(!input || !output)
+ return;
+
+ uint32_t input_id = strtol(input->value, nullptr, 10);
+ uint32_t output_id = strtol(output->value, nullptr, 10);
+
+ for(auto &si : m_streams) {
+ stream_info &stream = si.second;
+ if(stream.m_is_output && stream.m_node_id == output_id && (stream.m_node && stream.m_node->m_id != input_id)) {
+ auto ni = m_nodes.find(input_id);
+ if(ni != m_nodes.end()) {
+ stream.m_node = &ni->second;
+ m_generation ++;
+ return;
+ }
+ }
+ if(!stream.m_is_output && stream.m_node_id == input_id && (stream.m_node && stream.m_node->m_id != output_id)) {
+ auto ni = m_nodes.find(output_id);
+ if(ni != m_nodes.end()) {
+ stream.m_node = &ni->second;
+ m_generation ++;
+ return;
+ }
+ }
+ }
+}
+
+void sound_pipewire::register_default_metadata(uint32_t id)
+{
+ m_default = (pw_metadata *)pw_registry_bind(m_registry, id, PW_TYPE_INTERFACE_Metadata, PW_VERSION_METADATA, 0);
+ pw_metadata_add_listener(m_default, &m_default_listener, &default_events, this);
+}
+
+void sound_pipewire::register_metadata(uint32_t id, const spa_dict *props)
+{
+ const spa_dict_item *mn = spa_dict_lookup_item(props, PW_KEY_METADATA_NAME);
+ if(mn && !strcmp(mn->value, "default"))
+ register_default_metadata(id);
+}
+
+void sound_pipewire::registry_event_global(uint32_t id,
+ uint32_t permissions, const char *type, uint32_t version,
+ const spa_dict *props)
+{
+ if(!strcmp(type, PW_TYPE_INTERFACE_Node))
+ register_node(id, props);
+ else if(!strcmp(type, PW_TYPE_INTERFACE_Port))
+ register_port(id, props);
+ else if(!strcmp(type, PW_TYPE_INTERFACE_Metadata))
+ register_metadata(id, props);
+ else if(!strcmp(type, PW_TYPE_INTERFACE_Link))
+ register_link(id, props);
+ else {
+ // printf("type %03x %s\n", id, type);
+ }
+}
+
+void sound_pipewire::s_registry_event_global(void *data, uint32_t id,
+ uint32_t permissions, const char *type, uint32_t version,
+ const spa_dict *props)
+{
+ ((sound_pipewire *)data)->registry_event_global(id, permissions, type, version, props);
+}
+
+void sound_pipewire::registry_event_global_remove(uint32_t id)
+{
+ auto ind = m_nodes.find(id);
+ if(ind == m_nodes.end())
+ return;
+
+ for(auto &istream : m_streams)
+ if(istream.second.m_node == &ind->second)
+ istream.second.m_node = nullptr;
+ m_nodes.erase(ind);
+ m_generation++;
+}
+
+void sound_pipewire::s_registry_event_global_remove(void *data, uint32_t id)
+{
+ ((sound_pipewire *)data)->registry_event_global_remove(id);
+}
+
+void sound_pipewire::node_event_param(node_info *node, int seq, uint32_t id, uint32_t index, uint32_t next, const spa_pod *param)
+{
+ if(id == SPA_PARAM_EnumFormat) {
+ const spa_pod_prop *subtype = spa_pod_find_prop(param, nullptr, SPA_FORMAT_mediaSubtype);
+ if(subtype) {
+ uint32_t sval;
+ if(!spa_pod_get_id(&subtype->value, &sval)) {
+ if(sval == SPA_MEDIA_SUBTYPE_raw) {
+ const spa_pod_prop *format = spa_pod_find_prop(param, nullptr, SPA_FORMAT_AUDIO_format);
+ const spa_pod_prop *rate = spa_pod_find_prop(param, nullptr, SPA_FORMAT_AUDIO_rate);
+ const spa_pod_prop *position = spa_pod_find_prop(param, nullptr, SPA_FORMAT_AUDIO_position);
+
+ if(format) {
+ uint32_t *entry;
+ SPA_POD_CHOICE_FOREACH((spa_pod_choice *)(&format->value), entry) {
+ if(*entry == SPA_AUDIO_FORMAT_S16)
+ node->m_has_s16 = true;
+ }
+ }
+ if(rate) {
+ if(rate->value.type == SPA_TYPE_Choice) {
+ struct spa_pod_choice_body *b = &((spa_pod_choice *)(&rate->value))->body;
+ uint32_t *choices = (uint32_t *)(b+1);
+ node->m_rate.m_default_rate = choices[0];
+ if(b->type == SPA_CHOICE_Range) {
+ node->m_rate.m_min_rate = choices[1];
+ node->m_rate.m_max_rate = choices[2];
+ } else {
+ node->m_rate.m_min_rate = node->m_rate.m_default_rate;
+ node->m_rate.m_max_rate = node->m_rate.m_default_rate;
+ }
+ }
+ }
+
+ if(position) {
+ uint32_t *entry;
+ node->m_position_codes.clear();
+ node->m_positions.clear();
+ SPA_POD_ARRAY_FOREACH((spa_pod_array *)(&position->value), entry) {
+ node->m_position_codes.push_back(*entry);
+ for(uint32_t i = 0;; i++) {
+ if((position_infos[i].m_position == *entry) || (position_infos[i].m_position == SPA_AUDIO_CHANNEL_UNKNOWN)) {
+ node->m_positions.push_back(position_infos[i].m_coords);
+ break;
+ }
+ }
+ }
+ }
+ } else if(sval == SPA_MEDIA_SUBTYPE_iec958)
+ node->m_has_iec958 = true;
+ }
+ }
+ m_generation++;
+
+ } else
+ spa_debug_pod(2, nullptr, param);
+}
+
+void sound_pipewire::s_node_event_param(void *data, int seq, uint32_t id, uint32_t index, uint32_t next, const spa_pod *param)
+{
+ node_info *n = (node_info *)data;
+ n->m_wire->node_event_param(n, seq, id, index, next, param);
+}
+
+int sound_pipewire::default_event_property(uint32_t subject, const char *key, const char *type, const char *value)
+{
+ if(!value)
+ return 0;
+ std::string val = value;
+ if(!strcmp(type, "Spa:String:JSON")) {
+ rapidjson::Document json;
+ json.Parse(value);
+ if(json.IsObject() && json.HasMember("name") && json["name"].IsString())
+ val = json["name"].GetString();
+ } else
+ val = value;
+
+ if(!strcmp(key, "default.audio.sink"))
+ m_default_audio_sink = val;
+
+ else if(!strcmp(key, "default.audio.source"))
+ m_default_audio_source = val;
+
+ return 0;
+}
+
+int sound_pipewire::s_default_event_property(void *data, uint32_t subject, const char *key, const char *type, const char *value)
+{
+ return ((sound_pipewire *)data)->default_event_property(subject, key, type, value);
+}
+
+int sound_pipewire::init(osd_interface &osd, osd_options const &options)
+{
+ spa_zero(m_core_listener);
+ spa_zero(m_registry_listener);
+ spa_zero(m_default_listener);
+
+ m_node_current_id = 1;
+ m_stream_current_id = 1;
+ m_generation = 1;
+
+ m_wait_sync = false;
+ m_wait_stream = false;
+
+ pw_init(nullptr, nullptr);
+ m_loop = pw_thread_loop_new(nullptr, nullptr);
+ m_context = pw_context_new(pw_thread_loop_get_loop(m_loop), nullptr, 0);
+ m_core = pw_context_connect(m_context, nullptr, 0);
+
+ if(!m_core)
+ return 1;
+
+ pw_core_add_listener(m_core, &m_core_listener, &core_events, this);
+
+ m_registry = pw_core_get_registry(m_core, PW_VERSION_REGISTRY, 0);
+ pw_registry_add_listener(m_registry, &m_registry_listener, &registry_events, this);
+
+ pw_thread_loop_start(m_loop);
+
+ // The first sync ensures that the initial information request is
+ // completed, the second that the subsequent ones (parameters
+ // retrieval) are completed too.
+ sync();
+ sync();
+
+ return 0;
+}
+
+void sound_pipewire::core_event_done(uint32_t id, int seq)
+{
+ m_wait_sync = false;
+ pw_thread_loop_signal(m_loop, false);
+}
+
+void sound_pipewire::s_core_event_done(void *data, uint32_t id, int seq)
+{
+ ((sound_pipewire *)data)->core_event_done(id, seq);
+}
+
+void sound_pipewire::sync()
+{
+ pw_thread_loop_lock(m_loop);
+ m_wait_sync = true;
+ pw_core_sync(m_core, PW_ID_CORE, 0);
+ while(m_wait_sync)
+ pw_thread_loop_wait(m_loop);
+ pw_thread_loop_unlock(m_loop);
+}
+
+void sound_pipewire::exit()
+{
+ pw_thread_loop_stop(m_loop);
+ for(const auto &si : m_streams)
+ pw_stream_destroy(si.second.m_stream);
+ for(const auto &ni : m_nodes)
+ pw_proxy_destroy((pw_proxy *)ni.second.m_node);
+ pw_proxy_destroy((pw_proxy *)m_default);
+ pw_proxy_destroy((pw_proxy *)m_registry);
+ pw_core_disconnect(m_core);
+ pw_context_destroy(m_context);
+ pw_thread_loop_destroy(m_loop);
+ pw_deinit();
+}
+
+uint32_t sound_pipewire::get_generation()
+{
+ pw_thread_loop_lock(m_loop);
+ uint32_t result = m_generation;
+ pw_thread_loop_unlock(m_loop);
+ return result;
+}
+
+osd::audio_info sound_pipewire::get_information()
+{
+ osd::audio_info result;
+ pw_thread_loop_lock(m_loop);
+ result.m_nodes.resize(m_nodes.size());
+ result.m_default_sink = 0;
+ result.m_default_source = 0;
+ result.m_generation = m_generation;
+ uint32_t node = 0;
+ for(auto &inode : m_nodes) {
+ result.m_nodes[node].m_name = inode.second.m_name;
+ result.m_nodes[node].m_id = inode.second.m_osdid;
+ result.m_nodes[node].m_rate = inode.second.m_rate;
+ result.m_nodes[node].m_sinks = inode.second.m_sinks;
+ result.m_nodes[node].m_sources = inode.second.m_sources;
+ result.m_nodes[node].m_port_names = inode.second.m_port_names;
+ result.m_nodes[node].m_port_positions = inode.second.m_positions;
+
+ if(inode.second.m_text_id == m_default_audio_sink)
+ result.m_default_sink = inode.second.m_osdid;
+ if(inode.second.m_text_id == m_default_audio_source)
+ result.m_default_source = inode.second.m_osdid;
+ node ++;
+ }
+
+ for(auto &istream : m_streams)
+ if(istream.second.m_node)
+ result.m_streams.emplace_back(osd::audio_info::stream_info { istream.second.m_osdid, istream.second.m_node->m_osdid, istream.second.m_volumes });
+
+ pw_thread_loop_unlock(m_loop);
+ return result;
+}
+
+void sound_pipewire::stream_sink_event_process(stream_info *stream)
+{
+ pw_buffer *buffer = pw_stream_dequeue_buffer(stream->m_stream);
+ if(!buffer)
+ return;
+
+ spa_buffer *sbuf = buffer->buffer;
+ stream->m_buffer.get((int16_t *)(sbuf->datas[0].data), buffer->requested);
+
+ sbuf->datas[0].chunk->offset = 0;
+ sbuf->datas[0].chunk->stride = stream->m_channels * 2;
+ sbuf->datas[0].chunk->size = buffer->requested * stream->m_channels * 2;
+
+ pw_stream_queue_buffer(stream->m_stream, buffer);
+}
+
+void sound_pipewire::s_stream_sink_event_process(void *data)
+{
+ stream_info *info = (stream_info *)(data);
+ info->m_wire->stream_sink_event_process(info);
+}
+
+void sound_pipewire::stream_source_event_process(stream_info *stream)
+{
+ pw_buffer *buffer = pw_stream_dequeue_buffer(stream->m_stream);
+ if(!buffer)
+ return;
+
+ spa_buffer *sbuf = buffer->buffer;
+ stream->m_buffer.push((int16_t *)(sbuf->datas[0].data), sbuf->datas[0].chunk->size / stream->m_channels / 2);
+ pw_stream_queue_buffer(stream->m_stream, buffer);
+}
+
+void sound_pipewire::s_stream_source_event_process(void *data)
+{
+ stream_info *info = (stream_info *)(data);
+ info->m_wire->stream_source_event_process(info);
+}
+
+void sound_pipewire::stream_event_param_changed(stream_info *stream, uint32_t id, const spa_pod *param)
+{
+ if(id == SPA_PARAM_Props) {
+ const spa_pod_prop *vols = spa_pod_find_prop(param, nullptr, SPA_PROP_channelVolumes);
+ if(vols) {
+ bool initial = stream->m_volumes.empty();
+ stream->m_volumes.clear();
+ float *entry;
+ SPA_POD_ARRAY_FOREACH((spa_pod_array *)(&vols->value), entry) {
+ stream->m_volumes.push_back(osd::linear_to_db(*entry));
+ }
+ if(!stream->m_volumes.empty()) {
+ if(initial) {
+ m_wait_stream = false;
+ pw_thread_loop_signal(m_loop, false);
+ } else
+ m_generation++;
+ }
+ }
+ }
+}
+
+void sound_pipewire::s_stream_event_param_changed(void *data, uint32_t id, const spa_pod *param)
+{
+ stream_info *info = (stream_info *)(data);
+ info->m_wire->stream_event_param_changed(info, id, param);
+}
+
+uint32_t sound_pipewire::stream_sink_open(uint32_t node, std::string name, uint32_t rate)
+{
+ pw_thread_loop_lock(m_loop);
+ auto ni = m_node_osdid_to_id.find(node);
+ if(ni == m_node_osdid_to_id.end()) {
+ pw_thread_loop_unlock(m_loop);
+ return 0;
+ }
+ node_info &snode = m_nodes.find(ni->second)->second;
+
+ uint32_t id = m_stream_current_id++;
+ auto &stream = m_streams.emplace(id, stream_info(this, true, id, snode.m_sinks)).first->second;
+
+ stream.m_stream = pw_stream_new_simple(pw_thread_loop_get_loop(m_loop),
+ name.c_str(),
+ pw_properties_new(PW_KEY_MEDIA_TYPE, "Audio",
+ PW_KEY_MEDIA_CATEGORY, "Playback",
+ PW_KEY_MEDIA_ROLE, "Game",
+ PW_KEY_TARGET_OBJECT, snode.m_serial.c_str(),
+ nullptr),
+ &stream_sink_events,
+ &stream);
+ stream.m_node = &snode;
+
+ const spa_pod *params;
+ spa_audio_info_raw format = {
+ SPA_AUDIO_FORMAT_S16,
+ 0,
+ rate,
+ stream.m_channels
+ };
+ for(uint32_t i=0; i != snode.m_sinks; i++)
+ format.position[i] = snode.m_position_codes[i];
+
+ uint8_t buffer[1024];
+ spa_pod_builder b = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
+ params = spa_format_audio_raw_build(&b, SPA_PARAM_EnumFormat, &format);
+
+ pw_stream_connect(stream.m_stream,
+ PW_DIRECTION_OUTPUT,
+ PW_ID_ANY,
+ pw_stream_flags(PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_MAP_BUFFERS | PW_STREAM_FLAG_RT_PROCESS),
+ &params, 1);
+
+ m_wait_stream = true;
+ while(m_wait_stream)
+ pw_thread_loop_wait(m_loop);
+
+ stream.m_node_id = pw_stream_get_node_id(stream.m_stream);
+ pw_thread_loop_unlock(m_loop);
+
+ return id;
+}
+
+uint32_t sound_pipewire::stream_source_open(uint32_t node, std::string name, uint32_t rate)
+{
+ pw_thread_loop_lock(m_loop);
+ auto ni = m_node_osdid_to_id.find(node);
+ if(ni == m_node_osdid_to_id.end()) {
+ pw_thread_loop_unlock(m_loop);
+ return 0;
+ }
+ node_info &snode = m_nodes.find(ni->second)->second;
+
+ uint32_t id = m_stream_current_id++;
+ auto &stream = m_streams.emplace(id, stream_info(this, false, id, snode.m_sources)).first->second;
+
+ stream.m_stream = pw_stream_new_simple(pw_thread_loop_get_loop(m_loop),
+ name.c_str(),
+ pw_properties_new(PW_KEY_MEDIA_TYPE, "Audio",
+ PW_KEY_MEDIA_CATEGORY, "Record",
+ PW_KEY_MEDIA_ROLE, "Game",
+ PW_KEY_TARGET_OBJECT, snode.m_serial.c_str(),
+ nullptr),
+ &stream_source_events,
+ &stream);
+ stream.m_node = &snode;
+
+ const spa_pod *params;
+ spa_audio_info_raw format = {
+ SPA_AUDIO_FORMAT_S16,
+ 0,
+ rate,
+ stream.m_channels
+ };
+ for(uint32_t i=0; i != snode.m_sources; i++)
+ format.position[i] = snode.m_position_codes[i];
+
+ uint8_t buffer[1024];
+ spa_pod_builder b = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
+ params = spa_format_audio_raw_build(&b, SPA_PARAM_EnumFormat, &format);
+
+ pw_stream_connect(stream.m_stream,
+ PW_DIRECTION_INPUT,
+ PW_ID_ANY,
+ pw_stream_flags(PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_MAP_BUFFERS | PW_STREAM_FLAG_RT_PROCESS),
+ &params, 1);
+
+ m_wait_stream = true;
+ while(m_wait_stream)
+ pw_thread_loop_wait(m_loop);
+
+ stream.m_node_id = pw_stream_get_node_id(stream.m_stream);
+ pw_thread_loop_unlock(m_loop);
+
+ return id;
+}
+
+void sound_pipewire::stream_set_volumes(uint32_t id, const std::vector<float> &db)
+{
+ pw_thread_loop_lock(m_loop);
+ auto si = m_streams.find(id);
+ if(si == m_streams.end()) {
+ pw_thread_loop_unlock(m_loop);
+ return;
+ }
+ stream_info &stream = si->second;
+ stream.m_volumes = db;
+ std::vector<float> linear;
+ for(float db1 : db)
+ linear.push_back(osd::db_to_linear(db1));
+ pw_stream_set_control(stream.m_stream, SPA_PROP_channelVolumes, linear.size(), linear.data(), 0);
+ pw_thread_loop_unlock(m_loop);
+}
+
+void sound_pipewire::stream_close(uint32_t id)
+{
+ pw_thread_loop_lock(m_loop);
+ auto si = m_streams.find(id);
+ if(si == m_streams.end()) {
+ pw_thread_loop_unlock(m_loop);
+ return;
+ }
+ stream_info &stream = si->second;
+ pw_stream_destroy(stream.m_stream);
+ m_streams.erase(si);
+ pw_thread_loop_unlock(m_loop);
+}
+
+void sound_pipewire::stream_sink_update(uint32_t id, const int16_t *buffer, int samples_this_frame)
+{
+ pw_thread_loop_lock(m_loop);
+ auto si = m_streams.find(id);
+ if(si == m_streams.end()) {
+ pw_thread_loop_unlock(m_loop);
+ return;
+ }
+ si->second.m_buffer.push(buffer, samples_this_frame);
+ pw_thread_loop_unlock(m_loop);
+}
+
+void sound_pipewire::stream_source_update(uint32_t id, int16_t *buffer, int samples_this_frame)
+{
+ pw_thread_loop_lock(m_loop);
+ auto si = m_streams.find(id);
+ if(si == m_streams.end()) {
+ pw_thread_loop_unlock(m_loop);
+ return;
+ }
+ si->second.m_buffer.get(buffer, samples_this_frame);
+ pw_thread_loop_unlock(m_loop);
+}
+
+#else
+ MODULE_NOT_SUPPORTED(sound_pipewire, OSD_SOUND_PROVIDER, "pipewire")
+#endif
+
+MODULE_DEFINITION(SOUND_PIPEWIRE, sound_pipewire)
diff --git a/src/osd/modules/sound/pulse_sound.cpp b/src/osd/modules/sound/pulse_sound.cpp
index 373913f9f91..4b7c87b6b9b 100644
--- a/src/osd/modules/sound/pulse_sound.cpp
+++ b/src/osd/modules/sound/pulse_sound.cpp
@@ -14,21 +14,12 @@
#ifndef NO_USE_PULSEAUDIO
#define GNU_SOURCE
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <poll.h>
-
-#include <mutex>
-#include <thread>
+
#include <pulse/pulseaudio.h>
+#include <map>
#include "modules/lib/osdobj_common.h"
-using osd::s16;
-using osd::u32;
-
class sound_pulse : public osd_module, public sound_module
{
public:
@@ -40,52 +31,113 @@ public:
virtual int init(osd_interface &osd, osd_options const &options) override;
virtual void exit() override;
- virtual void update_audio_stream(bool is_throttled, const s16 *buffer, int samples_this_frame) override;
- virtual void set_mastervolume(int attenuation) override;
+
+ virtual bool external_per_channel_volume() override { return false; }
+ virtual bool split_streams_per_source() override { return true; }
+
+ virtual uint32_t get_generation() override;
+ virtual osd::audio_info get_information() override;
+ virtual uint32_t stream_sink_open(uint32_t node, std::string name, uint32_t rate) override;
+ virtual void stream_set_volumes(uint32_t id, const std::vector<float> &db) override;
+ virtual void stream_close(uint32_t id) override;
+ virtual void stream_sink_update(uint32_t, const int16_t *buffer, int samples_this_frame) override;
private:
- struct abuffer {
- size_t cpos;
- std::vector<u32> data;
+ struct position_info {
+ pa_channel_position_t m_position;
+ std::array<double, 3> m_coords;
};
- std::thread *m_thread;
- pa_mainloop *m_mainloop;
- pa_context *m_context;
- pa_stream *m_stream;
- std::mutex m_mutex;
+ static const position_info position_infos[];
+ static const char *const typenames[];
+ enum { AREC, APLAY };
+
+ struct node_info {
+ sound_pulse *m_pulse;
+ uint32_t m_id, m_osdid;
+ int m_type;
+ std::string m_name, m_desc;
+
+ // Audio node info
+ std::vector<pa_channel_position_t> m_position_codes;
+ std::vector<std::string> m_position_names;
+ std::vector<std::array<double, 3>> m_positions;
+ uint32_t m_sink_port_count, m_source_port_count;
+
+ osd::audio_rate_range m_rate;
+
+ node_info(sound_pulse *pulse, uint32_t id, uint32_t osdid, int type, std::string name, std::string desc) : m_pulse(pulse), m_id(id), m_osdid(osdid), m_type(type), m_name(name), m_desc(desc), m_sink_port_count(0), m_source_port_count(0), m_rate{0, 0, 0} {
+ }
+ };
+
+ struct stream_info {
+ sound_pulse *m_pulse;
+ uint32_t m_osdid;
+ uint32_t m_pulse_id;
+ node_info *m_target_node;
+ uint32_t m_channels;
+ pa_stream *m_stream;
+ std::vector<float> m_volumes;
+ abuffer m_buffer;
+
+ stream_info(sound_pulse *pulse, uint32_t osdid, uint32_t channels) : m_pulse(pulse), m_osdid(osdid), m_pulse_id(0), m_channels(channels), m_stream(nullptr), m_volumes(channels), m_buffer(channels) {}
+ };
- std::vector<abuffer> m_buffers;
+ std::map<uint32_t, node_info> m_nodes;
+ std::map<uint32_t, uint32_t> m_node_osdid_to_id;
- u32 m_last_sample;
- int m_new_volume_value;
- bool m_setting_volume;
- bool m_new_volume;
+ std::map<uint32_t, stream_info> m_streams;
+ std::map<uint32_t, uint32_t> m_stream_pulse_id_to_osdid;
- int m_pipe_to_sub[2];
- int m_pipe_to_main[2];
+ pa_threaded_mainloop *m_mainloop;
+ pa_context *m_context;
+ uint32_t m_node_current_id, m_stream_current_id;
+ uint32_t m_generation;
+ bool m_wait_stream, m_wait_init;
+
+ std::string m_default_audio_sink;
+ std::string m_default_audio_source;
- static void i_volume_set_notify(pa_context *, int success, void *self);
- void volume_set_notify(int success);
+ static void i_server_info(pa_context *, const pa_server_info *i, void *self);
+ void server_info(const pa_server_info *i);
static void i_context_notify(pa_context *, void *self);
void context_notify();
+ static void i_context_subscribe(pa_context *, pa_subscription_event_type_t t, uint32_t idx, void *self);
+ void context_subscribe(pa_subscription_event_type_t t, uint32_t idx);
static void i_stream_notify(pa_stream *, void *self);
- void stream_notify();
+ void stream_notify(stream_info *stream);
static void i_stream_write_request(pa_stream *, size_t size, void *self);
- void stream_write_request(size_t size);
+ void stream_write_request(stream_info *stream, size_t size);
+ static void i_source_info(pa_context *, const pa_source_info *i, int eol, void *self);
+ void source_info(const pa_source_info *i, int eol);
+ static void i_sink_info_new(pa_context *, const pa_sink_info *i, int eol, void *self);
+ void sink_info_new(const pa_sink_info *i, int eol);
+ static void i_sink_input_info_change(pa_context *, const pa_sink_input_info *i, int eol, void *self);
+ void sink_input_info_change(stream_info *stream, const pa_sink_input_info *i, int eol);
- void make_pipes();
-
- void mainloop_thread();
- void send_main(char c);
- void send_sub(char c);
- char get_main();
- char peek_main();
- void stop_mainloop(int err);
void generic_error(const char *msg);
void generic_pa_error(const char *msg, int err);
};
+// Try to more or less map to speaker.h positions
+
+const sound_pulse::position_info sound_pulse::position_infos[] = {
+ { PA_CHANNEL_POSITION_MONO, { 0.0, 0.0, 1.0 } },
+ { PA_CHANNEL_POSITION_FRONT_LEFT, { -0.2, 0.0, 1.0 } },
+ { PA_CHANNEL_POSITION_FRONT_RIGHT, { 0.2, 0.0, 1.0 } },
+ { PA_CHANNEL_POSITION_FRONT_CENTER, { 0.0, 0.0, 1.0 } },
+ { PA_CHANNEL_POSITION_LFE, { 0.0, -0.5, 1.0 } },
+ { PA_CHANNEL_POSITION_REAR_LEFT, { -0.2, 0.0, -0.5 } },
+ { PA_CHANNEL_POSITION_REAR_RIGHT, { 0.2, 0.0, -0.5 } },
+ { PA_CHANNEL_POSITION_REAR_CENTER, { 0.0, 0.0, -0.5 } },
+ { PA_CHANNEL_POSITION_MAX, { 0.0, 0.0, 0.0 } }
+};
+
+
+const char *const sound_pulse::typenames[] = {
+ "Audio recorder", "Speaker"
+};
+
void sound_pulse::generic_error(const char *msg)
{
perror(msg);
@@ -98,205 +150,312 @@ void sound_pulse::generic_pa_error(const char *msg, int err)
::exit(1);
}
-char sound_pulse::peek_main()
+void sound_pulse::context_notify()
{
- char c;
- int err = read(m_pipe_to_main[0], &c, 1);
- if(err != 1) {
- if(err >= 0) {
- fprintf(stderr, "peek_main: read returned %d, that's supposedly impossible\n", err);
- ::exit(1);
- }
- if(errno == EAGAIN || errno == EWOULDBLOCK) {
- // No data, no problem
- return -1;
- }
- generic_error("peek_main: read");
+ fprintf(stderr, "context notify\n");
+ pa_context_state state = pa_context_get_state(m_context);
+ if(state == PA_CONTEXT_READY) {
+ pa_context_subscribe(m_context, PA_SUBSCRIPTION_MASK_ALL, nullptr, this);
+ pa_context_get_sink_info_list(m_context, i_sink_info_new, (void *)this);
+
+ } else if(state == PA_CONTEXT_FAILED || state == PA_CONTEXT_TERMINATED) {
+ m_generation = 0x80000000;
+ pa_threaded_mainloop_signal(m_mainloop, 0);
}
- return c;
}
-char sound_pulse::get_main()
+void sound_pulse::i_context_notify(pa_context *, void *self)
{
- pollfd pfds[1];
- pfds[0].fd = m_pipe_to_main[0];
- pfds[0].events = POLLIN;
- pfds[0].revents = 0;
- int err = poll(pfds, 1, -1);
- if(err < 0)
- generic_error("get_main: poll");
-
- char c;
- err = read(m_pipe_to_main[0], &c, 1);
- if(err != 1) {
- if(err >= 0) {
- fprintf(stderr, "get_main: read returned %d, that's supposedly impossible\n", err);
- ::exit(1);
- }
- generic_error("get_main: read");
- }
- return c;
+ static_cast<sound_pulse *>(self)->context_notify();
}
-void sound_pulse::send_main(char c)
+void sound_pulse::stream_notify(stream_info *stream)
{
- int err = write(m_pipe_to_main[1], &c, 1);
- if(err != 1) {
- if(err >= 0) {
- fprintf(stderr, "send_main: write returned %d, that's supposedly impossible\n", err);
- ::exit(1);
- }
- if(errno == EAGAIN || errno == EWOULDBLOCK) {
- fprintf(stderr, "send_main: write would block, pipe buffer overflowed, something is going very badly\n");
- ::exit(1);
- }
- generic_error("send_main: write");
+ pa_stream_state state = pa_stream_get_state(stream->m_stream);
+
+ fprintf(stderr, "stream notify\n");
+ if(state == PA_STREAM_READY || state == PA_STREAM_FAILED || state == PA_STREAM_TERMINATED) {
+ m_wait_stream = false;
+ pa_threaded_mainloop_signal(m_mainloop, 0);
}
}
-void sound_pulse::send_sub(char c)
+void sound_pulse::i_stream_notify(pa_stream *, void *self)
{
- int err = write(m_pipe_to_sub[1], &c, 1);
- if(err != 1) {
- if(err >= 0) {
- fprintf(stderr, "send_sub: write returned %d, that's supposedly impossible\n", err);
- ::exit(1);
- }
- if(errno == EAGAIN || errno == EWOULDBLOCK) {
- fprintf(stderr, "send_sub: write would block, pipe buffer overflowed, something is going very badly\n");
- ::exit(1);
- }
- generic_error("send_sub: write");
- }
+ stream_info *si = static_cast<stream_info *>(self);
+ si->m_pulse->stream_notify(si);
}
-void sound_pulse::make_pipes()
+void sound_pulse::stream_write_request(stream_info *stream, size_t size)
{
- if(pipe2(m_pipe_to_sub, O_NONBLOCK))
- generic_error("pipe2 pipe_to_sub");
- if(pipe2(m_pipe_to_main, O_NONBLOCK))
- generic_error("pipe2 pipe_to_main");
+ // This is called with the thread locked
+ while(size) {
+ void *buffer;
+ size_t bsize = size;
+ int err = pa_stream_begin_write(stream->m_stream, &buffer, &bsize);
+ if(err)
+ generic_pa_error("stream begin write", err);
+ uint32_t frames = bsize/2/stream->m_channels;
+ uint32_t bytes = frames*2*stream->m_channels;
+ stream->m_buffer.get((int16_t *)buffer, frames);
+ err = pa_stream_write(stream->m_stream, buffer, bytes, nullptr, 0, PA_SEEK_RELATIVE);
+ if(err)
+ generic_pa_error("stream write", err);
+ size -= bytes;
+ }
}
-void sound_pulse::context_notify()
+void sound_pulse::i_stream_write_request(pa_stream *, size_t size, void *self)
{
- pa_context_state state = pa_context_get_state(m_context);
- if(state == PA_CONTEXT_READY)
- send_main('r');
+ stream_info *si = static_cast<stream_info *>(self);
+ si->m_pulse->stream_write_request(si, size);
+}
- else if(state == PA_CONTEXT_FAILED) {
- send_main('f');
- stop_mainloop(pa_context_errno(m_context));
- } else if(state == PA_CONTEXT_TERMINATED) {
- send_main('t');
- stop_mainloop(0);
+void sound_pulse::server_info(const pa_server_info *i)
+{
+ m_default_audio_sink = i->default_sink_name;
+ m_default_audio_source = i->default_source_name;
+ fprintf(stderr, "defaults %s %s\n", i->default_sink_name, i->default_source_name);
+ m_generation++;
+ if(m_wait_init) {
+ m_wait_init = false;
+ pa_threaded_mainloop_signal(m_mainloop, 0);
}
}
-void sound_pulse::i_context_notify(pa_context *, void *self)
+void sound_pulse::i_server_info(pa_context *, const pa_server_info *i, void *self)
{
- static_cast<sound_pulse *>(self)->context_notify();
+ static_cast<sound_pulse *>(self)->server_info(i);
}
-void sound_pulse::stream_notify()
+void sound_pulse::source_info(const pa_source_info *i, int eol)
{
- pa_stream_state state = pa_stream_get_state(m_stream);
-
- if(state == PA_STREAM_READY)
- send_main('r');
-
- else if(state == PA_STREAM_FAILED) {
- send_main('f');
- stop_mainloop(pa_context_errno(m_context));
+ if(eol) {
+ if(m_wait_init)
+ pa_context_get_server_info(m_context, i_server_info, (void *)this);
+ return;
+ }
+ auto ni = m_nodes.find(i->index);
+ if(ni != m_nodes.end()) {
+ // Add the monitoring sources to the node
+ ni->second.m_source_port_count = i->channel_map.channels;
+ return;
+ }
- } else if(state == PA_STREAM_TERMINATED)
- pa_context_disconnect(m_context);
+ fprintf(stderr, "new source %d (%s)\n", i->index, i->description);
+ m_node_osdid_to_id[m_node_current_id] = i->index;
+ auto &node = m_nodes.emplace(i->index, node_info(this, i->index, m_node_current_id++, AREC, i->name, i->description)).first->second;
+
+ node.m_source_port_count = i->channel_map.channels;
+ for(int chan=0; chan != i->channel_map.channels; chan++) {
+ pa_channel_position_t pos = i->channel_map.map[chan];
+ node.m_position_codes.push_back(pos);
+ node.m_position_names.push_back(pa_channel_position_to_pretty_string(pos));
+ for(uint32_t j = 0;; j++) {
+ if((position_infos[j].m_position == pos) || (position_infos[j].m_position == PA_CHANNEL_POSITION_MAX)) {
+ node.m_positions.push_back(position_infos[j].m_coords);
+ break;
+ }
+ }
+ }
}
-void sound_pulse::i_stream_notify(pa_stream *, void *self)
+void sound_pulse::i_source_info(pa_context *, const pa_source_info *i, int eol, void *self)
{
- static_cast<sound_pulse *>(self)->stream_notify();
+ static_cast<sound_pulse *>(self)->source_info(i, eol);
}
-void sound_pulse::stream_write_request(size_t size)
+void sound_pulse::sink_info_new(const pa_sink_info *i, int eol)
{
- if(size & 3) {
- fprintf(stderr, "stream request with size %d not a multiple of 4.\n", int(size));
- ::exit(1);
+ if(eol) {
+ if(m_wait_init)
+ pa_context_get_source_info_list(m_context, i_source_info, (void *)this);
+ return;
}
- size >>= 2;
- std::unique_lock<std::mutex> lock(m_mutex);
- while(size) {
- if(m_buffers.empty()) {
- std::vector<u32> zero(size, m_last_sample);
- int err = pa_stream_write(m_stream, zero.data(), size << 2, nullptr, 0, PA_SEEK_RELATIVE);
- if(err)
- generic_pa_error("stream write", err);
- size = 0;
-
- } else {
- auto &buf = m_buffers[0];
- size_t csz = size;
- size_t cur = buf.data.size() - buf.cpos;
- if(csz > cur)
- csz = cur;
- int err = pa_stream_write(m_stream, buf.data.data() + buf.cpos, csz << 2, nullptr, 0, PA_SEEK_RELATIVE);
- if(err)
- generic_pa_error("stream write", err);
- if(csz == cur)
- m_buffers.erase(m_buffers.begin());
- else
- buf.cpos += csz;
- size -= csz;
+ fprintf(stderr, "new sink %d (%s)\n", i->index, i->description);
+ fprintf(stderr, "rate %d\n", i->sample_spec.rate);
+ m_node_osdid_to_id[m_node_current_id] = i->index;
+ auto &node = m_nodes.emplace(i->index, node_info(this, i->index, m_node_current_id++, APLAY, i->name, i->description)).first->second;
+
+ node.m_sink_port_count = i->channel_map.channels;
+ for(int chan=0; chan != i->channel_map.channels; chan++) {
+ pa_channel_position_t pos = i->channel_map.map[chan];
+ node.m_position_codes.push_back(pos);
+ node.m_position_names.push_back(pa_channel_position_to_pretty_string(pos));
+ for(uint32_t j = 0;; j++) {
+ if((position_infos[j].m_position == pos) || (position_infos[j].m_position == PA_CHANNEL_POSITION_MAX)) {
+ node.m_positions.push_back(position_infos[j].m_coords);
+ break;
+ }
}
}
+ m_generation++;
}
-void sound_pulse::i_stream_write_request(pa_stream *, size_t size, void *self)
+void sound_pulse::i_sink_info_new(pa_context *, const pa_sink_info *i, int eol, void *self)
{
- static_cast<sound_pulse *>(self)->stream_write_request(size);
+ static_cast<sound_pulse *>(self)->sink_info_new(i, eol);
}
-void sound_pulse::mainloop_thread()
+void sound_pulse::sink_input_info_change(stream_info *stream, const pa_sink_input_info *i, int eol)
{
- int err = 0;
- pa_mainloop_run(m_mainloop, &err);
- if(err)
- generic_pa_error("mainloop stopped", err);
+ if(eol)
+ return;
+
+ auto ni = m_nodes.find(i->sink);
+ if(ni != m_nodes.end())
+ stream->m_target_node = &ni->second;
+
+ for(uint32_t port = 0; port != stream->m_channels; port++)
+ stream->m_volumes[port] = pa_sw_volume_to_dB(i->volume.values[port]);
+
+ fprintf(stderr, "change stream %d/%d sink=%s [%f %f]\n", stream->m_osdid, stream->m_pulse_id, stream->m_target_node->m_desc.c_str(), stream->m_volumes[0], stream->m_volumes[1]);
+ m_generation++;
}
-void sound_pulse::stop_mainloop(int err)
+void sound_pulse::i_sink_input_info_change(pa_context *, const pa_sink_input_info *i, int eol, void *self)
{
- pa_mainloop_quit(m_mainloop, err);
+ fprintf(stderr, "i_sink_input_info_change %p %d\n", i, eol);
+ stream_info *stream = static_cast<stream_info *>(self);
+ stream->m_pulse->sink_input_info_change(stream, i, eol);
}
-int sound_pulse::init(osd_interface &osd, osd_options const &options)
+void sound_pulse::context_subscribe(pa_subscription_event_type_t t, uint32_t idx)
{
- m_last_sample = 0;
- m_setting_volume = false;
- m_new_volume = false;
- m_new_volume_value = 0;
+ // This is called with the thread locked
+ static const char *const evt[] = { "sink", "source", "sink-input", "source-output", "module", "client", "cache", "server", "autoload", "card" };
+ static const char *const evt2[] = { "new", "change", "remove" };
+ switch(int(t)) {
+ case PA_SUBSCRIPTION_EVENT_REMOVE | PA_SUBSCRIPTION_EVENT_SINK:
+ case PA_SUBSCRIPTION_EVENT_REMOVE | PA_SUBSCRIPTION_EVENT_SOURCE: {
+ auto si = m_nodes.find(idx);
+ if(si == m_nodes.end())
+ break;
+ fprintf(stderr, "removing %s\n", si->second.m_desc.c_str());
+ for(auto &istream : m_streams)
+ if(istream.second.m_target_node == &si->second)
+ istream.second.m_target_node = nullptr;
+ m_nodes.erase(si);
+ m_generation++;
+ break;
+ }
+
+ case PA_SUBSCRIPTION_EVENT_NEW | PA_SUBSCRIPTION_EVENT_SINK:
+ pa_context_get_sink_info_by_index(m_context, idx, i_sink_info_new, this);
+ break;
+
+ case PA_SUBSCRIPTION_EVENT_NEW | PA_SUBSCRIPTION_EVENT_SOURCE:
+ pa_context_get_source_info_by_index(m_context, idx, i_source_info, this);
+ break;
+
+ case PA_SUBSCRIPTION_EVENT_CHANGE | PA_SUBSCRIPTION_EVENT_SERVER:
+ pa_context_get_server_info(m_context, i_server_info, (void *)this);
+ break;
+
+ case PA_SUBSCRIPTION_EVENT_CHANGE | PA_SUBSCRIPTION_EVENT_SINK_INPUT: {
+ auto si1 = m_stream_pulse_id_to_osdid.find(idx);
+ if(si1 == m_stream_pulse_id_to_osdid.end())
+ break;
+ auto si = m_streams.find(si1->second);
+ if(si == m_streams.end())
+ break;
+ pa_context_get_sink_input_info(m_context, idx, i_sink_input_info_change, (void *)&si->second);
+ break;
+ }
- m_mainloop = pa_mainloop_new();
- m_context = pa_context_new(pa_mainloop_get_api(m_mainloop), "MAME");
- pa_context_set_state_callback(m_context, i_context_notify, this);
- int err = pa_context_connect(m_context, nullptr, PA_CONTEXT_NOFLAGS, nullptr);
+ default:
+ fprintf(stderr, "event %s %s %d\n", evt2[t>>4], evt[t&15], idx);
+ }
+}
- if(err)
- generic_pa_error("pa_connect", err);
+void sound_pulse::i_context_subscribe(pa_context *, pa_subscription_event_type_t t, uint32_t idx, void *self)
+{
+ static_cast<sound_pulse *>(self)->context_subscribe(t, idx);
+}
- make_pipes();
- m_thread = new std::thread(&sound_pulse::mainloop_thread, this);
- char res = get_main();
- if(res != 'r')
+int sound_pulse::init(osd_interface &osd, osd_options const &options)
+{
+ m_node_current_id = 1;
+ m_stream_current_id = 1;
+ m_generation = 0;
+ m_wait_stream = false;
+ m_wait_init = true;
+
+ m_mainloop = pa_threaded_mainloop_new();
+ m_context = pa_context_new(pa_threaded_mainloop_get_api(m_mainloop), "MAME");
+ pa_context_set_state_callback(m_context, i_context_notify, this);
+ pa_context_set_subscribe_callback(m_context, i_context_subscribe, this);
+ pa_context_connect(m_context, nullptr, PA_CONTEXT_NOFLAGS, nullptr);
+ pa_threaded_mainloop_start(m_mainloop);
+
+ pa_threaded_mainloop_lock(m_mainloop);
+ while(m_wait_init)
+ pa_threaded_mainloop_wait(m_mainloop);
+ pa_threaded_mainloop_unlock(m_mainloop);
+ if(m_generation >= 0x80000000)
return 1;
- const int sample_rate = options.sample_rate();
+ return 0;
+}
+
+uint32_t sound_pulse::get_generation()
+{
+ pa_threaded_mainloop_lock(m_mainloop);
+ uint32_t result = m_generation;
+ pa_threaded_mainloop_unlock(m_mainloop);
+ return result;
+}
+
+osd::audio_info sound_pulse::get_information()
+{
+ osd::audio_info result;
+ pa_threaded_mainloop_lock(m_mainloop);
+ result.m_nodes.resize(m_nodes.size());
+ result.m_default_sink = 0;
+ result.m_default_source = 0;
+ result.m_generation = m_generation;
+ uint32_t node = 0;
+ for(auto &inode : m_nodes) {
+ result.m_nodes[node].m_name = inode.second.m_desc;
+ result.m_nodes[node].m_id = inode.second.m_osdid;
+ result.m_nodes[node].m_rate = inode.second.m_rate;
+ result.m_nodes[node].m_sinks = inode.second.m_sink_port_count;
+ result.m_nodes[node].m_sources = inode.second.m_source_port_count;
+ result.m_nodes[node].m_port_names = inode.second.m_position_names;
+ result.m_nodes[node].m_port_positions = inode.second.m_positions;
+
+ if(inode.second.m_name == m_default_audio_sink)
+ result.m_default_sink = inode.second.m_osdid;
+ if(inode.second.m_name == m_default_audio_source)
+ result.m_default_source = inode.second.m_osdid;
+ node ++;
+ }
+
+ for(auto &istream : m_streams)
+ if(istream.second.m_target_node)
+ result.m_streams.emplace_back(osd::audio_info::stream_info { istream.second.m_osdid, istream.second.m_target_node->m_osdid, istream.second.m_volumes });
+
+ pa_threaded_mainloop_unlock(m_mainloop);
+ return result;
+}
+
+uint32_t sound_pulse::stream_sink_open(uint32_t node, std::string name, uint32_t rate)
+{
+ pa_threaded_mainloop_lock(m_mainloop);
+ auto ni = m_node_osdid_to_id.find(node);
+ if(ni == m_node_osdid_to_id.end()) {
+ pa_threaded_mainloop_unlock(m_mainloop);
+ return 0;
+ }
+ node_info &snode = m_nodes.find(ni->second)->second;
+
+ uint32_t id = m_stream_current_id++;
+ auto &stream = m_streams.emplace(id, stream_info(this, id, snode.m_sink_port_count)).first->second;
pa_sample_spec ss;
#ifdef LSB_FIRST
@@ -304,108 +463,79 @@ int sound_pulse::init(osd_interface &osd, osd_options const &options)
#else
ss.format = PA_SAMPLE_S16BE;
#endif
- ss.rate = sample_rate;
- ss.channels = 2;
- m_stream = pa_stream_new(m_context, "main output", &ss, nullptr);
- pa_stream_set_state_callback(m_stream, i_stream_notify, this);
- pa_stream_set_write_callback(m_stream, i_stream_write_request, this);
+ ss.rate = rate;
+ ss.channels = stream.m_channels;
+ stream.m_stream = pa_stream_new(m_context, name.c_str(), &ss, nullptr);
+ pa_stream_set_state_callback(stream.m_stream, i_stream_notify, &stream);
+ pa_stream_set_write_callback(stream.m_stream, i_stream_write_request, &stream);
pa_buffer_attr battr;
- battr.fragsize = sample_rate / 1000;
- battr.maxlength = uint32_t(-1);
- battr.minreq = sample_rate / 1000;
+ battr.fragsize = uint32_t(-1);
+ battr.maxlength = 1024;
+ battr.minreq = uint32_t(-1);
battr.prebuf = uint32_t(-1);
- battr.tlength = sample_rate / 1000;
+ battr.tlength = uint32_t(-1);
- err = pa_stream_connect_playback(m_stream, nullptr, &battr, PA_STREAM_ADJUST_LATENCY, nullptr, nullptr);
+ int err = pa_stream_connect_playback(stream.m_stream, snode.m_name.c_str(), &battr, pa_stream_flags_t(PA_STREAM_ADJUST_LATENCY|PA_STREAM_START_UNMUTED), nullptr, nullptr);
if(err)
generic_pa_error("stream connect playback", err);
- res = get_main();
- if(res != 'r')
- return 1;
- return 0;
-}
+ stream.m_target_node = &snode;
-void sound_pulse::update_audio_stream(bool is_throttled, const s16 *buffer, int samples_this_frame)
-{
- std::unique_lock<std::mutex> lock(m_mutex);
- m_buffers.resize(m_buffers.size() + 1);
- auto &buf = m_buffers.back();
- buf.cpos = 0;
- buf.data.resize(samples_this_frame);
- memcpy(buf.data.data(), buffer, samples_this_frame*4);
- m_last_sample = buf.data.back();
-
- if(m_buffers.size() > 10)
- // If there way too many buffers, drop some so only 10 are left (roughly 0.2s)
- m_buffers.erase(m_buffers.begin(), m_buffers.begin() + m_buffers.size() - 10);
-
- else if(m_buffers.size() >= 5)
- // If there are too many buffers, remove five sample per buffer
- // to slowly resync to reduce latency (4 seconds to
- // compensate one buffer roughly)
- buf.cpos = 5;
+ m_wait_stream = true;
+ while(m_wait_stream)
+ pa_threaded_mainloop_wait(m_mainloop);
+
+ stream.m_pulse_id = pa_stream_get_index(stream.m_stream);
+ m_stream_pulse_id_to_osdid[stream.m_pulse_id] = id;
+
+ fprintf(stderr, "stream id %d\n", stream.m_pulse_id);
+ pa_threaded_mainloop_unlock(m_mainloop);
+
+ return id;
}
-void sound_pulse::volume_set_notify(int success)
+void sound_pulse::stream_sink_update(uint32_t id, const int16_t *buffer, int samples_this_frame)
{
- std::unique_lock<std::mutex> lock(m_mutex);
- if(m_new_volume) {
- m_new_volume = false;
- pa_cvolume vol;
- pa_cvolume_set(&vol, 2, pa_sw_volume_from_dB(m_new_volume_value));
- pa_context_set_sink_input_volume(m_context, pa_stream_get_index(m_stream), &vol, i_volume_set_notify, this);
- } else
- m_setting_volume = false;
+ pa_threaded_mainloop_lock(m_mainloop);
+ auto si = m_streams.find(id);
+ if(si == m_streams.end()) {
+ pa_threaded_mainloop_unlock(m_mainloop);
+ return;
+ }
+ si->second.m_buffer.push(buffer, samples_this_frame);
+ pa_threaded_mainloop_unlock(m_mainloop);
}
-void sound_pulse::i_volume_set_notify(pa_context *, int success, void *self)
+void sound_pulse::stream_set_volumes(uint32_t id, const std::vector<float> &db)
{
- static_cast<sound_pulse *>(self)->volume_set_notify(success);
}
-void sound_pulse::set_mastervolume(int attenuation)
+void sound_pulse::stream_close(uint32_t id)
{
- if(!m_stream)
+ pa_threaded_mainloop_lock(m_mainloop);
+ auto si = m_streams.find(id);
+ if(si == m_streams.end()) {
+ pa_threaded_mainloop_unlock(m_mainloop);
return;
-
-
- std::unique_lock<std::mutex> lock(m_mutex);
- if(m_setting_volume) {
- m_new_volume = true;
- m_new_volume_value = attenuation;
- } else {
- m_setting_volume = true;
- pa_cvolume vol;
- pa_cvolume_set(&vol, 2, pa_sw_volume_from_dB(attenuation));
- pa_context_set_sink_input_volume(m_context, pa_stream_get_index(m_stream), &vol, i_volume_set_notify, this);
}
+ stream_info &stream = si->second;
+ pa_stream_set_state_callback(stream.m_stream, nullptr, &stream);
+ pa_stream_set_write_callback(stream.m_stream, nullptr, &stream);
+ pa_stream_disconnect(stream.m_stream);
+ m_streams.erase(si);
+ pa_threaded_mainloop_unlock(m_mainloop);
}
void sound_pulse::exit()
{
- if(!m_stream)
- return;
+ for(const auto &si : m_streams) {
+ pa_stream_disconnect(si.second.m_stream);
+ pa_stream_unref(si.second.m_stream);
+ }
- pa_stream_disconnect(m_stream);
- while(get_main() != 't') {}
- pa_stream_unref(m_stream);
pa_context_unref(m_context);
- m_thread->join();
- pa_mainloop_free(m_mainloop);
- delete m_thread;
-
- close(m_pipe_to_sub[0]);
- close(m_pipe_to_sub[1]);
- close(m_pipe_to_main[0]);
- close(m_pipe_to_main[1]);
-
- m_thread = nullptr;
- m_mainloop = nullptr;
- m_context = nullptr;
- m_stream = nullptr;
- m_buffers.clear();
+ pa_threaded_mainloop_free(m_mainloop);
}
#else
diff --git a/src/osd/modules/sound/sdl_sound.cpp b/src/osd/modules/sound/sdl_sound.cpp
index 7f4993bea35..35c11eae86d 100644
--- a/src/osd/modules/sound/sdl_sound.cpp
+++ b/src/osd/modules/sound/sdl_sound.cpp
@@ -24,450 +24,205 @@
#include <cmath>
#include <fstream>
#include <memory>
+#include <map>
namespace osd {
namespace {
-//============================================================
-// DEBUGGING
-//============================================================
-
-#define LOG_SOUND 0
-
-#define SDLMAME_SOUND_LOG "sound.log"
-
-
-//============================================================
-// CLASS
-//============================================================
-
class sound_sdl : public osd_module, public sound_module
{
public:
-
- // number of samples per SDL callback
- static inline constexpr int SDL_XFER_SAMPLES = 512;
-
sound_sdl() :
- osd_module(OSD_SOUND_PROVIDER, "sdl"), sound_module(),
- sample_rate(0),
- sdl_xfer_samples(SDL_XFER_SAMPLES),
- stream_in_initialized(0),
- attenuation(0),
- buf_locked(0),
- stream_buffer(nullptr),
- stream_buffer_size(0),
- buffer_underflows(0),
- buffer_overflows(0)
+ osd_module(OSD_SOUND_PROVIDER, "sdl"), sound_module()
{
}
+
virtual ~sound_sdl() { }
virtual int init(osd_interface &osd, const osd_options &options) override;
virtual void exit() override;
- // sound_module
+ virtual bool external_per_channel_volume() override { return false; }
+ virtual bool split_streams_per_source() override { return false; }
- virtual void update_audio_stream(bool is_throttled, const int16_t *buffer, int samples_this_frame) override;
- virtual void set_mastervolume(int attenuation) override;
+ virtual uint32_t get_generation() override;
+ virtual osd::audio_info get_information() override;
+ virtual uint32_t stream_sink_open(uint32_t node, std::string name, uint32_t rate) override;
+ virtual void stream_close(uint32_t id) override;
+ virtual void stream_sink_update(uint32_t id, const int16_t *buffer, int samples_this_frame) override;
private:
- class ring_buffer
- {
- public:
- ring_buffer(size_t size);
-
- size_t data_size() const { return (tail - head + buffer_size) % buffer_size; }
- size_t free_size() const { return (head - tail - 1 + buffer_size) % buffer_size; }
- int append(const void *data, size_t size);
- int pop(void *data, size_t size);
-
- private:
- std::unique_ptr<int8_t []> const buffer;
- size_t const buffer_size;
- int head = 0, tail = 0;
+ struct device_info {
+ std::string m_name;
+ int m_freq;
+ uint8_t m_channels;
+ device_info(const char *name, int freq, uint8_t channels) : m_name(name), m_freq(freq), m_channels(channels) {}
};
- static void sdl_callback(void *userdata, Uint8 *stream, int len);
-
- void lock_buffer();
- void unlock_buffer();
- void attenuate(int16_t *data, int bytes);
- void copy_sample_data(bool is_throttled, const int16_t *data, int bytes_to_copy);
- int sdl_create_buffers();
- void sdl_destroy_buffers();
-
- int sample_rate;
- int sdl_xfer_samples;
- int stream_in_initialized;
- int attenuation;
+ struct stream_info {
+ uint32_t m_id;
+ SDL_AudioDeviceID m_sdl_id;
+ abuffer m_buffer;
+ stream_info(uint32_t id, uint8_t channels) : m_id(id), m_sdl_id(0), m_buffer(channels) {}
+ };
- int buf_locked;
- std::unique_ptr<ring_buffer> stream_buffer;
- uint32_t stream_buffer_size;
+ std::vector<device_info> m_devices;
+ uint32_t m_default_sink;
+ uint32_t m_stream_next_id;
+ std::map<uint32_t, std::unique_ptr<stream_info>> m_streams;
- // diagnostics
- int buffer_underflows;
- int buffer_overflows;
- std::unique_ptr<std::ofstream> sound_log;
+ static void sink_callback(void *userdata, Uint8 *stream, int len);
};
-
-//============================================================
-// PARAMETERS
-//============================================================
-
-// maximum audio latency
-#define MAX_AUDIO_LATENCY 5
-
-//============================================================
-// ring_buffer - constructor
-//============================================================
-
-sound_sdl::ring_buffer::ring_buffer(size_t size)
- : buffer(std::make_unique<int8_t []>(size + 1)), buffer_size(size + 1)
-{
- // A size+1 bytes buffer is allocated because it can never be full.
- // Otherwise the case head == tail couldn't be distinguished between a
- // full buffer and an empty buffer.
- std::fill_n(buffer.get(), size + 1, 0);
-}
-
//============================================================
-// ring_buffer::append
+// sound_sdl::init
//============================================================
-int sound_sdl::ring_buffer::append(const void *data, size_t size)
+int sound_sdl::init(osd_interface &osd, const osd_options &options)
{
- if (free_size() < size)
- return -1;
+ m_stream_next_id = 1;
- int8_t const *const data8 = reinterpret_cast<int8_t const *>(data);
- size_t sz = buffer_size - tail;
- if (size <= sz)
- sz = size;
- else
- std::copy_n(&data8[sz], size - sz, &buffer[0]);
-
- std::copy_n(data8, sz, &buffer[tail]);
- tail = (tail + size) % buffer_size;
-
- return 0;
-}
-
-//============================================================
-// ring_buffer::pop
-//============================================================
-
-int sound_sdl::ring_buffer::pop(void *data, size_t size)
-{
- if (data_size() < size)
+ if(SDL_InitSubSystem(SDL_INIT_AUDIO)) {
+ osd_printf_error("Could not initialize SDL %s\n", SDL_GetError());
return -1;
-
- int8_t *const data8 = reinterpret_cast<int8_t *>(data);
- size_t sz = buffer_size - head;
- if (size <= sz)
- sz = size;
- else
- {
- std::copy_n(&buffer[0], size - sz, &data8[sz]);
- std::fill_n(&buffer[0], size - sz, 0);
}
- std::copy_n(&buffer[head], sz, data8);
- std::fill_n(&buffer[head], sz, 0);
- head = (head + size) % buffer_size;
-
- return 0;
-}
-
-//============================================================
-// sound_sdl - destructor
-//============================================================
-
-//============================================================
-// lock_buffer
-//============================================================
-void sound_sdl::lock_buffer()
-{
- if (!buf_locked)
- SDL_LockAudio();
- buf_locked++;
-
- if (LOG_SOUND)
- *sound_log << "locking\n";
-}
-
-//============================================================
-// unlock_buffer
-//============================================================
-void sound_sdl::unlock_buffer()
-{
- buf_locked--;
- if (!buf_locked)
- SDL_UnlockAudio();
-
- if (LOG_SOUND)
- *sound_log << "unlocking\n";
-
-}
-
-//============================================================
-// Apply attenuation
-//============================================================
-
-void sound_sdl::attenuate(int16_t *data, int bytes_to_copy)
-{
- int level = (int) (pow(10.0, (double) attenuation / 20.0) * 128.0);
- int count = bytes_to_copy / sizeof(*data);
- while (count > 0)
- {
- *data = (*data * level) >> 7; /* / 128 */
- data++;
- count--;
+ osd_printf_verbose("Audio: Start initialization\n");
+ char const *const audio_driver = SDL_GetCurrentAudioDriver();
+ osd_printf_verbose("Audio: Driver is %s\n", audio_driver ? audio_driver : "not initialized");
+
+ // Capture is not implemented in SDL2, and the enumeration
+ // interface is different in SDL3
+ int dev_count = SDL_GetNumAudioDevices(0);
+ for(int i=0; i != dev_count; i++) {
+ SDL_AudioSpec spec;
+ const char *name = SDL_GetAudioDeviceName(i, 0);
+ int err = SDL_GetAudioDeviceSpec(i, 0, &spec);
+ if(!err)
+ m_devices.emplace_back(name, spec.freq, spec.channels);
}
+ char *def_name;
+ SDL_AudioSpec def_spec;
+ if(!SDL_GetDefaultAudioInfo(&def_name, &def_spec, 0)) {
+ uint32_t idx;
+ for(idx = 0; idx != m_devices.size() && m_devices[idx].m_name != def_name; idx++);
+ if(idx == m_devices.size())
+ m_devices.emplace_back(def_name, def_spec.freq, def_spec.channels);
+ m_default_sink = idx+1;
+ SDL_free(def_name);
+ } else
+ m_default_sink = 0;
+ return 0;
}
-//============================================================
-// copy_sample_data
-//============================================================
-
-void sound_sdl::copy_sample_data(bool is_throttled, const int16_t *data, int bytes_to_copy)
-{
- lock_buffer();
- int const err = stream_buffer->append(data, bytes_to_copy);
- unlock_buffer();
-
- if (LOG_SOUND && err)
- *sound_log << "Late detection of overflow. This shouldn't happen.\n";
-}
-
-
-//============================================================
-// update_audio_stream
-//============================================================
-
-void sound_sdl::update_audio_stream(bool is_throttled, const int16_t *buffer, int samples_this_frame)
+void sound_sdl::exit()
{
- // if nothing to do, don't do it
- if (sample_rate == 0 || !stream_buffer)
- return;
-
- if (!stream_in_initialized)
- {
- // Fill in some zeros to prevent an initial buffer underflow
- int8_t zero = 0;
- size_t zsize = stream_buffer->free_size() / 2;
- while (zsize--)
- stream_buffer->append(&zero, 1);
-
- // start playing
- SDL_PauseAudio(0);
- stream_in_initialized = 1;
- }
-
- size_t bytes_this_frame = samples_this_frame * sizeof(*buffer) * 2;
- size_t free_size = stream_buffer->free_size();
- size_t data_size = stream_buffer->data_size();
-
- if (stream_buffer->free_size() < bytes_this_frame) {
- if (LOG_SOUND)
- util::stream_format(*sound_log, "Overflow: DS=%u FS=%u BTF=%u\n", data_size, free_size, bytes_this_frame);
- buffer_overflows++;
- return;
- }
-
- copy_sample_data(is_throttled, buffer, bytes_this_frame);
-
- size_t nfree_size = stream_buffer->free_size();
- size_t ndata_size = stream_buffer->data_size();
- if (LOG_SOUND)
- util::stream_format(*sound_log, "Appended data: DS=%u(%u) FS=%u(%u) BTF=%u\n", data_size, ndata_size, free_size, nfree_size, bytes_this_frame);
+ SDL_QuitSubSystem(SDL_INIT_AUDIO);
}
-
-
-//============================================================
-// set_mastervolume
-//============================================================
-
-void sound_sdl::set_mastervolume(int _attenuation)
+uint32_t sound_sdl::get_generation()
{
- // clamp the attenuation to 0-32 range
- attenuation = std::clamp(_attenuation, -32, 0);
-
- if (stream_in_initialized)
- {
- if (attenuation == -32)
- SDL_PauseAudio(1);
- else
- SDL_PauseAudio(0);
- }
+ // sdl2 is not dynamic w.r.t devices
+ return 1;
}
-//============================================================
-// sdl_callback
-//============================================================
-void sound_sdl::sdl_callback(void *userdata, Uint8 *stream, int len)
+osd::audio_info sound_sdl::get_information()
{
- sound_sdl *thiz = reinterpret_cast<sound_sdl *>(userdata);
- size_t const free_size = thiz->stream_buffer->free_size();
- size_t const data_size = thiz->stream_buffer->data_size();
-
- if (data_size < len)
- {
- thiz->buffer_underflows++;
- if (LOG_SOUND)
- util::stream_format(*thiz->sound_log, "Underflow at sdl_callback: DS=%u FS=%u Len=%d\n", data_size, free_size, len);
+ enum { FL, FR, FC, LFE, BL, BR, BC, SL, SR };
+ static const char *const posname[9] = { "FL", "FR", "FC", "LFE", "BL", "BR", "BC", "SL", "SR" };
+
+ static std::array<double, 3> pos3d[9] = {
+ { -0.2, 0.0, 1.0 },
+ { 0.2, 0.0, 1.0 },
+ { 0.0, 0.0, 1.0 },
+ { 0.0, -0.5, 1.0 },
+ { -0.2, 0.0, -0.5 },
+ { 0.2, 0.0, -0.5 },
+ { 0.0, 0.0, -0.5 },
+ { -0.2, 0.0, 0.0 },
+ { 0.2, 0.0, 0.0 },
+ };
+
+ static const uint32_t positions[8][8] = {
+ { FC },
+ { FL, FR },
+ { FL, FR, LFE },
+ { FL, FR, BL, BR },
+ { FL, FR, LFE, BL, BR },
+ { FL, FR, FC, LFE, BL, BR },
+ { FL, FR, FC, LFE, BC, SL, SR },
+ { FL, FR, FC, LFE, BL, BR, SL, SR }
+ };
- // Maybe read whatever is left in the stream_buffer anyway?
- memset(stream, 0, len);
- return;
+ osd::audio_info result;
+ result.m_nodes.resize(m_devices.size());
+ result.m_default_sink = m_default_sink;
+ result.m_default_source = 0;
+ result.m_generation = 1;
+ for(uint32_t node = 0; node != m_devices.size(); node++) {
+ result.m_nodes[node].m_name = m_devices[node].m_name;
+ result.m_nodes[node].m_id = node + 1;
+ uint32_t freq = m_devices[node].m_freq;
+ result.m_nodes[node].m_rate = audio_rate_range{ freq, freq, freq };
+ result.m_nodes[node].m_sinks = m_devices[node].m_channels;
+ for(uint32_t port = 0; port != m_devices[node].m_channels; port++) {
+ uint32_t pos = positions[m_devices[node].m_channels-1][port];
+ result.m_nodes[node].m_port_names.push_back(posname[pos]);
+ result.m_nodes[node].m_port_positions.push_back(pos3d[pos]);
+ }
}
-
- int err = thiz->stream_buffer->pop((void *)stream, len);
- if (LOG_SOUND && err)
- *thiz->sound_log << "Late detection of underflow. This shouldn't happen.\n";
-
- thiz->attenuate((int16_t *)stream, len);
-
- if (LOG_SOUND)
- util::stream_format(*thiz->sound_log, "callback: xfer DS=%u FS=%u Len=%d\n", data_size, free_size, len);
+ return result;
}
-
-//============================================================
-// sound_sdl::init
-//============================================================
-
-int sound_sdl::init(osd_interface &osd, const osd_options &options)
+uint32_t sound_sdl::stream_sink_open(uint32_t node, std::string name, uint32_t rate)
{
- int n_channels = 2;
- int audio_latency;
- SDL_AudioSpec aspec, obtained;
-
- if (LOG_SOUND)
- sound_log = std::make_unique<std::ofstream>(SDLMAME_SOUND_LOG);
-
- // skip if sound disabled
- sample_rate = options.sample_rate();
- if (sample_rate != 0)
- {
- if (SDL_InitSubSystem(SDL_INIT_AUDIO))
- {
- osd_printf_error("Could not initialize SDL %s\n", SDL_GetError());
- return -1;
- }
-
- osd_printf_verbose("Audio: Start initialization\n");
- char const *const audio_driver = SDL_GetCurrentAudioDriver();
- osd_printf_verbose("Audio: Driver is %s\n", audio_driver ? audio_driver : "not initialized");
-
- sdl_xfer_samples = SDL_XFER_SAMPLES;
- stream_in_initialized = 0;
-
- // set up the audio specs
- aspec.freq = sample_rate;
- aspec.format = AUDIO_S16SYS; // keep endian independent
- aspec.channels = n_channels;
- aspec.samples = sdl_xfer_samples;
- aspec.callback = sdl_callback;
- aspec.userdata = this;
-
- if (SDL_OpenAudio(&aspec, &obtained) < 0)
- goto cant_start_audio;
-
- osd_printf_verbose("Audio: frequency: %d, channels: %d, samples: %d\n",
- obtained.freq, obtained.channels, obtained.samples);
-
- sdl_xfer_samples = obtained.samples;
-
- // pin audio latency
- audio_latency = std::clamp(options.audio_latency(), 1, MAX_AUDIO_LATENCY);
-
- // compute the buffer sizes
- stream_buffer_size = (sample_rate * 2 * sizeof(int16_t) * (2 + audio_latency)) / 30;
- stream_buffer_size = (stream_buffer_size / 1024) * 1024;
- if (stream_buffer_size < 1024)
- stream_buffer_size = 1024;
-
- // create the buffers
- if (sdl_create_buffers())
- goto cant_create_buffers;
-
- // set the startup volume
- set_mastervolume(attenuation);
- osd_printf_verbose("Audio: End initialization\n");
+ device_info &dev = m_devices[node-1];
+ std::unique_ptr<stream_info> stream = std::make_unique<stream_info>(m_stream_next_id ++, dev.m_channels);
+
+ SDL_AudioSpec dspec, ospec;
+ dspec.freq = rate;
+ dspec.format = AUDIO_S16SYS;
+ dspec.channels = dev.m_channels;
+ dspec.samples = 512;
+ dspec.callback = sink_callback;
+ dspec.userdata = stream.get();
+
+ stream->m_sdl_id = SDL_OpenAudioDevice(dev.m_name.c_str(), 0, &dspec, &ospec, 0);
+ if(!stream->m_sdl_id)
return 0;
-
- // error handling
- cant_create_buffers:
- cant_start_audio:
- osd_printf_verbose("Audio: Initialization failed. SDL error: %s\n", SDL_GetError());
-
- return -1;
- }
-
- return 0;
+ SDL_PauseAudioDevice(stream->m_sdl_id, 0);
+ uint32_t id = stream->m_id;
+ m_streams[stream->m_id] = std::move(stream);
+ return id;
}
-
-
-//============================================================
-// sdl_kill
-//============================================================
-
-void sound_sdl::exit()
+void sound_sdl::stream_close(uint32_t id)
{
- // if nothing to do, don't do it
- if (sample_rate == 0)
+ auto si = m_streams.find(id);
+ if(si == m_streams.end())
return;
-
- osd_printf_verbose("sdl_kill: closing audio\n");
- SDL_CloseAudio();
-
- SDL_QuitSubSystem(SDL_INIT_AUDIO);
-
- // kill the buffers
- sdl_destroy_buffers();
-
- // print out over/underflow stats
- if (buffer_overflows || buffer_underflows)
- osd_printf_verbose("Sound buffer: overflows=%d underflows=%d\n", buffer_overflows, buffer_underflows);
-
- if (LOG_SOUND)
- {
- util::stream_format(*sound_log, "Sound buffer: overflows=%d underflows=%d\n", buffer_overflows, buffer_underflows);
- sound_log.reset();
- }
+ SDL_CloseAudioDevice(si->second->m_sdl_id);
+ m_streams.erase(si);
}
-
-
-//============================================================
-// dsound_create_buffers
-//============================================================
-
-int sound_sdl::sdl_create_buffers()
+void sound_sdl::stream_sink_update(uint32_t id, const int16_t *buffer, int samples_this_frame)
{
- osd_printf_verbose("sdl_create_buffers: creating stream buffer of %u bytes\n", stream_buffer_size);
-
- stream_buffer = std::make_unique<ring_buffer>(stream_buffer_size);
- buf_locked = 0;
- return 0;
+ auto si = m_streams.find(id);
+ if(si == m_streams.end())
+ return;
+ stream_info *stream = si->second.get();
+ SDL_LockAudioDevice(stream->m_sdl_id);
+ stream->m_buffer.push(buffer, samples_this_frame);
+ SDL_UnlockAudioDevice(stream->m_sdl_id);
}
-//============================================================
-// sdl_destroy_buffers
-//============================================================
-
-void sound_sdl::sdl_destroy_buffers()
+void sound_sdl::sink_callback(void *userdata, uint8_t *data, int len)
{
- // release the buffer
- stream_buffer.reset();
+ stream_info *stream = reinterpret_cast<stream_info *>(userdata);
+ stream->m_buffer.get((int16_t *)data, len / 2 / stream->m_buffer.channels());
}
} // anonymous namespace
diff --git a/src/osd/modules/sound/sound_module.cpp b/src/osd/modules/sound/sound_module.cpp
new file mode 100644
index 00000000000..5dc13eb3246
--- /dev/null
+++ b/src/osd/modules/sound/sound_module.cpp
@@ -0,0 +1,61 @@
+// license:BSD-3-Clause
+// copyright-holders:O. Galibert
+
+
+#include "emu.h"
+#include "sound_module.h"
+
+void sound_module::abuffer::get(int16_t *data, uint32_t samples)
+{
+ uint32_t pos = 0;
+ while(pos != samples) {
+ if(m_buffers.empty()) {
+ while(pos != samples) {
+ memcpy(data, m_last_sample.data(), m_channels*2);
+ data += m_channels;
+ pos ++;
+ }
+ break;
+ }
+
+ auto &buf = m_buffers.front();
+ if(buf.m_data.empty()) {
+ m_buffers.erase(m_buffers.begin());
+ continue;
+ }
+
+ uint32_t avail = buf.m_data.size() / m_channels - buf.m_cpos;
+ if(avail > samples - pos) {
+ avail = samples - pos;
+ memcpy(data, buf.m_data.data() + buf.m_cpos * m_channels, avail * 2 * m_channels);
+ buf.m_cpos += avail;
+ break;
+ }
+
+ memcpy(data, buf.m_data.data() + buf.m_cpos * m_channels, avail * 2 * m_channels);
+ m_buffers.erase(m_buffers.begin());
+ pos += avail;
+ data += avail * m_channels;
+ }
+}
+
+void sound_module::abuffer::push(const int16_t *data, uint32_t samples)
+{
+ m_buffers.resize(m_buffers.size() + 1);
+ auto &buf = m_buffers.back();
+ buf.m_cpos = 0;
+ buf.m_data.resize(samples * m_channels);
+ memcpy(buf.m_data.data(), data, samples * 2 * m_channels);
+ memcpy(m_last_sample.data(), data + (samples-1) * m_channels, 2 * m_channels);
+
+ if(m_buffers.size() > 10)
+ // If there are way too many buffers, drop some so only 10 are left (roughly 0.2s)
+ m_buffers.erase(m_buffers.begin(), m_buffers.begin() + m_buffers.size() - 10);
+
+ else if(m_buffers.size() >= 5)
+ // If there are too many buffers, remove five samples per buffer
+ // to slowly resync to reduce latency (4 seconds to
+ // compensate one buffer, roughly)
+ buf.m_cpos = 5;
+}
+
diff --git a/src/osd/modules/sound/sound_module.h b/src/osd/modules/sound/sound_module.h
index 088da5ea8d0..2498db84107 100644
--- a/src/osd/modules/sound/sound_module.h
+++ b/src/osd/modules/sound/sound_module.h
@@ -9,11 +9,12 @@
#pragma once
-#include <cstdint>
+#include <osdepend.h>
-//============================================================
-// CONSTANTS
-//============================================================
+#include <cstdint>
+#include <array>
+#include <vector>
+#include <string>
#define OSD_SOUND_PROVIDER "sound"
@@ -22,8 +23,57 @@ class sound_module
public:
virtual ~sound_module() = default;
- virtual void update_audio_stream(bool is_throttled, const int16_t *buffer, int samples_this_frame) = 0;
- virtual void set_mastervolume(int attenuation) = 0;
+ virtual uint32_t get_generation() { return 1; }
+ virtual osd::audio_info get_information() {
+ osd::audio_info result;
+ result.m_generation = 1;
+ result.m_default_sink = 1;
+ result.m_default_source = 0;
+ result.m_nodes.resize(1);
+ result.m_nodes[0].m_name = "";
+ result.m_nodes[0].m_id = 1;
+ result.m_nodes[0].m_rate.m_default_rate = 0; // Magic value meaning "use configured sample rate"
+ result.m_nodes[0].m_rate.m_min_rate = 0;
+ result.m_nodes[0].m_rate.m_max_rate = 0;
+ result.m_nodes[0].m_sinks = 2;
+ result.m_nodes[0].m_sources = 0;
+ result.m_nodes[0].m_port_names.push_back("L");
+ result.m_nodes[0].m_port_names.push_back("R");
+ result.m_nodes[0].m_port_positions.emplace_back(std::array<double, 3>({ -0.2, 0.0, 1.0 }));
+ result.m_nodes[0].m_port_positions.emplace_back(std::array<double, 3>({ 0.2, 0.0, 1.0 }));
+ result.m_streams.resize(1);
+ result.m_streams[0].m_id = 1;
+ result.m_streams[0].m_node = 1;
+ return result;
+ }
+ virtual bool external_per_channel_volume() { return false; }
+ virtual bool split_streams_per_source() { return false; }
+
+ virtual uint32_t stream_sink_open(uint32_t node, std::string name, uint32_t rate) { return 1; }
+ virtual uint32_t stream_source_open(uint32_t node, std::string name, uint32_t rate) { return 0; }
+ virtual void stream_set_volumes(uint32_t id, const std::vector<float> &db) {}
+ virtual void stream_close(uint32_t id) {}
+ virtual void stream_sink_update(uint32_t id, const int16_t *buffer, int samples_this_frame) {}
+ virtual void stream_source_update(uint32_t id, int16_t *buffer, int samples_this_frame) {}
+
+protected:
+ class abuffer {
+ public:
+ abuffer(uint32_t channels) : m_channels(channels), m_last_sample(channels, 0) {}
+ void get(int16_t *data, uint32_t samples);
+ void push(const int16_t *data, uint32_t samples);
+ uint32_t channels() const { return m_channels; }
+
+ private:
+ struct buffer {
+ uint32_t m_cpos;
+ std::vector<int16_t> m_data;
+ };
+
+ uint32_t m_channels;
+ std::vector<int16_t> m_last_sample;
+ std::vector<buffer> m_buffers;
+ };
};
#endif // MAME_OSD_SOUND_SOUND_MODULE_H
diff --git a/src/osd/modules/sound/xaudio2_sound.cpp b/src/osd/modules/sound/xaudio2_sound.cpp
index d0243ba1267..a865f2527fe 100644
--- a/src/osd/modules/sound/xaudio2_sound.cpp
+++ b/src/osd/modules/sound/xaudio2_sound.cpp
@@ -214,8 +214,7 @@ public:
void exit() override;
// sound_module
- void update_audio_stream(bool is_throttled, int16_t const *buffer, int samples_this_frame) override;
- void set_mastervolume(int attenuation) override;
+ void stream_sink_update(uint32_t, int16_t const *buffer, int samples_this_frame) override;
private:
// Xaudio callbacks
@@ -376,11 +375,11 @@ void sound_xaudio2::exit()
}
//============================================================
-// update_audio_stream
+// stream_sink_update
//============================================================
-void sound_xaudio2::update_audio_stream(
- bool is_throttled,
+void sound_xaudio2::stream_sink_update(
+ uint32_t,
int16_t const *buffer,
int samples_this_frame)
{
@@ -414,32 +413,6 @@ void sound_xaudio2::update_audio_stream(
}
//============================================================
-// set_mastervolume
-//============================================================
-
-void sound_xaudio2::set_mastervolume(int attenuation)
-{
- if (!m_initialized)
- return;
-
- assert(m_sourceVoice);
-
- HRESULT result;
-
- // clamp the attenuation to 0-32 range
- attenuation = std::clamp(attenuation, -32, 0);
-
- // Ranges from 1.0 to XAUDIO2_MAX_VOLUME_LEVEL indicate additional gain
- // Ranges from 0 to 1.0 indicate a reduced volume level
- // 0 indicates silence
- // We only support a reduction from 1.0, so we generate values in the range 0.0 to 1.0
- float scaledVolume = (32.0f + attenuation) / 32.0f;
-
- // set the master volume
- HR_RETV(m_sourceVoice->SetVolume(scaledVolume));
-}
-
-//============================================================
// IXAudio2VoiceCallback::OnBufferEnd
//============================================================
diff --git a/src/osd/osdepend.h b/src/osd/osdepend.h
index ebad7883bbe..0c22440009f 100644
--- a/src/osd/osdepend.h
+++ b/src/osd/osdepend.h
@@ -16,6 +16,7 @@
#include "emufwd.h"
#include "bitmap.h"
+#include "interface/audio.h"
#include "interface/midiport.h"
#include "interface/nethandler.h"
@@ -24,7 +25,7 @@
#include <string>
#include <string_view>
#include <vector>
-
+#include <array>
// forward references
class input_type_entry;
@@ -65,7 +66,6 @@ public:
class osd_interface
{
public:
-
// general overridables
virtual void init(running_machine &machine) = 0;
virtual void update(bool skip_redraw) = 0;
@@ -78,9 +78,17 @@ public:
virtual void wait_for_debugger(device_t &device, bool firststop) = 0;
// audio overridables
- virtual void update_audio_stream(const int16_t *buffer, int samples_this_frame) = 0;
- virtual void set_mastervolume(int attenuation) = 0;
virtual bool no_sound() = 0;
+ virtual bool sound_external_per_channel_volume() = 0;
+ virtual bool sound_split_streams_per_source() = 0;
+ virtual uint32_t sound_get_generation() = 0;
+ virtual osd::audio_info sound_get_information() = 0;
+ virtual uint32_t sound_stream_sink_open(uint32_t node, std::string name, uint32_t rate) = 0;
+ virtual uint32_t sound_stream_source_open(uint32_t node, std::string name, uint32_t rate) = 0;
+ virtual void sound_stream_close(uint32_t id) = 0;
+ virtual void sound_stream_sink_update(uint32_t id, const int16_t *buffer, int samples_this_frame) = 0;
+ virtual void sound_stream_source_update(uint32_t id, int16_t *buffer, int samples_this_frame) = 0;
+ virtual void sound_stream_set_volumes(uint32_t id, const std::vector<float> &db) = 0;
// input overridables
virtual void customize_input_type_list(std::vector<input_type_entry> &typelist) = 0;
diff --git a/src/zexall/main.cpp b/src/zexall/main.cpp
index 3ff60ced4f2..cfb19bc6909 100644
--- a/src/zexall/main.cpp
+++ b/src/zexall/main.cpp
@@ -106,7 +106,7 @@ void emulator_info::periodic_check() { }
bool emulator_info::frame_hook() { return false; }
-void emulator_info::sound_hook() { }
+void emulator_info::sound_hook(const std::map<std::string, std::vector<std::pair<const float *, int>>> &) { }
void emulator_info::layout_script_cb(layout_file &file, const char *script) { }