diff options
Diffstat (limited to 'src/emu/sound.cpp')
-rw-r--r-- | src/emu/sound.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/emu/sound.cpp b/src/emu/sound.cpp index 88cdade710d..c1932099be6 100644 --- a/src/emu/sound.cpp +++ b/src/emu/sound.cpp @@ -15,7 +15,7 @@ #include "config.h" #include "wavwrite.h" - +#include <vector> //************************************************************************** // DEBUGGING @@ -560,6 +560,7 @@ sound_stream::sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output m_synchronous((flags & STREAM_SYNCHRONOUS) != 0), m_resampling_disabled((flags & STREAM_DISABLE_INPUT_RESAMPLING) != 0), m_sync_timer(nullptr), + m_last_update_end_time(attotime::zero), m_input(inputs), m_input_view(inputs), m_empty_buffer(100), @@ -578,8 +579,10 @@ sound_stream::sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output // create a unique tag for saving std::string state_tag = string_format("%d", m_device.machine().sound().unique_id()); auto &save = m_device.machine().save(); - save.save_item(&m_device, "stream.sample_rate", state_tag.c_str(), 0, NAME(m_sample_rate)); + save.save_item(&m_device, "stream.sound_stream", state_tag.c_str(), 0, NAME(m_sample_rate)); + save.save_item(&m_device, "stream.sound_stream", state_tag.c_str(), 0, NAME(m_last_update_end_time)); save.register_postload(save_prepost_delegate(FUNC(sound_stream::postload), this)); + save.register_presave(save_prepost_delegate(FUNC(sound_stream::presave), this)); // initialize all inputs for (unsigned int inputnum = 0; inputnum < m_input.size(); inputnum++) @@ -857,14 +860,24 @@ void sound_stream::sample_rate_changed() void sound_stream::postload() { - // set the end time of all of our streams to now + // set the end time of all of our streams to the value saved in m_last_update_end_time for (auto &output : m_output) - output.set_end_time(m_device.machine().time()); + output.set_end_time(m_last_update_end_time); // recompute the sample rate information sample_rate_changed(); } +//------------------------------------------------- +// presave - save/restore callback +//------------------------------------------------- + +void sound_stream::presave() +{ + // save the stream end time + m_last_update_end_time = m_output[0].end_time(); +} + //------------------------------------------------- // reprime_sync_timer - set up the next sync |