Use std::atomic_load for most calls to Oscillator::userWaveSample
This commit is contained in:
@@ -118,7 +118,8 @@ EnvelopeAndLfoParameters::EnvelopeAndLfoParameters(
|
||||
m_controlEnvAmountModel( false, this, tr( "Modulate env amount" ) ),
|
||||
m_lfoFrame( 0 ),
|
||||
m_lfoAmountIsZero( false ),
|
||||
m_lfoShapeData( nullptr )
|
||||
m_lfoShapeData( nullptr ),
|
||||
m_userWave(std::make_shared<SampleBuffer>())
|
||||
{
|
||||
m_amountModel.setCenterValue( 0 );
|
||||
m_lfoAmountModel.setCenterValue( 0 );
|
||||
@@ -221,7 +222,7 @@ inline sample_t EnvelopeAndLfoParameters::lfoShapeSample( fpp_t _frame_offset )
|
||||
shape_sample = Oscillator::sawSample( phase );
|
||||
break;
|
||||
case LfoShape::UserDefinedWave:
|
||||
shape_sample = Oscillator::userWaveSample(m_userWave.get(), phase);
|
||||
shape_sample = Oscillator::userWaveSample(std::atomic_load(&m_userWave).get(), phase);
|
||||
break;
|
||||
case LfoShape::RandomWave:
|
||||
if( frame == 0 )
|
||||
@@ -354,7 +355,9 @@ void EnvelopeAndLfoParameters::saveSettings( QDomDocument & _doc,
|
||||
m_lfoAmountModel.saveSettings( _doc, _parent, "lamt" );
|
||||
m_x100Model.saveSettings( _doc, _parent, "x100" );
|
||||
m_controlEnvAmountModel.saveSettings( _doc, _parent, "ctlenvamt" );
|
||||
_parent.setAttribute("userwavefile", m_userWave->audioFile());
|
||||
|
||||
// TODO C++20: Deprecated, use std::atomic<std::shared_ptr> instead
|
||||
_parent.setAttribute("userwavefile", std::atomic_load(&m_userWave)->audioFile());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -107,7 +107,8 @@ void LfoController::updateValueBuffer()
|
||||
{
|
||||
const float currentSample = m_sampleFunction != nullptr
|
||||
? m_sampleFunction( phase )
|
||||
: Oscillator::userWaveSample(m_userDefSampleBuffer.get(), phase);
|
||||
// TODO C++20: Deprecated, use std::atomic<std::shared_ptr> instead
|
||||
: Oscillator::userWaveSample(std::atomic_load(&m_userDefSampleBuffer).get(), phase);
|
||||
|
||||
f = std::clamp(m_baseModel.value() + (*amountPtr * currentSample / 2.0f), 0.0f, 1.0f);
|
||||
|
||||
|
||||
@@ -814,7 +814,8 @@ inline sample_t Oscillator::getSample<Oscillator::WaveShape::UserDefined>(
|
||||
}
|
||||
else
|
||||
{
|
||||
return userWaveSample(m_userWave.get(), _sample);
|
||||
// TODO C++20: Deprecated, use std::atomic<std::shared_ptr> instead
|
||||
return userWaveSample(std::atomic_load(&m_userWave).get(), _sample);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -486,7 +486,8 @@ void EnvelopeAndLfoView::paintEvent( QPaintEvent * )
|
||||
val = m_randomGraph;
|
||||
break;
|
||||
case EnvelopeAndLfoParameters::LfoShape::UserDefinedWave:
|
||||
val = Oscillator::userWaveSample(m_params->m_userWave.get(), phase);
|
||||
// TODO C++20: Deprecated, use std::atomic<std::shared_ptr> instead
|
||||
val = Oscillator::userWaveSample(std::atomic_load(&m_params->m_userWave).get(), phase);
|
||||
break;
|
||||
}
|
||||
if( static_cast<f_cnt_t>( cur_sample ) <=
|
||||
|
||||
Reference in New Issue
Block a user