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) 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, unsigned numChannels, float sampleRate)
 
virtual bool RealtimeSuspend ()
 
virtual bool RealtimeResume ()
 
virtual bool RealtimeProcessStart (EffectSettings &settings)
 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
 
- 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...
 
bool LoadUserPreset (const RegistryPath &name, EffectSettings &settings) const override
 Change settings to a user-named preset. More...
 
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...
 
bool LoadFactoryPreset (int id, EffectSettings &settings) const override
 Change settings to the preset whose name is GetFactoryPresets()[id] More...
 
bool LoadFactoryDefaults (EffectSettings &settings) const override
 Change settings back to "factory default". More...
 
unsigned GetAudioInCount () const override
 How many input buffers to allocate at once. More...
 
unsigned GetAudioOutCount () const override
 How many output buffers to allocate at once. More...
 
virtual const EffectParameterMethodsParameters () const
 
int ShowClientInterface (wxWindow &parent, wxDialog &dialog, bool forceModal=false) override
 
std::unique_ptr< EffectUIValidatorPopulateUI (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access) 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
 
void 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
 
bool 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
 
- Public Member Functions inherited from EffectUIClientInterface
virtual ~EffectUIClientInterface ()
 
virtual int ShowClientInterface (wxWindow &parent, wxDialog &dialog, bool forceModal=false)=0
 
virtual bool IsGraphicalUI ()=0
 
virtual std::unique_ptr< EffectUIValidatorPopulateUI (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access)=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 void ImportPresets (EffectSettings &settings)=0
 
virtual bool HasOptions ()=0
 
virtual void ShowOptions ()=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 void Preview (EffectSettingsAccess &access, bool dryOnly)=0
 
virtual bool SaveSettingsAsString (const EffectSettings &settings, wxString &parms) const =0
 
virtual bool 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...
 
virtual unsigned GetAudioInCount () const =0
 How many input buffers to allocate at once. More...
 
virtual unsigned GetAudioOutCount () const =0
 How many output buffers to allocate at once. More...
 
virtual int GetMidiInCount () const
 Function that has not yet found a use. More...
 
virtual int GetMidiOutCount () const
 Function that has not yet found a use. 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
 
- 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 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)
 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
 
virtual bool ValidateUI (EffectSettings &settings)=0
 
virtual bool CloseUI ()=0
 
- 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 }
 
- Protected Attributes inherited from EffectUIClientInterface
friend EffectUIValidator
 
friend DefaultEffectUIValidator
 
- 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 72 of file Nyquist.h.

Member Typedef Documentation

◆ Buffer

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

Definition at line 293 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 202 of file Nyquist.cpp.

203{
204}

Member Function Documentation

◆ Break()

void NyquistEffect::Break ( )

Definition at line 1838 of file Nyquist.cpp.

1839{
1840 mBreak = true;
1841}
bool mBreak
Definition: Nyquist.h:229

References mBreak.

◆ BuildEffectWindow()

void NyquistEffect::BuildEffectWindow ( ShuttleGui S)
private

Definition at line 2885 of file Nyquist.cpp.

2886{
2887 wxScrolledWindow *scroller = S.Style(wxVSCROLL | wxTAB_TRAVERSAL)
2888 .StartScroller(2);
2889 {
2890 S.StartMultiColumn(4);
2891 {
2892 for (size_t i = 0; i < mControls.size(); i++)
2893 {
2894 NyqControl & ctrl = mControls[i];
2895
2896 if (ctrl.type == NYQ_CTRL_TEXT)
2897 {
2898 S.EndMultiColumn();
2899 S.StartHorizontalLay(wxALIGN_LEFT, 0);
2900 {
2901 S.AddSpace(0, 10);
2902 S.AddFixedText( Verbatim( ctrl.label ), false );
2903 }
2904 S.EndHorizontalLay();
2905 S.StartMultiColumn(4);
2906 }
2907 else
2908 {
2909 auto prompt = XXO("%s:").Format( ctrl.name );
2910 S.AddPrompt( prompt );
2911
2912 if (ctrl.type == NYQ_CTRL_STRING)
2913 {
2914 S.AddSpace(10, 10);
2915
2916 auto item = S.Id(ID_Text + i)
2917 .Validator<wxGenericValidator>(&ctrl.valStr)
2918 .Name( prompt )
2919 .AddTextBox( {}, wxT(""), 50);
2920 }
2921 else if (ctrl.type == NYQ_CTRL_CHOICE)
2922 {
2923 S.AddSpace(10, 10);
2924
2925 S.Id(ID_Choice + i).AddChoice( {},
2926 Msgids( ctrl.choices.data(), ctrl.choices.size() ) );
2927 }
2928 else if (ctrl.type == NYQ_CTRL_TIME)
2929 {
2930 S.AddSpace(10, 10);
2931
2932 const auto options = NumericTextCtrl::Options{}
2933 .AutoPos(true)
2934 .MenuEnabled(true)
2935 .ReadOnly(false);
2936
2937 NumericTextCtrl *time = safenew
2938 NumericTextCtrl(S.GetParent(), (ID_Time + i),
2941 ctrl.val,
2943 options);
2944 S
2945 .Name( prompt )
2946 .Position(wxALIGN_LEFT | wxALL)
2947 .AddWindow(time);
2948 }
2949 else if (ctrl.type == NYQ_CTRL_FILE)
2950 {
2951 S.AddSpace(10, 10);
2952
2953 // Get default file extension if specified in wildcards
2954 FileExtension defaultExtension;
2955 if (!ctrl.fileTypes.empty()) {
2956 const auto &type = ctrl.fileTypes[0];
2957 if ( !type.extensions.empty() )
2958 defaultExtension = type.extensions[0];
2959 }
2960 resolveFilePath(ctrl.valStr, defaultExtension);
2961
2962 wxTextCtrl *item = S.Id(ID_Text+i)
2963 .Name( prompt )
2964 .AddTextBox( {}, wxT(""), 40);
2965 item->SetValidator(wxGenericValidator(&ctrl.valStr));
2966
2967 if (ctrl.label.empty())
2968 // We'd expect wxFileSelectorPromptStr to already be translated, but apparently not.
2969 ctrl.label = wxGetTranslation( wxFileSelectorPromptStr );
2970 S.Id(ID_FILE + i).AddButton(
2971 Verbatim(ctrl.label), wxALIGN_LEFT);
2972 }
2973 else
2974 {
2975 // Integer or Real
2976 if (ctrl.type == NYQ_CTRL_INT_TEXT || ctrl.type == NYQ_CTRL_FLOAT_TEXT)
2977 {
2978 S.AddSpace(10, 10);
2979 }
2980
2981 S.Id(ID_Text+i);
2982 if (ctrl.type == NYQ_CTRL_FLOAT || ctrl.type == NYQ_CTRL_FLOAT_TEXT)
2983 {
2984 double range = ctrl.high - ctrl.low;
2985 S.Validator<FloatingPointValidator<double>>(
2986 // > 12 decimal places can cause rounding errors in display.
2987 12, &ctrl.val,
2988 // Set number of decimal places
2989 (range < 10
2990 ? NumValidatorStyle::THREE_TRAILING_ZEROES
2991 : range < 100
2992 ? NumValidatorStyle::TWO_TRAILING_ZEROES
2993 : NumValidatorStyle::ONE_TRAILING_ZERO),
2994 ctrl.low, ctrl.high
2995 );
2996 }
2997 else
2998 {
2999 S.Validator<IntegerValidator<double>>(
3000 &ctrl.val, NumValidatorStyle::DEFAULT,
3001 (int) ctrl.low, (int) ctrl.high);
3002 }
3003 wxTextCtrl *item = S
3004 .Name( prompt )
3005 .AddTextBox( {}, wxT(""),
3006 (ctrl.type == NYQ_CTRL_INT_TEXT ||
3007 ctrl.type == NYQ_CTRL_FLOAT_TEXT) ? 25 : 12);
3008
3009 if (ctrl.type == NYQ_CTRL_INT || ctrl.type == NYQ_CTRL_FLOAT)
3010 {
3011 S.Id(ID_Slider + i)
3012 .Style(wxSL_HORIZONTAL)
3013 .MinSize( { 150, -1 } )
3014 .AddSlider( {}, 0, ctrl.ticks, 0);
3015 }
3016 }
3017
3018 if (ctrl.type != NYQ_CTRL_FILE)
3019 {
3020 if (ctrl.type == NYQ_CTRL_CHOICE || ctrl.label.empty())
3021 {
3022 S.AddSpace(10, 10);
3023 }
3024 else
3025 {
3026 S.AddUnits( Verbatim( ctrl.label ) );
3027 }
3028 }
3029 }
3030 }
3031 }
3032 S.EndMultiColumn();
3033 }
3034 S.EndScroller();
3035
3036 scroller->SetScrollRate(0, 20);
3037
3038 // This fools NVDA into not saying "Panel" when the dialog gets focus
3039 scroller->SetName(wxT("\a"));
3040 scroller->SetLabel(wxT("\a"));
3041}
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:109
@ ID_Choice
Definition: Nyquist.cpp:107
@ ID_Slider
Definition: Nyquist.cpp:105
ID_Text
Definition: Nyquist.cpp:132
NyquistEffect::OnText ID_Time
Definition: Nyquist.cpp:136
@ NYQ_CTRL_STRING
Definition: Nyquist.h:31
@ NYQ_CTRL_TEXT
Definition: Nyquist.h:35
@ NYQ_CTRL_TIME
Definition: Nyquist.h:36
@ NYQ_CTRL_INT_TEXT
Definition: Nyquist.h:33
@ NYQ_CTRL_INT
Definition: Nyquist.h:29
@ NYQ_CTRL_CHOICE
Definition: Nyquist.h:32
@ NYQ_CTRL_FLOAT_TEXT
Definition: Nyquist.h:34
@ NYQ_CTRL_FILE
Definition: Nyquist.h:37
@ NYQ_CTRL_FLOAT
Definition: Nyquist.h:30
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:99
virtual NumericFormatSymbol GetSelectionFormat()
Definition: Effect.cpp:458
A control on a NyquistDialog.
Definition: Nyquist.h:41
double high
Definition: Nyquist.h:60
wxString label
Definition: Nyquist.h:52
wxString name
Definition: Nyquist.h:51
int ticks
Definition: Nyquist.h:61
std::vector< EnumValueSymbol > choices
Definition: Nyquist.h:53
int type
Definition: Nyquist.h:49
wxString valStr
Definition: Nyquist.h:55
double low
Definition: Nyquist.h:59
double val
Definition: Nyquist.h:58
FileNames::FileTypes fileTypes
Definition: Nyquist.h:54
std::vector< NyqControl > mControls
Definition: Nyquist.h:276
static void resolveFilePath(wxString &path, FileExtension extension={})
Definition: Nyquist.cpp:3285
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(), 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 2853 of file Nyquist.cpp.

