29 return std::make_shared<ProjectTempoListener>(
39 , mTrackList { trackList }
40 , mTrackListSubstription { trackList.Subscribe(
45 if (
const auto track = event.mpTrack.lock())
50 mProjectTimeSignatureSubscription =
55 assert(mTrackList.empty());
65 const auto tempoRate =
mTempo / newTempo;
Utility ClientData::Site to register hooks into a host class that attach client data.
static const AttachedProjectObjects::RegisteredFactory key
void DoProjectTempoChange(ChannelGroup &group, double newTempo)
AttachedVirtualFunction< struct OnProjectTempoChangeTag, void, ChannelGroup, const std::optional< double > &, double > OnProjectTempoChange
Method to set project tempo on a channel group, defaulting to no-op.
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...
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.