-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Lv2 core implementation #4899
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
Closed
Closed
Lv2 core implementation #4899
Changes from all commits
Commits
Show all changes
155 commits
Select commit
Hold shift + click to select a range
0e516aa
Add PluginIssue class
JohannesLorenz e43d68e
Add Control classes
JohannesLorenz d20981c
Merge branch 'instr-sub-plugins' into lv2-review
JohannesLorenz f4d7f94
Merge branch 'model-visitor' into lv2-review
JohannesLorenz f586bac
Add linked model groups
JohannesLorenz 8fc9921
Merge branch 'linked-model-groups' into lv2-review
JohannesLorenz 577368f
Merge branch 'plugin-issue' into lv2-review
JohannesLorenz 3434bee
Merge branch 'piano-optional' into lv2-review
JohannesLorenz f7b9d33
Merge branch 'variable-tab-widget' into lv2-review
JohannesLorenz d899cf7
Merge branch 'misc-lv2-preparation' into lv2-review
JohannesLorenz c623d2c
Merge branch 'variable-tab-widget' into lv2
JohannesLorenz 288e83b
Lv2 core implementation
JohannesLorenz 5dc7bf6
Fix CI: assert -> Q_ASSERT
JohannesLorenz ba70b60
Fixed warning about uninitialized values
JohannesLorenz ae8473c
Remove a lot of dead code
JohannesLorenz 2a28ded
VST Bugfix, stolen from master
JohannesLorenz 9b13377
Merge branch 'variable-tab-widget' into lv2-review
JohannesLorenz 7961b25
Apply suggestions from code review
Spekular 71e0951
Whitespace fixes
JohannesLorenz ce197d6
Apply suggestions from code review
Spekular f73d2ce
Fix more whitespace isssues
JohannesLorenz 2610fae
PluginBrowser: Tree layout and search bar.
7c148e5
Do not delete help window on close
JohannesLorenz c168b6f
Add PluginIssue class
JohannesLorenz f3bb002
Editorial fixes after review
JohannesLorenz e9bf431
Fix memory cleanup
JohannesLorenz a396ae4
Fix review issues
JohannesLorenz 01e507f
Merge branch 'linked-model-groups' into lv2-review
JohannesLorenz a9726f4
Lv2Effect: Implement checkGate
JohannesLorenz 33df80b
Merge branch 'model-visitor' into linked-model-groups
JohannesLorenz b0758c1
Simplify LinkedModelGroups usage
JohannesLorenz dae999d
Code conventions + Merge fixes
JohannesLorenz 27f62e6
Do not store nProc in LinkedModelGroup
JohannesLorenz 52f2880
Merge branch 'linked-model-groups' into lv2-review
JohannesLorenz 5745834
Merge branch 'variable-tab-widget' into lv2-review
JohannesLorenz b23fd06
Improve LinkedModelGroups member funcs
JohannesLorenz bfd2cdc
Merge branch 'linked-model-groups' into lv2-review
JohannesLorenz c4e3411
Remove redundant Lv2Proc::m_controlCount
JohannesLorenz fa677c2
Only show Lv2 button box if there are buttons
JohannesLorenz 7d91d9b
LinkedModelGroups: Fix possible OOB read
JohannesLorenz 82cba06
LinkedModelGroups: Hide if no controls
JohannesLorenz 6c474fe
LinkedModelGroupViews: Fix comment
JohannesLorenz 08c49a3
LinkedModelGroups: Move model into struct
JohannesLorenz 78dee7d
LinkedModelGroups: Implement load/save
JohannesLorenz 993fa46
Coding conventions
JohannesLorenz bc104f4
Merge branch 'linked-model-groups' into lv2-review
JohannesLorenz 3e0525d
LinkedModelGroups: Fix nullptr indirection
JohannesLorenz e2d1320
Lv2: Fix compile after previous merge
JohannesLorenz 6c90e50
Lv2ControlBase: Enable load/save
JohannesLorenz 029c2e4
Remove unused variable
JohannesLorenz 6f6b35f
Merge branch 'linked-model-groups' into lv2-review
JohannesLorenz 2edb35e
LinkedModelGroups: Don't save linked models twice
JohannesLorenz 079102c
Merge branch 'linked-model-groups' into lv2-review
JohannesLorenz 24ca9f1
Code review
JohannesLorenz f47149a
Merge branch 'linked-model-groups' into lv2-review
JohannesLorenz 0c1758e
Review rework, thanks to @DomClark
JohannesLorenz 24f65bb
Merge branch 'linked-model-groups' into lv2-review
JohannesLorenz 2ad9db6
Update connect instructions
JohannesLorenz c6ba10b
Lv2Effect/Instrument: Fix translate section
JohannesLorenz 1229162
Replace redirecting slots by lambdas
JohannesLorenz 88bb00c
Cleanup includes
JohannesLorenz 2c423bb
Merge branch 'linked-model-groups' into lv2-review
JohannesLorenz eeade00
Merge branch 'variable-tab-widget' into lv2-review
JohannesLorenz 538b5a5
Fix assertion for #LinkedModelGroups == 1
JohannesLorenz dcd7482
LinkedModelGroups: Priv members -> nested struct
JohannesLorenz 2ce0b7f
Implement clearing models
JohannesLorenz b3d1fb1
Hide model vector in derived classes
JohannesLorenz 0960b06
Fix unique_ptr compiler issues
JohannesLorenz 65a7109
Merge branch 'linked-model-groups' into lv2-review
JohannesLorenz d9f61d0
Fix types (code review)
JohannesLorenz 96a73be
Code review: Minor corrections
JohannesLorenz 9ab8910
Code review: Improve loop readability
JohannesLorenz 2ba3fec
Controls: allow to return model view
JohannesLorenz 99cb22a
Implement LinkedModelGroupLayout
JohannesLorenz 326e076
Merge branch linked-model-groups into lv2-review
JohannesLorenz 5955e37
LinkedModelGroups: Always keep groups linked
JohannesLorenz 173427f
Merge branch linked-model-groups into lv2-review
JohannesLorenz d0b7dc1
Remove linking LEDs
JohannesLorenz 2565bf5
Merge branch 'linked-model-groups' into lv2-review
JohannesLorenz 94ea93e
Show only one processor view
JohannesLorenz d9d5e99
Merge branch 'linked-model-groups' into lv2-review
JohannesLorenz 74ad422
Minor cleanups, doc cleanups
JohannesLorenz 57804c3
Merge branch 'linked-model-groups' into lv2-review
JohannesLorenz 68777ef
Whitespace or non-functional fixes
JohannesLorenz 4c41a5e
Merge branch 'linked-model-groups' into lv2-review
JohannesLorenz e631937
Fix broken doc/wiki submodule
JohannesLorenz 36f1e6a
Do no set minimumSize for the view
JohannesLorenz 0ae2ac0
Disable VST in this release, it's buggy
JohannesLorenz 7841416
Merge branch 'linked-model-groups' into lv2-review
JohannesLorenz 23b6b1d
Rename LinkedModelGroupLayout to ControlLayout
JohannesLorenz c45c38e
Merge branch 'linked-model-groups' into lv2-review
JohannesLorenz 14c72b0
Implement LinkedModelGroup::containsModel
JohannesLorenz 6641380
Style fixes, thanks to @Veratil
JohannesLorenz cf23825
LinkedModelGroup::ModelInfo: Delete default CTOR
JohannesLorenz 0ff1877
Try to fix CI error
JohannesLorenz 0a97c6b
Fix broken wiki submodule
JohannesLorenz 87c4a03
Delete ModelInfo default CTOR
JohannesLorenz c6a28ed
LinkedModelGroup: Implement eraseModel() and getModel()
JohannesLorenz eeb1ef2
Add helpful comments
JohannesLorenz c9f03ba
Move removeControl from subclasses into this class
JohannesLorenz 210d704
Detect search bar by name, not by position
JohannesLorenz 5e7d708
Merge branch 'linked-model-groups' into lv2-review
JohannesLorenz 5c2b947
Merge branch 'plugin-issue' into lv2-review
JohannesLorenz b907a6d
Merge branch 'master' into lv2-review
JohannesLorenz 55a5d73
Add plugin load summary
JohannesLorenz c0a3e13
Lv2ControlBase: Don't expose vector storage
JohannesLorenz 2c540bd
Move Lv2Manager::m_world to other privates
JohannesLorenz f10afcc
Remove Lv2Manager::Lv2Info copy CTOR deletion
JohannesLorenz 38174ca
Introduce type Lv2Manager::Lv2InfoMap
JohannesLorenz a160000
Lv2Manager: Remove unused Iterator casts
JohannesLorenz f0fc456
Replace IS_PORT_TYPE with CRTP
JohannesLorenz 289051c
~Lv2Proc: use override instead of virtual
JohannesLorenz e8e89cf
Lv2Proc: Improve port access
JohannesLorenz a544810
Lv2Effect::processAudioBuffer: Remove useless alias
JohannesLorenz e9c46ad
Lv2FxControls must not be a friend of Lv2Effect
JohannesLorenz 960bf7c
Update all Lv2 Copyright headers
JohannesLorenz 428e841
Remove unused Lv2FxControls::m_effect
JohannesLorenz 1d34ba2
Lv2 reload buttons: clicked instead of toggled
JohannesLorenz e1f53a9
Lv2ControlBase CTOR: Use make_unique
JohannesLorenz c139582
Lv2ControlBase.cpp: Use auto for iterating
JohannesLorenz b91f99d
Lv2Manager::getPlugin: Pass QString by const ref
JohannesLorenz 770174b
Lv2Manager::getPlugin: Convert QString->string directly
JohannesLorenz 9feb491
Lv2Manager::initPlugins: Avoid using bool as int
JohannesLorenz 063788f
Implement/Use new func stdStringFromPortName
JohannesLorenz bc447b3
Lv2Proc::copyModelsFromCore: Fix cast
JohannesLorenz 6e2560d
Lv2ViewProc CTOR: Use plain LilvNode ptr
JohannesLorenz d4e5514
Lv2: Remove useless destructors where possible
JohannesLorenz 193d755
Lv2Effect: Fix `checkGate()` call
JohannesLorenz 4eeee2d
Lv2Proc CTOR: Remove unreachable else branch
JohannesLorenz ecfdf3b
Lv2SubPluginFeatures::listSubPluginKeys: Use auto in for loop
JohannesLorenz 5098883
Lv2ViewBase: Fix memory leak
JohannesLorenz f14918f
Remove useless virtual keywords
JohannesLorenz 6919ec1
Use AutoLilvNode where possible
JohannesLorenz 15faa99
Add one doxygen comment
JohannesLorenz 4a7f1ce
Implement D/W for Lv2 effects
JohannesLorenz 43d758b
Distinguish between sidechain and optional ports
JohannesLorenz 20f9b2c
Lv2ViewBase.cpp: Fix style issues
JohannesLorenz cea7f7d
Lv2Effect::tmpOutputSmps: Use 'm_' prefix
JohannesLorenz d8e36e5
Add LMMS_HAVE_SUIL to lmmsconfig.h.in
JohannesLorenz 216b689
CMakeLists style fixes
JohannesLorenz a02b106
Lv2Effect.cpp: Use static_cast
JohannesLorenz 12b2253
Remove unnecessary Lv2Ports::Control::accept
JohannesLorenz c7234aa
Lv2Effect.cpp: Style fixes
JohannesLorenz 4c2a52a
Lv2Effect: Fix calling checkGate with only wet
JohannesLorenz 13d39d2
Lv2ViewBase: Remove useless UI hint
JohannesLorenz 5c6ec8a
Lv2Ports::Audio: Rename a function
JohannesLorenz 74c92c3
Lv2Proc: Improve docs for 1st channel offsets
JohannesLorenz bca38f0
Enable turning on/off Lv2 debug output
JohannesLorenz e443ce1
Apply suggestions from code review
JohannesLorenz 867973c
Merge branch 'master' into lv2-review
JohannesLorenz 39bfecd
CMakeLists.txt: Improve `WANT_SUIL` description
JohannesLorenz 3862929
Remove Lv2ViewProc::leaveEvent
JohannesLorenz d282952
Merge branch 'master' into lv2-review
JohannesLorenz 756b84e
Revert "Remove Lv2ViewProc::leaveEvent"
JohannesLorenz 5602bb9
Revert "Revert "Remove Lv2ViewProc::leaveEvent""
JohannesLorenz 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
There are no files selected for viewing
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
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
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 |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| /* | ||
| * Lv2Basics.h - basic Lv2 utils | ||
| * | ||
| * Copyright (c) 2018-2020 Johannes Lorenz <jlsf2013$users.sourceforge.net, $=@> | ||
| * | ||
| * This file is part of LMMS - https://lmms.io | ||
| * | ||
| * This program is free software; you can redistribute it and/or | ||
| * modify it under the terms of the GNU General Public | ||
| * License as published by the Free Software Foundation; either | ||
| * version 2 of the License, or (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public | ||
| * License along with this program (see COPYING); if not, write to the | ||
| * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
| * Boston, MA 02110-1301 USA. | ||
| * | ||
| */ | ||
|
|
||
|
|
||
| #ifndef LV2BASICS_H | ||
| #define LV2BASICS_H | ||
|
|
||
|
|
||
| #include "lmmsconfig.h" | ||
|
|
||
| #ifdef LMMS_HAVE_LV2 | ||
|
|
||
| #include <lilv/lilv.h> | ||
| #include <memory> | ||
| #include <QString> | ||
| #include <string> | ||
|
|
||
| struct LilvNodeDeleter | ||
| { | ||
| void operator()(LilvNode* n) { lilv_node_free(n); } | ||
| }; | ||
|
|
||
| struct LilvNodesDeleter | ||
| { | ||
| void operator()(LilvNodes* n) { lilv_nodes_free(n); } | ||
| }; | ||
|
|
||
| using AutoLilvNode = std::unique_ptr<LilvNode, LilvNodeDeleter>; | ||
| using AutoLilvNodes = std::unique_ptr<LilvNodes, LilvNodesDeleter>; | ||
|
|
||
| /** | ||
| Return QString from a plugin's node, everything will be freed automatically | ||
| @param plug The plugin where the node is | ||
| @param getFunc The function to return the node from the plugin | ||
| */ | ||
| QString qStringFromPluginNode(const LilvPlugin* plug, | ||
| LilvNode * (*getFunc)(const LilvPlugin*)); | ||
|
|
||
| //! Return port name as QString, everything will be freed automatically | ||
| QString qStringFromPortName(const LilvPlugin* plug, const LilvPort* port); | ||
|
|
||
| //! Return port name as std::string, everything will be freed automatically | ||
| std::string stdStringFromPortName(const LilvPlugin* plug, const LilvPort* port); | ||
|
|
||
| #endif // LMMS_HAVE_LV2 | ||
| #endif // LV2BASICS_H |
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 |
|---|---|---|
| @@ -0,0 +1,146 @@ | ||
| /* | ||
| * Lv2ControlBase.h - Lv2 control base class | ||
| * | ||
| * Copyright (c) 2018-2020 Johannes Lorenz <jlsf2013$users.sourceforge.net, $=@> | ||
| * | ||
| * This file is part of LMMS - https://lmms.io | ||
| * | ||
| * This program is free software; you can redistribute it and/or | ||
| * modify it under the terms of the GNU General Public | ||
| * License as published by the Free Software Foundation; either | ||
| * version 2 of the License, or (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public | ||
| * License along with this program (see COPYING); if not, write to the | ||
| * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
| * Boston, MA 02110-1301 USA. | ||
| * | ||
| */ | ||
|
|
||
| #ifndef LV2_CONTROL_BASE_H | ||
| #define LV2_CONTROL_BASE_H | ||
|
|
||
| #include "lmmsconfig.h" | ||
|
|
||
| #ifdef LMMS_HAVE_LV2 | ||
|
|
||
| #include <lilv/lilv.h> | ||
|
|
||
| #include "DataFile.h" | ||
| #include "LinkedModelGroups.h" | ||
| #include "Plugin.h" | ||
|
|
||
| class Lv2Proc; | ||
| class PluginIssue; | ||
|
|
||
| /** | ||
| Common base class for Lv2 plugins | ||
|
|
||
| This class contains a vector of Lv2Proc, usually 1 (for stereo plugins) or | ||
| 2 (for mono plugins). Most of the logic is done there, this class primarily | ||
| forwards work to the Lv2Proc and collects the results. | ||
|
|
||
| This class provides everything Lv2 plugins have in common. It's not | ||
| named Lv2Plugin, because | ||
| * it does not inherit Instrument | ||
| * the Plugin subclass Effect does not inherit this class | ||
|
|
||
| This class would usually be a Model subclass. However, Qt doesn't allow | ||
| this: | ||
| * inhertiting only from Model will cause diamond inheritance for QObject, | ||
| which will cause errors with Q_OBJECT | ||
| * making this a direct subclass of Instrument resp. EffectControls would | ||
| require CRTP, which would make this class a template class, which would | ||
| conflict with Q_OBJECT | ||
|
|
||
| The consequence is that this class can neither inherit QObject or Model, nor | ||
| Instrument or EffectControls, which means in fact: | ||
| * this class contains no signals or slots, but it offers stubs for slots | ||
| that shall be called by child classes | ||
| * this class can not override virtuals of Instrument or EffectControls, so | ||
| it will offer functions that must be called by virtuals in its child class | ||
| */ | ||
| class Lv2ControlBase : public LinkedModelGroups | ||
| { | ||
| public: | ||
| static Plugin::PluginTypes check(const LilvPlugin* m_plugin, | ||
| std::vector<PluginIssue> &issues, bool printIssues = false); | ||
|
|
||
| const LilvPlugin* getPlugin() const { return m_plugin; } | ||
|
|
||
| Lv2Proc *control(std::size_t idx) { return m_procs[idx].get(); } | ||
| const Lv2Proc *control(std::size_t idx) const { return m_procs[idx].get(); } | ||
|
|
||
| bool hasGui() const { return m_hasGUI; } | ||
| void setHasGui(bool val) { m_hasGUI = val; } | ||
|
|
||
| protected: | ||
| /* | ||
| ctor/dtor | ||
| */ | ||
| //! @param that the class inheriting this class and inheriting Model; | ||
| //! this is the same pointer as this, but a different type | ||
| //! @param uri the Lv2 URI telling this class what plugin to construct | ||
| Lv2ControlBase(class Model *that, const QString& uri); | ||
| ~Lv2ControlBase() override; | ||
| //! Must be checked after ctor or reload | ||
| bool isValid() const { return m_valid; } | ||
|
|
||
| /* | ||
| overrides | ||
| */ | ||
| LinkedModelGroup* getGroup(std::size_t idx) override; | ||
| const LinkedModelGroup* getGroup(std::size_t idx) const override; | ||
|
|
||
| /* | ||
| utils for the run thread | ||
| */ | ||
| //! Copy values from all connected models into the respective ports | ||
| void copyModelsFromLmms(); | ||
| //! Copy buffer passed by LMMS into our ports | ||
| void copyBuffersFromLmms(const sampleFrame *buf, fpp_t frames); | ||
| //! Copy our ports into buffers passed by LMMS | ||
| void copyBuffersToLmms(sampleFrame *buf, fpp_t frames) const; | ||
JohannesLorenz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| //! Run the Lv2 plugin instance for @param frames frames | ||
| void run(fpp_t frames); | ||
|
|
||
| /* | ||
| load/save, must be called from virtuals | ||
| */ | ||
| void saveSettings(QDomDocument &doc, QDomElement &that); | ||
| void loadSettings(const QDomElement &that); | ||
| void loadFile(const QString &file); | ||
| //! TODO: not implemented | ||
| void reloadPlugin(); | ||
|
|
||
| /* | ||
| more functions that must be called from virtuals | ||
| */ | ||
| std::size_t controlCount() const; | ||
| QString nodeName() const { return "lv2controls"; } | ||
|
|
||
| private: | ||
| //! Return the DataFile settings type | ||
| virtual DataFile::Types settingsType() = 0; | ||
| //! Inform the plugin about a file name change | ||
| virtual void setNameFromFile(const QString &fname) = 0; | ||
|
|
||
| //! Independent processors | ||
| //! If this is a mono effect, the vector will have size 2 in order to | ||
| //! fulfill LMMS' requirement of having stereo input and output | ||
| std::vector<std::unique_ptr<Lv2Proc>> m_procs; | ||
|
|
||
| bool m_valid = true; | ||
| bool m_hasGUI = false; | ||
| unsigned m_channelsPerProc; | ||
|
|
||
| const LilvPlugin* m_plugin; | ||
| }; | ||
|
|
||
| #endif // LMMS_HAVE_LV2 | ||
| #endif // LV2_CONTROL_BASE_H | ||
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.