2854{
2855 S.StartVerticalLay();
2856 {
2857 S.StartMultiColumn(3, wxEXPAND);
2858 {
2859 S.SetStretchyCol(1);
2860
2861 S.AddVariableText(XO("Enter Nyquist Command: "));
2862
2863 S.AddSpace(1, 1);
2864 }
2865 S.EndMultiColumn();
2866
2867 S.StartHorizontalLay(wxEXPAND, 1);
2868 {
2869 mCommandText = S.Focus()
2870 .MinSize( { 500, 200 } )
2871 .AddTextWindow(wxT(""));
2872 }
2873 S.EndHorizontalLay();
2874
2875 S.StartHorizontalLay(wxALIGN_CENTER, 0);
2876 {
2877 S.Id(ID_Load).AddButton(XXO("&Load"));
2878 S.Id(ID_Save).AddButton(XXO("&Save"));
2879 }
2880 S.EndHorizontalLay();
2881 }
2882 S.EndVerticalLay();
2883}
#define XO(s)
Definition: Internat.h:31
@ ID_Load
Definition: Nyquist.cpp:102
@ ID_Save
Definition: Nyquist.cpp:103
wxTextCtrl * mCommandText
Definition: Nyquist.h:308

References ID_Load, ID_Save, mCommandText, S, XO, and XXO.

Referenced by PopulateOrExchange().

Here is the caller graph for this function:

◆ CheckHelpPage()

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

Definition at line 254 of file Nyquist.cpp.

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

References GetNyquistSearchPath(), and mHelpFile.

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 1843 of file Nyquist.cpp.

1844{
1845 mCont = true;
1846}
bool mCont
Definition: Nyquist.h:230

References mCont.

◆ DoLoadSettings()

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

Definition at line 431 of file Nyquist.cpp.

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

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 1134 of file Nyquist.cpp.

1135{
1136 return mDebugButton;
1137}
bool mDebugButton
Definition: Nyquist.h:267

References mDebugButton.

◆ EscapeString()

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

Definition at line 1716 of file Nyquist.cpp.

1717{
1718 wxString str = inStr;
1719
1720 str.Replace(wxT("\\"), wxT("\\\\"));
1721 str.Replace(wxT("\""), wxT("\\\""));
1722
1723 return str;
1724}
#define str(a)

References str.

Referenced by Process(), and ProcessOne().

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 2493 of file Nyquist.cpp.

2495{
2496 if (mCurBuffer[ch]) {
2497 if ((mCurStart[ch] + start) < mCurBufferStart[ch] ||
2498 (mCurStart[ch] + start)+len >
2500 mCurBuffer[ch].reset();
2501 }
2502 }
2503
2504 if (!mCurBuffer[ch]) {
2505 mCurBufferStart[ch] = (mCurStart[ch] + start);
2507
2508 if (mCurBufferLen[ch] < (size_t) len) {
2510 }
2511
2512 mCurBufferLen[ch] =
2514 mCurStart[ch] + mCurLen - mCurBufferStart[ch] );
2515
2516 // C++20
2517 // mCurBuffer[ch] = std::make_unique_for_overwrite(mCurBufferLen[ch]);
2518 mCurBuffer[ch] = Buffer{ safenew float[ mCurBufferLen[ch] ] };
2519 try {
2520 mCurTrack[ch]->GetFloats( mCurBuffer[ch].get(),
2522 }
2523 catch ( ... ) {
2524 // Save the exception object for re-throw when out of the library
2525 mpException = std::current_exception();
2526 return -1;
2527 }
2528 }
2529
2530 // We have guaranteed above that this is nonnegative and bounded by
2531 // mCurBufferLen[ch]:
2532 auto offset = ( mCurStart[ch] + start - mCurBufferStart[ch] ).as_size_t();
2533 const void *src = &mCurBuffer[ch][offset];
2534 std::memcpy(buffer, src, len * sizeof(float));
2535
2536 if (ch == 0) {
2537 double progress = mScale *
2538 ( (start+len)/ mCurLen.as_double() );
2539
2540 if (progress > mProgressIn) {
2541 mProgressIn = progress;
2542 }
2543
2545 return -1;
2546 }
2547 }
2548
2549 return 0;
2550}
size_t limitSampleBufferSize(size_t bufferSize, sampleCount limit)
Definition: SampleCount.cpp:23
bool TotalProgress(double frac, const TranslatableString &={}) const
Definition: Effect.cpp:685
Buffer mCurBuffer[2]
Definition: Nyquist.h:294
double mProgressOut
Definition: Nyquist.h:289
std::exception_ptr mpException
Definition: Nyquist.h:310
double mScale
Definition: Nyquist.h:291
size_t mCurBufferLen[2]
Definition: Nyquist.h:296
double mProgressIn
Definition: Nyquist.h:288
std::unique_ptr< float[]> Buffer
Definition: Nyquist.h:293
WaveTrack * mCurTrack[2]
Definition: Nyquist.h:279
sampleCount mCurStart[2]
Definition: Nyquist.h:280
sampleCount mCurLen
Definition: Nyquist.h:281
double mProgressTot
Definition: Nyquist.h:290
sampleCount mCurBufferStart[2]
Definition: Nyquist.h:295
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:1788
size_t GetIdealBlockSize()
Definition: WaveTrack.cpp:1826
double as_double() const
Definition: SampleCount.h:45

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 282 of file Nyquist.cpp.

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

References EffectTypeTool, mIsTool, and mType.

◆ GetCtrlValue()

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

Definition at line 1900 of file Nyquist.cpp.

1901{
1902 /* For this to work correctly requires that the plug-in header is
1903 * parsed on each run so that the correct value for "half-srate" may
1904 * be determined.
1905 *
1906 auto project = FindProject();
1907 if (project && s.IsSameAs(wxT("half-srate"), false)) {
1908 auto rate =
1909 TrackList::Get( *project ).Selected< const WaveTrack >()
1910 .min( &WaveTrack::GetRate );
1911 return (rate / 2.0);
1912 }
1913 */
1914
1916}
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 241 of file Nyquist.cpp.

242{
243 return mCopyright;
244}
TranslatableString mCopyright
Definition: Nyquist.h:258

References mCopyright.

◆ GetFamily()

EffectFamilySymbol NyquistEffect::GetFamily ( ) const
overridevirtual

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

Reimplemented from Effect.

Definition at line 289 of file Nyquist.cpp.

290{
292}
#define NYQUISTEFFECTS_FAMILY
Definition: EffectBase.h:144

References NYQUISTEFFECTS_FAMILY.

◆ GetNyquistSearchPath()

FilePaths NyquistEffect::GetNyquistSearchPath ( )
staticprivate

Definition at line 2634 of file Nyquist.cpp.

2635{
2636 const auto &audacityPathList = FileNames::AudacityPathList();
2637 FilePaths pathList;
2638
2639 for (size_t i = 0; i < audacityPathList.size(); i++)
2640 {
2641 wxString prefix = audacityPathList[i] + wxFILE_SEP_PATH;
2642 FileNames::AddUniquePathToPathList(prefix + wxT("nyquist"), pathList);
2643 FileNames::AddUniquePathToPathList(prefix + wxT("plugins"), pathList);
2644 FileNames::AddUniquePathToPathList(prefix + wxT("plug-ins"), pathList);
2645 }
2646 pathList.push_back(FileNames::PlugInDir());
2647
2648 return pathList;
2649}
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(), and FileNames::PlugInDir().

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 208 of file Nyquist.cpp.

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

References mFileName, mIsPrompt, and NYQUIST_PROMPT_ID.

◆ GetSymbol()

ComponentInterfaceSymbol NyquistEffect::GetSymbol ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 216 of file Nyquist.cpp.

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

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 277 of file Nyquist.cpp.

278{
279 return mType;
280}

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 224 of file Nyquist.cpp.

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

References mAuthor, mIsPrompt, and XO.

◆ GetVersion()

wxString NyquistEffect::GetVersion ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 234 of file Nyquist.cpp.

235{
236 // Are Nyquist version strings really supposed to be translatable?
237 // See commit a06e561 which used XO for at least one of them
239}
TranslatableString mReleaseVersion
Definition: Nyquist.h:257
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 270 of file Nyquist.cpp.

271{
272 return mHelpPage;
273}
FilePath mHelpPage
Definition: Nyquist.h:262

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 566 of file Nyquist.cpp.

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

155{ return mInitError; }
TranslatableString mInitError
Definition: Nyquist.h:245

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 304 of file Nyquist.cpp.

305{
306 return mIsPrompt;
307}

References mIsPrompt.

◆ IsInteractive()

bool NyquistEffect::IsInteractive ( ) const
overridevirtual

Whether the effect needs a dialog for entry of settings.

Reimplemented from Effect.

Definition at line 294 of file Nyquist.cpp.

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

References mControls, and mIsPrompt.

◆ IsOk()

bool NyquistEffect::IsOk ( )
private

Definition at line 3045 of file Nyquist.cpp.

3046{
3047 return mOK;
3048}

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 424 of file Nyquist.cpp.

426{
427 // To do: externalize state so const_cast isn't needed
428 return const_cast<NyquistEffect*>(this)->DoLoadSettings(parms, settings);
429}
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:74
bool DoLoadSettings(const CommandParameters &parms, EffectSettings &settings)
Definition: Nyquist.cpp:431

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 246 of file Nyquist.cpp.

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

References mIsPrompt, and mManPage.

◆ NyquistToWxString()

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

Definition at line 1703 of file Nyquist.cpp.

1704{
1705 wxString str(nyqString, wxConvUTF8);
1706 if (nyqString != NULL && nyqString[0] && str.empty()) {
1707 // invalid UTF-8 string, convert as Latin-1
1708 str = _("[Warning: Nyquist returned invalid UTF-8 string, converted here as Latin-1]");
1709 // TODO: internationalization of strings from Nyquist effects, at least
1710 // from those shipped with Audacity
1711 str += LAT1CTOWX(nyqString);
1712 }
1713 return str;
1714}
#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 3154 of file Nyquist.cpp.

3155{
3156 mControls[evt.GetId() - ID_Choice].val = (double) evt.GetInt();
3157}

References ID_Choice, and mControls.

◆ OnDebug()

void NyquistEffect::OnDebug ( wxCommandEvent &  evt)
private

◆ OnFileButton()

void NyquistEffect::OnFileButton ( wxCommandEvent &  evt)
private

Definition at line 3190 of file Nyquist.cpp.

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

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 3057 of file Nyquist.cpp.

3058{
3059 if (mCommandText->IsModified())
3060 {
3061 if (wxNO == Effect::MessageBox(
3062 XO("Current program has been modified.\nDiscard changes?"),
3063 wxYES_NO ) )
3064 {
3065 return;
3066 }
3067 }
3068
3069 FileDialogWrapper dlog(
3070 mUIParent,
3071 XO("Load Nyquist script"),
3072 mFileName.GetPath(),
3073 wxEmptyString,
3074 {
3075 NyquistScripts,
3076 LispScripts,
3077 FileNames::TextFiles,
3078 FileNames::AllFiles
3079 },
3080 wxFD_OPEN | wxRESIZE_BORDER);
3081
3082 if (dlog.ShowModal() != wxID_OK)
3083 {
3084 return;
3085 }
3086
3087 mFileName = dlog.GetPath();
3088
3089 if (!mCommandText->LoadFile(mFileName.GetFullPath()))
3090 {
3091 Effect::MessageBox( XO("File could not be loaded") );
3092 }
3093}

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 3095 of file Nyquist.cpp.

3096{
3097 FileDialogWrapper dlog(
3098 mUIParent,
3099 XO("Save Nyquist script"),
3100 mFileName.GetPath(),
3101 mFileName.GetFullName(),
3102 {
3103 NyquistScripts,
3104 LispScripts,
3105 FileNames::AllFiles
3106 },
3107 wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER);
3108
3109 if (dlog.ShowModal() != wxID_OK)
3110 {
3111 return;
3112 }
3113
3114 mFileName = dlog.GetPath();
3115
3116 if (!mCommandText->SaveFile(mFileName.GetFullPath()))
3117 {
3118 Effect::MessageBox( XO("File could not be saved") );
3119 }
3120}

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 3122 of file Nyquist.cpp.

3123{
3124 int i = evt.GetId() - ID_Slider;
3125 NyqControl & ctrl = mControls[i];
3126
3127 int val = evt.GetInt();
3128 double range = ctrl.high - ctrl.low;
3129 double newVal = (val / (double)ctrl.ticks) * range + ctrl.low;
3130
3131 // Determine precision for displayed number
3132 int precision = range < 1.0 ? 3 :
3133 range < 10.0 ? 2 :
3134 range < 100.0 ? 1 :
3135 0;
3136
3137 // If the value is at least one tick different from the current value
3138 // change it (this prevents changes from manually entered values unless
3139 // the slider actually moved)
3140 if (fabs(newVal - ctrl.val) >= (1 / (double)ctrl.ticks) * range &&
3141 fabs(newVal - ctrl.val) >= pow(0.1, precision) / 2)
3142 {
3143 // First round to the appropriate precision
3144 newVal *= pow(10.0, precision);
3145 newVal = floor(newVal + 0.5);
3146 newVal /= pow(10.0, precision);
3147
3148 ctrl.val = newVal;
3149
3150 mUIParent->FindWindow(ID_Text + i)->GetValidator()->TransferToWindow();
3151 }
3152}

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 3365 of file Nyquist.cpp.

3366{
3367 int i = evt.GetId() - ID_Text;
3368
3369 NyqControl & ctrl = mControls[i];
3370
3371 if (wxDynamicCast(evt.GetEventObject(), wxWindow)->GetValidator()->TransferFromWindow())
3372 {
3373 if (ctrl.type == NYQ_CTRL_FLOAT || ctrl.type == NYQ_CTRL_INT)
3374 {
3375 int pos = (int)floor((ctrl.val - ctrl.low) /
3376 (ctrl.high - ctrl.low) * ctrl.ticks + 0.5);
3377
3378 wxSlider *slider = (wxSlider *)mUIParent->FindWindow(ID_Slider + i);
3379 slider->SetValue(pos);
3380 }
3381 }
3382}

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 3159 of file Nyquist.cpp.

3160{
3161 int i = evt.GetId() - ID_Time;
3162 static double value = 0.0;
3163 NyqControl & ctrl = mControls[i];
3164
3165 NumericTextCtrl *n = (NumericTextCtrl *) mUIParent->FindWindow(ID_Time + i);
3166 double val = n->GetValue();
3167
3168 // Observed that two events transmitted on each control change (Linux)
3169 // so skip if value has not changed.
3170 if (val != value) {
3171 if (val < ctrl.low || val > ctrl.high) {
3172 const auto message = XO("Value range:\n%s to %s")
3173 .Format( ToTimeFormat(ctrl.low), ToTimeFormat(ctrl.high) );
3175 message,
3176 wxOK | wxCENTRE,
3177 XO("Value Error") );
3178 }
3179
3180 if (val < ctrl.low)
3181 val = ctrl.low;
3182 else if (val > ctrl.high)
3183 val = ctrl.high;
3184
3185 n->SetValue(val);
3186 value = val;
3187 }
3188}
void SetValue(double newValue)
wxString ToTimeFormat(double t)
Definition: Nyquist.cpp:3355

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 2604 of file Nyquist.cpp.

2605{
2606 if (mStop) {
2607 mStop = false;
2608 nyx_stop();
2609 }
2610 else if (mBreak) {
2611 mBreak = false;
2612 nyx_break();
2613 }
2614 else if (mCont) {
2615 mCont = false;
2616 nyx_continue();
2617 }
2618
2619 // LLL: STF figured out that yielding while the effect is being applied
2620 // produces an EXTREME slowdown. It appears that yielding is not
2621 // really necessary on Linux and Windows.
2622 //
2623 // However, on the Mac, the spinning cursor appears during longer
2624 // Nyquist processing and that may cause the user to think Audacity
2625 // has crashed or hung. In addition, yielding or not on the Mac
2626 // doesn't seem to make much of a difference in execution time.
2627 //
2628 // So, yielding on the Mac only...
2629#if defined(__WXMAC__)
2630 wxYieldIfNeeded();
2631#endif
2632}
bool mStop
Definition: Nyquist.h:228

References mBreak, mCont, and mStop.

◆ OutputCallback()

void NyquistEffect::OutputCallback ( int  c)
private

Definition at line 2588 of file Nyquist.cpp.

2589{
2590 // Always collect Nyquist error messages for normal plug-ins
2591 if (!mRedirectOutput) {
2592 mDebugOutputStr += (wxChar)c;
2593 return;
2594 }
2595
2596 std::cout << (char)c;
2597}
bool mRedirectOutput
Definition: Nyquist.h:270
wxString mDebugOutputStr
Definition: Nyquist.h:272

References mDebugOutputStr, and mRedirectOutput.

◆ Parse()

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

Definition at line 2017 of file Nyquist.cpp.

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

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, 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 1726 of file Nyquist.cpp.

1727{
1728 std::vector<EnumValueSymbol> results;
1729 if (text[0] == wxT('(')) {
1730 // New style: expecting a Lisp-like list of strings
1731 Tokenizer tzer;
1732 tzer.Tokenize(text, true, 1, 1);
1733 auto &choices = tzer.tokens;
1734 wxString extra;
1735 for (auto &choice : choices) {
1736 auto label = UnQuote(choice, true, &extra);
1737 if (extra.empty())
1738 results.push_back( TranslatableString{ label, {} } );
1739 else
1740 results.push_back(
1741 { extra, TranslatableString{ label, {} } } );
1742 }
1743 }
1744 else {
1745 // Old style: expecting a comma-separated list of
1746 // un-internationalized names, ignoring leading and trailing spaces
1747 // on each; and the whole may be quoted
1748 auto choices = wxStringTokenize(
1749 text[0] == wxT('"') ? text.Mid(1, text.length() - 2) : text,
1750 wxT(",")
1751 );
1752 for (auto &choice : choices)
1753 results.push_back( { choice.Trim(true).Trim(false) } );
1754 }
1755 return results;
1756}
TranslatableString label
Definition: TagsEditor.cpp:163

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

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 2478 of file Nyquist.cpp.

2479{
2480 wxStringInputStream stream(cmd + wxT(" "));
2481
2482 return ParseProgram(stream);
2483}
bool ParseProgram(wxInputStream &stream)
Definition: Nyquist.cpp:2372

References ParseProgram().

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 2470 of file Nyquist.cpp.

2471{
2472 wxFileInputStream rawStream(mFileName.GetFullPath());
2473 wxBufferedInputStream stream(rawStream, 10000);
2474
2475 ParseProgram(stream);
2476}

References mFileName, and ParseProgram().

Here is the call graph for this function:

◆ ParseFileExtensions()

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

Definition at line 1758 of file Nyquist.cpp.

1759{
1760 // todo: error handling
1761 FileExtensions results;
1762 if (text[0] == wxT('(')) {
1763 Tokenizer tzer;
1764 tzer.Tokenize(text, true, 1, 1);
1765 for (const auto &token : tzer.tokens)
1766 results.push_back( UnQuote( token ) );
1767 }
1768 return results;
1769}

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

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 1771 of file Nyquist.cpp.

1772{
1773 // todo: error handling
1774 FileNames::FileType result;
1775 if (text[0] == wxT('(')) {
1776 Tokenizer tzer;
1777 tzer.Tokenize(text, true, 1, 1);
1778 auto &tokens = tzer.tokens;
1779 if ( tokens.size() == 2 )
1780 result =
1781 { UnQuoteMsgid( tokens[0] ), ParseFileExtensions( tokens[1] ) };
1782 }
1783 return result;
1784}
static TranslatableString UnQuoteMsgid(const wxString &s, bool allowParens=true, wxString *pExtraString=nullptr)
Definition: Nyquist.cpp:1853
FileExtensions ParseFileExtensions(const wxString &text)
Definition: Nyquist.cpp:1758

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

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 1786 of file Nyquist.cpp.

1787{
1788 // todo: error handling
1789 FileNames::FileTypes results;
1790 if (text[0] == wxT('(')) {
1791 Tokenizer tzer;
1792 tzer.Tokenize(text, true, 1, 1);
1793 auto &types = tzer.tokens;
1794 if ( !types.empty() && types[0][0] == wxT('(') )
1795 for (auto &type : types)
1796 results.push_back( ParseFileType( type ) );
1797 }
1798 if ( results.empty() ) {
1799 // Old-style is a specially formatted string, maybe translated
1800 // Parse it for compatibility
1801 auto str = UnQuote( text );
1802 auto pieces = wxSplit( str, '|' );
1803 // Should have an even number
1804 auto size = pieces.size();
1805 if ( size % 2 == 1 )
1806 --size, pieces.pop_back();
1807 for ( size_t ii = 0; ii < size; ii += 2 ) {
1808 FileExtensions extensions;
1809 auto extensionStrings = wxSplit( pieces[ii + 1], ';' );
1810 for ( const auto &extensionString : extensionStrings )
1811 if ( extensionString.StartsWith( wxT("*.") ) ) {
1812 auto ext = extensionString.substr( 2 );
1813 if (ext == wxT("*"))
1814 // "*.*" to match all
1815 ext.clear();
1816 extensions.push_back( ext );
1817 }
1818 results.push_back( { Verbatim( pieces[ii] ), extensions } );
1819 }
1820 }
1821 return results;
1822}
std::vector< FileType > FileTypes
Definition: FileNames.h:76
FileNames::FileType ParseFileType(const wxString &text)
Definition: Nyquist.cpp:1771

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

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 2372 of file Nyquist.cpp.

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

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(), 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 
)
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 1124 of file Nyquist.cpp.

1126{
1127 if (mIsPrompt)
1129 else
1131 return nullptr;
1132}
void BuildEffectWindow(ShuttleGui &S)
Definition: Nyquist.cpp:2885
void BuildPromptWindow(ShuttleGui &S)
Definition: Nyquist.cpp:2853

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 662 of file Nyquist.cpp.

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

Here is the call graph for this function:

◆ ProcessOne()

bool NyquistEffect::ProcessOne ( )
private

Definition at line 1170 of file Nyquist.cpp.

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

2562{
2563 // Don't let C++ exceptions propagate through the Nyquist library
2564 return GuardedCall<int>( [&] {
2565 if (channel == 0) {
2566 double progress = mScale*((float)(start+len)/totlen);
2567
2568 if (progress > mProgressOut) {
2569 mProgressOut = progress;
2570 }
2571
2573 return -1;
2574 }
2575 }
2576
2577 mOutputTrack[channel]->Append((samplePtr)buffer, floatSample, len);
2578
2579 return 0; // success
2580 }, MakeSimpleGuard( -1 ) ); // translate all exceptions into failure
2581}
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:1766

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 1824 of file Nyquist.cpp.

1825{
1826 mRedirectOutput = true;
1827}

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 3285 of file Nyquist.cpp.

3287{
3288#if defined(__WXMSW__)
3289 path.Replace("/", wxFileName::GetPathSeparator());
3290#endif
3291
3292 path.Trim(true).Trim(false);
3293
3294 typedef std::unordered_map<wxString, FilePath> map;
3295 map pathKeys = {
3296 {"*home*", wxGetHomeDir()},
3297 {"~", wxGetHomeDir()},
3298 {"*default*", FileNames::DefaultToDocumentsFolder("").GetPath()},
3299 {"*export*", FileNames::FindDefaultPath(FileNames::Operation::Export)},
3300 {"*save*", FileNames::FindDefaultPath(FileNames::Operation::Save)},
3301 {"*config*", FileNames::DataDir()}
3302 };
3303
3304 int characters = path.Find(wxFileName::GetPathSeparator());
3305 if(characters == wxNOT_FOUND) // Just a path or just a file name
3306 {
3307 if (path.empty())
3308 path = "*default*";
3309
3310 if (pathKeys.find(path) != pathKeys.end())
3311 {
3312 // Keyword found, so assume this is the intended directory.
3313 path = pathKeys[path] + wxFileName::GetPathSeparator();
3314 }
3315 else // Just a file name
3316 {
3317 path = pathKeys["*default*"] + wxFileName::GetPathSeparator() + path;
3318 }
3319 }
3320 else // path + file name
3321 {
3322 wxString firstDir = path.Left(characters);
3323 wxString rest = path.Mid(characters);
3324
3325 if (pathKeys.find(firstDir) != pathKeys.end())
3326 {
3327 path = pathKeys[firstDir] + rest;
3328 }
3329 }
3330
3331 wxFileName fname = path;
3332
3333 // If the directory is invalid, better to leave it as is (invalid) so that
3334 // the user sees the error rather than an unexpected file path.
3335 if (fname.wxFileName::IsOk() && fname.GetFullName().empty())
3336 {
3337 path = fname.GetPathWithSep() + _("untitled");
3338 if (!extension.empty())
3339 path = path + '.' + extension;
3340 }
3341}
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 373 of file Nyquist.cpp.

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

1830{
1831 mExternal = true;
1832
1833 if (cmd.size()) {
1834 ParseCommand(cmd);
1835 }
1836}

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 497 of file Nyquist.cpp.

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

1058{
1059 int res = wxID_APPLY;
1061 // Show the normal (prompt or effect) interface
1063 parent, factory, pInstance, access, forceModal);
1064 }
1065
1066
1067 // Remember if the user clicked debug
1068 mDebug = (res == eDebugID);
1069
1070 // We're done if the user clicked "Close", we are not the Nyquist Prompt,
1071 // or the program currently loaded into the prompt doesn't have a UI.
1072 if (!res || !mIsPrompt || mControls.size() == 0 || !pInstance)
1073 return res;
1074
1075 // Nyquist prompt was OK, but gave us some magic ;control comments to
1076 // reinterpret into a second dialog
1077
1079 effect.SetCommand(mInputCmd);
1080
1081 // Must give effect its own settings to interpret, not those in access
1082 // Let's also give it its own instance
1083 auto newSettings = effect.MakeSettings();
1084 auto pNewInstance = effect.MakeInstance();
1085 auto newAccess = std::make_shared<SimpleEffectSettingsAccess>(newSettings);
1086
1087 if (IsBatchProcessing()) {
1088 effect.SetBatchProcessing();
1089
1092 effect.LoadSettings(cp, newSettings);
1093
1094 // Show the normal (prompt or effect) interface
1095 res = effect.ShowHostInterface(
1096 parent, factory, pNewInstance, *newAccess, forceModal);
1097 if (res) {
1099 effect.SaveSettings(newSettings, cp);
1101 }
1102 }
1103 else {
1104 if (!factory)
1105 return 0;
1106 res = effect.ShowHostInterface(
1107 parent, factory, pNewInstance, *newAccess, false );
1108 if (!res)
1109 return 0;
1110
1111 // Wrap the new settings in the old settings
1113 auto &nyquistSettings = GetSettings(settings);
1114 nyquistSettings.proxySettings = std::move(newSettings);
1115 nyquistSettings.proxyDebug = this->mDebug;
1116 });
1117 }
1118 if (!pNewInstance)
1119 // Propagate the failure from nested ShowHostInterface
1120 pInstance.reset();
1121 return res;
1122}
static RegisteredToolbarFactory factory
@ 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:175
unsigned TestUIFlags(unsigned mask)
Definition: Effect.cpp:558
void ModifySettings(Function &&function)
Do a correct read-modify-write of settings.
Externalized state of a plug-in.

References eDebugID, 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(), and Effect::TestUIFlags().

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 2485 of file Nyquist.cpp.

2488{
2489 NyquistEffect *This = (NyquistEffect *)userdata;
2490 return This->GetCallback(buffer, channel, start, len, totlen);
2491}
int GetCallback(float *buffer, int channel, int64_t start, int64_t len, int64_t totlen)
Definition: Nyquist.cpp:2493

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 2599 of file Nyquist.cpp.

2600{
2601 ((NyquistEffect *)This)->OSCallback();
2602}

Referenced by Process().

Here is the caller graph for this function:

◆ StaticOutputCallback()

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

Definition at line 2583 of file Nyquist.cpp.

2584{
2585 ((NyquistEffect *)This)->OutputCallback(c);
2586}

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 2552 of file Nyquist.cpp.

2555{
2556 NyquistEffect *This = (NyquistEffect *)userdata;
2557 return This->PutCallback(buffer, channel, start, len, totlen);
2558}
int PutCallback(float *buffer, int channel, int64_t start, int64_t len, int64_t totlen)
Definition: Nyquist.cpp:2560

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 1848 of file Nyquist.cpp.

1849{
1850 mStop = true;
1851}

References mStop.

Referenced by NyqBench::OnStop().

Here is the caller graph for this function:

◆ ToTimeFormat()

wxString NyquistEffect::ToTimeFormat ( double  t)
private

Definition at line 3355 of file Nyquist.cpp.

3356{
3357 int seconds = static_cast<int>(t);
3358 int hh = seconds / 3600;
3359 int mm = seconds % 3600;
3360 mm = mm / 60;
3361 return wxString::Format("%d:%d:%.3f", hh, mm, t - (hh * 3600 + mm * 60));
3362}

Referenced by OnTime().

Here is the caller graph for this function:

◆ TransferDataFromEffectWindow()

bool NyquistEffect::TransferDataFromEffectWindow ( )
private

Definition at line 2713 of file Nyquist.cpp.

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

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, 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 2695 of file Nyquist.cpp.

2696{
2697 mInputCmd = mCommandText->GetValue();
2698
2699 // Un-correct smart quoting, bothersomely applied in wxTextCtrl by
2700 // the native widget of MacOS 10.9 SDK
2701 const wxString left = wxT("\u201c"), right = wxT("\u201d"), dumb = '"';
2702 mInputCmd.Replace(left, dumb, true);
2703 mInputCmd.Replace(right, dumb, true);
2704
2705 const wxString leftSingle = wxT("\u2018"), rightSingle = wxT("\u2019"),
2706 dumbSingle = '\'';
2707 mInputCmd.Replace(leftSingle, dumbSingle, true);
2708 mInputCmd.Replace(rightSingle, dumbSingle, true);
2709
2710 return ParseCommand(mInputCmd);
2711}

References mCommandText, mInputCmd, and ParseCommand().

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 1159 of file Nyquist.cpp.

1160{
1161 if (mIsPrompt)
1162 {
1164 }
1166}
bool TransferDataFromPromptWindow()
Definition: Nyquist.cpp:2695
bool TransferDataFromEffectWindow()
Definition: Nyquist.cpp:2713

References mIsPrompt, TransferDataFromEffectWindow(), and TransferDataFromPromptWindow().

Here is the call graph for this function:

◆ TransferDataToEffectWindow()

bool NyquistEffect::TransferDataToEffectWindow ( )
private

Definition at line 2658 of file Nyquist.cpp.

2659{
2660 for (size_t i = 0, cnt = mControls.size(); i < cnt; i++)
2661 {
2662 NyqControl & ctrl = mControls[i];
2663
2664 if (ctrl.type == NYQ_CTRL_CHOICE)
2665 {
2666 const auto count = ctrl.choices.size();
2667
2668 int val = (int)ctrl.val;
2669 if (val < 0 || val >= (int)count)
2670 {
2671 val = 0;
2672 }
2673
2674 wxChoice *c = (wxChoice *) mUIParent->FindWindow(ID_Choice + i);
2675 c->SetSelection(val);
2676 }
2677 else if (ctrl.type == NYQ_CTRL_INT || ctrl.type == NYQ_CTRL_FLOAT)
2678 {
2679 // wxTextCtrls are handled by the validators
2680 double range = ctrl.high - ctrl.low;
2681 int val = (int)(0.5 + ctrl.ticks * (ctrl.val - ctrl.low) / range);
2682 wxSlider *s = (wxSlider *) mUIParent->FindWindow(ID_Slider + i);
2683 s->SetValue(val);
2684 }
2685 else if (ctrl.type == NYQ_CTRL_TIME)
2686 {
2687 NumericTextCtrl *n = (NumericTextCtrl *) mUIParent->FindWindow(ID_Time + i);
2688 n->SetValue(ctrl.val);
2689 }
2690 }
2691
2692 return true;
2693}

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 2651 of file Nyquist.cpp.

2652{
2653 mCommandText->ChangeValue(mInputCmd);
2654
2655 return true;
2656}

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 1139 of file Nyquist.cpp.

1140{
1141 bool success;
1142 if (mIsPrompt)
1143 {
1144 success = TransferDataToPromptWindow();
1145 }
1146 else
1147 {
1148 success = TransferDataToEffectWindow();
1149 }
1150
1151 if (success)
1152 {
1154 }
1155
1156 return success;
1157}
bool EnablePreview(bool enable=true)
Definition: Effect.cpp:644
bool TransferDataToPromptWindow()
Definition: Nyquist.cpp:2651
bool TransferDataToEffectWindow()
Definition: Nyquist.cpp:2658

References Effect::EnablePreview(), mEnablePreview, mIsPrompt, 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 1894 of file Nyquist.cpp.

1896{
1897 return UnQuoteMsgid( s, allowParens, pExtraString ).Translation();
1898}

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 1853 of file Nyquist.cpp.

1855{
1856 if (pExtraString)
1857 *pExtraString = wxString{};
1858
1859 int len = s.length();
1860 if (len >= 2 && s[0] == wxT('\"') && s[len - 1] == wxT('\"')) {
1861 auto unquoted = s.Mid(1, len - 2);
1862 // Sorry, no context strings, yet
1863 // (See also comments in NyquistEffectsModule::AutoRegisterPlugins)
1864 return TranslatableString{ unquoted, {} };
1865 }
1866 else if (allowParens &&
1867 len >= 2 && s[0] == wxT('(') && s[len - 1] == wxT(')')) {
1868 Tokenizer tzer;
1869 tzer.Tokenize(s, true, 1, 1);
1870 auto &tokens = tzer.tokens;
1871 if (tokens.size() > 1) {
1872 if (pExtraString && tokens[1][0] == '(') {
1873 // A choice with a distinct internal string form like
1874 // ("InternalString" (_ "Visible string"))
1875 // Recur to find the two strings
1876 *pExtraString = UnQuote(tokens[0], false);
1877 return UnQuoteMsgid(tokens[1]);
1878 }
1879 else {
1880 // Assume the first token was _ -- we don't check that
1881 // And the second is the string, which is internationalized
1882 // Sorry, no context strings, yet
1883 return UnQuoteMsgid( tokens[1], false );
1884 }
1885 }
1886 else
1887 return {};
1888 }
1889 else
1890 // If string was not quoted, assume no translation exists
1891 return Verbatim( s );
1892}

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

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 3344 of file Nyquist.cpp.

3345{
3346 wxFileName fname = path;
3347 wxString dir = fname.GetPath();
3348
3349 return (fname.wxFileName::IsOk() &&
3350 wxFileName::DirExists(dir) &&
3351 !fname.GetFullName().empty());
3352}

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 317 of file Nyquist.cpp.

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

311{
312 if (auto pSa = dynamic_cast<ShuttleSetAutomation*>(&visitor))
313 LoadSettings(*pSa->mpEap, settings);
314 return true;
315}
bool LoadSettings(const CommandParameters &parms, EffectSettings &settings) const override
Restore settings from keys and values.
Definition: Nyquist.cpp:424
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 314 of file Nyquist.h.

Member Data Documentation

◆ mAction

TranslatableString NyquistEffect::mAction
private

Definition at line 251 of file Nyquist.h.

Referenced by Parse().

◆ mAuthor

TranslatableString NyquistEffect::mAuthor
private

Definition at line 253 of file Nyquist.h.

Referenced by GetVendor(), and Parse().

◆ mBreak

bool NyquistEffect::mBreak
private

Definition at line 229 of file Nyquist.h.

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

◆ mCategories

wxArrayString NyquistEffect::mCategories
private

Definition at line 300 of file Nyquist.h.

Referenced by Parse(), and ParseProgram().

◆ mCmd

wxString NyquistEffect::mCmd
private

Definition at line 248 of file Nyquist.h.

Referenced by ParseProgram(), and ProcessOne().

◆ mCommandText

wxTextCtrl* NyquistEffect::mCommandText
private

◆ mCompiler

bool NyquistEffect::mCompiler
private

Definition at line 233 of file Nyquist.h.

Referenced by Parse(), and ProcessOne().

◆ mCont

bool NyquistEffect::mCont
private

Definition at line 230 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 258 of file Nyquist.h.

Referenced by GetDescription(), and Parse().

◆ mCount

unsigned NyquistEffect::mCount
private

Definition at line 286 of file Nyquist.h.

Referenced by Process(), and ProcessOne().

◆ mCurBuffer

Buffer NyquistEffect::mCurBuffer[2]
private

Definition at line 294 of file Nyquist.h.

Referenced by GetCallback(), and ProcessOne().

◆ mCurBufferLen

size_t NyquistEffect::mCurBufferLen[2]
private

Definition at line 296 of file Nyquist.h.

Referenced by GetCallback().

◆ mCurBufferStart

sampleCount NyquistEffect::mCurBufferStart[2]
private

Definition at line 295 of file Nyquist.h.

Referenced by GetCallback().

◆ mCurLen

sampleCount NyquistEffect::mCurLen
private

Definition at line 281 of file Nyquist.h.

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

◆ mCurNumChannels

unsigned NyquistEffect::mCurNumChannels
private

Definition at line 278 of file Nyquist.h.

Referenced by Process(), and ProcessOne().

◆ mCurStart

sampleCount NyquistEffect::mCurStart[2]
private

Definition at line 280 of file Nyquist.h.

Referenced by GetCallback(), and Process().

◆ mCurTrack

WaveTrack* NyquistEffect::mCurTrack[2]
private

Definition at line 279 of file Nyquist.h.

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

◆ mDebug

bool NyquistEffect::mDebug
private

Definition at line 269 of file Nyquist.h.

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

◆ mDebugButton

bool NyquistEffect::mDebugButton
private

Definition at line 267 of file Nyquist.h.

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

◆ mDebugOutput

TranslatableString NyquistEffect::mDebugOutput
private

Definition at line 273 of file Nyquist.h.

Referenced by Process(), and ProcessOne().

◆ mDebugOutputStr

wxString NyquistEffect::mDebugOutputStr
private

Definition at line 272 of file Nyquist.h.

Referenced by OutputCallback(), and Process().

◆ mEnablePreview

bool NyquistEffect::mEnablePreview
private

Definition at line 266 of file Nyquist.h.

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

◆ mExternal

bool NyquistEffect::mExternal
private

Definition at line 236 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 226 of file Nyquist.h.

◆ mFileName

wxFileName NyquistEffect::mFileName
private

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

Definition at line 225 of file Nyquist.h.

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

◆ mFirstInGroup

bool NyquistEffect::mFirstInGroup
private

Definition at line 284 of file Nyquist.h.

Referenced by Process(), and ProcessOne().

◆ mFoundType

bool NyquistEffect::mFoundType
private

Definition at line 232 of file Nyquist.h.

Referenced by Parse(), and ParseProgram().

◆ mHelpFile

wxString NyquistEffect::mHelpFile
private

Definition at line 260 of file Nyquist.h.

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

◆ mHelpFileExists

bool NyquistEffect::mHelpFileExists
private

Definition at line 261 of file Nyquist.h.

Referenced by ParseProgram(), and Process().

◆ mHelpPage

FilePath NyquistEffect::mHelpPage
private

Definition at line 262 of file Nyquist.h.

Referenced by HelpPage(), and ParseProgram().

◆ mInfo

TranslatableString NyquistEffect::mInfo
private

Definition at line 252 of file Nyquist.h.

Referenced by Parse().

◆ mInitError

TranslatableString NyquistEffect::mInitError
private

Definition at line 245 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 243 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 235 of file Nyquist.h.

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

◆ mIsSpectral

bool NyquistEffect::mIsSpectral
private

Definition at line 237 of file Nyquist.h.

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

◆ mIsTool

bool NyquistEffect::mIsTool
private

Definition at line 238 of file Nyquist.h.

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

◆ mManPage

wxString NyquistEffect::mManPage
private

Definition at line 259 of file Nyquist.h.

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

◆ mMaxLen

sampleCount NyquistEffect::mMaxLen
private

Definition at line 282 of file Nyquist.h.

Referenced by Parse(), and Process().

◆ mMergeClips

int NyquistEffect::mMergeClips
private

Definition at line 306 of file Nyquist.h.

Referenced by Parse(), and ProcessOne().

◆ mName

TranslatableString NyquistEffect::mName
private

Name of the Effect (untranslated)

Definition at line 249 of file Nyquist.h.

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

◆ mNumSelectedChannels

unsigned NyquistEffect::mNumSelectedChannels
private

Definition at line 287 of file Nyquist.h.

Referenced by Process(), and ProcessOne().

◆ mOK

bool NyquistEffect::mOK
private

Definition at line 244 of file Nyquist.h.

Referenced by IsOk(), and Parse().

◆ mOutputTime

double NyquistEffect::mOutputTime
private

Definition at line 285 of file Nyquist.h.

Referenced by Process(), and ProcessOne().

◆ mOutputTrack

WaveTrack* NyquistEffect::mOutputTrack[2]
private

Definition at line 298 of file Nyquist.h.

Referenced by ProcessOne(), and PutCallback().

◆ mParameters

wxString NyquistEffect::mParameters
private

Definition at line 247 of file Nyquist.h.

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

◆ mPerTrackProps

wxString NyquistEffect::mPerTrackProps
private

Definition at line 303 of file Nyquist.h.

Referenced by Process(), and ProcessOne().

◆ mpException

std::exception_ptr NyquistEffect::mpException {}
private

Definition at line 310 of file Nyquist.h.

Referenced by GetCallback(), and ProcessOne().

◆ mProgressIn

double NyquistEffect::mProgressIn
private

Definition at line 288 of file Nyquist.h.

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

◆ mProgressOut

double NyquistEffect::mProgressOut
private

Definition at line 289 of file Nyquist.h.

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

◆ mProgressTot

double NyquistEffect::mProgressTot
private

Definition at line 290 of file Nyquist.h.

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

◆ mProjectChanged

bool NyquistEffect::mProjectChanged
private

Definition at line 271 of file Nyquist.h.

Referenced by Process(), and ProcessOne().

◆ mPromptName

TranslatableString NyquistEffect::mPromptName
private

Definition at line 250 of file Nyquist.h.

Referenced by Init().

◆ mPromptType

EffectType NyquistEffect::mPromptType
private

Definition at line 264 of file Nyquist.h.

Referenced by DoLoadSettings(), and Init().

◆ mProps

wxString NyquistEffect::mProps
private

Definition at line 302 of file Nyquist.h.

Referenced by Process(), and ProcessOne().

◆ mRedirectOutput

bool NyquistEffect::mRedirectOutput
private

Definition at line 270 of file Nyquist.h.

Referenced by OutputCallback(), Process(), and RedirectOutput().

◆ mReentryCount

int NyquistEffect::mReentryCount = 0
staticprivate

Definition at line 140 of file Nyquist.h.

Referenced by Process().

◆ mReleaseVersion

TranslatableString NyquistEffect::mReleaseVersion
private

Definition at line 257 of file Nyquist.h.

Referenced by GetVersion(), and Parse().

◆ mRestoreSplits

bool NyquistEffect::mRestoreSplits
private

Definition at line 305 of file Nyquist.h.

Referenced by Parse(), and ProcessOne().

◆ mScale

double NyquistEffect::mScale
private

Definition at line 291 of file Nyquist.h.

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

◆ mStop

bool NyquistEffect::mStop
private

Definition at line 228 of file Nyquist.h.

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

◆ mTrace

bool NyquistEffect::mTrace
private

Definition at line 234 of file Nyquist.h.

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

◆ mTrackIndex

int NyquistEffect::mTrackIndex
private

Definition at line 283 of file Nyquist.h.

Referenced by Process(), and ProcessOne().

◆ mType

EffectType NyquistEffect::mType
private

Definition at line 263 of file Nyquist.h.

Referenced by DoLoadSettings(), GetClassification(), GetType(), Init(), Parse(), and ParseProgram().

◆ mVersion

int NyquistEffect::mVersion
private

Definition at line 275 of file Nyquist.h.

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

◆ mXlispPath

wxString NyquistEffect::mXlispPath
private

Definition at line 223 of file Nyquist.h.


The documentation for this class was generated from the following files: