diff options
author | 2025-04-14 11:31:53 +0200 | |
---|---|---|
committer | 2025-04-14 22:28:31 +0200 | |
commit | cef6157803320544651bfc96457d2f8a6df0abd6 (patch) | |
tree | f8a64867e3d654cdcad5f4c24824ea82e2c77194 /src/devices/sound/spkrdev.cpp | |
parent | 9473c027358e1a2d5c93d240a48052368f9d3b84 (diff) |
New sound infrastructure.sound
Should be added soon:
- mute
- lua hookup (with documentation)
- speaker/microphone resampling
To be added a little later:
- compression
- reverb
Needs to be added by someone else:
- coreaudio
- direct
- portaudio
- xaudio2
- js
Diffstat (limited to 'src/devices/sound/spkrdev.cpp')
-rw-r--r-- | src/devices/sound/spkrdev.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/devices/sound/spkrdev.cpp b/src/devices/sound/spkrdev.cpp index 19d1f1813d6..841656ab4ac 100644 --- a/src/devices/sound/spkrdev.cpp +++ b/src/devices/sound/spkrdev.cpp @@ -187,19 +187,18 @@ void speaker_sound_device::device_post_load() //------------------------------------------------- // This can be triggered by the core (based on emulated time) or via level_w(). -void speaker_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) +void speaker_sound_device::sound_stream_update(sound_stream &stream) { - auto &buffer = outputs[0]; double volume = m_levels[m_level]; double filtered_volume; attotime sampled_time = attotime::zero; - if (buffer.samples() > 0) + if (stream.samples() > 0) { /* Prepare to update time state */ sampled_time = attotime(0, m_channel_sample_period); - if (buffer.samples() > 1) - sampled_time *= buffer.samples(); + if (stream.samples() > 1) + sampled_time *= stream.samples(); /* Note: since the stream is in the process of being updated, * stream->sample_time() will return the time before the update! (MAME 0.130) @@ -207,19 +206,19 @@ void speaker_sound_device::sound_stream_update(sound_stream &stream, std::vector */ } - for (int sampindex = 0; sampindex < buffer.samples(); ) + for (int sampindex = 0; sampindex < stream.samples(); ) { /* Note that first intermediate sample may be composed... */ filtered_volume = update_interm_samples_get_filtered_volume(volume); /* Composite volume is now quantized to the stream resolution */ - buffer.put(sampindex++, filtered_volume); + stream.put(0, sampindex++, filtered_volume); /* Any additional samples will be homogeneous, however may need filtering across samples: */ - while (sampindex < buffer.samples()) + while (sampindex < stream.samples()) { filtered_volume = update_interm_samples_get_filtered_volume(volume); - buffer.put(sampindex++, filtered_volume); + stream.put(0, sampindex++, filtered_volume); } /* Update the time state */ |