More envelope sustain respon fixes

This commit is contained in:
Oskar Wallgren
2014-01-30 01:01:58 +01:00
parent 4a1417821f
commit ba69e70bdb
2 changed files with 15 additions and 5 deletions

View File

@@ -331,7 +331,7 @@ void EnvelopeAndLfoParameters::saveSettings( QDomDocument & _doc,
m_attackModel.saveSettings( _doc, _parent, "att" );
m_holdModel.saveSettings( _doc, _parent, "hold" );
m_decayModel.saveSettings( _doc, _parent, "dec" );
m_sustainModel.saveSettings( _doc, _parent, "sus" );
m_sustainModel.saveSettings( _doc, _parent, "sustain" );
m_releaseModel.saveSettings( _doc, _parent, "rel" );
m_amountModel.saveSettings( _doc, _parent, "amt" );
m_lfoWaveModel.saveSettings( _doc, _parent, "lshp" );
@@ -353,7 +353,7 @@ void EnvelopeAndLfoParameters::loadSettings( const QDomElement & _this )
m_attackModel.loadSettings( _this, "att" );
m_holdModel.loadSettings( _this, "hold" );
m_decayModel.loadSettings( _this, "dec" );
m_sustainModel.loadSettings( _this, "sus" );
m_sustainModel.loadSettings( _this, "sustain" );
m_releaseModel.loadSettings( _this, "rel" );
m_amountModel.loadSettings( _this, "amt" );
m_lfoWaveModel.loadSettings( _this, "lshp" );
@@ -364,6 +364,16 @@ void EnvelopeAndLfoParameters::loadSettings( const QDomElement & _this )
m_x100Model.loadSettings( _this, "x100" );
m_controlEnvAmountModel.loadSettings( _this, "ctlenvamt" );
/* ### TODO:
Old reversed sustain kept for backward compatibility
with 4.15 file format*/
if( _this.hasAttribute( "sus" ) )
{
m_sustainModel.loadSettings( _this, "sus" );
m_sustainModel.setValue( 1.0 - m_sustainModel.value() );
}
// ### TODO:
/* // Keep compatibility with version 2.1 file format
if( _this.hasAttribute( "lfosyncmode" ) )
@@ -400,7 +410,7 @@ void EnvelopeAndLfoParameters::updateSampleVars()
const f_cnt_t decay_frames = static_cast<f_cnt_t>( frames_per_env_seg *
expKnobVal( m_decayModel.value() *
m_sustainModel.value() ) );
( 1 - m_sustainModel.value() ) ) );
m_sustainLevel = m_sustainModel.value();
m_amount = m_amountModel.value();
@@ -452,7 +462,7 @@ void EnvelopeAndLfoParameters::updateSampleVars()
}
add += hold_frames;
const float dfI = (1.0 / decay_frames)*(m_sustainLevel-1)*m_amount;
const float dfI = ( 1.0 / decay_frames ) * ( m_sustainLevel -1 ) * m_amount;
for( f_cnt_t i = 0; i < decay_frames; ++i )
{
/*

View File

@@ -444,7 +444,7 @@ void EnvelopeAndLfoView::paintEvent( QPaintEvent * )
p.fillRect( x1, y_base - 1 - avail_height, 2, 2, end_points_color );
x1 = x2;
x2 = x1 + static_cast<int>( ( m_decayKnob->value<float>() *
m_sustainKnob->value<float>() ) *
( 1 - m_sustainKnob->value<float>() ) ) *
TIME_UNIT_WIDTH );
p.drawLine( x1, y_base-avail_height, x2, static_cast<int>( y_base -