Make seeking work again. Some variadic template, fold expression etc trickery for value tree etc. Readme change.

This commit is contained in:
xenakios 2018-02-23 20:46:51 +02:00
parent 3c20facdbc
commit 3a8da6de0c
3 changed files with 25 additions and 14 deletions

View File

@ -280,6 +280,8 @@ public:
} }
void seek(double pos) override //0=start,1.0=end void seek(double pos) override //0=start,1.0=end
{ {
seekImpl(pos);
/*
std::lock_guard<std::mutex> locker(m_mutex); std::lock_guard<std::mutex> locker(m_mutex);
if (m_seekfade.state == 0) if (m_seekfade.state == 0)
{ {
@ -288,9 +290,9 @@ public:
} }
m_seekfade.length = 16384; m_seekfade.length = 16384;
m_seekfade.requestedpos = pos; m_seekfade.requestedpos = pos;
*/
} }
std::pair<Range<double>,Range<double>> getCachedRangesNormalized() std::pair<Range<double>,Range<double>> getCachedRangesNormalized()
{ {
if (m_afreader == nullptr) if (m_afreader == nullptr)

View File

@ -71,6 +71,12 @@ const int g_maxnumoutchans = 32;
//#define USE_LUA_SCRIPTING //#define USE_LUA_SCRIPTING
#endif #endif
template<typename... Args>
inline bool hasProperties(ValueTree src, Args&&... args)
{
return (src.hasProperty(args) && ...);
}
inline void storeToTreeProperties(ValueTree dest, UndoManager* uman, juce::Identifier varname, var val) inline void storeToTreeProperties(ValueTree dest, UndoManager* uman, juce::Identifier varname, var val)
{ {
dest.setProperty(varname, val, uman); dest.setProperty(varname, val, uman);
@ -123,10 +129,13 @@ inline void getFromTreeProperties(ValueTree src, juce::Identifier varname, T& va
template<typename T> template<typename T>
inline void getFromTreeProperties(ValueTree src, juce::Identifier varname, Range<T>& rng) inline void getFromTreeProperties(ValueTree src, juce::Identifier varname, Range<T>& rng)
{ {
if (src.hasProperty(varname + "_start") && src.hasProperty(varname + "_end")) if (hasProperties(src, varname + "_start", varname + "_end"))
{ {
rng.setStart(src.getProperty(varname + "_start")); rng = { src.getProperty(varname + "_start") , src.getProperty(varname + "_end") };
rng.setEnd(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")); Logger::writeToLog(formatted(msgprefix, " took " , t1 - t0 , " ms"));
} }
template<typename Cont, typename T>
inline void fill_container(Cont& c, const T& x)
{
std::fill(std::begin(c), std::end(c), x);
}
template<typename T> template<typename T>
class CircularBuffer final class CircularBuffer final
{ {
@ -163,7 +178,7 @@ public:
m_avail = 0; m_avail = 0;
m_readpos = 0; m_readpos = 0;
m_writepos = 0; m_writepos = 0;
std::fill(m_buf.begin(), m_buf.end(), T()); fill_container(m_buf, T());
} }
void push(T x) void push(T x)
{ {
@ -214,12 +229,6 @@ private:
std::vector<T> m_buf; std::vector<T> m_buf;
}; };
template<typename Cont,typename T>
inline void fill_container(Cont& c, const T& x)
{
std::fill(std::begin(c), std::end(c), x);
}
template<typename T, typename F> template<typename T, typename F>
inline void callGUI(T* ap, F&& f, bool async) inline void callGUI(T* ap, F&& f, bool async)
{ {

View File

@ -9,10 +9,10 @@ Released under GNU General Public License v.2 license.
History : History :
02-23-2018 1.0.2 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) -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 -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) -Fixes for the waveform graphics disappearing unexpectedly (this probably still isn't entirely fixed, though)
02-16-2018 1.0.1 02-16-2018 1.0.1
-Increased maximum number of input channels to 8 -Increased maximum number of input channels to 8