11namespace tracktion {
inline namespace engine
32 MidiList& getSequence()
const noexcept;
61 void scaleVerticallyToFit();
63 bool hasValidSequence() const noexcept {
return channelSequence.size() > 0; }
66 void setMidiChannel (MidiChannel newChannel) { getSequence().
setMidiChannel (newChannel); }
69 void setMPEMode (
bool shouldUseMPE) { mpeMode = shouldUseMPE; }
70 bool getMPEMode() const noexcept {
return mpeMode; }
73 bool isRhythm() const noexcept {
return getMidiChannel().getChannelNumber() == 10; }
79 juce::String getGrooveTemplate() const noexcept {
return grooveTemplate; }
80 void setGrooveTemplate (
const juce::String& templateName) { grooveTemplate = templateName; }
82 bool usesGrooveStrength()
const;
84 float getGrooveStrength()
const {
return grooveStrength; }
85 void setGrooveStrength (
float g) { grooveStrength =
juce::jlimit (0.0f, 1.0f, g); }
106 float getVolumeDb()
const {
return level->dbGain.get(); }
107 void setVolumeDb (
float v) { level->dbGain =
juce::jlimit (-100.0f, 0.0f, v); }
109 bool isSendingBankChanges() const noexcept {
return sendBankChange; }
110 void setSendingBankChanges (
bool sendBank);
112 bool isMuted()
const override {
return level->mute.get(); }
113 void setMuted (
bool m)
override { level->mute = m; }
119 bool isMidi()
const override {
return true; }
126 bool hasAnyTakes()
const override {
return channelSequence.size() > 1; }
132 void deleteAllUnusedTakesConfirmingWithUser();
134 MidiList* getTakeSequence (
int takeIndex)
const {
return channelSequence[takeIndex]; }
136 bool canLoop()
const override {
return true; }
199 bool shouldWarnAboutMultiChannel =
false;
210 void clearCachedLoopSequence();
235 struct VariantConverter<
tracktion::engine::MidiClip::LoopedSequenceType>
Base class for items that can contain clips.
Represents a launch quantisation.
bool usesGlobalLaunchQuatisation() override
Some clip types can be launched, if that's possible, this returns whether the clip's quantisation or ...
void pitchTempoTrackChanged() override
Called when there are pitch or tempo changes made which might require clips to adjust timing informat...
TimeDuration getLoopLength() const override
Returns the length of loop in seconds.
BeatPosition getLoopStartBeats() const override
Returns the beat position of the loop start point.
PatternGenerator * getPatternGenerator() override
Returns the PatternGenerator for this clip if it has one.
TimePosition getLoopStart() const override
Returns the start time of the loop start point.
@ loopRangeDefinesAllRepetitions
The looped sequence is the same for all repetitions including the first.
@ loopRangeDefinesSubsequentRepetitions
The first section is the whole sequence, subsequent repitions are determined by the loop range.
bool isMuted() const override
Returns true if the clip is muted.
BeatDuration getLoopLengthBeats() const override
Returns the length of loop in beats.
LaunchQuantisation * getLaunchQuantisation() override
Some clip types can be launched, if that's possible, this returns a quantisation that can be used for...
void setLoopRange(TimeRange) override
Sets the loop range the clip should use in seconds.
int getNumTakes(bool includeComps) override
Returns the total number of takes.
void setUsesProxy(bool canUseProxy) noexcept
Can be used to disable proxy sequence generation for this clip.
void extendStart(TimePosition newStartTime)
This will extend the start time backwards, moving the notes along if this takes the offset below 0....
juce::Colour getDefaultColour() const override
Returns the default colour for this clip.
bool isLooping() const override
Returns true if this clip is currently looping.
void setMuted(bool m) override
Mutes or unmutes the clip.
void initialise() override
Initialises the Clip.
void clearTakes() override
Clears any takes this clip has.
bool canLoop() const override
Returns true if this clip is capable of looping.
void rescale(TimePosition pivotTimeInEdit, double factor) override
stretches and scales this clip relative to a fixed point in the edit.
int getCurrentTake() const override
Returns the current take index.
void setMPEMode(bool shouldUseMPE)
Sets whether the clip should send MPE MIDI rather than single channel.
bool isRhythm() const noexcept
Returns true if this clip represents a rhythm instrument (e.g.
FollowActions * getFollowActions() override
Some clip types can be launched, if that's possible, this can be used to determine the action to perf...
bool isMidi() const override
Returns true if this is a MidiClip.
void disableLooping() override
Disables all looping.
void setUsesGlobalLaunchQuatisation(bool useGlobal) override
Some clip types can be launched, if that's possible, this sets whether the clip's quantisation or the...
std::shared_ptr< LaunchHandle > getLaunchHandle() override
Some clip types can be launched, if that's possible, this returns a handle to trigger starting/stoppi...
bool canBeAddedTo(ClipOwner &) override
Tests whether this clip can go on the given parent.
bool canUseProxy() const noexcept
Retuns true if this clip can use a proxy sequence.
void cloneFrom(Clip *) override
Clones the given clip to this clip.
Clip::Array unpackTakes(bool toNewTracks) override
Attempts to unpack the takes to new clips.
void setLoopRangeBeats(BeatRange) override
Sets the loop range the clip should use in beats.
bool beatBasedLooping() const override
Returns true if this clip's looping is based on beats or false if absolute time.
void legatoNote(MidiNote ¬e, const juce::Array< MidiNote * > ¬esToUse, BeatPosition maxEndBeat, juce::UndoManager &)
Lengthens or shortens a note to match the start of the next note in the given array.
juce::StringArray getTakeDescriptions() const override
Returns the descriptions of any takes.
juce::String getSelectableDescription() override
Subclasses must return a description of what they are.
void setCurrentTake(int takeIndex) override
Sets a given take index to be the current take.
bool isCurrentTakeComp() override
Returns true if the current take is a comp.
void setNumberOfLoops(int) override
Sets the clip looping a number of times.
bool hasAnyTakes() const override
Returns true if this clip has any takes.
MidiChannel getMidiChannel() const
Gets the list's midi channel number.
void setMidiChannel(MidiChannel chanNum)
Gives the list a channel number that it'll use when generating real midi messages.
Represents a set of selected MIDI notes.
Type jlimit(Type lowerLimit, Type upperLimit, Type valueToConstrain) noexcept
void mergeInMidiSequence(MidiClip &mc, juce::MidiMessageSequence ms, TimeDuration startTime, MidiList::NoteAutomationType automationType)
Copies a zero-time origin based MIDI sequence in to a MidiClip.
Represents a duration in beats.
Represents a position in beats.
Represents a duration in real-life time.
Represents a position in real-life time.
ID for objects of type EditElement - e.g.
Provides a thread-safe way to share a clip's levels with an audio engine without worrying about the C...
Represents a MIDI channel 1-16, and also contains extra ID bits to encode info about the event's orig...
Temporarily limits the notes to use.