mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-25 16:48:44 +02:00
Fix bug 2041
Nyquist: Generating audio at a point within a track, deletes audio after the generated audio. This fix corrects errors in b9ec434.
This commit is contained in:
parent
f5443c8859
commit
800ddae34b
@ -1202,7 +1202,9 @@ bool Effect::DoEffect(wxWindow *parent,
|
||||
ReplaceProcessedTracks( false );
|
||||
} );
|
||||
|
||||
if ((GetType() == EffectTypeGenerate) && (mNumTracks == 0) && GetPath() != NYQUIST_EFFECTS_PROMPT_ID) {
|
||||
// We don't yet know the effect type for code in the Nyquist Prompt, so
|
||||
// assume it requires a track and handle errors when the effect runs.
|
||||
if ((GetType() == EffectTypeGenerate || GetPath() == NYQUIST_PROMPT_ID) && (mNumTracks == 0)) {
|
||||
newTrack = static_cast<WaveTrack*>(mTracks->Add(mFactory->NewWaveTrack()));
|
||||
newTrack->SetSelected(true);
|
||||
}
|
||||
@ -1218,8 +1220,8 @@ bool Effect::DoEffect(wxWindow *parent,
|
||||
double quantMT1 = QUANTIZED_TIME(mT1, mProjectRate);
|
||||
mDuration = quantMT1 - quantMT0;
|
||||
isSelection = true;
|
||||
mT1 = mT0 + mDuration;
|
||||
}
|
||||
mT1 = mT0 + mDuration;
|
||||
|
||||
mDurationFormat = isSelection
|
||||
? NumericConverter::TimeAndSampleFormat()
|
||||
|
@ -175,19 +175,10 @@ bool NyquistEffectsModule::AutoRegisterPlugins(PluginManagerInterface & pm)
|
||||
wxArrayString files;
|
||||
wxString ignoredErrMsg;
|
||||
|
||||
#if 0
|
||||
if (!pm.IsPluginRegistered(NYQUIST_EFFECTS_PROMPT_ID))
|
||||
if (!pm.IsPluginRegistered(NYQUIST_PROMPT_ID))
|
||||
{
|
||||
// No checking of error ?
|
||||
DiscoverPluginsAtPath(NYQUIST_EFFECTS_PROMPT_ID, ignoredErrMsg,
|
||||
PluginManagerInterface::DefaultRegistrationCallback);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!pm.IsPluginRegistered(NYQUIST_TOOLS_PROMPT_ID))
|
||||
{
|
||||
// No checking of error ?
|
||||
DiscoverPluginsAtPath(NYQUIST_TOOLS_PROMPT_ID, ignoredErrMsg,
|
||||
DiscoverPluginsAtPath(NYQUIST_PROMPT_ID, ignoredErrMsg,
|
||||
PluginManagerInterface::DefaultRegistrationCallback);
|
||||
}
|
||||
|
||||
@ -215,9 +206,8 @@ wxArrayString NyquistEffectsModule::FindPluginPaths(PluginManagerInterface & pm)
|
||||
wxArrayString pathList = NyquistEffect::GetNyquistSearchPath();
|
||||
wxArrayString files;
|
||||
|
||||
// Add the Nyquist prompt effect and tool.
|
||||
//files.Add(NYQUIST_EFFECTS_PROMPT_ID);
|
||||
files.Add(NYQUIST_TOOLS_PROMPT_ID);
|
||||
// Add the Nyquist prompt
|
||||
files.Add(NYQUIST_PROMPT_ID);
|
||||
|
||||
// Load .ny plug-ins
|
||||
pm.FindFilesInPathList(wxT("*.ny"), pathList, files);
|
||||
@ -249,7 +239,7 @@ bool NyquistEffectsModule::IsPluginValid(const wxString & path, bool bFast)
|
||||
// Ignores bFast parameter, since checking file exists is fast enough for
|
||||
// the small number of Nyquist plug-ins that we have.
|
||||
static_cast<void>(bFast);
|
||||
if((path == NYQUIST_EFFECTS_PROMPT_ID) || (path == NYQUIST_TOOLS_PROMPT_ID))
|
||||
if(path == NYQUIST_PROMPT_ID)
|
||||
return true;
|
||||
|
||||
return wxFileName::FileExists(path);
|
||||
|
@ -156,19 +156,8 @@ NyquistEffect::NyquistEffect(const wxString &fName)
|
||||
|
||||
mMaxLen = NYQ_MAX_LEN;
|
||||
|
||||
// Interactive Nyquist (for effects)
|
||||
if (fName == NYQUIST_EFFECTS_PROMPT_ID) {
|
||||
mName = XO("Nyquist Effects Prompt");
|
||||
mType = EffectTypeProcess;
|
||||
mPromptName = mName;
|
||||
mPromptType = mType;
|
||||
mOK = true;
|
||||
mIsPrompt = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Interactive Nyquist (for general tools)
|
||||
if (fName == NYQUIST_TOOLS_PROMPT_ID) {
|
||||
// Interactive Nyquist
|
||||
if (fName == NYQUIST_PROMPT_ID) {
|
||||
mName = XO("Nyquist Prompt");
|
||||
mType = EffectTypeTool;
|
||||
mIsTool = true;
|
||||
@ -204,9 +193,7 @@ NyquistEffect::~NyquistEffect()
|
||||
wxString NyquistEffect::GetPath()
|
||||
{
|
||||
if (mIsPrompt)
|
||||
return (mPromptType == EffectTypeTool) ?
|
||||
NYQUIST_TOOLS_PROMPT_ID :
|
||||
NYQUIST_EFFECTS_PROMPT_ID;
|
||||
return NYQUIST_PROMPT_ID;
|
||||
|
||||
return mFileName.GetFullPath();
|
||||
}
|
||||
@ -214,9 +201,7 @@ wxString NyquistEffect::GetPath()
|
||||
ComponentInterfaceSymbol NyquistEffect::GetSymbol()
|
||||
{
|
||||
if (mIsPrompt)
|
||||
return (mPromptType == EffectTypeTool) ?
|
||||
XO("Nyquist Prompt") :
|
||||
XO("Nyquist Effects Prompt");
|
||||
return XO("Nyquist Prompt");
|
||||
|
||||
return mName;
|
||||
}
|
||||
@ -1358,12 +1343,11 @@ bool NyquistEffect::ProcessOne()
|
||||
mDebugOutput = wxString::Format(_("nyx_error returned from %s.\n"),
|
||||
mName.IsEmpty()? _("plug-in") : mName) + mDebugOutput;
|
||||
mDebug = true;
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
wxLogMessage("Nyquist returned nyx_error:\n%s", mDebugOutput);
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (rval == nyx_string) {
|
||||
@ -1477,7 +1461,7 @@ bool NyquistEffect::ProcessOne()
|
||||
|
||||
if (mOutputTime <= 0) {
|
||||
Effect::MessageBox(_("Nyquist returned nil audio.\n"));
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3207,16 +3191,15 @@ void * nyq_reformat_aud_do_response(const wxString & Str) {
|
||||
LVAL xlc_aud_do(void)
|
||||
{
|
||||
// Based on string-trim...
|
||||
unsigned char *leftp,*rightp;
|
||||
unsigned char *leftp;
|
||||
LVAL src,dst;
|
||||
|
||||
/* get the string */
|
||||
src = xlgastring();
|
||||
xllastarg();
|
||||
|
||||
/* setup the string pointers */
|
||||
/* setup the string pointer */
|
||||
leftp = getstring(src);
|
||||
rightp = leftp + getslength(src) - 2;
|
||||
|
||||
// Go call my real function here...
|
||||
dst = (LVAL)ExecForLisp( (char *)leftp );
|
||||
|
@ -34,8 +34,7 @@
|
||||
name into another alphabet. */
|
||||
#define NYQUISTEFFECTS_FAMILY ( ComponentInterfaceSymbol{ XO("Nyquist") } )
|
||||
|
||||
#define NYQUIST_EFFECTS_PROMPT_ID wxT("Nyquist Effects Prompt")
|
||||
#define NYQUIST_TOOLS_PROMPT_ID wxT("Nyquist Prompt")
|
||||
#define NYQUIST_PROMPT_ID wxT("Nyquist Prompt")
|
||||
#define NYQUIST_WORKER_ID wxT("Nyquist Worker")
|
||||
|
||||
enum NyqControlType
|
||||
|
Loading…
x
Reference in New Issue
Block a user