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.

16 {
17 return [](LabelTrack &track,
18 const std::optional<double> &oldTempo, double newTempo)
19 {
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 auto label = *track.GetLabel(ii);
26 label.selectedRegion.setTimes(
27 label.getT0() * ratio, label.getT1() * ratio);
28 track.SetLabel(ii, label);
29 }
30 };
31}
TranslatableString label
Definition: TagsEditor.cpp:165
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:95
int GetNumLabels() const
const LabelStruct * GetLabel(int index) const
void SetLabel(size_t iLabel, const LabelStruct &newLabel)
Definition: LabelTrack.cpp:169

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

Here is the call graph for this function: