11namespace tracktion {
inline namespace engine
127 float getGainDB() const noexcept {
return level->dbGain.get(); }
129 float getGain() const noexcept {
return dbToGain (level->dbGain.get()); }
136 float getPan() const noexcept {
return level->pan.get(); }
139 void setMuted (
bool shouldBeMuted)
override { level->mute = shouldBeMuted; }
141 bool isMuted()
const override {
return level->mute.get(); }
315 void setAutoTempo (
bool shouldUseAutoTempo) { autoTempo = shouldUseAutoTempo; }
323 void setAutoPitch (
bool shouldUseAutoPitch) { autoPitch = shouldUseAutoPitch; }
337 void setWarpTime (
bool shouldUseWarpTime) { warpTime = shouldUseWarpTime; }
367 void setIsReversed (
bool shouldBeReversed) { isReversed = shouldBeReversed; }
534 void loadMelodyneState();
550 bool setupARA (
bool dontPopupErrorMessages);
646 mutable WarpTimeManager::Ptr warpTimeManager;
652 void updateLeftRightChannelActivenessFlags();
656 bool lastRenderJobFailed =
false;
680 class TempoDetectTask;
681 class BeatSensitivityComp;
688 void updateReversedState();
689 void updateAutoTempoState();
690 void updateClipEffectsState();
692 enum { updateCrossfadesFlag = 0, updateCrossfadesOverlappedFlag = 1 };
693 void updateAutoCrossfades (
bool updateOverlapped);
699 bool shouldAttemptRender()
const {
return (! lastRenderJobFailed) &&
needsRender(); }
701 void clearCachedAudioSegmentList();
704 void jobFinished (RenderManager::Job& job,
bool completedOk)
override;
705 void timerCallback()
override;
707 TimePosition clipTimeToSourceFileTime (TimePosition clipTime);
718 struct VariantConverter<
tracktion::engine::AudioClipBase::FadeBehaviour>
725 struct VariantConverter<
tracktion::engine::AudioClipBase::AutoPitchMode>
Base class for Clips that produce some kind of audio e.g.
FadeBehaviour
Describes the fade behaviour.
@ gainFade
Fade is a volume/gain ramp.
@ speedRamp
Fade is a change of playback speed for tape start/stop effects.
virtual bool needsRender() const
Subclasses should override this to return true if they need the rest of the render callbacks.
void sendMirrorUpdateToAllPlugins(Plugin &) const override
Sends an update to all plugins mirroing the one passed in.
WarpTimeManager & getWarpTimeManager() const
Returns the WarpTimeManager for this clip used to maipluate warp markers.
std::unique_ptr< ProxyRenderingInfo > createProxyRenderingInfo()
Creates a ProxyRenderingInfo object to decribe the stretch segements of this clip.
void setTimeStretchMode(TimeStretcher::Mode mode)
Sets a time-stretch mode to use.
void reverseLoopPoints()
Reverses the loop points to expose the same section of the source file but reversed.
bool usesGlobalLaunchQuatisation() override
Some clip types can be launched, if that's possible, this returns whether the clip's quantisation or ...
void setIsReversed(bool shouldBeReversed)
Enables reversing of the clip's source material.
virtual juce::File getOriginalFile() const =0
Must return the file that the source ProjectItemID refers to.
const LoopInfo & getLoopInfo() const
Returns the LoopInfo being used to describe this clip.
void setAutoCrossfade(bool shouldAutoCrossfade)
Enables/disables auto-crossfading.
float getPitchRatio() const
Returns the pitch change as a normalised ratio.
bool getEffectsVisible() const
Returns true if the effectsVisible flag is set for this clip.
TimeDuration getFadeOut() const
Returns the fade out duration in seconds.
void setWarpTime(bool shouldUseWarpTime)
Enables/disables warp time.
bool performTempoDetect()
Performs a tempo-detection task and if successful sets the clip's LoopInfo tempo to this.
virtual TimeDuration getSourceLength() const =0
Must return the length in seconds of the source material e.g.
virtual bool canHaveEffects() const
Returns true if this clip can have ClipEffects added to it.
AutoPitchMode getAutoPitchMode()
Returns the AutoPitchMode in use.
LoopInfo autoDetectBeatMarkers(const LoopInfo ¤t, bool autoBeat, float sensitivity) const
Scans the current source file for any beats and adds them to the LoopInfo returned.
void updateSourceFile()
Checks the current source file to see if it's up to date and then triggers a source render if needed.
virtual bool isUsingFile(const AudioFile &)
Should return true if the clip is referencing the file in any way.
virtual void renderComplete()
Callback to indicate that the render has completed.
juce::String canAddClipPlugin(const Plugin::Ptr &) const
Returns an empty string if this plugin can be added, otherwise an error message due to the clip plugi...
bool isRightChannelActive() const
Returns whether the right channel of the clip is enabled.
ClipEffects * getClipEffects() const noexcept
Returns the ClipEffects for this clip if it has been enabled.
const AudioSegmentList & getAudioSegmentList()
Returns an AudioSegmentList describing this file if it is using auto-tempo.
void setAutoPitchMode(AutoPitchMode m)
Sets the AutoPitchMode to use.
float getBeatSensitivity() const
Returns the beat sensitivity.
juce::Colour getDefaultColour() const override
Returns the default colour for this clip.
void setLeftChannelActive(bool)
Enables the left channel of the clip.
bool addClipPlugin(const Plugin::Ptr &, SelectionManager &) override
Adds a plugin to the clip.
ResamplingQuality getResamplingQuality() const
Returns the resampling quality to the be used.
void beginRenderingNewProxyIfNeeded()
Triggers creation of a new proxy file if one is required.
bool getAutoCrossfade() const noexcept
Returns whether auto-crossfade is enabled.
void setGainDB(float dB)
Sets the gain of the clip in dB.
TimeDuration getFadeIn() const
Returns the fade in duration in seconds.
AudioClipBase * getOverlappingClip(ClipDirection) const
Returns the previous/next overlapping clip if one exists.
LaunchQuantisation * getLaunchQuantisation() override
Some clip types can be launched, if that's possible, this returns a quantisation that can be used for...
void updateAutoCrossfadesAsync(bool updateOverlapped)
Triggers an update of the auto-crossfades.
void setRightChannelActive(bool)
Enables the right channel of the clip.
void setFadeInBehaviour(FadeBehaviour newBehaviour)
Sets the fade in behaviour.
void setPan(float pan)
Sets the pan of the clip.
FadeBehaviour getFadeInBehaviour() const
Returns the fade in behaviour.
virtual AudioFile getAudioFile() const
Returns the file used to play back the source and will get proxied etc.
TimeStretcher::Mode getActualTimeStretchMode() const noexcept
Returns the time-stretch mode that is in use.
int getTransposeSemiTones(bool includeAutoPitch) const
Returns the number of semitones this clip will be changed by.
bool isMuted() const override
Returns true if the clip is muted.
BeatDuration getLoopLengthBeats() const override
Returns the length of loop in beats.
Plugin::Array getAllPlugins() override
Returns all the plugins on the clip.
TimePosition getLoopStart() const override
Returns the start time of the loop start point.
bool setFadeIn(TimeDuration length)
Sets the fade in duration in seconds.
void setLoopRangeBeats(BeatRange) override
Sets the loop range the clip should use in beats.
float getPan() const noexcept
Returns the pan of the clip from -1 to 1.
FollowActions * getFollowActions() override
Some clip types can be launched, if that's possible, this can be used to determine the action to perf...
void setPitchChange(float semitones)
Sets the number of semitones to transpose the clip by.
void disableLooping() override
Disables all looping.
TimeDuration getLoopLength() const override
Returns the length of loop in seconds.
void setFadeOutBehaviour(FadeBehaviour newBehaviour)
Sets the fade out behaviour.
void showMelodyneWindow()
Shows the Melodyne window if this clip is using Melodyne.
PluginList * getPluginList() override
Returns the PluginList for this clip if it has one.
void enableEffects(bool enable, bool warn)
Enables/disables ClipEffects for this clip.
void pitchTempoTrackChanged() override
Called when there are pitch or tempo changes made which might require clips to adjust timing informat...
void cancelCurrentRender()
If a render is in progress, this will cancel it.
virtual HashCode getHash() const =0
Must return a unique hash for this clip's source.
bool canLoop() const override
Returns true if this clip is capable of looping.
void setFadeInType(AudioFadeCurve::Type)
Sets the curve shape for the fade in to use.
void flushStateToValueTree() override
Can be overridden to ensure any state (e.g.
AudioFile getProxyFileToCreate(bool renderTimestretched)
Returns the AudioFile to create to play this clip back.
void setBeatSensitivity(float s)
Sets the beat sensitivity, triggering a LoopInfo update if auto-detect is enabled.
virtual void setLoopDefaults()=0
Override this to fill in the LoopInfo structure as best fits the source.
void setNumberOfLoops(int num) override
Sets the clip looping a number of times.
void setLoopRange(TimeRange) override
Sets the loop range the clip should use in seconds.
float getPitchChange() const
Returns the number of semitones to transpose the clip by.
FadeBehaviour getFadeOutBehaviour() const
Returns the fade out behaviour.
bool getWarpTime() const
Returns true if warp time is enabled.
virtual juce::Array< ProjectItemID > getTakes() const
Returns the ProjectItemID of the clip's takes.
bool isLooping() const override
Returns true if this clip is currently looping.
bool getAutoTempo() const
Returns true if auto-tempo has been set.
LiveClipLevel getLiveClipLevel()
Returns a LiveClipLevel which can be used to read the gain, pan and mute statuses.
bool isUsingMelodyne() const
Returns true if this clip is using Melodyne.
juce::StringArray getPitchChoices()
Returns an array describng what pitch each semitone change will be.
void setFadeOutType(AudioFadeCurve::Type newType)
Sets the curve shape for the fade out to use.
TimeRange getLoopRange() const
Returns the loop range in seconds.
~AudioClipBase() override
Destructor.
float getGainDB() const noexcept
Returns the gain of the clip in dB.
void setMuted(bool shouldBeMuted) override
Mutes or unmutes the clip.
virtual juce::String getClipMessage()
Override this to return a custom message to display over the clip where the "file missing" text usual...
void createNewProxyAsync()
Triggers a source or proxy render after a timeout.
void checkFadeLengthsForOverrun()
Trims the fade in out lengths to avoid any overlap between them.
TimeStretcher::Mode getTimeStretchMode() const noexcept
Returns the time-stretch mode that has been set.
virtual AudioFileInfo getWaveInfo()
Returns the WaveInfo for a clip.
AudioFadeCurve::Type getFadeOutType() const
Returns the curve shape for the fade out to use.
LoopInfo & getLoopInfo()
Returns the LoopInfo being used to describe this clip.
void setAutoPitch(bool shouldUseAutoPitch)
Enables/disables auto-pitch.
bool usesTimeStretchedProxy() const
Retuns true if this clip use a proxy file due to timestretching.
void setSpeedRatio(double newSpeed) override
Sets a speed ratio i.e.
bool isLeftChannelActive() const
Returns whether the left channel of the clip is enabled.
void copyFadeToAutomation(bool fadeIn, bool removeClipFade)
Copies the fade in curve to a volume automation curve.
bool setFadeOut(TimeDuration length)
Sets the fade out duration in seconds.
void initialise() override
Initialises the Clip.
void setTranspose(int numSemitones)
Sets the number of semitones to transpose the clip by.
bool getIsReversed() const noexcept
Returns true if the clip's source material is reversed.
bool beatBasedLooping() const override
Returns true if this clip's looping is based on beats or false if absolute time.
void setEffectsVisible(bool b)
Sets the effectsVisible flag for this clip.
AudioFadeCurve::Type getFadeInType() const
Returns the curve shape for the fade in to use.
bool getAutoPitch() const
Returns true if auto-pitch has been set.
void snapToOriginalBWavTime()
Moves the clip to the bwav time reference metadata property time.
bool setupARA(bool dontPopupErrorMessages)
This internal method is used solely to find out if createAudioNode() should return nullptr or not.
static juce::StringArray getRootNoteChoices(Engine &)
Returns an array of the root note choices e.g.
void setAutoDetectBeats(bool)
Enables auto-detection of beats.
virtual juce::String getRenderMessage()
Override this to return a custom message to be displayed over waveforms during rendering.
float getGain() const noexcept
Returns the gain of the clip.
void markAsDirty()
Resets the dirty flag so that a new render will be attempted.
bool getAutoDetectBeats() const
Returns true if auto-detect of beats is enabled.
TimeDuration getMaximumLength() override
Returns the maximum length for this clip.
void setLoopInfo(const LoopInfo &)
Sets a LoopInfo to describe this clip's tempo, time sig etc.
void applyEdgeFades()
Sets the fade in/out lengths to be 0.03s to avoid any clicks at the start/end of th clip.
std::shared_ptr< LaunchHandle > getLaunchHandle() override
Some clip types can be launched, if that's possible, this returns a handle to trigger starting/stoppi...
juce::ReferenceCountedObjectPtr< MelodyneFileReader > melodyneProxy
The MelodyneFileReader proxy if this clip is using Melodyne.
void setUsesGlobalLaunchQuatisation(bool useGlobal) override
Some clip types can be launched, if that's possible, this sets whether the clip's quantisation or the...
virtual RenderManager::Job::Ptr getRenderJob(const AudioFile &)
Subclasses should override this to return a RenderJob suitable for rendering its source file.
ClipDirection
Defines a prevous/next direction.
bool effectsEnabled() const
Returns true if ClipEffects are enabled.
bool canUseProxy() const noexcept
Retuns true if this clip can use a proxy file.
bool canBeAddedTo(ClipOwner &) override
Tests whether this clip can go on the given parent.
void melodyneConvertToMIDI()
If this clip is using Melodyne, this will create a new MIDI clip based on the Melodyne analysis.
HashCode getProxyHash()
Returns a hash identifying the proxy settings.
void changed() override
This should be called to send a change notification to any SelectableListeners that are registered wi...
AutoPitchMode
Defines the auto pitch mode.
@ chordTrackMono
Clip tracks the chord track with a monophonic pitch change.
@ chordTrackPoly
Clip tracks the pitch track with a polyphonic pitch change.
@ pitchTrack
Clip tracks the Edit's PitchSequence.
void cloneFrom(Clip *) override
Clones the given clip to this clip.
void setResamplingQuality(ResamplingQuality)
Sets the resampling qulity to use.
bool canSnapToOriginalBWavTime()
Returns true if source file has a bwav time reference metadata property.
juce::AudioChannelSet getActiveChannels() const
Returns the layout of the active channels.
void setUsesProxy(bool canUseProxy) noexcept
Can be used to disable proxy file generation for this clip.
void addEffect(const juce::ValueTree &effectsTree)
Adds a ClipEffect to this clip.
AudioFile getPlaybackFile()
Returns the current AudioFile being used by the Clip, either the original source or a proxy.
void hideMelodyneWindow()
Hides the Melodyne window if this clip is using Melodyne.
PatternGenerator * getPatternGenerator() override
Returns the PatternGenerator for this clip if it has one.
void setAutoTempo(bool shouldUseAutoTempo)
Enables/disables auto-tempo.
BeatPosition getLoopStartBeats() const override
Returns the beat position of the loop start point.
juce::CachedValue< TimeStretcher::ElastiqueProOptions > elastiqueProOptions
The ElastiqueProOptions for fine tuning Elastique (if available).
juce::Array< TimePosition > getRescaledMarkPoints() const override
Returns the mark points relative to the start of the clip, rescaled to the current speed.
Smart wrapper for writing to an audio file.
Holds a list of audio regions for playback of things like warp time.
Base class for items that can contain clips.
juce::File getCurrentSourceFile() const
Returns the current source file, this is different to the SourceFileReference as it could be a tempor...
The Engine is the central class for all tracktion sessions.
Represents a launch quantisation.
Holds tempo/beat information about an audio file.
Holds a sequence of plugins.
An ID representing one of the items in a Project.
Manages a list of items that are currently selected.
Handles time/pitch stretching using various supported libraries.
Mode
Holds the various algorithms to which can be used (if enabled).
Type
Defines the types of item that can live on Track[s].
A WarpTimeManager contains a list of WarpMarkers and some source material and maps times from a linea...
Type jlimit(Type lowerLimit, Type upperLimit, Type valueToConstrain) noexcept
ResamplingQuality
Specifies a number of resampling qualities that can be used.
Represents a duration in beats.
Represents a position in beats.
Represents a duration in real-life time.
Represents a position in real-life time.
Holds a list of function objects and enables you to call them asyncronously.
Holds information about how to render a proxy for this clip.
bool render(Engine &, const AudioFile &, AudioFileWriter &, juce::ThreadPoolJob *const &, std::atomic< float > &progress) const
Renders this audio segment list to an AudioFile.
~ProxyRenderingInfo()
Destructor.
ProxyRenderingInfo()
Constructor.
Type
A enumeration of the curve classes available.
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...
A set of options that can be used in conjunction with the elastiquePro Mode to fine tune the algorith...