diff options
Diffstat (limited to 'src/devices/sound/nile.cpp')
-rw-r--r-- | src/devices/sound/nile.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/devices/sound/nile.cpp b/src/devices/sound/nile.cpp index aeaeeaca59c..345c88f2bf0 100644 --- a/src/devices/sound/nile.cpp +++ b/src/devices/sound/nile.cpp @@ -68,7 +68,7 @@ nile_device::nile_device(const machine_config &mconfig, const char *tag, device_ void nile_device::device_start() { - m_stream = stream_alloc_legacy(0, 2, 44100); + m_stream = stream_alloc(0, 2, 44100); save_item(NAME(m_sound_regs)); save_item(NAME(m_vpos)); save_item(NAME(m_frac)); @@ -78,23 +78,24 @@ void nile_device::device_start() //------------------------------------------------- -// sound_stream_update_legacy - handle update requests +// sound_stream_update - handle update requests // for our sound stream //------------------------------------------------- -void nile_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void nile_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { uint8_t *sound_ram = &m_sound_ram[0]; int v, i, snum; uint16_t *slot; - int32_t mix[48000*2]; + int32_t mix[4800*2]; int32_t *mixp; int16_t sample; int sptr, eptr, freq, lsptr, leptr; lsptr=leptr=0; - memset(mix, 0, sizeof(mix[0])*samples*2); + sound_assert(outputs[0].samples() * 2 < ARRAY_LENGTH(mix)); + std::fill_n(&mix[0], outputs[0].samples()*2, 0); for (v = 0; v < NILE_VOICES; v++) { @@ -111,7 +112,7 @@ void nile_device::sound_stream_update_legacy(sound_stream &stream, stream_sample lsptr = slot[NILE_REG_LSPTR_HI]<<16 | slot[NILE_REG_LSPTR_LO]; leptr = slot[NILE_REG_LEPTR_HI]<<16 | slot[NILE_REG_LEPTR_LO]; - for (snum = 0; snum < samples; snum++) + for (snum = 0; snum < outputs[0].samples(); snum++) { sample = sound_ram[sptr + m_vpos[v]]<<8; @@ -159,10 +160,10 @@ void nile_device::sound_stream_update_legacy(sound_stream &stream, stream_sample } } 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 * 16); + outputs[1].put_int(i, *mixp++, 32768 * 16); } } |