Cleanups
This commit is contained in:
parent
fb710e0ec7
commit
89c1944fc4
@ -128,35 +128,6 @@ void StretchAudioSource::setFreeFilterEnvelope(shared_envelope env)
|
||||
}
|
||||
}
|
||||
|
||||
ValueTree StretchAudioSource::getStateTree()
|
||||
{
|
||||
ValueTree tree("stretchsourcestate");
|
||||
storeToTreeProperties(tree, nullptr, "pitch_shift", m_ppar.pitch_shift.cents,
|
||||
"octaves_minus2", m_ppar.octave.om2,
|
||||
"octaves_minus1",m_ppar.octave.om1,
|
||||
"octave0",m_ppar.octave.o0,
|
||||
"octave_plus1",m_ppar.octave.o1,
|
||||
"octaves_plus15",m_ppar.octave.o15,
|
||||
"octaves_plus2",m_ppar.octave.o2);
|
||||
return tree;
|
||||
}
|
||||
|
||||
void StretchAudioSource::setStateTree(ValueTree state)
|
||||
{
|
||||
ScopedLock locker(m_cs);
|
||||
getFromTreeProperties(state, "pitch_shift", m_ppar.pitch_shift.cents,
|
||||
"octaves_minus2", m_ppar.octave.om2,
|
||||
"octaves_minus1", m_ppar.octave.om1,
|
||||
"octave0", m_ppar.octave.o0,
|
||||
"octave_plus1", m_ppar.octave.o1,
|
||||
"octaves_plus15", m_ppar.octave.o15,
|
||||
"octaves_plus2", m_ppar.octave.o2);
|
||||
for (int i = 0; i < m_stretchers.size(); ++i)
|
||||
{
|
||||
m_stretchers[i]->set_parameters(&m_ppar);
|
||||
}
|
||||
}
|
||||
|
||||
bool StretchAudioSource::isLoopingEnabled()
|
||||
{
|
||||
if (m_inputfile == nullptr || m_inputfile->info.nsamples == 0)
|
||||
|
@ -89,8 +89,6 @@ public:
|
||||
|
||||
void setFreeFilterEnvelope(shared_envelope env);
|
||||
|
||||
ValueTree getStateTree();
|
||||
void setStateTree(ValueTree state);
|
||||
void setClippingEnabled(bool b) { m_clip_output = b; }
|
||||
bool isLoopingEnabled();
|
||||
void setLoopingEnabled(bool b);
|
||||
|
@ -85,16 +85,12 @@ 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);
|
||||
}
|
||||
|
||||
template<typename... Ts>
|
||||
inline void storeToTreeProperties(ValueTree dest, UndoManager* uman, juce::Identifier varname, var val, Ts&&... args)
|
||||
{
|
||||
dest.setProperty(varname, val, uman);
|
||||
storeToTreeProperties(dest, uman, args...);
|
||||
if constexpr(sizeof...(Ts)>1)
|
||||
storeToTreeProperties(dest, uman, args...);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
@ -135,19 +131,13 @@ inline void storeToTreeProperties(ValueTree dest, UndoManager* uman, const Owned
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline void getFromTreeProperties(ValueTree src, juce::Identifier varname, T& val)
|
||||
{
|
||||
if (src.hasProperty(varname))
|
||||
val = src.getProperty(varname);
|
||||
}
|
||||
|
||||
template<typename... Ts, typename T>
|
||||
inline void getFromTreeProperties(ValueTree src, juce::Identifier varname, T& val, Ts&... args)
|
||||
{
|
||||
if (src.hasProperty(varname))
|
||||
val = src.getProperty(varname);
|
||||
getFromTreeProperties(src, args...);
|
||||
if constexpr(sizeof...(Ts)>1)
|
||||
getFromTreeProperties(src, args...);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
Loading…
Reference in New Issue
Block a user