1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-24 07:51:16 +02:00

Correct bug when just doing dc offset. Improve messages.

This commit is contained in:
martynshaw99 2012-05-19 20:30:57 +00:00
parent 96eff824d7
commit 95037c7b07

View File

@ -146,9 +146,13 @@ bool EffectNormalize::Process()
if (mGain == false && mDC == false) if (mGain == false && mDC == false)
return true; return true;
float ratio = pow(10.0,TrapDouble(mLevel, // same value used for all tracks float ratio;
if( mGain )
ratio = pow(10.0,TrapDouble(mLevel, // same value used for all tracks
NORMALIZE_DB_MIN, NORMALIZE_DB_MIN,
NORMALIZE_DB_MAX)/20.0); NORMALIZE_DB_MAX)/20.0);
else
ratio = 1.0;
//Iterate over each track //Iterate over each track
this->CopyInputTracks(); // Set up mOutputTracks. this->CopyInputTracks(); // Set up mOutputTracks.
@ -183,7 +187,10 @@ bool EffectNormalize::Process()
wxString msg, trackName; wxString msg, trackName;
trackName = wxString::Format(track->GetName().c_str()); trackName = wxString::Format(track->GetName().c_str());
msg = topMsg + _("Analyzing: ") + trackName; if(!track->GetLinked() || mStereoInd)
msg = topMsg + _("Analyzing: ") + trackName;
else
msg = topMsg + _("Analyzing first track of stereo pair: ") + trackName;
AnalyseTrack(track, msg); // sets mOffset and offset-adjusted mMin and mMax AnalyseTrack(track, msg); // sets mOffset and offset-adjusted mMin and mMax
if(!track->GetLinked() || mStereoInd) { // mono or 'stereo tracks independently' if(!track->GetLinked() || mStereoInd) { // mono or 'stereo tracks independently'
float extent = wxMax(fabs(mMax), fabs(mMin)); float extent = wxMax(fabs(mMax), fabs(mMin));
@ -191,9 +198,10 @@ bool EffectNormalize::Process()
mMult = ratio / extent; mMult = ratio / extent;
else else
mMult = 1.0; mMult = 1.0;
msg = topMsg + _("Normalizing: ") + trackName; msg = topMsg + _("Processing: ") + trackName;
if(track->GetLinked() || prevTrack->GetLinked()) // only get here if there is a linked track but we are processing independently if(track->GetLinked() || prevTrack->GetLinked()) // only get here if there is a linked track but we are processing independently
msg += wxT("\nProcessing stereo channels independently"); msg = topMsg + _("Processing stereo channels independently: ") + trackName;
if (!ProcessOne(track, msg)) if (!ProcessOne(track, msg))
{ {
bGoodResult = false; bGoodResult = false;
@ -223,7 +231,7 @@ bool EffectNormalize::Process()
mMult = 1.0; mMult = 1.0;
track = (WaveTrack *) iter.Prev(); // go back to the first linked one track = (WaveTrack *) iter.Prev(); // go back to the first linked one
mOffset = offset1; mOffset = offset1;
msg = topMsg + _("Normalizing first track of stereo pair: ") + trackName; msg = topMsg + _("Processing first track of stereo pair: ") + trackName;
if (!ProcessOne(track, msg)) if (!ProcessOne(track, msg))
{ {
bGoodResult = false; bGoodResult = false;
@ -232,7 +240,7 @@ bool EffectNormalize::Process()
mCurTrackNum++; // keeps progress bar correct mCurTrackNum++; // keeps progress bar correct
track = (WaveTrack *) iter.Next(); // go to the second linked one track = (WaveTrack *) iter.Next(); // go to the second linked one
mOffset = offset2; mOffset = offset2;
msg = topMsg + _("Normalizing second track of stereo pair: ") + trackName; msg = topMsg + _("Processing second track of stereo pair: ") + trackName;
if (!ProcessOne(track, msg)) if (!ProcessOne(track, msg))
{ {
bGoodResult = false; bGoodResult = false;