Audacity 3.2.0
LV2PreferencesDialog.cpp
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 LV2PreferencesDialog.cpp
6
7 Paul Licameli split from LV2Prefernces.cpp
8
9 Audacity(R) is copyright (c) 1999-2008 Audacity Team.
10 License: GPL v2 or later. See License.txt.
11
12**********************************************************************/
13
14#if defined(USE_LV2)
15
16#if defined(__GNUC__)
17#pragma GCC diagnostic ignored "-Wparentheses"
18#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
19#elif defined(__clang__)
20#pragma clang diagnostic ignored "-Wparentheses"
21#pragma clang diagnostic ignored "-Wdeprecated-declarations"
22#endif
23
25#include "LV2Preferences.h"
26#include "ConfigInterface.h"
27#include "ShuttleGui.h"
28#include "../../widgets/valnum.h"
29
30BEGIN_EVENT_TABLE(LV2PreferencesDialog, wxDialogWrapper)
33
35 const EffectDefinitionInterface &effect
36) : wxDialogWrapper{ nullptr, wxID_ANY, XO("LV2 Effect Settings") }
37 , mEffect{ effect }
38{
39 using namespace LV2Preferences;
40 GetBufferSize(mEffect, mBufferSize);
41 GetUseLatency(mEffect, mUseLatency);
42 GetUseGUI(mEffect, mUseGUI);
44 PopulateOrExchange(S);
45}
46
48
50{
51 S.SetBorder(5);
52 S.StartHorizontalLay(wxEXPAND, 1);
53 {
54 S.StartVerticalLay(false);
55 {
56 // This really shouldn't be required for LV2 plugins because they have the ability
57 // to specify their exact requirements in the TTL file and/or to check the host
58 // supplied min/max values. However, I've run across one (Harrison Consoles XT-EQ)
59 // that crashed on sizes greater than 8192.
60 S.StartStatic(XO("Buffer Size"));
61 {
62 IntegerValidator<int> vld(&mBufferSize);
63 vld.SetRange(8, LV2Preferences::DEFAULT_BLOCKSIZE);
64
65 S.AddVariableText( XO(
66"The buffer size controls the number of samples sent to the effect "
67"on each iteration. Smaller values will cause slower processing and "
68"some effects require 8192 samples or less to work properly. However "
69"most effects can accept large buffers and using them will greatly "
70"reduce processing time."),
71 false, 0, 650);
72
73 S.StartHorizontalLay(wxALIGN_LEFT);
74 {
75 wxTextCtrl *t;
76 t = S.TieNumericTextBox(
77 XXO("&Buffer Size (8 to %d) samples:")
80 12);
81 t->SetMinSize(wxSize(100, -1));
82 t->SetValidator(vld);
83 }
84 S.EndHorizontalLay();
85 }
86 S.EndStatic();
87
88 S.StartStatic(XO("Latency Compensation"));
89 {
90 S.AddVariableText( XO(
91"As part of their processing, some LV2 effects must delay returning "
92"audio to Audacity. When not compensating for this delay, you will "
93"notice that small silences have been inserted into the audio. "
94"Enabling this setting will provide that compensation, but it may "
95"not work for all LV2 effects."),
96 false, 0, 650);
97
98 S.StartHorizontalLay(wxALIGN_LEFT);
99 {
100 S.TieCheckBox(XXO("Enable &compensation"),
102 }
103 S.EndHorizontalLay();
104 }
105 S.EndStatic();
106
107 S.StartStatic(XO("Graphical Mode"));
108 {
109 S.AddVariableText( XO(
110"LV2 effects can have a graphical interface for setting parameter values."
111" A basic text-only method is also available. "
112" Reopen the effect for this to take effect."),
113 false, 0, 650);
114 S.TieCheckBox(XXO("Enable &graphical interface"),
115 mUseGUI);
116 }
117 S.EndStatic();
118 }
119 S.EndVerticalLay();
120 }
121 S.EndHorizontalLay();
122
123 S.AddStandardButtons();
124
125 Layout();
126 Fit();
127 Center();
128}
129
130void LV2PreferencesDialog::OnOk(wxCommandEvent &WXUNUSED(evt))
131{
132 if (!Validate())
133 {
134 return;
135 }
136
139
140 using namespace LV2Preferences;
144
145 EndModal(wxID_OK);
146}
147
148#endif
END_EVENT_TABLE()
EVT_BUTTON(wxID_NO, DependencyDialog::OnNo) EVT_BUTTON(wxID_YES
XO("Cut/Copy/Paste")
XXO("&Cut/Copy/Paste Toolbar")
@ eIsCreating
Definition: ShuttleGui.h:37
@ eIsGettingFromDialog
Definition: ShuttleGui.h:38
#define S(N)
Definition: ToChars.cpp:64
EffectDefinitionInterface is a ComponentInterface that adds some basic read-only information about ef...
Abstract base class used in importing a file.
const EffectDefinitionInterface & mEffect
virtual ~LV2PreferencesDialog()
void PopulateOrExchange(ShuttleGui &S)
void OnOk(wxCommandEvent &evt)
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640
LV2_API bool GetUseGUI(const EffectDefinitionInterface &effect, bool &useGUI)
constexpr auto DEFAULT_BLOCKSIZE
Maximum block size in number of samples (not bytes)
LV2_API bool GetUseLatency(const EffectDefinitionInterface &effect, bool &useLatency)
LV2_API bool SetBufferSize(const EffectDefinitionInterface &effect, int bufferSize)
LV2_API bool SetUseLatency(const EffectDefinitionInterface &effect, bool useLatency)
LV2_API bool SetUseGUI(const EffectDefinitionInterface &effect, bool useGUI)
LV2_API bool GetBufferSize(const EffectDefinitionInterface &effect, int &bufferSize)