28 return std::make_shared<ProjectTempoListener>(
38 , mTrackList { trackList }
39 , mTrackListSubstription { trackList.Subscribe(
44 if (
const auto track = event.mpTrack.lock()) {
47 pLeader->OnProjectTempoChange(tempo);
52 mProjectTimeSignatureSubscription =
55 OnProjectTempoChange(event.
newTempo);
57 assert(mTrackList.empty());
63 track->OnProjectTempoChange(newTempo);
67 const auto tempoRate =
mTempo / newTempo;
Utility ClientData::Site to register hooks into a host class that attach client data.
static const AttachedProjectObjects::RegisteredFactory key
declares abstract base class Track, TrackList, and iterators over TrackList
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Client code makes static instance from a factory of attachments; passes it to Get or Find as a retrie...
Subscription Subscribe(Callback callback)
Connect a callback to the Publisher; later-connected are called earlier.
A move-only handle representing a connection to a Publisher.
void SetTimes(double start, double end)
ProjectTempoListener(AudacityProject &project, TrackList &trackList)
Observer::Subscription mProjectTimeSignatureSubscription
void OnProjectTempoChange(double newTempo)
AudacityProject & mProject
Observer::Subscription mTrackListSubstription
static ProjectTimeSignature & Get(AudacityProject &project)
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
TrackIter< Track > Find(Track *pTrack)
static TrackList & Get(AudacityProject &project)
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
A convenient default parameter for class template Site.
Notification of changes in individual tracks of TrackList, or of TrackList's composition.
@ ADDITION
Posted when a track has been added to a tracklist. Also posted when one track replaces another.