Audacity 3.2.0
Public Member Functions | Public Attributes | List of all members
LadspaEffect::Editor Struct Reference
Inheritance diagram for LadspaEffect::Editor:
[legend]
Collaboration diagram for LadspaEffect::Editor:
[legend]

Public Member Functions

 Editor (const EffectUIServices &effect, EffectSettingsAccess &access, double sampleRate, EffectType type, const LadspaEffectOutputs *pOutputs)
 
bool UpdateUI () override
 Update appearance of the panel for changes in settings. More...
 
bool ValidateUI () override
 Get settings data from the panel; may make error dialogs and return false. More...
 
void Disconnect () override
 On the first call only, may disconnect from further event handling. More...
 
void PopulateUI (ShuttleGui &S)
 
void OnCheckBox (wxCommandEvent &evt)
 
void OnSlider (wxCommandEvent &evt)
 
void OnTextCtrl (wxCommandEvent &evt)
 
void RefreshControls ()
 
void UpdateControl (int index, float value, float epsilon)
 
void UpdateControls (const LadspaEffectSettings &src)
 
const LadspaEffectGetEffect ()
 
- Public Member Functions inherited from EffectEditor
 EffectEditor (const EffectUIServices &services, EffectSettingsAccess &access)
 
virtual ~EffectEditor ()
 
virtual bool ValidateUI ()=0
 Get settings data from the panel; may make error dialogs and return false. More...
 
virtual bool UpdateUI ()
 Update appearance of the panel for changes in settings. More...
 
virtual bool IsGraphicalUI ()
 
virtual void Disconnect ()
 On the first call only, may disconnect from further event handling. More...
 
virtual void OnClose ()
 
- Public Member Functions inherited from Observer::Publisher< EffectSettingChanged >
 Publisher (ExceptionPolicy *pPolicy=nullptr, Alloc a={})
 Constructor supporting type-erased custom allocation/deletion. More...
 
 Publisher (Publisher &&)=default
 
Publisheroperator= (Publisher &&)=default
 
Subscription Subscribe (Callback callback)
 Connect a callback to the Publisher; later-connected are called earlier. More...
 
Subscription Subscribe (Object &obj, Return(Object::*callback)(Args...))
 Overload of Subscribe takes an object and pointer-to-member-function. More...
 

Public Attributes

const double mSampleRate
 
const EffectType mType
 
LadspaEffectSettings mSettings
 
const LadspaEffectOutputs *const mpOutputs
 
NumericTextCtrlmDuration {}
 
wxWeakRef< wxDialog > mDialog
 
wxWindow * mParent {}
 
ArrayOf< wxSlider * > mSliders
 
ArrayOf< wxTextCtrl * > mFields
 
ArrayOf< wxStaticText * > mLabels
 
ArrayOf< wxCheckBox * > mToggles
 
std::vector< LadspaEffectMeter * > mMeters
 

Additional Inherited Members

- Public Types inherited from Observer::Publisher< EffectSettingChanged >
using message_type = EffectSettingChanged
 
using CallbackReturn = std::conditional_t< true, void, bool >
 
using Callback = std::function< CallbackReturn(const EffectSettingChanged &) >
 Type of functions that can be connected to the Publisher. More...
 
- Static Public Member Functions inherited from EffectEditor
static bool EnableApply (wxWindow *parent, bool enable=true)
 Enable or disable the Apply button of the dialog that contains parent. More...
 
static bool EnablePreview (wxWindow *parent, bool enable=true)
 
- Static Public Attributes inherited from EffectEditor
static constexpr int kPlayID = 20102
 
- Static Public Attributes inherited from Observer::Publisher< EffectSettingChanged >
static constexpr bool notifies_all
 
- Protected Member Functions inherited from EffectEditor
template<typename EventTag , typename Class , typename Event >
void BindTo (wxEvtHandler &src, const EventTag &eventType, void(Class::*pmf)(Event &))
 
- Protected Member Functions inherited from Observer::Publisher< EffectSettingChanged >
CallbackReturn Publish (const EffectSettingChanged &message)
 Send a message to connected callbacks. More...
 
- Protected Attributes inherited from EffectEditor
const EffectUIServicesmUIServices
 
EffectSettingsAccessmAccess
 
bool mUIClosed { false }
 

Detailed Description

Definition at line 1189 of file LadspaEffect.cpp.

Constructor & Destructor Documentation

◆ Editor()

LadspaEffect::Editor::Editor ( const EffectUIServices effect,
EffectSettingsAccess access,
double  sampleRate,
EffectType  type,
const LadspaEffectOutputs pOutputs 
)
inline

Definition at line 1190 of file LadspaEffect.cpp.

1193 : EffectEditor{ effect, access }
1194 , mSampleRate{ sampleRate }
1195 , mType{ type }
1196 // Copy settings
1197 , mSettings{ GetSettings(access.Get()) }
1198 , mpOutputs{ pOutputs }
1199 {}
virtual const EffectSettings & Get()=0
static LadspaEffectSettings & GetSettings(EffectSettings &settings)
Assume settings originated from MakeSettings() and copies thereof.
Definition: Effect.h:178
const LadspaEffectOutputs *const mpOutputs
const EffectType mType
LadspaEffectSettings mSettings
const double mSampleRate

Member Function Documentation

◆ Disconnect()

void LadspaEffect::Editor::Disconnect ( )
overridevirtual

On the first call only, may disconnect from further event handling.

Default implemantation does nothing

Reimplemented from EffectEditor.

Definition at line 1534 of file LadspaEffect.cpp.

1535{
1536 for (auto &meter : mMeters)
1537 if (meter) {
1538 meter->Disconnect();
1539 meter = nullptr;
1540 }
1541}
std::vector< LadspaEffectMeter * > mMeters

◆ GetEffect()

const LadspaEffect & LadspaEffect::Editor::GetEffect ( )
inline

Definition at line 1215 of file LadspaEffect.cpp.

1216 { return static_cast<const LadspaEffect &>(mUIServices); }
const EffectUIServices & mUIServices
Definition: EffectEditor.h:91
An Effect that calls up a LADSPA plug in, i.e. many possible effects from this one class.
Definition: LadspaEffect.h:67

References EffectEditor::mUIServices.

◆ OnCheckBox()

void LadspaEffect::Editor::OnCheckBox ( wxCommandEvent &  evt)

Definition at line 1698 of file LadspaEffect.cpp.

1699{
1700 int p = evt.GetId() - ID_Toggles;
1701 // 0.5 is a half of the interval
1702 UpdateControl(p, mToggles[p]->GetValue(), 0.5f);
1703 ValidateUI();
1704}
@ ID_Toggles
void UpdateControl(int index, float value, float epsilon)
bool ValidateUI() override
Get settings data from the panel; may make error dialogs and return false.
ArrayOf< wxCheckBox * > mToggles

References ID_Toggles, and BasicEffectUIServices::ValidateUI().

Referenced by PopulateUI().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnSlider()

void LadspaEffect::Editor::OnSlider ( wxCommandEvent &  evt)

Definition at line 1706 of file LadspaEffect.cpp.

