From 3a8da6de0cc749cd33183da5cf6a5ce3fca90dfc Mon Sep 17 00:00:00 2001 From: xenakios Date: Fri, 23 Feb 2018 20:46:51 +0200 Subject: [PATCH] Make seeking work again. Some variadic template, fold expression etc trickery for value tree etc. Readme change. --- Source/PS_Source/Input/AInputS.h | 6 ++++-- Source/PS_Source/globals.h | 29 +++++++++++++++++++---------- readme.txt | 4 ++-- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/Source/PS_Source/Input/AInputS.h b/Source/PS_Source/Input/AInputS.h index f09883e..8eaeec4 100644 --- a/Source/PS_Source/Input/AInputS.h +++ b/Source/PS_Source/Input/AInputS.h @@ -280,6 +280,8 @@ public: } void seek(double pos) override //0=start,1.0=end { + seekImpl(pos); + /* std::lock_guard locker(m_mutex); if (m_seekfade.state == 0) { @@ -288,9 +290,9 @@ public: } m_seekfade.length = 16384; m_seekfade.requestedpos = pos; - - + */ } + std::pair,Range> getCachedRangesNormalized() { if (m_afreader == nullptr) diff --git a/Source/PS_Source/globals.h b/Source/PS_Source/globals.h index 55fc5ea..fe89fc7 100644 --- a/Source/PS_Source/globals.h +++ b/Source/PS_Source/globals.h @@ -71,6 +71,12 @@ const int g_maxnumoutchans = 32; //#define USE_LUA_SCRIPTING #endif +template +inline bool hasProperties(ValueTree src, Args&&... args) +{ + return (src.hasProperty(args) && ...); +} + inline void storeToTreeProperties(ValueTree dest, UndoManager* uman, juce::Identifier varname, var val) { dest.setProperty(varname, val, uman); @@ -123,10 +129,13 @@ inline void getFromTreeProperties(ValueTree src, juce::Identifier varname, T& va template inline void getFromTreeProperties(ValueTree src, juce::Identifier varname, Range& rng) { - if (src.hasProperty(varname + "_start") && src.hasProperty(varname + "_end")) + if (hasProperties(src, varname + "_start", varname + "_end")) { - rng.setStart(src.getProperty(varname + "_start")); - rng.setEnd(src.getProperty(varname + "_end")); + rng = { src.getProperty(varname + "_start") , src.getProperty(varname + "_end") }; + } + else + { + jassert(false); } } @@ -150,6 +159,12 @@ inline void timeCall(String msgprefix,F&& f) Logger::writeToLog(formatted(msgprefix, " took " , t1 - t0 , " ms")); } +template +inline void fill_container(Cont& c, const T& x) +{ + std::fill(std::begin(c), std::end(c), x); +} + template class CircularBuffer final { @@ -163,7 +178,7 @@ public: m_avail = 0; m_readpos = 0; m_writepos = 0; - std::fill(m_buf.begin(), m_buf.end(), T()); + fill_container(m_buf, T()); } void push(T x) { @@ -214,12 +229,6 @@ private: std::vector m_buf; }; -template -inline void fill_container(Cont& c, const T& x) -{ - std::fill(std::begin(c), std::end(c), x); -} - template inline void callGUI(T* ap, F&& f, bool async) { diff --git a/readme.txt b/readme.txt index 7d7bb3a..8a592d8 100644 --- a/readme.txt +++ b/readme.txt @@ -9,10 +9,10 @@ Released under GNU General Public License v.2 license. History : 02-23-2018 1.0.2 - -Show approximate stretched output duration in info label (only valid if the stretch amount is not automated in the host) -Added stretch processing bypass parameter (to play the original sound looped like it is passed into the stretcher) + -Show approximate stretched output duration in info label (only valid if the stretch amount is not automated in the host) -Waveform selection can be moved by dragging the selection top area - -Smoothed playback with fades when changing waveform selection + -Smoothed playback with fades when changing waveform selection (doesn't work ideally, fixing later...) -Fixes for the waveform graphics disappearing unexpectedly (this probably still isn't entirely fixed, though) 02-16-2018 1.0.1 -Increased maximum number of input channels to 8