27#include "../EffectEditor.h"
34#if !defined(__WXMSW__)
38#define RTLD_DEEPBIND 0
44#include <wx/checkbox.h>
45#include <wx/dcclient.h>
46#include <wx/filename.h>
51#include <wx/statbox.h>
52#include <wx/stattext.h>
53#include <wx/textctrl.h>
54#include <wx/tokenzr.h>
55#include <wx/scrolwin.h>
56#include <wx/version.h>
61#include "../../widgets/NumericTextCtrl.h"
62#include "../../widgets/valnum.h"
66#if wxUSE_ACCESSIBILITY
96 return std::make_unique<LadspaEffectsModule>();
122 auto result = EffectSettings::Make<LadspaEffectSettings>(
mData->
PortCount );
138 assert(srcControls.size() == portCount);
139 assert(dstControls.size() == portCount);
141 const auto portValuesCount =
142 std::min(srcControls.size(), dstControls.size());
144 if (portValuesCount != portCount)
147 for (
unsigned long p = 0; p < portCount; ++p)
155 dstControls[p] = srcControls[p];
163 auto result = std::make_unique<LadspaEffectOutputs>();
182 return XO(
"LADSPA Effects");
187 return XO(
"The Audacity Team");
198 return XO(
"Provides LADSPA Effects");
267 for (
size_t j = 0, cnt = files.size(); j < cnt; j++)
284#if defined(__WXMAC__)
289#elif defined(__WXMSW__)
301 return { files.begin(), files.end() };
312 if (ff.GetName().CmpNoCase(
wxT(
"vst-bridge")) == 0) {
313 errMsg =
XO(
"Audacity no longer uses vst-bridge");
321 bool hadpath = wxGetEnv(
wxT(
"PATH"), &envpath);
322 wxSetEnv(
wxT(
"PATH"), ff.GetPath() + wxFILE_SEP_PATH + envpath);
323 wxString saveOldCWD = ff.GetCwd();
330#if defined(__WXMSW__)
331 wxDynamicLibrary lib;
332 if (lib.Load(path, wxDL_NOW))
334 void *lib = dlopen((
const char *)path.ToUTF8(), RTLD_NOW | RTLD_LOCAL | RTLD_DEEPBIND);
339#if defined(__WXMSW__)
350 for (data = mainFn(index); data; data = mainFn(++index)) {
355 callback(
this, &effect );
358 errMsg =
XO(
"Could not load the library");
363 errMsg =
XO(
"Could not load the library");
365#if defined(__WXMSW__)
366 if (lib.IsLoaded()) {
371 using namespace std::chrono;
372 std::this_thread::sleep_for(10ms);
381 wxSetWorkingDirectory(saveOldCWD);
382 hadpath ? wxSetEnv(
wxT(
"PATH"), envpath) : wxUnsetEnv(
wxT(
"PATH"));
387std::unique_ptr<ComponentInterface>
395 wxString realPath = path.BeforeFirst(
wxT(
';'));
396 path.AfterFirst(
wxT(
';')).ToLong(&index);
397 auto result = std::make_unique<LadspaEffect>(realPath, (
int)index);
398 result->InitializePlugin();
404 const auto realPath = path.BeforeFirst(
wxT(
';'));
405 return wxFileName::FileExists(realPath);
414 pathVar = wxString::FromUTF8(getenv(
"LADSPA_PATH"));
415 if (!pathVar.empty())
417 wxStringTokenizer tok(pathVar, wxPATH_SEP);
418 while (tok.HasMoreTokens())
420 pathList.push_back(tok.GetNextToken());
424#if defined(__WXMAC__)
425#define LADSPAPATH wxT("/Library/Audio/Plug-Ins/LADSPA")
428 pathList.push_back(wxGetHomeDir() + wxFILE_SEP_PATH +
LADSPAPATH);
431#elif defined(__WXMSW__)
437 pathList.push_back(wxGetHomeDir() + wxFILE_SEP_PATH +
wxT(
".ladspa"));
439 pathList.push_back(
wxT(
"/usr/local/lib64/ladspa"));
440 pathList.push_back(
wxT(
"/usr/lib64/ladspa"));
442 pathList.push_back(
wxT(
"/usr/local/lib/ladspa"));
443 pathList.push_back(
wxT(
"/usr/lib/ladspa"));
444 pathList.push_back(
wxT(LIBDIR)
wxT(
"/ladspa"));
470 void OnOk(wxCommandEvent & evt);
476 DECLARE_EVENT_TABLE()
490 PopulateOrExchange(
S);
519 S.StartHorizontalLay(wxEXPAND, 1);
521 S.StartVerticalLay(
false);
523 S.StartStatic(
XO(
"Latency Compensation"));
525 S.AddVariableText(
XO(
526"As part of their processing, some LADSPA effects must delay returning "
527"audio to Audacity. When not compensating for this delay, you will "
528"notice that small silences have been inserted into the audio. "
529"Enabling this option will provide that compensation, but it may "
530"not work for all LADSPA effects."),
533 S.StartHorizontalLay(wxALIGN_LEFT);
535 S.TieCheckBox(
XXO(
"Enable &compensation"),
538 S.EndHorizontalLay();
544 S.EndHorizontalLay();
546 S.AddStandardButtons();
598 void OnErase(wxEraseEvent & evt);
599 void OnPaint(wxPaintEvent & evt);
600 void OnIdle(wxIdleEvent & evt);
601 void OnSize(wxSizeEvent & evt);
610 DECLARE_EVENT_TABLE()
621: wxWindow{ parent, wxID_ANY, wxDefaultPosition, wxDefaultSize,
628 SetBackgroundColour(*wxWHITE);
629 SetMinSize({ 20, 20 });
658 wxRect r = GetClientRect();
659 wxCoord x = r.GetLeft();
660 wxCoord y = r.GetTop();
661 wxCoord w = r.GetWidth();
662 wxCoord h = r.GetHeight();
673 dc.SetPen(*wxTRANSPARENT_PEN);
674 dc.SetBrush(wxColour(100, 100, 220));
676 dc.DrawRectangle(x, y, (w * (val / fabs(
mMax -
mMin))), h);
690 return std::make_unique<LadspaEffectOutputs>(*
this);
698 assert(srcValues.size() == dstValues.size());
699 copy(srcValues.begin(), srcValues.end(), dstValues.data());
799std::pair<float, float>
803 const auto multiplier =
823 const auto combine = [bounds,
825 ](
float lowWeight,
float highWeight){
826 auto [lower, upper] = bounds;
828 ? exp(log(lower) * lowWeight + log(upper) * highWeight)
829 : lower * lowWeight + upper * highWeight;
832 auto [lower, upper] = bounds;
842 val = combine(0.75, 0.25);
break;
844 val = combine(0.5, 0.5);
break;
846 val = combine(0.25, 0.75);
break;
928 const float *
const *inBlock,
float *
const *outBlock,
size_t blockLen)
937 EffectOutputs *pOutputs,
unsigned numChannels,
float sampleRate)
943 const float *
const *inBuf,
float *
const *outBuf,
size_t numSamples)
971 return std::make_shared<Instance>(*
this);
977 auto &effect = GetEffect();
979 if (mUseLatency && effect.mLatencyPort >= 0)
980 return controls[effect.mLatencyPort];
989 auto &effect = GetEffect();
992 mMaster = effect.InitInstance(sampleRate, ladspaSettings,
nullptr);
1002return GuardedCall<bool>([&]{
1005 GetEffect().FreeInstance(mMaster);
1014 const float *
const *inBlock,
float *
const *outBlock,
size_t blockLen)
1016 auto &effect = GetEffect();
1017 for (
unsigned i = 0; i < effect.mAudioIns; ++i)
1018 effect.mData->connect_port(mMaster, effect.mInputPorts[i],
1019 const_cast<float*
>(inBlock[i]));
1021 for (
unsigned i = 0; i < effect.mAudioOuts; ++i)
1022 effect.mData->connect_port(mMaster, effect.mOutputPorts[i], outBlock[i]);
1024 effect.mData->run(mMaster, blockLen);
1036 auto &effect = GetEffect();
1041 auto pLadspaOutputs = mSlaves.empty()
1043 auto slave = effect.InitInstance(sampleRate, ladspaSettings, pLadspaOutputs);
1046 mSlaves.push_back(slave);
1052 return GetEffect().mAudioOuts;
1057 return GetEffect().mAudioIns;
1062return GuardedCall<bool>([&]{
1063 auto &effect = GetEffect();
1064 for (
size_t i = 0, cnt = mSlaves.size(); i < cnt; ++i)
1065 effect.FreeInstance(mSlaves[i]);
1075 for (
auto &slave : mSlaves)
1083 for (
auto &slave : mSlaves)
1094 const float *
const *inbuf,
float *
const *outbuf,
size_t numSamples)
1096 if (group >= mSlaves.size())
1099 auto &effect = GetEffect();
1100 for (
unsigned i = 0; i < effect.mAudioIns; ++i)
1101 effect.mData->connect_port(mSlaves[group], effect.mInputPorts[i],
1102 const_cast<float*
>(inbuf[i]));
1104 for (
unsigned i = 0; i < effect.mAudioOuts; ++i)
1105 effect.mData->connect_port(
1106 mSlaves[group], effect.mOutputPorts[i], outbuf[i]);
1108 effect.mData->run(mSlaves[group], numSamples);
1119 wxWindow &parent, wxDialog &dialog,
1124 dialog.SetMinSize(dialog.GetSize());
1132 return dialog.ShowModal();
1159 if (!parms.Read(labelText, &d))
1208 void OnSlider(wxCommandEvent & evt);
1241 auto &effect = GetEffect();
1242 auto &controls = mSettings.controls;
1243 auto parent =
S.GetParent();
1247 const auto &data = *effect.mData;
1248 mToggles.reinit( data.PortCount );
1249 mSliders.reinit( data.PortCount );
1250 mFields.reinit( data.PortCount,
true);
1251 mLabels.reinit( data.PortCount );
1252 mMeters.resize( data.PortCount );
1255 wxScrolledWindow *
const w =
safenew wxScrolledWindow(mParent,
1259 wxVSCROLL | wxTAB_TRAVERSAL);
1262 auto mainSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
1263 w->SetScrollRate(0, 20);
1266 w->SetName(
wxT(
"\a"));
1267 w->SetLabel(
wxT(
"\a"));
1269 mainSizer->Add(w, 1, wxEXPAND);
1270 mParent->SetSizer(mainSizer.release());
1273 wxSizer *marginSizer;
1275 auto uMarginSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
1276 marginSizer = uMarginSizer.get();
1279 if (effect.mNumInputControls) {
1280 auto paramSizer = std::make_unique<wxStaticBoxSizer>(wxVERTICAL, w,
_(
"Effect Settings"));
1282 auto gridSizer = std::make_unique<wxFlexGridSizer>(5, 0, 0);
1283 gridSizer->AddGrowableCol(3);
1289 item =
safenew wxStaticText(w, 0,
_(
"Duration:"));
1290 gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
1291 auto &extra = mAccess.Get().extra;
1295 extra.GetDurationFormat(),
1296 extra.GetDuration(),
1300 mDuration->SetName(
XO(
"Duration") );
1301 gridSizer->Add(mDuration, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
1302 gridSizer->Add(1, 1, 0);
1303 gridSizer->Add(1, 1, 0);
1304 gridSizer->Add(1, 1, 0);
1307 for (
unsigned long p = 0; p < data.PortCount; ++p) {
1314 wxString labelText =
LAT1CTOWX(data.PortNames[p]);
1315 item =
safenew wxStaticText(w, 0, wxString::Format(
_(
"%s:"), labelText));
1316 gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
1323 mToggles[p]->SetName(labelText);
1324 mToggles[p]->SetValue(controls[p] > 0);
1325 BindTo(*mToggles[p],
1327 gridSizer->Add(mToggles[p], 0, wxALL, 5);
1329 gridSizer->Add(1, 1, 0);
1330 gridSizer->Add(1, 1, 0);
1331 gridSizer->Add(1, 1, 0);
1336 float lower = -FLT_MAX;
1337 float upper = FLT_MAX;
1340 bool forceint =
false;
1353 lower *= mSampleRate;
1354 upper *= mSampleRate;
1359 lower = ceilf(lower * 1000000.0) / 1000000.0;
1360 upper = floorf(upper * 1000000.0) / 1000000.0;
1361 controls[p] = roundf(controls[p] * 1000000.0) / 1000000.0;
1363 if (haslo && controls[p] < lower)
1364 controls[p] = lower;
1366 if (hashi && controls[p] > upper)
1367 controls[p] = upper;
1373 mFields[p]->SetName(labelText);
1376 gridSizer->Add(mFields[p], 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
1382 str.Printf(
wxT(
"%d"), (
int)(lower + 0.5));
1389 gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
1392 gridSizer->Add(1, 1, 0);
1398#if wxUSE_ACCESSIBILITY
1402 mSliders[p]->SetName(labelText);
1403 BindTo(*mSliders[p],
1405 gridSizer->Add(mSliders[p], 0, wxALIGN_CENTER_VERTICAL | wxEXPAND | wxALL, 5);
1409 str.Printf(
wxT(
"%d"), (
int)(upper + 0.5));
1413 gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxALL, 5);
1416 gridSizer->Add(1, 1, 0);
1419 fieldText.Printf(
wxT(
"%d"), (
int)(controls[p] + 0.5));
1421 IntegerValidator<float> vld(&controls[p]);
1422 vld.SetRange(haslo ? lower : INT_MIN,
1423 hashi ? upper : INT_MAX);
1424 mFields[p]->SetValidator(vld);
1430 FloatingPointValidator<float> vld(6, &controls[p]);
1431 vld.SetRange(lower, upper);
1434 if (upper - lower < 10.0)
1435 vld.SetStyle(NumValidatorStyle::THREE_TRAILING_ZEROES);
1436 else if (upper - lower < 100.0)
1437 vld.SetStyle(NumValidatorStyle::TWO_TRAILING_ZEROES);
1439 vld.SetStyle(NumValidatorStyle::ONE_TRAILING_ZERO);
1441 mFields[p]->SetValidator(vld);
1446 mFields[p]->SetValue(fieldText);
1449 paramSizer->Add(gridSizer.release(), 0, wxEXPAND | wxALL, 5);
1450 marginSizer->Add(paramSizer.release(), 0, wxEXPAND | wxALL, 5);
1454 if (effect.mNumOutputControls > 0) {
1455 auto paramSizer = std::make_unique<wxStaticBoxSizer>(wxVERTICAL, w,
_(
"Effect Output"));
1457 auto gridSizer = std::make_unique<wxFlexGridSizer>(2, 0, 0);
1458 gridSizer->AddGrowableCol(1);
1462 for (
unsigned long p = 0; p < data.PortCount; ++p) {
1467 wxString labelText =
LAT1CTOWX(data.PortNames[p]);
1469 w, 0, wxString::Format(
_(
"%s:"), labelText));
1471 item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
1480 lower = ceilf(lower * 1000000.0) / 1000000.0;
1481 upper = floorf(upper * 1000000.0) / 1000000.0;
1482 controls[p] = lower;
1487 auto pOutput = mpOutputs ? &mpOutputs->controls[p] : &sink;
1489 w, *pOutput, lower, upper);
1490 mMeters[p]->SetLabel(labelText);
1491 gridSizer->Add(mMeters[p], 1, wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALL, 5);
1494 paramSizer->Add(gridSizer.release(), 0, wxEXPAND | wxALL, 5);
1495 marginSizer->Add(paramSizer.release(), 0, wxEXPAND | wxALL, 5);
1498 w->SetSizer(uMarginSizer.release());
1504 wxSize sz1 = marginSizer->GetMinSize();
1505 wxSize sz2 = mParent->GetMinSize();
1509 mParent->SetMinSize({ -1, -1 });
1517 auto result = std::make_unique<Editor>(*
this, access,
mProjectRate,
1519 result->PopulateUI(
S);
1527 settings.extra.SetDuration(mDuration->GetValue());
1536 for (
auto &meter : mMeters)
1538 meter->Disconnect();
1575 if (
mLib.IsLoaded())
1580 wxFileName ff =
mPath;
1582 bool hadpath = wxGetEnv(
wxT(
"PATH"), &envpath);
1583 wxSetEnv(
wxT(
"PATH"), ff.GetPath() + wxFILE_SEP_PATH + envpath);
1584 wxString saveOldCWD = ff.GetCwd();
1601 if (
mLib.IsLoaded())
1606 wxSetWorkingDirectory(saveOldCWD);
1607 hadpath ? wxSetEnv(
wxT(
"PATH"), envpath) : wxUnsetEnv(
wxT(
"PATH"));
1614 if (
mLib.IsLoaded())
1625 parms, wxEmptyString))
1657 group,
wxT(
"Parameters"), parms);
1669 auto &controls =
settings.controls;
1678 pOutputs ? &pOutputs->
controls[p] : &sink);
1702 UpdateControl(p, mToggles[p]->GetValue(), 0.5f);
1711 float lower = float(0.0);
1712 float upper = float(10.0);
1714 bool forceint =
false;
1722 lower *= mSampleRate;
1723 upper *= mSampleRate;
1727 range = upper - lower;
1728 val = (mSliders[p]->GetValue() / 1000.0) * range + lower;
1731 str.Printf(
wxT(
"%d"), (int)(val + 0.5));
1735 mFields[p]->SetValue(
str);
1746 float lower = float(0.0);
1747 float upper = float(10.0);
1758 lower *= mSampleRate;
1759 upper *= mSampleRate;
1761 range = upper - lower;
1767 mSliders[p]->SetValue((
int)(((val-lower)/range) * 1000.0 + 0.5));
1781 auto& controls = mSettings.controls;
1783 const auto &data = *GetEffect().mData;
1784 for (
unsigned long p = 0; p < data.PortCount; ++p) {
1792 bool forceint =
false;
1800 mToggles[p]->SetValue(controls[p] > 0);
1805 fieldText.Printf(
wxT(
"%d"), (
int)(controls[p] + 0.5));
1811 mFields[p]->SetValue(fieldText);
1817 auto& controls = mSettings.controls;
1819 assert(index <
static_cast<int>(controls.size()));
1821 if (std::abs(controls[index] - value) < epsilon)
1824 controls[index] = value;
1825 Publish({ size_t(index), value });
1830 const auto& data = *GetEffect().mData;
1832 for (
size_t portIndex = 0, portsCount = src.
controls.size();
1833 portIndex < portsCount;
1848 portIndex, src.
controls[portIndex],
Declare abstract class AudacityException, some often-used subclasses, and GuardedCall.
EVT_BUTTON(wxID_NO, DependencyDialog::OnNo) EVT_BUTTON(wxID_YES
const TranslatableString name
std::optional< std::unique_ptr< EffectSettingsAccess::Message > > OptionalMessage
XXO("&Cut/Copy/Paste Toolbar")
std::vector< PluginPath > PluginPaths
wxString PluginPath
type alias for identifying a Plugin supplied by a module, each module defining its own interpretation...
std::vector< RegistryPath > RegistryPaths
DECLARE_PROVIDER_ENTRY(AudacityModule)
static const wxChar * kShippedEffects[]
static const wchar_t * UseLatencyKey
DECLARE_BUILTIN_PROVIDER(LadspaBuiltin)
constexpr float ControlValueTolerance
static const wchar_t * OptionsKey
#define LADSPAEFFECTS_VERSION
#define LADSPAEFFECTS_FAMILY
wxEVT_COMMAND_TEXT_UPDATED
static Settings & settings()
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
void reinit(Integral count, bool initialize=false)
bool ValidateUI(const EffectPlugin &context, EffectSettings &) const override
CommandParameters, derived from wxFileConfig, is essentially doing the same things as the SettingsVis...
bool GetParameters(wxString &parms)
bool SetParameters(const wxString &parms)
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
EffectDefinitionInterface is a ComponentInterface that adds some basic read-only information about ef...
bool SupportsRealtime() const
RealtimeSince
In which versions of Audacity was an effect realtime capable?
const EffectUIServices & mUIServices
Performs effect computation.
Inherit to add a state variable to an EffectInstance subclass.
Hold values to send to effect output meters.
Factory of instances of an effect.
static LadspaEffectSettings & GetSettings(EffectSettings &settings)
Assume settings originated from MakeSettings() and copies thereof.
static wxString ToDisplayString(double numberToConvert, int digitsAfterDecimalPoint=-1)
Convert a number to a string, uses the user's locale's decimal separator.
static bool CompatibleToDouble(const wxString &stringToConvert, double *result)
Convert a string to a number.
An Effect that calls up a LADSPA plug in, i.e. many possible effects from this one class.
int ShowClientInterface(const EffectPlugin &plugin, wxWindow &parent, wxDialog &dialog, EffectEditor *pEditor, bool forceModal) const override
bool LoadSettings(const CommandParameters &parms, EffectSettings &settings) const override
Restore settings from keys and values.
LadspaEffect(const wxString &path, int index)
bool CopySettingsContents(const EffectSettings &src, EffectSettings &dst) const override
Update one settings object from another.
EffectFamilySymbol GetFamily() const override
Report identifier and user-visible name of the effect protocol.
bool SupportsAutomation() const override
Whether the effect has any automatable controls.
void ShowOptions(const EffectPlugin &plugin) const override
bool SaveSettings(const EffectSettings &settings, CommandParameters &parms) const override
Store settings as keys and values.
const LADSPA_Descriptor * mData
RealtimeSince RealtimeSupport() const override
Since which version of Audacity has the effect supported realtime?
bool IsInteractive() const override
Whether the effect needs a dialog for entry of settings.
bool SaveParameters(const RegistryPath &group, const EffectSettings &settings) const
EffectType GetType() const override
Type determines how it behaves.
OptionalMessage LoadParameters(const RegistryPath &group, EffectSettings &settings) const
ComponentInterfaceSymbol GetSymbol() const override
bool HasOptions() const override
OptionalMessage LoadUserPreset(const RegistryPath &name, EffectSettings &settings) const override
void FreeInstance(LADSPA_Handle handle) const
ArrayOf< unsigned long > mOutputPorts
bool SaveUserPreset(const RegistryPath &name, const EffectSettings &settings) const override
Save settings in the configuration file as a user-named preset.
wxString GetVersion() const override
LADSPA_Handle InitInstance(float sampleRate, LadspaEffectSettings &settings, LadspaEffectOutputs *pOutputs) const
RegistryPaths GetFactoryPresets() const override
Report names of factory presets.
OptionalMessage LoadFactoryPreset(int id, EffectSettings &settings) const override
std::unique_ptr< EffectEditor > MakeEditor(ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs) const override
Called only from PopulateUI, to add controls to effect panel.
TranslatableString GetDescription() const override
OptionalMessage ImportPresets(const EffectPlugin &plugin, EffectSettings &settings) const override
void ExportPresets(const EffectPlugin &plugin, const EffectSettings &settings) const override
bool InitializeControls(LadspaEffectSettings &settings) const
std::unique_ptr< EffectOutputs > MakeOutputs() const override
Produce an object to hold values to send to effect output meters.
std::shared_ptr< EffectInstance > MakeInstance() const override
Make an object maintaining short-term state of an Effect.
bool IsDefault() const override
Whether the effect sorts "above the line" in the menus.
PluginPath GetPath() const override
EffectSettings MakeSettings() const override
ArrayOf< unsigned long > mInputPorts
VendorSymbol GetVendor() const override
bool CanExportPresets() const override
Whether the effect supports export of presets to files, and importing too.
void OnErase(wxEraseEvent &evt)
void OnSize(wxSizeEvent &evt)
LadspaEffectMeter(wxWindow *parent, const float &val, float min, float max)
void OnIdle(wxIdleEvent &evt)
virtual ~LadspaEffectMeter()
void OnPaint(wxPaintEvent &evt)
const EffectDefinitionInterface & mEffect
LadspaEffectOptionsDialog(const EffectDefinitionInterface &effect)
virtual ~LadspaEffectOptionsDialog()
void PopulateOrExchange(ShuttleGui &S)
void OnOk(wxCommandEvent &evt)
PluginPaths FindModulePaths(PluginManagerInterface &pm) override
virtual ~LadspaEffectsModule()
ComponentInterfaceSymbol GetSymbol() const override
std::unique_ptr< ComponentInterface > LoadPlugin(const PluginPath &path) override
Load the plug-in at a path reported by DiscoverPluginsAtPath.
FilePath InstallPath() override
Where plug-in files should be copied to install them.
TranslatableString GetDescription() const override
EffectFamilySymbol GetOptionalFamilySymbol() override
A symbol identifying the family of plug-ins provided by this.
unsigned DiscoverPluginsAtPath(const PluginPath &path, TranslatableString &errMsg, const RegistrationCallback &callback) override
FilePaths GetSearchPaths()
const FileExtensions & GetFileExtensions() override
File types associated with this protocol.
VendorSymbol GetVendor() const override
void Terminate() override
Called just prior to deletion to allow releasing any resources.
wxString GetVersion() const override
bool Initialize() override
Called immediately after creation. Let provider initialize.
PluginPath GetPath() const override
bool CheckPluginExist(const PluginPath &path) const override
Performs plugin/module existence check, still plugin may fail to load. Implementation should avoid lo...
void AutoRegisterPlugins(PluginManagerInterface &pm) override
Called so that a provider of a static set of plug-ins can register them.
const PerTrackEffect & mProcessor
Base class for many of the effects in Audacity.
virtual void FindFilesInPathList(const wxString &pattern, const FilePaths &pathList, FilePaths &files, bool directories=false)=0
virtual bool IsPluginRegistered(const PluginPath &path, const TranslatableString *pName=nullptr)=0
Was the plugin registry already populated for a path (maybe from loading the config file)?
static const PluginID & DefaultRegistrationCallback(PluginProvider *provider, ComponentInterface *ident)
std::function< const PluginID &(PluginProvider *, ComponentInterface *) > RegistrationCallback
Further expand a path reported by FindModulePaths.
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Holds a msgid for the translation catalog; may also bind format arguments.
An alternative to using wxWindowAccessible, which in wxWidgets 3.1.1 contained GetParent() which was ...
Extend wxArrayString with move operations and construction and insertion fromstd::initializer_list.
#define LADSPA_HINT_DEFAULT_100
#define LADSPA_IS_HINT_BOUNDED_BELOW(x)
#define LADSPA_HINT_DEFAULT_MAXIMUM
#define LADSPA_HINT_DEFAULT_440
#define LADSPA_HINT_DEFAULT_LOW
#define LADSPA_IS_HINT_BOUNDED_ABOVE(x)
#define LADSPA_HINT_DEFAULT_0
#define LADSPA_IS_HINT_INTEGER(x)
#define LADSPA_IS_HINT_LOGARITHMIC(x)
#define LADSPA_HINT_DEFAULT_HIGH
#define LADSPA_IS_HINT_TOGGLED(x)
#define LADSPA_HINT_DEFAULT_MASK
#define LADSPA_HINT_DEFAULT_MIDDLE
int LADSPA_PortDescriptor
#define LADSPA_HINT_DEFAULT_1
#define LADSPA_HINT_DEFAULT_MINIMUM
const LADSPA_Descriptor *(* LADSPA_Descriptor_Function)(unsigned long Index)
#define LADSPA_IS_PORT_INPUT(x)
#define LADSPA_IS_PORT_AUDIO(x)
#define LADSPA_IS_PORT_CONTROL(x)
#define LADSPA_IS_PORT_OUTPUT(x)
#define LADSPA_HINT_DEFAULT_NONE
#define LADSPA_IS_HINT_SAMPLE_RATE(x)
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
FILES_API FilePath PlugInDir()
The user plug-in directory (not a system one)
bool SetConfig(const EffectDefinitionInterface &ident, ConfigurationType type, const RegistryPath &group, const RegistryPath &key, const Value &value)
bool GetConfig(const EffectDefinitionInterface &ident, ConfigurationType type, const RegistryPath &group, const RegistryPath &key, Value &var, const Value &defval)
bool LoadUseLatency(const EffectDefinitionInterface &effect)
float InputControlPortDefaultValue(const LADSPA_PortRangeHint &hint, double sampleRate)
bool SaveUseLatency(const EffectDefinitionInterface &effect, bool value)
std::pair< float, float > InputControlPortBounds(const LADSPA_PortRangeHint &hint, double sampleRate)
float ClampInputControlValue(const LADSPA_PortRangeHint &hint, float val, float lower, float upper)
_LADSPA_Descriptor is a structure that provides the API to a LADSPA (Linux Audio Plugin Architecture)...
LADSPA_Handle(* instantiate)(const struct _LADSPA_Descriptor *Descriptor, unsigned long SampleRate)
void(* deactivate)(LADSPA_Handle Instance)
void(* cleanup)(LADSPA_Handle Instance)
const char *const * PortNames
void(* activate)(LADSPA_Handle Instance)
void(* connect_port)(LADSPA_Handle Instance, unsigned long Port, LADSPA_Data *DataLocation)
const LADSPA_PortDescriptor * PortDescriptors
const LADSPA_PortRangeHint * PortRangeHints
_LADSPA_PortRangeHint is a structure that gives parameter validation information for a LADSPA (Linux ...
LADSPA_PortRangeHintDescriptor HintDescriptor
Externalized state of a plug-in.
const LadspaEffectOutputs *const mpOutputs
Editor(const EffectUIServices &effect, EffectSettingsAccess &access, double sampleRate, EffectType type, const LadspaEffectOutputs *pOutputs)
void UpdateControl(int index, float value, float epsilon)
bool ValidateUI() override
Get settings data from the panel; may make error dialogs and return false.
std::vector< LadspaEffectMeter * > mMeters
ArrayOf< wxSlider * > mSliders
bool UpdateUI() override
Update appearance of the panel for changes in settings.
void OnTextCtrl(wxCommandEvent &evt)
void UpdateControls(const LadspaEffectSettings &src)
LadspaEffectSettings mSettings
void PopulateUI(ShuttleGui &S)
void OnCheckBox(wxCommandEvent &evt)
ArrayOf< wxStaticText * > mLabels
ArrayOf< wxTextCtrl * > mFields
void OnSlider(wxCommandEvent &evt)
void Disconnect() override
On the first call only, may disconnect from further event handling.
wxWeakRef< wxDialog > mDialog
const LadspaEffect & GetEffect()
ArrayOf< wxCheckBox * > mToggles
NumericTextCtrl * mDuration
bool RealtimeAddProcessor(EffectSettings &settings, EffectOutputs *pOutputs, unsigned numChannels, float sampleRate) override
size_t ProcessBlock(EffectSettings &settings, const float *const *inBlock, float *const *outBlock, size_t blockLen) override
Called for destructive effect computation.
size_t RealtimeProcess(size_t group, EffectSettings &settings, const float *const *inBuf, float *const *outBuf, size_t numSamples) override
bool RealtimeResume() override
bool RealtimeProcessEnd(EffectSettings &settings) noexcept override
settings can be updated to let a dialog change appearance at idle
bool RealtimeInitialize(EffectSettings &settings, double sampleRate) override
SampleCount GetLatency(const EffectSettings &settings, double sampleRate) const override
bool ProcessFinalize() noexcept override
Instance(const PerTrackEffect &processor)
bool RealtimeSuspend() override
std::vector< LADSPA_Handle > mSlaves
unsigned GetAudioInCount() const override
How many input buffers to allocate at once.
const LadspaEffect & GetEffect() const
bool RealtimeFinalize(EffectSettings &settings) noexcept override
bool ProcessInitialize(EffectSettings &settings, double sampleRate, ChannelNames chanMap) override
bool RealtimeProcessStart(MessagePackage &package) override
settings are possibly changed, since last call, by an asynchronous dialog
unsigned GetAudioOutCount() const override
How many output buffers to allocate at once.
Carry output control port information back to main thread.
~LadspaEffectOutputs() override
void Assign(EffectOutputs &&src) override
Update one Outputs object from another.
std::vector< float > controls
std::unique_ptr< EffectOutputs > Clone() const override
std::vector< float > controls
Options & AutoPos(bool enable)