Browse Source

Added diagnostics to see how often the parameters have been set. Added a somewhat hacky way to avoid doing the parameter updates if not needed, using raw memory comparison.

tags/v100_p5
xenakios 8 years ago
parent
commit
d442e2eaea
3 changed files with 11 additions and 1 deletions
  1. +6
    -0
      Source/PS_Source/StretchSource.cpp
  2. +1
    -0
      Source/PS_Source/StretchSource.h
  3. +4
    -1
      Source/PluginEditor.cpp

+ 6
- 0
Source/PS_Source/StretchSource.cpp View File

@@ -382,6 +382,8 @@ double StretchAudioSource::getInfileLengthSeconds()

void StretchAudioSource::setRate(double rate)
{
if (rate == m_playrate)
return;
std::lock_guard<std::mutex> locker(m_mutex);
//if (rate != m_lastplayrate)
{
@@ -394,16 +396,20 @@ void StretchAudioSource::setRate(double rate)
m_stretchers[i]->set_rap((float)rate);
}
}
++m_param_change_count;
}

void StretchAudioSource::setProcessParameters(ProcessParameters * pars)
{
if (memcmp(pars, &m_ppar, sizeof(ProcessParameters)) == 0)
return;
std::lock_guard<std::mutex> locker(m_mutex);
m_ppar = *pars;
for (int i = 0; i < m_stretchers.size(); ++i)
{
m_stretchers[i]->set_parameters(pars);
}
++m_param_change_count;
}

ProcessParameters StretchAudioSource::getProcessParameters()


+ 1
- 0
Source/PS_Source/StretchSource.h View File

@@ -91,6 +91,7 @@ public:
void setLoopingEnabled(bool b);
void setMaxLoops(int64_t numloops) { m_maxloops = numloops; }
void setAudioBufferAsInputSource(AudioBuffer<float>* buf, int sr, int len);
int m_param_change_count = 0;
private:
CircularBuffer<float> m_stretchoutringbuf{ 1024 * 1024 };
AudioBuffer<float> m_file_inbuf;


+ 4
- 1
Source/PluginEditor.cpp View File

@@ -96,7 +96,10 @@ void PaulstretchpluginAudioProcessorEditor::timerCallback(int id)
e->updateComponent();
if (processor.isRecordingEnabled() != m_rec_enable.getToggleState())
m_rec_enable.setToggleState(processor.isRecordingEnabled(), dontSendNotification);
m_info_label.setText(String(processor.getRecordingPositionPercent()*100.0, 1),dontSendNotification);
if (processor.isRecordingEnabled())
m_info_label.setText(String(processor.getRecordingPositionPercent()*100.0, 1),dontSendNotification);
else
m_info_label.setText(String(processor.m_control->getStretchAudioSource()->m_param_change_count), dontSendNotification);
}
}



Loading…
Cancel
Save