11namespace tracktion {
inline namespace engine
21 notifyListenersOfDeletion();
39 copyValueTree (list, other->state.getChildWithName (IDs::CLIPLIST),
nullptr);
48 return TRANS(
"Container Clip") +
" - \"" +
getName() +
"\"";
65 l =
std::max (l, toDuration (c->getPosition().getEnd()));
74 for (
auto c : getClipsOfType<AudioClipBase> (*
this))
75 hash_combine (hash, c->getHash());
77 return static_cast<HashCode
> (hash);
82 auto& ts =
edit.tempoSequence;
86 loopInfo.
setNumerator (ts.getTimeSigAt (pos.getStart()).numerator);
89 loopInfo.
setDenominator (ts.getTimeSigAt (pos.getStart()).denominator);
97 const auto newStartBeat =
juce::jmax (0_bp, newRangeBeats.getStart());
98 const auto newLengthBeat =
juce::jmax (0_bd, newRangeBeats.getLength());
100 if (loopStartBeats != newStartBeat || loopLengthBeats != newLengthBeat)
105 loopStartBeats = newStartBeat;
106 loopLengthBeats = newLengthBeat;
113 c->flushStateToValueTree();
121 c->pitchTempoTrackChanged();
129 return clipListState;
153 for (
auto c : getClipsOfType<AudioClipBase> (*
this))
154 if (c->isUsingFile (af))
160void ContainerClip::clipCreated (
Clip&)
164void ContainerClip::clipAddedOrRemoved()
168void ContainerClip::clipOrderChanged()
172void ContainerClip::clipPositionChanged()
ValueTree getChildWithName(const Identifier &type) const
ValueTree getOrCreateChildWithName(const Identifier &type, UndoManager *undoManager)
Base class for Clips that produce some kind of audio e.g.
virtual bool isUsingFile(const AudioFile &)
Should return true if the clip is referencing the file in any way.
void pitchTempoTrackChanged() override
Called when there are pitch or tempo changes made which might require clips to adjust timing informat...
void flushStateToValueTree() override
Can be overridden to ensure any state (e.g.
TimeRange getLoopRange() const
Returns the loop range in seconds.
void initialise() override
Initialises the Clip.
void cloneFrom(Clip *) override
Clones the given clip to this clip.
void setAutoTempo(bool shouldUseAutoTempo)
Enables/disables auto-tempo.
Base class for items that can contain clips.
const juce::Array< Clip * > & getClips() const
Returns the clips this owner contains.
void initialiseClipOwner(Edit &, juce::ValueTree clipParentState)
Must be called once from the subclass constructor to init the clip owner.
virtual juce::String getName() const override
Returns the name of the clip.
juce::ValueTree state
The ValueTree of the Clip state.
virtual void setSpeedRatio(double)
Sets a speed ratio i.e.
juce::UndoManager * getUndoManager() const
Returns the UndoManager.
ClipPosition getPosition() const override
Returns the ClipPosition on the parent Track.
A clip that can contain multiple other clips and mix their output together.
bool isMidi() const override
Returns true if this is a MidiClip.
juce::ValueTree & getClipOwnerState() override
Must return the state of this ClipOwner.
juce::String getSelectableDescription() override
Subclasses must return a description of what they are.
Selectable * getClipOwnerSelectable() override
Must return the selectable if this ClipOwner is one.
TimeDuration getSourceLength() const override
Must return the length in seconds of the source material e.g.
void cloneFrom(Clip *) override
Clones the given clip to this clip.
EditItemID getClipOwnerID() override
Must return the ID of this ClipOwner.
~ContainerClip() override
Destructor.
void flushStateToValueTree() override
Can be overridden to ensure any state (e.g.
bool isUsingFile(const AudioFile &) override
Should return true if the clip is referencing the file in any way.
void pitchTempoTrackChanged() override
Called when there are pitch or tempo changes made which might require clips to adjust timing informat...
void initialise() override
Initialises the Clip.
ContainerClip(const juce::ValueTree &, EditItemID, ClipOwner &)
Creates a ContainerClip from a given state.
void setLoopRangeBeats(BeatRange) override
Sets the loop range the clip should use in beats.
HashCode getHash() const override
Must return a unique hash for this clip's source.
Edit & getClipOwnerEdit() override
Must return the Edit this ClipOwner belongs to.
void setLoopDefaults() override
Override this to fill in the LoopInfo structure as best fits the source.
const EditItemID itemID
Every EditItem has an ID which is unique within the edit.
The Tracktion Edit class!
void setNumerator(int newNumerator)
Sets the numerator of the object.
void setDenominator(int newDenominator)
Sets the denominator of the object.
int getDenominator() const
Returns the denominator of the object.
double getNumBeats() const
Returns the number of beats.
int getNumerator() const
Returns the numerator of the object.
void setNumBeats(double newNumBeats)
Sets the number of beats.
Base class for things that can be selected, and whose properties can appear in the properties panel.
virtual void changed()
This should be called to send a change notification to any SelectableListeners that are registered wi...
Type
Defines the types of item that can live on Track[s].
#define TRANS(stringLiteral)
constexpr Type jmax(Type a, Type b)
Represents a duration in real-life time.
ID for objects of type EditElement - e.g.