mirror of
https://github.com/LMMS/lmms.git
synced 2026-03-18 14:08:26 -04:00
Merge pull request #191 from zonkmachine/stable-0.4
Fixed envelope sustain response
This commit is contained in:
@@ -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,9 +410,9 @@ 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 = 1.0f - m_sustainModel.value();
|
||||
m_sustainLevel = m_sustainModel.value();
|
||||
m_amount = m_amountModel.value();
|
||||
if( m_amount >= 0 )
|
||||
{
|
||||
@@ -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 )
|
||||
{
|
||||
/*
|
||||
|
||||
@@ -62,7 +62,7 @@ const int SUSTAIN_KNOB_X = DECAY_KNOB_X+KNOB_X_SPACING;
|
||||
const int RELEASE_KNOB_X = SUSTAIN_KNOB_X+KNOB_X_SPACING;
|
||||
const int AMOUNT_KNOB_X = RELEASE_KNOB_X+KNOB_X_SPACING;
|
||||
|
||||
const float TIME_UNIT_WIDTH = 36.0;
|
||||
const float TIME_UNIT_WIDTH = 35.0;
|
||||
|
||||
|
||||
const int LFO_GRAPH_X = 6;
|
||||
@@ -441,15 +441,15 @@ void EnvelopeAndLfoView::paintEvent( QPaintEvent * )
|
||||
p.drawLine( x1, y_base - avail_height, x2, y_base - avail_height );
|
||||
p.fillRect( x1 - 1, y_base - 2 - avail_height, 4, 4,
|
||||
end_points_bg_color );
|
||||
p.fillRect( x1, y_base-1-avail_height, 2, 2, end_points_color );
|
||||
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 -
|
||||
avail_height +
|
||||
m_sustainKnob->value<float>() * avail_height ) );
|
||||
( 1 - m_sustainKnob->value<float>() ) * avail_height ) );
|
||||
p.fillRect( x1 - 1, y_base - 2 - avail_height, 4, 4,
|
||||
end_points_bg_color );
|
||||
p.fillRect( x1, y_base - 1 - avail_height, 2, 2, end_points_color );
|
||||
@@ -457,14 +457,14 @@ void EnvelopeAndLfoView::paintEvent( QPaintEvent * )
|
||||
x2 = x1 + static_cast<int>( m_releaseKnob->value<float>() * TIME_UNIT_WIDTH );
|
||||
|
||||
p.drawLine( x1, static_cast<int>( y_base - avail_height +
|
||||
m_sustainKnob->value<float>() *
|
||||
( 1 - m_sustainKnob->value<float>() ) *
|
||||
avail_height ), x2, y_base );
|
||||
p.fillRect( x1-1, static_cast<int>( y_base - avail_height +
|
||||
m_sustainKnob->value<float>() *
|
||||
p.fillRect( x1 - 1, static_cast<int>( y_base - avail_height +
|
||||
( 1 - m_sustainKnob->value<float>() ) *
|
||||
avail_height ) - 2, 4, 4,
|
||||
end_points_bg_color );
|
||||
p.fillRect( x1, static_cast<int>( y_base - avail_height +
|
||||
m_sustainKnob->value<float>() *
|
||||
( 1 - m_sustainKnob->value<float>() ) *
|
||||
avail_height ) - 1, 2, 2,
|
||||
end_points_color );
|
||||
p.fillRect( x2 - 1, y_base - 2, 4, 4, end_points_bg_color );
|
||||
|
||||
Reference in New Issue
Block a user