Audacity 3.2.0
Classes | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
NyquistEffect Class Referencefinal

An Effect that calls up a Nyquist (XLISP) plug-in, i.e. many possible effects from this one class. More...

#include <Nyquist.h>

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

Classes

struct  Tokenizer
 

Public Member Functions

 NyquistEffect (const wxString &fName)
 
virtual ~NyquistEffect ()
 
PluginPath GetPath () const override
 
ComponentInterfaceSymbol GetSymbol () const override
 
VendorSymbol GetVendor () const override
 
wxString GetVersion () const override
 
TranslatableString GetDescription () const override
 
ManualPageID ManualPage () const override
 Name of a page in the Audacity alpha manual, default is empty. More...
 
FilePath HelpPage () const override
 Fully qualified local help file name, default is empty. More...
 
EffectType GetType () const override
 Type determines how it behaves. More...
 
EffectType GetClassification () const override
 Determines which menu it appears in; default same as GetType(). More...
 
EffectFamilySymbol GetFamily () const override
 Report identifier and user-visible name of the effect protocol. More...
 
bool IsInteractive () const override
 Whether the effect needs a dialog for entry of settings. More...
 
bool IsDefault () const override
 Whether the effect sorts "above the line" in the menus. More...
 
bool EnablesDebug () const override
 Whether the effect dialog should have a Debug button; default, always false. More...
 
bool SaveSettings (const EffectSettings &settings, CommandParameters &parms) const override
 Store settings as keys and values. More...
 
bool LoadSettings (const CommandParameters &parms, EffectSettings &settings) const override
 Restore settings from keys and values. More...
 
bool DoLoadSettings (const CommandParameters &parms, EffectSettings &settings)
 
bool VisitSettings (SettingsVisitor &visitor, EffectSettings &settings) override
 
bool VisitSettings (ConstSettingsVisitor &visitor, const EffectSettings &settings) const override
 
int SetLispVarsFromParameters (const CommandParameters &parms, bool bTestOnly)
 
bool Init () override
 Call once to set up state for whole list of tracks to be processed. More...
 
bool Process (EffectInstance &instance, EffectSettings &settings) override
 Actually do the effect here. More...
 
int ShowHostInterface (wxWindow &parent, const EffectDialogFactory &factory, std::shared_ptr< EffectInstance > &pInstance, EffectSettingsAccess &access, bool forceModal=false) override
 Usually applies factory to self and given access. More...
 
std::unique_ptr< EffectUIValidatorPopulateOrExchange (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs) override
 Add controls to effect panel; always succeeds. More...
 
bool TransferDataToWindow (const EffectSettings &settings) override
 Update controls for the settings. More...
 
bool TransferDataFromWindow (EffectSettings &settings) override
 Update the given settings from controls. More...
 
void RedirectOutput ()
 
void SetCommand (const wxString &cmd)
 
void Continue ()
 
void Break ()
 
void Stop ()
 
- Public Member Functions inherited from EffectWithSettings< NyquistSettings, StatefulEffect >
EffectSettings MakeSettings () const override
 
bool CopySettingsContents (const EffectSettings &src, EffectSettings &dst) const override
 
- Public Member Functions inherited from StatefulEffect
std::shared_ptr< EffectInstanceMakeInstance () const override
 Make an object maintaining short-term state of an Effect. More...
 
- Public Member Functions inherited from StatefulEffectBase
virtual bool Init ()
 Call once to set up state for whole list of tracks to be processed. More...
 
virtual bool Process (EffectInstance &instance, EffectSettings &settings)=0
 Actually do the effect here. More...
 
virtual bool RealtimeInitialize (EffectSettings &settings, double sampleRate)
 
virtual bool RealtimeAddProcessor (EffectSettings &settings, EffectOutputs *pOutputs, unsigned numChannels, float sampleRate)
 
virtual bool RealtimeSuspend ()
 
virtual bool RealtimeResume ()
 
virtual bool RealtimeProcessStart (MessagePackage &package)
 settings are possibly changed, since last call, by an asynchronous dialog More...
 
virtual size_t RealtimeProcess (size_t group, EffectSettings &settings, const float *const *inBuf, float *const *outBuf, size_t numSamples)
 
virtual bool RealtimeProcessEnd (EffectSettings &settings) noexcept
 settings can be updated to let a dialog change appearance at idle More...
 
virtual bool RealtimeFinalize (EffectSettings &settings) noexcept
 
virtual size_t SetBlockSize (size_t maxBlockSize)
 
virtual size_t GetBlockSize () const
 
virtual unsigned GetAudioInCount () const
 How many input buffers to allocate at once. More...
 
virtual unsigned GetAudioOutCount () const
 How many output buffers to allocate at once. More...
 
virtual sampleCount GetLatency () const
 
- Public Member Functions inherited from Effect
 Effect ()
 
virtual ~Effect ()
 
PluginPath GetPath () const override
 
bool VisitSettings (SettingsVisitor &visitor, EffectSettings &settings) override
 
bool VisitSettings (ConstSettingsVisitor &visitor, const EffectSettings &settings) const override
 
ComponentInterfaceSymbol GetSymbol () const override
 
VendorSymbol GetVendor () const override
 
wxString GetVersion () const override
 
TranslatableString GetDescription () const override
 
EffectType GetType () const override
 Type determines how it behaves. More...
 
EffectFamilySymbol GetFamily () const override
 Report identifier and user-visible name of the effect protocol. More...
 
bool IsInteractive () const override
 Whether the effect needs a dialog for entry of settings. More...
 
bool IsDefault () const override
 Whether the effect sorts "above the line" in the menus. More...
 
RealtimeSince RealtimeSupport () const override
 Since which version of Audacity has the effect supported realtime? More...
 
bool SupportsAutomation () const override
 Whether the effect has any automatable controls. More...
 
bool SaveSettings (const EffectSettings &settings, CommandParameters &parms) const override
 Store settings as keys and values. More...
 
bool LoadSettings (const CommandParameters &parms, EffectSettings &settings) const override
 Restore settings from keys and values. More...
 
OptionalMessage LoadUserPreset (const RegistryPath &name, EffectSettings &settings) const override
 
bool SaveUserPreset (const RegistryPath &name, const EffectSettings &settings) const override
 Save settings in the configuration file as a user-named preset. More...
 
RegistryPaths GetFactoryPresets () const override
 Report names of factory presets. More...
 
OptionalMessage LoadFactoryPreset (int id, EffectSettings &settings) const override
 
OptionalMessage LoadFactoryDefaults (EffectSettings &settings) const override
 
virtual const EffectParameterMethodsParameters () const
 
int ShowClientInterface (wxWindow &parent, wxDialog &dialog, EffectUIValidator *pValidator, bool forceModal) override
 
EffectUIClientInterfaceGetEffectUIClientInterface () override
 Returns the EffectUIClientInterface instance for this effect. More...
 
std::unique_ptr< EffectUIValidatorPopulateUI (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs) override
 Adds controls to a panel that is given as the parent window of S More...
 
bool IsGraphicalUI () override
 
bool ValidateUI (EffectSettings &) override
 
bool CloseUI () override
 
bool CanExportPresets () override
 
void ExportPresets (const EffectSettings &settings) const override
 
OptionalMessage ImportPresets (EffectSettings &settings) override
 
bool HasOptions () override
 
void ShowOptions () override
 
const EffectSettingsManagerGetDefinition () const override
 
virtual NumericFormatSymbol GetSelectionFormat ()
 
int ShowHostInterface (wxWindow &parent, const EffectDialogFactory &factory, std::shared_ptr< EffectInstance > &pInstance, EffectSettingsAccess &access, bool forceModal=false) override
 Usually applies factory to self and given access. More...
 
bool SaveSettingsAsString (const EffectSettings &settings, wxString &parms) const override
 
OptionalMessage LoadSettingsFromString (const wxString &parms, EffectSettings &settings) const override
 
bool IsBatchProcessing () const override
 
void SetBatchProcessing () override
 
void UnsetBatchProcessing () override
 
bool TransferDataToWindow (const EffectSettings &settings) override
 Update controls for the settings. More...
 
bool TransferDataFromWindow (EffectSettings &settings) override
 Update the given settings from controls. More...
 
unsigned TestUIFlags (unsigned mask)
 
bool Delegate (Effect &delegate, EffectSettings &settings)
 Re-invoke DoEffect on another Effect object that implements the work. More...
 
int MessageBox (const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={}) const
 
bool EnableApply (bool enable=true)
 
wxWindow * GetUIParent ()
 
- Public Member Functions inherited from EffectBase
 EffectBase ()
 
 ~EffectBase () override
 
void SetTracks (TrackList *pTracks)
 
- Public Member Functions inherited from EffectUIClientInterface
virtual ~EffectUIClientInterface ()
 
virtual int ShowClientInterface (wxWindow &parent, wxDialog &dialog, EffectUIValidator *pValidator, bool forceModal=false)=0
 
virtual bool IsGraphicalUI ()=0
 
virtual std::unique_ptr< EffectUIValidatorPopulateUI (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs)=0
 Adds controls to a panel that is given as the parent window of S More...
 
virtual bool CanExportPresets ()=0
 
virtual void ExportPresets (const EffectSettings &settings) const =0
 
virtual OptionalMessage ImportPresets (EffectSettings &settings)=0
 
virtual bool HasOptions ()=0
 
virtual void ShowOptions ()=0
 
virtual bool ValidateUI (EffectSettings &settings)=0
 
virtual bool CloseUI ()=0
 
- Public Member Functions inherited from EffectPlugin
EffectPluginoperator= (EffectPlugin &)=delete
 
virtual ~EffectPlugin ()
 
virtual const EffectSettingsManagerGetDefinition () const =0
 
virtual int ShowHostInterface (wxWindow &parent, const EffectDialogFactory &factory, std::shared_ptr< EffectInstance > &pInstance, EffectSettingsAccess &access, bool forceModal=false)=0
 Usually applies factory to self and given access. More...
 
virtual EffectUIClientInterfaceGetEffectUIClientInterface ()=0
 Returns the EffectUIClientInterface instance for this effect. More...
 
virtual void Preview (EffectSettingsAccess &access, bool dryOnly)=0
 
virtual bool SaveSettingsAsString (const EffectSettings &settings, wxString &parms) const =0
 
virtual OptionalMessage LoadSettingsFromString (const wxString &parms, EffectSettings &settings) const =0
 
virtual bool IsBatchProcessing () const =0
 
virtual void SetBatchProcessing ()=0
 
virtual void UnsetBatchProcessing ()=0
 
virtual bool DoEffect (EffectSettings &settings, double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, unsigned flags, wxWindow *pParent=nullptr, const EffectDialogFactory &dialogFactory={}, const EffectSettingsAccessPtr &pAccess=nullptr)=0
 Unfortunately complicated dual-use function. More...
 
virtual bool TransferDataToWindow (const EffectSettings &settings)=0
 Update controls for the settings. More...
 
virtual bool TransferDataFromWindow (EffectSettings &settings)=0
 Update the given settings from controls. More...
 
- Public Member Functions inherited from EffectInstanceFactory
virtual ~EffectInstanceFactory ()
 
virtual std::shared_ptr< EffectInstanceMakeInstance () const =0
 Make an object maintaining short-term state of an Effect. More...
 
- Public Member Functions inherited from EffectSettingsManager
virtual ~EffectSettingsManager ()
 
virtual bool VisitSettings (SettingsVisitor &visitor, EffectSettings &settings)
 
virtual bool VisitSettings (ConstSettingsVisitor &visitor, const EffectSettings &settings) const
 
virtual std::unique_ptr< EffectOutputsMakeOutputs () const
 Produce an object to hold values to send to effect output meters. More...
 
- Public Member Functions inherited from EffectDefinitionInterface
virtual ~EffectDefinitionInterface ()
 
virtual EffectType GetType () const =0
 Type determines how it behaves. More...
 
virtual EffectType GetClassification () const
 Determines which menu it appears in; default same as GetType(). More...
 
virtual EffectFamilySymbol GetFamily () const =0
 Report identifier and user-visible name of the effect protocol. More...
 
virtual bool IsInteractive () const =0
 Whether the effect needs a dialog for entry of settings. More...
 
virtual bool IsDefault () const =0
 Whether the effect sorts "above the line" in the menus. More...
 
virtual RealtimeSince RealtimeSupport () const =0
 Since which version of Audacity has the effect supported realtime? More...
 
bool SupportsRealtime () const
 
virtual bool SupportsAutomation () const =0
 Whether the effect has any automatable controls. More...
 
virtual bool EnablesDebug () const
 Whether the effect dialog should have a Debug button; default, always false. More...
 
virtual ManualPageID ManualPage () const
 Name of a page in the Audacity alpha manual, default is empty. More...
 
virtual FilePath HelpPage () const
 Fully qualified local help file name, default is empty. More...
 
virtual bool IsHiddenFromMenus () const
 Default is false. More...
 
- Public Member Functions inherited from ComponentInterface
virtual ~ComponentInterface ()
 
virtual PluginPath GetPath () const =0
 
virtual ComponentInterfaceSymbol GetSymbol () const =0
 
virtual VendorSymbol GetVendor () const =0
 
virtual wxString GetVersion () const =0
 
virtual TranslatableString GetDescription () const =0
 
TranslatableString GetName () const
 

Private Types

using Buffer = std::unique_ptr< float[]>
 

Private Member Functions

bool ProcessOne ()
 
void BuildPromptWindow (ShuttleGui &S)
 
void BuildEffectWindow (ShuttleGui &S)
 
bool TransferDataToPromptWindow ()
 
bool TransferDataToEffectWindow ()
 
bool TransferDataFromPromptWindow ()
 
bool TransferDataFromEffectWindow ()
 
bool IsOk ()
 
const TranslatableStringInitializationError () const
 
wxString EscapeString (const wxString &inStr)
 
FileExtensions ParseFileExtensions (const wxString &text)
 
FileNames::FileType ParseFileType (const wxString &text)
 
FileNames::FileTypes ParseFileTypes (const wxString &text)
 
int GetCallback (float *buffer, int channel, int64_t start, int64_t len, int64_t totlen)
 
int PutCallback (float *buffer, int channel, int64_t start, int64_t len, int64_t totlen)
 
void OutputCallback (int c)
 
void OSCallback ()
 
void ParseFile ()
 
bool ParseCommand (const wxString &cmd)
 
bool ParseProgram (wxInputStream &stream)
 
bool Parse (Tokenizer &tokenizer, const wxString &line, bool eof, bool first)
 
void OnLoad (wxCommandEvent &evt)
 
void OnSave (wxCommandEvent &evt)
 
void OnDebug (wxCommandEvent &evt)
 
void OnText (wxCommandEvent &evt)
 
void OnSlider (wxCommandEvent &evt)
 
void OnChoice (wxCommandEvent &evt)
 
void OnTime (wxCommandEvent &evt)
 
void OnFileButton (wxCommandEvent &evt)
 
bool validatePath (wxString path)
 
wxString ToTimeFormat (double t)
 
std::pair< bool, FilePathCheckHelpPage () const
 

Static Private Member Functions

static FilePaths GetNyquistSearchPath ()
 
static wxString NyquistToWxString (const char *nyqString)
 
static std::vector< EnumValueSymbolParseChoice (const wxString &text)
 
static int StaticGetCallback (float *buffer, int channel, int64_t start, int64_t len, int64_t totlen, void *userdata)
 
static int StaticPutCallback (float *buffer, int channel, int64_t start, int64_t len, int64_t totlen, void *userdata)
 
static void StaticOutputCallback (int c, void *userdata)
 
static void StaticOSCallback (void *userdata)
 
static TranslatableString UnQuoteMsgid (const wxString &s, bool allowParens=true, wxString *pExtraString=nullptr)
 
static wxString UnQuote (const wxString &s, bool allowParens=true, wxString *pExtraString=nullptr)
 
static double GetCtrlValue (const wxString &s)
 
static void resolveFilePath (wxString &path, FileExtension extension={})
 

Private Attributes

wxString mXlispPath
 
wxFileName mFileName
 Name of the Nyquist script file this effect is loaded from. More...
 
wxDateTime mFileModified
 When the script was last modified on disk. More...
 
bool mStop
 
bool mBreak
 
bool mCont
 
bool mFoundType
 
bool mCompiler
 
bool mTrace
 
bool mIsSal
 
bool mExternal
 
bool mIsSpectral
 
bool mIsTool
 
bool mIsPrompt
 
bool mOK
 
TranslatableString mInitError
 
wxString mInputCmd
 
wxString mParameters
 
wxString mCmd
 
TranslatableString mName
 Name of the Effect (untranslated) More...
 
TranslatableString mPromptName
 
TranslatableString mAction
 
TranslatableString mInfo
 
TranslatableString mAuthor
 
TranslatableString mReleaseVersion
 
TranslatableString mCopyright
 
wxString mManPage
 
wxString mHelpFile
 
bool mHelpFileExists
 
FilePath mHelpPage
 
EffectType mType
 
EffectType mPromptType
 
bool mEnablePreview
 
bool mDebugButton
 
bool mDebug
 
bool mRedirectOutput
 
bool mProjectChanged
 
wxString mDebugOutputStr
 
TranslatableString mDebugOutput
 
int mVersion
 
std::vector< NyqControlmControls
 
unsigned mCurNumChannels
 
WaveTrackmCurTrack [2]
 
sampleCount mCurStart [2]
 
sampleCount mCurLen
 
sampleCount mMaxLen
 
int mTrackIndex
 
bool mFirstInGroup
 
double mOutputTime
 
unsigned mCount
 
unsigned mNumSelectedChannels
 
double mProgressIn
 
double mProgressOut
 
double mProgressTot
 
double mScale
 
Buffer mCurBuffer [2]
 
sampleCount mCurBufferStart [2]
 
size_t mCurBufferLen [2]
 
WaveTrackmOutputTrack [2]
 
wxArrayString mCategories
 
wxString mProps
 
wxString mPerTrackProps
 
bool mRestoreSplits
 
int mMergeClips
 
wxTextCtrl * mCommandText
 
std::exception_ptr mpException {}
 

Static Private Attributes

static int mReentryCount = 0
 

Friends

class NyquistEffectsModule
 

Additional Inherited Members

- Public Types inherited from StatefulEffectBase
using MessagePackage = EffectInstance::MessagePackage
 
- Public Types inherited from Effect
enum  : long { DefaultMessageBoxStyle = wxOK | wxCENTRE }
 
- Public Types inherited from EffectPlugin
using EffectSettingsAccessPtr = std::shared_ptr< EffectSettingsAccess >
 
- Public Types inherited from EffectDefinitionInterface
enum class  RealtimeSince : unsigned { Never , Since_3_2 , Always }
 In which versions of Audacity was an effect realtime capable? More...
 
- Static Public Member Functions inherited from EffectWithSettings< NyquistSettings, StatefulEffect >
static NyquistSettingsGetSettings (EffectSettings &settings)
 Assume settings originated from MakeSettings() and copies thereof. More...
 
static const NyquistSettingsGetSettings (const EffectSettings &settings)
 Assume settings originated from MakeSettings() and copies thereof. More...
 
static NyquistSettingsFetchParameters (StatefulEffect &, EffectSettings &s)
 
- Static Public Member Functions inherited from Effect
static EffectFetchParameters (Effect &e, EffectSettings &)
 
static void IncEffectCounter ()
 
- Static Public Member Functions inherited from EffectDefinitionInterface
static Identifier GetSquashedName (const Identifier &ident)
 A utility that strips spaces and CamelCases a name. More...
 
- Static Public Attributes inherited from EffectPlugin
static const wxString kUserPresetIdent = wxT("User Preset:")
 
static const wxString kFactoryPresetIdent = wxT("Factory Preset:")
 
static const wxString kCurrentSettingsIdent = wxT("<Current Settings>")
 
static const wxString kFactoryDefaultsIdent = wxT("<Factory Defaults>")
 
- Protected Member Functions inherited from Effect
bool EnablePreview (bool enable=true)
 
bool CheckWhetherSkipEffect (const EffectSettings &settings) const override
 Default implementation returns false. More...
 
double CalcPreviewInputLength (const EffectSettings &settings, double previewLength) const override
 Default implementation returns previewLength More...
 
virtual std::unique_ptr< EffectUIValidatorPopulateOrExchange (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs)
 Add controls to effect panel; always succeeds. More...
 
bool TotalProgress (double frac, const TranslatableString &={}) const
 
bool TrackProgress (int whichTrack, double frac, const TranslatableString &={}) const
 
bool TrackGroupProgress (int whichGroup, double frac, const TranslatableString &={}) const
 
int GetNumWaveTracks () const
 
int GetNumWaveGroups () const
 
void GetBounds (const WaveTrack &track, const WaveTrack *pRight, sampleCount *start, sampleCount *len)
 
void CopyInputTracks (bool allSyncLockSelected=false)
 
std::shared_ptr< AddedAnalysisTrackAddAnalysisTrack (const wxString &name=wxString())
 
ModifiedAnalysisTrack ModifyAnalysisTrack (const LabelTrack *pOrigTrack, const wxString &name=wxString())
 
TrackAddToOutputTracks (const std::shared_ptr< Track > &t)
 
- Protected Member Functions inherited from EffectBase
void Preview (EffectSettingsAccess &access, bool dryOnly) override
 
bool DoEffect (EffectSettings &settings, double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, unsigned flags, wxWindow *pParent, const EffectDialogFactory &dialogFactory, const EffectSettingsAccessPtr &pAccess) override
 Unfortunately complicated dual-use function. More...
 
virtual bool CheckWhetherSkipEffect (const EffectSettings &settings) const =0
 After Init(), tell whether Process() should be skipped. More...
 
virtual double CalcPreviewInputLength (const EffectSettings &settings, double previewLength) const =0
 
void SetLinearEffectFlag (bool linearEffectFlag)
 
void SetPreviewFullSelectionFlag (bool previewDurationFlag)
 
bool IsPreviewing () const
 
void IncludeNotSelectedPreviewTracks (bool includeNotSelected)
 
void ReplaceProcessedTracks (const bool bGoodResult)
 
const TrackListinputTracks () const
 
const AudacityProjectFindProject () const
 
- Protected Attributes inherited from Effect
wxWeakRef< wxDialog > mHostUIDialog
 This smart pointer tracks the lifetime of the dialog. More...
 
wxWindow * mUIParent {}
 
- Protected Attributes inherited from EffectBase
BasicUI::ProgressDialogmProgress {}
 
double mProjectRate {}
 
WaveTrackFactorymFactory {}
 
std::shared_ptr< TrackListmOutputTracks
 
double mT0 {}
 
double mT1 {}
 
wxArrayString mPresetNames
 
unsigned mUIFlags { 0 }
 
- Static Protected Attributes inherited from EffectBase
static int nEffectsDone = 0
 

Detailed Description

An Effect that calls up a Nyquist (XLISP) plug-in, i.e. many possible effects from this one class.

Definition at line 74 of file Nyquist.h.

Member Typedef Documentation

◆ Buffer

using NyquistEffect::Buffer = std::unique_ptr<float[]>
private

Definition at line 295 of file Nyquist.h.

Constructor & Destructor Documentation

◆ NyquistEffect()

NyquistEffect::NyquistEffect ( const wxString &  fName)
Parameters
fNameFile name of the Nyquist script defining this effect. If an empty string, then prompt the user for the Nyquist code to interpret.

◆ ~NyquistEffect()

NyquistEffect::~NyquistEffect ( )
virtual

Definition at line 203 of file Nyquist.cpp.

204{
205}

Member Function Documentation

◆ Break()

void NyquistEffect::Break ( )

Definition at line 1859 of file Nyquist.cpp.

1860{
1861 mBreak = true;
1862}
bool mBreak
Definition: Nyquist.h:231

References mBreak.

◆ BuildEffectWindow()

void NyquistEffect::BuildEffectWindow ( ShuttleGui S)
private

Definition at line 2906 of file Nyquist.cpp.

2907{
2908 wxScrolledWindow *scroller = S.Style(wxVSCROLL | wxTAB_TRAVERSAL)
2909 .StartScroller(2);
2910 {
2911 S.StartMultiColumn(4);
2912 {
2913 for (size_t i = 0; i < mControls.size(); i++)
2914 {
2915 NyqControl & ctrl = mControls[i];
2916
2917 if (ctrl.type == NYQ_CTRL_TEXT)
2918 {
2919 S.EndMultiColumn();
2920 S.StartHorizontalLay(wxALIGN_LEFT, 0);
2921 {
2922 S.AddSpace(0, 10);
2923 S.AddFixedText( Verbatim( ctrl.label ), false );
2924 }
2925 S.EndHorizontalLay();
2926 S.StartMultiColumn(4);
2927 }
2928 else
2929 {
2930 auto prompt = XXO("%s:").Format( ctrl.name );
2931 S.AddPrompt( prompt );
2932
2933 if (ctrl.type == NYQ_CTRL_STRING)
2934 {
2935 S.AddSpace(10, 10);
2936
2937 auto item = S.Id(ID_Text + i)
2938 .Validator<wxGenericValidator>(&ctrl.valStr)
2939 .Name( prompt )
2940 .AddTextBox( {}, wxT(""), 50);
2941 }
2942 else if (ctrl.type == NYQ_CTRL_CHOICE)
2943 {
2944 S.AddSpace(10, 10);
2945
2946 S.Id(ID_Choice + i).AddChoice( {},
2947 Msgids( ctrl.choices.data(), ctrl.choices.size() ) );
2948 }
2949 else if (ctrl.type == NYQ_CTRL_TIME)
2950 {
2951 S.AddSpace(10, 10);
2952
2953 const auto options = NumericTextCtrl::Options{}
2954 .AutoPos(true)
2955 .MenuEnabled(true)
2956 .ReadOnly(false);
2957
2958 NumericTextCtrl *time = safenew
2959 NumericTextCtrl(S.GetParent(), (ID_Time + i),
2962 ctrl.val,
2964 options);
2965 S
2966 .Name( prompt )
2967 .Position(wxALIGN_LEFT | wxALL)
2968 .AddWindow(time);
2969 }
2970 else if (ctrl.type == NYQ_CTRL_FILE)
2971 {
2972 S.AddSpace(10, 10);
2973
2974 // Get default file extension if specified in wildcards
2975 FileExtension defaultExtension;
2976 if (!ctrl.fileTypes.empty()) {
2977 const auto &type = ctrl.fileTypes[0];
2978 if ( !type.extensions.empty() )
2979 defaultExtension = type.extensions[0];
2980 }
2981 resolveFilePath(ctrl.valStr, defaultExtension);
2982
2983 wxTextCtrl *item = S.Id(ID_Text+i)
2984 .Name( prompt )
2985 .AddTextBox( {}, wxT(""), 40);
2986 item->SetValidator(wxGenericValidator(&ctrl.valStr));
2987
2988 if (ctrl.label.empty())
2989 // We'd expect wxFileSelectorPromptStr to already be translated, but apparently not.
2990 ctrl.label = wxGetTranslation( wxFileSelectorPromptStr );
2991 S.Id(ID_FILE + i).AddButton(
2992 Verbatim(ctrl.label), wxALIGN_LEFT);
2993 }
2994 else
2995 {
2996 // Integer or Real
2997 if (ctrl.type == NYQ_CTRL_INT_TEXT || ctrl.type == NYQ_CTRL_FLOAT_TEXT)
2998 {
2999 S.AddSpace(10, 10);
3000 }
3001
3002 S.Id(ID_Text+i);
3003 if (ctrl.type == NYQ_CTRL_FLOAT || ctrl.type == NYQ_CTRL_FLOAT_TEXT)
3004 {
3005 double range = ctrl.high - ctrl.low;
3006 S.Validator<FloatingPointValidator<double>>(
3007 // > 12 decimal places can cause rounding errors in display.
3008 12, &ctrl.val,
3009 // Set number of decimal places
3010 (range < 10
3011 ? NumValidatorStyle::THREE_TRAILING_ZEROES
3012 : range < 100
3013 ? NumValidatorStyle::TWO_TRAILING_ZEROES
3014 : NumValidatorStyle::ONE_TRAILING_ZERO),
3015 ctrl.low, ctrl.high
3016 );
3017 }
3018 else
3019 {
3020 S.Validator<IntegerValidator<double>>(
3021 &ctrl.val, NumValidatorStyle::DEFAULT,
3022 (int) ctrl.low, (int) ctrl.high);
3023 }
3024 wxTextCtrl *item = S
3025 .Name( prompt )
3026 .AddTextBox( {}, wxT(""),
3027 (ctrl.type == NYQ_CTRL_INT_TEXT ||
3028 ctrl.type == NYQ_CTRL_FLOAT_TEXT) ? 25 : 12);
3029
3030 if (ctrl.type == NYQ_CTRL_INT || ctrl.type == NYQ_CTRL_FLOAT)
3031 {
3032 S.Id(ID_Slider + i)
3033 .Style(wxSL_HORIZONTAL)
3034 .MinSize( { 150, -1 } )
3035 .AddSlider( {}, 0, ctrl.ticks, 0);
3036 }
3037 }
3038
3039 if (ctrl.type != NYQ_CTRL_FILE)
3040 {
3041 if (ctrl.type == NYQ_CTRL_CHOICE || ctrl.label.empty())
3042 {
3043 S.AddSpace(10, 10);
3044 }
3045 else
3046 {
3047 S.AddUnits( Verbatim( ctrl.label ) );
3048 }
3049 }
3050 }
3051 }
3052 }
3053 S.EndMultiColumn();
3054 }
3055 S.EndScroller();
3056
3057 scroller->SetScrollRate(0, 20);
3058
3059 // This fools NVDA into not saying "Panel" when the dialog gets focus
3060 scroller->SetName(wxT("\a"));
3061 scroller->SetLabel(wxT("\a"));
3062}
wxT("CloseDown"))
wxString FileExtension
File extension, not including any leading dot.
Definition: Identifier.h:224
#define XXO(s)
Definition: Internat.h:44
#define safenew
Definition: MemoryX.h:10
@ ID_FILE
Definition: Nyquist.cpp:110
@ ID_Choice
Definition: Nyquist.cpp:108
@ ID_Slider
Definition: Nyquist.cpp:106
ID_Text
Definition: Nyquist.cpp:133
NyquistEffect::OnText ID_Time
Definition: Nyquist.cpp:137
@ NYQ_CTRL_STRING
Definition: Nyquist.h:32
@ NYQ_CTRL_TEXT
Definition: Nyquist.h:36
@ NYQ_CTRL_TIME
Definition: Nyquist.h:37
@ NYQ_CTRL_INT_TEXT
Definition: Nyquist.h:34
@ NYQ_CTRL_INT
Definition: Nyquist.h:30
@ NYQ_CTRL_CHOICE
Definition: Nyquist.h:33
@ NYQ_CTRL_FLOAT_TEXT
Definition: Nyquist.h:35
@ NYQ_CTRL_FILE
Definition: Nyquist.h:38
@ NYQ_CTRL_FLOAT
Definition: Nyquist.h:31
TranslatableStrings Msgids(const EnumValueSymbol strings[], size_t nStrings)
Convenience function often useful when adding choice controls.
#define S(N)
Definition: ToChars.cpp:64
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
double mProjectRate
Definition: EffectBase.h:101
virtual NumericFormatSymbol GetSelectionFormat()
Definition: Effect.cpp:453
A control on a NyquistDialog.
Definition: Nyquist.h:42
double high
Definition: Nyquist.h:61
wxString label
Definition: Nyquist.h:53
wxString name
Definition: Nyquist.h:52
int ticks
Definition: Nyquist.h:62
std::vector< EnumValueSymbol > choices
Definition: Nyquist.h:54
int type
Definition: Nyquist.h:50
wxString valStr
Definition: Nyquist.h:56
double low
Definition: Nyquist.h:60
double val
Definition: Nyquist.h:59
FileNames::FileTypes fileTypes
Definition: Nyquist.h:55
std::vector< NyqControl > mControls
Definition: Nyquist.h:278
static void resolveFilePath(wxString &path, FileExtension extension={})
Definition: Nyquist.cpp:3306
Options & MenuEnabled(bool enable)
Options & AutoPos(bool enable)
Options & ReadOnly(bool enable)

References NumericTextCtrl::Options::AutoPos(), NyqControl::choices, NyqControl::fileTypes, Effect::GetSelectionFormat(), NyqControl::high, ID_Choice, ID_FILE, ID_Slider, ID_Text, ID_Time, NyqControl::label, NyqControl::low, mControls, NumericTextCtrl::Options::MenuEnabled(), EffectBase::mProjectRate, Msgids(), NyqControl::name, NYQ_CTRL_CHOICE, NYQ_CTRL_FILE, NYQ_CTRL_FLOAT, NYQ_CTRL_FLOAT_TEXT, NYQ_CTRL_INT, NYQ_CTRL_INT_TEXT, NYQ_CTRL_STRING, NYQ_CTRL_TEXT, NYQ_CTRL_TIME, NumericTextCtrl::Options::ReadOnly(), resolveFilePath(), S, safenew, NyqControl::ticks, NumericConverter::TIME, NyqControl::type, NyqControl::val, NyqControl::valStr, Verbatim(), wxT(), and XXO.

Referenced by PopulateOrExchange().

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

◆ BuildPromptWindow()

void NyquistEffect::BuildPromptWindow ( ShuttleGui S)
private

Definition at line 2874 of file Nyquist.cpp.

2875{
2876 S.StartVerticalLay();
2877 {
2878 S.StartMultiColumn(3, wxEXPAND);
2879 {
2880 S.SetStretchyCol(1);
2881
2882 S.AddVariableText(XO("Enter Nyquist Command: "));
2883
2884 S.AddSpace(1, 1);
2885 }
2886 S.EndMultiColumn();
2887
2888 S.StartHorizontalLay(wxEXPAND, 1);
2889 {
2890 mCommandText = S.Focus()
2891 .MinSize( { 500, 200 } )
2892 .AddTextWindow(wxT(""));
2893 }
2894 S.EndHorizontalLay();
2895
2896 S.StartHorizontalLay(wxALIGN_CENTER, 0);
2897 {
2898 S.Id(ID_Load).AddButton(XXO("&Load"));
2899 S.Id(ID_Save).AddButton(XXO("&Save"));
2900 }
2901 S.EndHorizontalLay();
2902 }
2903 S.EndVerticalLay();
2904}
#define XO(s)
Definition: Internat.h:31
@ ID_Load
Definition: Nyquist.cpp:103
@ ID_Save
Definition: Nyquist.cpp:104
wxTextCtrl * mCommandText
Definition: Nyquist.h:310

References ID_Load, ID_Save, mCommandText, S, wxT(), XO, and XXO.

Referenced by PopulateOrExchange().

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

◆ CheckHelpPage()

std::pair< bool, FilePath > NyquistEffect::CheckHelpPage ( ) const
private

Definition at line 255 of file Nyquist.cpp.

256{
258 wxString fileName;
259
260 for (size_t i = 0, cnt = paths.size(); i < cnt; i++) {
261 fileName = wxFileName(paths[i] + wxT("/") + mHelpFile).GetFullPath();
262 if (wxFileExists(fileName))
263 {
264 return { true, fileName };
265 }
266 }
267 return { false, wxEmptyString };
268}
wxString mHelpFile
Definition: Nyquist.h:262
static FilePaths GetNyquistSearchPath()
Definition: Nyquist.cpp:2655

References GetNyquistSearchPath(), mHelpFile, and wxT().

Referenced by ParseProgram().

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

◆ Continue()

void NyquistEffect::Continue ( )

Definition at line 1864 of file Nyquist.cpp.

1865{
1866 mCont = true;
1867}
bool mCont
Definition: Nyquist.h:232

References mCont.

◆ DoLoadSettings()

bool NyquistEffect::DoLoadSettings ( const CommandParameters parms,
EffectSettings settings 
)

Definition at line 432 of file Nyquist.cpp.

434{
435 // Due to a constness problem that happens when using the prompt, we need
436 // to be ready to switch the params to a local instance.
437 const CommandParameters* pParms = &parms;
438 CommandParameters localParms;
439
440 if (mIsPrompt)
441 {
442 parms.Read(KEY_Command, &mInputCmd, wxEmptyString);
443 parms.Read(KEY_Parameters, &mParameters, wxEmptyString);
444
445 if (!mInputCmd.empty())
446 {
448 }
449
450 if (!mParameters.empty())
451 {
452 pParms = &localParms;
453 localParms.SetParameters(mParameters);
454 }
455
456 if (!IsBatchProcessing())
457 {
459 }
460
463 mExternal = true;
464
465 if (!IsBatchProcessing())
466 {
467 return true;
468 }
469 }
470
471 // Constants to document what the true/false values mean.
472 const auto kTestOnly = true;
473 const auto kTestAndSet = false;
474
475 // badCount will encompass both actual bad values and missing values.
476 // We probably never actually have bad values when using the dialogs
477 // since the dialog validation will catch them.
478 int badCount;
479 // When batch processing, we just ignore missing/bad parameters.
480 // We'll end up using defaults in those cases.
481 if (!IsBatchProcessing()) {
482 badCount = SetLispVarsFromParameters(*pParms, kTestOnly);
483 if (badCount > 0)
484 return false;
485 }
486
487 badCount = SetLispVarsFromParameters(*pParms, kTestAndSet);
488 // We never do anything with badCount here.
489 // It might be non zero, for missing parameters, and we allow that,
490 // and don't distinguish that from an out-of-range value.
491 return true;
492}
@ EffectTypeTool
static const wxChar * KEY_Command
Definition: Nyquist.cpp:118
static const wxChar * KEY_Parameters
Definition: Nyquist.cpp:119
CommandParameters, derived from wxFileConfig, is essentially doing the same things as the SettingsVis...
bool SetParameters(const wxString &parms)
bool IsBatchProcessing() const override
Definition: Effect.cpp:559
EffectType mType
Definition: Nyquist.h:265
bool ParseCommand(const wxString &cmd)
Definition: Nyquist.cpp:2499
int SetLispVarsFromParameters(const CommandParameters &parms, bool bTestOnly)
Definition: Nyquist.cpp:498
wxString mInputCmd
Definition: Nyquist.h:248
bool mExternal
Definition: Nyquist.h:238
bool mIsTool
Definition: Nyquist.h:240
wxString mParameters
Definition: Nyquist.h:249
EffectType mPromptType
Definition: Nyquist.h:266
bool mIsPrompt
Definition: Nyquist.h:245

References EffectTypeTool, Effect::IsBatchProcessing(), KEY_Command, KEY_Parameters, mExternal, mInputCmd, mIsPrompt, mIsTool, mParameters, mPromptType, mType, ParseCommand(), SetLispVarsFromParameters(), and CommandParameters::SetParameters().

Referenced by LoadSettings().

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

◆ EnablesDebug()

bool NyquistEffect::EnablesDebug ( ) const
overridevirtual

Whether the effect dialog should have a Debug button; default, always false.

Reimplemented from EffectDefinitionInterface.

Definition at line 1148 of file Nyquist.cpp.

1149{
1150 return mDebugButton;
1151}
bool mDebugButton
Definition: Nyquist.h:269

References mDebugButton.

◆ EscapeString()

wxString NyquistEffect::EscapeString ( const wxString &  inStr)
private

Definition at line 1737 of file Nyquist.cpp.

1738{
1739 wxString str = inStr;
1740
1741 str.Replace(wxT("\\"), wxT("\\\\"));
1742 str.Replace(wxT("\""), wxT("\\\""));
1743
1744 return str;
1745}
#define str(a)

References str, and wxT().

Referenced by Process(), and ProcessOne().

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

◆ GetCallback()

int NyquistEffect::GetCallback ( float *  buffer,
int  channel,
int64_t  start,
int64_t  len,
int64_t  totlen 
)
private

Definition at line 2514 of file Nyquist.cpp.

2516{
2517 if (mCurBuffer[ch]) {
2518 if ((mCurStart[ch] + start) < mCurBufferStart[ch] ||
2519 (mCurStart[ch] + start)+len >
2521 mCurBuffer[ch].reset();
2522 }
2523 }
2524
2525 if (!mCurBuffer[ch]) {
2526 mCurBufferStart[ch] = (mCurStart[ch] + start);
2528
2529 if (mCurBufferLen[ch] < (size_t) len) {
2531 }
2532
2533 mCurBufferLen[ch] =
2535 mCurStart[ch] + mCurLen - mCurBufferStart[ch] );
2536
2537 // C++20
2538 // mCurBuffer[ch] = std::make_unique_for_overwrite(mCurBufferLen[ch]);
2539 mCurBuffer[ch] = Buffer{ safenew float[ mCurBufferLen[ch] ] };
2540 try {
2541 mCurTrack[ch]->GetFloats( mCurBuffer[ch].get(),
2543 }
2544 catch ( ... ) {
2545 // Save the exception object for re-throw when out of the library
2546 mpException = std::current_exception();
2547 return -1;
2548 }
2549 }
2550
2551 // We have guaranteed above that this is nonnegative and bounded by
2552 // mCurBufferLen[ch]:
2553 auto offset = ( mCurStart[ch] + start - mCurBufferStart[ch] ).as_size_t();
2554 const void *src = &mCurBuffer[ch][offset];
2555 std::memcpy(buffer, src, len * sizeof(float));
2556
2557 if (ch == 0) {
2558 double progress = mScale *
2559 ( (start+len)/ mCurLen.as_double() );
2560
2561 if (progress > mProgressIn) {
2562 mProgressIn = progress;
2563 }
2564
2566 return -1;
2567 }
2568 }
2569
2570 return 0;
2571}
size_t limitSampleBufferSize(size_t bufferSize, sampleCount limit)
Definition: SampleCount.cpp:22
bool TotalProgress(double frac, const TranslatableString &={}) const
Definition: Effect.cpp:675
Buffer mCurBuffer[2]
Definition: Nyquist.h:296
double mProgressOut
Definition: Nyquist.h:291
std::exception_ptr mpException
Definition: Nyquist.h:312
double mScale
Definition: Nyquist.h:293
size_t mCurBufferLen[2]
Definition: Nyquist.h:298
double mProgressIn
Definition: Nyquist.h:290
std::unique_ptr< float[]> Buffer
Definition: Nyquist.h:295
WaveTrack * mCurTrack[2]
Definition: Nyquist.h:281
sampleCount mCurStart[2]
Definition: Nyquist.h:282
sampleCount mCurLen
Definition: Nyquist.h:283
double mProgressTot
Definition: Nyquist.h:292
sampleCount mCurBufferStart[2]
Definition: Nyquist.h:297
bool GetFloats(float *buffer, sampleCount start, size_t len, fillFormat fill=fillZero, bool mayThrow=true, sampleCount *pNumWithinClips=nullptr) const
Retrieve samples from a track in floating-point format, regardless of the storage format.
Definition: SampleTrack.h:67
size_t GetBestBlockSize(sampleCount t) const override
This returns a nonnegative number of samples meant to size a memory buffer.
Definition: WaveTrack.cpp:1798
size_t GetIdealBlockSize()
Definition: WaveTrack.cpp:1836
double as_double() const
Definition: SampleCount.h:46

References sampleCount::as_double(), WaveTrack::GetBestBlockSize(), SampleTrack::GetFloats(), WaveTrack::GetIdealBlockSize(), limitSampleBufferSize(), mCurBuffer, mCurBufferLen, mCurBufferStart, mCurLen, mCurStart, mCurTrack, mpException, mProgressIn, mProgressOut, mProgressTot, mScale, safenew, and Effect::TotalProgress().

Referenced by StaticGetCallback().

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

◆ GetClassification()

EffectType NyquistEffect::GetClassification ( ) const
overridevirtual

Determines which menu it appears in; default same as GetType().

Reimplemented from EffectDefinitionInterface.

Definition at line 283 of file Nyquist.cpp.

284{
285 if (mIsTool)
286 return EffectTypeTool;
287 return mType;
288}

References EffectTypeTool, mIsTool, and mType.

◆ GetCtrlValue()

double NyquistEffect::GetCtrlValue ( const wxString &  s)
staticprivate

Definition at line 1921 of file Nyquist.cpp.

1922{
1923 /* For this to work correctly requires that the plug-in header is
1924 * parsed on each run so that the correct value for "half-srate" may
1925 * be determined.
1926 *
1927 auto project = FindProject();
1928 if (project && s.IsSameAs(wxT("half-srate"), false)) {
1929 auto rate =
1930 TrackList::Get( *project ).Selected< const WaveTrack >()
1931 .min( &WaveTrack::GetRate );
1932 return (rate / 2.0);
1933 }
1934 */
1935
1937}
static bool CompatibleToDouble(const wxString &stringToConvert, double *result)
Convert a string to a number.
Definition: Internat.cpp:134

References Internat::CompatibleToDouble().

Referenced by Parse(), SaveSettings(), SetLispVarsFromParameters(), TransferDataFromEffectWindow(), and VisitSettings().

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

◆ GetDescription()

TranslatableString NyquistEffect::GetDescription ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 242 of file Nyquist.cpp.

243{
244 return mCopyright;
245}
TranslatableString mCopyright
Definition: Nyquist.h:260

References mCopyright.

◆ GetFamily()

EffectFamilySymbol NyquistEffect::GetFamily ( ) const
overridevirtual

Report identifier and user-visible name of the effect protocol.

Reimplemented from Effect.

Definition at line 290 of file Nyquist.cpp.

291{
293}
#define NYQUISTEFFECTS_FAMILY
Definition: EffectBase.h:146

References NYQUISTEFFECTS_FAMILY.

◆ GetNyquistSearchPath()

FilePaths NyquistEffect::GetNyquistSearchPath ( )
staticprivate

Definition at line 2655 of file Nyquist.cpp.

2656{
2657 const auto &audacityPathList = FileNames::AudacityPathList();
2658 FilePaths pathList;
2659
2660 for (size_t i = 0; i < audacityPathList.size(); i++)
2661 {
2662 wxString prefix = audacityPathList[i] + wxFILE_SEP_PATH;
2663 FileNames::AddUniquePathToPathList(prefix + wxT("nyquist"), pathList);
2664 FileNames::AddUniquePathToPathList(prefix + wxT("plugins"), pathList);
2665 FileNames::AddUniquePathToPathList(prefix + wxT("plug-ins"), pathList);
2666 }
2667 pathList.push_back(FileNames::PlugInDir());
2668
2669 return pathList;
2670}
Extend wxArrayString with move operations and construction and insertion fromstd::initializer_list.
FILES_API FilePath PlugInDir()
The user plug-in directory (not a system one)
FILES_API void AddUniquePathToPathList(const FilePath &path, FilePaths &pathList)
FILES_API const FilePaths & AudacityPathList()
A list of directories that should be searched for Audacity files (plug-ins, help files,...

References FileNames::AddUniquePathToPathList(), FileNames::AudacityPathList(), FileNames::PlugInDir(), and wxT().

Referenced by NyquistEffectsModule::AutoRegisterPlugins(), CheckHelpPage(), NyquistEffectsModule::FindModulePaths(), and Process().

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

◆ GetPath()

PluginPath NyquistEffect::GetPath ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 209 of file Nyquist.cpp.

210{
211 if (mIsPrompt)
212 return NYQUIST_PROMPT_ID;
213
214 return mFileName.GetFullPath();
215}
#define NYQUIST_PROMPT_ID
wxFileName mFileName
Name of the Nyquist script file this effect is loaded from.
Definition: Nyquist.h:227

References mFileName, mIsPrompt, and NYQUIST_PROMPT_ID.

◆ GetSymbol()

ComponentInterfaceSymbol NyquistEffect::GetSymbol ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 217 of file Nyquist.cpp.

218{
219 if (mIsPrompt)
221
222 return mName;
223}
#define NYQUIST_PROMPT_NAME
TranslatableString mName
Name of the Effect (untranslated)
Definition: Nyquist.h:251

References mIsPrompt, mName, NYQUIST_PROMPT_ID, and NYQUIST_PROMPT_NAME.

◆ GetType()

EffectType NyquistEffect::GetType ( ) const
overridevirtual

Type determines how it behaves.

Reimplemented from Effect.

Definition at line 278 of file Nyquist.cpp.

279{
280 return mType;
281}

References mType.

Referenced by Process(), and ProcessOne().

Here is the caller graph for this function:

◆ GetVendor()

VendorSymbol NyquistEffect::GetVendor ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 225 of file Nyquist.cpp.

226{
227 if (mIsPrompt)
228 {
229 return XO("Audacity");
230 }
231
232 return mAuthor;
233}
TranslatableString mAuthor
Definition: Nyquist.h:255

References mAuthor, mIsPrompt, and XO.

◆ GetVersion()

wxString NyquistEffect::GetVersion ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 235 of file Nyquist.cpp.

236{
237 // Are Nyquist version strings really supposed to be translatable?
238 // See commit a06e561 which used XO for at least one of them
240}
TranslatableString mReleaseVersion
Definition: Nyquist.h:259
wxString Translation() const

References mReleaseVersion, and TranslatableString::Translation().

Here is the call graph for this function:

◆ HelpPage()

FilePath NyquistEffect::HelpPage ( ) const
overridevirtual

Fully qualified local help file name, default is empty.

Reimplemented from EffectDefinitionInterface.

Definition at line 271 of file Nyquist.cpp.

272{
273 return mHelpPage;
274}
FilePath mHelpPage
Definition: Nyquist.h:264

References mHelpPage.

◆ Init()

bool NyquistEffect::Init ( )
overridevirtual

Call once to set up state for whole list of tracks to be processed.

Returns
success Default implementation does nothing, returns true Default implementation does nothing, returns true

Reimplemented from StatefulEffectBase.

Definition at line 567 of file Nyquist.cpp.

568{
569 // When Nyquist Prompt spawns an effect GUI, Init() is called for Nyquist Prompt,
570 // and then again for the spawned (mExternal) effect.
571
572 // EffectType may not be defined in script, so
573 // reset each time we call the Nyquist Prompt.
574 if (mIsPrompt) {
576 // Reset effect type each time we call the Nyquist Prompt.
578 mIsSpectral = false;
579 mDebugButton = true; // Debug button always enabled for Nyquist Prompt.
580 mEnablePreview = true; // Preview button always enabled for Nyquist Prompt.
581 mVersion = 4;
582 }
583
584 // As of Audacity 2.1.2 rc1, 'spectral' effects are allowed only if
585 // the selected track(s) are in a spectrogram view, and there is at
586 // least one frequency bound and Spectral Selection is enabled for the
587 // selected track(s) - (but don't apply to Nyquist Prompt).
588
589 if (!mIsPrompt && mIsSpectral) {
590 // Completely skip the spectral editing limitations if there is no
591 // project because that is editing of macro parameters
592 if (const auto project = FindProject()) {
593 bool bAllowSpectralEditing = false;
594 bool hasSpectral = false;
595 for ( auto t :
596 TrackList::Get( *project ).Selected< const WaveTrack >() ) {
597 // Find() not Get() to avoid creation-on-demand of views in case we are
598 // only previewing
599 auto pView = WaveTrackView::Find( t );
600 if ( pView ) {
601 const auto displays = pView->GetDisplays();
602 if (displays.end() != std::find(
603 displays.begin(), displays.end(),
604 WaveTrackSubView::Type{ WaveTrackViewConstants::Spectrum, {} }))
605 hasSpectral = true;
606 }
607 if ( hasSpectral &&
608 (t->GetSpectrogramSettings().SpectralSelectionEnabled())) {
609 bAllowSpectralEditing = true;
610 break;
611 }
612 }
613
614 if (!bAllowSpectralEditing || ((mF0 < 0.0) && (mF1 < 0.0))) {
615 if (!hasSpectral) {
617 XO("Enable track spectrogram view before\n"
618 "applying 'Spectral' effects."),
619 wxOK | wxICON_EXCLAMATION | wxCENTRE,
620 XO("Error") );
621 } else {
623 XO("To use 'Spectral effects', enable 'Spectral Selection'\n"
624 "in the track Spectrogram settings and select the\n"
625 "frequency range for the effect to act on."),
626 wxOK | wxICON_EXCLAMATION | wxCENTRE,
627 XO("Error") );
628 }
629 return false;
630 }
631 }
632 }
633
634 if (!mIsPrompt && !mExternal)
635 {
636 //TODO: (bugs):
637 // 1) If there is more than one plug-in with the same name, GetModificationTime may pick the wrong one.
638 // 2) If the ;type is changed after the effect has been registered, the plug-in will appear in the wrong menu.
639
640 //TODO: If we want to auto-add parameters from spectral selection,
641 //we will need to modify this test.
642 //Note that removing it stops the caching of parameter values,
643 //(during this session).
644 if (mFileName.GetModificationTime().IsLaterThan(mFileModified))
645 {
646 // If the effect has internal state, save and restore it.
647 // If the effect is stateless, saving and restoring don't matter.
648 auto dummySettings = MakeSettings();
649 constexpr auto key = L"TemporarySettings";
650 SaveUserPreset(key, dummySettings);
651
653 ParseFile();
654 mFileModified = mFileName.GetModificationTime();
655
656 // Ignore failure
657 (void) LoadUserPreset(key, dummySettings);
658 }
659 }
660
661 return true;
662}
static const AudacityProject::AttachedObjects::RegisteredFactory key
#define NYQ_MAX_LEN
Definition: Nyquist.cpp:114
const AudacityProject * FindProject() const
Definition: EffectBase.cpp:319
bool SaveUserPreset(const RegistryPath &name, const EffectSettings &settings) const override
Save settings in the configuration file as a user-named preset.
Definition: Effect.cpp:251
int MessageBox(const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={}) const
Definition: Effect.cpp:863
OptionalMessage LoadUserPreset(const RegistryPath &name, EffectSettings &settings) const override
Definition: Effect.cpp:238
EffectSettings MakeSettings() const override
Definition: Effect.h:323
bool mIsSpectral
Definition: Nyquist.h:239
bool mEnablePreview
Definition: Nyquist.h:268
int mVersion
Definition: Nyquist.h:277
TranslatableString mPromptName
Definition: Nyquist.h:252
wxDateTime mFileModified
When the script was last modified on disk.
Definition: Nyquist.h:228
sampleCount mMaxLen
Definition: Nyquist.h:284
void ParseFile()
Definition: Nyquist.cpp:2491
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:486
auto Selected() -> TrackIterRange< TrackType >
Definition: Track.h:1454
A Track that contains audio waveform data.
Definition: WaveTrack.h:57
static WaveTrackView * Find(WaveTrack *pTrack)

References WaveTrackView::Find(), EffectBase::FindProject(), TrackList::Get(), mDebugButton, mEnablePreview, Effect::MessageBox(), mIsPrompt, mIsSpectral, mName, mPromptName, mPromptType, mType, mVersion, TrackList::Selected(), and XO.

Here is the call graph for this function:

◆ InitializationError()

const TranslatableString & NyquistEffect::InitializationError ( ) const
inlineprivate

Definition at line 157 of file Nyquist.h.

157{ return mInitError; }
TranslatableString mInitError
Definition: Nyquist.h:247

Referenced by NyquistEffectsModule::DiscoverPluginsAtPath().

Here is the caller graph for this function:

◆ IsDefault()

bool NyquistEffect::IsDefault ( ) const
overridevirtual

Whether the effect sorts "above the line" in the menus.

Reimplemented from Effect.

Definition at line 305 of file Nyquist.cpp.

306{
307 return mIsPrompt;
308}

References mIsPrompt.

◆ IsInteractive()

bool NyquistEffect::IsInteractive ( ) const
overridevirtual

Whether the effect needs a dialog for entry of settings.

Reimplemented from Effect.

Definition at line 295 of file Nyquist.cpp.

296{
297 if (mIsPrompt)
298 {
299 return true;
300 }
301
302 return mControls.size() != 0;
303}

References mControls, and mIsPrompt.

◆ IsOk()

bool NyquistEffect::IsOk ( )
private

Definition at line 3066 of file Nyquist.cpp.

3067{
3068 return mOK;
3069}

References mOK.

Referenced by NyquistEffectsModule::DiscoverPluginsAtPath().

Here is the caller graph for this function:

◆ LoadSettings()

bool NyquistEffect::LoadSettings ( const CommandParameters parms,
EffectSettings settings 
) const
overridevirtual

Restore settings from keys and values.

Returns
true on success

Reimplemented from Effect.

Definition at line 425 of file Nyquist.cpp.

427{
428 // To do: externalize state so const_cast isn't needed
429 return const_cast<NyquistEffect*>(this)->DoLoadSettings(parms, settings);
430}
static Settings & settings()
Definition: TrackInfo.cpp:87
An Effect that calls up a Nyquist (XLISP) plug-in, i.e. many possible effects from this one class.
Definition: Nyquist.h:76
bool DoLoadSettings(const CommandParameters &parms, EffectSettings &settings)
Definition: Nyquist.cpp:432

References DoLoadSettings(), and settings().

Referenced by ShowHostInterface(), and VisitSettings().

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

◆ ManualPage()

ManualPageID NyquistEffect::ManualPage ( ) const
overridevirtual

Name of a page in the Audacity alpha manual, default is empty.

Reimplemented from EffectDefinitionInterface.

Definition at line 247 of file Nyquist.cpp.

248{
249 return mIsPrompt
250 ? wxString("Nyquist_Prompt")
251 : mManPage;
252}
wxString mManPage
Definition: Nyquist.h:261

References mIsPrompt, and mManPage.

◆ NyquistToWxString()

wxString NyquistEffect::NyquistToWxString ( const char *  nyqString)
staticprivate

Definition at line 1724 of file Nyquist.cpp.

1725{
1726 wxString str(nyqString, wxConvUTF8);
1727 if (nyqString != NULL && nyqString[0] && str.empty()) {
1728 // invalid UTF-8 string, convert as Latin-1
1729 str = _("[Warning: Nyquist returned invalid UTF-8 string, converted here as Latin-1]");
1730 // TODO: internationalization of strings from Nyquist effects, at least
1731 // from those shipped with Audacity
1732 str += LAT1CTOWX(nyqString);
1733 }
1734 return str;
1735}
#define LAT1CTOWX(X)
Definition: Internat.h:160
#define _(s)
Definition: Internat.h:75

References _, LAT1CTOWX, and str.

Referenced by ProcessOne().

Here is the caller graph for this function:

◆ OnChoice()

void NyquistEffect::OnChoice ( wxCommandEvent &  evt)
private

Definition at line 3175 of file Nyquist.cpp.

3176{
3177 mControls[evt.GetId() - ID_Choice].val = (double) evt.GetInt();
3178}

References ID_Choice, and mControls.

◆ OnDebug()

void NyquistEffect::OnDebug ( wxCommandEvent &  evt)
private

◆ OnFileButton()

void NyquistEffect::OnFileButton ( wxCommandEvent &  evt)
private

Definition at line 3211 of file Nyquist.cpp.

3212{
3213 int i = evt.GetId() - ID_FILE;
3214 NyqControl & ctrl = mControls[i];
3215
3216 // Get style flags:
3217 // Ensure legal combinations so that wxWidgets does not throw an assert error.
3218 unsigned int flags = 0;
3219 if (!ctrl.highStr.empty())
3220 {
3221 wxStringTokenizer tokenizer(ctrl.highStr, ",");
3222 while ( tokenizer.HasMoreTokens() )
3223 {
3224 wxString token = tokenizer.GetNextToken().Trim(true).Trim(false);
3225 if (token.IsSameAs("open", false))
3226 {
3227 flags |= wxFD_OPEN;
3228 flags &= ~wxFD_SAVE;
3229 flags &= ~wxFD_OVERWRITE_PROMPT;
3230 }
3231 else if (token.IsSameAs("save", false))
3232 {
3233 flags |= wxFD_SAVE;
3234 flags &= ~wxFD_OPEN;
3235 flags &= ~wxFD_MULTIPLE;
3236 flags &= ~wxFD_FILE_MUST_EXIST;
3237 }
3238 else if (token.IsSameAs("overwrite", false) && !(flags & wxFD_OPEN))
3239 {
3240 flags |= wxFD_OVERWRITE_PROMPT;
3241 }
3242 else if (token.IsSameAs("exists", false) && !(flags & wxFD_SAVE))
3243 {
3244 flags |= wxFD_FILE_MUST_EXIST;
3245 }
3246 else if (token.IsSameAs("multiple", false) && !(flags & wxFD_SAVE))
3247 {
3248 flags |= wxFD_MULTIPLE;
3249 }
3250 }
3251 }
3252
3253 resolveFilePath(ctrl.valStr);
3254
3255 wxFileName fname = ctrl.valStr;
3256 wxString defaultDir = fname.GetPath();
3257 wxString defaultFile = fname.GetName();
3258 auto message = XO("Select a file");
3259
3260 if (flags & wxFD_MULTIPLE)
3261 message = XO("Select one or more files");
3262 else if (flags & wxFD_SAVE)
3263 message = XO("Save file as");
3264
3265 FileDialogWrapper openFileDialog(mUIParent->FindWindow(ID_FILE + i),
3266 message,
3267 defaultDir,
3268 defaultFile,
3269 ctrl.fileTypes,
3270 flags); // styles
3271
3272 if (openFileDialog.ShowModal() == wxID_CANCEL)
3273 {
3274 return;
3275 }
3276
3277 wxString path;
3278 // When multiple files selected, return file paths as a list of quoted strings.
3279 if (flags & wxFD_MULTIPLE)
3280 {
3281 wxArrayString selectedFiles;
3282 openFileDialog.GetPaths(selectedFiles);
3283
3284 for (size_t sf = 0; sf < selectedFiles.size(); sf++) {
3285 path += "\"";
3286 path += selectedFiles[sf];
3287 path += "\"";
3288 }
3289 ctrl.valStr = path;
3290 }
3291 else
3292 {
3293 ctrl.valStr = openFileDialog.GetPath();
3294 }
3295
3296 mUIParent->FindWindow(ID_Text + i)->GetValidator()->TransferToWindow();
3297}
wxWindow * mUIParent
Definition: Effect.h:307
wxString highStr
Definition: Nyquist.h:58

References NyqControl::fileTypes, FileDialog::GetPath(), FileDialog::GetPaths(), NyqControl::highStr, ID_FILE, ID_Text, mControls, Effect::mUIParent, resolveFilePath(), FileDialog::ShowModal(), NyqControl::valStr, and XO.

Here is the call graph for this function:

◆ OnLoad()

void NyquistEffect::OnLoad ( wxCommandEvent &  evt)
private

Definition at line 3078 of file Nyquist.cpp.

3079{
3080 if (mCommandText->IsModified())
3081 {
3082 if (wxNO == Effect::MessageBox(
3083 XO("Current program has been modified.\nDiscard changes?"),
3084 wxYES_NO ) )
3085 {
3086 return;
3087 }
3088 }
3089
3090 FileDialogWrapper dlog(
3091 mUIParent,
3092 XO("Load Nyquist script"),
3093 mFileName.GetPath(),
3094 wxEmptyString,
3095 {
3096 NyquistScripts,
3097 LispScripts,
3098 FileNames::TextFiles,
3099 FileNames::AllFiles
3100 },
3101 wxFD_OPEN | wxRESIZE_BORDER);
3102
3103 if (dlog.ShowModal() != wxID_OK)
3104 {
3105 return;
3106 }
3107
3108 mFileName = dlog.GetPath();
3109
3110 if (!mCommandText->LoadFile(mFileName.GetFullPath()))
3111 {
3112 Effect::MessageBox( XO("File could not be loaded") );
3113 }
3114}

References FileDialog::GetPath(), mCommandText, Effect::MessageBox(), mFileName, Effect::mUIParent, FileDialog::ShowModal(), and XO.

Here is the call graph for this function:

◆ OnSave()

void NyquistEffect::OnSave ( wxCommandEvent &  evt)
private

Definition at line 3116 of file Nyquist.cpp.

3117{
3118 FileDialogWrapper dlog(
3119 mUIParent,
3120 XO("Save Nyquist script"),
3121 mFileName.GetPath(),
3122 mFileName.GetFullName(),
3123 {
3124 NyquistScripts,
3125 LispScripts,
3126 FileNames::AllFiles
3127 },
3128 wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER);
3129
3130 if (dlog.ShowModal() != wxID_OK)
3131 {
3132 return;
3133 }
3134
3135 mFileName = dlog.GetPath();
3136
3137 if (!mCommandText->SaveFile(mFileName.GetFullPath()))
3138 {
3139 Effect::MessageBox( XO("File could not be saved") );
3140 }
3141}

References FileDialog::GetPath(), mCommandText, Effect::MessageBox(), mFileName, Effect::mUIParent, FileDialog::ShowModal(), and XO.

Here is the call graph for this function:

◆ OnSlider()

void NyquistEffect::OnSlider ( wxCommandEvent &  evt)
private

Definition at line 3143 of file Nyquist.cpp.

3144{
3145 int i = evt.GetId() - ID_Slider;
3146 NyqControl & ctrl = mControls[i];
3147
3148 int val = evt.GetInt();
3149 double range = ctrl.high - ctrl.low;
3150 double newVal = (val / (double)ctrl.ticks) * range + ctrl.low;
3151
3152 // Determine precision for displayed number
3153 int precision = range < 1.0 ? 3 :
3154 range < 10.0 ? 2 :
3155 range < 100.0 ? 1 :
3156 0;
3157
3158 // If the value is at least one tick different from the current value
3159 // change it (this prevents changes from manually entered values unless
3160 // the slider actually moved)
3161 if (fabs(newVal - ctrl.val) >= (1 / (double)ctrl.ticks) * range &&
3162 fabs(newVal - ctrl.val) >= pow(0.1, precision) / 2)
3163 {
3164 // First round to the appropriate precision
3165 newVal *= pow(10.0, precision);
3166 newVal = floor(newVal + 0.5);
3167 newVal /= pow(10.0, precision);
3168
3169 ctrl.val = newVal;
3170
3171 mUIParent->FindWindow(ID_Text + i)->GetValidator()->TransferToWindow();
3172 }
3173}

References NyqControl::high, ID_Slider, ID_Text, NyqControl::low, mControls, Effect::mUIParent, NyqControl::ticks, and NyqControl::val.

◆ OnText()

void NyquistEffect::OnText ( wxCommandEvent &  evt)
private

Definition at line 3386 of file Nyquist.cpp.

3387{
3388 int i = evt.GetId() - ID_Text;
3389
3390 NyqControl & ctrl = mControls[i];
3391
3392 if (wxDynamicCast(evt.GetEventObject(), wxWindow)->GetValidator()->TransferFromWindow())
3393 {
3394 if (ctrl.type == NYQ_CTRL_FLOAT || ctrl.type == NYQ_CTRL_INT)
3395 {
3396 int pos = (int)floor((ctrl.val - ctrl.low) /
3397 (ctrl.high - ctrl.low) * ctrl.ticks + 0.5);
3398
3399 wxSlider *slider = (wxSlider *)mUIParent->FindWindow(ID_Slider + i);
3400 slider->SetValue(pos);
3401 }
3402 }
3403}

References NyqControl::high, ID_Slider, ID_Text, NyqControl::low, mControls, Effect::mUIParent, NYQ_CTRL_FLOAT, NYQ_CTRL_INT, NyqControl::ticks, NyqControl::type, and NyqControl::val.

◆ OnTime()

void NyquistEffect::OnTime ( wxCommandEvent &  evt)
private

Definition at line 3180 of file Nyquist.cpp.

3181{
3182 int i = evt.GetId() - ID_Time;
3183 static double value = 0.0;
3184 NyqControl & ctrl = mControls[i];
3185
3186 NumericTextCtrl *n = (NumericTextCtrl *) mUIParent->FindWindow(ID_Time + i);
3187 double val = n->GetValue();
3188
3189 // Observed that two events transmitted on each control change (Linux)
3190 // so skip if value has not changed.
3191 if (val != value) {
3192 if (val < ctrl.low || val > ctrl.high) {
3193 const auto message = XO("Value range:\n%s to %s")
3194 .Format( ToTimeFormat(ctrl.low), ToTimeFormat(ctrl.high) );
3196 message,
3197 wxOK | wxCENTRE,
3198 XO("Value Error") );
3199 }
3200
3201 if (val < ctrl.low)
3202 val = ctrl.low;
3203 else if (val > ctrl.high)
3204 val = ctrl.high;
3205
3206 n->SetValue(val);
3207 value = val;
3208 }
3209}
void SetValue(double newValue)
wxString ToTimeFormat(double t)
Definition: Nyquist.cpp:3376

References NumericConverter::GetValue(), NyqControl::high, ID_Time, NyqControl::low, mControls, Effect::MessageBox(), Effect::mUIParent, NumericTextCtrl::SetValue(), ToTimeFormat(), and XO.

Here is the call graph for this function:

◆ OSCallback()

void NyquistEffect::OSCallback ( )
private

Definition at line 2625 of file Nyquist.cpp.

2626{
2627 if (mStop) {
2628 mStop = false;
2629 nyx_stop();
2630 }
2631 else if (mBreak) {
2632 mBreak = false;
2633 nyx_break();
2634 }
2635 else if (mCont) {
2636 mCont = false;
2637 nyx_continue();
2638 }
2639
2640 // LLL: STF figured out that yielding while the effect is being applied
2641 // produces an EXTREME slowdown. It appears that yielding is not
2642 // really necessary on Linux and Windows.
2643 //
2644 // However, on the Mac, the spinning cursor appears during longer
2645 // Nyquist processing and that may cause the user to think Audacity
2646 // has crashed or hung. In addition, yielding or not on the Mac
2647 // doesn't seem to make much of a difference in execution time.
2648 //
2649 // So, yielding on the Mac only...
2650#if defined(__WXMAC__)
2651 wxYieldIfNeeded();
2652#endif
2653}
bool mStop
Definition: Nyquist.h:230

References mBreak, mCont, and mStop.

◆ OutputCallback()

void NyquistEffect::OutputCallback ( int  c)
private

Definition at line 2609 of file Nyquist.cpp.

2610{
2611 // Always collect Nyquist error messages for normal plug-ins
2612 if (!mRedirectOutput) {
2613 mDebugOutputStr += (wxChar)c;
2614 return;
2615 }
2616
2617 std::cout << (char)c;
2618}
bool mRedirectOutput
Definition: Nyquist.h:272
wxString mDebugOutputStr
Definition: Nyquist.h:274

References mDebugOutputStr, and mRedirectOutput.

◆ Parse()

bool NyquistEffect::Parse ( Tokenizer tokenizer,
const wxString &  line,
bool  eof,
bool  first 
)
private

Definition at line 2038 of file Nyquist.cpp.

