Complete the alerts for the known misfires of this effect. Most cases, it does nothing.
Previous commit had problem because TrackProgress() can report false for user cancellation, not actual failure, so I separated out mbDidSomething, to check whether it actually made any changes, for all tracks.
This commit is contained in:
parent
d862db8b16
commit
477ab4245e
|
@ -124,6 +124,7 @@ bool EffectClickRemoval::Process()
|
||||||
{
|
{
|
||||||
this->CopyInputTracks(); // Set up mOutputTracks.
|
this->CopyInputTracks(); // Set up mOutputTracks.
|
||||||
bool bGoodResult = true;
|
bool bGoodResult = true;
|
||||||
|
mbDidSomething = false;
|
||||||
|
|
||||||
SelectedTrackListOfKindIterator iter(Track::Wave, mOutputTracks);
|
SelectedTrackListOfKindIterator iter(Track::Wave, mOutputTracks);
|
||||||
WaveTrack *track = (WaveTrack *) iter.First();
|
WaveTrack *track = (WaveTrack *) iter.First();
|
||||||
|
@ -149,8 +150,14 @@ bool EffectClickRemoval::Process()
|
||||||
track = (WaveTrack *) iter.Next();
|
track = (WaveTrack *) iter.Next();
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
this->ReplaceProcessedTracks(bGoodResult);
|
if (bGoodResult && !mbDidSomething) // Processing successful, but ineffective.
|
||||||
return bGoodResult;
|
wxMessageBox(
|
||||||
|
wxString::Format(_("Algorithm not effective on these data. Nothing changed.")),
|
||||||
|
this->GetEffectName(),
|
||||||
|
wxOK | wxICON_ERROR);
|
||||||
|
|
||||||
|
this->ReplaceProcessedTracks(bGoodResult && mbDidSomething);
|
||||||
|
return bGoodResult && mbDidSomething;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EffectClickRemoval::ProcessOne(int count, WaveTrack * track, sampleCount start, sampleCount len)
|
bool EffectClickRemoval::ProcessOne(int count, WaveTrack * track, sampleCount start, sampleCount len)
|
||||||
|
@ -170,7 +177,7 @@ bool EffectClickRemoval::ProcessOne(int count, WaveTrack * track, sampleCount st
|
||||||
if (idealBlockLen % windowSize != 0)
|
if (idealBlockLen % windowSize != 0)
|
||||||
idealBlockLen += (windowSize - (idealBlockLen % windowSize));
|
idealBlockLen += (windowSize - (idealBlockLen % windowSize));
|
||||||
|
|
||||||
bool bResult = false; // This effect usually does nothing.
|
bool bResult = true;
|
||||||
sampleCount s = 0;
|
sampleCount s = 0;
|
||||||
float *buffer = new float[idealBlockLen];
|
float *buffer = new float[idealBlockLen];
|
||||||
float *datawindow = new float[windowSize];
|
float *datawindow = new float[windowSize];
|
||||||
|
@ -194,19 +201,19 @@ bool EffectClickRemoval::ProcessOne(int count, WaveTrack * track, sampleCount st
|
||||||
for(j=wcopy; j<windowSize; j++)
|
for(j=wcopy; j<windowSize; j++)
|
||||||
datawindow[j] = 0;
|
datawindow[j] = 0;
|
||||||
|
|
||||||
bResult |= RemoveClicks(windowSize, datawindow);
|
mbDidSomething |= RemoveClicks(windowSize, datawindow);
|
||||||
|
|
||||||
for(j=0; j<wcopy; j++)
|
for(j=0; j<wcopy; j++)
|
||||||
buffer[i+j] = datawindow[j];
|
buffer[i+j] = datawindow[j];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bResult) // RemoveClicks() actually did something.
|
if (mbDidSomething) // RemoveClicks() actually did something.
|
||||||
track->Set((samplePtr) buffer, floatSample, start + s, block);
|
track->Set((samplePtr) buffer, floatSample, start + s, block);
|
||||||
|
|
||||||
s += block;
|
s += block;
|
||||||
|
|
||||||
if (TrackProgress(count, s / (double) len)) {
|
if (TrackProgress(count, s / (double) len)) {
|
||||||
// Not necessarily a failure, as might be eProgressCancelled. // bResult = false;
|
bResult = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -214,12 +221,6 @@ bool EffectClickRemoval::ProcessOne(int count, WaveTrack * track, sampleCount st
|
||||||
delete[] buffer;
|
delete[] buffer;
|
||||||
delete[] datawindow;
|
delete[] datawindow;
|
||||||
|
|
||||||
if (!bResult)
|
|
||||||
wxMessageBox(
|
|
||||||
wxString::Format(_("Algorithm not effective on these data. Nothing changed.")),
|
|
||||||
this->GetEffectName(),
|
|
||||||
wxOK | wxICON_ERROR);
|
|
||||||
|
|
||||||
return bResult;
|
return bResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,7 @@ private:
|
||||||
|
|
||||||
Envelope *mEnvelope;
|
Envelope *mEnvelope;
|
||||||
|
|
||||||
|
bool mbDidSomething; // This effect usually does nothing on real-world data.
|
||||||
int windowSize;
|
int windowSize;
|
||||||
int mThresholdLevel;
|
int mThresholdLevel;
|
||||||
int mClickWidth;
|
int mClickWidth;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user