forked from LMMS/lmms
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This PR is a about reloading an `Lv2Proc`, e.g. in case of a sample rate change. Prior to this PR, LMMS#6419 handled this by first saving the models into XML, then destroying and re-initializing the whole `Lv2Proc` and finally reloading the saved XML. However, LMMS#6786 shows that the automation is not properly restored in such a case. This PR thus attempts to not destroy the automatable models, just everything else. This is done by moving `Lv2Proc::createPorts` into the CTOR before calling `Lv2Proc::initPlugin`, which makes `initPlugin()` and `shutdownPlugin()` proper inverses of each other (note that in jalv, the ports are also created before the features are). The new class `Lv2ProcSuspender` adds an RAII interface for reloading the `Lv2Proc`. Note that another, possibly more clean approach would be to separate the features and the plugin from the models ("controls"), to then only destroy the features and the plugin. This could be done by having `Lv2Effect` contain an `Lv2Proc` and `Lv2FxControls` contain an `Lv2ProcControls`. Then the effect classes are the usual way round, and you still maintain the separation between processor and controls in the core LV2 code. (Similarly for the instrument, except we don't have a processor/control split for instruments, so an instance of each class would be contained within the same instrument instance.) - Thanks for this proposal to @DomClark .
- Loading branch information
1 parent
379acb9
commit 5c37aa2
Showing
3 changed files
with
72 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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 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,47 @@ | ||
/* | ||
* NoCopyNoMove.h - NoCopyNoMove class | ||
* | ||
* Copyright (c) 2023-2023 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 LMMS_NOCOPYNOMOVE_H | ||
#define LMMS_NOCOPYNOMOVE_H | ||
|
||
namespace lmms | ||
{ | ||
|
||
/** | ||
* Inherit this class to make your class non-copyable and non-movable | ||
*/ | ||
class NoCopyNoMove | ||
{ | ||
protected: | ||
NoCopyNoMove() = default; | ||
NoCopyNoMove(const NoCopyNoMove& other) = delete; | ||
NoCopyNoMove& operator=(const NoCopyNoMove& other) = delete; | ||
NoCopyNoMove(NoCopyNoMove&& other) = delete; | ||
NoCopyNoMove& operator=(NoCopyNoMove&& other) = delete; | ||
}; | ||
|
||
} // namespace lmms | ||
|
||
#endif // LMMS_NOCOPYNOMOVE_H | ||
|
This file contains 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