Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
3212bd8
ModelView_adding_error_message_for_model_nullptr
szeli1 Apr 9, 2025
247e348
ModelView_adding_assert_to_model_also
szeli1 Apr 10, 2025
4ba7cbb
AutomatableModel_refactoring_linking_part_1
szeli1 May 9, 2025
74500d8
LapsdaControl_updating_functions
szeli1 May 9, 2025
dba2a5a
Song_updating_automation_functions
szeli1 May 9, 2025
57c24b8
AutomatableModel_refactoring_part_2
szeli1 May 9, 2025
eff1d2a
AutomatableModel_moving_funcion_to_private
szeli1 May 9, 2025
ffaddb1
ModelView_reveting_changes
szeli1 May 9, 2025
f4678e9
AutomatableModel_removing_unused_code
szeli1 May 9, 2025
368d8bf
Song_removing_unused_code
szeli1 May 9, 2025
23c99df
Vestige_replace_setAutomatedValue
szeli1 May 9, 2025
6bb8982
VstEffectControls_replace_setAutomatedValue
szeli1 May 9, 2025
c5f9a04
AutomatableModel_fixing_issues
szeli1 May 9, 2025
e008275
AutomatableModelTest_updating_test
szeli1 May 9, 2025
db3b11a
AutomatatbleModel adding comments and assert
szeli1 May 23, 2025
675993a
edit_unlink adding new svg
szeli1 May 24, 2025
f1f0d04
AutomatableModelView fixing unlink picture
szeli1 May 24, 2025
8ab1bd1
AutomatableModel removing unused function
szeli1 Jun 4, 2025
37400d4
edit_unlink replacing with better image
szeli1 Jun 9, 2025
33fa252
MULTIPLE FILES applying style suggestions
szeli1 Jun 9, 2025
a8a5b3e
AutomatableModel updating while loops
szeli1 Jun 27, 2025
40c231d
AutomatableModel fixing value buffers causing crash
szeli1 Jun 29, 2025
f7c1d79
Remove const_cast and simiplify linking functions
allejok96 Jul 7, 2025
761b385
Clarify for, add assert, revert setUseControllerValue, remove comments
allejok96 Jul 13, 2025
e89ba7d
Add comments about design flaws
allejok96 Jul 18, 2025
71fe1a7
Remove const_cast and simiplify linking functions
szeli1 Aug 5, 2025
3e396ab
Merge branch 'LMMS:master' into fix_model_returning_nullptr
szeli1 Oct 25, 2025
2680d4c
AutomatableModel style fixes
szeli1 Oct 25, 2025
3f2e78e
FloatModelEditorBase fixing format
szeli1 Dec 6, 2025
0558a6b
LinkedModelGroups fixing link order
szeli1 Dec 6, 2025
c53f982
LinkedModelGroups fixing bug
szeli1 Dec 6, 2025
6cfa40c
LinkedModelGroups fixing bug 2
szeli1 Dec 6, 2025
6789da4
AutomatableModel removing emit
szeli1 Dec 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
AutomatableModel_fixing_issues
  • Loading branch information
szeli1 committed May 9, 2025
commit c5f9a0400df5a855cc0834d1ce497209f04adcca
24 changes: 6 additions & 18 deletions include/AutomatableModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,22 +149,12 @@ class LMMS_EXPORT AutomatableModel : public Model, public JournallingObject
template<class T>
inline T value( int frameOffset = 0 ) const
{
if (m_controllerConnection)
if (m_controllerConnection && m_useControllerValue)
{
if (!m_useControllerValue)
{
return castValue<T>(m_value);
}
else
{
return castValue<T>(controllerValue(frameOffset));
}
// workaround to update linked models
AutomatableModel* thisModel = const_cast<AutomatableModel*>(this);
thisModel->setValue(controllerValue(frameOffset));
}
else if (hasLinkedModels())
{
return castValue<T>( controllerValue( frameOffset ) );
}

return castValue<T>( m_value );
}

Expand Down Expand Up @@ -250,8 +240,9 @@ class LMMS_EXPORT AutomatableModel : public Model, public JournallingObject

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

void unlinkAllModels();
//! @return 0 if not connected, never 1, 2 if connected to 1 model
size_t countLinks() const;
Comment thread
szeli1 marked this conversation as resolved.
Outdated

/**
* @brief Saves settings (value, automation links and controller connections) of AutomatableModel into
Expand Down Expand Up @@ -338,7 +329,6 @@ public slots:

private:
void setValueInternal(float value, bool isAutomated);
float controllerValueInternal(int frameOffset) const;
// dynamicCast implementation
template<class Target>
struct DCastVisitor : public ModelVisitor
Expand Down Expand Up @@ -374,8 +364,6 @@ public slots:
AutomatableModel* getLastLinkedModel() const;
//! @return true if the `model` is in the linked list
bool isModelLinked(AutomatableModel* model) const;
size_t countLinks() const;


//! @brief Scales @value from linear to logarithmic.
//! Value should be within [0,1]
Expand Down
34 changes: 1 addition & 33 deletions src/core/AutomatableModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,6 @@ void AutomatableModel::setValueInternal(float value, bool isAutomated)
m_valueChanged = true;
emit dataChanged();
}
else if (isAutomated == false)
{
// emit only if not automated and not changed
emit dataUnchanged();
}
}


Expand Down Expand Up @@ -436,7 +431,7 @@ float AutomatableModel::fittedValue( float value ) const
void AutomatableModel::linkModel(AutomatableModel* model)
{
if (model == nullptr || model == this || isModelLinked(model)) { return; }

AutomatableModel* otherEnd = model->getLastLinkedModel();
Comment thread
szeli1 marked this conversation as resolved.
Outdated
if (otherEnd == nullptr)
{
Expand All @@ -448,9 +443,6 @@ void AutomatableModel::linkModel(AutomatableModel* model)
otherEnd->m_nextLink = m_nextLink == nullptr ? this : m_nextLink;
m_nextLink = model;
}

QObject::connect(this, SIGNAL(dataChanged()),
model, SIGNAL(dataChanged()), Qt::DirectConnection);
}

void AutomatableModel::unlinkModel()
Expand Down Expand Up @@ -554,30 +546,6 @@ void AutomatableModel::setControllerConnection( ControllerConnection* c )


float AutomatableModel::controllerValue( int frameOffset ) const
{
float output = m_value;
if (hasLinkedModels())
{
const AutomatableModel* next = this;
while (true)
{
if (next->controllerConnection() != nullptr && next->useControllerValue())
{
output = next->fittedValue(controllerValueInternal(frameOffset));
break;
}
next = next->m_nextLink;
if (next == this) { break; }
}
}
else
{
output = fittedValue(controllerValueInternal(frameOffset));
}
return output;
}

float AutomatableModel::controllerValueInternal(int frameOffset) const
{
if (m_controllerConnection == nullptr) { return m_value; }

Expand Down