1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-18 17:10:05 +02:00

Better fix for bug 604, not losing the repaired track.

This commit is contained in:
martynshaw99 2013-01-12 22:17:41 +00:00
parent aac65490f9
commit 2dca704213

View File

@ -69,6 +69,7 @@ bool EffectRepair::Process()
double repair_t1 = mT1; double repair_t1 = mT1;
repair_t0 = (repair_t0 < trackStart? trackStart: repair_t0); repair_t0 = (repair_t0 < trackStart? trackStart: repair_t0);
repair_t1 = (repair_t1 > trackEnd? trackEnd: repair_t1); repair_t1 = (repair_t1 > trackEnd? trackEnd: repair_t1);
if (repair_t0 < repair_t1) { // selection is within track audio
double rate = track->GetRate(); double rate = track->GetRate();
double repair_deltat = repair_t1 - repair_t0; double repair_deltat = repair_t1 - repair_t0;
@ -94,8 +95,6 @@ bool EffectRepair::Process()
sampleCount repairStart = (sampleCount)(repair0 - s0); sampleCount repairStart = (sampleCount)(repair0 - s0);
sampleCount repairLen = (sampleCount)(repair1 - repair0); sampleCount repairLen = (sampleCount)(repair1 - repair0);
sampleCount len = (sampleCount)(s1 - s0); sampleCount len = (sampleCount)(s1 - s0);
if (len < 0)
break; // FIX-ME: This failsafes bug 604, but does not account for why it actually happens.
if (repairLen > 128) { if (repairLen > 128) {
::wxMessageBox(_("The Repair effect is intended to be used on very short sections of damaged audio (up to 128 samples).\n\nZoom in and select a tiny fraction of a second to repair.")); ::wxMessageBox(_("The Repair effect is intended to be used on very short sections of damaged audio (up to 128 samples).\n\nZoom in and select a tiny fraction of a second to repair."));
@ -105,7 +104,7 @@ bool EffectRepair::Process()
if (s0 == repair0 && s1 == repair1) { if (s0 == repair0 && s1 == repair1) {
::wxMessageBox(_("Repair works by using audio data outside the selection region.\n\nPlease select a region that has audio touching at least one side of it.\n\nThe more surrounding audio, the better it performs.")); ::wxMessageBox(_("Repair works by using audio data outside the selection region.\n\nPlease select a region that has audio touching at least one side of it.\n\nThe more surrounding audio, the better it performs."));
/// The Repair effect needs some data to go on.\n\nPlease select an area to repair with some audio on at least one side (the more the better).")); /// The Repair effect needs some data to go on.\n\nPlease select an area to repair with some audio on at least one side (the more the better)."));
bGoodResult = false; bGoodResult = false;
break; break;
} }
@ -115,6 +114,7 @@ bool EffectRepair::Process()
bGoodResult = false; bGoodResult = false;
break; break;
} }
}
track = (WaveTrack *) iter.Next(); track = (WaveTrack *) iter.Next();
count++; count++;