summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2020-09-21 12:47:00 -0700
committer Aaron Giles <aaron@aarongiles.com>2020-09-21 12:47:00 -0700
commit70743c6fb2602a5c2666c679b618706eabfca2ad (patch)
tree380e7aaefe5e3adcf044b69e72e04ad9b34904d4 /src
parentfdfcbf14e874e763b208426488b2e79e67dc735d (diff)
s_dsp/saa1099/scsp/segapcm/sn76477/snkwave/sp0256/spkrdev/spu/st0016/swp*: Update to new stream callbacks
Diffstat (limited to 'src')
-rw-r--r--src/devices/bus/ecbbus/grip.cpp2
-rw-r--r--src/devices/sound/astrocde.cpp2
-rw-r--r--src/devices/sound/discrete.cpp2
-rw-r--r--src/devices/sound/dmadac.cpp2
-rw-r--r--src/devices/sound/es1373.cpp8
-rw-r--r--src/devices/sound/es5506.cpp2
-rw-r--r--src/devices/sound/flt_rc.cpp2
-rw-r--r--src/devices/sound/gb.cpp2
-rw-r--r--src/devices/sound/hc55516.cpp2
-rw-r--r--src/devices/sound/k053260.cpp2
-rw-r--r--src/devices/sound/lmc1992.cpp2
-rw-r--r--src/devices/sound/mos6560.cpp2
-rw-r--r--src/devices/sound/mos6581.cpp2
-rw-r--r--src/devices/sound/okim6258.cpp2
-rw-r--r--src/devices/sound/pcd3311.cpp2
-rw-r--r--src/devices/sound/qs1000.cpp2
-rw-r--r--src/devices/sound/qsoundhle.cpp2
-rw-r--r--src/devices/sound/rp2c33_snd.cpp2
-rw-r--r--src/devices/sound/s14001a.cpp10
-rw-r--r--src/devices/sound/s14001a.h2
-rw-r--r--src/devices/sound/s_dsp.cpp12
-rw-r--r--src/devices/sound/s_dsp.h2
-rw-r--r--src/devices/sound/saa1099.cpp16
-rw-r--r--src/devices/sound/saa1099.h2
-rw-r--r--src/devices/sound/scsp.cpp47
-rw-r--r--src/devices/sound/scsp.h11
-rw-r--r--src/devices/sound/segapcm.cpp16
-rw-r--r--src/devices/sound/segapcm.h2
-rw-r--r--src/devices/sound/sn76477.cpp14
-rw-r--r--src/devices/sound/sn76477.h2
-rw-r--r--src/devices/sound/snkwave.cpp18
-rw-r--r--src/devices/sound/snkwave.h2
-rw-r--r--src/devices/sound/sp0256.cpp18
-rw-r--r--src/devices/sound/sp0256.h2
-rw-r--r--src/devices/sound/spkrdev.cpp30
-rw-r--r--src/devices/sound/spkrdev.h10
-rw-r--r--src/devices/sound/spu.cpp19
-rw-r--r--src/devices/sound/spu.h2
-rw-r--r--src/devices/sound/st0016.cpp16
-rw-r--r--src/devices/sound/st0016.h2
-rw-r--r--src/devices/sound/swp00.cpp4
-rw-r--r--src/devices/sound/swp00.h2
-rw-r--r--src/devices/sound/swp20.cpp2
-rw-r--r--src/devices/sound/swp20.h2
-rw-r--r--src/devices/sound/swp30.cpp18
-rw-r--r--src/devices/sound/swp30.h2
-rw-r--r--src/mame/drivers/apogee.cpp2
-rw-r--r--src/mame/drivers/apple2gs.cpp7
-rw-r--r--src/mame/drivers/h01x.cpp2
-rw-r--r--src/mame/drivers/hh_amis2k.cpp8
-rw-r--r--src/mame/drivers/hh_hmcs40.cpp10
-rw-r--r--src/mame/drivers/hh_pic16.cpp6
-rw-r--r--src/mame/drivers/hh_sm510.cpp2
-rw-r--r--src/mame/drivers/hh_tms1k.cpp27
-rw-r--r--src/mame/drivers/hh_ucom4.cpp6
-rw-r--r--src/mame/drivers/meritum.cpp2
-rw-r--r--src/mame/drivers/pokemini.cpp2
-rw-r--r--src/mame/drivers/tasc.cpp2
-rw-r--r--src/mame/drivers/vtech1.cpp2
-rw-r--r--src/mame/machine/trs80.cpp2
60 files changed, 187 insertions, 220 deletions
diff --git a/src/devices/bus/ecbbus/grip.cpp b/src/devices/bus/ecbbus/grip.cpp
index 88e3d2fe23b..97a33298171 100644
--- a/src/devices/bus/ecbbus/grip.cpp
+++ b/src/devices/bus/ecbbus/grip.cpp
@@ -217,7 +217,7 @@ MC6845_ON_UPDATE_ADDR_CHANGED( ecb_grip21_device::grip5_addr_changed )
}
*/
-static const int16_t speaker_levels[] = { -32768, 0, 32767, 0 };
+static const double speaker_levels[] = { -1.0, 0.0, 1.0, 0.0 };
//-------------------------------------------------
// I8255A interface
diff --git a/src/devices/sound/astrocde.cpp b/src/devices/sound/astrocde.cpp
index 17df6999989..e0fab62505b 100644
--- a/src/devices/sound/astrocde.cpp
+++ b/src/devices/sound/astrocde.cpp
@@ -126,7 +126,7 @@ void astrocade_io_device::device_start()
//-------------------------------------------------
-// sound_stream_update_legacy - handle a stream update
+// 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)
diff --git a/src/devices/sound/discrete.cpp b/src/devices/sound/discrete.cpp
index 7d6a84a4fc7..0bda283c936 100644
--- a/src/devices/sound/discrete.cpp
+++ b/src/devices/sound/discrete.cpp
@@ -1060,7 +1060,7 @@ void discrete_device::process(int samples)
}
//-------------------------------------------------
-// sound_stream_update_legacy - handle update requests for
+// sound_stream_update - handle update requests for
// our sound stream
//-------------------------------------------------
diff --git a/src/devices/sound/dmadac.cpp b/src/devices/sound/dmadac.cpp
index b3a7d84bbf5..384449fca9b 100644
--- a/src/devices/sound/dmadac.cpp
+++ b/src/devices/sound/dmadac.cpp
@@ -232,7 +232,7 @@ dmadac_sound_device::dmadac_sound_device(const machine_config &mconfig, const ch
}
//-------------------------------------------------
-// sound_stream_update_legacy - handle a stream update
+// 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)
diff --git a/src/devices/sound/es1373.cpp b/src/devices/sound/es1373.cpp
index a7a86de22d6..1c707599188 100644
--- a/src/devices/sound/es1373.cpp
+++ b/src/devices/sound/es1373.cpp
@@ -230,13 +230,13 @@ void es1373_device::device_timer(emu_timer &timer, device_timer_id tid, int para
}
//-------------------------------------------------
-// sound_stream_update_legacy - handle update requests for
+// 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)
{
if (m_dac1.enable) {
- logerror("%s: sound_stream_update_legacy DAC1 not implemented yet\n", tag());
+ logerror("%s: sound_stream_update DAC1 not implemented yet\n", tag());
}
if (m_dac2.enable) {
@@ -248,7 +248,7 @@ void es1373_device::sound_stream_update(sound_stream &stream, std::vector<read_s
if (m_adc.enable) {
if (m_adc.format!=SCTRL_16BIT_MONO) {
- logerror("%s: sound_stream_update_legacy Only SCTRL_16BIT_MONO recorded supported\n", tag());
+ logerror("%s: sound_stream_update Only SCTRL_16BIT_MONO recorded supported\n", tag());
} else {
for (int i=0; i<outputs[0].samples(); i++) {
if (m_adc.buf_count<=m_adc.buf_size) {
@@ -349,7 +349,7 @@ void es1373_device::send_audio_out(chan_info& chan, uint32_t intr_mask, write_st
}
if (LOG_ES_FILE && m_tempCount<1000000) {
m_tempCount++;
- //logerror("es1373_device::sound_stream_update_legacy count: %i samp16: %X\n", i, samp16);
+ //logerror("es1373_device::sound_stream_update count: %i samp16: %X\n", i, samp16);
//if (LOG_ES_FILE && m_eslog)
//fprintf(m_eslog, "%i\n", samp16);
}
diff --git a/src/devices/sound/es5506.cpp b/src/devices/sound/es5506.cpp
index aa266b4a620..3ea90a97261 100644
--- a/src/devices/sound/es5506.cpp
+++ b/src/devices/sound/es5506.cpp
@@ -2092,7 +2092,7 @@ u16 es5505_device::read(offs_t offset)
//-------------------------------------------------
-// sound_stream_update_legacy - handle a stream update
+// 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)
diff --git a/src/devices/sound/flt_rc.cpp b/src/devices/sound/flt_rc.cpp
index cb6b4940681..48d542283e0 100644
--- a/src/devices/sound/flt_rc.cpp
+++ b/src/devices/sound/flt_rc.cpp
@@ -52,7 +52,7 @@ void filter_rc_device::device_start()
//-------------------------------------------------
-// sound_stream_update_legacy - handle a stream update
+// 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)
diff --git a/src/devices/sound/gb.cpp b/src/devices/sound/gb.cpp
index cb4ba86fe36..2fc1c81e5b0 100644
--- a/src/devices/sound/gb.cpp
+++ b/src/devices/sound/gb.cpp
@@ -1211,7 +1211,7 @@ void cgb04_apu_device::apu_power_off()
//-------------------------------------------------
-// sound_stream_update_legacy - handle a stream update
+// 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)
diff --git a/src/devices/sound/hc55516.cpp b/src/devices/sound/hc55516.cpp
index d01c3b86c0c..4ee6667ede4 100644
--- a/src/devices/sound/hc55516.cpp
+++ b/src/devices/sound/hc55516.cpp
@@ -242,7 +242,7 @@ int hc55516_device::clock_state_r()
//-------------------------------------------------
-// sound_stream_update_legacy - handle a stream update
+// sound_stream_update - 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)
diff --git a/src/devices/sound/k053260.cpp b/src/devices/sound/k053260.cpp
index 619313c9c99..0032d834df6 100644
--- a/src/devices/sound/k053260.cpp
+++ b/src/devices/sound/k053260.cpp
@@ -421,7 +421,7 @@ void k053260_device::KDSC_Voice::update_pan_volume()
void k053260_device::KDSC_Voice::key_on()
{
m_position = m_kadpcm ? 1 : 0; // for kadpcm low bit is nybble offset, so must start at 1 due to preincrement
- m_counter = 0x1000 - CLOCKS_PER_SAMPLE; // force update on next sound_stream_update_legacy
+ m_counter = 0x1000 - CLOCKS_PER_SAMPLE; // force update on next sound_stream_update
m_output = 0;
m_playing = true;
if (LOG) m_device.logerror("K053260: start = %06x, length = %06x, pitch = %04x, vol = %02x:%x, loop = %s, %s\n",
diff --git a/src/devices/sound/lmc1992.cpp b/src/devices/sound/lmc1992.cpp
index 25da0ac327d..551bf1a4741 100644
--- a/src/devices/sound/lmc1992.cpp
+++ b/src/devices/sound/lmc1992.cpp
@@ -171,7 +171,7 @@ void lmc1992_device::device_start()
//-------------------------------------------------
-// sound_stream_update_legacy - handle update requests for
+// sound_stream_update - handle update requests for
// our sound stream
//-------------------------------------------------
diff --git a/src/devices/sound/mos6560.cpp b/src/devices/sound/mos6560.cpp
index be66c4c4703..e3f94ef6aa6 100644
--- a/src/devices/sound/mos6560.cpp
+++ b/src/devices/sound/mos6560.cpp
@@ -884,7 +884,7 @@ void mos6560_device::device_timer(emu_timer &timer, device_timer_id id, int para
}
//-------------------------------------------------
-// sound_stream_update_legacy - handle a stream update
+// 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)
diff --git a/src/devices/sound/mos6581.cpp b/src/devices/sound/mos6581.cpp
index 0870631ad47..4ee3ddd7ebd 100644
--- a/src/devices/sound/mos6581.cpp
+++ b/src/devices/sound/mos6581.cpp
@@ -235,7 +235,7 @@ void mos6581_device::device_post_load()
//-------------------------------------------------
-// sound_stream_update_legacy - handle update requests for
+// sound_stream_update - handle update requests for
// our sound stream
//-------------------------------------------------
diff --git a/src/devices/sound/okim6258.cpp b/src/devices/sound/okim6258.cpp
index 0cf7d2e327e..349fe9ca13c 100644
--- a/src/devices/sound/okim6258.cpp
+++ b/src/devices/sound/okim6258.cpp
@@ -138,7 +138,7 @@ void okim6258_device::device_reset()
//-------------------------------------------------
-// sound_stream_update_legacy - handle a stream update
+// 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)
diff --git a/src/devices/sound/pcd3311.cpp b/src/devices/sound/pcd3311.cpp
index 67c597fb397..37c4471d166 100644
--- a/src/devices/sound/pcd3311.cpp
+++ b/src/devices/sound/pcd3311.cpp
@@ -48,7 +48,7 @@ void pcd3311_device::device_start()
//-------------------------------------------------
-// sound_stream_update_legacy - handle update requests for
+// sound_stream_update - handle update requests for
// our sound stream
//-------------------------------------------------
diff --git a/src/devices/sound/qs1000.cpp b/src/devices/sound/qs1000.cpp
index faf7d22a524..23b0ee76a44 100644
--- a/src/devices/sound/qs1000.cpp
+++ b/src/devices/sound/qs1000.cpp
@@ -466,7 +466,7 @@ void qs1000_device::wave_w(offs_t offset, uint8_t data)
//-------------------------------------------------
-// sound_stream_update_legacy -
+// 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)
{
diff --git a/src/devices/sound/qsoundhle.cpp b/src/devices/sound/qsoundhle.cpp
index 2fa8bcfea32..913d22baed1 100644
--- a/src/devices/sound/qsoundhle.cpp
+++ b/src/devices/sound/qsoundhle.cpp
@@ -158,7 +158,7 @@ void qsound_hle_device::device_reset()
}
//-------------------------------------------------
-// sound_stream_update_legacy - handle a stream update
+// 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)
diff --git a/src/devices/sound/rp2c33_snd.cpp b/src/devices/sound/rp2c33_snd.cpp
index 506e21ce21c..d0701041a6b 100644
--- a/src/devices/sound/rp2c33_snd.cpp
+++ b/src/devices/sound/rp2c33_snd.cpp
@@ -218,7 +218,7 @@ void rp2c33_sound_device::write(offs_t offset, u8 data)
}
//-------------------------------------------------
-// sound_stream_update_legacy - handle a stream update
+// 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)
diff --git a/src/devices/sound/s14001a.cpp b/src/devices/sound/s14001a.cpp
index 5230a66b534..aa4506ba1c8 100644
--- a/src/devices/sound/s14001a.cpp
+++ b/src/devices/sound/s14001a.cpp
@@ -226,7 +226,7 @@ ALLOW_SAVE_TYPE(s14001a_device::states); // allow save_item on a non-fundamental
void s14001a_device::device_start()
{
- m_stream = stream_alloc_legacy(0, 1, clock() ? clock() : machine().sample_rate());
+ m_stream = stream_alloc(0, 1, clock() ? clock() : machine().sample_rate());
// resolve callbacks
m_ext_read_handler.resolve();
@@ -311,16 +311,16 @@ void s14001a_device::device_start()
//-------------------------------------------------
-// sound_stream_update_legacy - handle a stream update
+// sound_stream_update - handle a stream update
//-------------------------------------------------
-void s14001a_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
+void s14001a_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- for (int i = 0; i < samples; i++)
+ for (int i = 0; i < outputs[0].samples(); i++)
{
Clock();
int16_t sample = m_uOutputP2 - 7; // range -7..8
- outputs[0][i] = sample * 0xf00;
+ outputs[0].put_int(i, sample, 8);
}
}
diff --git a/src/devices/sound/s14001a.h b/src/devices/sound/s14001a.h
index 09f985a51dc..511503d9daa 100644
--- a/src/devices/sound/s14001a.h
+++ b/src/devices/sound/s14001a.h
@@ -31,7 +31,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
private:
uint8_t readmem(uint16_t offset, bool phase);
diff --git a/src/devices/sound/s_dsp.cpp b/src/devices/sound/s_dsp.cpp
index 9385273ba66..52d255dbfc6 100644
--- a/src/devices/sound/s_dsp.cpp
+++ b/src/devices/sound/s_dsp.cpp
@@ -160,7 +160,7 @@ void s_dsp_device::device_start()
space().cache(m_cache);
space().specific(m_data);
- m_channel = stream_alloc_legacy(0, 2, clock() / 64);
+ m_channel = stream_alloc(0, 2, clock() / 64);
state_register();
}
@@ -1061,20 +1061,20 @@ void s_dsp_device::state_register()
}
//-------------------------------------------------
-// sound_stream_update_legacy - handle a stream update
+// sound_stream_update - handle a stream update
//-------------------------------------------------
-void s_dsp_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
+void s_dsp_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
s16 mix[2];
- for (int i = 0; i < samples; i++)
+ for (int i = 0; i < outputs[0].samples(); i++)
{
mix[0] = mix[1] = 0;
dsp_update(mix);
/* Update the buffers */
- outputs[0][i] = (stream_sample_t)mix[0];
- outputs[1][i] = (stream_sample_t)mix[1];
+ outputs[0].put_int(i, (stream_sample_t)mix[0], 32768);
+ outputs[1].put_int(i, (stream_sample_t)mix[1], 32768);
}
}
diff --git a/src/devices/sound/s_dsp.h b/src/devices/sound/s_dsp.h
index 4ab841d0ebd..00097b17303 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_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) 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 cad84d184bb..080ebabe89c 100644
--- a/src/devices/sound/saa1099.cpp
+++ b/src/devices/sound/saa1099.cpp
@@ -161,7 +161,7 @@ saa1099_device::saa1099_device(const machine_config &mconfig, const char *tag, d
void saa1099_device::device_start()
{
/* for each chip allocate one stream */
- m_stream = stream_alloc_legacy(0, 2, clock()/clock_divider);
+ m_stream = stream_alloc(0, 2, clock()/clock_divider);
save_item(NAME(m_noise_params));
save_item(NAME(m_env_enable));
@@ -200,18 +200,18 @@ void saa1099_device::device_clock_changed()
//-------------------------------------------------
-// sound_stream_update_legacy - handle a stream update
+// sound_stream_update - handle a stream update
//-------------------------------------------------
-void saa1099_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
+void saa1099_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
int j, ch;
/* if the channels are disabled we're done */
if (!m_all_ch_enable)
{
/* init output data */
- memset(outputs[LEFT],0,samples*sizeof(*outputs[LEFT]));
- memset(outputs[RIGHT],0,samples*sizeof(*outputs[RIGHT]));
+ outputs[LEFT].fill(0);
+ outputs[RIGHT].fill(0);
return;
}
@@ -227,7 +227,7 @@ void saa1099_device::sound_stream_update_legacy(sound_stream &stream, stream_sam
}
/* fill all data needed */
- for( j = 0; j < samples; j++ )
+ for( j = 0; j < outputs[0].samples(); j++ )
{
int output_l = 0, output_r = 0;
@@ -285,8 +285,8 @@ void saa1099_device::sound_stream_update_legacy(sound_stream &stream, stream_sam
m_noise[ch].counter -= clock_divider;
}
/* write sound data to the buffer */
- outputs[LEFT][j] = output_l / 6;
- outputs[RIGHT][j] = output_r / 6;
+ outputs[LEFT].put_int(j, output_l, 32768 * 6);
+ outputs[RIGHT].put_int(j, output_r, 32768 * 6);
}
}
diff --git a/src/devices/sound/saa1099.h b/src/devices/sound/saa1099.h
index 2f9361d5ce8..87f5b58f48a 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_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
private:
struct saa1099_channel
diff --git a/src/devices/sound/scsp.cpp b/src/devices/sound/scsp.cpp
index 143be37ca40..b340da3d237 100644
--- a/src/devices/sound/scsp.cpp
+++ b/src/devices/sound/scsp.cpp
@@ -36,9 +36,6 @@
#include <algorithm>
-static constexpr s32 clip16(int x) { return std::min(32767, std::max(-32768, x)); }
-static constexpr s32 clip18(int x) { return std::min(131071, std::max(-131072, x)); }
-
#define SHIFT 12
#define LFO_SHIFT 8
#define FIX(v) ((u32) ((float) (1 << SHIFT) * (v)))
@@ -165,11 +162,6 @@ scsp_device::scsp_device(const machine_config &mconfig, const char *tag, device_
m_timerC(nullptr),
m_mcieb(0),
m_mcipd(0),
- m_bufferl(nullptr),
- m_bufferr(nullptr),
- m_exts0(nullptr),
- m_exts1(nullptr),
- m_length(0),
m_RBUFDST(nullptr)
{
std::fill(std::begin(m_RINGBUF), std::end(m_RINGBUF), 0);
@@ -212,7 +204,7 @@ void scsp_device::device_start()
m_main_irq_cb.resolve_safe();
// Stereo output with EXTS0,1 Input (External digital audio output)
- m_stream = stream_alloc_legacy(2, 2, clock() / 512);
+ m_stream = stream_alloc(2, 2, clock() / 512);
for (int slot = 0; slot < 32; slot++)
{
@@ -317,17 +309,12 @@ void scsp_device::rom_bank_updated()
}
//-------------------------------------------------
-// sound_stream_update_legacy - handle a stream update
+// sound_stream_update - handle a stream update
//-------------------------------------------------
-void scsp_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
+void scsp_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- m_exts0 = inputs[0];
- m_exts1 = inputs[1];
- m_bufferl = outputs[0];
- m_bufferr = outputs[1];
- m_length = samples;
- DoMasterSamples(samples);
+ DoMasterSamples(inputs, outputs);
}
u8 scsp_device::DecodeSCI(u8 irq)
@@ -1276,17 +1263,12 @@ inline s32 scsp_device::UpdateSlot(SCSP_SLOT *slot)
return sample;
}
-void scsp_device::DoMasterSamples(int nsamples)
+void scsp_device::DoMasterSamples(std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- stream_sample_t *bufr,*bufl;
- stream_sample_t const *exts[2];
-
- bufr = m_bufferr;
- bufl = m_bufferl;
- exts[0] = m_exts0;
- exts[1] = m_exts1;
+ auto &bufr = outputs[1];
+ auto &bufl = outputs[0];
- for (int s = 0; s < nsamples; ++s)
+ for (int s = 0; s < bufl.samples(); ++s)
{
s32 smpl = 0, smpr = 0;
@@ -1342,7 +1324,7 @@ void scsp_device::DoMasterSamples(int nsamples)
SCSP_SLOT *slot = m_Slots + i + 16; // 100217, 100237 EFSDL, EFPAN for EXTS0/1
if (EFSDL(slot))
{
- m_DSP.EXTS[i] = exts[i][s];
+ m_DSP.EXTS[i] = s32(inputs[i].get(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;
@@ -1351,17 +1333,14 @@ void scsp_device::DoMasterSamples(int nsamples)
if (DAC18B())
{
- smpl = clip18(smpl);
- smpr = clip18(smpr);
+ bufl.put_int_clamp(s, smpl, 131072);
+ bufr.put_int_clamp(s, smpr, 131072);
}
else
{
- smpl = clip16(smpl >> 2);
- smpr = clip16(smpr >> 2);
+ bufl.put_int_clamp(s, smpl >> 2, 32768);
+ bufr.put_int_clamp(s, smpr >> 2, 32768);
}
-
- *bufl++ = smpl;
- *bufr++ = smpr;
}
}
diff --git a/src/devices/sound/scsp.h b/src/devices/sound/scsp.h
index 4fe8c5e2a91..7ff91fdb576 100644
--- a/src/devices/sound/scsp.h
+++ b/src/devices/sound/scsp.h
@@ -45,7 +45,7 @@ protected:
virtual void rom_bank_updated() override;
// sound stream update overrides
- virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
private:
enum SCSP_STATE { SCSP_ATTACK, SCSP_DECAY1, SCSP_DECAY2, SCSP_RELEASE };
@@ -148,13 +148,6 @@ private:
SCSPDSP m_DSP;
- stream_sample_t *m_bufferl;
- stream_sample_t *m_bufferr;
- stream_sample_t const *m_exts0;
- stream_sample_t const *m_exts1;
-
- int m_length;
-
s16 *m_RBUFDST; //this points to where the sample will be stored in the RingBuf
//LFO
@@ -187,7 +180,7 @@ private:
void w16(u32 addr, u16 val);
u16 r16(u32 addr);
inline s32 UpdateSlot(SCSP_SLOT *slot);
- void DoMasterSamples(int nsamples);
+ void DoMasterSamples(std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs);
//LFO
void LFO_Init();
diff --git a/src/devices/sound/segapcm.cpp b/src/devices/sound/segapcm.cpp
index e93bbaec7ee..9b4d7a9c803 100644
--- a/src/devices/sound/segapcm.cpp
+++ b/src/devices/sound/segapcm.cpp
@@ -39,7 +39,7 @@ void segapcm_device::device_start()
std::fill(&m_ram[0], &m_ram[0x800], 0xff);
- m_stream = stream_alloc_legacy(0, 2, clock() / 128);
+ m_stream = stream_alloc(0, 2, clock() / 128);
save_item(NAME(m_low));
save_pointer(NAME(m_ram), 0x800);
@@ -68,14 +68,14 @@ void segapcm_device::rom_bank_updated()
//-------------------------------------------------
-// sound_stream_update_legacy - handle a stream update
+// sound_stream_update - handle a stream update
//-------------------------------------------------
-void segapcm_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
+void segapcm_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
/* clear the buffers */
- memset(outputs[0], 0, samples*sizeof(*outputs[0]));
- memset(outputs[1], 0, samples*sizeof(*outputs[1]));
+ outputs[0].fill(0);
+ outputs[1].fill(0);
// reg function
// ------------------------------------------------
@@ -113,7 +113,7 @@ void segapcm_device::sound_stream_update_legacy(sound_stream &stream, stream_sam
int i;
/* loop over samples on this channel */
- for (i = 0; i < samples; i++)
+ for (i = 0; i < outputs[0].samples(); i++)
{
int8_t v;
@@ -132,8 +132,8 @@ void segapcm_device::sound_stream_update_legacy(sound_stream &stream, stream_sam
v = read_byte(offset + (addr >> 8)) - 0x80;
/* apply panning and advance */
- outputs[0][i] += v * (regs[2] & 0x7f);
- outputs[1][i] += v * (regs[3] & 0x7f);
+ outputs[0].add_int(i, v * (regs[2] & 0x7f), 32768);
+ outputs[1].add_int(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 8b9942a5727..f9869f2211f 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_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
// device_rom_interface overrides
virtual void rom_bank_updated() override;
diff --git a/src/devices/sound/sn76477.cpp b/src/devices/sound/sn76477.cpp
index 2903af1904b..b8db037e26b 100644
--- a/src/devices/sound/sn76477.cpp
+++ b/src/devices/sound/sn76477.cpp
@@ -203,7 +203,7 @@ sn76477_device::sn76477_device(const machine_config &mconfig, const char *tag, d
void sn76477_device::device_start()
{
- m_channel = stream_alloc_legacy(0, 1, machine().sample_rate());
+ m_channel = stream_alloc(0, 1, machine().sample_rate());
if (clock() > 0)
{
@@ -1698,10 +1698,10 @@ void sn76477_device::state_save_register()
}
//-------------------------------------------------
-// sound_stream_update_legacy - handle a stream update
+// sound_stream_update - handle a stream update
//-------------------------------------------------
-void sn76477_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
+void sn76477_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
double one_shot_cap_charging_step;
double one_shot_cap_discharging_step;
@@ -1720,7 +1720,7 @@ void sn76477_device::sound_stream_update_legacy(sound_stream &stream, stream_sam
double voltage_out;
double center_to_peak_voltage_out;
- stream_sample_t *buffer = outputs[0];
+ 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;
@@ -1744,7 +1744,7 @@ void sn76477_device::sound_stream_update_legacy(sound_stream &stream, stream_sam
/* process 'samples' number of samples */
- while (samples--)
+ for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
{
/* update the one-shot cap voltage */
if (!m_one_shot_cap_voltage_ext)
@@ -1993,10 +1993,10 @@ void sn76477_device::sound_stream_update_legacy(sound_stream &stream, stream_sam
32767 = 2 * OUT_CENTER_LEVEL_VOLTAGE + OUT_LOW_CLIP_THRESHOLD
/ Vout - Vmin \
- sample = | ----------- - 1 | * 32767
+ sample = | ----------- - 1 |
\ Vcen - Vmin /
*/
- *buffer++ = (((voltage_out - OUT_LOW_CLIP_THRESHOLD) / (OUT_CENTER_LEVEL_VOLTAGE - OUT_LOW_CLIP_THRESHOLD)) - 1) * 32767;
+ buffer.put(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 42fa82e5efc..094f8e78e1b 100644
--- a/src/devices/sound/sn76477.h
+++ b/src/devices/sound/sn76477.h
@@ -147,7 +147,7 @@ protected:
virtual void device_stop() override;
// sound stream update overrides
- virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
private:
/* chip's external interface */
diff --git a/src/devices/sound/snkwave.cpp b/src/devices/sound/snkwave.cpp
index 718dde017fb..44e6ba51466 100644
--- a/src/devices/sound/snkwave.cpp
+++ b/src/devices/sound/snkwave.cpp
@@ -44,7 +44,7 @@ void snkwave_device::device_start()
m_sample_rate = m_external_clock >> CLOCK_SHIFT;
/* get stream channels */
- m_stream = stream_alloc_legacy(0, 1, m_sample_rate);
+ m_stream = stream_alloc(0, 1, m_sample_rate);
/* reset all the voices */
m_frequency = 0;
@@ -60,26 +60,26 @@ void snkwave_device::device_start()
//-------------------------------------------------
-// sound_stream_update_legacy - handle update requests
+// sound_stream_update - handle update requests
// for our sound stream
//-------------------------------------------------
-void snkwave_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
+void snkwave_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- stream_sample_t *buffer = outputs[0];
-
- /* zap the contents of the buffer */
- memset(buffer, 0, samples * sizeof(*buffer));
+ 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 */
- while (samples-- > 0)
+ for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
{
int loops;
int16_t out = 0;
@@ -104,7 +104,7 @@ void snkwave_device::sound_stream_update_legacy(sound_stream &stream, stream_sam
}
}
- *buffer++ = out;
+ buffer.put_int(sampindex, out, 32768);
}
}
diff --git a/src/devices/sound/snkwave.h b/src/devices/sound/snkwave.h
index 2ecb5f7715d..bf40a33e500 100644
--- a/src/devices/sound/snkwave.h
+++ b/src/devices/sound/snkwave.h
@@ -26,7 +26,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
private:
static constexpr unsigned WAVEFORM_LENGTH = 16;
diff --git a/src/devices/sound/sp0256.cpp b/src/devices/sound/sp0256.cpp
index b4d18e6d6d3..5188d3bc31f 100644
--- a/src/devices/sound/sp0256.cpp
+++ b/src/devices/sound/sp0256.cpp
@@ -74,7 +74,7 @@ void sp0256_device::device_start()
m_drq_cb(1);
m_sby_cb(1);
- m_stream = stream_alloc_legacy(0, 1, clock() / CLOCK_DIVIDER);
+ m_stream = stream_alloc(0, 1, clock() / CLOCK_DIVIDER);
/* -------------------------------------------------------------------- */
/* Configure our internal variables. */
@@ -1260,16 +1260,16 @@ TIMER_CALLBACK_MEMBER(sp0256_device::set_lrq_timer_proc)
}
//-------------------------------------------------
-// sound_stream_update_legacy - handle a stream update
+// sound_stream_update - handle a stream update
//-------------------------------------------------
-void sp0256_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
+void sp0256_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- stream_sample_t *output = outputs[0];
+ auto &output = outputs[0];
int output_index = 0;
int length, did_samp/*, old_idx*/;
- while (output_index < samples)
+ while (output_index < output.samples())
{
/* ---------------------------------------------------------------- */
/* First, drain as much of our scratch buffer as we can into the */
@@ -1278,20 +1278,20 @@ void sp0256_device::sound_stream_update_legacy(sound_stream &stream, stream_samp
while (m_sc_tail != m_sc_head)
{
- output[output_index++] = m_scratch[m_sc_tail++ & SCBUF_MASK];
+ output.put_int(output_index++, m_scratch[m_sc_tail++ & SCBUF_MASK], 32768);
m_sc_tail &= SCBUF_MASK;
- if (output_index > samples)
+ if (output_index >= output.samples())
break;
}
/* ---------------------------------------------------------------- */
/* If output outputs is full, then we're done. */
/* ---------------------------------------------------------------- */
- if (output_index > samples)
+ if (output_index > output.samples())
break;
- length = samples - output_index;
+ length = output.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 3720b3429ed..d1e1d5612cf 100644
--- a/src/devices/sound/sp0256.h
+++ b/src/devices/sound/sp0256.h
@@ -61,7 +61,7 @@ protected:
virtual void device_reset() override;
// sound stream update overrides
- virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
private:
struct lpc12_t
diff --git a/src/devices/sound/spkrdev.cpp b/src/devices/sound/spkrdev.cpp
index 3fc3467771e..ec1ad169196 100644
--- a/src/devices/sound/spkrdev.cpp
+++ b/src/devices/sound/spkrdev.cpp
@@ -76,7 +76,7 @@
#include "sound/spkrdev.h"
-static constexpr int16_t default_levels[2] = {0, 32767};
+static constexpr double default_levels[2] = {0.0, 1.0};
// Internal oversampling factor (interm. samples vs stream samples)
static constexpr int RATE_MULTIPLIER = 4;
@@ -102,7 +102,7 @@ void speaker_sound_device::device_start()
int i;
double x;
- m_channel = stream_alloc_legacy(0, 1, machine().sample_rate());
+ m_channel = stream_alloc(0, 1, machine().sample_rate());
m_level = 0;
for (i = 0; i < FILTER_LENGTH; i++)
@@ -198,23 +198,23 @@ void speaker_sound_device::device_post_load()
}
//-------------------------------------------------
-// sound_stream_update_legacy - handle a stream update
+// sound_stream_update - handle a stream update
//-------------------------------------------------
// This can be triggered by the core (based on emulated time) or via level_w().
-void speaker_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
+void speaker_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- stream_sample_t *buffer = outputs[0];
- int volume = m_levels[m_level];
+ auto &buffer = outputs[0];
+ double volume = m_levels[m_level];
double filtered_volume;
attotime sampled_time = attotime::zero;
- if (samples > 0)
+ if (buffer.samples() > 0)
{
/* Prepare to update time state */
sampled_time = attotime(0, m_channel_sample_period);
- if (samples > 1)
- sampled_time *= samples;
+ if (buffer.samples() > 1)
+ sampled_time *= buffer.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)
@@ -222,19 +222,19 @@ void speaker_sound_device::sound_stream_update_legacy(sound_stream &stream, stre
*/
}
- if (samples-- > 0)
+ for (int sampindex = 0; sampindex < buffer.samples(); )
{
/* Note that first interm. sample may be composed... */
filtered_volume = update_interm_samples_get_filtered_volume(volume);
/* Composite volume is now quantized to the stream resolution */
- *buffer++ = (stream_sample_t)filtered_volume;
+ buffer.put(sampindex++, filtered_volume);
/* Any additional samples will be homogeneous, however may need filtering across samples: */
- while (samples-- > 0)
+ while (sampindex < buffer.samples())
{
filtered_volume = update_interm_samples_get_filtered_volume(volume);
- *buffer++ = (stream_sample_t)filtered_volume;
+ buffer.put(sampindex++, filtered_volume);
}
/* Update the time state */
@@ -322,7 +322,7 @@ void speaker_sound_device::update_interm_samples(const attotime &time, int volum
}
-double speaker_sound_device::update_interm_samples_get_filtered_volume(int volume)
+double speaker_sound_device::update_interm_samples_get_filtered_volume(double volume)
{
double filtered_volume, tempx;
@@ -355,7 +355,7 @@ double speaker_sound_device::update_interm_samples_get_filtered_volume(int volum
}
-void speaker_sound_device::finalize_interm_sample(int volume)
+void speaker_sound_device::finalize_interm_sample(double volume)
{
double fraction;
diff --git a/src/devices/sound/spkrdev.h b/src/devices/sound/spkrdev.h
index 7411e47170d..596a4f94854 100644
--- a/src/devices/sound/spkrdev.h
+++ b/src/devices/sound/spkrdev.h
@@ -21,7 +21,7 @@ public:
~speaker_sound_device() {}
// configuration
- void set_levels(int num_levels, const int16_t *levels) { m_num_levels = num_levels; m_levels = levels; }
+ void set_levels(int num_levels, const double *levels) { m_num_levels = num_levels; m_levels = levels; }
void level_w(int new_level); // can use as writeline
@@ -32,7 +32,7 @@ protected:
virtual void device_post_load() override;
// sound stream update overrides
- virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
private:
// Length of anti-aliasing filter kernel, measured in number of intermediate samples
@@ -47,9 +47,9 @@ private:
void update_interm_samples(const attotime &time, int volume);
// Updates the composed volume array and returns final filtered volume of next stream sample
- double update_interm_samples_get_filtered_volume(int volume);
+ double update_interm_samples_get_filtered_volume(double volume);
- void finalize_interm_sample(int volume);
+ void finalize_interm_sample(double volume);
void init_next_interm_sample();
inline double make_fraction(const attotime &a, const attotime &b, double timediv);
double get_filtered_volume();
@@ -80,7 +80,7 @@ private:
double m_prevx, m_prevy;
int m_num_levels; /* optional: number of levels (if not two) */
- const int16_t *m_levels; /* optional: pointer to level lookup table */
+ const double *m_levels; /* optional: pointer to level lookup table */
};
DECLARE_DEVICE_TYPE(SPEAKER_SOUND, speaker_sound_device)
diff --git a/src/devices/sound/spu.cpp b/src/devices/sound/spu.cpp
index 82f5d3973ac..2f85c6c87f7 100644
--- a/src/devices/sound/spu.cpp
+++ b/src/devices/sound/spu.cpp
@@ -1093,7 +1093,7 @@ void spu_device::init_stream()
{
const unsigned int hz=44100;
- m_stream = stream_alloc_legacy(0, 2, hz);
+ m_stream = stream_alloc(0, 2, hz);
rev=new reverb(hz);
@@ -2761,21 +2761,20 @@ void spu_device::update_timing()
//
//
-void spu_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
+void spu_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- stream_sample_t *outL, *outR;
int16_t temp[44100], *src;
- outL = outputs[0];
- outR = outputs[1];
+ auto &outL = outputs[0];
+ auto &outR = outputs[1];
- generate(temp, samples*4); // second parameter is bytes, * 2 (size of int16_t) * 2 (stereo)
+ generate(temp, outputs[0].samples()*4); // second parameter is bytes, * 2 (size of int16_t) * 2 (stereo)
src = &temp[0];
- for (int i = 0; i < samples; i++)
+ for (int i = 0; i < outputs[0].samples(); i++)
{
- *outL++ = *src++;
- *outR++ = *src++;
+ outL.put_int(i, *src++, 32768);
+ outR.put_int(i, *src++, 32768);
}
}
@@ -3034,7 +3033,7 @@ bool spu_device::play_cdda(const unsigned int sector, const unsigned char *cdda)
flip[i] = flip[i+1];
flip[i+1] = temp;
}
- // this should be done in generate but sound_stream_update_legacy may not be called frequently enough
+ // this should be done in generate but sound_stream_update may not be called frequently enough
if(((spureg.irq_addr << 3) < 0x800) && (spureg.ctrl & spuctrl_irq_enable))
m_irq_handler(1);
diff --git a/src/devices/sound/spu.h b/src/devices/sound/spu.h
index 7913670c667..54942d9d324 100644
--- a/src/devices/sound/spu.h
+++ b/src/devices/sound/spu.h
@@ -35,7 +35,7 @@ protected:
virtual void device_post_load() override;
virtual void device_stop() override;
- virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
static constexpr float ms_to_rate(float ms) { return 1.0f / (ms * (float(spu_base_frequency_hz) / 1000.0f)); }
static constexpr float s_to_rate(float s) { return ms_to_rate(s * 1000.0f); }
diff --git a/src/devices/sound/st0016.cpp b/src/devices/sound/st0016.cpp
index e0318eca466..d13dfd7cacc 100644
--- a/src/devices/sound/st0016.cpp
+++ b/src/devices/sound/st0016.cpp
@@ -43,7 +43,7 @@ st0016_device::st0016_device(const machine_config &mconfig, const char *tag, dev
void st0016_device::device_start()
{
- m_stream = stream_alloc_legacy(0, 2, 44100);
+ m_stream = stream_alloc(0, 2, 44100);
m_ram_read_cb.resolve_safe(0);
save_item(NAME(m_vpos));
@@ -54,10 +54,10 @@ void st0016_device::device_start()
//-------------------------------------------------
-// sound_stream_update_legacy - handle a stream update
+// sound_stream_update - handle a stream update
//-------------------------------------------------
-void st0016_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
+void st0016_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
int v, i, snum;
unsigned char *slot;
@@ -66,7 +66,7 @@ void st0016_device::sound_stream_update_legacy(sound_stream &stream, stream_samp
int16_t sample;
int sptr, eptr, freq, lsptr, leptr;
- memset(mix, 0, sizeof(mix[0])*samples*2);
+ memset(mix, 0, sizeof(mix[0])*outputs[0].samples()*2);
for (v = 0; v < 8; v++)
{
@@ -82,7 +82,7 @@ void st0016_device::sound_stream_update_legacy(sound_stream &stream, stream_samp
lsptr = slot[0x06]<<16 | slot[0x05]<<8 | slot[0x04];
leptr = slot[0x0a]<<16 | slot[0x09]<<8 | slot[0x08];
- for (snum = 0; snum < samples; snum++)
+ for (snum = 0; snum < outputs[0].samples(); snum++)
{
sample = m_ram_read_cb((sptr + m_vpos[v]) & 0x1fffff) << 8;
@@ -124,10 +124,10 @@ void st0016_device::sound_stream_update_legacy(sound_stream &stream, stream_samp
}
mixp = &mix[0];
- for (i = 0; i < samples; i++)
+ for (i = 0; i < outputs[0].samples(); i++)
{
- outputs[0][i] = (*mixp++)>>4;
- outputs[1][i] = (*mixp++)>>4;
+ outputs[0].put_int(i, *mixp++, 32768<<4);
+ outputs[1].put_int(i, *mixp++, 32768<<4);
}
}
diff --git a/src/devices/sound/st0016.h b/src/devices/sound/st0016.h
index 21dd14e07c7..b18317da348 100644
--- a/src/devices/sound/st0016.h
+++ b/src/devices/sound/st0016.h
@@ -27,7 +27,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
private:
sound_stream *m_stream;
diff --git a/src/devices/sound/swp00.cpp b/src/devices/sound/swp00.cpp
index d4d323af0a5..c19b7021e84 100644
--- a/src/devices/sound/swp00.cpp
+++ b/src/devices/sound/swp00.cpp
@@ -21,7 +21,7 @@ void swp00_device::device_add_mconfig(machine_config &config)
void swp00_device::device_start()
{
- m_stream = stream_alloc_legacy(0, 2, 44100);
+ m_stream = stream_alloc(0, 2, 44100);
}
void swp00_device::device_reset()
@@ -97,6 +97,6 @@ void swp00_device::snd_w(offs_t offset, u8 data)
// Synthesis
-void swp00_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
+void swp00_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
}
diff --git a/src/devices/sound/swp00.h b/src/devices/sound/swp00.h
index 0bf2d8b43d3..ae732979606 100644
--- a/src/devices/sound/swp00.h
+++ b/src/devices/sound/swp00.h
@@ -21,7 +21,7 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) 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 rom_bank_updated() override;
virtual void device_add_mconfig(machine_config &config) override;
diff --git a/src/devices/sound/swp20.cpp b/src/devices/sound/swp20.cpp
index c1c92c8cb27..46528efe32e 100644
--- a/src/devices/sound/swp20.cpp
+++ b/src/devices/sound/swp20.cpp
@@ -69,7 +69,7 @@ void swp20_device::snd_w(offs_t offset, u8 data)
logerror("w %02x, %02x %s\n", offset, data, machine().describe_context());
}
-void swp20_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
+void swp20_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
}
diff --git a/src/devices/sound/swp20.h b/src/devices/sound/swp20.h
index a65bae793a3..7323dd64f17 100644
--- a/src/devices/sound/swp20.h
+++ b/src/devices/sound/swp20.h
@@ -20,7 +20,7 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) 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 rom_bank_updated() override;
private:
diff --git a/src/devices/sound/swp30.cpp b/src/devices/sound/swp30.cpp
index 849af9f9946..aec573aa07a 100644
--- a/src/devices/sound/swp30.cpp
+++ b/src/devices/sound/swp30.cpp
@@ -163,7 +163,7 @@ void swp30_device::device_add_mconfig(machine_config &config)
void swp30_device::device_start()
{
- m_stream = stream_alloc_legacy(0, 2, 44100);
+ m_stream = stream_alloc(0, 2, 44100);
// Attenuantion for panning is 4.4 floating point. That means 0
// to -96.3dB. Since it's a nice range, we assume it's the same
@@ -761,12 +761,12 @@ void swp30_device::snd_w(offs_t offset, u16 data)
// Synthesis
-void swp30_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
+void swp30_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
// Loop first on the samples and not on the channels otherwise
// effects will be annoying to implement.
- for(int sample = 0; sample < samples; sample++) {
+ for(int sample = 0; sample < outputs[0].samples(); sample++) {
// Accumulate on 64 bits, shift/clamp at the end
s64 acc_left = 0, acc_right = 0;
@@ -871,17 +871,9 @@ void swp30_device::sound_stream_update_legacy(sound_stream &stream, stream_sampl
// Global EQ is missing (it's done in the MEG)
acc_left >>= (16+6);
- if(acc_left < -0x8000)
- acc_left = -0x8000;
- else if(acc_left > 0x7fff)
- acc_left = 0x7fff;
- outputs[0][sample] = acc_left;
+ outputs[0].put_int_clamp(sample, acc_left, 32768);
acc_right >>= (16+6);
- if(acc_right < -0x8000)
- acc_right = -0x8000;
- else if(acc_right > 0x7fff)
- acc_right = 0x7fff;
- outputs[1][sample] = acc_right;
+ outputs[1].put_int_clamp(sample, acc_right, 32768);
}
}
diff --git a/src/devices/sound/swp30.h b/src/devices/sound/swp30.h
index fc8424b66d2..1eb68270626 100644
--- a/src/devices/sound/swp30.h
+++ b/src/devices/sound/swp30.h
@@ -21,7 +21,7 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) 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 rom_bank_updated() override;
virtual void device_add_mconfig(machine_config &config) override;
diff --git a/src/mame/drivers/apogee.cpp b/src/mame/drivers/apogee.cpp
index e89e0ba03b0..f91f058ee6c 100644
--- a/src/mame/drivers/apogee.cpp
+++ b/src/mame/drivers/apogee.cpp
@@ -153,7 +153,7 @@ static INPUT_PORTS_START( apogee )
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rus/Lat") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT)
INPUT_PORTS_END
-static const int16_t speaker_levels[] = {-32767, -10922, 10922, 32767};
+static const double speaker_levels[] = {-1.0, -0.33333, 0.33333, 1.0};
WRITE_LINE_MEMBER(apogee_state::pit8253_out0_changed)
{
diff --git a/src/mame/drivers/apple2gs.cpp b/src/mame/drivers/apple2gs.cpp
index ba7dbbb67b5..464133ef4b4 100644
--- a/src/mame/drivers/apple2gs.cpp
+++ b/src/mame/drivers/apple2gs.cpp
@@ -1233,10 +1233,11 @@ void apple2gs_state::machine_start()
// setup speaker toggle volumes. this should be done mathematically probably,
// but these ad-hoc values aren't too bad.
- static const int16_t lvlTable[16] =
+#define LVL(x) (double(x) / 32768.0)
+ static const double lvlTable[16] =
{
- 0x0000, 0x03ff, 0x04ff, 0x05ff, 0x06ff, 0x07ff, 0x08ff, 0x09ff,
- 0x0aff, 0x0bff, 0x0cff, 0x0fff, 0x1fff, 0x3fff, 0x5fff, 0x7fff
+ LVL(0x0000), LVL(0x03ff), LVL(0x04ff), LVL(0x05ff), LVL(0x06ff), LVL(0x07ff), LVL(0x08ff), LVL(0x09ff),
+ LVL(0x0aff), LVL(0x0bff), LVL(0x0cff), LVL(0x0fff), LVL(0x1fff), LVL(0x3fff), LVL(0x5fff), LVL(0x7fff)
};
m_speaker->set_levels(16, lvlTable);
diff --git a/src/mame/drivers/h01x.cpp b/src/mame/drivers/h01x.cpp
index 15a676a477b..6680a803a77 100644
--- a/src/mame/drivers/h01x.cpp
+++ b/src/mame/drivers/h01x.cpp
@@ -11,7 +11,7 @@
#include "emu.h"
#include "includes/h01x.h"
-static const int16_t speaker_levels[] = {-32768, 0, 32767, 0};
+static const double speaker_levels[] = {-1.0, 0.0, 1.0, 0.0};
void h01x_state::h01x(machine_config &config)
{
diff --git a/src/mame/drivers/hh_amis2k.cpp b/src/mame/drivers/hh_amis2k.cpp
index 67778048e8a..051503c30f6 100644
--- a/src/mame/drivers/hh_amis2k.cpp
+++ b/src/mame/drivers/hh_amis2k.cpp
@@ -157,6 +157,8 @@ public:
protected:
virtual void machine_start() override;
+
+ std::vector<double> m_speaker_levels;
};
void wildfire_state::machine_start()
@@ -255,10 +257,10 @@ void wildfire_state::wildfire(machine_config &config)
TIMER(config, "speaker_decay").configure_periodic(FUNC(wildfire_state::speaker_decay_sim), attotime::from_usec(100));
// set volume levels (set_output_gain is too slow for sub-frame intervals)
- static s16 speaker_levels[0x8000];
+ m_speaker_levels.resize(0x8000);
for (int i = 0; i < 0x8000; i++)
- speaker_levels[i] = i;
- m_speaker->set_levels(0x8000, speaker_levels);
+ m_speaker_levels[i] = double(i) / 32768.0;
+ m_speaker->set_levels(0x8000, &m_speaker_levels[0]);
}
// roms
diff --git a/src/mame/drivers/hh_hmcs40.cpp b/src/mame/drivers/hh_hmcs40.cpp
index d9f8bf63ce3..249a3c859c4 100644
--- a/src/mame/drivers/hh_hmcs40.cpp
+++ b/src/mame/drivers/hh_hmcs40.cpp
@@ -1926,6 +1926,8 @@ public:
protected:
virtual void machine_start() override;
+
+ std::vector<double> m_speaker_levels;
};
void cdkong_state::machine_start()
@@ -2027,10 +2029,10 @@ void cdkong_state::cdkong(machine_config &config)
TIMER(config, "speaker_decay").configure_periodic(FUNC(cdkong_state::speaker_decay_sim), attotime::from_msec(1));
// set volume levels (set_output_gain is too slow for sub-frame intervals)
- static s16 speaker_levels[0x8000];
+ m_speaker_levels.resize(0x8000);
for (int i = 0; i < 0x8000; i++)
- speaker_levels[i] = i;
- m_speaker->set_levels(0x8000, speaker_levels);
+ m_speaker_levels[i] = double(i) / 32768.0;
+ m_speaker->set_levels(0x8000, &m_speaker_levels[0]);
}
// roms
@@ -3668,7 +3670,7 @@ void mwcbaseb_state::mwcbaseb(machine_config &config)
/* sound hardware */
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.25);
- static const s16 speaker_levels[] = { 0, 0x3fff, -0x4000, 0, -0x4000, 0, -0x8000, -0x4000 };
+ static const double speaker_levels[] = { 0.0, 0.5, -0.5, 0.0, -0.5, 0.0, -1.0, -0.5 };
m_speaker->set_levels(8, speaker_levels);
}
diff --git a/src/mame/drivers/hh_pic16.cpp b/src/mame/drivers/hh_pic16.cpp
index 8fb36a746c4..102111824bc 100644
--- a/src/mame/drivers/hh_pic16.cpp
+++ b/src/mame/drivers/hh_pic16.cpp
@@ -295,7 +295,7 @@ void touchme_state::touchme(machine_config &config)
/* sound hardware */
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker);
- static const s16 speaker_levels[] = { 0, 0x7fff, -0x8000, 0 };
+ static const double speaker_levels[] = { 0.0, 1.0, -1.0, 0.0 };
m_speaker->set_levels(4, speaker_levels);
m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25);
}
@@ -626,7 +626,7 @@ void maniac_state::maniac(machine_config &config)
/* sound hardware */
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker);
- static const s16 speaker_levels[] = { 0, 0x7fff, -0x8000, 0 };
+ static const double speaker_levels[] = { 0.0, 1.0, -1.0, 0.0 };
m_speaker->set_levels(4, speaker_levels);
m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25);
}
@@ -1336,7 +1336,7 @@ void rockpin_state::rockpin(machine_config &config)
/* sound hardware */
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker);
- static const s16 speaker_levels[] = { 0, 0x7fff, -0x8000, 0 };
+ static const double speaker_levels[] = { 0.0, 1.0, -1.0, 0.0 };
m_speaker->set_levels(4, speaker_levels);
m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25);
}
diff --git a/src/mame/drivers/hh_sm510.cpp b/src/mame/drivers/hh_sm510.cpp
index 7fc98eb6a76..01951558fa1 100644
--- a/src/mame/drivers/hh_sm510.cpp
+++ b/src/mame/drivers/hh_sm510.cpp
@@ -520,7 +520,7 @@ void hh_sm510_state::sm511_tiger2bit(machine_config &config, u16 width, u16 heig
m_maincpu->write_r().set(FUNC(hh_sm510_state::piezo2bit_r1_w));
// R via 120K resistor, S1 via 39K resistor (eg. tsonic, tsonic2, tbatmana)
- static const s16 speaker_levels[] = { 0, 0x7fff/3*1, 0x7fff/3*2, 0x7fff };
+ static const double speaker_levels[] = { 0.0, 1.0/3.0, 2.0/3.0, 1.0 };
m_speaker->set_levels(4, speaker_levels);
}
diff --git a/src/mame/drivers/hh_tms1k.cpp b/src/mame/drivers/hh_tms1k.cpp
index 872d4e19568..3219fa5234b 100644
--- a/src/mame/drivers/hh_tms1k.cpp
+++ b/src/mame/drivers/hh_tms1k.cpp
@@ -494,7 +494,7 @@ void matchnum_state::matchnum(machine_config &config)
/* sound hardware */
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker);
- static const s16 speaker_levels[4] = { 0, 0x7fff, -0x8000, 0 };
+ static const double speaker_levels[4] = { 0.0, 1.0, -1.0, 0.0 };
m_speaker->set_levels(4, speaker_levels);
m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25);
}
@@ -606,7 +606,7 @@ void arrball_state::arrball(machine_config &config)
/* sound hardware */
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker);
- static const s16 speaker_levels[4] = { 0, 0x7fff, -0x8000, 0 };
+ static const double speaker_levels[4] = { 0.0, 1.0, -1.0, 0.0 };
m_speaker->set_levels(4, speaker_levels);
m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25);
}
@@ -2852,7 +2852,7 @@ void cnfball_state::cnfball(machine_config &config)
/* sound hardware */
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker);
- static const s16 speaker_levels[4] = { 0, 0x7fff, -0x8000, 0 };
+ static const double speaker_levels[4] = { 0.0, 1.0, -1.0, 0.0 };
m_speaker->set_levels(4, speaker_levels);
m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25);
}
@@ -5755,7 +5755,7 @@ void elecdet_state::elecdet(machine_config &config)
/* sound hardware */
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker);
- static const s16 speaker_levels[4] = { 0, 0x3fff, 0x3fff, 0x7fff };
+ static const double speaker_levels[4] = { 0.0, 0.5, 0.5, 1.0};
m_speaker->set_levels(4, speaker_levels);
m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25);
}
@@ -7469,7 +7469,7 @@ void bigtrak_state::bigtrak(machine_config &config)
/* sound hardware */
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker);
- static const s16 speaker_levels[8] = { 0, 0x7fff/3, 0x7fff/3, 0x7fff/3*2, 0x7fff/3, 0x7fff/3*2, 0x7fff/3*2, 0x7fff };
+ static const double speaker_levels[8] = { 0.0, 1.0/3.0, 1.0/3.0, 2.0/3.0, 1.0/3.0, 2.0/3.0, 2.0/3.0, 1.0 };
m_speaker->set_levels(8, speaker_levels);
m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25);
}
@@ -7834,7 +7834,7 @@ void arcmania_state::arcmania(machine_config &config)
/* sound hardware */
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker);
- static const s16 speaker_levels[8] = { 0, 0x7fff/3, 0x7fff/3, 0x7fff/3*2, 0x7fff/3, 0x7fff/3*2, 0x7fff/3*2, 0x7fff };
+ static const double speaker_levels[8] = { 0.0, 1.0/3.0, 1.0/3.0, 2.0/3.0, 1.0/3.0, 2.0/3.0, 2.0/3.0, 1.0 };
m_speaker->set_levels(8, speaker_levels);
m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25);
}
@@ -8096,7 +8096,7 @@ void merlin_state::merlin(machine_config &config)
/* sound hardware */
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker);
- static const s16 speaker_levels[8] = { 0, 0x7fff/3, 0x7fff/3, 0x7fff/3*2, 0x7fff/3, 0x7fff/3*2, 0x7fff/3*2, 0x7fff };
+ static const double speaker_levels[8] = { 0.0, 1.0/3.0, 1.0/3.0, 2.0/3.0, 1.0/3.0, 2.0/3.0, 2.0/3.0, 1.0 };
m_speaker->set_levels(8, speaker_levels);
m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25);
}
@@ -8413,7 +8413,7 @@ void stopthief_state::stopthief(machine_config &config)
/* sound hardware */
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker);
- static const s16 speaker_levels[7] = { 0x7fff/7, 0x7fff/6, 0x7fff/5, 0x7fff/4, 0x7fff/3, 0x7fff/2, 0x7fff/1 };
+ static const double speaker_levels[7] = { 1.0/7.0, 1.0/6.0, 1.0/5.0, 1.0/4.0, 1.0/3.0, 1.0/2.0, 1.0 };
m_speaker->set_levels(7, speaker_levels);
m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25);
}
@@ -8820,9 +8820,8 @@ void lostreas_state::lostreas(machine_config &config)
m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25);
// set volume levels
- static s16 speaker_levels[0x10];
- for (int i = 0; i < 0x10; i++)
- speaker_levels[i] = 0x7fff / (0x10 - i);
+ static const double speaker_levels[0x10] =
+ { 1.0/16.0, 1.0/15.0, 1.0/14.0, 1.0/13.0, 1.0/12.0, 1.0/11.0, 1.0/10.0, 1.0/9.0, 1.0/8.0, 1.0/7.0, 1.0/6.0, 1.0/5.0, 1.0/4.0, 1.0/3.0, 1.0/2.0, 1.0 };
m_speaker->set_levels(16, speaker_levels);
}
@@ -11519,7 +11518,7 @@ void copycat_state::copycat(machine_config &config)
/* sound hardware */
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker);
- static const s16 speaker_levels[4] = { 0, 0x7fff, -0x8000, 0 };
+ static const double speaker_levels[4] = { 0.0, 1.0, -1.0, 0.0 };
m_speaker->set_levels(4, speaker_levels);
m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25);
}
@@ -11609,7 +11608,7 @@ void copycatm2_state::copycatm2(machine_config &config)
/* sound hardware */
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker);
- static const s16 speaker_levels[4] = { 0, 0x7fff, -0x8000, 0 };
+ static const double speaker_levels[4] = { 0.0, 1.0, -1.0, 0 };
m_speaker->set_levels(4, speaker_levels);
m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25);
}
@@ -11694,7 +11693,7 @@ void ditto_state::ditto(machine_config &config)
/* sound hardware */
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker);
- static const s16 speaker_levels[4] = { 0, 0x7fff, -0x8000, 0 };
+ static const double speaker_levels[4] = { 0.0, 1.0, -1.0, 0 };
m_speaker->set_levels(4, speaker_levels);
m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25);
}
diff --git a/src/mame/drivers/hh_ucom4.cpp b/src/mame/drivers/hh_ucom4.cpp
index 33c68e23a51..c6c778bb9b3 100644
--- a/src/mame/drivers/hh_ucom4.cpp
+++ b/src/mame/drivers/hh_ucom4.cpp
@@ -323,7 +323,7 @@ void ufombs_state::ufombs(machine_config &config)
/* sound hardware */
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker);
- static const s16 speaker_levels[] = { 0, 0x7fff, -0x8000, 0 };
+ static const double speaker_levels[] = { 0.0, 1.0, -1.0, 0.0 };
m_speaker->set_levels(4, speaker_levels);
m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25);
}
@@ -479,7 +479,7 @@ void ssfball_state::ssfball(machine_config &config)
/* sound hardware */
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker);
- static const s16 speaker_levels[] = { 0, 0x7fff, -0x8000, 0 };
+ static const double speaker_levels[] = { 0.0, 1.0, -1.0, 0.0 };
m_speaker->set_levels(4, speaker_levels);
m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25);
}
@@ -902,7 +902,7 @@ void splasfgt_state::splasfgt(machine_config &config)
/* sound hardware */
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker);
- static const s16 speaker_levels[] = { 0, 0x7fff, -0x8000, 0 };
+ static const double speaker_levels[] = { 0.0, 1.0, -1.0, 0.0 };
m_speaker->set_levels(4, speaker_levels);
m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25);
}
diff --git a/src/mame/drivers/meritum.cpp b/src/mame/drivers/meritum.cpp
index a91fc301bf8..6be63729eea 100644
--- a/src/mame/drivers/meritum.cpp
+++ b/src/mame/drivers/meritum.cpp
@@ -354,7 +354,7 @@ void meritum_state::port_ff_w(u8 data)
if (!init)
{
init = 1;
- static int16_t speaker_levels[4] = { 0, -32767, 0, 32767 };
+ static double const speaker_levels[4] = { 0.0, -1.0, 0.0, 1.0 };
m_speaker->set_levels(4, speaker_levels);
}
}
diff --git a/src/mame/drivers/pokemini.cpp b/src/mame/drivers/pokemini.cpp
index 34a62148174..70205b76e24 100644
--- a/src/mame/drivers/pokemini.cpp
+++ b/src/mame/drivers/pokemini.cpp
@@ -1747,7 +1747,7 @@ void pokemini_state::device_timer(emu_timer &timer, device_timer_id id, int para
}
-static const int16_t speaker_levels[] = {-32768, 0, 32767};
+static const double speaker_levels[] = {-1.0, 0.0, 1.0};
void pokemini_state::video_start()
{
diff --git a/src/mame/drivers/tasc.cpp b/src/mame/drivers/tasc.cpp
index 7a6d2efa96f..097be9d0600 100644
--- a/src/mame/drivers/tasc.cpp
+++ b/src/mame/drivers/tasc.cpp
@@ -239,7 +239,7 @@ void tasc_state::tasc(machine_config &config)
/* sound hardware */
SPEAKER(config, "mono").front_center();
- static const int16_t speaker_levels[4] = { 0, 32767, -32768, 0 };
+ static const double speaker_levels[4] = { 0.0, 1.0, -1.0, 0.0 };
SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.75);
m_speaker->set_levels(4, speaker_levels);
}
diff --git a/src/mame/drivers/vtech1.cpp b/src/mame/drivers/vtech1.cpp
index bb69f550b54..934c86000ce 100644
--- a/src/mame/drivers/vtech1.cpp
+++ b/src/mame/drivers/vtech1.cpp
@@ -395,7 +395,7 @@ INPUT_PORTS_END
MACHINE DRIVERS
***************************************************************************/
-static const int16_t speaker_levels[] = {-32768, 0, 32767, 0};
+static const double speaker_levels[] = {-1.0, 0.0, 1.0, 0.0};
void vtech1_state::laser110(machine_config &config)
{
diff --git a/src/mame/machine/trs80.cpp b/src/mame/machine/trs80.cpp
index 99deddaafb4..898ff364550 100644
--- a/src/mame/machine/trs80.cpp
+++ b/src/mame/machine/trs80.cpp
@@ -199,7 +199,7 @@ void trs80_state::port_ff_w(uint8_t data)
if (!init)
{
init = 1;
- static int16_t speaker_levels[4] = { 0, -32767, 0, 32767 };
+ static double speaker_levels[4] = { 0.0, -1.0, 0.0, 1.0 };
m_speaker->set_levels(4, speaker_levels);
}