Skip to content

Commit

Permalink
Fix knobs not updating vals on link (LMMS#4904)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesLorenz committed Dec 7, 2019
1 parent 6351677 commit 5ea869b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions include/AutomatableModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ class EXPORT AutomatableModel : public Model, public JournallingObject
m_centerValue = centerVal;
}

//! link @p m1 and @p m2, let @p m1 take the values of @p m2
static void linkModels( AutomatableModel* m1, AutomatableModel* m2 );
static void unlinkModels( AutomatableModel* m1, AutomatableModel* m2 );

Expand Down
11 changes: 9 additions & 2 deletions src/core/AutomatableModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,15 @@ void AutomatableModel::unlinkModel( AutomatableModel* model )

void AutomatableModel::linkModels( AutomatableModel* model1, AutomatableModel* model2 )
{
model1->linkModel( model2 );
model2->linkModel( model1 );
model1->linkModel( model2 );
model2->linkModel( model1 );
model1->m_value = model2->m_value;
if (model1->valueBuffer() && model2->valueBuffer())
{
std::copy_n(model2->valueBuffer()->data(),
model1->valueBuffer()->length(),
model1->valueBuffer()->data());
}
}


Expand Down

0 comments on commit 5ea869b

Please sign in to comment.