1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-17 16:50:26 +02:00

Make old Noise Removal effect compilable again

This commit is contained in:
Paul Licameli 2016-04-02 12:41:36 -04:00
parent 2d57549f0c
commit 8e447493eb
2 changed files with 15 additions and 9 deletions

View File

@ -50,6 +50,7 @@
#include "../Prefs.h" #include "../Prefs.h"
#include "../Project.h" #include "../Project.h"
#include "../FileNames.h" #include "../FileNames.h"
#include "../ShuttleGui.h"
#include <math.h> #include <math.h>
@ -153,9 +154,9 @@ bool EffectNoiseRemoval::CheckWhetherSkipEffect()
return (mLevel == 0); return (mLevel == 0);
} }
bool EffectNoiseRemoval::PromptUser() bool EffectNoiseRemoval::PromptUser(wxWindow *parent)
{ {
NoiseRemovalDialog dlog(this, mParent); NoiseRemovalDialog dlog(this, parent);
dlog.mSensitivity = mSensitivity; dlog.mSensitivity = mSensitivity;
dlog.mGain = -mNoiseGain; dlog.mGain = -mNoiseGain;
dlog.mFreq = mFreqSmoothingHz; dlog.mFreq = mFreqSmoothingHz;
@ -614,13 +615,12 @@ bool EffectNoiseRemoval::ProcessOne(int count, WaveTrack * track,
double tLen = mOutputTrack->LongSamplesToTime(len); double tLen = mOutputTrack->LongSamplesToTime(len);
// Filtering effects always end up with more data than they started with. Delete this 'tail'. // Filtering effects always end up with more data than they started with. Delete this 'tail'.
mOutputTrack->HandleClear(tLen, mOutputTrack->GetEndTime(), false, false); mOutputTrack->HandleClear(tLen, mOutputTrack->GetEndTime(), false, false);
bool bResult = track->ClearAndPaste(t0, t0 + tLen, mOutputTrack, true, false); bool bResult = track->ClearAndPaste(t0, t0 + tLen, mOutputTrack.get(), true, false);
wxASSERT(bResult); // TO DO: Actually handle this. wxASSERT(bResult); // TO DO: Actually handle this.
} }
// Delete the outputTrack now that its data is inserted in place // Delete the outputTrack now that its data is inserted in place
delete mOutputTrack; mOutputTrack.reset();
mOutputTrack = NULL;
} }
return bLoopSuccess; return bLoopSuccess;
@ -680,8 +680,8 @@ BEGIN_EVENT_TABLE(NoiseRemovalDialog,wxDialog)
END_EVENT_TABLE() END_EVENT_TABLE()
NoiseRemovalDialog::NoiseRemovalDialog(EffectNoiseRemoval * effect, NoiseRemovalDialog::NoiseRemovalDialog(EffectNoiseRemoval * effect,
wxWindow *parent) : wxWindow *parent)
EffectDialog( parent, _("Noise Removal"), PROCESS_EFFECT) : EffectDialog( parent, _("Noise Removal"), EffectTypeProcess)
{ {
m_pEffect = effect; m_pEffect = effect;

View File

@ -20,6 +20,7 @@
#include "Effect.h" #include "Effect.h"
#include "../MemoryX.h"
#include <wx/dialog.h> #include <wx/dialog.h>
#include <wx/slider.h> #include <wx/slider.h>
@ -30,8 +31,13 @@ class wxString;
class Envelope; class Envelope;
class WaveTrack; class WaveTrack;
class wxRadioButton;
class wxTextCtrl;
#include "../RealFFTf.h" #include "../RealFFTf.h"
#define NOISEREMOVAL_PLUGIN_SYMBOL XO("Noise Removal")
class EffectNoiseRemoval final : public Effect class EffectNoiseRemoval final : public Effect
{ {
public: public:
@ -50,7 +56,7 @@ public:
// Effect implementation // Effect implementation
bool PromptUser() override; bool PromptUser(wxWindow *parent) override;
bool Init() override; bool Init() override;
bool CheckWhetherSkipEffect() override; bool CheckWhetherSkipEffect() override;
bool Process() override; bool Process() override;
@ -94,7 +100,7 @@ private:
void Cleanup(); void Cleanup();
// Variables that only exist during processing // Variables that only exist during processing
WaveTrack *mOutputTrack; std::unique_ptr<WaveTrack> mOutputTrack;
sampleCount mInSampleCount; sampleCount mInSampleCount;
sampleCount mOutSampleCount; sampleCount mOutSampleCount;
int mInputPos; int mInputPos;