1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-24 16:20:05 +02:00

Use DBL_MAX, not arbitrary 1000000000.0, as "infinite" time interval

This commit is contained in:
Paul Licameli 2016-09-19 10:38:42 -04:00
parent ce1f587feb
commit 0eb2f85bfb
7 changed files with 12 additions and 7 deletions

View File

@ -269,6 +269,7 @@ writing audio.
#include "AudioIO.h"
#include "float_cast.h"
#include <cfloat>
#include <math.h>
#include <stdlib.h>
#include <algorithm>

View File

@ -70,7 +70,8 @@ bool ValidateDeviceNames();
class AudioIOListener;
#define BAD_STREAM_TIME -1000000000.0
// #include <cfloat> if you need this constant
#define BAD_STREAM_TIME (-DBL_MAX)
#define MAX_MIDI_BUFFER_SIZE 5000
#define DEFAULT_SYNTH_LATENCY 5

View File

@ -421,7 +421,7 @@ void Lyrics::Update(double t)
{
if (t < 0.0)
{
// TrackPanel::OnTimer passes gAudioIO->GetStreamTime(), which is -1000000000 if !IsStreamActive().
// TrackPanel::OnTimer passes gAudioIO->GetStreamTime(), which is -DBL_MAX if !IsStreamActive().
// In that case, use the selection start time.
AudacityProject* pProj = GetActiveProject();
mT = pProj->GetSel0();

View File

@ -5888,7 +5888,7 @@ void AudacityProject::HandleAlign(int index, bool moveSel)
wxString action;
wxString shortAction;
double offset;
double minOffset = 1000000000.0;
double minOffset = DBL_MAX;
double maxEndOffset = 0.0;
double leftOffset = 0.0;
bool bRightChannel = false;

View File

@ -13,6 +13,7 @@
#include "Experimental.h"
#include "MixerBoard.h"
#include <cfloat>
#include <math.h>
#include <wx/dcmemory.h>

View File

@ -16,6 +16,7 @@
#include "Audacity.h"
#include "TimeTrack.h"
#include <cfloat>
#include <wx/intl.h>
#include "AColor.h"
#include "widgets/Ruler.h"
@ -44,7 +45,7 @@ TimeTrack::TimeTrack(const std::shared_ptr<DirManager> &projDirManager, const Zo
mDisplayLog = false;
mEnvelope = std::make_unique<Envelope>();
mEnvelope->SetTrackLen(1000000000.0);
mEnvelope->SetTrackLen(DBL_MAX);
mEnvelope->SetInterpolateDB(true);
mEnvelope->Flatten(1.0);
mEnvelope->Mirror(false);
@ -71,7 +72,7 @@ TimeTrack::TimeTrack(const TimeTrack &orig):
///@TODO: Give Envelope:: a copy-constructor instead of this?
mEnvelope = std::make_unique<Envelope>();
mEnvelope->SetTrackLen(1000000000.0);
mEnvelope->SetTrackLen(DBL_MAX);
SetInterpolateLog(orig.GetInterpolateLog()); // this calls Envelope::SetInterpolateDB
mEnvelope->Flatten(1.0);
mEnvelope->Mirror(false);

View File

@ -33,6 +33,7 @@
*//*******************************************************************/
#include <algorithm>
#include <cfloat>
#include "../Audacity.h"
#include "../Experimental.h"
@ -891,7 +892,7 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt)
double t0 = p->GetSel0();
double t1 = p->GetSel1();
if (t1 == t0)
t1 = 1000000000.0; // record for a long, long time (tens of years)
t1 = DBL_MAX; // record for a long, long time
/* TODO: set up stereo tracks if that is how the user has set up
* their preferences, and choose sample format based on prefs */
@ -985,7 +986,7 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt)
}
}
t1 = 1000000000.0; // record for a long, long time (tens of years)
t1 = DBL_MAX; // record for a long, long time
}
else {
bool recordingNameCustom, useTrackNumber, useDateStamp, useTimeStamp;