diff options
Diffstat (limited to 'src/devices/sound/segapcm.cpp')
-rw-r--r-- | src/devices/sound/segapcm.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/devices/sound/segapcm.cpp b/src/devices/sound/segapcm.cpp index 6daa0339de2..81f6ceffec9 100644 --- a/src/devices/sound/segapcm.cpp +++ b/src/devices/sound/segapcm.cpp @@ -20,7 +20,7 @@ DEFINE_DEVICE_TYPE(SEGAPCM, segapcm_device, "segapcm", "Sega PCM") segapcm_device::segapcm_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, SEGAPCM, tag, owner, clock) , device_sound_interface(mconfig, *this) - , device_rom_interface(mconfig, *this, 21) + , device_rom_interface(mconfig, *this) , m_ram(nullptr) , m_bankshift(12) , m_bankmask(0x70) @@ -58,10 +58,11 @@ void segapcm_device::device_clock_changed() //------------------------------------------------- -// rom_bank_updated - the rom bank has changed +// rom_bank_pre_change - refresh the stream if the +// ROM banking changes //------------------------------------------------- -void segapcm_device::rom_bank_updated() +void segapcm_device::rom_bank_pre_change() { m_stream->update(); } @@ -71,12 +72,8 @@ void segapcm_device::rom_bank_updated() // sound_stream_update - handle a stream update //------------------------------------------------- -void segapcm_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +void segapcm_device::sound_stream_update(sound_stream &stream) { - /* clear the buffers */ - memset(outputs[0], 0, samples*sizeof(*outputs[0])); - memset(outputs[1], 0, samples*sizeof(*outputs[1])); - // reg function // ------------------------------------------------ // 0x00 ? @@ -113,7 +110,7 @@ void segapcm_device::sound_stream_update(sound_stream &stream, stream_sample_t * int i; /* loop over samples on this channel */ - for (i = 0; i < samples; i++) + for (i = 0; i < stream.samples(); i++) { int8_t v; @@ -132,8 +129,8 @@ void segapcm_device::sound_stream_update(sound_stream &stream, stream_sample_t * 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); + stream.add_int(0, i, v * (regs[2] & 0x7f), 32768); + stream.add_int(1, i, v * (regs[3] & 0x7f), 32768); addr = (addr + regs[7]) & 0xffffff; } @@ -146,14 +143,14 @@ void segapcm_device::sound_stream_update(sound_stream &stream, stream_sample_t * } -WRITE8_MEMBER( segapcm_device::sega_pcm_w ) +void segapcm_device::write(offs_t offset, uint8_t data) { m_stream->update(); m_ram[offset & 0x07ff] = data; } -READ8_MEMBER( segapcm_device::sega_pcm_r ) +uint8_t segapcm_device::read(offs_t offset) { m_stream->update(); return m_ram[offset & 0x07ff]; |