From 58c697a9ecebdebfec2c50de49946908bd444070 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20M=C3=BCller?= Date: Thu, 24 Dec 2020 10:41:48 +0100 Subject: Audaspace: port accuracy improvement from upstream. --- extern/audaspace/src/sequence/SequenceHandle.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/extern/audaspace/src/sequence/SequenceHandle.cpp b/extern/audaspace/src/sequence/SequenceHandle.cpp index 0437b05c85d..fca4e805df2 100644 --- a/extern/audaspace/src/sequence/SequenceHandle.cpp +++ b/extern/audaspace/src/sequence/SequenceHandle.cpp @@ -22,6 +22,7 @@ #include #define KEEP_TIME 10 +#define POSITION_EPSILON (1.0 / static_cast(RATE_48000)) AUD_NAMESPACE_BEGIN @@ -64,7 +65,7 @@ bool SequenceHandle::updatePosition(double position) if(m_handle.get()) { // we currently have a handle, let's check where we are - if(position >= m_entry->m_end) + if(position - POSITION_EPSILON >= m_entry->m_end) { if(position >= m_entry->m_end + KEEP_TIME) // far end, stopping @@ -76,7 +77,7 @@ bool SequenceHandle::updatePosition(double position) return true; } } - else if(position >= m_entry->m_begin) + else if(position + POSITION_EPSILON >= m_entry->m_begin) { // inside, resuming m_handle->resume(); @@ -98,7 +99,7 @@ bool SequenceHandle::updatePosition(double position) else { // we don't have a handle, let's start if we should be playing - if(position >= m_entry->m_begin && position <= m_entry->m_end) + if(position + POSITION_EPSILON >= m_entry->m_begin && position - POSITION_EPSILON <= m_entry->m_end) { start(); return m_valid; -- cgit v1.2.3