Audacity  3.0.3
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
LadspaEffect Class Referencefinal

An Effect that calls up a LADSPA plug in, i.e. many possible effects from this one class. More...

#include <LadspaEffect.h>

Inheritance diagram for LadspaEffect:
[legend]
Collaboration diagram for LadspaEffect:
[legend]

Public Member Functions

 LadspaEffect (const wxString &path, int index)
 
virtual ~LadspaEffect ()
 
PluginPath GetPath () override
 
ComponentInterfaceSymbol GetSymbol () override
 
VendorSymbol GetVendor () override
 
wxString GetVersion () override
 
TranslatableString GetDescription () override
 
EffectType GetType () override
 
EffectFamilySymbol GetFamily () override
 
bool IsInteractive () override
 
bool IsDefault () override
 
bool IsLegacy () override
 
bool SupportsRealtime () override
 
bool SupportsAutomation () override
 
bool SetHost (EffectHostInterface *host) override
 
unsigned GetAudioInCount () override
 
unsigned GetAudioOutCount () override
 
int GetMidiInCount () override
 
int GetMidiOutCount () override
 
void SetSampleRate (double rate) override
 
size_t SetBlockSize (size_t maxBlockSize) override
 
size_t GetBlockSize () const override
 
sampleCount GetLatency () override
 
size_t GetTailSize () override
 
bool IsReady () override
 
bool ProcessInitialize (sampleCount totalLen, ChannelNames chanMap=NULL) override
 
bool ProcessFinalize () override
 
size_t ProcessBlock (float **inBlock, float **outBlock, size_t blockLen) override
 
bool RealtimeInitialize () override
 
bool RealtimeAddProcessor (unsigned numChannels, float sampleRate) override
 
bool RealtimeFinalize () override
 
bool RealtimeSuspend () override
 
bool RealtimeResume () override
 
bool RealtimeProcessStart () override
 
size_t RealtimeProcess (int group, float **inbuf, float **outbuf, size_t numSamples) override
 
bool RealtimeProcessEnd () override
 
bool ShowInterface (wxWindow &parent, const EffectDialogFactory &factory, bool forceModal=false) override
 
bool GetAutomationParameters (CommandParameters &parms) override
 
bool SetAutomationParameters (CommandParameters &parms) override
 
bool LoadUserPreset (const RegistryPath &name) override
 
bool SaveUserPreset (const RegistryPath &name) override
 
RegistryPaths GetFactoryPresets () override
 
bool LoadFactoryPreset (int id) override
 
bool LoadFactoryDefaults () override
 
void SetHostUI (EffectUIHostInterface *host) override
 
bool PopulateUI (ShuttleGui &S) override
 
bool IsGraphicalUI () override
 
bool ValidateUI () override
 
bool HideUI () override
 
bool CloseUI () override
 
bool CanExportPresets () override
 
void ExportPresets () override
 
void ImportPresets () override
 
bool HasOptions () override
 
void ShowOptions () override
 
- Public Member Functions inherited from EffectClientInterface
virtual ~EffectClientInterface ()
 
- Public Member Functions inherited from EffectDefinitionInterface
virtual ~EffectDefinitionInterface ()
 
virtual EffectType GetClassification ()
 
- Public Member Functions inherited from ComponentInterface
virtual ~ComponentInterface ()
 
TranslatableString GetName ()
 
virtual bool DefineParams (ShuttleParams &WXUNUSED(S))
 
- Public Member Functions inherited from EffectUIClientInterface
virtual ~EffectUIClientInterface ()
 

Private Member Functions

bool Load ()
 
void Unload ()
 
bool LoadParameters (const RegistryPath &group)
 
bool SaveParameters (const RegistryPath &group)
 
LADSPA_Handle InitInstance (float sampleRate)
 
void FreeInstance (LADSPA_Handle handle)
 
void OnCheckBox (wxCommandEvent &evt)
 
void OnSlider (wxCommandEvent &evt)
 
void OnTextCtrl (wxCommandEvent &evt)
 
void RefreshControls (bool outputOnly=false)
 

Private Attributes

wxString mPath
 
int mIndex
 
EffectHostInterfacemHost
 
wxDynamicLibrary mLib
 
const LADSPA_DescriptormData
 
wxString pluginName
 
bool mReady
 
LADSPA_Handle mMaster
 
double mSampleRate
 
size_t mBlockSize
 
bool mInteractive
 
unsigned mAudioIns
 
ArrayOf< unsigned long > mInputPorts
 
unsigned mAudioOuts
 
ArrayOf< unsigned long > mOutputPorts
 
int mNumInputControls
 
Floats mInputControls
 
int mNumOutputControls
 
Floats mOutputControls
 
bool mUseLatency
 
int mLatencyPort
 
bool mLatencyDone
 
std::vector< LADSPA_HandlemSlaves
 
EffectUIHostInterfacemUIHost
 
NumericTextCtrlmDuration
 
wxDialog * mDialog
 
wxWindow * mParent
 
ArrayOf< wxSlider * > mSliders
 
ArrayOf< wxTextCtrl * > mFields
 
ArrayOf< wxStaticText * > mLabels
 
ArrayOf< wxCheckBox * > mToggles
 
ArrayOf< LadspaEffectMeter * > mMeters
 

Friends

class LadspaEffectsModule
 

Additional Inherited Members

- Public Types inherited from EffectClientInterface
using EffectDialogFactory = std::function< wxDialog *(wxWindow &parent, EffectHostInterface *, EffectUIClientInterface *) >
 

Detailed Description

An Effect that calls up a LADSPA plug in, i.e. many possible effects from this one class.

Definition at line 42 of file LadspaEffect.h.

Constructor & Destructor Documentation

◆ LadspaEffect()

LadspaEffect::LadspaEffect ( const wxString &  path,
int  index 
)

Definition at line 605 of file LadspaEffect.cpp.

606 {
607  mPath = path;
608  mIndex = index;
609  mData = NULL;
610 
611  mHost = NULL;
612  mMaster = NULL;
613  mReady = false;
614 
615  mInteractive = false;
616 
617  mAudioIns = 0;
618  mAudioOuts = 0;
619  mNumInputControls = 0;
620  mNumOutputControls = 0;
621  mSampleRate = 44100;
622  mBlockSize = 0;
623 
624  mLatencyPort = -1;
625 
626  mDialog = NULL;
627  mParent = NULL;
628 }

◆ ~LadspaEffect()

LadspaEffect::~LadspaEffect ( )
virtual

Definition at line 630 of file LadspaEffect.cpp.

631 {
632 }

Member Function Documentation

◆ CanExportPresets()

bool LadspaEffect::CanExportPresets ( )
overridevirtual

Implements EffectUIClientInterface.

Definition at line 1544 of file LadspaEffect.cpp.

1545 {
1546  return false;
1547 }

◆ CloseUI()

bool LadspaEffect::CloseUI ( )
overridevirtual

Implements EffectUIClientInterface.

Definition at line 1528 of file LadspaEffect.cpp.

1529 {
1530  mParent->RemoveEventHandler(this);
1531 
1532  mToggles.reset();
1533  mSliders.reset();
1534  mFields.reset();
1535  mLabels.reset();
1536 
1537  mUIHost = NULL;
1538  mParent = NULL;
1539  mDialog = NULL;
1540 
1541  return true;
1542 }

◆ ExportPresets()

void LadspaEffect::ExportPresets ( )
overridevirtual

Implements EffectUIClientInterface.

Definition at line 1549 of file LadspaEffect.cpp.

1550 {
1551 }

◆ FreeInstance()

void LadspaEffect::FreeInstance ( LADSPA_Handle  handle)
private

Definition at line 1690 of file LadspaEffect.cpp.

1691 {
1692  if (mData->deactivate)
1693  {
1694  mData->deactivate(handle);
1695  }
1696 
1697  mData->cleanup(handle);
1698 }

◆ GetAudioInCount()

unsigned LadspaEffect::GetAudioInCount ( )
overridevirtual

Implements EffectClientInterface.

Definition at line 883 of file LadspaEffect.cpp.

884 {
885  return mAudioIns;
886 }

◆ GetAudioOutCount()

unsigned LadspaEffect::GetAudioOutCount ( )
overridevirtual

Implements EffectClientInterface.

Definition at line 888 of file LadspaEffect.cpp.

889 {
890  return mAudioOuts;
891 }

◆ GetAutomationParameters()

bool LadspaEffect::GetAutomationParameters ( CommandParameters parms)
overridevirtual

Implements EffectClientInterface.

Definition at line 1097 of file LadspaEffect.cpp.

1098 {
1099  for (unsigned long p = 0; p < mData->PortCount; p++)
1100  {
1102 
1104  {
1105  if (!parms.Write(LAT1CTOWX(mData->PortNames[p]), mInputControls[p]))
1106  {
1107  return false;
1108  }
1109  }
1110  }
1111 
1112  return true;
1113 }

References LADSPA_IS_PORT_CONTROL, LADSPA_IS_PORT_INPUT, and LAT1CTOWX.

◆ GetBlockSize()

size_t LadspaEffect::GetBlockSize ( ) const
overridevirtual

Implements EffectClientInterface.

Definition at line 915 of file LadspaEffect.cpp.

916 {
917  return mBlockSize;
918 }

◆ GetDescription()

TranslatableString LadspaEffect::GetDescription ( )
overridevirtual

Implements ComponentInterface.

Definition at line 658 of file LadspaEffect.cpp.

659 {
660  return Verbatim( LAT1CTOWX(mData->Copyright) );
661 }

References LAT1CTOWX, and Verbatim().

Here is the call graph for this function:

◆ GetFactoryPresets()

RegistryPaths LadspaEffect::GetFactoryPresets ( )
overridevirtual

Implements EffectClientInterface.

Definition at line 1154 of file LadspaEffect.cpp.

1155 {
1156  return {};
1157 }

◆ GetFamily()

EffectFamilySymbol LadspaEffect::GetFamily ( )
overridevirtual

Implements EffectDefinitionInterface.

Definition at line 687 of file LadspaEffect.cpp.

688 {
689  return LADSPAEFFECTS_FAMILY;
690 }

References LADSPAEFFECTS_FAMILY.

◆ GetLatency()

sampleCount LadspaEffect::GetLatency ( )
overridevirtual

Implements EffectClientInterface.

Definition at line 920 of file LadspaEffect.cpp.

921 {
922  if (mUseLatency && mLatencyPort >= 0 && !mLatencyDone)
923  {
924  mLatencyDone = true;
926  }
927 
928  return 0;
929 }

◆ GetMidiInCount()

int LadspaEffect::GetMidiInCount ( )
overridevirtual

Implements EffectClientInterface.

Definition at line 893 of file LadspaEffect.cpp.

894 {
895  return 0;
896 }

◆ GetMidiOutCount()

int LadspaEffect::GetMidiOutCount ( )
overridevirtual

Implements EffectClientInterface.

Definition at line 898 of file LadspaEffect.cpp.

899 {
900  return 0;
901 }

◆ GetPath()

PluginPath LadspaEffect::GetPath ( )
overridevirtual

Implements ComponentInterface.

Definition at line 638 of file LadspaEffect.cpp.

639 {
640  return wxString::Format(wxT("%s;%d"), mPath, mIndex);
641 }

◆ GetSymbol()

ComponentInterfaceSymbol LadspaEffect::GetSymbol ( )
overridevirtual

Implements ComponentInterface.

Definition at line 643 of file LadspaEffect.cpp.

644 {
645  return LAT1CTOWX(mData->Name);
646 }

References LAT1CTOWX.

◆ GetTailSize()

size_t LadspaEffect::GetTailSize ( )
overridevirtual

Implements EffectClientInterface.

Definition at line 931 of file LadspaEffect.cpp.

932 {
933  return 0;
934 }

◆ GetType()

EffectType LadspaEffect::GetType ( )
overridevirtual

Implements EffectDefinitionInterface.

Definition at line 667 of file LadspaEffect.cpp.

668 {
669  if (mAudioIns == 0 && mAudioOuts == 0)
670  {
671  return EffectTypeTool;
672  }
673 
674  if (mAudioIns == 0)
675  {
676  return EffectTypeGenerate;
677  }
678 
679  if (mAudioOuts == 0)
680  {
681  return EffectTypeAnalyze;
682  }
683 
684  return EffectTypeProcess;
685 }

References EffectTypeAnalyze, EffectTypeGenerate, EffectTypeProcess, and EffectTypeTool.

◆ GetVendor()

VendorSymbol LadspaEffect::GetVendor ( )
overridevirtual

Implements ComponentInterface.

Definition at line 648 of file LadspaEffect.cpp.

649 {
650  return { LAT1CTOWX(mData->Maker) };
651 }

References LAT1CTOWX.

◆ GetVersion()

wxString LadspaEffect::GetVersion ( )
overridevirtual

Implements ComponentInterface.

Definition at line 653 of file LadspaEffect.cpp.

654 {
655  return _("n/a");
656 }

References _.

◆ HasOptions()

bool LadspaEffect::HasOptions ( )
overridevirtual

Implements EffectUIClientInterface.

Definition at line 1557 of file LadspaEffect.cpp.

1558 {
1559  return true;
1560 }

◆ HideUI()

bool LadspaEffect::HideUI ( )
overridevirtual

Implements EffectUIClientInterface.

Definition at line 1523 of file LadspaEffect.cpp.

1524 {
1525  return true;
1526 }

◆ ImportPresets()

void LadspaEffect::ImportPresets ( )
overridevirtual

Implements EffectUIClientInterface.

Definition at line 1553 of file LadspaEffect.cpp.

1554 {
1555 }

◆ InitInstance()

LADSPA_Handle LadspaEffect::InitInstance ( float  sampleRate)
private

Definition at line 1657 of file LadspaEffect.cpp.

1658 {
1659  /* Instantiate the plugin */
1660  LADSPA_Handle handle = mData->instantiate(mData, sampleRate);
1661  if (!handle)
1662  {
1663  return NULL;
1664  }
1665 
1666  for (unsigned long p = 0; p < mData->PortCount; p++)
1667  {
1669  if (LADSPA_IS_PORT_CONTROL(d))
1670  {
1671  if (LADSPA_IS_PORT_INPUT(d))
1672  {
1673  mData->connect_port(handle, p, &mInputControls[p]);
1674  }
1675  else
1676  {
1677  mData->connect_port(handle, p, &mOutputControls[p]);
1678  }
1679  }
1680  }
1681 
1682  if (mData->activate)
1683  {
1684  mData->activate(handle);
1685  }
1686 
1687  return handle;
1688 }

References LADSPA_IS_PORT_CONTROL, and LADSPA_IS_PORT_INPUT.

◆ IsDefault()

bool LadspaEffect::IsDefault ( )
overridevirtual

Implements EffectDefinitionInterface.

Definition at line 697 of file LadspaEffect.cpp.

698 {
699  return false;
700 }

◆ IsGraphicalUI()

bool LadspaEffect::IsGraphicalUI ( )
overridevirtual

Implements EffectUIClientInterface.

Definition at line 1503 of file LadspaEffect.cpp.

1504 {
1505  return false;
1506 }

◆ IsInteractive()

bool LadspaEffect::IsInteractive ( )
overridevirtual

Implements EffectDefinitionInterface.

Definition at line 692 of file LadspaEffect.cpp.

693 {
694  return mInteractive;
695 }

◆ IsLegacy()

bool LadspaEffect::IsLegacy ( )
overridevirtual

Implements EffectDefinitionInterface.

Definition at line 702 of file LadspaEffect.cpp.

703 {
704  return false;
705 }

◆ IsReady()

bool LadspaEffect::IsReady ( )
overridevirtual

Implements EffectClientInterface.

Definition at line 936 of file LadspaEffect.cpp.

937 {
938  return mReady;
939 }

◆ Load()

bool LadspaEffect::Load ( )
private

Definition at line 1576 of file LadspaEffect.cpp.

1577 {
1578  if (mLib.IsLoaded())
1579  {
1580  return true;
1581  }
1582 
1583  wxFileName ff = mPath;
1584  wxString envpath;
1585  bool hadpath = wxGetEnv(wxT("PATH"), &envpath);
1586  wxSetEnv(wxT("PATH"), ff.GetPath() + wxFILE_SEP_PATH + envpath);
1587  wxString saveOldCWD = ff.GetCwd();
1588  ff.SetCwd();
1589 
1590  LADSPA_Descriptor_Function mainFn = NULL;
1591 
1592  if (mLib.Load(mPath, wxDL_NOW))
1593  {
1594  wxLogNull logNo;
1595 
1596  mainFn = (LADSPA_Descriptor_Function) mLib.GetSymbol(wxT("ladspa_descriptor"));
1597  if (mainFn)
1598  {
1599  mData = mainFn(mIndex);
1600  return true;
1601  }
1602  }
1603 
1604  if (mLib.IsLoaded())
1605  {
1606  mLib.Unload();
1607  }
1608 
1609  wxSetWorkingDirectory(saveOldCWD);
1610  hadpath ? wxSetEnv(wxT("PATH"), envpath) : wxUnsetEnv(wxT("PATH"));
1611 
1612  return false;
1613 }

◆ LoadFactoryDefaults()

bool LadspaEffect::LoadFactoryDefaults ( )
overridevirtual

Implements EffectClientInterface.

Definition at line 1164 of file LadspaEffect.cpp.