1707{
1708 int p = evt.GetId() - ID_Sliders;
1709
1710 float val;
1711 float lower = float(0.0);
1712 float upper = float(10.0);
1713 float range;
1714 bool forceint = false;
1715
1718 lower = hint.LowerBound;
1720 upper = hint.UpperBound;
1722 lower *= mSampleRate;
1723 upper *= mSampleRate;
1724 forceint = true;
1725 }
1726
1727 range = upper - lower;
1728 val = (mSliders[p]->GetValue() / 1000.0) * range + lower;
1729 wxString str;
1730 if (LADSPA_IS_HINT_INTEGER(hint.HintDescriptor) || forceint)
1731 str.Printf(wxT("%d"), (int)(val + 0.5));
1732 else
1734
1735 mFields[p]->SetValue(str);
1736
1738 ValidateUI();
1739}
wxT("CloseDown"))
#define str(a)
constexpr float ControlValueTolerance
@ ID_Sliders
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
const LADSPA_Descriptor * mData
Definition: LadspaEffect.h:155
#define LADSPA_IS_HINT_BOUNDED_BELOW(x)
Definition: ladspa.h:310
#define LADSPA_IS_HINT_BOUNDED_ABOVE(x)
Definition: ladspa.h:311
#define LADSPA_IS_HINT_INTEGER(x)
Definition: ladspa.h:315
#define LADSPA_IS_HINT_SAMPLE_RATE(x)
Definition: ladspa.h:313
const LADSPA_PortRangeHint * PortRangeHints
Definition: ladspa.h:419
_LADSPA_PortRangeHint is a structure that gives parameter validation information for a LADSPA (Linux ...
Definition: ladspa.h:337
LADSPA_PortRangeHintDescriptor HintDescriptor
Definition: ladspa.h:340
LADSPA_Data LowerBound
Definition: ladspa.h:345
LADSPA_Data UpperBound
Definition: ladspa.h:350
ArrayOf< wxSlider * > mSliders
ArrayOf< wxTextCtrl * > mFields
const LadspaEffect & GetEffect()

References ControlValueTolerance, _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, str, Internat::ToDisplayString(), _LADSPA_PortRangeHint::UpperBound, BasicEffectUIServices::ValidateUI(), and wxT().

Referenced by PopulateUI().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnTextCtrl()

void LadspaEffect::Editor::OnTextCtrl ( wxCommandEvent &  evt)

Definition at line 1741 of file LadspaEffect.cpp.

1742{
1743 int p = evt.GetId() - ID_Texts;
1744
1745 float val;
1746 float lower = float(0.0);
1747 float upper = float(10.0);
1748 float range;
1749
1750 val = Internat::CompatibleToDouble(mFields[p]->GetValue());
1751
1754 lower = hint.LowerBound;
1756 upper = hint.UpperBound;
1758 lower *= mSampleRate;
1759 upper *= mSampleRate;
1760 }
1761 range = upper - lower;
1762 if (val < lower)
1763 val = lower;
1764 if (val > upper)
1765 val = upper;
1766
1767 mSliders[p]->SetValue((int)(((val-lower)/range) * 1000.0 + 0.5));
1768
1770 ValidateUI();
1771}
@ ID_Texts
static bool CompatibleToDouble(const wxString &stringToConvert, double *result)
Convert a string to a number.
Definition: Internat.cpp:133

References Internat::CompatibleToDouble(), ControlValueTolerance, _LADSPA_PortRangeHint::HintDescriptor, ID_Texts, LADSPA_IS_HINT_BOUNDED_ABOVE, LADSPA_IS_HINT_BOUNDED_BELOW, LADSPA_IS_HINT_SAMPLE_RATE, _LADSPA_PortRangeHint::LowerBound, _LADSPA_PortRangeHint::UpperBound, and BasicEffectUIServices::ValidateUI().

Referenced by PopulateUI().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PopulateUI()

void LadspaEffect::Editor::PopulateUI ( ShuttleGui S)

Definition at line 1239 of file LadspaEffect.cpp.

1240{
1241 auto &effect = GetEffect();
1242 auto &controls = mSettings.controls;
1243 auto parent = S.GetParent();
1244
1245 mParent = parent;
1246
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 );
1253
1254 wxASSERT(mParent); // To justify safenew
1255 wxScrolledWindow *const w = safenew wxScrolledWindow(mParent,
1256 wxID_ANY,
1257 wxDefaultPosition,
1258 wxDefaultSize,
1259 wxVSCROLL | wxTAB_TRAVERSAL);
1260
1261 {
1262 auto mainSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
1263 w->SetScrollRate(0, 20);
1264
1265 // This fools NVDA into not saying "Panel" when the dialog gets focus
1266 w->SetName(wxT("\a"));
1267 w->SetLabel(wxT("\a"));
1268
1269 mainSizer->Add(w, 1, wxEXPAND);
1270 mParent->SetSizer(mainSizer.release());
1271 }
1272
1273 wxSizer *marginSizer;
1274 {
1275 auto uMarginSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
1276 marginSizer = uMarginSizer.get();
1277
1278 // Make user-adjustible input controls
1279 if (effect.mNumInputControls) {
1280 auto paramSizer = std::make_unique<wxStaticBoxSizer>(wxVERTICAL, w, _("Effect Settings"));
1281
1282 auto gridSizer = std::make_unique<wxFlexGridSizer>(5, 0, 0);
1283 gridSizer->AddGrowableCol(3);
1284
1285 wxControl *item;
1286
1287 // Add the duration control for generators
1288 if (mType == EffectTypeGenerate) {
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;
1294 w, ID_Duration,
1296 extra.GetDurationFormat(),
1297 extra.GetDuration(),
1299 .AutoPos(true));
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);
1305 }
1306
1307 for (unsigned long p = 0; p < data.PortCount; ++p) {
1308 LADSPA_PortDescriptor d = data.PortDescriptors[p];
1310 {
1311 continue;
1312 }
1313
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);
1317
1318 wxString fieldText;
1319 LADSPA_PortRangeHint hint = data.PortRangeHints[p];
1320
1322 mToggles[p] = safenew wxCheckBox(w, ID_Toggles + p, wxT(""));
1323 mToggles[p]->SetName(labelText);
1324 mToggles[p]->SetValue(controls[p] > 0);
1325 BindTo(*mToggles[p],
1326 wxEVT_COMMAND_CHECKBOX_CLICKED, &Editor::OnCheckBox);
1327 gridSizer->Add(mToggles[p], 0, wxALL, 5);
1328
1329 gridSizer->Add(1, 1, 0);
1330 gridSizer->Add(1, 1, 0);
1331 gridSizer->Add(1, 1, 0);
1332 continue;
1333 }
1334
1335 wxString bound;
1336 float lower = -FLT_MAX;
1337 float upper = FLT_MAX;
1338 bool haslo = false;
1339 bool hashi = false;
1340 bool forceint = false;
1341
1343 lower = hint.LowerBound;
1344 haslo = true;
1345 }
1346
1348 upper = hint.UpperBound;
1349 hashi = true;
1350 }
1351
1353 lower *= mSampleRate;
1354 upper *= mSampleRate;
1355 forceint = true;
1356 }
1357
1358 // Limit to the UI precision
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;
1362
1363 if (haslo && controls[p] < lower)
1364 controls[p] = lower;
1365
1366 if (hashi && controls[p] > upper)
1367 controls[p] = upper;
1368
1369 // Don't specify a value at creation time. This prevents unwanted events
1370 // being sent to the OnTextCtrl() handler before the associated slider
1371 // has been created.
1372 mFields[p] = safenew wxTextCtrl(w, ID_Texts + p);
1373 mFields[p]->SetName(labelText);
1374 BindTo(*mFields[p],
1376 gridSizer->Add(mFields[p], 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
1377
1378 wxString str;
1379 if (haslo) {
1380 if (LADSPA_IS_HINT_INTEGER(hint.HintDescriptor) || forceint)
1381 {
1382 str.Printf(wxT("%d"), (int)(lower + 0.5));
1383 }
1384 else
1385 {
1387 }
1388 item = safenew wxStaticText(w, 0, str);
1389 gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
1390 }
1391 else
1392 gridSizer->Add(1, 1, 0);
1393
1395 0, 0, 1000,
1396 wxDefaultPosition,
1397 wxSize(200, -1));
1398#if wxUSE_ACCESSIBILITY
1399 // so that name can be set on a standard control
1400 mSliders[p]->SetAccessible(safenew WindowAccessible(mSliders[p]));
1401#endif
1402 mSliders[p]->SetName(labelText);
1403 BindTo(*mSliders[p],
1404 wxEVT_COMMAND_SLIDER_UPDATED, &Editor::OnSlider);
1405 gridSizer->Add(mSliders[p], 0, wxALIGN_CENTER_VERTICAL | wxEXPAND | wxALL, 5);
1406
1407 if (hashi) {
1408 if (LADSPA_IS_HINT_INTEGER(hint.HintDescriptor) || forceint)
1409 str.Printf(wxT("%d"), (int)(upper + 0.5));
1410 else
1412 item = safenew wxStaticText(w, 0, str);
1413 gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxALL, 5);
1414 }
1415 else
1416 gridSizer->Add(1, 1, 0);
1417
1418 if (LADSPA_IS_HINT_INTEGER(hint.HintDescriptor) || forceint) {
1419 fieldText.Printf(wxT("%d"), (int)(controls[p] + 0.5));
1420
1421 IntegerValidator<float> vld(&controls[p]);
1422 vld.SetRange(haslo ? lower : INT_MIN,
1423 hashi ? upper : INT_MAX);
1424 mFields[p]->SetValidator(vld);
1425 }
1426 else {
1427 fieldText = Internat::ToDisplayString(controls[p]);
1428
1429 // > 12 decimal places can cause rounding errors in display.
1430 FloatingPointValidator<float> vld(6, &controls[p]);
1431 vld.SetRange(lower, upper);
1432
1433 // Set number of decimal places
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);
1438 else
1439 vld.SetStyle(NumValidatorStyle::ONE_TRAILING_ZERO);
1440
1441 mFields[p]->SetValidator(vld);
1442 }
1443
1444 // Set the textctrl value. This will trigger an event so OnTextCtrl()
1445 // can update the slider.
1446 mFields[p]->SetValue(fieldText);
1447 }
1448
1449 paramSizer->Add(gridSizer.release(), 0, wxEXPAND | wxALL, 5);
1450 marginSizer->Add(paramSizer.release(), 0, wxEXPAND | wxALL, 5);
1451 }
1452
1453 // Make output meters
1454 if (effect.mNumOutputControls > 0) {
1455 auto paramSizer = std::make_unique<wxStaticBoxSizer>(wxVERTICAL, w, _("Effect Output"));
1456
1457 auto gridSizer = std::make_unique<wxFlexGridSizer>(2, 0, 0);
1458 gridSizer->AddGrowableCol(1);
1459
1460 wxControl *item;
1461
1462 for (unsigned long p = 0; p < data.PortCount; ++p) {
1463 LADSPA_PortDescriptor d = data.PortDescriptors[p];
1465 continue;
1466
1467 wxString labelText = LAT1CTOWX(data.PortNames[p]);
1468 item = safenew wxStaticText(
1469 w, 0, wxString::Format(_("%s:"), labelText));
1470 gridSizer->Add(
1471 item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
1472
1473 //LADSPA_PortRangeHint hint = data.PortRangeHints[p];
1474
1475 wxString bound;
1476 float lower = 0.0;
1477 float upper = 1.0;
1478
1479 // Limit to the UI precision
1480 lower = ceilf(lower * 1000000.0) / 1000000.0;
1481 upper = floorf(upper * 1000000.0) / 1000000.0;
1482 controls[p] = lower;
1483
1484 // Capture const reference to output control value for later
1485 // display update
1486 static float sink;
1487 auto pOutput = mpOutputs ? &mpOutputs->controls[p] : &sink;
1489 w, *pOutput, lower, upper);
1490 mMeters[p]->SetLabel(labelText); // for screen readers
1491 gridSizer->Add(mMeters[p], 1, wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALL, 5);
1492 }
1493
1494 paramSizer->Add(gridSizer.release(), 0, wxEXPAND | wxALL, 5);
1495 marginSizer->Add(paramSizer.release(), 0, wxEXPAND | wxALL, 5);
1496 }
1497
1498 w->SetSizer(uMarginSizer.release());
1499 }
1500
1501 w->Layout();
1502
1503 // Try to give the window a sensible default/minimum size
1504 wxSize sz1 = marginSizer->GetMinSize();
1505 wxSize sz2 = mParent->GetMinSize();
1506 w->SetMinSize( { std::min(sz1.x, sz2.x), std::min(sz1.y, sz2.y) } );
1507
1508 // And let the parent reduce to the NEW minimum if possible
1509 mParent->SetMinSize({ -1, -1 });
1510}
int min(int a, int b)
@ EffectTypeGenerate
XO("Cut/Copy/Paste")
#define LAT1CTOWX(X)
Definition: Internat.h:158
#define _(s)
Definition: Internat.h:73
@ ID_Duration
#define safenew
Definition: MemoryX.h:10
const NumericConverterType NumericConverterType_TIME
wxEVT_COMMAND_TEXT_UPDATED
Definition: Nyquist.cpp:133
#define S(N)
Definition: ToChars.cpp:64
void reinit(Integral count, bool initialize=false)
Definition: MemoryX.h:57
EffectSettingsAccess & mAccess
Definition: EffectEditor.h:92
void BindTo(wxEvtHandler &src, const EventTag &eventType, void(Class::*pmf)(Event &))
Definition: EffectEditor.h:85
static FormatterContext SampleRateContext(double sampleRate)
void SetName(const TranslatableString &name)
An alternative to using wxWindowAccessible, which in wxWidgets 3.1.1 contained GetParent() which was ...
#define LADSPA_IS_HINT_TOGGLED(x)
Definition: ladspa.h:312
int LADSPA_PortDescriptor
Definition: ladspa.h:152
#define LADSPA_IS_PORT_INPUT(x)
Definition: ladspa.h:168
#define LADSPA_IS_PORT_AUDIO(x)
Definition: ladspa.h:171
#define LADSPA_IS_PORT_OUTPUT(x)
Definition: ladspa.h:169
EffectSettingsExtra extra
void OnTextCtrl(wxCommandEvent &evt)
void OnCheckBox(wxCommandEvent &evt)
ArrayOf< wxStaticText * > mLabels
void OnSlider(wxCommandEvent &evt)
NumericTextCtrl * mDuration
std::vector< float > controls
Definition: LadspaEffect.h:62
std::vector< float > controls
Definition: LadspaEffect.h:50
Options & AutoPos(bool enable)

References _, NumericTextCtrl::Options::AutoPos(), EffectTypeGenerate, _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(), NumericConverterType_TIME, OnCheckBox(), OnSlider(), OnTextCtrl(), S, safenew, FormatterContext::SampleRateContext(), str, Internat::ToDisplayString(), _LADSPA_PortRangeHint::UpperBound, wxEVT_COMMAND_TEXT_UPDATED, wxT(), and XO().

Here is the call graph for this function:

◆ RefreshControls()

void LadspaEffect::Editor::RefreshControls ( )

Definition at line 1773 of file LadspaEffect.cpp.

1774{
1775 if (!mParent)
1776 return;
1777
1778 // Copy from the dialog
1780
1781 auto& controls = mSettings.controls;
1782
1783 const auto &data = *GetEffect().mData;
1784 for (unsigned long p = 0; p < data.PortCount; ++p) {
1786 if (!(LADSPA_IS_PORT_CONTROL(d)))
1787 continue;
1788
1789 wxString fieldText;
1790 LADSPA_PortRangeHint hint = data.PortRangeHints[p];
1791
1792 bool forceint = false;
1794 forceint = true;
1795
1796 if (LADSPA_IS_PORT_OUTPUT(d))
1797 continue;
1798
1800 mToggles[p]->SetValue(controls[p] > 0);
1801 continue;
1802 }
1803
1804 if (LADSPA_IS_HINT_INTEGER(hint.HintDescriptor) || forceint)
1805 fieldText.Printf(wxT("%d"), (int)(controls[p] + 0.5));
1806 else
1807 fieldText = Internat::ToDisplayString(controls[p]);
1808
1809 // Set the textctrl value. This will trigger an event so OnTextCtrl()
1810 // can update the slider.
1811 mFields[p]->SetValue(fieldText);
1812 }
1813}
#define LADSPA_IS_PORT_CONTROL(x)
Definition: ladspa.h:170
const LADSPA_PortDescriptor * PortDescriptors
Definition: ladspa.h:410
void UpdateControls(const LadspaEffectSettings &src)

References EffectWithSettings< LadspaEffectSettings, StatelessPerTrackEffect >::GetSettings(), _LADSPA_PortRangeHint::HintDescriptor, LADSPA_IS_HINT_INTEGER, LADSPA_IS_HINT_SAMPLE_RATE, LADSPA_IS_HINT_TOGGLED, LADSPA_IS_PORT_CONTROL, LADSPA_IS_PORT_OUTPUT, Internat::ToDisplayString(), and wxT().

Here is the call graph for this function:

◆ UpdateControl()

void LadspaEffect::Editor::UpdateControl ( int  index,
float  value,
float  epsilon 
)

Definition at line 1815 of file LadspaEffect.cpp.

1816{
1817 auto& controls = mSettings.controls;
1818
1819 assert(index < static_cast<int>(controls.size()));
1820
1821 if (std::abs(controls[index] - value) < epsilon)
1822 return;
1823
1824 controls[index] = value;
1825 Publish({ size_t(index), value });
1826}
CallbackReturn Publish(const EffectSettingChanged &message)
Send a message to connected callbacks.
Definition: Observer.h:207

◆ UpdateControls()

void LadspaEffect::Editor::UpdateControls ( const LadspaEffectSettings src)

Definition at line 1828 of file LadspaEffect.cpp.

1829{
1830 const auto& data = *GetEffect().mData;
1831
1832 for (size_t portIndex = 0, portsCount = src.controls.size();
1833 portIndex < portsCount;
1834 ++portIndex)
1835 {
1836 LADSPA_PortDescriptor d = data.PortDescriptors[portIndex];
1837
1839 continue;
1840
1842
1843 const bool isIntValue = (LADSPA_IS_HINT_TOGGLED(hint.HintDescriptor)) ||
1846
1848 portIndex, src.controls[portIndex],
1849 isIntValue ? 0.5f : ControlValueTolerance);
1850 }
1851}

References LadspaEffectSettings::controls, ControlValueTolerance, _LADSPA_PortRangeHint::HintDescriptor, LADSPA_IS_HINT_INTEGER, LADSPA_IS_HINT_SAMPLE_RATE, LADSPA_IS_HINT_TOGGLED, LADSPA_IS_PORT_CONTROL, and LADSPA_IS_PORT_OUTPUT.

◆ UpdateUI()

bool LadspaEffect::Editor::UpdateUI ( )
overridevirtual

Update appearance of the panel for changes in settings.

Default implementation does nothing, returns true

Returns
true if successful

Reimplemented from EffectEditor.

Definition at line 1233 of file LadspaEffect.cpp.

1234{
1236 return true;
1237}

◆ ValidateUI()

bool LadspaEffect::Editor::ValidateUI ( )
overridevirtual

Get settings data from the panel; may make error dialogs and return false.

Returns
true only if panel settings are acceptable

Implements EffectEditor.

Definition at line 1523 of file LadspaEffect.cpp.

1524{
1527 settings.extra.SetDuration(mDuration->GetValue());
1529 return nullptr;
1530 });
1531 return true;
1532}
static Settings & settings()
Definition: TrackInfo.cpp:87
void ModifySettings(Function &&function)
Do a correct read-modify-write of settings.
Externalized state of a plug-in.

References EffectTypeGenerate, EffectWithSettings< LadspaEffectSettings, StatelessPerTrackEffect >::GetSettings(), and settings().

Here is the call graph for this function:

Member Data Documentation

◆ mDialog

wxWeakRef<wxDialog> LadspaEffect::Editor::mDialog

Definition at line 1224 of file LadspaEffect.cpp.

◆ mDuration

NumericTextCtrl* LadspaEffect::Editor::mDuration {}

Definition at line 1223 of file LadspaEffect.cpp.

◆ mFields

ArrayOf<wxTextCtrl*> LadspaEffect::Editor::mFields

Definition at line 1227 of file LadspaEffect.cpp.

◆ mLabels

ArrayOf<wxStaticText*> LadspaEffect::Editor::mLabels

Definition at line 1228 of file LadspaEffect.cpp.

◆ mMeters

std::vector<LadspaEffectMeter *> LadspaEffect::Editor::mMeters

Definition at line 1230 of file LadspaEffect.cpp.

◆ mParent

wxWindow* LadspaEffect::Editor::mParent {}

Definition at line 1225 of file LadspaEffect.cpp.

◆ mpOutputs

const LadspaEffectOutputs* const LadspaEffect::Editor::mpOutputs

Definition at line 1221 of file LadspaEffect.cpp.

◆ mSampleRate

const double LadspaEffect::Editor::mSampleRate

Definition at line 1218 of file LadspaEffect.cpp.

◆ mSettings

LadspaEffectSettings LadspaEffect::Editor::mSettings

Definition at line 1220 of file LadspaEffect.cpp.

◆ mSliders

ArrayOf<wxSlider*> LadspaEffect::Editor::mSliders

Definition at line 1226 of file LadspaEffect.cpp.

◆ mToggles

ArrayOf<wxCheckBox*> LadspaEffect::Editor::mToggles

Definition at line 1229 of file LadspaEffect.cpp.

◆ mType

const EffectType LadspaEffect::Editor::mType

Definition at line 1219 of file LadspaEffect.cpp.


The documentation for this struct was generated from the following file: