summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author arbee <rb6502@users.noreply.github.com>2020-09-24 08:49:38 -0400
committer arbee <rb6502@users.noreply.github.com>2020-09-24 08:49:38 -0400
commit2fb9f38b83270cac34428738313cd2eee79f421e (patch)
tree30ff4027baa21af27b78bfe87887265b0b2bd32f /src
parent194ba382d333e2a71ed14aed7bf5addac93c5016 (diff)
es5503: use put_int for sample scaling, use fill_n for faster clear [R. Belmont]
Diffstat (limited to 'src')
-rw-r--r--src/devices/sound/es5503.cpp14
-rw-r--r--src/devices/sound/es5503.h3
2 files changed, 10 insertions, 7 deletions
diff --git a/src/devices/sound/es5503.cpp b/src/devices/sound/es5503.cpp
index 835305a3d80..ec176b2b369 100644
--- a/src/devices/sound/es5503.cpp
+++ b/src/devices/sound/es5503.cpp
@@ -129,14 +129,13 @@ void es5503_device::halt_osc(int onum, int type, uint32_t *accumulator, int ress
}
void es5503_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- static int32_t mix[(44100/60)*2*8];
int32_t *mixp;
int osc, snum, i;
uint32_t ramptr;
int samples = outputs[0].samples();
assert(samples < (44100/60)*2);
- memset(mix, 0, sizeof(mix));
+ std::fill_n(&m_mix_buffer[0], samples*output_channels, 0);
for (int chan = 0; chan < output_channels; chan++)
{
@@ -155,7 +154,7 @@ void es5503_device::sound_stream_update(sound_stream &stream, std::vector<read_s
int8_t data = -128;
int resshift = resshifts[pOsc->resolution] - pOsc->wavetblsize;
uint32_t sizemask = accmasks[pOsc->wavetblsize];
- mixp = &mix[0] + chan;
+ mixp = &m_mix_buffer[0] + chan;
for (snum = 0; snum < samples; snum++)
{
@@ -197,11 +196,14 @@ void es5503_device::sound_stream_update(sound_stream &stream, std::vector<read_s
}
}
}
- mixp = &mix[0];
- constexpr stream_buffer::sample_t sample_scale = 1.0 / (32768.0 * 8.0);
+ mixp = &m_mix_buffer[0];
for (int chan = 0; chan < output_channels; chan++)
+ {
for (i = 0; i < outputs[chan].samples(); i++)
- outputs[chan].put(i, stream_buffer::sample_t(*mixp++) * sample_scale);
+ {
+ outputs[chan].put_int(i, *mixp++, 32768*8);
+ }
+ }
}
diff --git a/src/devices/sound/es5503.h b/src/devices/sound/es5503.h
index 66339fda467..4fa3ab21931 100644
--- a/src/devices/sound/es5503.h
+++ b/src/devices/sound/es5503.h
@@ -84,7 +84,8 @@ private:
uint32_t output_rate;
emu_timer *m_timer;
- std::vector<int32_t> m_mix_buffer;
+
+ int32_t m_mix_buffer[(44100/60)*2*8];
void halt_osc(int onum, int type, uint32_t *accumulator, int resshift);
};