netlist: fix artificial clicks in streaming sound device. (nw)

This commit is contained in:
couriersud 2019-03-16 18:03:35 +01:00
parent 4a9428a039
commit bfd8b4108a

View File

@ -315,6 +315,16 @@ public:
}
}
ATTR_HOT void sound_update_fill(int samples)
{
if (samples > m_bufsize)
throw emu_fatalerror("sound %s: pos %d exceeded bufsize %d\n", name().c_str(), samples, m_bufsize);
while (m_last_pos < samples )
{
m_buffer[m_last_pos++] = (stream_sample_t) m_cur;
}
}
NETLIB_UPDATEI()
{
nl_double val = m_in() * m_mult() + m_offset();
@ -334,7 +344,6 @@ public:
{
m_last_pos = 0;
m_last_buffer_time = upto;
m_cur = 0.0;
}
netlist::param_int_t m_channel;
@ -1194,7 +1203,7 @@ void netlist_mame_sound_device::sound_stream_update(sound_stream &stream, stream
for (auto &e : m_out)
{
e.second->sound_update(cur);
e.second->sound_update_fill(samples);
e.second->buffer_reset(cur);
}
}