From 0eb2f85bfb4aa5778c8c2811412067b2863202c5 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Mon, 19 Sep 2016 10:38:42 -0400 Subject: [PATCH] Use DBL_MAX, not arbitrary 1000000000.0, as "infinite" time interval --- src/AudioIO.cpp | 1 + src/AudioIO.h | 3 ++- src/Lyrics.cpp | 2 +- src/Menus.cpp | 2 +- src/MixerBoard.cpp | 1 + src/TimeTrack.cpp | 5 +++-- src/toolbars/ControlToolBar.cpp | 5 +++-- 7 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/AudioIO.cpp b/src/AudioIO.cpp index fed87be66..a9b8599a5 100644 --- a/src/AudioIO.cpp +++ b/src/AudioIO.cpp @@ -269,6 +269,7 @@ writing audio. #include "AudioIO.h" #include "float_cast.h" +#include #include #include #include diff --git a/src/AudioIO.h b/src/AudioIO.h index 3f89b1d69..929fb2d83 100644 --- a/src/AudioIO.h +++ b/src/AudioIO.h @@ -70,7 +70,8 @@ bool ValidateDeviceNames(); class AudioIOListener; -#define BAD_STREAM_TIME -1000000000.0 +// #include if you need this constant +#define BAD_STREAM_TIME (-DBL_MAX) #define MAX_MIDI_BUFFER_SIZE 5000 #define DEFAULT_SYNTH_LATENCY 5 diff --git a/src/Lyrics.cpp b/src/Lyrics.cpp index cd08e5f0f..2faae7421 100644 --- a/src/Lyrics.cpp +++ b/src/Lyrics.cpp @@ -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(); diff --git a/src/Menus.cpp b/src/Menus.cpp index 1face9b57..b99dfa8bd 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -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; diff --git a/src/MixerBoard.cpp b/src/MixerBoard.cpp index e2d68601a..85994f014 100644 --- a/src/MixerBoard.cpp +++ b/src/MixerBoard.cpp @@ -13,6 +13,7 @@ #include "Experimental.h" #include "MixerBoard.h" +#include #include #include diff --git a/src/TimeTrack.cpp b/src/TimeTrack.cpp index bdbd8008d..f5d909d18 100644 --- a/src/TimeTrack.cpp +++ b/src/TimeTrack.cpp @@ -16,6 +16,7 @@ #include "Audacity.h" #include "TimeTrack.h" +#include #include #include "AColor.h" #include "widgets/Ruler.h" @@ -44,7 +45,7 @@ TimeTrack::TimeTrack(const std::shared_ptr &projDirManager, const Zo mDisplayLog = false; mEnvelope = std::make_unique(); - 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(); - mEnvelope->SetTrackLen(1000000000.0); + mEnvelope->SetTrackLen(DBL_MAX); SetInterpolateLog(orig.GetInterpolateLog()); // this calls Envelope::SetInterpolateDB mEnvelope->Flatten(1.0); mEnvelope->Mirror(false); diff --git a/src/toolbars/ControlToolBar.cpp b/src/toolbars/ControlToolBar.cpp index 8a6047b62..9a5194abb 100644 --- a/src/toolbars/ControlToolBar.cpp +++ b/src/toolbars/ControlToolBar.cpp @@ -33,6 +33,7 @@ *//*******************************************************************/ #include +#include #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;