1165 {
1167  {
1168  return false;
1169  }
1170 
1171  RefreshControls();
1172 
1173  return true;
1174 }

◆ LoadFactoryPreset()

bool LadspaEffect::LoadFactoryPreset ( int  id)
overridevirtual

Implements EffectClientInterface.

Definition at line 1159 of file LadspaEffect.cpp.

1160 {
1161  return true;
1162 }

◆ LoadParameters()

bool LadspaEffect::LoadParameters ( const RegistryPath group)
private

Definition at line 1623 of file LadspaEffect.cpp.

1624 {
1625  wxString parms;
1626  if (!mHost->GetPrivateConfig(group, wxT("Parameters"), parms, wxEmptyString))
1627  {
1628  return false;
1629  }
1630 
1631  CommandParameters eap;
1632  if (!eap.SetParameters(parms))
1633  {
1634  return false;
1635  }
1636 
1637  return SetAutomationParameters(eap);
1638 }

References CommandParameters::SetParameters().

Here is the call graph for this function:

◆ LoadUserPreset()

bool LadspaEffect::LoadUserPreset ( const RegistryPath name)
overridevirtual

Implements EffectClientInterface.

Definition at line 1137 of file LadspaEffect.cpp.

1138 {
1139  if (!LoadParameters(name))
1140  {
1141  return false;
1142  }
1143 
1144  RefreshControls();
1145 
1146  return true;
1147 }

References name.

◆ OnCheckBox()

void LadspaEffect::OnCheckBox ( wxCommandEvent &  evt)
private

Definition at line 1700 of file LadspaEffect.cpp.

1701 {
1702  int p = evt.GetId() - ID_Toggles;
1703 
1704  mInputControls[p] = mToggles[p]->GetValue();
1705 }

References ID_Toggles.

◆ OnSlider()

void LadspaEffect::OnSlider ( wxCommandEvent &  evt)
private

Definition at line 1707 of file LadspaEffect.cpp.

1708 {
1709  int p = evt.GetId() - ID_Sliders;
1710 
1711  float val;
1712  float lower = float(0.0);
1713  float upper = float(10.0);
1714  float range;
1715  bool forceint = false;
1716 
1719  lower = hint.LowerBound;
1721  upper = hint.UpperBound;
1723  lower *= mSampleRate;
1724  upper *= mSampleRate;
1725  forceint = true;
1726  }
1727 
1728  range = upper - lower;
1729 
1730  val = (mSliders[p]->GetValue() / 1000.0) * range + lower;
1731 
1732  wxString str;
1733  if (LADSPA_IS_HINT_INTEGER(hint.HintDescriptor) || forceint)
1734  str.Printf(wxT("%d"), (int)(val + 0.5));
1735  else
1736  str = Internat::ToDisplayString(val);
1737 
1738  mFields[p]->SetValue(str);
1739 
1740  mInputControls[p] = val;
1741 }

References _LADSPA_PortRangeHint::HintDescriptor, ID_Sliders, LADSPA_IS_HINT_BOUNDED_ABOVE, LADSPA_IS_HINT_BOUNDED_BELOW, LADSPA_IS_HINT_INTEGER, LADSPA_IS_HINT_SAMPLE_RATE, _LADSPA_PortRangeHint::LowerBound, Internat::ToDisplayString(), and _LADSPA_PortRangeHint::UpperBound.

Here is the call graph for this function:

◆ OnTextCtrl()

void LadspaEffect::OnTextCtrl ( wxCommandEvent &  evt)
private

Definition at line 1743 of file LadspaEffect.cpp.

1744 {
1745  LadspaEffect *that = this;
1746  int p = evt.GetId() - ID_Texts;
1747 
1748  float val;
1749  float lower = float(0.0);
1750  float upper = float(10.0);
1751  float range;
1752 
1753  val = Internat::CompatibleToDouble(that->mFields[p]->GetValue());
1754 
1755  LADSPA_PortRangeHint hint = that->mData->PortRangeHints[p];
1757  lower = hint.LowerBound;
1759  upper = hint.UpperBound;
1761  lower *= mSampleRate;
1762  upper *= mSampleRate;
1763  }
1764  range = upper - lower;
1765 
1766  if (val < lower)
1767  val = lower;
1768  if (val > upper)
1769  val = upper;
1770 
1771  mInputControls[p] = val;
1772 
1773  that->mSliders[p]->SetValue((int)(((val-lower)/range) * 1000.0 + 0.5));
1774 }

References Internat::CompatibleToDouble(), _LADSPA_PortRangeHint::HintDescriptor, ID_Texts, LADSPA_IS_HINT_BOUNDED_ABOVE, LADSPA_IS_HINT_BOUNDED_BELOW, LADSPA_IS_HINT_SAMPLE_RATE, _LADSPA_PortRangeHint::LowerBound, mData, mFields, mSliders, _LADSPA_Descriptor::PortRangeHints, and _LADSPA_PortRangeHint::UpperBound.

Here is the call graph for this function:

◆ PopulateUI()

bool LadspaEffect::PopulateUI ( ShuttleGui S)
overridevirtual

Implements EffectUIClientInterface.

Definition at line 1185 of file LadspaEffect.cpp.

