Audacity 3.2.0
Functions | Variables
LabelTrack.cpp File Reference
#include "LabelTrack.h"
#include <algorithm>
#include <limits.h>
#include <float.h>
#include <wx/log.h>
#include <wx/tokenzr.h>
#include <wx/datetime.h>
#include "Prefs.h"
#include "Project.h"
#include "TimeWarper.h"
#include "BasicUI.h"
Include dependency graph for LabelTrack.cpp:

Go to the source code of this file.

Functions

static const Track::TypeInfotypeInfo ()
 
static double SubRipTimestampToDouble (const wxString &ts)
 
static wxString SubRipTimestampFromDouble (double timestamp, bool webvtt)
 

Variables

EnumSetting< bool > LabelStyleSetting
 
static ProjectFileIORegistry::ObjectReaderEntry readerEntry
 

Function Documentation

◆ SubRipTimestampFromDouble()

static wxString SubRipTimestampFromDouble ( double  timestamp,
bool  webvtt 
)
static

Definition at line 539 of file LabelTrack.cpp.

540{
541 // Note that the SubRip format always uses the comma as its separator...
542 static constexpr auto subripFormat = wxT("%H:%M:%S,%l");
543 // ... while WebVTT always used the period.
544 // WebVTT also allows skipping the hour part, but doesn't require doing so.
545 static constexpr auto webvttFormat = wxT("%H:%M:%S.%l");
546
547 // dt is the datetime that is timestamp seconds after Jan 1, 1970 UTC.
548 wxDateTime dt { (time_t) timestamp };
549 dt.SetMillisecond(wxRound(timestamp * 1000) % 1000);
550
551 // As such, we need to use UTC when formatting it, or else the time will
552 // be shifted (assuming the user is not in the UTC timezone).
553 return dt.Format(webvtt ? webvttFormat : subripFormat, wxDateTime::UTC);
554}
wxT("CloseDown"))

References wxT().

Referenced by LabelStruct::Export().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SubRipTimestampToDouble()

static double SubRipTimestampToDouble ( const wxString &  ts)
static

Definition at line 408 of file LabelTrack.cpp.

409{
410 wxString::const_iterator end;
411 wxDateTime dt;
412
413 if (!dt.ParseFormat(ts, wxT("%H:%M:%S,%l"), &end) || end != ts.end())
415
416 return dt.GetHour() * 3600 + dt.GetMinute() * 60 + dt.GetSecond()
417 + dt.GetMillisecond() / 1000.0;
418}
const char * end(const char *str) noexcept
Definition: StringUtils.h:106

References details::end(), and wxT().

Referenced by LabelStruct::Import().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ typeInfo()

static const Track::TypeInfo & typeInfo ( )
static

Definition at line 139 of file LabelTrack.cpp.

140{
141 static Track::TypeInfo info{
142 { "label", "label", XO("Label Track") }, true, &Track::ClassTypeInfo() };
143 return info;
144}
XO("Cut/Copy/Paste")
static const TypeInfo & ClassTypeInfo()
Definition: Track.cpp:790

References Track::ClassTypeInfo(), and XO().

Referenced by LabelTrack::ClassTypeInfo(), and LabelTrack::GetTypeInfo().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ LabelStyleSetting

EnumSetting<bool> LabelStyleSetting
Initial value:
{
wxT("/FileFormats/LabelStyleChoice"),
{
EnumValueSymbol { wxT("Standard"), XXO("S&tandard") },
EnumValueSymbol { wxT("Extended"),
XXO("E&xtended (with frequency ranges)") },
},
0,
{
true,
false,
},
}
XXO("&Cut/Copy/Paste Toolbar")
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...

Definition at line 51 of file LabelTrack.cpp.

Referenced by anonymous_namespace{ExportLabelTrack.cpp}::AddControls(), and LabelStruct::Export().

◆ readerEntry

Initial value:
{
"labeltrack",
}
static LabelTrack * New(AudacityProject &project)
Definition: LabelTrack.cpp:101

Definition at line 91 of file LabelTrack.cpp.