11namespace tracktion {
inline namespace engine
16 ownerSequence (ts), state (v)
18 auto* um = ts.getUndoManager();
20 startBeatNumber.referTo (state, IDs::startBeat, um);
21 bpm.
referTo (state, IDs::bpm, um, 120.0);
22 curve.
referTo (state, IDs::curve, um);
31 return createValueTree (IDs::TEMPO,
32 IDs::startBeat, beat.inBeats(),
34 IDs::curve, curveVal);
39 return ownerSequence.
edit;
45 return TRANS(
"Tempo");
51 ownerSequence.updateTempoDataIfNeeded();
57 startBeatNumber.forceUpdateOfCachedValue();
64 if (newBPM != bpm || startBeatNumber != newStartBeat || curve != newCurve)
68 if (remapEditPositions)
69 snap.savePreChangeState (
getEdit());
73 startBeatNumber = newStartBeat;
77 if (remapEditPositions)
84 set (b, bpm, curve,
false);
89 set (startBeatNumber, newBpm, curve,
true);
94 set (startBeatNumber, bpm, newCurve,
true);
118HashCode TempoSetting::getHash() const noexcept
120 return static_cast<HashCode
> (startBeatNumber.get().inBeats() * 128.0)
121 ^ (
static_cast<HashCode
> (bpm * 1217.0)
122 +
static_cast<HashCode
> (curve * 1023.0));
void forceUpdateOfCachedValue()
void referTo(ValueTree &tree, const Identifier &property, UndoManager *um)
The Tracktion Edit class!
virtual void changed()
This should be called to send a change notification to any SelectableListeners that are registered wi...
Holds a list of TempoSetting objects, to form a sequence of tempo changes.
TimeSigSetting & getTimeSigAt(TimePosition) const
Returns the TimeSigSetting at a given position.
int indexOfTempo(const TempoSetting *) const
Returns the index of the given TempoSetting.
void removeTempo(int index, bool remapEdit)
Removes the TempoSetting at a given index.
TempoSetting * getTempo(int index) const
Returns the TempoSetting at the given index.
Edit & edit
The Edit this sequence belongs to.
A tempo value, as used in a TempoSequence.
void set(BeatPosition, double newBpm, float newCurve, bool remapEditPositions)
Sets the properties of this tempo setting.
void setBpm(double newBpm)
Sets the BPM of this tempo setting.
static constexpr double minBPM
Minimum BPM a setting can have.
~TempoSetting() override
Destructor.
juce::String getSelectableDescription() override
Returns the description of this Selectable.
TimeSigSetting & getMatchingTimeSig() const
Returns the time signature at this tempo's time in the sequence.
TimePosition getStartTime() const
Returns the start time in seconds of the tempo setting.
TempoSetting * getPreviousTempo() const
Returns the previous tempo setting in the sequence.
void setCurve(float curve)
Sets the curve of this tempo setting.
TimeDuration getApproxBeatLength() const
Returns the approximate length of one beat based on the bpm and matching time sig denonimator.
TempoSetting(TempoSequence &, const juce::ValueTree &)
Constructs a TempoSetting belonging to a given TempoSequence.
static constexpr double maxBPM
Maximum BPM a setting can have.
static juce::ValueTree create(BeatPosition startBeat, double bpm, float curve)
Creates a tree to prepresent a TempoSetting.
void removeFromEdit()
Removes the TempoSetting from the sequence.
Edit & getEdit() const
Returns the Edit this setting belongs to.
#define TRANS(stringLiteral)
Type jlimit(Type lowerLimit, Type upperLimit, Type valueToConstrain) noexcept
Represents a position in beats.
Represents a duration in real-life time.
Represents a position in real-life time.
Takes a copy of all the beat related things in an edit in terms of bars/beats and then remaps these a...
#define CRASH_TRACER
This macro adds the current location to a stack which gets logged if a crash happens.