diff options
Diffstat (limited to 'src/devices/sound/tms5110.cpp')
-rw-r--r-- | src/devices/sound/tms5110.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/devices/sound/tms5110.cpp b/src/devices/sound/tms5110.cpp index d9d8427688a..5782aa905af 100644 --- a/src/devices/sound/tms5110.cpp +++ b/src/devices/sound/tms5110.cpp @@ -1048,7 +1048,7 @@ void tms5110_device::device_start() m_data_cb.resolve(); /* initialize a stream */ - m_stream = machine().sound().stream_alloc(*this, 0, 1, clock() / 80); + m_stream = stream_alloc(0, 1, clock() / 80); m_state = CTL_STATE_INPUT; /* most probably not defined */ m_romclk_hack_timer = timer_alloc(0); @@ -1223,24 +1223,22 @@ int tms5110_device::romclk_hack_r() // sound_stream_update - handle a stream update //------------------------------------------------- -void tms5110_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +void tms5110_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { int16_t sample_data[MAX_SAMPLE_CHUNK]; - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; /* loop while we still have samples to generate */ - while (samples) + for (int sampindex = 0; sampindex < buffer.samples(); ) { - int length = (samples > MAX_SAMPLE_CHUNK) ? MAX_SAMPLE_CHUNK : samples; - int index; + int length = buffer.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 (index = 0; index < length; index++) - *buffer++ = sample_data[index]; - - /* account for the samples */ - samples -= length; + for (int index = 0; index < length; index++) + buffer.put_int(sampindex++, sample_data[index], 32768); } } |