diff options
author | Jörg Müller <nexyon@gmail.com> | 2020-12-24 12:41:48 +0300 |
---|---|---|
committer | Jörg Müller <nexyon@gmail.com> | 2020-12-24 12:42:16 +0300 |
commit | 58c697a9ecebdebfec2c50de49946908bd444070 (patch) | |
tree | b65931b2a51b3b7dd51afdfb8a9943c91bd1c7c2 /extern | |
parent | 83ad35cb9c41c7e7df5ff239e5c2232742f4d5b6 (diff) |
Audaspace: port accuracy improvement from upstream.
Diffstat (limited to 'extern')
-rw-r--r-- | extern/audaspace/src/sequence/SequenceHandle.cpp | 7 |
1 files 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 <mutex> #define KEEP_TIME 10 +#define POSITION_EPSILON (1.0 / static_cast<double>(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; |