Audacity 3.2.0
Enumerations | Functions | Variables
Nyquist.cpp File Reference
#include "Nyquist.h"
#include <wx/choice.h>
#include <wx/scrolwin.h>
#include <wx/sizer.h>
#include <wx/tokenzr.h>
#include <wx/utils.h>
#include <wx/valgen.h>
#include "../../commands/ScriptCommandRelay.h"
#include "../../tracks/playabletrack/wavetrack/ui/WaveChannelView.h"
#include "../../widgets/NumericTextCtrl.h"
#include "../../widgets/valnum.h"
#include "../EffectEditor.h"
#include "BasicUI.h"
#include "ShuttleGui.h"
#include "EffectManager.h"
#include <nyx.h>
#include <cfloat>
Include dependency graph for Nyquist.cpp:

Go to the source code of this file.

Enumerations

enum  {
  ID_Editor = 10000 , ID_Load , ID_Save , ID_Slider = 11000 ,
  ID_Choice = 13000 , ID_FILE = 15000
}
 

Functions

 EVT_COMMAND_RANGE (ID_Slider, ID_Slider+99, wxEVT_COMMAND_SLIDER_UPDATED, NyquistEffect::OnSlider) EVT_COMMAND_RANGE(ID_Text
 
NyquistEffect::OnText EVT_COMMAND_RANGE (ID_Choice, ID_Choice+99, wxEVT_COMMAND_CHOICE_SELECTED, NyquistEffect::OnChoice) EVT_COMMAND_RANGE(ID_Time
 
NyquistEffect::OnText NyquistEffect::OnTime EVT_COMMAND_RANGE (ID_FILE, ID_FILE+99, wxEVT_COMMAND_BUTTON_CLICKED, NyquistEffect::OnFileButton) int NyquistEffect
 

Variables

 ID_Text = 12000
 
 wxEVT_COMMAND_TEXT_UPDATED
 
NyquistEffect::OnText ID_Time = 14000
 
static const FileNames::FileType NyquistScripts = { XO("Nyquist scripts"), { wxT("ny") }, true }
 
static const FileNames::FileType LispScripts = { XO("Lisp scripts"), { wxT("lsp") }, true }
 
static NyquistBase::GetEffectHook::Scope getEffectHookScope
 
static NyquistBase::GetDisplaysHook::Scope getDisplaysHookScope
 
static NyquistBase::ShowDebugOutputHook::Scope showDebugOutputHookScope
 
static NyquistBase::ExecFromMainHook::Scope execFromMainHookScope
 
static NyquistBase::YieldIfNeededHook::Scope yieldIfNeededHookScope
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
ID_Editor 
ID_Load 
ID_Save 
ID_Slider 
ID_Choice 
ID_FILE 

Definition at line 53 of file Nyquist.cpp.

54{
55 ID_Editor = 10000,
56 ID_Load,
57 ID_Save,
58
59 ID_Slider = 11000,
60 ID_Text = 12000,
61 ID_Choice = 13000,
62 ID_Time = 14000,
63 ID_FILE = 15000
64};
@ ID_Editor
Definition: Nyquist.cpp:55
@ ID_Load
Definition: Nyquist.cpp:56
@ ID_FILE
Definition: Nyquist.cpp:63
@ ID_Choice
Definition: Nyquist.cpp:61
@ ID_Slider
Definition: Nyquist.cpp:59
@ ID_Save
Definition: Nyquist.cpp:57
ID_Text
Definition: Nyquist.cpp:72
NyquistEffect::OnText ID_Time
Definition: Nyquist.cpp:76

Function Documentation

◆ EVT_COMMAND_RANGE() [1/3]

NyquistEffect::OnText EVT_COMMAND_RANGE ( ID_Choice  ,
ID_Choice 99,
wxEVT_COMMAND_CHOICE_SELECTED  ,
NyquistEffect::OnChoice   
)

◆ EVT_COMMAND_RANGE() [2/3]

Definition at line 78 of file Nyquist.cpp.

86{
87 int res = wxID_APPLY;
89 // Show the normal (prompt or effect) interface
91 parent, factory, pInstance, access, forceModal);
92 }
93
94
95 // Remember if the user clicked debug
96 mDebug = (res == eDebugID);
97
98 // We're done if the user clicked "Close", we are not the Nyquist Prompt,
99 // or the program currently loaded into the prompt doesn't have a UI.
100 if (!res || !mIsPrompt || mControls.size() == 0 || !pInstance)
101 return res;
102
103 // Nyquist prompt was OK, but gave us some magic ;control comments to
104 // reinterpret into a second dialog
105
107 effect.SetCommand(mInputCmd);
108 Finally Do{[&]{
109 // A second dialog will use effect as a pushed event handler.
110 // wxWidgets delays window destruction until idle time.
111 // Yield to destroy the dialog while effect is still in scope.
113 }};
114
115 // Must give effect its own settings to interpret, not those in access
116 // Let's also give it its own instance
117 auto newSettings = effect.MakeSettings();
118 auto pNewInstance = effect.MakeInstance();
119 auto newAccess = std::make_shared<SimpleEffectSettingsAccess>(newSettings);
120
121 if (IsBatchProcessing()) {
122 effect.SetBatchProcessing();
123
125 cp.SetParameters(mParameters);
126 effect.LoadSettings(cp, newSettings);
127
128 // Show the normal (prompt or effect) interface
129 // Don't pass this as first argument, pass the worker to itself
130 res = effect.ShowHostInterface(effect,
131 parent, factory, pNewInstance, *newAccess, forceModal);
132 if (res) {
134 effect.SaveSettings(newSettings, cp);
135 cp.GetParameters(mParameters);
136 }
137 }
138 else {
139 if (!factory)
140 return 0;
141 // Don't pass this as first argument, pass the worker to itself
142 res = effect.ShowHostInterface(effect,
143 parent, factory, pNewInstance, *newAccess, false );
144 if (!res)
145 return 0;
146
147 // Wrap the new settings in the old settings
148 access.ModifySettings([&](EffectSettings &settings){
149 auto &nyquistSettings = GetSettings(settings);
150 nyquistSettings.proxySettings = std::move(newSettings);
151 nyquistSettings.proxyDebug = this->mDebug;
152 nyquistSettings.controls = move(effect.mControls);
153 return nullptr;
154 });
155 }
156 if (!pNewInstance)
157 // Propagate the failure from nested ShowHostInterface
158 pInstance.reset();
159 return res;
160}
static RegisteredToolbarFactory factory
#define NYQUIST_WORKER_ID
Definition: NyquistBase.h:25
@ eDebugID
Definition: ShuttleGui.h:628
static Settings & settings()
Definition: TrackInfo.cpp:51
CommandParameters, derived from wxFileConfig, is essentially doing the same things as the SettingsVis...
bool GetParameters(wxString &parms)
bool SetParameters(const wxString &parms)
unsigned TestUIFlags(unsigned mask)
Definition: Effect.cpp:291
virtual int ShowHostInterface(EffectBase &plugin, wxWindow &parent, const EffectDialogFactory &factory, std::shared_ptr< EffectInstance > &pInstance, EffectSettingsAccess &access, bool forceModal=false)
void Yield()
Dispatch waiting events, including actions enqueued by CallAfter.
Definition: BasicUI.cpp:225
DynamicRangeProcessorSettings GetSettings(EffectSettingsAccess &access)
Externalized state of a plug-in.
"finally" as in The C++ Programming Language, 4th ed., p. 358 Useful for defining ad-hoc RAII actions...
Definition: MemoryX.h:175