1186 {
1187  auto parent = S.GetParent();
1188 
1189  mParent = parent;
1190 
1191  mParent->PushEventHandler(this);
1192 
1195  mFields.reinit( mData->PortCount, true);
1198 
1199  wxASSERT(mParent); // To justify safenew
1200  wxScrolledWindow *const w = safenew wxScrolledWindow(mParent,
1201  wxID_ANY,
1202  wxDefaultPosition,
1203  wxDefaultSize,
1204  wxVSCROLL | wxTAB_TRAVERSAL);
1205 
1206  {
1207  auto mainSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
1208  w->SetScrollRate(0, 20);
1209 
1210  // This fools NVDA into not saying "Panel" when the dialog gets focus
1211  w->SetName(wxT("\a"));
1212  w->SetLabel(wxT("\a"));
1213 
1214  mainSizer->Add(w, 1, wxEXPAND);
1215  mParent->SetSizer(mainSizer.release());
1216  }
1217 
1218  wxSizer *marginSizer;
1219  {
1220  auto uMarginSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
1221  marginSizer = uMarginSizer.get();
1222 
1223  if (mNumInputControls)
1224  {
1225  auto paramSizer = std::make_unique<wxStaticBoxSizer>(wxVERTICAL, w, _("Effect Settings"));
1226 
1227  auto gridSizer = std::make_unique<wxFlexGridSizer>(5, 0, 0);
1228  gridSizer->AddGrowableCol(3);
1229 
1230  wxControl *item;
1231 
1232  // Add the duration control for generators
1233  if (GetType() == EffectTypeGenerate)
1234  {
1235  item = safenew wxStaticText(w, 0, _("Duration:"));
1236  gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
1237  mDuration = safenew
1241  mHost->GetDuration(),
1242  mSampleRate,
1244  .AutoPos(true));
1245  mDuration->SetName( XO("Duration") );
1246  gridSizer->Add(mDuration, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
1247  gridSizer->Add(1, 1, 0);
1248  gridSizer->Add(1, 1, 0);
1249  gridSizer->Add(1, 1, 0);
1250  }
1251 
1252  for (unsigned long p = 0; p < mData->PortCount; p++)
1253  {
1256  {
1257  continue;
1258  }
1259 
1260  wxString labelText = LAT1CTOWX(mData->PortNames[p]);
1261  item = safenew wxStaticText(w, 0, wxString::Format(_("%s:"), labelText));
1262  gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
1263 
1264  wxString fieldText;
1266 
1268  {
1269  mToggles[p] = safenew wxCheckBox(w, ID_Toggles + p, wxT(""));
1270  mToggles[p]->SetName(labelText);
1271  mToggles[p]->SetValue(mInputControls[p] > 0);
1272  gridSizer->Add(mToggles[p], 0, wxALL, 5);
1273 
1274  gridSizer->Add(1, 1, 0);
1275  gridSizer->Add(1, 1, 0);
1276  gridSizer->Add(1, 1, 0);
1277  continue;
1278  }
1279 
1280  wxString bound;
1281  float lower = -FLT_MAX;
1282  float upper = FLT_MAX;
1283  bool haslo = false;
1284  bool hashi = false;
1285  bool forceint = false;
1286 
1288  {
1289  lower = hint.LowerBound;
1290  haslo = true;
1291  }
1292 
1294  {
1295  upper = hint.UpperBound;
1296  hashi = true;
1297  }
1298 
1300  {
1301  lower *= mSampleRate;
1302  upper *= mSampleRate;
1303  forceint = true;
1304  }
1305 
1306  // Limit to the UI precision
1307  lower = ceilf(lower * 1000000.0) / 1000000.0;
1308  upper = floorf(upper * 1000000.0) / 1000000.0;
1309  mInputControls[p] = roundf(mInputControls[p] * 1000000.0) / 1000000.0;
1310 
1311  if (haslo && mInputControls[p] < lower)
1312  {
1313  mInputControls[p] = lower;
1314  }
1315 
1316  if (hashi && mInputControls[p] > upper)
1317  {
1318  mInputControls[p] = lower;
1319  }
1320 
1321  // Don't specify a value at creation time. This prevents unwanted events
1322  // being sent to the OnTextCtrl() handler before the associated slider
1323  // has been created.
1324  mFields[p] = safenew wxTextCtrl(w, ID_Texts + p);
1325  mFields[p]->SetName(labelText);
1326  gridSizer->Add(mFields[p], 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
1327 
1328  wxString str;
1329  if (haslo)
1330  {
1331  if (LADSPA_IS_HINT_INTEGER(hint.HintDescriptor) || forceint)
1332  {
1333  str.Printf(wxT("%d"), (int)(lower + 0.5));
1334  }
1335  else
1336  {
1337  str = Internat::ToDisplayString(lower);
1338  }
1339  item = safenew wxStaticText(w, 0, str);
1340  gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
1341  }
1342  else
1343  {
1344  gridSizer->Add(1, 1, 0);
1345  }
1346 
1348  0, 0, 1000,
1349  wxDefaultPosition,
1350  wxSize(200, -1));
1351 #if wxUSE_ACCESSIBILITY
1352  // so that name can be set on a standard control
1353  mSliders[p]->SetAccessible(safenew WindowAccessible(mSliders[p]));
1354 #endif
1355  mSliders[p]->SetName(labelText);
1356  gridSizer->Add(mSliders[p], 0, wxALIGN_CENTER_VERTICAL | wxEXPAND | wxALL, 5);
1357 
1358  if (hashi)
1359  {
1360  if (LADSPA_IS_HINT_INTEGER(hint.HintDescriptor) || forceint)
1361  {
1362  str.Printf(wxT("%d"), (int)(upper + 0.5));
1363  }
1364  else
1365  {
1366  str = Internat::ToDisplayString(upper);
1367  }
1368  item = safenew wxStaticText(w, 0, str);
1369  gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxALL, 5);
1370  }
1371  else
1372  {
1373  gridSizer->Add(1, 1, 0);
1374  }
1375 
1376  if (LADSPA_IS_HINT_INTEGER(hint.HintDescriptor) || forceint)
1377  {
1378  fieldText.Printf(wxT("%d"), (int)(mInputControls[p] + 0.5));
1379 
1380  IntegerValidator<float> vld(&mInputControls[p]);
1381  vld.SetRange(haslo ? lower : INT_MIN,
1382  hashi ? upper : INT_MAX);
1383  mFields[p]->SetValidator(vld);
1384  }
1385  else
1386  {
1387  fieldText = Internat::ToDisplayString(mInputControls[p]);
1388 
1389  // > 12 decimal places can cause rounding errors in display.
1390  FloatingPointValidator<float> vld(6, &mInputControls[p]);
1391  vld.SetRange(lower, upper);
1392 
1393  // Set number of decimal places
1394  if (upper - lower < 10.0)
1395  {
1396  vld.SetStyle(NumValidatorStyle::THREE_TRAILING_ZEROES);
1397  }
1398  else if (upper - lower < 100.0)
1399  {
1400  vld.SetStyle(NumValidatorStyle::TWO_TRAILING_ZEROES);
1401  }
1402  else
1403  {
1404  vld.SetStyle(NumValidatorStyle::ONE_TRAILING_ZERO);
1405  }
1406 
1407  mFields[p]->SetValidator(vld);
1408  }
1409 
1410  // Set the textctrl value. This will trigger an event so OnTextCtrl()
1411  // can update the slider.
1412  mFields[p]->SetValue(fieldText);
1413  }
1414 
1415  paramSizer->Add(gridSizer.release(), 0, wxEXPAND | wxALL, 5);
1416  marginSizer->Add(paramSizer.release(), 0, wxEXPAND | wxALL, 5);
1417  }
1418 
1419  if (mNumOutputControls > 0)
1420  {
1421  auto paramSizer = std::make_unique<wxStaticBoxSizer>(wxVERTICAL, w, _("Effect Output"));
1422 
1423  auto gridSizer = std::make_unique<wxFlexGridSizer>(2, 0, 0);
1424  gridSizer->AddGrowableCol(1);
1425 
1426  wxControl *item;
1427 
1428  for (unsigned long p = 0; p < mData->PortCount; p++)
1429  {
1432  {
1433  continue;
1434  }
1435 
1436  wxString labelText = LAT1CTOWX(mData->PortNames[p]);
1437  item = safenew wxStaticText(w, 0, wxString::Format(_("%s:"), labelText));
1438  gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
1439 
1440  //LADSPA_PortRangeHint hint = mData->PortRangeHints[p];
1441 
1442  wxString bound;
1443  float lower = 0.0;
1444  float upper = 1.0;
1445 
1446  /*
1447  bool haslo = false;
1448  bool hashi = false;
1449  bool forceint = false;
1450 
1451  if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor))
1452  {
1453  lower = hint.LowerBound;
1454  haslo = true;
1455  }
1456 
1457  if (LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor))
1458  {
1459  upper = hint.UpperBound;
1460  hashi = true;
1461  }
1462 
1463  if (LADSPA_IS_HINT_SAMPLE_RATE(hint.HintDescriptor))
1464  {
1465  lower *= mSampleRate;
1466  upper *= mSampleRate;
1467  forceint = true;
1468  }
1469  */
1470 
1471  // Limit to the UI precision
1472  lower = ceilf(lower * 1000000.0) / 1000000.0;
1473  upper = floorf(upper * 1000000.0) / 1000000.0;
1474  mInputControls[p] = roundf(mInputControls[p] * 1000000.0) / 1000000.0;
1475 
1476  mMeters[p] = safenew LadspaEffectMeter(w, mOutputControls[p], lower, upper);
1477  mMeters[p]->SetLabel(labelText); // for screen readers
1478  gridSizer->Add(mMeters[p], 1, wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALL, 5);
1479  }
1480 
1481  paramSizer->Add(gridSizer.release(), 0, wxEXPAND | wxALL, 5);
1482  marginSizer->Add(paramSizer.release(), 0, wxEXPAND | wxALL, 5);
1483 
1484  RefreshControls(true);
1485  }
1486 
1487  w->SetSizer(uMarginSizer.release());
1488  }
1489 
1490  w->Layout();
1491 
1492  // Try to give the window a sensible default/minimum size
1493  wxSize sz1 = marginSizer->GetMinSize();
1494  wxSize sz2 = mParent->GetMinSize();
1495  w->SetMinSize( { std::min(sz1.x, sz2.x), std::min(sz1.y, sz2.y) } );
1496 
1497  // And let the parent reduce to the NEW minimum if possible
1498  mParent->SetMinSize({ -1, -1 });
1499 
1500  return true;
1501 }

References _, NumericTextCtrl::Options::AutoPos(), EffectTypeGenerate, ShuttleGuiBase::GetParent(), _LADSPA_PortRangeHint::HintDescriptor, ID_Duration, ID_Sliders, ID_Texts, ID_Toggles, LADSPA_IS_HINT_BOUNDED_ABOVE, LADSPA_IS_HINT_BOUNDED_BELOW, LADSPA_IS_HINT_INTEGER, LADSPA_IS_HINT_SAMPLE_RATE, LADSPA_IS_HINT_TOGGLED, LADSPA_IS_PORT_AUDIO, LADSPA_IS_PORT_INPUT, LADSPA_IS_PORT_OUTPUT, LAT1CTOWX, _LADSPA_PortRangeHint::LowerBound, min(), safenew, NumericConverter::TIME, Internat::ToDisplayString(), _LADSPA_PortRangeHint::UpperBound, and XO.

Here is the call graph for this function:

◆ ProcessBlock()

size_t LadspaEffect::ProcessBlock ( float **  inBlock,
float **  outBlock,
size_t  blockLen 
)
overridevirtual

Implements EffectClientInterface.

Definition at line 972 of file LadspaEffect.cpp.

973 {
974  for (int i = 0; i < (int)mAudioIns; i++)
975  {
976  mData->connect_port(mMaster, mInputPorts[i], inBlock[i]);
977  }
978 
979  for (int i = 0; i < (int)mAudioOuts; i++)
980  {
981  mData->connect_port(mMaster, mOutputPorts[i], outBlock[i]);
982  }
983 
984  mData->run(mMaster, blockLen);
985 
986  RefreshControls(true);
987 
988  return blockLen;
989 }

◆ ProcessFinalize()

bool LadspaEffect::ProcessFinalize ( )
overridevirtual

Implements EffectClientInterface.

Definition at line 959 of file LadspaEffect.cpp.

960 {
961  if (mReady)
962  {
963  mReady = false;
964 
966  mMaster = NULL;
967  }
968 
969  return true;
970 }

◆ ProcessInitialize()

bool LadspaEffect::ProcessInitialize ( sampleCount  totalLen,
ChannelNames  chanMap = NULL 
)
overridevirtual

Implements EffectClientInterface.

Definition at line 941 of file LadspaEffect.cpp.

942 {
943  /* Instantiate the plugin */
944  if (!mReady)
945  {
947  if (!mMaster)
948  {
949  return false;
950  }
951  mReady = true;
952  }
953 
954  mLatencyDone = false;
955 
956  return true;
957 }

◆ RealtimeAddProcessor()

bool LadspaEffect::RealtimeAddProcessor ( unsigned  numChannels,
float  sampleRate 
)
overridevirtual

Implements EffectClientInterface.

Definition at line 996 of file LadspaEffect.cpp.

997 {
998  LADSPA_Handle slave = InitInstance(sampleRate);
999  if (!slave)
1000  {
1001  return false;
1002  }
1003 
1004  mSlaves.push_back(slave);
1005 
1006  return true;
1007 }

◆ RealtimeFinalize()

bool LadspaEffect::RealtimeFinalize ( )
overridevirtual

Implements EffectClientInterface.

Definition at line 1009 of file LadspaEffect.cpp.

1010 {
1011  for (size_t i = 0, cnt = mSlaves.size(); i < cnt; i++)
1012  {
1013  FreeInstance(mSlaves[i]);
1014  }
1015  mSlaves.clear();
1016 
1017  return true;
1018 }

◆ RealtimeInitialize()

bool LadspaEffect::RealtimeInitialize ( )
overridevirtual

Implements EffectClientInterface.

Definition at line 991 of file LadspaEffect.cpp.

992 {
993  return true;
994 }

◆ RealtimeProcess()

size_t LadspaEffect::RealtimeProcess ( int  group,
float **  inbuf,
float **  outbuf,
size_t  numSamples 
)
overridevirtual

Implements EffectClientInterface.

Definition at line 1035 of file LadspaEffect.cpp.

1039 {
1040  for (int i = 0; i < (int)mAudioIns; i++)
1041  {
1042  mData->connect_port(mSlaves[group], mInputPorts[i], inbuf[i]);
1043  }
1044 
1045  for (int i = 0; i < (int)mAudioOuts; i++)
1046  {
1047  mData->connect_port(mSlaves[group], mOutputPorts[i], outbuf[i]);
1048  }
1049 
1050  mData->run(mSlaves[group], numSamples);
1051 
1052  return numSamples;
1053 }

◆ RealtimeProcessEnd()

bool LadspaEffect::RealtimeProcessEnd ( )
overridevirtual

Implements EffectClientInterface.

Definition at line 1055 of file LadspaEffect.cpp.

1056 {
1057  return true;
1058 }

◆ RealtimeProcessStart()

bool LadspaEffect::RealtimeProcessStart ( )
overridevirtual

Implements EffectClientInterface.

Definition at line 1030 of file LadspaEffect.cpp.

1031 {
1032  return true;
1033 }

◆ RealtimeResume()

bool LadspaEffect::RealtimeResume ( )
overridevirtual

Implements EffectClientInterface.

Definition at line 1025 of file LadspaEffect.cpp.

1026 {
1027  return true;
1028 }

◆ RealtimeSuspend()

bool LadspaEffect::RealtimeSuspend ( )
overridevirtual

Implements EffectClientInterface.

Definition at line 1020 of file LadspaEffect.cpp.

1021 {
1022  return true;
1023 }

◆ RefreshControls()

void LadspaEffect::RefreshControls ( bool  outputOnly = false)
private

Definition at line 1776 of file LadspaEffect.cpp.

1777 {
1778  if (!mParent)
1779  {
1780  return;
1781  }
1782 
1783  for (unsigned long p = 0; p < mData->PortCount; p++)
1784  {
1786  if (!(LADSPA_IS_PORT_CONTROL(d)))
1787  {
1788  continue;
1789  }
1790 
1791  wxString fieldText;
1793 
1794  bool forceint = false;
1796  {
1797  forceint = true;
1798  }
1799 
1800  if (LADSPA_IS_PORT_OUTPUT(d))
1801  {
1802  continue;
1803  }
1804 
1805  if (outputOnly)
1806  {
1807  continue;
1808  }
1809 
1811  {
1812  mToggles[p]->SetValue(mInputControls[p] > 0);
1813  continue;
1814  }
1815 
1816  if (LADSPA_IS_HINT_INTEGER(hint.HintDescriptor) || forceint)
1817  {
1818  fieldText.Printf(wxT("%d"), (int)(mInputControls[p] + 0.5));
1819  }
1820  else
1821  {
1822  fieldText = Internat::ToDisplayString(mInputControls[p]);
1823  }
1824 
1825  // Set the textctrl value. This will trigger an event so OnTextCtrl()
1826  // can update the slider.
1827  mFields[p]->SetValue(fieldText);
1828  }
1829 }

References _LADSPA_PortRangeHint::HintDescriptor, LADSPA_IS_HINT_INTEGER, LADSPA_IS_HINT_SAMPLE_RATE, LADSPA_IS_HINT_TOGGLED, LADSPA_IS_PORT_CONTROL, LADSPA_IS_PORT_OUTPUT, and Internat::ToDisplayString().

Here is the call graph for this function:

◆ SaveParameters()

bool LadspaEffect::SaveParameters ( const RegistryPath group)
private

Definition at line 1640 of file LadspaEffect.cpp.

1641 {
1642  CommandParameters eap;
1643  if (!GetAutomationParameters(eap))
1644  {
1645  return false;
1646  }
1647 
1648  wxString parms;
1649  if (!eap.GetParameters(parms))
1650  {
1651  return false;
1652  }
1653 
1654  return mHost->SetPrivateConfig(group, wxT("Parameters"), parms);
1655 }

References CommandParameters::GetParameters().

Here is the call graph for this function:

◆ SaveUserPreset()

bool LadspaEffect::SaveUserPreset ( const RegistryPath name)
overridevirtual

Implements EffectClientInterface.

Definition at line 1149 of file LadspaEffect.cpp.

1150 {
1151  return SaveParameters(name);
1152 }

References name.

◆ SetAutomationParameters()

bool LadspaEffect::SetAutomationParameters ( CommandParameters parms)
overridevirtual

Implements EffectClientInterface.

Definition at line 1115 of file LadspaEffect.cpp.

1116 {
1117  for (unsigned long p = 0; p < mData->PortCount; p++)
1118  {
1119  LADSPA_PortDescriptor descriptor = mData->PortDescriptors[p];
1120 
1121  if (LADSPA_IS_PORT_CONTROL(descriptor) && LADSPA_IS_PORT_INPUT(descriptor))
1122  {
1123  wxString labelText = LAT1CTOWX(mData->PortNames[p]);
1124  double d = 0.0;
1125  if (!parms.Read(labelText, &d))
1126  {
1127  return false;
1128  }
1129 
1130  mInputControls[p] = d;
1131  }
1132  }
1133 
1134  return true;
1135 }

References LADSPA_IS_PORT_CONTROL, LADSPA_IS_PORT_INPUT, and LAT1CTOWX.

◆ SetBlockSize()

size_t LadspaEffect::SetBlockSize ( size_t  maxBlockSize)
overridevirtual

Implements EffectClientInterface.

Definition at line 908 of file LadspaEffect.cpp.

909 {
910  mBlockSize = maxBlockSize;
911 
912  return mBlockSize;
913 }

◆ SetHost()

bool LadspaEffect::SetHost ( EffectHostInterface host)
overridevirtual

Implements EffectClientInterface.

Definition at line 721 of file LadspaEffect.cpp.

722 {
723  mHost = host;
724 
725  if (!Load())
726  {
727  return false;
728  }
729 
734 
735  for (unsigned long p = 0; p < mData->PortCount; p++)
736  {
738 
739  // Collect the audio ports
740  if (LADSPA_IS_PORT_AUDIO(d))
741  {
742  if (LADSPA_IS_PORT_INPUT(d))
743  {
744  mInputPorts[mAudioIns++] = p;
745  }
746  else if (LADSPA_IS_PORT_OUTPUT(d))
747  {
748  mOutputPorts[mAudioOuts++] = p;
749  }
750  }
751  // Determine the port's default value
753  {
754  mInteractive = true;
755 
757  float val = float(1.0);
758  float lower = hint.LowerBound;
759  float upper = hint.UpperBound;
760 
762  {
763  lower *= mSampleRate;
764  upper *= mSampleRate;
765  }
766 
767  if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor) && val < lower)
768  {
769  val = lower;
770  }
771 
772  if (LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor) && val > upper)
773  {
774  val = upper;
775  }
776 
778  {
779  val = lower;
780  }
781 
783  {
784  val = upper;
785  }
786 
788  {
790  {
791  val = exp(log(lower) * 0.75f + log(upper) * 0.25f);
792  }
793  else
794  {
795  val = lower * 0.75f + upper * 0.25f;
796  }
797  }
798 
800  {
802  {
803  val = exp(log(lower) * 0.5f + log(upper) * 0.5f);
804  }
805  else
806  {
807  val = lower * 0.5f + upper * 0.5f;
808  }
809  }
810 
812  {
814  {
815  val = exp(log(lower) * 0.25f + log(upper) * 0.75f);
816  }
817  else
818  {
819  val = lower * 0.25f + upper * 0.75f;
820  }
821  }
822 
824  {
825  val = 0.0f;
826  }
827 
829  {
830  val = 1.0f;
831  }
832 
834  {
835  val = 100.0f;
836  }
837 
839  {
840  val = 440.0f;
841  }
842 
844  mInputControls[p] = val;
845  }
847  {
848  mOutputControls[p] = 0.0;
849 
850  // LADSPA effects have a convention of providing latency on an output
851  // control port whose name is "latency".
852  if (strcmp(mData->PortNames[p], "latency") == 0)
853  {
854  mLatencyPort = p;
855  }
856  else
857  {
858  mInteractive = true;
860  }
861  }
862  }
863 
864  // mHost will be null during registration
865  if (mHost)
866  {
867  mHost->GetSharedConfig(wxT("Options"), wxT("UseLatency"), mUseLatency, true);
868 
869  bool haveDefaults;
870  mHost->GetPrivateConfig(mHost->GetFactoryDefaultsGroup(), wxT("Initialized"), haveDefaults, false);
871  if (!haveDefaults)
872  {
874  mHost->SetPrivateConfig(mHost->GetFactoryDefaultsGroup(), wxT("Initialized"), true);
875  }
876 
878  }
879 
880  return true;
881 }

References _LADSPA_PortRangeHint::HintDescriptor, LADSPA_IS_HINT_BOUNDED_ABOVE, LADSPA_IS_HINT_BOUNDED_BELOW, LADSPA_IS_HINT_DEFAULT_0, LADSPA_IS_HINT_DEFAULT_1, LADSPA_IS_HINT_DEFAULT_100, LADSPA_IS_HINT_DEFAULT_440, LADSPA_IS_HINT_DEFAULT_HIGH, LADSPA_IS_HINT_DEFAULT_LOW, LADSPA_IS_HINT_DEFAULT_MAXIMUM, LADSPA_IS_HINT_DEFAULT_MIDDLE, LADSPA_IS_HINT_DEFAULT_MINIMUM, LADSPA_IS_HINT_LOGARITHMIC, LADSPA_IS_HINT_SAMPLE_RATE, LADSPA_IS_PORT_AUDIO, LADSPA_IS_PORT_CONTROL, LADSPA_IS_PORT_INPUT, LADSPA_IS_PORT_OUTPUT, _LADSPA_PortRangeHint::LowerBound, and _LADSPA_PortRangeHint::UpperBound.

Referenced by LadspaEffectsModule::DiscoverPluginsAtPath().

Here is the caller graph for this function:

◆ SetHostUI()

void LadspaEffect::SetHostUI ( EffectUIHostInterface host)
overridevirtual

Implements EffectUIClientInterface.

Definition at line 1180 of file LadspaEffect.cpp.

1181 {
1182  mUIHost = host;
1183 }

◆ SetSampleRate()

void LadspaEffect::SetSampleRate ( double  rate)
overridevirtual

Implements EffectClientInterface.

Definition at line 903 of file LadspaEffect.cpp.

904 {
905  mSampleRate = rate;
906 }

◆ ShowInterface()

bool LadspaEffect::ShowInterface ( wxWindow &  parent,
const EffectDialogFactory factory,
bool  forceModal = false 
)
overridevirtual

Implements EffectClientInterface.

Definition at line 1060 of file LadspaEffect.cpp.

1062 {
1063  if (mDialog)
1064  {
1065  if ( mDialog->Close(true) )
1066  mDialog = nullptr;
1067  return false;
1068  }
1069 
1070  // mDialog is null
1071  auto cleanup = valueRestorer( mDialog );
1072 
1073  if ( factory )
1074  mDialog = factory(parent, mHost, this);
1075  if (!mDialog)
1076  {
1077  return false;
1078  }
1079 
1080  mDialog->Layout();
1081  mDialog->Fit();
1082  mDialog->SetMinSize(mDialog->GetSize());
1083 
1084  if ((SupportsRealtime() || GetType() == EffectTypeAnalyze) && !forceModal)
1085  {
1086  mDialog->Show();
1087  cleanup.release();
1088 
1089  return false;
1090  }
1091 
1092  bool res = mDialog->ShowModal() != 0;
1093 
1094  return res;
1095 }

References EffectTypeAnalyze, factory, and valueRestorer().

Here is the call graph for this function:

◆ ShowOptions()

void LadspaEffect::ShowOptions ( )
overridevirtual

Implements EffectUIClientInterface.

Definition at line 1562 of file LadspaEffect.cpp.

1563 {
1565  if (dlg.ShowModal())
1566  {
1567  // Reinitialize configuration options
1568  mHost->GetSharedConfig(wxT("Options"), wxT("UseLatency"), mUseLatency, true);
1569  }
1570 }

◆ SupportsAutomation()

bool LadspaEffect::SupportsAutomation ( )
overridevirtual

Implements EffectDefinitionInterface.

Definition at line 712 of file LadspaEffect.cpp.

713 {
714  return mNumInputControls > 0;
715 }

◆ SupportsRealtime()

bool LadspaEffect::SupportsRealtime ( )
overridevirtual

Implements EffectDefinitionInterface.

Definition at line 707 of file LadspaEffect.cpp.

708 {
709  return GetType() != EffectTypeGenerate;
710 }

References EffectTypeGenerate.

◆ Unload()

void LadspaEffect::Unload ( )
private

Definition at line 1615 of file LadspaEffect.cpp.

1616 {
1617  if (mLib.IsLoaded())
1618  {
1619  mLib.Unload();
1620  }
1621 }

◆ ValidateUI()

bool LadspaEffect::ValidateUI ( )
overridevirtual

Implements EffectUIClientInterface.

Definition at line 1508 of file LadspaEffect.cpp.

1509 {
1510  if (!mParent->Validate())
1511  {
1512  return false;
1513  }
1514 
1515  if (GetType() == EffectTypeGenerate)
1516  {
1518  }
1519 
1520  return true;
1521 }

References EffectTypeGenerate.

Friends And Related Function Documentation

◆ LadspaEffectsModule

friend class LadspaEffectsModule
friend

Definition at line 199 of file LadspaEffect.h.

Member Data Documentation

◆ mAudioIns

unsigned LadspaEffect::mAudioIns
private

Definition at line 168 of file LadspaEffect.h.

◆ mAudioOuts

unsigned LadspaEffect::mAudioOuts
private

Definition at line 171 of file LadspaEffect.h.

◆ mBlockSize

size_t LadspaEffect::mBlockSize
private

Definition at line 164 of file LadspaEffect.h.

◆ mData

const LADSPA_Descriptor* LadspaEffect::mData
private

Definition at line 155 of file LadspaEffect.h.

Referenced by OnTextCtrl().

◆ mDialog

wxDialog* LadspaEffect::mDialog
private

Definition at line 189 of file LadspaEffect.h.

◆ mDuration

NumericTextCtrl* LadspaEffect::mDuration
private

Definition at line 188 of file LadspaEffect.h.

◆ mFields

ArrayOf<wxTextCtrl*> LadspaEffect::mFields
private

Definition at line 192 of file LadspaEffect.h.

Referenced by OnTextCtrl().

◆ mHost

EffectHostInterface* LadspaEffect::mHost
private

Definition at line 152 of file LadspaEffect.h.

◆ mIndex

int LadspaEffect::mIndex
private

Definition at line 151 of file LadspaEffect.h.

◆ mInputControls

Floats LadspaEffect::mInputControls
private

Definition at line 175 of file LadspaEffect.h.

◆ mInputPorts

ArrayOf<unsigned long> LadspaEffect::mInputPorts
private

Definition at line 169 of file LadspaEffect.h.

◆ mInteractive

bool LadspaEffect::mInteractive
private

Definition at line 166 of file LadspaEffect.h.

◆ mLabels

ArrayOf<wxStaticText*> LadspaEffect::mLabels
private

Definition at line 193 of file LadspaEffect.h.

◆ mLatencyDone

bool LadspaEffect::mLatencyDone
private

Definition at line 181 of file LadspaEffect.h.

◆ mLatencyPort

int LadspaEffect::mLatencyPort
private

Definition at line 180 of file LadspaEffect.h.

◆ mLib

wxDynamicLibrary LadspaEffect::mLib
private

Definition at line 154 of file LadspaEffect.h.

◆ mMaster

LADSPA_Handle LadspaEffect::mMaster
private

Definition at line 161 of file LadspaEffect.h.

◆ mMeters

ArrayOf<LadspaEffectMeter *> LadspaEffect::mMeters
private

Definition at line 195 of file LadspaEffect.h.

◆ mNumInputControls

int LadspaEffect::mNumInputControls
private

Definition at line 174 of file LadspaEffect.h.

◆ mNumOutputControls

int LadspaEffect::mNumOutputControls
private

Definition at line 176 of file LadspaEffect.h.

◆ mOutputControls

Floats LadspaEffect::mOutputControls
private

Definition at line 177 of file LadspaEffect.h.

◆ mOutputPorts

ArrayOf<unsigned long> LadspaEffect::mOutputPorts
private

Definition at line 172 of file LadspaEffect.h.

◆ mParent

wxWindow* LadspaEffect::mParent
private

Definition at line 190 of file LadspaEffect.h.

◆ mPath

wxString LadspaEffect::mPath
private

Definition at line 150 of file LadspaEffect.h.

◆ mReady

bool LadspaEffect::mReady
private

Definition at line 159 of file LadspaEffect.h.

◆ mSampleRate

double LadspaEffect::mSampleRate
private

Definition at line 163 of file LadspaEffect.h.

◆ mSlaves

std::vector<LADSPA_Handle> LadspaEffect::mSlaves
private

Definition at line 184 of file LadspaEffect.h.

◆ mSliders

ArrayOf<wxSlider*> LadspaEffect::mSliders
private

Definition at line 191 of file LadspaEffect.h.

Referenced by OnTextCtrl().

◆ mToggles

ArrayOf<wxCheckBox*> LadspaEffect::mToggles
private

Definition at line 194 of file LadspaEffect.h.

◆ mUIHost

EffectUIHostInterface* LadspaEffect::mUIHost
private

Definition at line 186 of file LadspaEffect.h.

◆ mUseLatency

bool LadspaEffect::mUseLatency
private

Definition at line 179 of file LadspaEffect.h.

◆ pluginName

wxString LadspaEffect::pluginName
private

Definition at line 157 of file LadspaEffect.h.


The documentation for this class was generated from the following files:
_LADSPA_Descriptor::PortNames
const char *const * PortNames
Definition: ladspa.h:415
LadspaEffect::FreeInstance
void FreeInstance(LADSPA_Handle handle)
Definition: LadspaEffect.cpp:1690
CommandParameters
CommandParameters, derived from wxFileConfig, is essentially doing the same things as the Shuttle cla...
Definition: EffectAutomationParameters.h:67
LadspaEffect::mHost
EffectHostInterface * mHost
Definition: LadspaEffect.h:152
CommandParameters::SetParameters
bool SetParameters(const wxString &parms)
Definition: EffectAutomationParameters.h:286
valueRestorer
ValueRestorer< T > valueRestorer(T &var)
inline functions provide convenient parameter type deduction
Definition: MemoryX.h:354
LadspaEffectOptionsDialog
Definition: LadspaEffect.cpp:397
LadspaEffect::RefreshControls
void RefreshControls(bool outputOnly=false)
Definition: LadspaEffect.cpp:1776
EffectTypeProcess
@ EffectTypeProcess
Definition: EffectInterface.h:59
wxSliderWrapper
wxSlider wxSliderWrapper
Definition: ShuttleGui.h:105
LadspaEffect::mLatencyDone
bool mLatencyDone
Definition: LadspaEffect.h:181
NumericTextCtrl::Options::AutoPos
Options & AutoPos(bool enable)
Definition: NumericTextCtrl.h:190
LadspaEffect::InitInstance
LADSPA_Handle InitInstance(float sampleRate)
Definition: LadspaEffect.cpp:1657
LadspaEffect::mParent
wxWindow * mParent
Definition: LadspaEffect.h:190
LADSPA_IS_HINT_INTEGER
#define LADSPA_IS_HINT_INTEGER(x)
Definition: ladspa.h:315
LADSPA_IS_HINT_DEFAULT_1
#define LADSPA_IS_HINT_DEFAULT_1(x)
Definition: ladspa.h:330
LADSPA_PortDescriptor
int LADSPA_PortDescriptor
Definition: ladspa.h:152
EffectTypeGenerate
@ EffectTypeGenerate
Definition: EffectInterface.h:58
LadspaEffect::mAudioIns
unsigned mAudioIns
Definition: LadspaEffect.h:168
LadspaEffect::mOutputPorts
ArrayOf< unsigned long > mOutputPorts
Definition: LadspaEffect.h:172
LadspaEffect::SupportsRealtime
bool SupportsRealtime() override
Definition: LadspaEffect.cpp:707
LadspaEffect::mIndex
int mIndex
Definition: LadspaEffect.h:151
_LADSPA_Descriptor::PortCount
unsigned long PortCount
Definition: ladspa.h:406
ArrayOf::reinit
void reinit(Integral count, bool initialize=false)
Definition: MemoryX.h:57
LadspaEffect::mInteractive
bool mInteractive
Definition: LadspaEffect.h:166
LadspaEffect::SetAutomationParameters
bool SetAutomationParameters(CommandParameters &parms) override
Definition: LadspaEffect.cpp:1115
NumericTextCtrl::SetName
void SetName(const TranslatableString &name)
Definition: NumericTextCtrl.cpp:1420
XO
#define XO(s)
Definition: Internat.h:31
LadspaEffect::mData
const LADSPA_Descriptor * mData
Definition: LadspaEffect.h:155
EffectHostInterface::GetCurrentSettingsGroup
virtual RegistryPath GetCurrentSettingsGroup()=0
LADSPA_IS_HINT_TOGGLED
#define LADSPA_IS_HINT_TOGGLED(x)
Definition: ladspa.h:312
CommandParameters::GetParameters
bool GetParameters(wxString &parms)
Definition: EffectAutomationParameters.h:258
LadspaEffect::mPath
wxString mPath
Definition: LadspaEffect.h:150
_LADSPA_PortRangeHint::UpperBound
LADSPA_Data UpperBound
Definition: ladspa.h:350
_LADSPA_Descriptor::Maker
const char * Maker
Definition: ladspa.h:397
_LADSPA_PortRangeHint::HintDescriptor
LADSPA_PortRangeHintDescriptor HintDescriptor
Definition: ladspa.h:340
LADSPA_Descriptor_Function
const LADSPA_Descriptor *(* LADSPA_Descriptor_Function)(unsigned long Index)
Definition: ladspa.h:593
_LADSPA_Descriptor::Copyright
const char * Copyright
Definition: ladspa.h:402
LADSPA_IS_HINT_DEFAULT_MIDDLE
#define LADSPA_IS_HINT_DEFAULT_MIDDLE(x)
Definition: ladspa.h:322
NumericTextCtrl
Definition: NumericTextCtrl.h:172
LadspaEffect::mUIHost
EffectUIHostInterface * mUIHost
Definition: LadspaEffect.h:186
LADSPA_IS_HINT_DEFAULT_LOW
#define LADSPA_IS_HINT_DEFAULT_LOW(x)
Definition: ladspa.h:320
NumericTextCtrl::Options
Definition: NumericTextCtrl.h:178
LadspaEffect::mFields
ArrayOf< wxTextCtrl * > mFields
Definition: LadspaEffect.h:192
LadspaEffect::mBlockSize
size_t mBlockSize
Definition: LadspaEffect.h:164
LadspaEffect::mMeters
ArrayOf< LadspaEffectMeter * > mMeters
Definition: LadspaEffect.h:195
LADSPA_IS_HINT_DEFAULT_100
#define LADSPA_IS_HINT_DEFAULT_100(x)
Definition: ladspa.h:332
LadspaEffect::GetAutomationParameters
bool GetAutomationParameters(CommandParameters &parms) override
Definition: LadspaEffect.cpp:1097
_LADSPA_Descriptor::connect_port
void(* connect_port)(LADSPA_Handle Instance, unsigned long Port, LADSPA_Data *DataLocation)
Definition: ladspa.h:466
LADSPA_IS_HINT_SAMPLE_RATE
#define LADSPA_IS_HINT_SAMPLE_RATE(x)
Definition: ladspa.h:313
LadspaEffect::mSampleRate
double mSampleRate
Definition: LadspaEffect.h:163
LadspaEffect::mOutputControls
Floats mOutputControls
Definition: LadspaEffect.h:177
LadspaEffect::mReady
bool mReady
Definition: LadspaEffect.h:159
EffectHostInterface::GetDuration
virtual double GetDuration()=0
factory
static RegisteredToolbarFactory factory
Definition: ControlToolBar.cpp:806
LadspaEffect::mUseLatency
bool mUseLatency
Definition: LadspaEffect.h:179
ID_Toggles
@ ID_Toggles
Definition: LadspaEffect.cpp:487
LadspaEffect::mLatencyPort
int mLatencyPort
Definition: LadspaEffect.h:180
LADSPA_IS_PORT_OUTPUT
#define LADSPA_IS_PORT_OUTPUT(x)
Definition: ladspa.h:169
LADSPA_IS_HINT_DEFAULT_MAXIMUM
#define LADSPA_IS_HINT_DEFAULT_MAXIMUM(x)
Definition: ladspa.h:326
LadspaEffect::SaveParameters
bool SaveParameters(const RegistryPath &group)
Definition: LadspaEffect.cpp:1640
LadspaEffect::mToggles
ArrayOf< wxCheckBox * > mToggles
Definition: LadspaEffect.h:194
name
const TranslatableString name
Definition: Distortion.cpp:98
NumericConverter::TIME
@ TIME
Definition: NumericTextCtrl.h:52
EffectTypeTool
@ EffectTypeTool
Definition: EffectInterface.h:61
_LADSPA_Descriptor::PortDescriptors
const LADSPA_PortDescriptor * PortDescriptors
Definition: ladspa.h:410
ShuttleGuiBase::GetParent
wxWindow * GetParent()
Definition: ShuttleGui.h:496
LADSPA_IS_HINT_LOGARITHMIC
#define LADSPA_IS_HINT_LOGARITHMIC(x)
Definition: ladspa.h:314
LadspaEffect::LoadParameters
bool LoadParameters(const RegistryPath &group)
Definition: LadspaEffect.cpp:1623
LadspaEffect::mLabels
ArrayOf< wxStaticText * > mLabels
Definition: LadspaEffect.h:193
LADSPAEFFECTS_FAMILY
#define LADSPAEFFECTS_FAMILY
Definition: LadspaEffect.h:32
WindowAccessible
An alternative to using wxWindowAccessible, which in wxWidgets 3.1.1 contained GetParent() which was ...
_LADSPA_PortRangeHint::LowerBound
LADSPA_Data LowerBound
Definition: ladspa.h:345
EffectHostInterface::GetDurationFormat
virtual NumericFormatSymbol GetDurationFormat()=0
ConfigClientInterface::GetSharedConfig
virtual bool GetSharedConfig(const RegistryPath &group, const RegistryPath &key, wxString &value, const wxString &defval)=0
LadspaEffect::Load
bool Load()
Definition: LadspaEffect.cpp:1576
LadspaEffect::mLib
wxDynamicLibrary mLib
Definition: LadspaEffect.h:154
LADSPA_IS_PORT_INPUT
#define LADSPA_IS_PORT_INPUT(x)
Definition: ladspa.h:168
LADSPA_IS_HINT_DEFAULT_0
#define LADSPA_IS_HINT_DEFAULT_0(x)
Definition: ladspa.h:328
LadspaEffect::GetType
EffectType GetType() override
Definition: LadspaEffect.cpp:667
LadspaEffect::mInputControls
Floats mInputControls
Definition: LadspaEffect.h:175
_LADSPA_Descriptor::cleanup
void(* cleanup)(LADSPA_Handle Instance)
Definition: ladspa.h:558
_LADSPA_PortRangeHint
_LADSPA_PortRangeHint is a structure that gives parameter validation information for a LADSPA (Linux ...
Definition: ladspa.h:337
LadspaEffect::mSliders
ArrayOf< wxSlider * > mSliders
Definition: LadspaEffect.h:191
LadspaEffect::mNumInputControls
int mNumInputControls
Definition: LadspaEffect.h:174
LAT1CTOWX
#define LAT1CTOWX(X)
Definition: Internat.h:160
LadspaEffect::mNumOutputControls
int mNumOutputControls
Definition: LadspaEffect.h:176
_LADSPA_Descriptor::deactivate
void(* deactivate)(LADSPA_Handle Instance)
Definition: ladspa.h:549
_LADSPA_Descriptor::PortRangeHints
const LADSPA_PortRangeHint * PortRangeHints
Definition: ladspa.h:419
min
int min(int a, int b)
Definition: CompareAudioCommand.cpp:106
ConfigClientInterface::SetPrivateConfig
virtual bool SetPrivateConfig(const RegistryPath &group, const RegistryPath &key, const wxString &value)=0
LADSPA_IS_HINT_BOUNDED_ABOVE
#define LADSPA_IS_HINT_BOUNDED_ABOVE(x)
Definition: ladspa.h:311
LadspaEffect::mDuration
NumericTextCtrl * mDuration
Definition: LadspaEffect.h:188
LadspaEffect
An Effect that calls up a LADSPA plug in, i.e. many possible effects from this one class.
Definition: LadspaEffect.h:45
_
#define _(s)
Definition: Internat.h:75
sampleCount
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:18
LadspaEffect::mMaster
LADSPA_Handle mMaster
Definition: LadspaEffect.h:161
EffectTypeAnalyze
@ EffectTypeAnalyze
Definition: EffectInterface.h:60
LadspaEffect::mAudioOuts
unsigned mAudioOuts
Definition: LadspaEffect.h:171
_LADSPA_Descriptor::instantiate
LADSPA_Handle(* instantiate)(const struct _LADSPA_Descriptor *Descriptor, unsigned long SampleRate)
Definition: ladspa.h:437
LADSPA_IS_HINT_DEFAULT_HIGH
#define LADSPA_IS_HINT_DEFAULT_HIGH(x)
Definition: ladspa.h:324
LADSPA_IS_HINT_DEFAULT_MINIMUM
#define LADSPA_IS_HINT_DEFAULT_MINIMUM(x)
Definition: ladspa.h:318
_LADSPA_Descriptor::Name
const char * Name
Definition: ladspa.h:393
Verbatim
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
Definition: TranslatableString.h:321
LadspaEffect::mInputPorts
ArrayOf< unsigned long > mInputPorts
Definition: LadspaEffect.h:169
LadspaEffectMeter
Definition: LadspaEffect.cpp:499
LADSPA_Handle
void * LADSPA_Handle
Definition: ladspa.h:363
_LADSPA_Descriptor::run
void(* run)(LADSPA_Handle Instance, unsigned long SampleCount)
Definition: ladspa.h:505
Internat::ToDisplayString
static wxString ToDisplayString(double numberToConvert, int digitsAfterDecimalPoint=-1)
Convert a number to a string, uses the user's locale's decimal separator.
Definition: Internat.cpp:161
ID_Texts
@ ID_Texts
Definition: LadspaEffect.cpp:489
ID_Sliders
@ ID_Sliders
Definition: LadspaEffect.cpp:488
ConfigClientInterface::GetPrivateConfig
virtual bool GetPrivateConfig(const RegistryPath &group, const RegistryPath &key, wxString &value, const wxString &defval)=0
safenew
#define safenew
Definition: MemoryX.h:10
LADSPA_IS_HINT_BOUNDED_BELOW
#define LADSPA_IS_HINT_BOUNDED_BELOW(x)
Definition: ladspa.h:310
LadspaEffect::mDialog
wxDialog * mDialog
Definition: LadspaEffect.h:189
LADSPA_IS_PORT_AUDIO
#define LADSPA_IS_PORT_AUDIO(x)
Definition: ladspa.h:171
NumericConverter::GetValue
double GetValue()
Definition: NumericTextCtrl.cpp:1172
LadspaEffect::mSlaves
std::vector< LADSPA_Handle > mSlaves
Definition: LadspaEffect.h:184
_LADSPA_Descriptor::activate
void(* activate)(LADSPA_Handle Instance)
Definition: ladspa.h:489
LADSPA_IS_PORT_CONTROL
#define LADSPA_IS_PORT_CONTROL(x)
Definition: ladspa.h:170
EffectHostInterface::SetDuration
virtual void SetDuration(double seconds)=0
EffectHostInterface::GetFactoryDefaultsGroup
virtual RegistryPath GetFactoryDefaultsGroup()=0
Internat::CompatibleToDouble
static bool CompatibleToDouble(const wxString &stringToConvert, double *result)
Convert a string to a number.
Definition: Internat.cpp:134
ID_Duration
@ ID_Duration
Definition: LadspaEffect.cpp:486
LADSPA_IS_HINT_DEFAULT_440
#define LADSPA_IS_HINT_DEFAULT_440(x)
Definition: ladspa.h:334