Check volume and loop xfade length in setters before entering mutex

This commit is contained in:
xenakios 2017-11-28 16:35:15 +02:00
parent eece70d89b
commit da1fea6850

View File

@ -131,6 +131,8 @@ void StretchAudioSource::setAudioBufferAsInputSource(AudioBuffer<float>* buf, in
void StretchAudioSource::setMainVolume(double decibels) void StretchAudioSource::setMainVolume(double decibels)
{ {
if (decibels == m_main_volume)
return;
std::lock_guard <decltype(m_mutex)> locker(m_mutex); std::lock_guard <decltype(m_mutex)> locker(m_mutex);
m_main_volume = jlimit(-144.0, 12.0, decibels); m_main_volume = jlimit(-144.0, 12.0, decibels);
++m_param_change_count; ++m_param_change_count;
@ -138,6 +140,8 @@ void StretchAudioSource::setMainVolume(double decibels)
void StretchAudioSource::setLoopXFadeLength(double lenseconds) void StretchAudioSource::setLoopXFadeLength(double lenseconds)
{ {
if (lenseconds == m_loopxfadelen)
return;
std::lock_guard <decltype(m_mutex)> locker(m_mutex); std::lock_guard <decltype(m_mutex)> locker(m_mutex);
m_loopxfadelen = jlimit(0.0, 1.0, lenseconds); m_loopxfadelen = jlimit(0.0, 1.0, lenseconds);
++m_param_change_count; ++m_param_change_count;