Audacity 3.2.0
Typedefs | Functions
NoteTrackEditing.cpp File Reference
#include "WrapAllegro.h"
#include "NoteTrack.h"
#include "TempoChange.h"
Include dependency graph for NoteTrackEditing.cpp:

Go to the source code of this file.

Typedefs

using OnNoteTrackProjectTempoChange = OnProjectTempoChange::Override< NoteTrack >
 

Functions

 DEFINE_ATTACHED_VIRTUAL_OVERRIDE (OnNoteTrackProjectTempoChange)
 

Detailed Description


Audacity: A Digital Audio Editor

PaulLicameli

Definition in file NoteTrackEditing.cpp.

Typedef Documentation

◆ OnNoteTrackProjectTempoChange

Definition at line 15 of file NoteTrackEditing.cpp.

Function Documentation

◆ DEFINE_ATTACHED_VIRTUAL_OVERRIDE()

DEFINE_ATTACHED_VIRTUAL_OVERRIDE ( OnNoteTrackProjectTempoChange  )

Definition at line 16 of file NoteTrackEditing.cpp.

16 {
17 return [](NoteTrack &track,
18 const std::optional<double> &oldTempo, double newTempo)
19 {
20 if (!oldTempo.has_value())
21 return;
22 const auto ratio = *oldTempo / newTempo;
23 auto& seq = track.GetSeq();
24 seq.convert_to_beats();
25 const auto b1 = seq.get_dur();
26 seq.convert_to_seconds();
27 const auto newDuration = seq.get_dur() * ratio;
28 seq.stretch_region(0, b1, newDuration);
29 seq.set_real_dur(newDuration);
30 };
31}
A Track that is used for Midi notes. (Somewhat old code).
Definition: NoteTrack.h:78
Alg_seq & GetSeq() const
Definition: NoteTrack.cpp:158

References NoteTrack::GetSeq().

Here is the call graph for this function: