Audacity 3.2.0
Typedefs | Functions
LabelTrackEditing.cpp File Reference
#include "LabelTrack.h"
#include "TempoChange.h"
Include dependency graph for LabelTrackEditing.cpp:

Go to the source code of this file.

Typedefs

using OnLabelTrackProjectTempoChange = OnProjectTempoChange::Override< LabelTrack >
 

Functions

 DEFINE_ATTACHED_VIRTUAL_OVERRIDE (OnLabelTrackProjectTempoChange)
 

Detailed Description


Audacity: A Digital Audio Editor

PaulLicameli

Definition in file LabelTrackEditing.cpp.

Typedef Documentation

◆ OnLabelTrackProjectTempoChange

Definition at line 14 of file LabelTrackEditing.cpp.

Function Documentation

◆ DEFINE_ATTACHED_VIRTUAL_OVERRIDE()

DEFINE_ATTACHED_VIRTUAL_OVERRIDE ( OnLabelTrackProjectTempoChange  )

Definition at line 16 of file LabelTrackEditing.cpp.

17{
18 return [](LabelTrack& track, const std::optional<double>& oldTempo,
19 double newTempo) {
20 if (!oldTempo.has_value())
21 return;
22 const auto ratio = *oldTempo / newTempo;
23 const size_t nn = track.GetNumLabels();
24 for (size_t ii = 0; ii < nn; ++ii)
25 {
26 auto label = *track.GetLabel(ii);
27 label.selectedRegion.setTimes(
28 label.getT0() * ratio, label.getT1() * ratio);
29 track.SetLabel(ii, label);
30 }
31 };
32}
TranslatableString label
Definition: TagsEditor.cpp:165
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:98
int GetNumLabels() const
const LabelStruct * GetLabel(int index) const
void SetLabel(size_t iLabel, const LabelStruct &newLabel)
Definition: LabelTrack.cpp:183

References LabelTrack::GetLabel(), LabelTrack::GetNumLabels(), label, and LabelTrack::SetLabel().

Here is the call graph for this function: