Audacity  2.2.2
Macros | Enumerations | Functions | Variables
Nyquist.cpp File Reference
#include "../../Audacity.h"
#include <algorithm>
#include <cmath>
#include <locale.h>
#include <wx/checkbox.h>
#include <wx/choice.h>
#include <wx/datetime.h>
#include <wx/intl.h>
#include <wx/log.h>
#include <wx/sstream.h>
#include <wx/textdlg.h>
#include <wx/txtstrm.h>
#include <wx/valgen.h>
#include <wx/wfstream.h>
#include <wx/numformatter.h>
#include "../../AudacityApp.h"
#include "../../FileException.h"
#include "../../FileNames.h"
#include "../../Internat.h"
#include "../../LabelTrack.h"
#include "../../prefs/SpectrogramSettings.h"
#include "../../Project.h"
#include "../../ShuttleGui.h"
#include "../../WaveClip.h"
#include "../../WaveTrack.h"
#include "../../widgets/valnum.h"
#include "../../widgets/ErrorDialog.h"
#include "../../Prefs.h"
#include "../../prefs/WaveformSettings.h"
#include "../../widgets/NumericTextCtrl.h"
#include "../lib-src/FileDialog/FileDialog.h"
#include "Nyquist.h"
#include <iostream>
#include <ostream>
#include <sstream>
#include <float.h>
#include "../../Experimental.h"
#include "../../../lib-src/libnyquist/nyquist/xlisp/xlisp.h"

Go to the source code of this file.

Macros

#define NYQ_MAX_LEN   (std::numeric_limits<long>::max())
 
#define UNINITIALIZED_CONTROL   ((double)99999999.99)
 

Enumerations

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

Functions

 EVT_COMMAND_RANGE (ID_Slider, ID_Slider+99, wxEVT_COMMAND_SLIDER_UPDATED, NyquistEffect::OnSlider) EVT_COMMAND_RANGE(ID_Text
 
NyquistEffect::OnText EVT_COMMAND_RANGE (ID_Choice, ID_Choice+99, wxEVT_COMMAND_CHOICE_SELECTED, NyquistEffect::OnChoice) EVT_COMMAND_RANGE(ID_Time
 
NyquistEffect::OnText
NyquistEffect::OnTime 
EVT_COMMAND_RANGE (ID_FILE, ID_FILE+99, wxEVT_COMMAND_BUTTON_CLICKED, NyquistEffect::OnFileButton) NyquistEffect
 
static void RegisterFunctions ()
 
static LVAL gettext ()
 
static LVAL ngettext ()
 

Variables

static const wxChar * KEY_Version = wxT("Version")
 
static const wxChar * KEY_Command = wxT("Command")
 
 ID_Text = 12000
 
 wxEVT_COMMAND_TEXT_UPDATED
 
NyquistEffect::OnText ID_Time = 14000
 

Macro Definition Documentation

#define NYQ_MAX_LEN   (std::numeric_limits<long>::max())

Definition at line 93 of file Nyquist.cpp.

Referenced by EVT_COMMAND_RANGE(), NyquistEffect::Init(), and NyquistEffect::Process().

#define UNINITIALIZED_CONTROL   ((double)99999999.99)

Enumeration Type Documentation

anonymous enum
Enumerator
ID_Editor 
ID_Version 
ID_Load 
ID_Save 
ID_Slider 
ID_Choice 
ID_FILE 

Definition at line 78 of file Nyquist.cpp.

79 {
80  ID_Editor = 10000,
81  ID_Version,
82  ID_Load,
83  ID_Save,
84 
85  ID_Slider = 11000,
86  ID_Text = 12000,
87  ID_Choice = 13000,
88  ID_Time = 14000,
89  ID_FILE = 15000
90 };
NyquistEffect::OnText ID_Time
Definition: Nyquist.cpp:116
ID_Text
Definition: Nyquist.cpp:112

Function Documentation

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

Definition at line 118 of file Nyquist.cpp.

References _(), EffectTypeProcess, EffectTypeTool, NYQ_MAX_LEN, NYQUIST_EFFECTS_PROMPT_ID, NYQUIST_TOOLS_PROMPT_ID, NYQUIST_WORKER_ID, and XO.

123 {
124  mOutputTrack[0] = mOutputTrack[1] = nullptr;
125 
126  mAction = XO("Applying Nyquist Effect...");
127  mInputCmd = wxEmptyString;
128  mCmd = wxEmptyString;
129  mIsPrompt = false;
130  mExternal = false;
131  mCompiler = false;
132  mTrace = false;
133  mRedirectOutput = false;
134  mDebug = false;
135  mIsSal = false;
136  mOK = false;
137  mAuthor = XO("n/a");
138  mReleaseVersion = XO("n/a");
139  mCopyright = XO("n/a");
140 
141  // set clip/split handling when applying over clip boundary.
142  mRestoreSplits = true; // Default: Restore split lines.
143  mMergeClips = -1; // Default (auto): Merge if length remains unchanged.
144 
145  mVersion = 4;
146 
147  mStop = false;
148  mBreak = false;
149  mCont = false;
150 
151  mMaxLen = NYQ_MAX_LEN;
152 
153  // Interactive Nyquist (for effects)
154  if (fName == NYQUIST_EFFECTS_PROMPT_ID) {
155  mName = XO("Nyquist Effects Prompt");
156  mType = EffectTypeProcess;
157  mPromptName = mName;
158  mPromptType = mType;
159  mOK = true;
160  mIsPrompt = true;
161  return;
162  }
163 
164  // Interactive Nyquist (for general tools)
165  if (fName == NYQUIST_TOOLS_PROMPT_ID) {
166  mName = XO("Nyquist Tools Prompt");
167  mType = EffectTypeTool;
168  mPromptName = mName;
169  mPromptType = mType;
170  mOK = true;
171  mIsPrompt = true;
172  return;
173  }
174 
175  if (fName == NYQUIST_WORKER_ID) {
176  // Effect spawned from Nyquist Prompt
177 /* i18n-hint: It is acceptable to translate this the same as for "Nyquist Prompt" */
178  mName = XO("Nyquist Worker");
179  return;
180  }
181 
182  mFileName = fName;
183  mName = mFileName.GetName();
184  mFileModified = mFileName.GetModificationTime();
185  ParseFile();
186 
187  if (!mOK && mInitError.empty())
188  mInitError = _("Ill-formed Nyquist plug-in header");
189 }
#define NYQUIST_TOOLS_PROMPT_ID
Definition: Nyquist.h:38
#define XO(s)
Definition: Internat.h:33
#define NYQUIST_EFFECTS_PROMPT_ID
Definition: Nyquist.h:37
#define NYQ_MAX_LEN
Definition: Nyquist.cpp:93
#define NYQUIST_WORKER_ID
Definition: Nyquist.h:39
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
static LVAL gettext ( )
static

Definition at line 3083 of file Nyquist.cpp.

References GetCustomTranslation(), and UTF8CTOWX.

Referenced by RegisterFunctions().

3084 {
3085  auto string = UTF8CTOWX(getstring(xlgastring()));
3086  xllastarg();
3087  return cvstring(GetCustomTranslation(string).mb_str(wxConvUTF8));
3088 }
#define UTF8CTOWX(X)
Definition: Internat.h:179
AUDACITY_DLL_API const wxString & GetCustomTranslation(const wxString &str1)
Definition: Internat.cpp:75
static LVAL ngettext ( )
static

Definition at line 3090 of file Nyquist.cpp.

References UTF8CTOWX.

Referenced by RegisterFunctions().

3091 {
3092  auto string1 = UTF8CTOWX(getstring(xlgastring()));
3093  auto string2 = UTF8CTOWX(getstring(xlgastring()));
3094  auto number = getfixnum(xlgafixnum());
3095  xllastarg();
3096  return cvstring(
3097  wxGetTranslation(string1, string2, number).mb_str(wxConvUTF8));
3098 }
#define UTF8CTOWX(X)
Definition: Internat.h:179
static void RegisterFunctions ( )
static

Definition at line 3100 of file Nyquist.cpp.

References gettext(), and ngettext().

Referenced by NyquistEffect::Process().

3101 {
3102  // Add functions to XLisp. Do this only once,
3103  // before the first call to nyx_init.
3104  static bool firstTime = true;
3105  if (firstTime) {
3106  firstTime = false;
3107 
3108  static const FUNDEF functions[] = {
3109  { "_", SUBR, gettext },
3110  { "ngettext", SUBR, ngettext },
3111  };
3112 
3113  xlbindfunctions( functions, sizeof(functions)/sizeof(*functions) );
3114  }
3115 }
static LVAL ngettext()
Definition: Nyquist.cpp:3090
static LVAL gettext()
Definition: Nyquist.cpp:3083

Variable Documentation

ID_Text = 12000
ID_Time = 14000
const wxChar* KEY_Command = wxT("Command")
static
const wxChar* KEY_Version = wxT("Version")
static
NyquistEffect::OnText wxEVT_COMMAND_TEXT_UPDATED

Definition at line 112 of file Nyquist.cpp.

Referenced by NumericTextCtrl::Updated().