2040{
2041 if ( !tzer.Tokenize(line, eof, first ? 1 : 0, 0) )
2042 return false;
2043
2044 const auto &tokens = tzer.tokens;
2045 int len = tokens.size();
2046 if (len < 1) {
2047 return true;
2048 }
2049
2050 // Consistency decision is for "plug-in" as the correct spelling
2051 // "plugin" (deprecated) is allowed as an undocumented convenience.
2052 if (len == 2 && tokens[0] == wxT("nyquist") &&
2053 (tokens[1] == wxT("plug-in") || tokens[1] == wxT("plugin"))) {
2054 mOK = true;
2055 return true;
2056 }
2057
2058 if (len >= 2 && tokens[0] == wxT("type")) {
2059 wxString tok = tokens[1];
2060 mIsTool = false;
2061 if (tok == wxT("tool")) {
2062 mIsTool = true;
2064 // we allow
2065 // ;type tool
2066 // ;type tool process
2067 // ;type tool generate
2068 // ;type tool analyze
2069 // The last three are placed in the tool menu, but are processed as
2070 // process, generate or analyze.
2071 if (len >= 3)
2072 tok = tokens[2];
2073 }
2074
2075 if (tok == wxT("process")) {
2077 }
2078 else if (tok == wxT("generate")) {
2080 }
2081 else if (tok == wxT("analyze")) {
2083 }
2084
2085 if (len >= 3 && tokens[2] == wxT("spectral")) {;
2086 mIsSpectral = true;
2087 }
2088 return true;
2089 }
2090
2091 if (len == 2 && tokens[0] == wxT("codetype")) {
2092 // This will stop ParseProgram() from doing a best guess as program type.
2093 if (tokens[1] == wxT("lisp")) {
2094 mIsSal = false;
2095 mFoundType = true;
2096 }
2097 else if (tokens[1] == wxT("sal")) {
2098 mIsSal = true;
2099 mFoundType = true;
2100 }
2101 return true;
2102 }
2103
2104 if (len >= 2 && tokens[0] == wxT("debugflags")) {
2105 for (int i = 1; i < len; i++) {
2106 // "trace" sets *tracenable* (LISP) or *sal-traceback* (SAL)
2107 // and displays debug window IF there is anything to show.
2108 if (tokens[i] == wxT("trace")) {
2109 mTrace = true;
2110 }
2111 else if (tokens[i] == wxT("notrace")) {
2112 mTrace = false;
2113 }
2114 else if (tokens[i] == wxT("compiler")) {
2115 mCompiler = true;
2116 }
2117 else if (tokens[i] == wxT("nocompiler")) {
2118 mCompiler = false;
2119 }
2120 }
2121 return true;
2122 }
2123
2124 // We support versions 1, 2 and 3
2125 // (Version 2 added support for string parameters.)
2126 // (Version 3 added support for choice parameters.)
2127 // (Version 4 added support for project/track/selection information.)
2128 if (len >= 2 && tokens[0] == wxT("version")) {
2129 long v;
2130 tokens[1].ToLong(&v);
2131 if (v < 1 || v > 4) {
2132 // This is an unsupported plug-in version
2133 mOK = false;
2134 mInitError = XO(
2135"This version of Audacity does not support Nyquist plug-in version %ld")
2136 .Format( v );
2137 return true;
2138 }
2139 mVersion = (int) v;
2140 }
2141
2142 if (len >= 2 && tokens[0] == wxT("name")) {
2143 // Names do not yet support context strings for translations, or
2144 // internal names distinct from visible English names.
2145 // (See also comments in NyquistEffectsModule::AutoRegisterPlugins)
2146 auto name = UnQuote(tokens[1]);
2147 // Strip ... from name if it's present, perhaps in third party plug-ins
2148 // Menu system puts ... back if there are any controls
2149 // This redundant naming convention must NOT be followed for
2150 // shipped Nyquist effects with internationalization. Else the msgid
2151 // later looked up will lack the ... and will not be found.
2152 if (name.EndsWith(wxT("...")))
2153 name = name.RemoveLast(3);
2154 mName = TranslatableString{ name, {} };
2155 return true;
2156 }
2157
2158 if (len >= 2 && tokens[0] == wxT("action")) {
2159 mAction = TranslatableString{ UnQuote(tokens[1]), {} };
2160 return true;
2161 }
2162
2163 if (len >= 2 && tokens[0] == wxT("info")) {
2164 mInfo = TranslatableString{ UnQuote(tokens[1]), {} };
2165 return true;
2166 }
2167
2168 if (len >= 2 && tokens[0] == wxT("preview")) {
2169 if (tokens[1] == wxT("enabled") || tokens[1] == wxT("true")) {
2170 mEnablePreview = true;
2171 SetLinearEffectFlag(false);
2172 }
2173 else if (tokens[1] == wxT("linear")) {
2174 mEnablePreview = true;
2175 SetLinearEffectFlag(true);
2176 }
2177 else if (tokens[1] == wxT("selection")) {
2178 mEnablePreview = true;
2180 }
2181 else if (tokens[1] == wxT("disabled") || tokens[1] == wxT("false")) {
2182 mEnablePreview = false;
2183 }
2184 return true;
2185 }
2186
2187 // Maximum number of samples to be processed. This can help the
2188 // progress bar if effect does not process all of selection.
2189 if (len >= 2 && tokens[0] == wxT("maxlen")) {
2190 long long v; // Note that Nyquist may overflow at > 2^31 samples (bug 439)
2191 tokens[1].ToLongLong(&v);
2192 mMaxLen = (sampleCount) v;
2193 }
2194
2195#if defined(EXPERIMENTAL_NYQUIST_SPLIT_CONTROL)
2196 if (len >= 2 && tokens[0] == wxT("mergeclips")) {
2197 long v;
2198 // -1 = auto (default), 0 = don't merge clips, 1 = do merge clips
2199 tokens[1].ToLong(&v);
2200 mMergeClips = v;
2201 return true;
2202 }
2203
2204 if (len >= 2 && tokens[0] == wxT("restoresplits")) {
2205 long v;
2206 // Splits are restored by default. Set to 0 to prevent.
2207 tokens[1].ToLong(&v);
2208 mRestoreSplits = !!v;
2209 return true;
2210 }
2211#endif
2212
2213 if (len >= 2 && tokens[0] == wxT("author")) {
2214 mAuthor = TranslatableString{ UnQuote(tokens[1]), {} };
2215 return true;
2216 }
2217
2218 if (len >= 2 && tokens[0] == wxT("release")) {
2219 // Value must be quoted if the release version string contains spaces.
2221 TranslatableString{ UnQuote(tokens[1]), {} };
2222 return true;
2223 }
2224
2225 if (len >= 2 && tokens[0] == wxT("copyright")) {
2226 mCopyright = TranslatableString{ UnQuote(tokens[1]), {} };
2227 return true;
2228 }
2229
2230 // Page name in Audacity development manual
2231 if (len >= 2 && tokens[0] == wxT("manpage")) {
2232 // do not translate
2233 mManPage = UnQuote(tokens[1], false);
2234 return true;
2235 }
2236
2237 // Local Help file
2238 if (len >= 2 && tokens[0] == wxT("helpfile")) {
2239 // do not translate
2240 mHelpFile = UnQuote(tokens[1], false);
2241 return true;
2242 }
2243
2244 // Debug button may be disabled for release plug-ins.
2245 if (len >= 2 && tokens[0] == wxT("debugbutton")) {
2246 if (tokens[1] == wxT("disabled") || tokens[1] == wxT("false")) {
2247 mDebugButton = false;
2248 }
2249 return true;
2250 }
2251
2252
2253 if (len >= 3 && tokens[0] == wxT("control")) {
2254 NyqControl ctrl;
2255
2256 if (len == 3 && tokens[1] == wxT("text")) {
2257 ctrl.var = tokens[1];
2258 ctrl.label = UnQuote( tokens[2] );
2259 ctrl.type = NYQ_CTRL_TEXT;
2260 }
2261 else if (len >= 5)
2262 {
2263 ctrl.var = tokens[1];
2264 ctrl.name = UnQuote( tokens[2] );
2265 // 3 is type, below
2266 ctrl.label = tokens[4];
2267
2268 // valStr may or may not be a quoted string
2269 ctrl.valStr = len > 5 ? tokens[5] : wxString{};
2270 ctrl.val = GetCtrlValue(ctrl.valStr);
2271 if (ctrl.valStr.length() > 0 &&
2272 (ctrl.valStr[0] == wxT('(') ||
2273 ctrl.valStr[0] == wxT('"')))
2274 ctrl.valStr = UnQuote( ctrl.valStr );
2275
2276 // 6 is minimum, below
2277 // 7 is maximum, below
2278
2279 if (tokens[3] == wxT("string")) {
2280 ctrl.type = NYQ_CTRL_STRING;
2281 ctrl.label = UnQuote( ctrl.label );
2282 }
2283 else if (tokens[3] == wxT("choice")) {
2284 ctrl.type = NYQ_CTRL_CHOICE;
2285 ctrl.choices = ParseChoice(ctrl.label);
2286 ctrl.label = wxT("");
2287 }
2288 else if (tokens[3] == wxT("file")) {
2289 ctrl.type = NYQ_CTRL_FILE;
2290 ctrl.fileTypes = ParseFileTypes(tokens[6]);
2291 // will determine file dialog styles:
2292 ctrl.highStr = UnQuote( tokens[7] );
2293 ctrl.label = UnQuote(ctrl.label);
2294 }
2295 else {
2296 ctrl.label = UnQuote( ctrl.label );
2297
2298 if (len < 8) {
2299 return true;
2300 }
2301
2302 if ((tokens[3] == wxT("float")) ||
2303 (tokens[3] == wxT("real"))) // Deprecated
2304 ctrl.type = NYQ_CTRL_FLOAT;
2305 else if (tokens[3] == wxT("int"))
2306 ctrl.type = NYQ_CTRL_INT;
2307 else if (tokens[3] == wxT("float-text"))
2309 else if (tokens[3] == wxT("int-text"))
2310 ctrl.type = NYQ_CTRL_INT_TEXT;
2311 else if (tokens[3] == wxT("time"))
2312 ctrl.type = NYQ_CTRL_TIME;
2313 else
2314 {
2315 wxString str;
2316 str.Printf(wxT("Bad Nyquist 'control' type specification: '%s' in plug-in file '%s'.\nControl not created."),
2317 tokens[3], mFileName.GetFullPath());
2318
2319 // Too disturbing to show alert before Audacity frame is up.
2320 // Effect::MessageBox(
2321 // str,
2322 // wxOK | wxICON_EXCLAMATION,
2323 // XO("Nyquist Warning") );
2324
2325 // Note that the AudacityApp's mLogger has not yet been created,
2326 // so this brings up an alert box, but after the Audacity frame is up.
2327 wxLogWarning(str);
2328 return true;
2329 }
2330
2331 ctrl.lowStr = UnQuote( tokens[6] );
2332 if (ctrl.type == NYQ_CTRL_INT_TEXT && ctrl.lowStr.IsSameAs(wxT("nil"), false)) {
2333 ctrl.low = INT_MIN;
2334 }
2335 else if (ctrl.type == NYQ_CTRL_FLOAT_TEXT && ctrl.lowStr.IsSameAs(wxT("nil"), false)) {
2336 ctrl.low = -(FLT_MAX);
2337 }
2338 else if (ctrl.type == NYQ_CTRL_TIME && ctrl.lowStr.IsSameAs(wxT("nil"), false)) {
2339 ctrl.low = 0.0;
2340 }
2341 else {
2342 ctrl.low = GetCtrlValue(ctrl.lowStr);
2343 }
2344
2345 ctrl.highStr = UnQuote( tokens[7] );
2346 if (ctrl.type == NYQ_CTRL_INT_TEXT && ctrl.highStr.IsSameAs(wxT("nil"), false)) {
2347 ctrl.high = INT_MAX;
2348 }
2349 else if ((ctrl.type == NYQ_CTRL_FLOAT_TEXT || ctrl.type == NYQ_CTRL_TIME) &&
2350 ctrl.highStr.IsSameAs(wxT("nil"), false))
2351 {
2352 ctrl.high = FLT_MAX;
2353 }
2354 else {
2355 ctrl.high = GetCtrlValue(ctrl.highStr);
2356 }
2357
2358 if (ctrl.high < ctrl.low) {
2359 ctrl.high = ctrl.low;
2360 }
2361
2362 if (ctrl.val < ctrl.low) {
2363 ctrl.val = ctrl.low;
2364 }
2365
2366 if (ctrl.val > ctrl.high) {
2367 ctrl.val = ctrl.high;
2368 }
2369
2370 ctrl.ticks = 1000;
2371 if (ctrl.type == NYQ_CTRL_INT &&
2372 (ctrl.high - ctrl.low < ctrl.ticks)) {
2373 ctrl.ticks = (int)(ctrl.high - ctrl.low);
2374 }
2375 }
2376 }
2377
2378 if( ! make_iterator_range( mPresetNames ).contains( ctrl.var ) )
2379 {
2380 mControls.push_back(ctrl);
2381 }
2382 }
2383
2384 // Deprecated
2385 if (len >= 2 && tokens[0] == wxT("categories")) {
2386 for (size_t i = 1; i < tokens.size(); ++i) {
2387 mCategories.push_back(tokens[i]);
2388 }
2389 }
2390 return true;
2391}
const TranslatableString name
Definition: Distortion.cpp:82
@ EffectTypeAnalyze
@ EffectTypeGenerate
@ EffectTypeProcess
IteratorRange< Iterator > make_iterator_range(const Iterator &i1, const Iterator &i2)
Definition: MemoryX.h:431
void SetPreviewFullSelectionFlag(bool previewDurationFlag)
Definition: EffectBase.cpp:227
void SetLinearEffectFlag(bool linearEffectFlag)
Definition: EffectBase.cpp:222
wxArrayString mPresetNames
Definition: EffectBase.h:114
wxString var
Definition: Nyquist.h:51
wxString lowStr
Definition: Nyquist.h:57
static double GetCtrlValue(const wxString &s)
Definition: Nyquist.cpp:1921
bool mRestoreSplits
Definition: Nyquist.h:307
bool mFoundType
Definition: Nyquist.h:234
FileNames::FileTypes ParseFileTypes(const wxString &text)
Definition: Nyquist.cpp:1807
int mMergeClips
Definition: Nyquist.h:308
TranslatableString mAction
Definition: Nyquist.h:253
bool mCompiler
Definition: Nyquist.h:235
wxArrayString mCategories
Definition: Nyquist.h:302
static std::vector< EnumValueSymbol > ParseChoice(const wxString &text)
Definition: Nyquist.cpp:1747
static wxString UnQuote(const wxString &s, bool allowParens=true, wxString *pExtraString=nullptr)
Definition: Nyquist.cpp:1915
bool mTrace
Definition: Nyquist.h:236
bool mIsSal
Definition: Nyquist.h:237
TranslatableString mInfo
Definition: Nyquist.h:254
Holds a msgid for the translation catalog; may also bind format arguments.
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:19

References NyqControl::choices, EffectTypeAnalyze, EffectTypeGenerate, EffectTypeProcess, EffectTypeTool, NyqControl::fileTypes, GetCtrlValue(), NyqControl::high, NyqControl::highStr, NyqControl::label, NyqControl::low, NyqControl::lowStr, mAction, make_iterator_range(), mAuthor, mCategories, mCompiler, mControls, mCopyright, mDebugButton, mEnablePreview, mFileName, mFoundType, mHelpFile, mInfo, mInitError, mIsSal, mIsSpectral, mIsTool, mManPage, mMaxLen, mMergeClips, mName, mOK, EffectBase::mPresetNames, mReleaseVersion, mRestoreSplits, mTrace, mType, mVersion, name, NyqControl::name, NYQ_CTRL_CHOICE, NYQ_CTRL_FILE, NYQ_CTRL_FLOAT, NYQ_CTRL_FLOAT_TEXT, NYQ_CTRL_INT, NYQ_CTRL_INT_TEXT, NYQ_CTRL_STRING, NYQ_CTRL_TEXT, NYQ_CTRL_TIME, ParseChoice(), ParseFileTypes(), EffectBase::SetLinearEffectFlag(), EffectBase::SetPreviewFullSelectionFlag(), str, NyqControl::ticks, NyquistEffect::Tokenizer::Tokenize(), NyquistEffect::Tokenizer::tokens, NyqControl::type, UnQuote(), NyqControl::val, NyqControl::valStr, NyqControl::var, wxT(), and XO.

Referenced by ParseProgram().

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

◆ ParseChoice()

std::vector< EnumValueSymbol > NyquistEffect::ParseChoice ( const wxString &  text)
staticprivate

Definition at line 1747 of file Nyquist.cpp.

1748{
1749 std::vector<EnumValueSymbol> results;
1750 if (text[0] == wxT('(')) {
1751 // New style: expecting a Lisp-like list of strings
1752 Tokenizer tzer;
1753 tzer.Tokenize(text, true, 1, 1);
1754 auto &choices = tzer.tokens;
1755 wxString extra;
1756 for (auto &choice : choices) {
1757 auto label = UnQuote(choice, true, &extra);
1758 if (extra.empty())
1759 results.push_back( TranslatableString{ label, {} } );
1760 else
1761 results.push_back(
1762 { extra, TranslatableString{ label, {} } } );
1763 }
1764 }
1765 else {
1766 // Old style: expecting a comma-separated list of
1767 // un-internationalized names, ignoring leading and trailing spaces
1768 // on each; and the whole may be quoted
1769 auto choices = wxStringTokenize(
1770 text[0] == wxT('"') ? text.Mid(1, text.length() - 2) : text,
1771 wxT(",")
1772 );
1773 for (auto &choice : choices)
1774 results.push_back( { choice.Trim(true).Trim(false) } );
1775 }
1776 return results;
1777}
TranslatableString label
Definition: TagsEditor.cpp:163

References label, NyquistEffect::Tokenizer::Tokenize(), NyquistEffect::Tokenizer::tokens, UnQuote(), and wxT().

Referenced by Parse().

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

◆ ParseCommand()

bool NyquistEffect::ParseCommand ( const wxString &  cmd)
private

Definition at line 2499 of file Nyquist.cpp.

2500{
2501 wxStringInputStream stream(cmd + wxT(" "));
2502
2503 return ParseProgram(stream);
2504}
bool ParseProgram(wxInputStream &stream)
Definition: Nyquist.cpp:2393

References ParseProgram(), and wxT().

Referenced by DoLoadSettings(), SetCommand(), and TransferDataFromPromptWindow().

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

◆ ParseFile()

void NyquistEffect::ParseFile ( )
private

Definition at line 2491 of file Nyquist.cpp.

2492{
2493 wxFileInputStream rawStream(mFileName.GetFullPath());
2494 wxBufferedInputStream stream(rawStream, 10000);
2495
2496 ParseProgram(stream);
2497}

References mFileName, and ParseProgram().

Here is the call graph for this function:

◆ ParseFileExtensions()

FileExtensions NyquistEffect::ParseFileExtensions ( const wxString &  text)
private

Definition at line 1779 of file Nyquist.cpp.

1780{
1781 // todo: error handling
1782 FileExtensions results;
1783 if (text[0] == wxT('(')) {
1784 Tokenizer tzer;
1785 tzer.Tokenize(text, true, 1, 1);
1786 for (const auto &token : tzer.tokens)
1787 results.push_back( UnQuote( token ) );
1788 }
1789 return results;
1790}

References NyquistEffect::Tokenizer::Tokenize(), NyquistEffect::Tokenizer::tokens, UnQuote(), and wxT().

Referenced by ParseFileType().

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

◆ ParseFileType()

FileNames::FileType NyquistEffect::ParseFileType ( const wxString &  text)
private

Definition at line 1792 of file Nyquist.cpp.

1793{
1794 // todo: error handling
1795 FileNames::FileType result;
1796 if (text[0] == wxT('(')) {
1797 Tokenizer tzer;
1798 tzer.Tokenize(text, true, 1, 1);
1799 auto &tokens = tzer.tokens;
1800 if ( tokens.size() == 2 )
1801 result =
1802 { UnQuoteMsgid( tokens[0] ), ParseFileExtensions( tokens[1] ) };
1803 }
1804 return result;
1805}
static TranslatableString UnQuoteMsgid(const wxString &s, bool allowParens=true, wxString *pExtraString=nullptr)
Definition: Nyquist.cpp:1874
FileExtensions ParseFileExtensions(const wxString &text)
Definition: Nyquist.cpp:1779

References ParseFileExtensions(), NyquistEffect::Tokenizer::Tokenize(), NyquistEffect::Tokenizer::tokens, UnQuoteMsgid(), and wxT().

Referenced by ParseFileTypes().

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

◆ ParseFileTypes()

FileNames::FileTypes NyquistEffect::ParseFileTypes ( const wxString &  text)
private

Definition at line 1807 of file Nyquist.cpp.

1808{
1809 // todo: error handling
1810 FileNames::FileTypes results;
1811 if (text[0] == wxT('(')) {
1812 Tokenizer tzer;
1813 tzer.Tokenize(text, true, 1, 1);
1814 auto &types = tzer.tokens;
1815 if ( !types.empty() && types[0][0] == wxT('(') )
1816 for (auto &type : types)
1817 results.push_back( ParseFileType( type ) );
1818 }
1819 if ( results.empty() ) {
1820 // Old-style is a specially formatted string, maybe translated
1821 // Parse it for compatibility
1822 auto str = UnQuote( text );
1823 auto pieces = wxSplit( str, '|' );
1824 // Should have an even number
1825 auto size = pieces.size();
1826 if ( size % 2 == 1 )
1827 --size, pieces.pop_back();
1828 for ( size_t ii = 0; ii < size; ii += 2 ) {
1829 FileExtensions extensions;
1830 auto extensionStrings = wxSplit( pieces[ii + 1], ';' );
1831 for ( const auto &extensionString : extensionStrings )
1832 if ( extensionString.StartsWith( wxT("*.") ) ) {
1833 auto ext = extensionString.substr( 2 );
1834 if (ext == wxT("*"))
1835 // "*.*" to match all
1836 ext.clear();
1837 extensions.push_back( ext );
1838 }
1839 results.push_back( { Verbatim( pieces[ii] ), extensions } );
1840 }
1841 }
1842 return results;
1843}
std::vector< FileType > FileTypes
Definition: FileNames.h:76
FileNames::FileType ParseFileType(const wxString &text)
Definition: Nyquist.cpp:1792

References ParseFileType(), size, str, NyquistEffect::Tokenizer::Tokenize(), NyquistEffect::Tokenizer::tokens, UnQuote(), Verbatim(), and wxT().

Referenced by Parse().

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

◆ ParseProgram()

bool NyquistEffect::ParseProgram ( wxInputStream &  stream)
private

Definition at line 2393 of file Nyquist.cpp.

2394{
2395 if (!stream.IsOk())
2396 {
2397 mInitError = XO("Could not open file");
2398 return false;
2399 }
2400
2401 wxTextInputStream pgm(stream, wxT(" \t"), wxConvAuto());
2402
2403 mCmd = wxT("");
2404 mCmd.Alloc(10000);
2405 mIsSal = false;
2406 mControls.clear();
2407 mCategories.clear();
2408 mIsSpectral = false;
2409 mManPage = wxEmptyString; // If not wxEmptyString, must be a page in the Audacity manual.
2410 mHelpFile = wxEmptyString; // If not wxEmptyString, must be a valid HTML help file.
2411 mHelpFileExists = false;
2412 mDebug = false;
2413 mTrace = false;
2414 mDebugButton = true; // Debug button enabled by default.
2415 mEnablePreview = true; // Preview button enabled by default.
2416
2417 // Bug 1934.
2418 // All Nyquist plug-ins should have a ';type' field, but if they don't we default to
2419 // being an Effect.
2421
2422 mFoundType = false;
2423 while (!stream.Eof() && stream.IsOk())
2424 {
2425 wxString line = pgm.ReadLine();
2426 if (line.length() > 1 &&
2427 // New in 2.3.0: allow magic comment lines to start with $
2428 // The trick is that xgettext will not consider such lines comments
2429 // and will extract the strings they contain
2430 (line[0] == wxT(';') || line[0] == wxT('$')) )
2431 {
2432 Tokenizer tzer;
2433 unsigned nLines = 1;
2434 bool done;
2435 // Allow continuations within control lines.
2436 bool control =
2437 line[0] == wxT('$') || line.StartsWith( wxT(";control") );
2438 do
2439 done = Parse(tzer, line, !control || stream.Eof(), nLines == 1);
2440 while(!done &&
2441 (line = pgm.ReadLine(), ++nLines, true));
2442
2443 // Don't pass these lines to the interpreter, so it doesn't get confused
2444 // by $, but pass blanks,
2445 // so that SAL effects compile with proper line numbers
2446 while (nLines --)
2447 mCmd += wxT('\n');
2448 }
2449 else
2450 {
2451 if(!mFoundType && line.length() > 0) {
2452 if (line[0] == wxT('(') ||
2453 (line[0] == wxT('#') && line.length() > 1 && line[1] == wxT('|')))
2454 {
2455 mIsSal = false;
2456 mFoundType = true;
2457 }
2458 else if (line.Upper().Find(wxT("RETURN")) != wxNOT_FOUND)
2459 {
2460 mIsSal = true;
2461 mFoundType = true;
2462 }
2463 }
2464 mCmd += line + wxT("\n");
2465 }
2466 }
2467 if (!mFoundType && mIsPrompt)
2468 {
2469 /* i1n-hint: SAL and LISP are names for variant syntaxes for the
2470 Nyquist programming language. Leave them, and 'return', untranslated. */
2472 XO(
2473"Your code looks like SAL syntax, but there is no \'return\' statement.\n\
2474For SAL, use a return statement such as:\n\treturn *track* * 0.1\n\
2475or for LISP, begin with an open parenthesis such as:\n\t(mult *track* 0.1)\n ."),
2477 XO("Error in Nyquist code") );
2478 /* i18n-hint: refers to programming "languages" */
2479 mInitError = XO("Could not determine language");
2480 return false;
2481 // Else just throw it at Nyquist to see what happens
2482 }
2483
2484 const auto helpStuff = CheckHelpPage();
2485 mHelpFileExists = helpStuff.first;
2486 mHelpPage = helpStuff.second;
2487
2488 return true;
2489}
@ DefaultMessageBoxStyle
Definition: Effect.h:176
std::pair< bool, FilePath > CheckHelpPage() const
Definition: Nyquist.cpp:255
bool Parse(Tokenizer &tokenizer, const wxString &line, bool eof, bool first)
Definition: Nyquist.cpp:2038
bool mHelpFileExists
Definition: Nyquist.h:263
bool mDebug
Definition: Nyquist.h:271
wxString mCmd
Definition: Nyquist.h:250

References CheckHelpPage(), Effect::DefaultMessageBoxStyle, EffectTypeProcess, mCategories, mCmd, mControls, mDebug, mDebugButton, mEnablePreview, Effect::MessageBox(), mFoundType, mHelpFile, mHelpFileExists, mHelpPage, mInitError, mIsPrompt, mIsSal, mIsSpectral, mManPage, mTrace, mType, Parse(), wxT(), and XO.

Referenced by ParseCommand(), and ParseFile().

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

◆ PopulateOrExchange()

std::unique_ptr< EffectUIValidator > NyquistEffect::PopulateOrExchange ( ShuttleGui S,
EffectInstance instance,
EffectSettingsAccess access,
const EffectOutputs pOutputs 
)
overridevirtual

Add controls to effect panel; always succeeds.

Returns
if not null, then return it from Effect::PopulateUI instead of a DefaultEffectUIValidator; default implementation returns null

Reimplemented from Effect.

Definition at line 1137 of file Nyquist.cpp.

1140{
1141 if (mIsPrompt)
1143 else
1145 return nullptr;
1146}
void BuildEffectWindow(ShuttleGui &S)
Definition: Nyquist.cpp:2906
void BuildPromptWindow(ShuttleGui &S)
Definition: Nyquist.cpp:2874

References BuildEffectWindow(), BuildPromptWindow(), mIsPrompt, and S.

Here is the call graph for this function:

◆ Process()

bool NyquistEffect::Process ( EffectInstance instance,
EffectSettings settings 
)
overridevirtual

Actually do the effect here.

Returns
success

Implements StatefulEffectBase.

Definition at line 666 of file Nyquist.cpp.

667{
668 if (mIsPrompt && mControls.size() > 0 && !IsBatchProcessing()) {
669 auto &nyquistSettings = GetSettings(settings);
670 auto cleanup = finally([&]{
671 // Free up memory
672 nyquistSettings.proxySettings = {};
673 });
675 proxy.SetCommand(mInputCmd);
676 proxy.mDebug = nyquistSettings.proxyDebug;
677 proxy.mControls = move(nyquistSettings.controls);
678 auto result = Delegate(proxy, nyquistSettings.proxySettings);
679 if (result) {
680 mT0 = proxy.mT0;
681 mT1 = proxy.mT1;
682 }
683 return result;
684 }
685
686 // Check for reentrant Nyquist commands.
687 // I'm choosing to mark skipped Nyquist commands as successful even though
688 // they are skipped. The reason is that when Nyquist calls out to a chain,
689 // and that chain contains Nyquist, it will be clearer if the chain completes
690 // skipping Nyquist, rather than doing nothing at all.
691 if( mReentryCount > 0 )
692 return true;
693
694 // Restore the reentry counter (to zero) when we exit.
695 auto countRestorer = valueRestorer( mReentryCount);
698
699 bool success = true;
700 int nEffectsSoFar = nEffectsDone;
701 mProjectChanged = false;
703 em.SetSkipStateFlag(false);
704
705 // This code was added in a fix for bug 2392 (no preview for Nyquist)
706 // It was commented out in a fix for bug 2428 (no progress dialog from a macro)
707 //if (mExternal) {
708 // mProgress->Hide();
709 //}
710
711 mOutputTime = 0;
712 mCount = 0;
713 mProgressIn = 0;
714 mProgressOut = 0;
715 mProgressTot = 0;
716 mScale = (GetType() == EffectTypeProcess ? 0.5 : 1.0) / GetNumWaveGroups();
717
718 mStop = false;
719 mBreak = false;
720 mCont = false;
721
722 mTrackIndex = 0;
723
724 // If in tool mode, then we don't do anything with the track and selection.
725 const bool bOnePassTool = (GetType() == EffectTypeTool);
726
727 // We must copy all the tracks, because Paste needs label tracks to ensure
728 // correct sync-lock group behavior when the timeline is affected; then we just want
729 // to operate on the selected wave tracks
730 if ( !bOnePassTool )
731 CopyInputTracks(true);
732
733 mNumSelectedChannels = bOnePassTool
734 ? 0
735 : mOutputTracks->Selected< const WaveTrack >().size();
736
737 mDebugOutput = {};
738 if (!mHelpFile.empty() && !mHelpFileExists) {
740"error: File \"%s\" specified in header but not found in plug-in path.\n")
741 .Format( mHelpFile );
742 }
743
744 if (mVersion >= 4)
745 {
746 auto project = FindProject();
747
748 mProps = wxEmptyString;
749
750 mProps += wxString::Format(wxT("(putprop '*AUDACITY* (list %d %d %d) 'VERSION)\n"), AUDACITY_VERSION, AUDACITY_RELEASE, AUDACITY_REVISION);
751 wxString lang = gPrefs->Read(wxT("/Locale/Language"), wxT(""));
752 lang = (lang.empty())
754 : lang;
755 mProps += wxString::Format(wxT("(putprop '*AUDACITY* \"%s\" 'LANGUAGE)\n"), lang);
756
757 mProps += wxString::Format(wxT("(setf *DECIMAL-SEPARATOR* #\\%c)\n"), wxNumberFormatter::GetDecimalSeparator());
758
759 mProps += wxString::Format(wxT("(putprop '*SYSTEM-DIR* \"%s\" 'BASE)\n"), EscapeString(FileNames::BaseDir()));
760 mProps += wxString::Format(wxT("(putprop '*SYSTEM-DIR* \"%s\" 'DATA)\n"), EscapeString(FileNames::DataDir()));
761 mProps += wxString::Format(wxT("(putprop '*SYSTEM-DIR* \"%s\" 'HELP)\n"), EscapeString(FileNames::HtmlHelpDir().RemoveLast()));
762 mProps += wxString::Format(wxT("(putprop '*SYSTEM-DIR* \"%s\" 'TEMP)\n"), EscapeString(TempDirectory::TempDir()));
763 mProps += wxString::Format(wxT("(putprop '*SYSTEM-DIR* \"%s\" 'SYS-TEMP)\n"), EscapeString(wxStandardPaths::Get().GetTempDir()));
764 mProps += wxString::Format(wxT("(putprop '*SYSTEM-DIR* \"%s\" 'DOCUMENTS)\n"), EscapeString(wxStandardPaths::Get().GetDocumentsDir()));
765 mProps += wxString::Format(wxT("(putprop '*SYSTEM-DIR* \"%s\" 'HOME)\n"), EscapeString(wxGetHomeDir()));
766
768 wxString list;
769 for (size_t i = 0, cnt = paths.size(); i < cnt; i++)
770 {
771 list += wxT("\"") + EscapeString(paths[i]) + wxT("\" ");
772 }
773 list = list.RemoveLast();
774
775 mProps += wxString::Format(wxT("(putprop '*SYSTEM-DIR* (list %s) 'PLUGIN)\n"), list);
776 mProps += wxString::Format(wxT("(putprop '*SYSTEM-DIR* (list %s) 'PLUG-IN)\n"), list);
777 mProps += wxString::Format(wxT("(putprop '*SYSTEM-DIR* \"%s\" 'USER-PLUG-IN)\n"),
779
780 // Date and time:
781 wxDateTime now = wxDateTime::Now();
782 int year = now.GetYear();
783 int doy = now.GetDayOfYear();
784 int dom = now.GetDay();
785 // enumerated constants
786 wxDateTime::Month month = now.GetMonth();
787 wxDateTime::WeekDay day = now.GetWeekDay();
788
789 // Date/time as a list: year, day of year, hour, minute, seconds
790 mProps += wxString::Format(wxT("(setf *SYSTEM-TIME* (list %d %d %d %d %d))\n"),
791 year, doy, now.GetHour(), now.GetMinute(), now.GetSecond());
792
793 mProps += wxString::Format(wxT("(putprop '*SYSTEM-TIME* \"%s\" 'DATE)\n"), now.FormatDate());
794 mProps += wxString::Format(wxT("(putprop '*SYSTEM-TIME* \"%s\" 'TIME)\n"), now.FormatTime());
795 mProps += wxString::Format(wxT("(putprop '*SYSTEM-TIME* \"%s\" 'ISO-DATE)\n"), now.FormatISODate());
796 mProps += wxString::Format(wxT("(putprop '*SYSTEM-TIME* \"%s\" 'ISO-TIME)\n"), now.FormatISOTime());
797 mProps += wxString::Format(wxT("(putprop '*SYSTEM-TIME* %d 'YEAR)\n"), year);
798 mProps += wxString::Format(wxT("(putprop '*SYSTEM-TIME* %d 'DAY)\n"), dom); // day of month
799 mProps += wxString::Format(wxT("(putprop '*SYSTEM-TIME* %d 'MONTH)\n"), month);
800 mProps += wxString::Format(wxT("(putprop '*SYSTEM-TIME* \"%s\" 'MONTH-NAME)\n"), now.GetMonthName(month));
801 mProps += wxString::Format(wxT("(putprop '*SYSTEM-TIME* \"%s\" 'DAY-NAME)\n"), now.GetWeekDayName(day));
802
803 mProps += wxString::Format(wxT("(putprop '*PROJECT* %d 'PROJECTS)\n"),
804 (int) AllProjects{}.size());
805 mProps += wxString::Format(wxT("(putprop '*PROJECT* \"%s\" 'NAME)\n"), EscapeString(project->GetProjectName()));
806
807 int numTracks = 0;
808 int numWave = 0;
809 int numLabel = 0;
810 int numMidi = 0;
811 int numTime = 0;
812 wxString waveTrackList; // track positions of selected audio tracks.
813
814 {
815 auto countRange = TrackList::Get( *project ).Leaders();
816 for (auto t : countRange) {
817 t->TypeSwitch( [&](const WaveTrack *) {
818 numWave++;
819 if (t->GetSelected())
820 waveTrackList += wxString::Format(wxT("%d "), 1 + numTracks);
821 });
822 numTracks++;
823 }
824 numLabel = countRange.Filter<const LabelTrack>().size();
825 #if defined(USE_MIDI)
826 numMidi = countRange.Filter<const NoteTrack>().size();
827 #endif
828 numTime = countRange.Filter<const TimeTrack>().size();
829 }
830
831 // We use Internat::ToString() rather than "%g" here because we
832 // always have to use the dot as decimal separator when giving
833 // numbers to Nyquist, whereas using "%g" will use the user's
834 // decimal separator which may be a comma in some countries.
835 mProps += wxString::Format(wxT("(putprop '*PROJECT* (float %s) 'RATE)\n"),
837 mProps += wxString::Format(wxT("(putprop '*PROJECT* %d 'TRACKS)\n"), numTracks);
838 mProps += wxString::Format(wxT("(putprop '*PROJECT* %d 'WAVETRACKS)\n"), numWave);
839 mProps += wxString::Format(wxT("(putprop '*PROJECT* %d 'LABELTRACKS)\n"), numLabel);
840 mProps += wxString::Format(wxT("(putprop '*PROJECT* %d 'MIDITRACKS)\n"), numMidi);
841 mProps += wxString::Format(wxT("(putprop '*PROJECT* %d 'TIMETRACKS)\n"), numTime);
842
843 double previewLen = 6.0;
844 gPrefs->Read(wxT("/AudioIO/EffectsPreviewLen"), &previewLen);
845 mProps += wxString::Format(wxT("(putprop '*PROJECT* (float %s) 'PREVIEW-DURATION)\n"),
846 Internat::ToString(previewLen));
847
848 // *PREVIEWP* is true when previewing (better than relying on track view).
849 wxString isPreviewing = (this->IsPreviewing())? wxT("T") : wxT("NIL");
850 mProps += wxString::Format(wxT("(setf *PREVIEWP* %s)\n"), isPreviewing);
851
852 mProps += wxString::Format(wxT("(putprop '*SELECTION* (float %s) 'START)\n"),
854 mProps += wxString::Format(wxT("(putprop '*SELECTION* (float %s) 'END)\n"),
856 mProps += wxString::Format(wxT("(putprop '*SELECTION* (list %s) 'TRACKS)\n"), waveTrackList);
857 mProps += wxString::Format(wxT("(putprop '*SELECTION* %d 'CHANNELS)\n"), mNumSelectedChannels);
858 }
859
860 // Nyquist Prompt does not require a selection, but effects do.
861 if (!bOnePassTool && (mNumSelectedChannels == 0)) {
862 auto message = XO("Audio selection required.");
864 message,
865 wxOK | wxCENTRE | wxICON_EXCLAMATION,
866 XO("Nyquist Error") );
867 }
868
869 std::optional<TrackIterRange<WaveTrack>> pRange;
870 if (!bOnePassTool)
871 pRange.emplace(mOutputTracks->Selected< WaveTrack >() + &Track::IsLeader);
872
873 // Keep track of whether the current track is first selected in its sync-lock group
874 // (we have no idea what the length of the returned audio will be, so we have
875 // to handle sync-lock group behavior the "old" way).
876 mFirstInGroup = true;
877 Track *gtLast = NULL;
878
879 for (;
880 bOnePassTool || pRange->first != pRange->second;
881 (void) (!pRange || (++pRange->first, true))
882 ) {
883 // Prepare to accumulate more debug output in OutputCallback
885 mDebugOutput = Verbatim( "%s" ).Format( std::cref( mDebugOutputStr ) );
886
887 mCurTrack[0] = pRange ? *pRange->first : nullptr;
888 mCurNumChannels = 1;
889 if ( (mT1 >= mT0) || bOnePassTool ) {
890 if (bOnePassTool) {
891 }
892 else {
893 auto channels = TrackList::Channels(mCurTrack[0]);
894 if (channels.size() > 1) {
895 // TODO: more-than-two-channels
896 // Pay attention to consistency of mNumSelectedChannels
897 // with the running tally made by this loop!
898 mCurNumChannels = 2;
899
900 mCurTrack[1] = * ++ channels.first;
901 if (mCurTrack[1]->GetRate() != mCurTrack[0]->GetRate()) {
903 XO(
904"Sorry, cannot apply effect on stereo tracks where the tracks don't match."),
905 wxOK | wxCENTRE );
906 success = false;
907 goto finish;
908 }
910 }
911
912 // Check whether we're in the same group as the last selected track
913 Track *gt = *SyncLock::Group(mCurTrack[0]).first;
914 mFirstInGroup = !gtLast || (gtLast != gt);
915 gtLast = gt;
916
919 mCurLen = end - mCurStart[0];
920
921 if (mCurLen > NYQ_MAX_LEN) {
922 float hours = (float)NYQ_MAX_LEN / (44100 * 60 * 60);
923 const auto message =
924 XO(
925"Selection too long for Nyquist code.\nMaximum allowed selection is %ld samples\n(about %.1f hours at 44100 Hz sample rate).")
926 .Format((long)NYQ_MAX_LEN, hours);
928 message,
929 wxOK | wxCENTRE,
930 XO("Nyquist Error") );
931 if (!mProjectChanged)
932 em.SetSkipStateFlag(true);
933 return false;
934 }
935
937 }
938
939 mProgressIn = 0.0;
940 mProgressOut = 0.0;
941
942 // libnyquist breaks except in LC_NUMERIC=="C".
943 //
944 // Note that we must set the locale to "C" even before calling
945 // nyx_init() because otherwise some effects will not work!
946 //
947 // MB: setlocale is not thread-safe. Should use uselocale()
948 // if available, or fix libnyquist to be locale-independent.
949 // See also http://bugzilla.audacityteam.org/show_bug.cgi?id=642#c9
950 // for further info about this thread safety question.
951 wxString prevlocale = wxSetlocale(LC_NUMERIC, NULL);
952 wxSetlocale(LC_NUMERIC, wxString(wxT("C")));
953
954 nyx_init();
955 nyx_set_os_callback(StaticOSCallback, (void *)this);
956 nyx_capture_output(StaticOutputCallback, (void *)this);
957
958 auto cleanup = finally( [&] {
959 nyx_capture_output(NULL, (void *)NULL);
960 nyx_set_os_callback(NULL, (void *)NULL);
961 nyx_cleanup();
962 } );
963
964
965 if (mVersion >= 4)
966 {
967 mPerTrackProps = wxEmptyString;
968 wxString lowHz = wxT("nil");
969 wxString highHz = wxT("nil");
970 wxString centerHz = wxT("nil");
971 wxString bandwidth = wxT("nil");
972
973#if defined(EXPERIMENTAL_SPECTRAL_EDITING)
974 if (mF0 >= 0.0) {
975 lowHz.Printf(wxT("(float %s)"), Internat::ToString(mF0));
976 }
977
978 if (mF1 >= 0.0) {
979 highHz.Printf(wxT("(float %s)"), Internat::ToString(mF1));
980 }
981
982 if ((mF0 >= 0.0) && (mF1 >= 0.0)) {
983 centerHz.Printf(wxT("(float %s)"), Internat::ToString(sqrt(mF0 * mF1)));
984 }
985
986 if ((mF0 > 0.0) && (mF1 >= mF0)) {
987 // with very small values, bandwidth calculation may be inf.
988 // (Observed on Linux)
989 double bw = log(mF1 / mF0) / log(2.0);
990 if (!std::isinf(bw)) {
991 bandwidth.Printf(wxT("(float %s)"), Internat::ToString(bw));
992 }
993 }
994
995#endif
996 mPerTrackProps += wxString::Format(wxT("(putprop '*SELECTION* %s 'LOW-HZ)\n"), lowHz);
997 mPerTrackProps += wxString::Format(wxT("(putprop '*SELECTION* %s 'CENTER-HZ)\n"), centerHz);
998 mPerTrackProps += wxString::Format(wxT("(putprop '*SELECTION* %s 'HIGH-HZ)\n"), highHz);
999 mPerTrackProps += wxString::Format(wxT("(putprop '*SELECTION* %s 'BANDWIDTH)\n"), bandwidth);
1000 }
1001
1002 success = ProcessOne();
1003
1004 // Reset previous locale
1005 wxSetlocale(LC_NUMERIC, prevlocale);
1006
1007 if (!success || bOnePassTool) {
1008 goto finish;
1009 }
1011 }
1012
1014 }
1015
1016 if (mOutputTime > 0.0) {
1017 mT1 = mT0 + mOutputTime;
1018 }
1019
1020finish:
1021
1022 // Show debug window if trace set in plug-in header and something to show.
1023 mDebug = (mTrace && !mDebugOutput.Translation().empty())? true : mDebug;
1024
1025 if (mDebug && !mRedirectOutput) {
1027 mName,
1028 XO("Debug Output: "),
1029 mDebugOutput);
1030 dlog.CentreOnParent();
1031 dlog.ShowModal();
1032 }
1033
1034 // Has rug been pulled from under us by some effect done within Nyquist??
1035 if( !bOnePassTool && ( nEffectsSoFar == nEffectsDone ))
1036 ReplaceProcessedTracks(success);
1037 else{
1038 ReplaceProcessedTracks(false); // Do not use the results.
1039 // Selection is to be set to whatever it is in the project.
1040 auto project = FindProject();
1041 if (project) {
1042 auto &selectedRegion = ViewInfo::Get( *project ).selectedRegion;
1043 mT0 = selectedRegion.t0();
1044 mT1 = selectedRegion.t1();
1045 }
1046 else {
1047 mT0 = 0;
1048 mT1 = -1;
1049 }
1050
1051 }
1052
1053 if (!mProjectChanged)
1054 em.SetSkipStateFlag(true);
1055
1056 return success;
1057}
int min(int a, int b)
ValueRestorer< T > valueRestorer(T &var)
inline functions provide convenient parameter type deduction
Definition: MemoryX.h:234
#define NYQUIST_WORKER_ID
Definition: Nyquist.cpp:96
static void RegisterFunctions()
Definition: Nyquist.cpp:3573
FileConfig * gPrefs
Definition: Prefs.cpp:71
size_t size() const
Definition: Project.cpp:17
double mT1
Definition: EffectBase.h:109
std::shared_ptr< TrackList > mOutputTracks
Definition: EffectBase.h:107
bool IsPreviewing() const
Definition: EffectBase.h:85
double mT0
Definition: EffectBase.h:108
void ReplaceProcessedTracks(const bool bGoodResult)
Definition: EffectBase.cpp:240
static int nEffectsDone
Definition: EffectBase.h:93
void CopyInputTracks(bool allSyncLockSelected=false)
Definition: Effect.cpp:733
bool Delegate(Effect &delegate, EffectSettings &settings)
Re-invoke DoEffect on another Effect object that implements the work.
Definition: Effect.cpp:586
int GetNumWaveGroups() const
Definition: Effect.h:225
EffectManager is the class that handles effects and effect categories.
Definition: EffectManager.h:48
void SetSkipStateFlag(bool flag)
static EffectManager & Get()
static NyquistSettings & GetSettings(EffectSettings &settings)
Assume settings originated from MakeSettings() and copies thereof.
Definition: Effect.h:333
static wxString ToString(double numberToConvert, int digitsAfterDecimalPoint=-1)
Convert a number to a string, always uses the dot as decimal separator.
Definition: Internat.cpp:151
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:89
A Track that is used for Midi notes. (Somewhat old code).
Definition: NoteTrack.h:63
TranslatableString mDebugOutput
Definition: Nyquist.h:275
static void StaticOSCallback(void *userdata)
Definition: Nyquist.cpp:2620
static void StaticOutputCallback(int c, void *userdata)
Definition: Nyquist.cpp:2604
unsigned mCurNumChannels
Definition: Nyquist.h:280
EffectType GetType() const override
Type determines how it behaves.
Definition: Nyquist.cpp:278
wxString mPerTrackProps
Definition: Nyquist.h:305
static int mReentryCount
Definition: Nyquist.h:142
unsigned mNumSelectedChannels
Definition: Nyquist.h:289
bool ProcessOne()
Definition: Nyquist.cpp:1191
bool mProjectChanged
Definition: Nyquist.h:273
bool mFirstInGroup
Definition: Nyquist.h:286
wxString EscapeString(const wxString &inStr)
Definition: Nyquist.cpp:1737
wxString mProps
Definition: Nyquist.h:304
int mTrackIndex
Definition: Nyquist.h:285
double mOutputTime
Definition: Nyquist.h:287
unsigned mCount
Definition: Nyquist.h:288
Dialog used with NyquistEffect.
Definition: Nyquist.h:320
static ProjectRate & Get(AudacityProject &project)
Definition: ProjectRate.cpp:28
double GetRate() const
Definition: ProjectRate.cpp:53
sampleCount TimeToLongSamples(double t0) const
Convert correctly between an (absolute) time in seconds and a number of samples.
Definition: SampleTrack.cpp:42
static TrackIterRange< Track > Group(Track *pTrack)
Definition: SyncLock.cpp:122
A kind of Track used to 'warp time'.
Definition: TimeTrack.h:24
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:225
bool IsLeader() const
Definition: Track.cpp:405
auto Leaders() -> TrackIterRange< TrackType >
Definition: Track.h:1471
static auto Channels(TrackType *pTrack) -> TrackIterRange< TrackType >
Definition: Track.h:1541
TranslatableString & Format(Args &&...args) &
Capture variadic format arguments (by copy) when there is no plural.
NotifyingSelectedRegion selectedRegion
Definition: ViewInfo.h:216
static ViewInfo & Get(AudacityProject &project)
Definition: ViewInfo.cpp:235
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Definition: BasicUI.cpp:194
FILES_API FilePath HtmlHelpDir()
FILES_API FilePath BaseDir()
FILES_API FilePath DataDir()
Audacity user data directory.
wxString GetSystemLanguageCode(const FilePaths &pathList)
Definition: Languages.cpp:83
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
Definition: PackedArray.h:159
FILES_API wxString TempDir()

References FileNames::AudacityPathList(), FileNames::BaseDir(), TrackList::Channels(), Effect::CopyInputTracks(), FileNames::DataDir(), Effect::Delegate(), EffectTypeProcess, EffectTypeTool, PackedArray::end(), EscapeString(), EffectBase::FindProject(), TranslatableString::Format(), BasicUI::Get(), EffectManager::Get(), ProjectRate::Get(), ViewInfo::Get(), TrackList::Get(), Effect::GetNumWaveGroups(), GetNyquistSearchPath(), anonymous_namespace{TimeTrack.cpp}::GetRate(), ProjectRate::GetRate(), EffectWithSettings< NyquistSettings, StatefulEffect >::GetSettings(), Languages::GetSystemLanguageCode(), GetType(), gPrefs, SyncLock::Group(), FileNames::HtmlHelpDir(), Effect::IsBatchProcessing(), Track::IsLeader(), EffectBase::IsPreviewing(), TrackList::Leaders(), mBreak, mCont, mControls, mCount, mCurLen, mCurNumChannels, mCurStart, mCurTrack, mDebug, mDebugOutput, mDebugOutputStr, Effect::MessageBox(), mFirstInGroup, mHelpFile, mHelpFileExists, min(), mInputCmd, mIsPrompt, mMaxLen, mName, mNumSelectedChannels, mOutputTime, EffectBase::mOutputTracks, mPerTrackProps, mProgressIn, mProgressOut, mProgressTot, mProjectChanged, mProps, mRedirectOutput, mReentryCount, mScale, mStop, EffectBase::mT0, EffectBase::mT1, mTrace, mTrackIndex, Effect::mUIParent, mVersion, EffectBase::nEffectsDone, NYQ_MAX_LEN, NYQUIST_WORKER_ID, FileNames::PlugInDir(), ProcessOne(), RegisterFunctions(), EffectBase::ReplaceProcessedTracks(), ViewInfo::selectedRegion, EffectManager::SetSkipStateFlag(), settings(), size, AllProjects::size(), StaticOSCallback(), StaticOutputCallback(), TempDirectory::TempDir(), SampleTrack::TimeToLongSamples(), Internat::ToString(), TranslatableString::Translation(), valueRestorer(), Verbatim(), wxT(), and XO.

