mirror of
				https://github.com/cookiengineer/audacity
				synced 2025-11-04 16:14:00 +01: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:
		@@ -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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user