-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix knob linking / refactor linking #7883
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+334
−217
Merged
Changes from 17 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
3212bd8
ModelView_adding_error_message_for_model_nullptr
szeli1 247e348
ModelView_adding_assert_to_model_also
szeli1 4ba7cbb
AutomatableModel_refactoring_linking_part_1
szeli1 74500d8
LapsdaControl_updating_functions
szeli1 dba2a5a
Song_updating_automation_functions
szeli1 57c24b8
AutomatableModel_refactoring_part_2
szeli1 eff1d2a
AutomatableModel_moving_funcion_to_private
szeli1 ffaddb1
ModelView_reveting_changes
szeli1 f4678e9
AutomatableModel_removing_unused_code
szeli1 368d8bf
Song_removing_unused_code
szeli1 23c99df
Vestige_replace_setAutomatedValue
szeli1 6bb8982
VstEffectControls_replace_setAutomatedValue
szeli1 c5f9a04
AutomatableModel_fixing_issues
szeli1 e008275
AutomatableModelTest_updating_test
szeli1 db3b11a
AutomatatbleModel adding comments and assert
szeli1 675993a
edit_unlink adding new svg
szeli1 f1f0d04
AutomatableModelView fixing unlink picture
szeli1 8ab1bd1
AutomatableModel removing unused function
szeli1 37400d4
edit_unlink replacing with better image
szeli1 33fa252
MULTIPLE FILES applying style suggestions
szeli1 a8a5b3e
AutomatableModel updating while loops
szeli1 40c231d
AutomatableModel fixing value buffers causing crash
szeli1 f7c1d79
Remove const_cast and simiplify linking functions
allejok96 761b385
Clarify for, add assert, revert setUseControllerValue, remove comments
allejok96 e89ba7d
Add comments about design flaws
allejok96 71fe1a7
Remove const_cast and simiplify linking functions
szeli1 3e396ab
Merge branch 'LMMS:master' into fix_model_returning_nullptr
szeli1 2680d4c
AutomatableModel style fixes
szeli1 3f2e78e
FloatModelEditorBase fixing format
szeli1 0558a6b
LinkedModelGroups fixing link order
szeli1 c53f982
LinkedModelGroups fixing bug
szeli1 6cfa40c
LinkedModelGroups fixing bug 2
szeli1 6789da4
AutomatableModel removing emit
szeli1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,8 +78,6 @@ class LMMS_EXPORT AutomatableModel : public Model, public JournallingObject | |
| { | ||
| Q_OBJECT | ||
| public: | ||
| using AutoModelVector = std::vector<AutomatableModel*>; | ||
|
|
||
| enum class ScaleType | ||
| { | ||
| Linear, | ||
|
|
@@ -151,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_useControllerValue) | ||
| { | ||
| return castValue<T>(m_value); | ||
| } | ||
| else | ||
| { | ||
| return castValue<T>(controllerValue(frameOffset)); | ||
| } | ||
| } | ||
| else if (hasLinkedModels()) | ||
| if (m_controllerConnection && m_useControllerValue) | ||
| { | ||
| return castValue<T>( controllerValue( frameOffset ) ); | ||
| // workaround to update linked models | ||
| AutomatableModel* thisModel = const_cast<AutomatableModel*>(this); | ||
| thisModel->setValue(controllerValue(frameOffset)); | ||
| } | ||
|
|
||
| return castValue<T>( m_value ); | ||
| } | ||
|
|
||
|
|
@@ -212,8 +200,8 @@ class LMMS_EXPORT AutomatableModel : public Model, public JournallingObject | |
|
|
||
| void setInitValue( const float value ); | ||
|
|
||
| void setAutomatedValue( const float value ); | ||
| void setValue( const float value ); | ||
| void setAutomatedValue(float value); | ||
| void setValue(float value, bool isAutomated = false); | ||
|
|
||
| void incValue( int steps ) | ||
| { | ||
|
|
@@ -252,9 +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 ); | ||
| static void unlinkModels( AutomatableModel* m1, AutomatableModel* m2 ); | ||
|
|
||
| void unlinkAllModels(); | ||
| //! @return 0 if not connected, never 1, 2 if connected to 1 model | ||
| size_t countLinks() const; | ||
szeli1 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| /** | ||
| * @brief Saves settings (value, automation links and controller connections) of AutomatableModel into | ||
|
|
@@ -277,9 +265,9 @@ class LMMS_EXPORT AutomatableModel : public Model, public JournallingObject | |
|
|
||
| virtual QString displayValue( const float val ) const = 0; | ||
|
|
||
| bool hasLinkedModels() const | ||
| constexpr bool hasLinkedModels() const | ||
| { | ||
| return !m_linkedModels.empty(); | ||
| return m_nextLink != nullptr; | ||
| } | ||
|
|
||
| // a way to track changed values in the model and avoid using signals/slots - useful for speed-critical code. | ||
|
|
@@ -312,7 +300,7 @@ class LMMS_EXPORT AutomatableModel : public Model, public JournallingObject | |
| s_periodCounter = 0; | ||
| } | ||
|
|
||
| bool useControllerValue() | ||
| bool useControllerValue() const | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is always true as far as I can see... but that's just a side note
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope, it's used in |
||
| { | ||
| return m_useControllerValue; | ||
| } | ||
|
|
@@ -340,6 +328,7 @@ public slots: | |
|
|
||
|
|
||
| private: | ||
| void setValueInternal(float value, bool isAutomated); | ||
| // dynamicCast implementation | ||
| template<class Target> | ||
| struct DCastVisitor : public ModelVisitor | ||
|
|
@@ -368,9 +357,14 @@ public slots: | |
| loadSettings( element, "value" ); | ||
| } | ||
|
|
||
| void linkModel( AutomatableModel* model ); | ||
| void unlinkModel( AutomatableModel* model ); | ||
|
|
||
| void linkModel(AutomatableModel* model); | ||
| void unlinkModel(); | ||
| //! linking is stored in a linked list ring | ||
| //! @return the model that's `m_nextLink` is `this` | ||
| AutomatableModel* getLastLinkedModel() const; | ||
| //! @return true if the `model` is in the linked list | ||
| bool isModelLinked(AutomatableModel* model) const; | ||
|
|
||
| //! @brief Scales @value from linear to logarithmic. | ||
| //! Value should be within [0,1] | ||
| template<class T> T logToLinearScale( T value ) const; | ||
|
|
@@ -390,16 +384,15 @@ public slots: | |
| float m_centerValue; | ||
|
|
||
| bool m_valueChanged; | ||
|
|
||
| // currently unused? | ||
| float m_oldValue; | ||
| int m_setValueDepth; | ||
| float m_oldValue; //!< used for interpolation | ||
|
|
||
| // used to determine if step size should be applied strictly (ie. always) | ||
| // or only when value set from gui (default) | ||
| bool m_hasStrictStepSize; | ||
|
|
||
| AutoModelVector m_linkedModels; | ||
| //! an `AutomatableModel` can be linked together with others in a linked list | ||
| //! the list has no end, the last model is connected to the first forming a ring | ||
| AutomatableModel* m_nextLink; | ||
szeli1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| //! NULL if not appended to controller, otherwise connection info | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.