mirror of
https://github.com/cookiengineer/audacity
synced 2025-12-19 15:11:23 +01:00
Support version 3 syntax in Nyquist Prompt.
This commit is contained in:
@@ -48,6 +48,7 @@ effects from this one class.
|
|||||||
#include <wx/textdlg.h>
|
#include <wx/textdlg.h>
|
||||||
#include <wx/textfile.h>
|
#include <wx/textfile.h>
|
||||||
#include <wx/choice.h>
|
#include <wx/choice.h>
|
||||||
|
#include <wx/checkbox.h>
|
||||||
|
|
||||||
#include "../../AudacityApp.h"
|
#include "../../AudacityApp.h"
|
||||||
#include "../../FileNames.h"
|
#include "../../FileNames.h"
|
||||||
@@ -58,6 +59,7 @@ effects from this one class.
|
|||||||
#include "../../WaveClip.h"
|
#include "../../WaveClip.h"
|
||||||
#include "../../WaveTrack.h"
|
#include "../../WaveTrack.h"
|
||||||
#include "../../widgets/valnum.h"
|
#include "../../widgets/valnum.h"
|
||||||
|
#include "../../Prefs.h"
|
||||||
|
|
||||||
#include "Nyquist.h"
|
#include "Nyquist.h"
|
||||||
|
|
||||||
@@ -100,6 +102,7 @@ EffectNyquist::EffectNyquist(wxString fName)
|
|||||||
|
|
||||||
if (fName == wxT("")) {
|
if (fName == wxT("")) {
|
||||||
// Interactive Nyquist
|
// Interactive Nyquist
|
||||||
|
gPrefs->Read(wxT("/Effects/NyquistPrompt/Version"), &mVersion, 4);
|
||||||
mOK = true;
|
mOK = true;
|
||||||
mInteractive = true;
|
mInteractive = true;
|
||||||
mName = _("Nyquist Prompt...");
|
mName = _("Nyquist Prompt...");
|
||||||
@@ -531,6 +534,7 @@ bool EffectNyquist::PromptUser()
|
|||||||
_("Nyquist Prompt"),
|
_("Nyquist Prompt"),
|
||||||
_("Enter Nyquist Command: "),
|
_("Enter Nyquist Command: "),
|
||||||
mInputCmd);
|
mInputCmd);
|
||||||
|
dlog.mVersion = mVersion;
|
||||||
dlog.CentreOnParent();
|
dlog.CentreOnParent();
|
||||||
int result = dlog.ShowModal();
|
int result = dlog.ShowModal();
|
||||||
|
|
||||||
@@ -538,6 +542,8 @@ bool EffectNyquist::PromptUser()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mVersion = dlog.mVersion;
|
||||||
|
|
||||||
/*if (result == eDebugID) {
|
/*if (result == eDebugID) {
|
||||||
mDebug = true;
|
mDebug = true;
|
||||||
}*/
|
}*/
|
||||||
@@ -895,10 +901,17 @@ bool EffectNyquist::ProcessOne()
|
|||||||
{
|
{
|
||||||
nyx_rval rval;
|
nyx_rval rval;
|
||||||
|
|
||||||
nyx_set_audio_name(mVersion >= 4 ? "*TRACK*" : "S");
|
|
||||||
|
|
||||||
wxString cmd;
|
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
|
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
|
||||||
{
|
{
|
||||||
static const wxString varName(wxT("*F0*"));
|
static const wxString varName(wxT("*F0*"));
|
||||||
@@ -1698,8 +1711,10 @@ void NyquistDialog::OnPreview(wxCommandEvent & /* event */)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************/
|
/**********************************************************/
|
||||||
|
#define ID_VERSION 1001
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(NyquistInputDialog, wxDialog)
|
BEGIN_EVENT_TABLE(NyquistInputDialog, wxDialog)
|
||||||
|
EVT_CHECKBOX(ID_VERSION, NyquistInputDialog::OnVersionCheck)
|
||||||
EVT_BUTTON(wxID_OK, NyquistInputDialog::OnOk)
|
EVT_BUTTON(wxID_OK, NyquistInputDialog::OnOk)
|
||||||
EVT_BUTTON(wxID_CANCEL, NyquistInputDialog::OnCancel)
|
EVT_BUTTON(wxID_CANCEL, NyquistInputDialog::OnCancel)
|
||||||
EVT_BUTTON(eDebugID, NyquistInputDialog::OnDebug)
|
EVT_BUTTON(eDebugID, NyquistInputDialog::OnDebug)
|
||||||
@@ -1712,6 +1727,9 @@ NyquistInputDialog::NyquistInputDialog(wxWindow * parent, wxWindowID id,
|
|||||||
wxString initialCommand)
|
wxString initialCommand)
|
||||||
: wxDialog(parent, id, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
: 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);
|
ShuttleGui S(this, eIsCreating);
|
||||||
|
|
||||||
S.StartVerticalLay();
|
S.StartVerticalLay();
|
||||||
@@ -1728,6 +1746,14 @@ NyquistInputDialog::NyquistInputDialog(wxWindow * parent, wxWindowID id,
|
|||||||
mCommandText->SetMinSize(wxSize(500, 200));
|
mCommandText->SetMinSize(wxSize(500, 200));
|
||||||
}
|
}
|
||||||
S.EndHorizontalLay();
|
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();
|
S.EndVerticalLay();
|
||||||
|
|
||||||
@@ -1744,6 +1770,13 @@ wxString NyquistInputDialog::GetCommand()
|
|||||||
return mCommandText->GetValue();
|
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 */)
|
void NyquistInputDialog::OnOk(wxCommandEvent & /* event */)
|
||||||
{
|
{
|
||||||
EndModal(wxID_OK);
|
EndModal(wxID_OK);
|
||||||
|
|||||||
@@ -245,9 +245,12 @@ class NyquistInputDialog:public wxDialog
|
|||||||
wxString initialCommand);
|
wxString initialCommand);
|
||||||
|
|
||||||
wxString GetCommand();
|
wxString GetCommand();
|
||||||
|
void OnVersionCheck(wxCommandEvent& evt);
|
||||||
|
int mVersion;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxTextCtrl *mCommandText;
|
wxTextCtrl *mCommandText;
|
||||||
|
wxCheckBox *mVersionCheckBox;
|
||||||
|
|
||||||
void OnOk(wxCommandEvent & event);
|
void OnOk(wxCommandEvent & event);
|
||||||
void OnCancel(wxCommandEvent & event);
|
void OnCancel(wxCommandEvent & event);
|
||||||
|
|||||||
Reference in New Issue
Block a user