mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-08 16:11:14 +02:00
Restore default behaviour if no clips found to pre-r11704 status, whilst still get proper max and min for severely-offset waveforms.
This commit is contained in:
parent
4e7769ce79
commit
68e2d00f9b
@ -1539,7 +1539,9 @@ double WaveTrack::GetEndTime()
|
||||
bool WaveTrack::GetMinMax(float *min, float *max,
|
||||
double t0, double t1)
|
||||
{
|
||||
*min = FLT_MAX;
|
||||
bool clipFound = false;
|
||||
|
||||
*min = FLT_MAX; // we need these at extremes to make sure we find true min and max
|
||||
*max = -FLT_MAX;
|
||||
|
||||
if (t0 > t1)
|
||||
@ -1556,6 +1558,7 @@ bool WaveTrack::GetMinMax(float *min, float *max,
|
||||
|
||||
if (t1 >= clip->GetStartTime() && t0 <= clip->GetEndTime())
|
||||
{
|
||||
clipFound = true;
|
||||
float clipmin, clipmax;
|
||||
if (it->GetData()->GetMinMax(&clipmin, &clipmax, t0, t1))
|
||||
{
|
||||
@ -1570,6 +1573,12 @@ bool WaveTrack::GetMinMax(float *min, float *max,
|
||||
}
|
||||
}
|
||||
|
||||
if(!clipFound)
|
||||
{
|
||||
*min = float(0.0); // sensible defaults if no clips found
|
||||
*max = float(0.0);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user