1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-17 16:40:07 +02:00

Correct prefs

Remove a pass if not needed
This commit is contained in:
martynshaw99 2011-06-12 23:18:14 +00:00
parent fe2449858d
commit 97620f561a

View File

@ -53,14 +53,14 @@ static double gFrameSum; //lda odd ... having this as member var crashed on exit
bool EffectNormalize::Init() bool EffectNormalize::Init()
{ {
int boolProxy = gPrefs->Read(wxT("/Presets/Norm_AmpDbGain"), 1); int boolProxy = gPrefs->Read(wxT("/Effects/Normalize/RemoveDcOffset"), 1);
mGain = (boolProxy == 1);
boolProxy = gPrefs->Read(wxT("/Presets/Norm_RemoveDcOffset"), 1);
mDC = (boolProxy == 1); mDC = (boolProxy == 1);
gPrefs->Read(wxT("/Presets/Norm_Level"), &mLevel, -1.0); boolProxy = gPrefs->Read(wxT("/Effects/Normalize/Normalize"), 1);
if(mLevel > 0.0) mGain = (boolProxy == 1);
gPrefs->Read(wxT("/Effects/Normalize/Level"), &mLevel, -1.0);
if(mLevel > 0.0) // this should never happen
mLevel = -mLevel; mLevel = -mLevel;
boolProxy = gPrefs->Read(wxT("/Presets/Norm_StereoIndependent"), 0L); boolProxy = gPrefs->Read(wxT("/Effects/Normalize/StereoIndependent"), 0L);
mStereoInd = (boolProxy == 1); mStereoInd = (boolProxy == 1);
return true; return true;
} }
@ -102,7 +102,7 @@ bool EffectNormalize::CheckWhetherSkipEffect()
void EffectNormalize::End() void EffectNormalize::End()
{ {
bool bValidate; bool bValidate;
gPrefs->Read(wxT("/Validate/Enabled"), &bValidate, false ); gPrefs->Read(wxT("/Validate/Enabled"), &bValidate, false ); // this never get written! Why is this here? MJS
if( bValidate ) if( bValidate )
{ {
int checkOffset = abs((int)(mOffset * 1000.0)); int checkOffset = abs((int)(mOffset * 1000.0));
@ -133,10 +133,10 @@ bool EffectNormalize::PromptUser()
mDC = dlog.mDC; mDC = dlog.mDC;
mLevel = dlog.mLevel; mLevel = dlog.mLevel;
mStereoInd = dlog.mStereoInd; mStereoInd = dlog.mStereoInd;
gPrefs->Write(wxT("/Presets/Norm_AmpDbGain"), mGain); gPrefs->Write(wxT("/Effects/Normalize/RemoveDcOffset"), mDC);
gPrefs->Write(wxT("/Presets/Norm_RemoveDcOffset"), mDC); gPrefs->Write(wxT("/Effects/Normalize/Normalize"), mGain);
gPrefs->Write(wxT("/Presets/Norm_Level"), mLevel); gPrefs->Write(wxT("/Effects/Normalize/Level"), mLevel);
gPrefs->Write(wxT("/Presets/Norm_StereoIndependent"), mStereoInd); gPrefs->Write(wxT("/Effects/Normalize/StereoIndependent"), mStereoInd);
return true; return true;
} }
@ -235,8 +235,10 @@ bool EffectNormalize::ProcessOne(WaveTrack * track,
int pass; int pass;
for(pass=0; pass<2; pass++) { for(pass=0; pass<2; pass++)
{
if(pass==0 && !mDC) // we don't need an analysis pass if not doing dc removal
continue;
if (pass==0) if (pass==0)
StartAnalysis(); // dc offset only. Max/min done in Process(). StartAnalysis(); // dc offset only. Max/min done in Process().
if (pass==1) if (pass==1)