Audacity
3.2.0
src
TimeTrackEditing.cpp
Go to the documentation of this file.
1
/* SPDX-License-Identifier: GPL-2.0-or-later */
2
/*!********************************************************************
3
4
Audacity: A Digital Audio Editor
5
6
@file TimeTrackEditing.cpp
7
8
PaulLicameli
9
10
**********************************************************************/
11
#include "
Envelope.h
"
12
#include "
TempoChange.h
"
13
#include "
TimeTrack.h
"
14
15
using
OnTimeTrackProjectTempoChange
=
OnProjectTempoChange::Override<TimeTrack>
;
16
DEFINE_ATTACHED_VIRTUAL_OVERRIDE
(
OnTimeTrackProjectTempoChange
) {
17
return
[](
TimeTrack
&track,
18
const
std::optional<double> &oldTempo,
double
newTempo)
19
{
20
if
(!oldTempo.has_value())
21
return
;
22
const
auto
ratio = *oldTempo / newTempo;
23
track.
GetEnvelope
()->
RescaleTimesBy
(ratio);
24
};
25
}
Envelope.h
TempoChange.h
TimeTrack.h
DEFINE_ATTACHED_VIRTUAL_OVERRIDE
DEFINE_ATTACHED_VIRTUAL_OVERRIDE(OnTimeTrackProjectTempoChange)
Definition:
TimeTrackEditing.cpp:16
Envelope::RescaleTimesBy
void RescaleTimesBy(double ratio)
Definition:
Envelope.cpp:871
TimeTrack
A kind of Track used to 'warp time'.
Definition:
TimeTrack.h:24
TimeTrack::GetEnvelope
BoundedEnvelope * GetEnvelope()
Definition:
TimeTrack.h:84
AttachedVirtualFunction::Override
For defining overrides of the method.
Definition:
AttachedVirtualFunction.h:184
Generated by
1.9.3