From b179285b934d0ed5dbf5c9eaa20120fe93821867 Mon Sep 17 00:00:00 2001 From: xenakios Date: Wed, 31 Jan 2018 20:06:12 +0200 Subject: [PATCH] Added method to sound source to get playback position percent. Avoid seeking sound source when changing FFT size. Readme change. --- Source/PS_Source/Input/InputS.h | 1 + Source/PS_Source/StretchSource.cpp | 3 ++- readme.txt | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Source/PS_Source/Input/InputS.h b/Source/PS_Source/Input/InputS.h index 7742178..c729ce7 100644 --- a/Source/PS_Source/Input/InputS.h +++ b/Source/PS_Source/Input/InputS.h @@ -75,6 +75,7 @@ public: bool isLooping() { return m_loop_enabled; } virtual void setLoopEnabled(bool b) = 0; int64_t getCurrentPosition() { return m_currentsample; } + double getCurrentPositionPercent() { return 1.0 / info.nsamples*m_currentsample; } virtual bool hasEnded() { return m_currentsample >= info.nsamples*m_activerange.getEnd(); diff --git a/Source/PS_Source/StretchSource.cpp b/Source/PS_Source/StretchSource.cpp index 50ecf2f..06e64f3 100644 --- a/Source/PS_Source/StretchSource.cpp +++ b/Source/PS_Source/StretchSource.cpp @@ -399,7 +399,8 @@ void StretchAudioSource::initObjects() { ScopedLock locker(m_cs); m_inputfile->setActiveRange(m_playrange); - m_inputfile->seek(m_playrange.getStart()); + if (m_inputfile->getActiveRange().contains(m_inputfile->getCurrentPositionPercent())==false) + m_inputfile->seek(m_playrange.getStart()); m_firstbuffer = true; if (m_stretchoutringbuf.getSize() < m_num_outchans*m_process_fftsize) diff --git a/readme.txt b/readme.txt index 665168a..6a17eef 100644 --- a/readme.txt +++ b/readme.txt @@ -44,10 +44,11 @@ History : provide the file name of the source of audio file, so audio clip/event/item specific audio won't be imported) -Removed an unnecessary level of buffering (doesn't reduce latency but should help a bit with CPU usage) -Added About window -01-30-2018 1.0.0 preview 5 +01-31-2018 1.0.0 preview 5 -Added buttons to enable/disable spectral processing steps -Restored ability to set capture buffer length (via the settings menu) -Seek to play range beginning when audio file imported + -No longer seeks to beginning of play range when changing FFT size -Fixes to waveform display issues -Double click on waveform selects whole waveform