1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-02 16:49:41 +02:00

Support version 3 syntax in Nyquist Prompt.

This commit is contained in:
stevethefiddle@gmail.com 2014-11-17 02:48:47 +00:00
parent 2527327fd7
commit 8ca85d0595
2 changed files with 38 additions and 2 deletions

View File

@ -48,6 +48,7 @@ effects from this one class.
#include <wx/textdlg.h>
#include <wx/textfile.h>
#include <wx/choice.h>
#include <wx/checkbox.h>
#include "../../AudacityApp.h"
#include "../../FileNames.h"
@ -58,6 +59,7 @@ effects from this one class.
#include "../../WaveClip.h"
#include "../../WaveTrack.h"
#include "../../widgets/valnum.h"
#include "../../Prefs.h"
#include "Nyquist.h"
@ -100,6 +102,7 @@ EffectNyquist::EffectNyquist(wxString fName)
if (fName == wxT("")) {
// Interactive Nyquist
gPrefs->Read(wxT("/Effects/NyquistPrompt/Version"), &mVersion, 4);
mOK = true;
mInteractive = true;
mName = _("Nyquist Prompt...");
@ -531,6 +534,7 @@ bool EffectNyquist::PromptUser()
_("Nyquist Prompt"),
_("Enter Nyquist Command: "),
mInputCmd);
dlog.mVersion = mVersion;
dlog.CentreOnParent();
int result = dlog.ShowModal();
@ -538,6 +542,8 @@ bool EffectNyquist::PromptUser()
return false;
}
mVersion = dlog.mVersion;
/*if (result == eDebugID) {
mDebug = true;
}*/
@ -895,10 +901,17 @@ bool EffectNyquist::ProcessOne()
{
nyx_rval rval;
nyx_set_audio_name(mVersion >= 4 ? "*TRACK*" : "S");
wxString cmd;
if (mVersion >= 4) {
nyx_set_audio_name("*TRACK*");
cmd += wxT("(setf S 0.25)\n");
}
else {
nyx_set_audio_name("S");
cmd += wxT("(setf *TRACK* '*unbound*)\n");
}
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
{
static const wxString varName(wxT("*F0*"));
@ -1698,8 +1711,10 @@ void NyquistDialog::OnPreview(wxCommandEvent & /* event */)
}
/**********************************************************/
#define ID_VERSION 1001
BEGIN_EVENT_TABLE(NyquistInputDialog, wxDialog)
EVT_CHECKBOX(ID_VERSION, NyquistInputDialog::OnVersionCheck)
EVT_BUTTON(wxID_OK, NyquistInputDialog::OnOk)
EVT_BUTTON(wxID_CANCEL, NyquistInputDialog::OnCancel)
EVT_BUTTON(eDebugID, NyquistInputDialog::OnDebug)
@ -1712,6 +1727,9 @@ NyquistInputDialog::NyquistInputDialog(wxWindow * parent, wxWindowID id,
wxString initialCommand)
: wxDialog(parent, id, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
{
// Recover last used setting.
gPrefs->Read(wxT("/Effects/NyquistPrompt/Version"), &mVersion, 4);
ShuttleGui S(this, eIsCreating);
S.StartVerticalLay();
@ -1728,6 +1746,14 @@ NyquistInputDialog::NyquistInputDialog(wxWindow * parent, wxWindowID id,
mCommandText->SetMinSize(wxSize(500, 200));
}
S.EndHorizontalLay();
S.StartHorizontalLay(wxEXPAND, 0);
{
mVersionCheckBox = S.Id(ID_VERSION).AddCheckBox(_("&Use legacy (version 3) syntax."),
(mVersion == 3) ? wxT("true") : wxT("false"));
}
S.EndHorizontalLay();
}
S.EndVerticalLay();
@ -1744,6 +1770,13 @@ wxString NyquistInputDialog::GetCommand()
return mCommandText->GetValue();
}
void NyquistInputDialog::OnVersionCheck(wxCommandEvent& WXUNUSED(evt))
{
mVersion = (mVersionCheckBox->GetValue()) ? 3 : 4;
gPrefs->Write(wxT("/Effects/NyquistPrompt/Version"), mVersion);
gPrefs->Flush();
}
void NyquistInputDialog::OnOk(wxCommandEvent & /* event */)
{
EndModal(wxID_OK);

View File

@ -245,9 +245,12 @@ class NyquistInputDialog:public wxDialog
wxString initialCommand);
wxString GetCommand();
void OnVersionCheck(wxCommandEvent& evt);
int mVersion;
private:
wxTextCtrl *mCommandText;
wxCheckBox *mVersionCheckBox;
void OnOk(wxCommandEvent & event);
void OnCancel(wxCommandEvent & event);