summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2021-06-07 15:51:41 -0700
committer Aaron Giles <aaron@aarongiles.com>2021-06-07 15:51:41 -0700
commita35a7dd397accf1e85ebefaf9e4235eb6a26cc20 (patch)
tree4b9221e8578a3f5b35ecec737b74030948f68f91
parent04ab059f27c2a3e722e77f41a4f47e91ecbd04bd (diff)
Better fix for wavwrite length.time-experiments2
-rw-r--r--src/emu/machine.cpp1
-rw-r--r--src/emu/sound.cpp12
-rw-r--r--src/emu/sound.h1
3 files changed, 3 insertions, 11 deletions
diff --git a/src/emu/machine.cpp b/src/emu/machine.cpp
index cb0fad50a65..76661129cb6 100644
--- a/src/emu/machine.cpp
+++ b/src/emu/machine.cpp
@@ -910,6 +910,7 @@ void running_machine::scheduled_event(int event)
{
// flush out the sound, handle auto-save and final snapshot, then force an immediate stop
case EVENT_EXIT:
+ m_sound->update();
if (options().autosave() && (m_system.flags & MACHINE_SUPPORTS_SAVE) && this->time() > attotime::zero)
immediate_save("auto");
if (options().seconds_to_run() != 0)
diff --git a/src/emu/sound.cpp b/src/emu/sound.cpp
index 87c8cea37f3..e552ff5ffc1 100644
--- a/src/emu/sound.cpp
+++ b/src/emu/sound.cpp
@@ -1102,7 +1102,7 @@ sound_manager::sound_manager(running_machine &machine) :
// start the periodic update flushing timer
m_update_timer.init(machine.scheduler(), *this, FUNC(sound_manager::update));
- m_update_timer.adjust(STREAMS_UPDATE_ATTOTIME);
+ m_update_timer.adjust(STREAMS_UPDATE_ATTOTIME, 0, STREAMS_UPDATE_ATTOTIME);
}
@@ -1591,15 +1591,5 @@ void sound_manager::update()
// notify that new samples have been generated
emulator_info::sound_hook();
- // adjust ourselves for next time; to keep things precisely on the second,
- // we check for overflow into the next second and ensure that it ends up
- // at 0 in the fractional part (due to rounding it will be slightly over
- // otherwise)
- attotime const &curr = m_update_timer.expire();
- attotime next = curr + STREAMS_UPDATE_ATTOTIME;
- if (next.seconds() != curr.seconds())
- next = attotime(next.seconds(), subseconds::zero());
- m_update_timer.adjust_absolute(next);
-
g_profiler.stop();
}
diff --git a/src/emu/sound.h b/src/emu/sound.h
index 5c6371462da..239468010f4 100644
--- a/src/emu/sound.h
+++ b/src/emu/sound.h
@@ -737,6 +737,7 @@ struct mixer_input
class sound_manager
{
+ friend class running_machine;
friend class sound_stream;
// reasons for muting