Here is the call graph for this function:

◆ ProcessOne()

bool NyquistEffect::ProcessOne ( )
private

Definition at line 1191 of file Nyquist.cpp.

1192{
1193 mpException = {};
1194
1195 nyx_rval rval;
1196
1197 wxString cmd;
1198 cmd += wxT("(snd-set-latency 0.1)");
1199
1200 // A tool may be using AUD-DO which will potentially invalidate *TRACK*
1201 // so tools do not get *TRACK*.
1202 if (GetType() == EffectTypeTool)
1203 cmd += wxT("(setf S 0.25)\n"); // No Track.
1204 else if (mVersion >= 4) {
1205 nyx_set_audio_name("*TRACK*");
1206 cmd += wxT("(setf S 0.25)\n");
1207 }
1208 else {
1209 nyx_set_audio_name("S");
1210 cmd += wxT("(setf *TRACK* '*unbound*)\n");
1211 }
1212
1213 if(mVersion >= 4) {
1214 cmd += mProps;
1215 cmd += mPerTrackProps;
1216 }
1217
1218 if( (mVersion >= 4) && (GetType() != EffectTypeTool) ) {
1219 // Set the track TYPE and VIEW properties
1220 wxString type;
1221 wxString view;
1222 wxString bitFormat;
1223 wxString spectralEditp;
1224
1226 [&](const WaveTrack *wt) {
1227 type = wxT("wave");
1228 spectralEditp = mCurTrack[0]->GetSpectrogramSettings().SpectralSelectionEnabled()? wxT("T") : wxT("NIL");
1229 view = wxT("NIL");
1230 // Find() not Get() to avoid creation-on-demand of views in case we are
1231 // only previewing
1232 if ( const auto pView = WaveTrackView::Find( wt ) ) {
1233 auto displays = pView->GetDisplays();
1234 auto format = [&]( decltype(displays[0]) display ) {
1235 // Get the English name of the view type, without menu codes,
1236 // as a string that Lisp can examine
1237 return wxString::Format( wxT("\"%s\""),
1238 display.name.Stripped().Debug() );
1239 };
1240 if (displays.empty())
1241 ;
1242 else if (displays.size() == 1)
1243 view = format( displays[0] );
1244 else {
1245 view = wxT("(list");
1246 for ( auto display : displays )
1247 view += wxString(wxT(" ")) + format( display );
1248 view += wxT(")");
1249 }
1250 }
1251 },
1252#if defined(USE_MIDI)
1253 [&](const NoteTrack *) {
1254 type = wxT("midi");
1255 view = wxT("\"Midi\"");
1256 },
1257#endif
1258 [&](const LabelTrack *) {
1259 type = wxT("label");
1260 view = wxT("\"Label\"");
1261 },
1262 [&](const TimeTrack *) {
1263 type = wxT("time");
1264 view = wxT("\"Time\"");
1265 }
1266 );
1267
1268 cmd += wxString::Format(wxT("(putprop '*TRACK* %d 'INDEX)\n"), ++mTrackIndex);
1269 cmd += wxString::Format(wxT("(putprop '*TRACK* \"%s\" 'NAME)\n"), EscapeString(mCurTrack[0]->GetName()));
1270 cmd += wxString::Format(wxT("(putprop '*TRACK* \"%s\" 'TYPE)\n"), type);
1271 // Note: "View" property may change when Audacity's choice of track views has stabilized.
1272 cmd += wxString::Format(wxT("(putprop '*TRACK* %s 'VIEW)\n"), view);
1273 cmd += wxString::Format(wxT("(putprop '*TRACK* %d 'CHANNELS)\n"), mCurNumChannels);
1274
1275 //NOTE: Audacity 2.1.3 True if spectral selection is enabled regardless of track view.
1276 cmd += wxString::Format(wxT("(putprop '*TRACK* %s 'SPECTRAL-EDIT-ENABLED)\n"), spectralEditp);
1277
1278 auto channels = TrackList::Channels( mCurTrack[0] );
1279 double startTime = channels.min( &Track::GetStartTime );
1280 double endTime = channels.max( &Track::GetEndTime );
1281
1282 cmd += wxString::Format(wxT("(putprop '*TRACK* (float %s) 'START-TIME)\n"),
1283 Internat::ToString(startTime));
1284 cmd += wxString::Format(wxT("(putprop '*TRACK* (float %s) 'END-TIME)\n"),
1285 Internat::ToString(endTime));
1286 cmd += wxString::Format(wxT("(putprop '*TRACK* (float %s) 'GAIN)\n"),
1287 Internat::ToString(mCurTrack[0]->GetGain()));
1288 cmd += wxString::Format(wxT("(putprop '*TRACK* (float %s) 'PAN)\n"),
1289 Internat::ToString(mCurTrack[0]->GetPan()));
1290 cmd += wxString::Format(wxT("(putprop '*TRACK* (float %s) 'RATE)\n"),
1292
1293 switch (mCurTrack[0]->GetSampleFormat())
1294 {
1295 case int16Sample:
1296 bitFormat = wxT("16");
1297 break;
1298 case int24Sample:
1299 bitFormat = wxT("24");
1300 break;
1301 case floatSample:
1302 bitFormat = wxT("32.0");
1303 break;
1304 }
1305 cmd += wxString::Format(wxT("(putprop '*TRACK* %s 'FORMAT)\n"), bitFormat);
1306
1307 float maxPeakLevel = 0.0; // Deprecated as of 2.1.3
1308 wxString clips, peakString, rmsString;
1309 for (size_t i = 0; i < mCurNumChannels; i++) {
1310 auto ca = mCurTrack[i]->SortedClipArray();
1311 float maxPeak = 0.0;
1312
1313 // A list of clips for mono, or an array of lists for multi-channel.
1314 if (mCurNumChannels > 1) {
1315 clips += wxT("(list ");
1316 }
1317 // Each clip is a list (start-time, end-time)
1318 // Limit number of clips added to avoid argument stack overflow error (bug 2300).
1319 for (size_t i=0; i<ca.size(); i++) {
1320 if (i < 1000) {
1321 clips += wxString::Format(wxT("(list (float %s) (float %s))"),
1322 Internat::ToString(ca[i]->GetPlayStartTime()),
1323 Internat::ToString(ca[i]->GetPlayEndTime()));
1324 } else if (i == 1000) {
1325 // If final clip is NIL, plug-in developer knows there are more than 1000 clips in channel.
1326 clips += "NIL";
1327 } else if (i > 1000) {
1328 break;
1329 }
1330 }
1331 if (mCurNumChannels > 1) clips += wxT(" )");
1332
1333 float min, max;
1334 auto pair = mCurTrack[i]->GetMinMax(mT0, mT1); // may throw
1335 min = pair.first, max = pair.second;
1336 maxPeak = wxMax(wxMax(fabs(min), fabs(max)), maxPeak);
1337 maxPeakLevel = wxMax(maxPeakLevel, maxPeak);
1338
1339 // On Debian, NaN samples give maxPeak = 3.40282e+38 (FLT_MAX)
1340 if (!std::isinf(maxPeak) && !std::isnan(maxPeak) && (maxPeak < FLT_MAX)) {
1341 peakString += wxString::Format(wxT("(float %s) "), Internat::ToString(maxPeak));
1342 } else {
1343 peakString += wxT("nil ");
1344 }
1345
1346 float rms = mCurTrack[i]->GetRMS(mT0, mT1); // may throw
1347 if (!std::isinf(rms) && !std::isnan(rms)) {
1348 rmsString += wxString::Format(wxT("(float %s) "), Internat::ToString(rms));
1349 } else {
1350 rmsString += wxT("NIL ");
1351 }
1352 }
1353 // A list of clips for mono, or an array of lists for multi-channel.
1354 cmd += wxString::Format(wxT("(putprop '*TRACK* %s%s ) 'CLIPS)\n"),
1355 (mCurNumChannels == 1) ? wxT("(list ") : wxT("(vector "),
1356 clips);
1357
1358 (mCurNumChannels > 1)?
1359 cmd += wxString::Format(wxT("(putprop '*SELECTION* (vector %s) 'PEAK)\n"), peakString) :
1360 cmd += wxString::Format(wxT("(putprop '*SELECTION* %s 'PEAK)\n"), peakString);
1361
1362 if (!std::isinf(maxPeakLevel) && !std::isnan(maxPeakLevel) && (maxPeakLevel < FLT_MAX)) {
1363 cmd += wxString::Format(wxT("(putprop '*SELECTION* (float %s) 'PEAK-LEVEL)\n"),
1364 Internat::ToString(maxPeakLevel));
1365 }
1366
1367 (mCurNumChannels > 1)?
1368 cmd += wxString::Format(wxT("(putprop '*SELECTION* (vector %s) 'RMS)\n"), rmsString) :
1369 cmd += wxString::Format(wxT("(putprop '*SELECTION* %s 'RMS)\n"), rmsString);
1370 }
1371
1372 // If in tool mode, then we don't do anything with the track and selection.
1373 if (GetType() == EffectTypeTool) {
1374 nyx_set_audio_params(44100, 0);
1375 }
1376 else if (GetType() == EffectTypeGenerate) {
1377 nyx_set_audio_params(mCurTrack[0]->GetRate(), 0);
1378 }
1379 else {
1380 auto curLen = mCurLen.as_long_long();
1381 nyx_set_audio_params(mCurTrack[0]->GetRate(), curLen);
1382
1383 nyx_set_input_audio(StaticGetCallback, (void *)this,
1384 (int)mCurNumChannels,
1385 curLen, mCurTrack[0]->GetRate());
1386 }
1387
1388 // Restore the Nyquist sixteenth note symbol for Generate plug-ins.
1389 // See http://bugzilla.audacityteam.org/show_bug.cgi?id=490.
1390 if (GetType() == EffectTypeGenerate) {
1391 cmd += wxT("(setf s 0.25)\n");
1392 }
1393
1394 if (mDebug || mTrace) {
1395 cmd += wxT("(setf *tracenable* T)\n");
1396 if (mExternal) {
1397 cmd += wxT("(setf *breakenable* T)\n");
1398 }
1399 }
1400 else {
1401 // Explicitly disable backtrace and prevent values
1402 // from being carried through to the output.
1403 // This should be the final command before evaluating the Nyquist script.
1404 cmd += wxT("(setf *tracenable* NIL)\n");
1405 }
1406
1407 for (unsigned int j = 0; j < mControls.size(); j++) {
1408 if (mControls[j].type == NYQ_CTRL_FLOAT || mControls[j].type == NYQ_CTRL_FLOAT_TEXT ||
1409 mControls[j].type == NYQ_CTRL_TIME) {
1410 // We use Internat::ToString() rather than "%f" here because we
1411 // always have to use the dot as decimal separator when giving
1412 // numbers to Nyquist, whereas using "%f" will use the user's
1413 // decimal separator which may be a comma in some countries.
1414 cmd += wxString::Format(wxT("(setf %s %s)\n"),
1415 mControls[j].var,
1416 Internat::ToString(mControls[j].val, 14));
1417 }
1418 else if (mControls[j].type == NYQ_CTRL_INT ||
1419 mControls[j].type == NYQ_CTRL_INT_TEXT ||
1420 mControls[j].type == NYQ_CTRL_CHOICE) {
1421 cmd += wxString::Format(wxT("(setf %s %d)\n"),
1422 mControls[j].var,
1423 (int)(mControls[j].val));
1424 }
1425 else if (mControls[j].type == NYQ_CTRL_STRING || mControls[j].type == NYQ_CTRL_FILE) {
1426 cmd += wxT("(setf ");
1427 // restrict variable names to 7-bit ASCII:
1428 cmd += mControls[j].var;
1429 cmd += wxT(" \"");
1430 cmd += EscapeString(mControls[j].valStr); // unrestricted value will become quoted UTF-8
1431 cmd += wxT("\")\n");
1432 }
1433 }
1434
1435 if (mIsSal) {
1436 wxString str = EscapeString(mCmd);
1437 // this is tricky: we need SAL to call main so that we can get a
1438 // SAL traceback in the event of an error (sal-compile catches the
1439 // error and calls sal-error-output), but SAL does not return values.
1440 // We will catch the value in a special global aud:result and if no
1441 // error occurs, we will grab the value with a LISP expression
1442 str += wxT("\nset aud:result = main()\n");
1443
1444 if (mDebug || mTrace) {
1445 // since we're about to evaluate SAL, remove LISP trace enable and
1446 // break enable (which stops SAL processing) and turn on SAL stack
1447 // trace
1448 cmd += wxT("(setf *tracenable* nil)\n");
1449 cmd += wxT("(setf *breakenable* nil)\n");
1450 cmd += wxT("(setf *sal-traceback* t)\n");
1451 }
1452
1453 if (mCompiler) {
1454 cmd += wxT("(setf *sal-compiler-debug* t)\n");
1455 }
1456
1457 cmd += wxT("(setf *sal-call-stack* nil)\n");
1458 // if we do not set this here and an error occurs in main, another
1459 // error will be raised when we try to return the value of aud:result
1460 // which is unbound
1461 cmd += wxT("(setf aud:result nil)\n");
1462 cmd += wxT("(sal-compile-audacity \"") + str + wxT("\" t t nil)\n");
1463 // Capture the value returned by main (saved in aud:result), but
1464 // set aud:result to nil so sound results can be evaluated without
1465 // retaining audio in memory
1466 cmd += wxT("(prog1 aud:result (setf aud:result nil))\n");
1467 }
1468 else {
1469 cmd += mCmd;
1470 }
1471
1472 // Put the fetch buffers in a clean initial state
1473 for (size_t i = 0; i < mCurNumChannels; i++)
1474 mCurBuffer[i].reset();
1475
1476 // Guarantee release of memory when done
1477 auto cleanup = finally( [&] {
1478 for (size_t i = 0; i < mCurNumChannels; i++)
1479 mCurBuffer[i].reset();
1480 } );
1481
1482 // Evaluate the expression, which may invoke the get callback, but often does
1483 // not, leaving that to delayed evaluation of the output sound
1484 rval = nyx_eval_expression(cmd.mb_str(wxConvUTF8));
1485
1486 // If we're not showing debug window, log errors and warnings:
1487 const auto output = mDebugOutput.Translation();
1488 if (!output.empty() && !mDebug && !mTrace) {
1489 /* i18n-hint: An effect "returned" a message.*/
1490 wxLogMessage(wxT("\'%s\' returned:\n%s"),
1491 mName.Translation(), output);
1492 }
1493
1494 // Audacity has no idea how long Nyquist processing will take, but
1495 // can monitor audio being returned.
1496 // Anything other than audio should be returned almost instantly
1497 // so notify the user that process has completed (bug 558)
1498 if ((rval != nyx_audio) && ((mCount + mCurNumChannels) == mNumSelectedChannels)) {
1499 if (mCurNumChannels == 1) {
1500 TrackProgress(mCount, 1.0, XO("Processing complete."));
1501 }
1502 else {
1503 TrackGroupProgress(mCount, 1.0, XO("Processing complete."));
1504 }
1505 }
1506
1507 if ((rval == nyx_audio) && (GetType() == EffectTypeTool)) {
1508 // Catch this first so that we can also handle other errors.
1509 mDebugOutput =
1510 /* i18n-hint: Don't translate ';type tool'. */
1511 XO("';type tool' effects cannot return audio from Nyquist.\n")
1512 + mDebugOutput;
1513 rval = nyx_error;
1514 }
1515
1516 if ((rval == nyx_labels) && (GetType() == EffectTypeTool)) {
1517 // Catch this first so that we can also handle other errors.
1518 mDebugOutput =
1519 /* i18n-hint: Don't translate ';type tool'. */
1520 XO("';type tool' effects cannot return labels from Nyquist.\n")
1521 + mDebugOutput;
1522 rval = nyx_error;
1523 }
1524
1525 if (rval == nyx_error) {
1526 // Return value is not valid type.
1527 // Show error in debug window if trace enabled, otherwise log.
1528 if (mTrace) {
1529 /* i18n-hint: "%s" is replaced by name of plug-in.*/
1530 mDebugOutput = XO("nyx_error returned from %s.\n")
1531 .Format( mName.empty() ? XO("plug-in") : mName )
1532 + mDebugOutput;
1533 mDebug = true;
1534 }
1535 else {
1536 wxLogMessage(
1537 "Nyquist returned nyx_error:\n%s", mDebugOutput.Translation());
1538 }
1539 return false;
1540 }
1541
1542 if (rval == nyx_list) {
1543 wxLogMessage("Nyquist returned nyx_list");
1544 if (GetType() == EffectTypeTool) {
1545 mProjectChanged = true;
1546 } else {
1547 Effect::MessageBox(XO("Nyquist returned a list.") );
1548 }
1549 return true;
1550 }
1551
1552 if (rval == nyx_string) {
1553 // Assume the string has already been translated within the Lisp runtime
1554 // if necessary, by one of the gettext functions defined below, before it
1555 // is communicated back to C++
1556 auto msg = Verbatim( NyquistToWxString(nyx_get_string()) );
1557 if (!msg.empty()) { // Empty string may be used as a No-Op return value.
1558 Effect::MessageBox( msg );
1559 }
1560 else if (GetType() == EffectTypeTool) {
1561 // ;tools may change the project with aud-do commands so
1562 // it is essential that the state is added to history.
1563 mProjectChanged = true;
1564 return true;
1565 }
1566 else {
1567 // A true no-op.
1568 return true;
1569 }
1570
1571 // True if not process type.
1572 // If not returning audio from process effect,
1573 // return first result then stop (disables preview)
1574 // but allow all output from Nyquist Prompt.
1575 return (GetType() != EffectTypeProcess || mIsPrompt);
1576 }
1577
1578 if (rval == nyx_double) {
1579 auto str = XO("Nyquist returned the value: %f")
1580 .Format(nyx_get_double());
1582 return (GetType() != EffectTypeProcess || mIsPrompt);
1583 }
1584
1585 if (rval == nyx_int) {
1586 auto str = XO("Nyquist returned the value: %d")
1587 .Format(nyx_get_int());
1589 return (GetType() != EffectTypeProcess || mIsPrompt);
1590 }
1591
1592 if (rval == nyx_labels) {
1593 mProjectChanged = true;
1594 unsigned int numLabels = nyx_get_num_labels();
1595 unsigned int l;
1596 auto ltrack = * mOutputTracks->Any< LabelTrack >().begin();
1597 if (!ltrack) {
1598 auto newTrack = std::make_shared<LabelTrack>();
1599 //new track name should be unique among the names in the list of input tracks, not output
1600 newTrack->SetName(inputTracks()->MakeUniqueTrackName(LabelTrack::GetDefaultName()));
1601 ltrack = static_cast<LabelTrack*>(
1602 AddToOutputTracks(newTrack));
1603 }
1604
1605 for (l = 0; l < numLabels; l++) {
1606 double t0, t1;
1607 const char *str;
1608
1609 // PRL: to do:
1610 // let Nyquist analyzers define more complicated selections
1611 nyx_get_label(l, &t0, &t1, &str);
1612
1613 ltrack->AddLabel(SelectedRegion(t0 + mT0, t1 + mT0), UTF8CTOWX(str));
1614 }
1615 return (GetType() != EffectTypeProcess || mIsPrompt);
1616 }
1617
1618 wxASSERT(rval == nyx_audio);
1619
1620 int outChannels = nyx_get_audio_num_channels();
1621 if (outChannels > (int)mCurNumChannels) {
1622 Effect::MessageBox( XO("Nyquist returned too many audio channels.\n") );
1623 return false;
1624 }
1625
1626 if (outChannels == -1) {
1628 XO("Nyquist returned one audio channel as an array.\n") );
1629 return false;
1630 }
1631
1632 if (outChannels == 0) {
1633 Effect::MessageBox( XO("Nyquist returned an empty array.\n") );
1634 return false;
1635 }
1636
1637 std::shared_ptr<WaveTrack> outputTrack[2];
1638
1639 double rate = mCurTrack[0]->GetRate();
1640 for (int i = 0; i < outChannels; i++) {
1641 if (outChannels == (int)mCurNumChannels) {
1642 rate = mCurTrack[i]->GetRate();
1643 }
1644
1645 outputTrack[i] = mCurTrack[i]->EmptyCopy();
1646 outputTrack[i]->SetRate( rate );
1647
1648 // Clean the initial buffer states again for the get callbacks
1649 // -- is this really needed?
1650 mCurBuffer[i].reset();
1651 }
1652
1653 // Now fully evaluate the sound
1654 int success;
1655 {
1656 auto vr0 = valueRestorer( mOutputTrack[0], outputTrack[0].get() );
1657 auto vr1 = valueRestorer( mOutputTrack[1], outputTrack[1].get() );
1658 success = nyx_get_audio(StaticPutCallback, (void *)this);
1659 }
1660
1661 // See if GetCallback found read errors
1662 {
1663 auto pException = mpException;
1664 mpException = {};
1665 if (pException)
1666 std::rethrow_exception( pException );
1667 }
1668
1669 if (!success)
1670 return false;
1671
1672 for (int i = 0; i < outChannels; i++) {
1673 outputTrack[i]->Flush();
1674 mOutputTime = outputTrack[i]->GetEndTime();
1675
1676 if (mOutputTime <= 0) {
1677 Effect::MessageBox( XO("Nyquist returned nil audio.\n") );
1678 return false;
1679 }
1680 }
1681
1682 for (size_t i = 0; i < mCurNumChannels; i++) {
1683 WaveTrack *out;
1684
1685 if (outChannels == (int)mCurNumChannels) {
1686 out = outputTrack[i].get();
1687 }
1688 else {
1689 out = outputTrack[0].get();
1690 }
1691
1692 if (mMergeClips < 0) {
1693 // Use sample counts to determine default behaviour - times will rarely be equal.
1694 bool bMergeClips = (out->TimeToLongSamples(mT0) + out->TimeToLongSamples(mOutputTime) ==
1695 out->TimeToLongSamples(mT1));
1696 mCurTrack[i]->ClearAndPaste(mT0, mT1, out, mRestoreSplits, bMergeClips);
1697 }
1698 else {
1700 }
1701
1702 // If we were first in the group adjust non-selected group tracks
1703 if (mFirstInGroup) {
1704 for (auto t : SyncLock::Group(mCurTrack[i]))
1705 {
1706 if (!t->GetSelected() && SyncLock::IsSyncLockSelected(t)) {
1707 t->SyncLockAdjust(mT1, mT0 + out->GetEndTime());
1708 }
1709 }
1710 }
1711
1712 // Only the first channel can be first in its group
1713 mFirstInGroup = false;
1714 }
1715
1716 mProjectChanged = true;
1717 return true;
1718}
int format
Definition: ExportPCM.cpp:56
#define UTF8CTOWX(X)
Definition: Internat.h:159
@ floatSample
Definition: SampleFormat.h:34
@ int16Sample
Definition: SampleFormat.h:32
@ int24Sample
Definition: SampleFormat.h:33
TranslatableString GetName() const
const TrackList * inputTracks() const
Definition: EffectBase.h:104
bool TrackGroupProgress(int whichGroup, double frac, const TranslatableString &={}) const
Definition: Effect.cpp:693
Track * AddToOutputTracks(const std::shared_ptr< Track > &t)
Definition: Effect.cpp:760
bool TrackProgress(int whichTrack, double frac, const TranslatableString &={}) const
Definition: Effect.cpp:683
static wxString GetDefaultName()
Definition: LabelTrack.cpp:58
WaveTrack * mOutputTrack[2]
Definition: Nyquist.h:300
static int StaticPutCallback(float *buffer, int channel, int64_t start, int64_t len, int64_t totlen, void *userdata)
Definition: Nyquist.cpp:2573
static wxString NyquistToWxString(const char *nyqString)
Definition: Nyquist.cpp:1724
static int StaticGetCallback(float *buffer, int channel, int64_t start, int64_t len, int64_t totlen, void *userdata)
Definition: Nyquist.cpp:2506
Defines a selected portion of a project.
bool SpectralSelectionEnabled() const
static bool IsSyncLockSelected(const Track *pTrack)
Definition: SyncLock.cpp:43
virtual double GetStartTime() const =0
R TypeSwitch(const Functions &...functions)
Use this function rather than testing track type explicitly and making down-casts.
Definition: Track.h:832
virtual double GetEndTime() const =0
WaveClipPointers SortedClipArray()
Definition: WaveTrack.cpp:2733
const SpectrogramSettings & GetSpectrogramSettings() const
Definition: WaveTrack.cpp:799
std::pair< float, float > GetMinMax(double t0, double t1, bool mayThrow=true) const
Definition: WaveTrack.cpp:2050
float GetRMS(double t0, double t1, bool mayThrow=true) const
Definition: WaveTrack.cpp:2089
double GetEndTime() const override
Get the time at which the last clip in the track ends, plus recorded stuff.
Definition: WaveTrack.cpp:2025
double GetRate() const override
Definition: WaveTrack.cpp:479
void ClearAndPaste(double t0, double t1, const Track *src, bool preserve=true, bool merge=true, const TimeWarper *effectWarper=NULL)
Definition: WaveTrack.cpp:915
Holder EmptyCopy(const SampleBlockFactoryPtr &pFactory={}, bool keepLink=true) const
Definition: WaveTrack.cpp:705
long long as_long_long() const
Definition: SampleCount.h:48
auto begin(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
Definition: PackedArray.h:150

References Effect::AddToOutputTracks(), sampleCount::as_long_long(), PackedArray::begin(), TrackList::Channels(), WaveTrack::ClearAndPaste(), EffectTypeGenerate, EffectTypeProcess, EffectTypeTool, TranslatableString::empty(), WaveTrack::EmptyCopy(), EscapeString(), WaveTrackView::Find(), floatSample, format, LabelTrack::GetDefaultName(), Track::GetEndTime(), WaveTrack::GetEndTime(), WaveTrack::GetMinMax(), ComponentInterface::GetName(), anonymous_namespace{TimeTrack.cpp}::GetRate(), WaveTrack::GetRate(), WaveTrack::GetRMS(), WaveTrack::GetSpectrogramSettings(), Track::GetStartTime(), GetType(), SyncLock::Group(), EffectBase::inputTracks(), int16Sample, int24Sample, SyncLock::IsSyncLockSelected(), mCmd, mCompiler, mControls, mCount, mCurBuffer, mCurLen, mCurNumChannels, mCurTrack, mDebug, mDebugOutput, Effect::MessageBox(), mExternal, mFirstInGroup, min(), mIsPrompt, mIsSal, mMergeClips, mName, mNumSelectedChannels, mOutputTime, mOutputTrack, EffectBase::mOutputTracks, mPerTrackProps, mpException, mProjectChanged, mProps, mRestoreSplits, EffectBase::mT0, EffectBase::mT1, mTrace, mTrackIndex, mVersion, NYQ_CTRL_CHOICE, NYQ_CTRL_FILE, NYQ_CTRL_FLOAT, NYQ_CTRL_FLOAT_TEXT, NYQ_CTRL_INT, NYQ_CTRL_INT_TEXT, NYQ_CTRL_STRING, NYQ_CTRL_TIME, NyquistToWxString(), WaveTrack::SortedClipArray(), SpectrogramSettings::SpectralSelectionEnabled(), StaticGetCallback(), StaticPutCallback(), str, SampleTrack::TimeToLongSamples(), Internat::ToString(), Effect::TrackGroupProgress(), Effect::TrackProgress(), TranslatableString::Translation(), Track::TypeSwitch(), UTF8CTOWX, valueRestorer(), Verbatim(), wxT(), and XO.

Referenced by Process().

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

◆ PutCallback()

int NyquistEffect::PutCallback ( float *  buffer,
int  channel,
int64_t  start,
int64_t  len,
int64_t  totlen 
)
private

Definition at line 2581 of file Nyquist.cpp.

2583{
2584 // Don't let C++ exceptions propagate through the Nyquist library
2585 return GuardedCall<int>( [&] {
2586 if (channel == 0) {
2587 double progress = mScale*((float)(start+len)/totlen);
2588
2589 if (progress > mProgressOut) {
2590 mProgressOut = progress;
2591 }
2592
2594 return -1;
2595 }
2596 }
2597
2598 mOutputTrack[channel]->Append((samplePtr)buffer, floatSample, len);
2599
2600 return 0; // success
2601 }, MakeSimpleGuard( -1 ) ); // translate all exceptions into failure
2602}
SimpleGuard< R > MakeSimpleGuard(R value) noexcept(noexcept(SimpleGuard< R >{ value }))
Convert a value to a handler function returning that value, suitable for GuardedCall<R>
char * samplePtr
Definition: SampleFormat.h:49
bool Append(constSamplePtr buffer, sampleFormat format, size_t len, unsigned int stride=1) override
Definition: WaveTrack.cpp:1776

References WaveTrack::Append(), floatSample, MakeSimpleGuard(), mOutputTrack, mProgressIn, mProgressOut, mProgressTot, mScale, and Effect::TotalProgress().

Referenced by StaticPutCallback().

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

◆ RedirectOutput()

void NyquistEffect::RedirectOutput ( )

Definition at line 1845 of file Nyquist.cpp.

1846{
1847 mRedirectOutput = true;
1848}

References mRedirectOutput.

Referenced by NyqBench::OnGo().

Here is the caller graph for this function:

◆ resolveFilePath()

void NyquistEffect::resolveFilePath ( wxString &  path,
FileExtension  extension = {} 
)
staticprivate

A file path given to Nyquist may be a platform-independent canonicalized form using certain abbreviations that are expanded into the platform-dependent equivalent.

If the path names only a directory, also append "/untitled" plus extension

Definition at line 3306 of file Nyquist.cpp.

3308{
3309#if defined(__WXMSW__)
3310 path.Replace("/", wxFileName::GetPathSeparator());
3311#endif
3312
3313 path.Trim(true).Trim(false);
3314
3315 typedef std::unordered_map<wxString, FilePath> map;
3316 map pathKeys = {
3317 {"*home*", wxGetHomeDir()},
3318 {"~", wxGetHomeDir()},
3319 {"*default*", FileNames::DefaultToDocumentsFolder("").GetPath()},
3320 {"*export*", FileNames::FindDefaultPath(FileNames::Operation::Export)},
3321 {"*save*", FileNames::FindDefaultPath(FileNames::Operation::Save)},
3322 {"*config*", FileNames::DataDir()}
3323 };
3324
3325 int characters = path.Find(wxFileName::GetPathSeparator());
3326 if(characters == wxNOT_FOUND) // Just a path or just a file name
3327 {
3328 if (path.empty())
3329 path = "*default*";
3330
3331 if (pathKeys.find(path) != pathKeys.end())
3332 {
3333 // Keyword found, so assume this is the intended directory.
3334 path = pathKeys[path] + wxFileName::GetPathSeparator();
3335 }
3336 else // Just a file name
3337 {
3338 path = pathKeys["*default*"] + wxFileName::GetPathSeparator() + path;
3339 }
3340 }
3341 else // path + file name
3342 {
3343 wxString firstDir = path.Left(characters);
3344 wxString rest = path.Mid(characters);
3345
3346 if (pathKeys.find(firstDir) != pathKeys.end())
3347 {
3348 path = pathKeys[firstDir] + rest;
3349 }
3350 }
3351
3352 wxFileName fname = path;
3353
3354 // If the directory is invalid, better to leave it as is (invalid) so that
3355 // the user sees the error rather than an unexpected file path.
3356 if (fname.wxFileName::IsOk() && fname.GetFullName().empty())
3357 {
3358 path = fname.GetPathWithSep() + _("untitled");
3359 if (!extension.empty())
3360 path = path + '.' + extension;
3361 }
3362}
FILES_API wxFileNameWrapper DefaultToDocumentsFolder(const wxString &preference)
FILES_API FilePath FindDefaultPath(Operation op)

References _, FileNames::DataDir(), FileNames::DefaultToDocumentsFolder(), and FileNames::FindDefaultPath().

Referenced by BuildEffectWindow(), OnFileButton(), SaveSettings(), and TransferDataFromEffectWindow().

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

◆ SaveSettings()

bool NyquistEffect::SaveSettings ( const EffectSettings settings,
CommandParameters parms 
) const
overridevirtual

Store settings as keys and values.

The override may assume parms is initially empty

Returns
true on success

Reimplemented from Effect.

Definition at line 374 of file Nyquist.cpp.

376{
377 if (mIsPrompt)
378 {
379 parms.Write(KEY_Command, mInputCmd);
380 parms.Write(KEY_Parameters, mParameters);
381
382 return true;
383 }
384
385 for (size_t c = 0, cnt = mControls.size(); c < cnt; c++)
386 {
387 const NyqControl & ctrl = mControls[c];
388 double d = ctrl.val;
389
390 if (d == UNINITIALIZED_CONTROL && ctrl.type != NYQ_CTRL_STRING)
391 {
392 d = GetCtrlValue(ctrl.valStr);
393 }
394
395 if (ctrl.type == NYQ_CTRL_FLOAT || ctrl.type == NYQ_CTRL_FLOAT_TEXT ||
396 ctrl.type == NYQ_CTRL_TIME)
397 {
398 parms.Write(ctrl.var, d);
399 }
400 else if (ctrl.type == NYQ_CTRL_INT || ctrl.type == NYQ_CTRL_INT_TEXT)
401 {
402 parms.Write(ctrl.var, (int) d);
403 }
404 else if (ctrl.type == NYQ_CTRL_CHOICE)
405 {
406 // untranslated
407 parms.WriteEnum(ctrl.var, (int) d,
408 ctrl.choices.data(), ctrl.choices.size());
409 }
410 else if (ctrl.type == NYQ_CTRL_STRING)
411 {
412 parms.Write(ctrl.var, ctrl.valStr);
413 }
414 else if (ctrl.type == NYQ_CTRL_FILE)
415 {
416 // Convert the given path string to platform-dependent equivalent
417 resolveFilePath(const_cast<wxString&>(ctrl.valStr));
418 parms.Write(ctrl.var, ctrl.valStr);
419 }
420 }
421
422 return true;
423}
#define UNINITIALIZED_CONTROL
Definition: Nyquist.cpp:116
bool WriteEnum(const wxString &key, int value, const EnumValueSymbol choices[], size_t nChoices)

References NyqControl::choices, GetCtrlValue(), KEY_Command, KEY_Parameters, mControls, mInputCmd, mIsPrompt, mParameters, NYQ_CTRL_CHOICE, NYQ_CTRL_FILE, NYQ_CTRL_FLOAT, NYQ_CTRL_FLOAT_TEXT, NYQ_CTRL_INT, NYQ_CTRL_INT_TEXT, NYQ_CTRL_STRING, NYQ_CTRL_TIME, resolveFilePath(), NyqControl::type, UNINITIALIZED_CONTROL, NyqControl::val, NyqControl::valStr, NyqControl::var, and CommandParameters::WriteEnum().

Referenced by ShowHostInterface(), and VisitSettings().

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

◆ SetCommand()

void NyquistEffect::SetCommand ( const wxString &  cmd)

Definition at line 1850 of file Nyquist.cpp.

1851{
1852 mExternal = true;
1853
1854 if (cmd.size()) {
1855 ParseCommand(cmd);
1856 }
1857}

References mExternal, and ParseCommand().

Referenced by NyqBench::OnGo(), and ShowHostInterface().

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

◆ SetLispVarsFromParameters()

int NyquistEffect::SetLispVarsFromParameters ( const CommandParameters parms,
bool  bTestOnly 
)

Definition at line 498 of file Nyquist.cpp.

499{
500 int badCount = 0;
501 // First pass verifies values
502 for (size_t c = 0, cnt = mControls.size(); c < cnt; c++)
503 {
504 NyqControl & ctrl = mControls[c];
505 bool good = false;
506
507 // This GetCtrlValue code is preserved from former code,
508 // but probably is pointless. The value d isn't used later,
509 // and GetCtrlValue does not appear to have important needed
510 // side effects.
511 if (!bTestOnly) {
512 double d = ctrl.val;
513 if (d == UNINITIALIZED_CONTROL && ctrl.type != NYQ_CTRL_STRING)
514 {
515 d = GetCtrlValue(ctrl.valStr);
516 }
517 }
518
519 if (ctrl.type == NYQ_CTRL_FLOAT || ctrl.type == NYQ_CTRL_FLOAT_TEXT ||
520 ctrl.type == NYQ_CTRL_TIME)
521 {
522 double val;
523 good = parms.Read(ctrl.var, &val) &&
524 val >= ctrl.low &&
525 val <= ctrl.high;
526 if (good && !bTestOnly)
527 ctrl.val = val;
528 }
529 else if (ctrl.type == NYQ_CTRL_INT || ctrl.type == NYQ_CTRL_INT_TEXT)
530 {
531 int val;
532 good = parms.Read(ctrl.var, &val) &&
533 val >= ctrl.low &&
534 val <= ctrl.high;
535 if (good && !bTestOnly)
536 ctrl.val = (double)val;
537 }
538 else if (ctrl.type == NYQ_CTRL_CHOICE)
539 {
540 int val;
541 // untranslated
542 good = parms.ReadEnum(ctrl.var, &val,
543 ctrl.choices.data(), ctrl.choices.size()) &&
544 val != wxNOT_FOUND;
545 if (good && !bTestOnly)
546 ctrl.val = (double)val;
547 }
548 else if (ctrl.type == NYQ_CTRL_STRING || ctrl.type == NYQ_CTRL_FILE)
549 {
550 wxString val;
551 good = parms.Read(ctrl.var, &val);
552 if (good && !bTestOnly)
553 ctrl.valStr = val;
554 }
555 else if (ctrl.type == NYQ_CTRL_TEXT)
556 {
557 // This "control" is just fixed text (nothing to save or restore),
558 // Does not count for good/bad counting.
559 good = true;
560 }
561 badCount += !good ? 1 : 0;
562 }
563 return badCount;
564}
bool ReadEnum(const wxString &key, int *pi, const EnumValueSymbol choices[], size_t nChoices, const ObsoleteMap obsoletes[]=nullptr, size_t nObsoletes=0) const

References NyqControl::choices, GetCtrlValue(), NyqControl::high, NyqControl::low, mControls, NYQ_CTRL_CHOICE, NYQ_CTRL_FILE, NYQ_CTRL_FLOAT, NYQ_CTRL_FLOAT_TEXT, NYQ_CTRL_INT, NYQ_CTRL_INT_TEXT, NYQ_CTRL_STRING, NYQ_CTRL_TEXT, NYQ_CTRL_TIME, CommandParameters::ReadEnum(), NyqControl::type, UNINITIALIZED_CONTROL, NyqControl::val, NyqControl::valStr, and NyqControl::var.

Referenced by DoLoadSettings().

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

◆ ShowHostInterface()

int NyquistEffect::ShowHostInterface ( wxWindow &  parent,
const EffectDialogFactory factory,
std::shared_ptr< EffectInstance > &  pInstance,
EffectSettingsAccess access,
bool  forceModal = false 
)
overridevirtual

Usually applies factory to self and given access.

But there are a few unusual overrides for historical reasons

Parameters
pInstancemay be passed to factory, and is only guaranteed to have lifetime suitable for a modal dialog, unless the dialog stores a copy of pInstance
accessis only guaranteed to have lifetime suitable for a modal dialog, unless the dialog stores access.shared_from_this()
Returns
0 if destructive effect processing should not proceed (and there may be a non-modal dialog still opened); otherwise, modal dialog return code

Reimplemented from Effect.

Definition at line 1059 of file Nyquist.cpp.

1063{
1064 int res = wxID_APPLY;
1066 // Show the normal (prompt or effect) interface
1068 parent, factory, pInstance, access, forceModal);
1069 }
1070
1071
1072 // Remember if the user clicked debug
1073 mDebug = (res == eDebugID);
1074
1075 // We're done if the user clicked "Close", we are not the Nyquist Prompt,
1076 // or the program currently loaded into the prompt doesn't have a UI.
1077 if (!res || !mIsPrompt || mControls.size() == 0 || !pInstance)
1078 return res;
1079
1080 // Nyquist prompt was OK, but gave us some magic ;control comments to
1081 // reinterpret into a second dialog
1082
1084 effect.SetCommand(mInputCmd);
1085 Finally Do{[&]{
1086 // A second dialog will use effect as a pushed event handler.
1087 // wxWidgets delays window destruction until idle time.
1088 // Yield to destroy the dialog while effect is still in scope.
1090 }};
1091
1092 // Must give effect its own settings to interpret, not those in access
1093 // Let's also give it its own instance
1094 auto newSettings = effect.MakeSettings();
1095 auto pNewInstance = effect.MakeInstance();
1096 auto newAccess = std::make_shared<SimpleEffectSettingsAccess>(newSettings);
1097
1098 if (IsBatchProcessing()) {
1099 effect.SetBatchProcessing();
1100
1103 effect.LoadSettings(cp, newSettings);
1104
1105 // Show the normal (prompt or effect) interface
1106 res = effect.ShowHostInterface(
1107 parent, factory, pNewInstance, *newAccess, forceModal);
1108 if (res) {
1110 effect.SaveSettings(newSettings, cp);
1112 }
1113 }
1114 else {
1115 if (!factory)
1116 return 0;
1117 res = effect.ShowHostInterface(
1118 parent, factory, pNewInstance, *newAccess, false );
1119 if (!res)
1120 return 0;
1121
1122 // Wrap the new settings in the old settings
1124 auto &nyquistSettings = GetSettings(settings);
1125 nyquistSettings.proxySettings = std::move(newSettings);
1126 nyquistSettings.proxyDebug = this->mDebug;
1127 nyquistSettings.controls = move(effect.mControls);
1128 return nullptr;
1129 });
1130 }
1131 if (!pNewInstance)
1132 // Propagate the failure from nested ShowHostInterface
1133 pInstance.reset();
1134 return res;
1135}
@ eDebugID
Definition: ShuttleGui.h:616
bool GetParameters(wxString &parms)
int ShowHostInterface(wxWindow &parent, const EffectDialogFactory &factory, std::shared_ptr< EffectInstance > &pInstance, EffectSettingsAccess &access, bool forceModal=false) override
Usually applies factory to self and given access.
Definition: Effect.cpp:165
unsigned TestUIFlags(unsigned mask)
Definition: Effect.cpp:555
void ModifySettings(Function &&function)
Do a correct read-modify-write of settings.
void Yield()
Dispatch waiting events, including actions enqueued by CallAfter.
Definition: BasicUI.cpp:217
static RegisteredToolbarFactory factory
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:173

References eDebugID, cloud::factory, CommandParameters::GetParameters(), EffectWithSettings< NyquistSettings, StatefulEffect >::GetSettings(), Effect::IsBatchProcessing(), EffectManager::kRepeatNyquistPrompt, LoadSettings(), StatefulEffect::MakeInstance(), EffectWithSettings< Settings, Base >::MakeSettings(), mControls, mDebug, mInputCmd, mIsPrompt, EffectSettingsAccess::ModifySettings(), mParameters, NYQUIST_WORKER_ID, SaveSettings(), Effect::SetBatchProcessing(), SetCommand(), CommandParameters::SetParameters(), settings(), Effect::ShowHostInterface(), ShowHostInterface(), Effect::TestUIFlags(), and BasicUI::Yield().

Referenced by ShowHostInterface().

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

◆ StaticGetCallback()

int NyquistEffect::StaticGetCallback ( float *  buffer,
int  channel,
int64_t  start,
int64_t  len,
int64_t  totlen,
void *  userdata 
)
staticprivate

Definition at line 2506 of file Nyquist.cpp.

2509{
2510 NyquistEffect *This = (NyquistEffect *)userdata;
2511 return This->GetCallback(buffer, channel, start, len, totlen);
2512}
int GetCallback(float *buffer, int channel, int64_t start, int64_t len, int64_t totlen)
Definition: Nyquist.cpp:2514

References GetCallback().

Referenced by ProcessOne().

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

◆ StaticOSCallback()

void NyquistEffect::StaticOSCallback ( void *  userdata)
staticprivate

Definition at line 2620 of file Nyquist.cpp.

2621{
2622 ((NyquistEffect *)This)->OSCallback();
2623}

Referenced by Process().

Here is the caller graph for this function:

◆ StaticOutputCallback()

void NyquistEffect::StaticOutputCallback ( int  c,
void *  userdata 
)
staticprivate

Definition at line 2604 of file Nyquist.cpp.

2605{
2606 ((NyquistEffect *)This)->OutputCallback(c);
2607}

Referenced by Process().

Here is the caller graph for this function:

◆ StaticPutCallback()

int NyquistEffect::StaticPutCallback ( float *  buffer,
int  channel,
int64_t  start,
int64_t  len,
int64_t  totlen,
void *  userdata 
)
staticprivate

Definition at line 2573 of file Nyquist.cpp.

2576{
2577 NyquistEffect *This = (NyquistEffect *)userdata;
2578 return This->PutCallback(buffer, channel, start, len, totlen);
2579}
int PutCallback(float *buffer, int channel, int64_t start, int64_t len, int64_t totlen)
Definition: Nyquist.cpp:2581

References PutCallback().

Referenced by ProcessOne().

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

◆ Stop()

void NyquistEffect::Stop ( )

Definition at line 1869 of file Nyquist.cpp.

1870{
1871 mStop = true;
1872}

References mStop.

Referenced by NyqBench::OnStop().

Here is the caller graph for this function:

◆ ToTimeFormat()

wxString NyquistEffect::ToTimeFormat ( double  t)
private

Definition at line 3376 of file Nyquist.cpp.

3377{
3378 int seconds = static_cast<int>(t);
3379 int hh = seconds / 3600;
3380 int mm = seconds % 3600;
3381 mm = mm / 60;
3382 return wxString::Format("%d:%d:%.3f", hh, mm, t - (hh * 3600 + mm * 60));
3383}

Referenced by OnTime().

Here is the caller graph for this function:

◆ TransferDataFromEffectWindow()

bool NyquistEffect::TransferDataFromEffectWindow ( )
private

Definition at line 2734 of file Nyquist.cpp.

2735{
2736 if (mControls.size() == 0)
2737 {
2738 return true;
2739 }
2740
2741 for (unsigned int i = 0; i < mControls.size(); i++)
2742 {
2743 NyqControl *ctrl = &mControls[i];
2744
2745 if (ctrl->type == NYQ_CTRL_STRING || ctrl->type == NYQ_CTRL_TEXT)
2746 {
2747 continue;
2748 }
2749
2750 if (ctrl->val == UNINITIALIZED_CONTROL)
2751 {
2752 ctrl->val = GetCtrlValue(ctrl->valStr);
2753 }
2754
2755 if (ctrl->type == NYQ_CTRL_CHOICE)
2756 {
2757 continue;
2758 }
2759
2760 if (ctrl->type == NYQ_CTRL_FILE)
2761 {
2762 resolveFilePath(ctrl->valStr);
2763
2764 wxString path;
2765 if (ctrl->valStr.StartsWith("\"", &path))
2766 {
2767 // Validate if a list of quoted paths.
2768 if (path.EndsWith("\"", &path))
2769 {
2770 path.Replace("\"\"", "\"");
2771 wxStringTokenizer tokenizer(path, "\"");
2772 while (tokenizer.HasMoreTokens())
2773 {
2774 wxString token = tokenizer.GetNextToken();
2775 if(!validatePath(token))
2776 {
2777 const auto message =
2778 XO("\"%s\" is not a valid file path.").Format( token );
2780 message,
2781 wxOK | wxICON_EXCLAMATION | wxCENTRE,
2782 XO("Error") );
2783 return false;
2784 }
2785 }
2786 continue;
2787 }
2788 else
2789 {
2790 const auto message =
2791 /* i18n-hint: Warning that there is one quotation mark rather than a pair.*/
2792 XO("Mismatched quotes in\n%s").Format( ctrl->valStr );
2794 message,
2795 wxOK | wxICON_EXCLAMATION | wxCENTRE,
2796 XO("Error") );
2797 return false;
2798 }
2799 }
2800 // Validate a single path.
2801 else if (validatePath(ctrl->valStr))
2802 {
2803 continue;
2804 }
2805
2806 // Validation failed
2807 const auto message =
2808 XO("\"%s\" is not a valid file path.").Format( ctrl->valStr );
2810 message,
2811 wxOK | wxICON_EXCLAMATION | wxCENTRE,
2812 XO("Error") );
2813 return false;
2814 }
2815
2816 if (ctrl->type == NYQ_CTRL_TIME)
2817 {
2818 NumericTextCtrl *n = (NumericTextCtrl *) mUIParent->FindWindow(ID_Time + i);
2819 ctrl->val = n->GetValue();
2820 }
2821
2822 if (ctrl->type == NYQ_CTRL_INT_TEXT && ctrl->lowStr.IsSameAs(wxT("nil"), false)) {
2823 ctrl->low = INT_MIN;
2824 }
2825 else if ((ctrl->type == NYQ_CTRL_FLOAT_TEXT || ctrl->type == NYQ_CTRL_TIME) &&
2826 ctrl->lowStr.IsSameAs(wxT("nil"), false))
2827 {
2828 ctrl->low = -(FLT_MAX);
2829 }
2830 else
2831 {
2832 ctrl->low = GetCtrlValue(ctrl->lowStr);
2833 }
2834
2835 if (ctrl->type == NYQ_CTRL_INT_TEXT && ctrl->highStr.IsSameAs(wxT("nil"), false)) {
2836 ctrl->high = INT_MAX;
2837 }
2838 else if ((ctrl->type == NYQ_CTRL_FLOAT_TEXT || ctrl->type == NYQ_CTRL_TIME) &&
2839 ctrl->highStr.IsSameAs(wxT("nil"), false))
2840 {
2841 ctrl->high = FLT_MAX;
2842 }
2843 else
2844 {
2845 ctrl->high = GetCtrlValue(ctrl->highStr);
2846 }
2847
2848 if (ctrl->high < ctrl->low)
2849 {
2850 ctrl->high = ctrl->low + 1;
2851 }
2852
2853 if (ctrl->val < ctrl->low)
2854 {
2855 ctrl->val = ctrl->low;
2856 }
2857
2858 if (ctrl->val > ctrl->high)
2859 {
2860 ctrl->val = ctrl->high;
2861 }
2862
2863 ctrl->ticks = 1000;
2864 if (ctrl->type == NYQ_CTRL_INT &&
2865 (ctrl->high - ctrl->low < ctrl->ticks))
2866 {
2867 ctrl->ticks = (int)(ctrl->high - ctrl->low);
2868 }
2869 }
2870
2871 return true;
2872}
bool validatePath(wxString path)
Definition: Nyquist.cpp:3365

References GetCtrlValue(), NumericConverter::GetValue(), NyqControl::high, NyqControl::highStr, ID_Time, NyqControl::low, NyqControl::lowStr, mControls, Effect::MessageBox(), Effect::mUIParent, NYQ_CTRL_CHOICE, NYQ_CTRL_FILE, NYQ_CTRL_FLOAT_TEXT, NYQ_CTRL_INT, NYQ_CTRL_INT_TEXT, NYQ_CTRL_STRING, NYQ_CTRL_TEXT, NYQ_CTRL_TIME, resolveFilePath(), NyqControl::ticks, NyqControl::type, UNINITIALIZED_CONTROL, NyqControl::val, validatePath(), NyqControl::valStr, wxT(), and XO.

Referenced by TransferDataFromWindow().

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

◆ TransferDataFromPromptWindow()

bool NyquistEffect::TransferDataFromPromptWindow ( )
private

Definition at line 2716 of file Nyquist.cpp.

2717{
2718 mInputCmd = mCommandText->GetValue();
2719
2720 // Un-correct smart quoting, bothersomely applied in wxTextCtrl by
2721 // the native widget of MacOS 10.9 SDK
2722 const wxString left = wxT("\u201c"), right = wxT("\u201d"), dumb = '"';
2723 mInputCmd.Replace(left, dumb, true);
2724 mInputCmd.Replace(right, dumb, true);
2725
2726 const wxString leftSingle = wxT("\u2018"), rightSingle = wxT("\u2019"),
2727 dumbSingle = '\'';
2728 mInputCmd.Replace(leftSingle, dumbSingle, true);
2729 mInputCmd.Replace(rightSingle, dumbSingle, true);
2730
2731 return ParseCommand(mInputCmd);
2732}

References mCommandText, mInputCmd, ParseCommand(), and wxT().

Referenced by TransferDataFromWindow().

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

◆ TransferDataFromWindow()

bool NyquistEffect::TransferDataFromWindow ( EffectSettings settings)
overridevirtual

Update the given settings from controls.

Reimplemented from Effect.

Definition at line 1175 of file Nyquist.cpp.

1176{
1177 if (!mUIParent->Validate() || !mUIParent->TransferDataFromWindow())
1178 {
1179 return false;
1180 }
1181
1182 if (mIsPrompt)
1183 {
1185 }
1187}
bool TransferDataFromPromptWindow()
Definition: Nyquist.cpp:2716
bool TransferDataFromEffectWindow()
Definition: Nyquist.cpp:2734

References mIsPrompt, Effect::mUIParent, TransferDataFromEffectWindow(), and TransferDataFromPromptWindow().

Here is the call graph for this function:

◆ TransferDataToEffectWindow()

bool NyquistEffect::TransferDataToEffectWindow ( )
private

Definition at line 2679 of file Nyquist.cpp.

2680{
2681 for (size_t i = 0, cnt = mControls.size(); i < cnt; i++)
2682 {
2683 NyqControl & ctrl = mControls[i];
2684
2685 if (ctrl.type == NYQ_CTRL_CHOICE)
2686 {
2687 const auto count = ctrl.choices.size();
2688
2689 int val = (int)ctrl.val;
2690 if (val < 0 || val >= (int)count)
2691 {
2692 val = 0;
2693 }
2694
2695 wxChoice *c = (wxChoice *) mUIParent->FindWindow(ID_Choice + i);
2696 c->SetSelection(val);
2697 }
2698 else if (ctrl.type == NYQ_CTRL_INT || ctrl.type == NYQ_CTRL_FLOAT)
2699 {
2700 // wxTextCtrls are handled by the validators
2701 double range = ctrl.high - ctrl.low;
2702 int val = (int)(0.5 + ctrl.ticks * (ctrl.val - ctrl.low) / range);
2703 wxSlider *s = (wxSlider *) mUIParent->FindWindow(ID_Slider + i);
2704 s->SetValue(val);
2705 }
2706 else if (ctrl.type == NYQ_CTRL_TIME)
2707 {
2708 NumericTextCtrl *n = (NumericTextCtrl *) mUIParent->FindWindow(ID_Time + i);
2709 n->SetValue(ctrl.val);
2710 }
2711 }
2712
2713 return true;
2714}

References NyqControl::choices, NyqControl::high, ID_Choice, ID_Slider, ID_Time, NyqControl::low, mControls, Effect::mUIParent, NYQ_CTRL_CHOICE, NYQ_CTRL_FLOAT, NYQ_CTRL_INT, NYQ_CTRL_TIME, NumericTextCtrl::SetValue(), NyqControl::ticks, NyqControl::type, and NyqControl::val.

Referenced by TransferDataToWindow().

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

◆ TransferDataToPromptWindow()

bool NyquistEffect::TransferDataToPromptWindow ( )
private

Definition at line 2672 of file Nyquist.cpp.

2673{
2674 mCommandText->ChangeValue(mInputCmd);
2675
2676 return true;
2677}

References mCommandText, and mInputCmd.

Referenced by TransferDataToWindow().

Here is the caller graph for this function:

◆ TransferDataToWindow()

bool NyquistEffect::TransferDataToWindow ( const EffectSettings settings)
overridevirtual

Update controls for the settings.

Reimplemented from Effect.

Definition at line 1153 of file Nyquist.cpp.

1154{
1155 mUIParent->TransferDataToWindow();
1156
1157 bool success;
1158 if (mIsPrompt)
1159 {
1160 success = TransferDataToPromptWindow();
1161 }
1162 else
1163 {
1164 success = TransferDataToEffectWindow();
1165 }
1166
1167 if (success)
1168 {
1170 }
1171
1172 return success;
1173}
bool EnablePreview(bool enable=true)
Definition: Effect.cpp:644
bool TransferDataToPromptWindow()
Definition: Nyquist.cpp:2672
bool TransferDataToEffectWindow()
Definition: Nyquist.cpp:2679

References Effect::EnablePreview(), mEnablePreview, mIsPrompt, Effect::mUIParent, TransferDataToEffectWindow(), and TransferDataToPromptWindow().

Here is the call graph for this function:

◆ UnQuote()

wxString NyquistEffect::UnQuote ( const wxString &  s,
bool  allowParens = true,
wxString *  pExtraString = nullptr 
)
staticprivate

Definition at line 1915 of file Nyquist.cpp.

1917{
1918 return UnQuoteMsgid( s, allowParens, pExtraString ).Translation();
1919}

References TranslatableString::Translation(), and UnQuoteMsgid().

Referenced by Parse(), ParseChoice(), ParseFileExtensions(), ParseFileTypes(), and UnQuoteMsgid().

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

◆ UnQuoteMsgid()

TranslatableString NyquistEffect::UnQuoteMsgid ( const wxString &  s,
bool  allowParens = true,
wxString *  pExtraString = nullptr 
)
staticprivate

Definition at line 1874 of file Nyquist.cpp.

1876{
1877 if (pExtraString)
1878 *pExtraString = wxString{};
1879
1880 int len = s.length();
1881 if (len >= 2 && s[0] == wxT('\"') && s[len - 1] == wxT('\"')) {
1882 auto unquoted = s.Mid(1, len - 2);
1883 // Sorry, no context strings, yet
1884 // (See also comments in NyquistEffectsModule::AutoRegisterPlugins)
1885 return TranslatableString{ unquoted, {} };
1886 }
1887 else if (allowParens &&
1888 len >= 2 && s[0] == wxT('(') && s[len - 1] == wxT(')')) {
1889 Tokenizer tzer;
1890 tzer.Tokenize(s, true, 1, 1);
1891 auto &tokens = tzer.tokens;
1892 if (tokens.size() > 1) {
1893 if (pExtraString && tokens[1][0] == '(') {
1894 // A choice with a distinct internal string form like
1895 // ("InternalString" (_ "Visible string"))
1896 // Recur to find the two strings
1897 *pExtraString = UnQuote(tokens[0], false);
1898 return UnQuoteMsgid(tokens[1]);
1899 }
1900 else {
1901 // Assume the first token was _ -- we don't check that
1902 // And the second is the string, which is internationalized
1903 // Sorry, no context strings, yet
1904 return UnQuoteMsgid( tokens[1], false );
1905 }
1906 }
1907 else
1908 return {};
1909 }
1910 else
1911 // If string was not quoted, assume no translation exists
1912 return Verbatim( s );
1913}

References NyquistEffect::Tokenizer::Tokenize(), NyquistEffect::Tokenizer::tokens, UnQuote(), UnQuoteMsgid(), Verbatim(), and wxT().

Referenced by ParseFileType(), UnQuote(), and UnQuoteMsgid().

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

◆ validatePath()

bool NyquistEffect::validatePath ( wxString  path)
private

Definition at line 3365 of file Nyquist.cpp.

3366{
3367 wxFileName fname = path;
3368 wxString dir = fname.GetPath();
3369
3370 return (fname.wxFileName::IsOk() &&
3371 wxFileName::DirExists(dir) &&
3372 !fname.GetFullName().empty());
3373}

Referenced by TransferDataFromEffectWindow().

Here is the caller graph for this function:

◆ VisitSettings() [1/2]

bool NyquistEffect::VisitSettings ( ConstSettingsVisitor visitor,
const EffectSettings settings 
) const
overridevirtual

Visit settings (read-only), if defined. false means no defined settings. Default implementation returns false

Reimplemented from Effect.

Definition at line 318 of file Nyquist.cpp.

320{
321 // For now we assume Nyquist can do get and set better than VisitSettings can,
322 // And so we ONLY use it for getting the signature.
323 if (auto pGa = dynamic_cast<ShuttleGetAutomation*>(&visitor)) {
324 SaveSettings(settings, *pGa->mpEap);
325 return true;
326 }
327 else if (auto pSd = dynamic_cast<ShuttleGetDefinition*>(&visitor);
328 !pSd)
329 // must be the NullShuttle
330 return true;
331
332 // Get the "definition," only for the help or info commands
333 if (mExternal)
334 return true;
335
336 if (mIsPrompt) {
337 visitor.Define( mInputCmd, KEY_Command, wxString{} );
338 visitor.Define( mParameters, KEY_Parameters, wxString{} );
339 return true;
340 }
341
342 for (const auto &ctrl : mControls) {
343 double d = ctrl.val;
344
345 if (d == UNINITIALIZED_CONTROL && ctrl.type != NYQ_CTRL_STRING)
346 d = GetCtrlValue(ctrl.valStr);
347
348 if (ctrl.type == NYQ_CTRL_FLOAT || ctrl.type == NYQ_CTRL_FLOAT_TEXT ||
349 ctrl.type == NYQ_CTRL_TIME)
350 visitor.Define( d, static_cast<const wxChar*>( ctrl.var.c_str() ),
351 (double)0.0, ctrl.low, ctrl.high, 1.0);
352 else if (ctrl.type == NYQ_CTRL_INT || ctrl.type == NYQ_CTRL_INT_TEXT) {
353 int x = d;
354 visitor.Define( x, static_cast<const wxChar*>( ctrl.var.c_str() ), 0,
355 static_cast<int>(ctrl.low), static_cast<int>(ctrl.high), 1);
356 //parms.Write(ctrl.var, (int) d);
357 }
358 else if (ctrl.type == NYQ_CTRL_CHOICE) {
359 // untranslated
360 int x = d;
361 //parms.WriteEnum(ctrl.var, (int) d, choices);
362 visitor.DefineEnum( x, static_cast<const wxChar*>( ctrl.var.c_str() ),
363 0, ctrl.choices.data(), ctrl.choices.size() );
364 }
365 else if (ctrl.type == NYQ_CTRL_STRING || ctrl.type == NYQ_CTRL_FILE) {
366 visitor.Define( ctrl.valStr, ctrl.var,
367 wxString{}, ctrl.lowStr, ctrl.highStr );
368 //parms.Write(ctrl.var, ctrl.valStr);
369 }
370 }
371 return true;
372}
bool SaveSettings(const EffectSettings &settings, CommandParameters &parms) const override
Store settings as keys and values.
Definition: Nyquist.cpp:374
virtual void Define(Arg< bool > var, const wxChar *key, bool vdefault, bool vmin=false, bool vmax=false, bool vscl=false)
Definition: Shuttle.cpp:359
virtual void DefineEnum(Arg< int > var, const wxChar *key, int vdefault, const EnumValueSymbol strings[], size_t nStrings)
Definition: Shuttle.cpp:394
SettingsVisitor that gets parameter values into a string.
SettingsVisitor that retrieves a JSON format definition of a command's parameters.

References SettingsVisitorBase< Const >::Define(), SettingsVisitorBase< Const >::DefineEnum(), GetCtrlValue(), KEY_Command, KEY_Parameters, mControls, mExternal, mInputCmd, mIsPrompt, mParameters, NYQ_CTRL_CHOICE, NYQ_CTRL_FILE, NYQ_CTRL_FLOAT, NYQ_CTRL_FLOAT_TEXT, NYQ_CTRL_INT, NYQ_CTRL_INT_TEXT, NYQ_CTRL_STRING, NYQ_CTRL_TIME, SaveSettings(), settings(), and UNINITIALIZED_CONTROL.

Here is the call graph for this function:

◆ VisitSettings() [2/2]

bool NyquistEffect::VisitSettings ( SettingsVisitor visitor,
EffectSettings settings 
)
overridevirtual

Visit settings (and maybe change them), if defined. false means no defined settings. Default implementation returns false

Reimplemented from Effect.

Definition at line 310 of file Nyquist.cpp.

312{
313 if (auto pSa = dynamic_cast<ShuttleSetAutomation*>(&visitor))
314 LoadSettings(*pSa->mpEap, settings);
315 return true;
316}
bool LoadSettings(const CommandParameters &parms, EffectSettings &settings) const override
Restore settings from keys and values.
Definition: Nyquist.cpp:425
SettingsVisitor that sets parameters to a value (from a string)

References LoadSettings(), and settings().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ NyquistEffectsModule

friend class NyquistEffectsModule
friend

Definition at line 316 of file Nyquist.h.

Member Data Documentation

◆ mAction

TranslatableString NyquistEffect::mAction
private

Definition at line 253 of file Nyquist.h.

Referenced by Parse().

◆ mAuthor

TranslatableString NyquistEffect::mAuthor
private

Definition at line 255 of file Nyquist.h.

Referenced by GetVendor(), and Parse().

◆ mBreak

bool NyquistEffect::mBreak
private

Definition at line 231 of file Nyquist.h.

Referenced by Break(), OSCallback(), and Process().

◆ mCategories

wxArrayString NyquistEffect::mCategories
private

Definition at line 302 of file Nyquist.h.

Referenced by Parse(), and ParseProgram().

◆ mCmd

wxString NyquistEffect::mCmd
private

Definition at line 250 of file Nyquist.h.

Referenced by ParseProgram(), and ProcessOne().

◆ mCommandText

wxTextCtrl* NyquistEffect::mCommandText
private

◆ mCompiler

bool NyquistEffect::mCompiler
private

Definition at line 235 of file Nyquist.h.

Referenced by Parse(), and ProcessOne().

◆ mCont

bool NyquistEffect::mCont
private

Definition at line 232 of file Nyquist.h.

Referenced by Continue(), OSCallback(), and Process().

◆ mControls

std::vector<NyqControl> NyquistEffect::mControls
private

◆ mCopyright

TranslatableString NyquistEffect::mCopyright
private

Definition at line 260 of file Nyquist.h.

Referenced by GetDescription(), and Parse().

◆ mCount

unsigned NyquistEffect::mCount
private

Definition at line 288 of file Nyquist.h.

Referenced by Process(), and ProcessOne().

◆ mCurBuffer

Buffer NyquistEffect::mCurBuffer[2]
private

Definition at line 296 of file Nyquist.h.

Referenced by GetCallback(), and ProcessOne().

◆ mCurBufferLen

size_t NyquistEffect::mCurBufferLen[2]
private

Definition at line 298 of file Nyquist.h.

Referenced by GetCallback().

◆ mCurBufferStart

sampleCount NyquistEffect::mCurBufferStart[2]
private

Definition at line 297 of file Nyquist.h.

Referenced by GetCallback().

◆ mCurLen

sampleCount NyquistEffect::mCurLen
private

Definition at line 283 of file Nyquist.h.

Referenced by GetCallback(), Process(), and ProcessOne().

◆ mCurNumChannels

unsigned NyquistEffect::mCurNumChannels
private

Definition at line 280 of file Nyquist.h.

Referenced by Process(), and ProcessOne().

◆ mCurStart

sampleCount NyquistEffect::mCurStart[2]
private

Definition at line 282 of file Nyquist.h.

Referenced by GetCallback(), and Process().

◆ mCurTrack

WaveTrack* NyquistEffect::mCurTrack[2]
private

Definition at line 281 of file Nyquist.h.

Referenced by GetCallback(), Process(), and ProcessOne().

◆ mDebug

bool NyquistEffect::mDebug
private

Definition at line 271 of file Nyquist.h.

Referenced by ParseProgram(), Process(), ProcessOne(), and ShowHostInterface().

◆ mDebugButton

bool NyquistEffect::mDebugButton
private

Definition at line 269 of file Nyquist.h.

Referenced by EnablesDebug(), Init(), Parse(), and ParseProgram().

◆ mDebugOutput

TranslatableString NyquistEffect::mDebugOutput
private

Definition at line 275 of file Nyquist.h.

Referenced by Process(), and ProcessOne().

◆ mDebugOutputStr

wxString NyquistEffect::mDebugOutputStr
private

Definition at line 274 of file Nyquist.h.

Referenced by OutputCallback(), and Process().

◆ mEnablePreview

bool NyquistEffect::mEnablePreview
private

Definition at line 268 of file Nyquist.h.

Referenced by Init(), Parse(), ParseProgram(), and TransferDataToWindow().

◆ mExternal

bool NyquistEffect::mExternal
private

Definition at line 238 of file Nyquist.h.

Referenced by DoLoadSettings(), ProcessOne(), SetCommand(), and VisitSettings().

◆ mFileModified

wxDateTime NyquistEffect::mFileModified
private

When the script was last modified on disk.

Definition at line 228 of file Nyquist.h.

◆ mFileName

wxFileName NyquistEffect::mFileName
private

Name of the Nyquist script file this effect is loaded from.

Definition at line 227 of file Nyquist.h.

Referenced by GetPath(), OnLoad(), OnSave(), Parse(), and ParseFile().

◆ mFirstInGroup

bool NyquistEffect::mFirstInGroup
private

Definition at line 286 of file Nyquist.h.

Referenced by Process(), and ProcessOne().

◆ mFoundType

bool NyquistEffect::mFoundType
private

Definition at line 234 of file Nyquist.h.

Referenced by Parse(), and ParseProgram().

◆ mHelpFile

wxString NyquistEffect::mHelpFile
private

Definition at line 262 of file Nyquist.h.

Referenced by CheckHelpPage(), Parse(), ParseProgram(), and Process().

◆ mHelpFileExists

bool NyquistEffect::mHelpFileExists
private

Definition at line 263 of file Nyquist.h.

Referenced by ParseProgram(), and Process().

◆ mHelpPage

FilePath NyquistEffect::mHelpPage
private

Definition at line 264 of file Nyquist.h.

Referenced by HelpPage(), and ParseProgram().

◆ mInfo

TranslatableString NyquistEffect::mInfo
private

Definition at line 254 of file Nyquist.h.

Referenced by Parse().

◆ mInitError

TranslatableString NyquistEffect::mInitError
private

Definition at line 247 of file Nyquist.h.

Referenced by Parse(), and ParseProgram().

◆ mInputCmd

wxString NyquistEffect::mInputCmd
private

◆ mIsPrompt

bool NyquistEffect::mIsPrompt
private

True if the code to execute is obtained interactively from the user via the "Nyquist Effect Prompt", or "Nyquist Prompt", false for all other effects (lisp code read from files)

Definition at line 245 of file Nyquist.h.

Referenced by DoLoadSettings(), GetPath(), GetSymbol(), GetVendor(), Init(), IsDefault(), IsInteractive(), ManualPage(), ParseProgram(), PopulateOrExchange(), Process(), ProcessOne(), SaveSettings(), ShowHostInterface(), TransferDataFromWindow(), TransferDataToWindow(), and VisitSettings().

◆ mIsSal

bool NyquistEffect::mIsSal
private

Definition at line 237 of file Nyquist.h.

Referenced by Parse(), ParseProgram(), and ProcessOne().

◆ mIsSpectral

bool NyquistEffect::mIsSpectral
private

Definition at line 239 of file Nyquist.h.

Referenced by Init(), Parse(), and ParseProgram().

◆ mIsTool

bool NyquistEffect::mIsTool
private

Definition at line 240 of file Nyquist.h.

Referenced by DoLoadSettings(), GetClassification(), and Parse().

◆ mManPage

wxString NyquistEffect::mManPage
private

Definition at line 261 of file Nyquist.h.

Referenced by ManualPage(), Parse(), and ParseProgram().

◆ mMaxLen

sampleCount NyquistEffect::mMaxLen
private

Definition at line 284 of file Nyquist.h.

Referenced by Parse(), and Process().

◆ mMergeClips

int NyquistEffect::mMergeClips
private

Definition at line 308 of file Nyquist.h.

Referenced by Parse(), and ProcessOne().

◆ mName

TranslatableString NyquistEffect::mName
private

Name of the Effect (untranslated)

Definition at line 251 of file Nyquist.h.

Referenced by GetSymbol(), Init(), Parse(), Process(), and ProcessOne().

◆ mNumSelectedChannels

unsigned NyquistEffect::mNumSelectedChannels
private

Definition at line 289 of file Nyquist.h.

Referenced by Process(), and ProcessOne().

◆ mOK

bool NyquistEffect::mOK
private

Definition at line 246 of file Nyquist.h.

Referenced by IsOk(), and Parse().

◆ mOutputTime

double NyquistEffect::mOutputTime
private

Definition at line 287 of file Nyquist.h.

Referenced by Process(), and ProcessOne().

◆ mOutputTrack

WaveTrack* NyquistEffect::mOutputTrack[2]
private

Definition at line 300 of file Nyquist.h.

Referenced by ProcessOne(), and PutCallback().

◆ mParameters

wxString NyquistEffect::mParameters
private

Definition at line 249 of file Nyquist.h.

Referenced by DoLoadSettings(), SaveSettings(), ShowHostInterface(), and VisitSettings().

◆ mPerTrackProps

wxString NyquistEffect::mPerTrackProps
private

Definition at line 305 of file Nyquist.h.

Referenced by Process(), and ProcessOne().

◆ mpException

std::exception_ptr NyquistEffect::mpException {}
private

Definition at line 312 of file