References eDebugID, factory, CommandParameters::GetParameters(), anonymous_namespace{DynamicRangeProcessorEditor.cpp}::GetSettings(), EffectManager::kRepeatNyquistPrompt, NyquistBase::LoadSettings(), StatefulEffect::MakeInstance(), EffectWithSettings< Settings, Base >::MakeSettings(), NyquistBase::mControls, NYQUIST_WORKER_ID, NyquistBase::SaveSettings(), Effect::SetBatchProcessing(), NyquistBase::SetCommand(), CommandParameters::SetParameters(), settings(), EffectUIServices::ShowHostInterface(), NyquistEffect::ShowHostInterface(), Effect::TestUIFlags(), and BasicUI::Yield().

Here is the call graph for this function:

◆ EVT_COMMAND_RANGE() [3/3]

EVT_COMMAND_RANGE ( ID_Slider  ,
ID_Slider 99,
wxEVT_COMMAND_SLIDER_UPDATED  ,
NyquistEffect::OnSlider   
)

Variable Documentation

◆ execFromMainHookScope

NyquistBase::ExecFromMainHook::Scope execFromMainHookScope
static
Initial value:
{
[](wxString* pIn, wxString* pOut) { ExecFromMain(pIn, pOut); }
}
int ExecFromMain(wxString *pIn, wxString *pOut)
Executes a command on the main (GUI) thread.

Definition at line 929 of file Nyquist.cpp.

◆ getDisplaysHookScope

NyquistBase::GetDisplaysHook::Scope getDisplaysHookScope
static
Initial value:
{
[](const WaveTrack* track) {
auto pView = WaveChannelView::FindFirst(track);
return pView ? pView->GetDisplays() :
std::vector<WaveChannelSubView::Type> {};
}
}
static WaveChannelView * FindFirst(WaveTrack *pWt)
If pWt is not null, return a pointer to the view of the first channel.
A Track that contains audio waveform data.
Definition: WaveTrack.h:203

Definition at line 913 of file Nyquist.cpp.

◆ getEffectHookScope

NyquistBase::GetEffectHook::Scope getEffectHookScope
static
Initial value:
{
[](const PluginID& path) {
return std::make_unique<NyquistEffect>(path);
}
}
wxString PluginID

Definition at line 905 of file Nyquist.cpp.

◆ ID_Text

ID_Text = 12000

◆ ID_Time

ID_Time = 14000

◆ LispScripts

const FileNames::FileType LispScripts = { XO("Lisp scripts"), { wxT("lsp") }, true }
static

Definition at line 606 of file Nyquist.cpp.

◆ NyquistScripts

const FileNames::FileType NyquistScripts = { XO("Nyquist scripts"), { wxT("ny") }, true }
static

Definition at line 604 of file Nyquist.cpp.

◆ showDebugOutputHookScope

NyquistBase::ShowDebugOutputHook::Scope showDebugOutputHookScope
static
Initial value:
{
[](const TranslatableString& title, const TranslatableString& message) {
NyquistOutputDialog dialog { title, message };
dialog.CentreOnParent();
dialog.ShowModal();
}
}
static const auto title
Dialog used with NyquistBase.
Definition: Nyquist.h:69
Holds a msgid for the translation catalog; may also bind format arguments.

Definition at line 921 of file Nyquist.cpp.

◆ wxEVT_COMMAND_TEXT_UPDATED

NyquistEffect::OnText wxEVT_COMMAND_TEXT_UPDATED

Definition at line 73 of file Nyquist.cpp.

Referenced by LadspaEditor::PopulateUI(), and NumericTextCtrl::Updated().

◆ yieldIfNeededHookScope

NyquistBase::YieldIfNeededHook::Scope yieldIfNeededHookScope
static
Initial value:
{ []() {
wxYieldIfNeeded();
} }

Definition at line 933 of file Nyquist.cpp.