Skip to content

Commit

Permalink
New library for module and plugin managers
Browse files Browse the repository at this point in the history
(cherry picked from commit 30e75e3;
modified for Tenacity)
Signed-off-by: Avery King <[email protected]>
  • Loading branch information
Paul-Licameli authored and generic-pers0n committed Aug 27, 2024
1 parent 6c36e5d commit 9daaa17
Show file tree
Hide file tree
Showing 29 changed files with 85 additions and 72 deletions.
1 change: 1 addition & 0 deletions libraries/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ set( LIBRARIES
lib-ffmpeg-support
lib-files
lib-math
lib-module-manager
lib-preferences
lib-string-utils
lib-registries
Expand Down
27 changes: 27 additions & 0 deletions libraries/lib-module-manager/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#[[
Management of dynamically loaded libraries for add-on functionality, and for
effect, generator, and analyzer plug-ins.
Maintains persistent data in the configuration file for enablement of modules
and plug-ins, and preferred settings.
]]
set( SOURCES
ConfigInterface.cpp
ConfigInterface.h
ModuleManager.cpp
ModuleManager.h
ModuleSettings.cpp
ModuleSettings.h
PluginInterface.cpp
PluginInterface.h
PluginManager.cpp
PluginManager.h
)
set( LIBRARIES
lib-files-interface
PRIVATE
wxWidgets::wxWidgets
)
tenacity_library( lib-module-manager "${SOURCES}" "${LIBRARIES}"
"" ""
)
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ class EffectDefinitionInterface;

namespace PluginSettings {

TENACITY_DLL_API bool HasConfigGroup( EffectDefinitionInterface &ident,
MODULE_MANAGER_API bool HasConfigGroup( EffectDefinitionInterface &ident,
ConfigurationType type, const RegistryPath & group);
TENACITY_DLL_API bool GetConfigSubgroups( EffectDefinitionInterface &ident,
MODULE_MANAGER_API bool GetConfigSubgroups( EffectDefinitionInterface &ident,
ConfigurationType type, const RegistryPath & group,
RegistryPaths & subgroups);

TENACITY_DLL_API bool GetConfigValue( EffectDefinitionInterface &ident,
MODULE_MANAGER_API bool GetConfigValue( EffectDefinitionInterface &ident,
ConfigurationType type, const RegistryPath & group,
const RegistryPath & key, ConfigReference var, ConfigConstReference value);

Expand Down Expand Up @@ -89,7 +89,7 @@ inline bool GetConfig( EffectDefinitionInterface &ident,
return GetConfig(ident, type, group, key, var, Value{});
}

TENACITY_DLL_API bool SetConfigValue( EffectDefinitionInterface &ident,
MODULE_MANAGER_API bool SetConfigValue( EffectDefinitionInterface &ident,
ConfigurationType type, const RegistryPath & group,
const RegistryPath & key, ConfigConstReference value);

Expand All @@ -101,9 +101,9 @@ inline bool SetConfig( EffectDefinitionInterface &ident,
return SetConfigValue(ident, type, group, key, std::cref(value));
}

TENACITY_DLL_API bool RemoveConfigSubgroup( EffectDefinitionInterface &ident,
MODULE_MANAGER_API bool RemoveConfigSubgroup( EffectDefinitionInterface &ident,
ConfigurationType type, const RegistryPath & group);
TENACITY_DLL_API bool RemoveConfig( EffectDefinitionInterface &ident,
MODULE_MANAGER_API bool RemoveConfig( EffectDefinitionInterface &ident,
ConfigurationType type, const RegistryPath & group,
const RegistryPath & key);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,22 @@ i.e. an alternative to the usual interface, for Audacity.
*//*******************************************************************/


#include "ModuleManager.h"

#include "BasicUI.h"
#include "FileNames.h"
#include "MemoryX.h"
#include "ModuleInterface.h"
#include "PluginInterface.h"

// Tenacity libraries
#include <lib-basic-ui/BasicUI.h>
#include <lib-components/ModuleInterface.h>
#include <lib-files/FileNames.h>
#include <lib-utility/MemoryX.h>

#include <wx/dynlib.h>
#include <wx/log.h>
#include <wx/string.h>
#include <wx/filename.h>

#ifdef EXPERIMENTAL_MODULE_PREFS
// Tenacity libraries
#include <lib-preferences/Prefs.h>
#include "Prefs.h"

#include "ModuleSettings.h"
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,25 @@
#ifndef __AUDACITY_MODULEMANAGER_H__
#define __AUDACITY_MODULEMANAGER_H__

// Tenacity libraries
#include <lib-strings/Identifier.h>
#include <lib-utility/MemoryX.h>
#include <lib-utility/ModuleConstants.h>

#include "Identifier.h"
#include "MemoryX.h"
#include "ModuleConstants.h"
#include "PluginInterface.h"

#include <functional>
#include <map>
#include <vector>
#include <wx/string.h>

#include "Identifier.h"

class wxArrayString;
class wxDynamicLibrary;
class ComponentInterface;
class ModuleInterface;
class wxWindow;
using PluginID = wxString;
class TranslatableString;

//
// Module Manager
Expand Down Expand Up @@ -68,7 +71,7 @@ using ModuleInterfaceHandle = std::unique_ptr<
typedef std::map<wxString, ModuleInterfaceHandle> ModuleMap;
typedef std::map<ModuleInterface *, std::unique_ptr<wxDynamicLibrary>> LibraryMap;

class TENACITY_DLL_API ModuleManager final
class MODULE_MANAGER_API ModuleManager final
{
public:

Expand Down Expand Up @@ -143,9 +146,9 @@ class TENACITY_DLL_API ModuleManager final
// ----------------------------------------------------------------------------
using ModuleMain = ModuleInterface *(*)();

TENACITY_DLL_API
MODULE_MANAGER_API
void RegisterProvider(ModuleMain rtn);
TENACITY_DLL_API
MODULE_MANAGER_API
void UnregisterProvider(ModuleMain rtn);

// Guarantee the registry exists before any registrations, so it will
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@

#include "ModuleSettings.h"

// Tenacity libraries
#include <lib-preferences/Prefs.h>
#include "Prefs.h"

#include <unordered_set>
#include <wx/filename.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
#ifndef __AUDACITY_MODULE_SETTINGS__
#define __AUDACITY_MODULE_SETTINGS__

// Tenacity libraries
#include <lib-strings/Identifier.h>
#include "Identifier.h"

enum {
kModuleDisabled = 0,
Expand All @@ -24,8 +23,8 @@ enum {

namespace ModuleSettings {

int GetModuleStatus( const FilePath &fname );
void SetModuleStatus( const FilePath &fname, int iStatus );
MODULE_MANAGER_API int GetModuleStatus( const FilePath &fname );
MODULE_MANAGER_API void SetModuleStatus( const FilePath &fname, int iStatus );

}

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ using ConfigConstReference =

}

class TENACITY_DLL_API PluginManagerInterface /* not final */
class MODULE_MANAGER_API PluginManagerInterface /* not final */
{
public:
using ConfigurationType = PluginSettings::ConfigurationType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@ for shared and private configs - which need to move out.
#include <wx/tokenzr.h>

#include "BasicUI.h"
#include "FileNames.h"
#include "MemoryX.h"
#include "ModuleInterface.h"

// Tenacity libraries
#include <lib-files/FileNames.h>
#include <lib-strings/Internat.h>
#include <lib-utility/MemoryX.h>
#include "PluginInterface.h"

#include "ModuleManager.h"
#include "PlatformCompatibility.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@
#include <map>
#include <memory>

// Tenacity libraries
#include <lib-components/EffectInterface.h>
#include <lib-strings/wxArrayStringEx.h>

#include "EffectInterface.h"
#include "PluginInterface.h"
#include "wxArrayStringEx.h"

class wxArrayString;
class FileConfig;
Expand All @@ -43,7 +41,7 @@ typedef enum : unsigned {
} PluginType;

// TODO: Convert this to multiple derived classes
class TENACITY_DLL_API PluginDescriptor
class MODULE_MANAGER_API PluginDescriptor
{
public:
PluginDescriptor();
Expand Down Expand Up @@ -173,7 +171,7 @@ typedef wxArrayString PluginIDs;

class PluginRegistrationDialog;

class TENACITY_DLL_API PluginManager final : public PluginManagerInterface
class MODULE_MANAGER_API PluginManager final : public PluginManagerInterface
{
public:

Expand Down Expand Up @@ -241,7 +239,7 @@ class TENACITY_DLL_API PluginManager final : public PluginManagerInterface

//! @name iteration over plugins of certain types, supporting range-for syntax
//! @{
class Iterator {
class MODULE_MANAGER_API Iterator {
public:
//! Iterates all, even disabled
explicit Iterator(PluginManager &manager);
Expand Down
10 changes: 0 additions & 10 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ list( APPEND SOURCES
Clipboard.h
CommonCommandFlags.cpp
CommonCommandFlags.h
ConfigInterface.cpp
ConfigInterface.h
DBConnection.cpp
DBConnection.h
Diags.cpp
Expand Down Expand Up @@ -158,20 +156,12 @@ list( APPEND SOURCES
MixAndRender.h
MixerBoard.cpp
MixerBoard.h
ModuleManager.cpp
ModuleManager.h
ModuleSettings.cpp
ModuleSettings.h
$<$<BOOL:${USE_MIDI}>:NoteTrack.cpp>
$<$<BOOL:${USE_MIDI}>:NoteTrack.h>
PitchName.cpp
PitchName.h
PlaybackSchedule.cpp
PlaybackSchedule.h
PluginInterface.cpp
PluginInterface.h
PluginManager.cpp
PluginManager.h
PluginRegistrationDialog.cpp
PluginRegistrationDialog.h
Printing.cpp
Expand Down
4 changes: 3 additions & 1 deletion src/commands/GetInfoCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ This class now lists

#include "../prefs/PrefsDialog.h"
#include "../shuttle/Shuttle.h"
#include "../PluginManager.h"
#include "../tracks/ui/TrackView.h"
#include "../shuttle/ShuttleGui.h"

// Tenacity libraries
#include <lib-module-manager/PluginManager.h>

#include <wx/frame.h>
#include <wx/log.h>
#include <wx/menu.h>
Expand Down
2 changes: 1 addition & 1 deletion src/effects/Effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "widgets/wxWidgetsBasicUI.h"
#include "../LabelTrack.h"
#include "../MixAndRender.h"
#include "../PluginManager.h"
#include "PluginManager.h"
#include "../ProjectAudioManager.h"
#include "../ProjectSettings.h"
#include "QualitySettings.h"
Expand Down
2 changes: 1 addition & 1 deletion src/effects/EffectManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ effects.
#include "../shuttle/ShuttleGetDefinition.h"
#include "../commands/CommandContext.h"
#include "../commands/AudacityCommand.h"
#include "../PluginManager.h"
#include "PluginManager.h"


/*******************************************************************************
Expand Down
4 changes: 2 additions & 2 deletions src/effects/EffectUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include "ConfigInterface.h"
#include "EffectManager.h"
#include "../PluginManager.h"
#include "PluginManager.h"
#include "../ProjectHistory.h"
#include "../ProjectWindowBase.h"
#include "../TrackPanelAx.h"
Expand Down Expand Up @@ -1202,7 +1202,7 @@ wxDialog *EffectUI::DialogFactory( wxWindow &parent,
return nullptr;
};

#include "../PluginManager.h"
#include "PluginManager.h"
#include "ProjectRate.h"
#include "../ProjectWindow.h"
#include "../SelectUtilities.h"
Expand Down
2 changes: 1 addition & 1 deletion src/effects/VST/VSTEffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


#include "VSTEffect.h"
#include "../../ModuleManager.h"
#include "ModuleManager.h"
#include "SampleCount.h"

#include "../../widgets/ProgressDialog.h"
Expand Down
4 changes: 2 additions & 2 deletions src/effects/audiounits/AudioUnitEffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@

#if USE_AUDIO_UNITS
#include "AudioUnitEffect.h"
#include "../../ModuleManager.h"
#include "../../ConfigInterface.h"

// Tenacity libraries
#include <lib-exceptions/TenacityException.h>
#include <lib-math/SampleCount.h>
#include <lib-module-manager/ModuleManager.h>
#include <lib-module-manager/ConfigInterface.h>

#include <wx/defs.h>
#include <wx/base64.h>
Expand Down
5 changes: 2 additions & 3 deletions src/effects/ladspa/LadspaEffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ effects from this one class.

#include "LadspaEffect.h" // This class's header file

#include "../../ConfigInterface.h"

// Tenacity libraries
#include <lib-module-manager/ConfigInterface.h>
#include <lib-exceptions/TenacityException.h>
#include <lib-files/FileNames.h>
#include <lib-math/SampleCount.h>
Expand Down Expand Up @@ -65,7 +64,7 @@ effects from this one class.
#include "../../widgets/NumericTextCtrl.h"
#include "../../widgets/valnum.h"
#include "../../widgets/wxPanelWrapper.h"
#include "../../ModuleManager.h"
#include "ModuleManager.h"

#if wxUSE_ACCESSIBILITY
#include "../../widgets/WindowAccessible.h"
Expand Down
2 changes: 1 addition & 1 deletion src/effects/lv2/LV2Effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
// Tenacity libraries
#include <lib-exceptions/TenacityException.h>
#include <lib-math/SampleCount.h>
#include <lib-module-manager/ConfigInterface.h>

#include <cmath>

Expand All @@ -50,7 +51,6 @@
#include <wx/intl.h>
#include <wx/scrolwin.h>

#include "../../ConfigInterface.h"
#include "../../shuttle/ShuttleGui.h"
#include "../../EffectHostInterface.h"
#include "../../widgets/valnum.h"
Expand Down
Loading

0 comments on commit 9daaa17

Please sign in to comment.