11namespace tracktion {
inline namespace engine
21 : edit (ed), state (s), isNewPlugin (isNew) {}
28 bool isNewPlugin =
false;
51 int bufferStart,
int bufferSize,
53 TimeRange
editTime,
bool playing,
bool scrubbing,
bool rendering,
133 virtual void flushPluginStateToValueTree()
override;
140 virtual juce::String getVendor() {
return "Tracktion"; }
152 bool isEnabled() const noexcept {
return enabled.get(); }
156 bool isFrozen() const noexcept {
return frozen; }
161 bool isProcessingEnabled() const noexcept {
return processing; }
185 bool isInitialising()
const {
return isInitialisingFlag; }
194 virtual void reset();
235 virtual bool producesAudioWhenNoAudioInput() {
return isAutomationNeeded(); }
236 virtual bool noTail() {
return true; }
239 virtual bool takesAudioInput() {
return ! isSynth(); }
240 virtual bool takesMidiInput() {
return false; }
241 virtual bool isSynth() {
return false; }
242 virtual double getLatencySeconds() {
return 0.0; }
243 virtual double getTailLength()
const {
return 0.0; }
244 virtual bool canSidechain();
248 void setSidechainSourceByName (
const juce::String& name);
250 void guessSidechainRouting();
262 int getNumWires()
const;
263 Wire* getWire (
int index)
const;
266 void breakConnection (
int srcChannel,
int dstChannel);
278 virtual bool hasNameForMidiBank (
int bank,
juce::String& name);
281 virtual bool canBeAddedToClip() {
return true; }
282 virtual bool canBeAddedToRack() {
return true; }
283 virtual bool canBeAddedToFolderTrack() {
return false; }
284 virtual bool canBeAddedToMaster() {
return true; }
285 virtual bool canBeDisabled() {
return true; }
286 virtual bool canBeMoved() {
return true; }
287 virtual bool needsConstantBufferSize() = 0;
295 bool isInRack()
const;
298 bool isClipEffectPlugin()
const;
303 AutomatableParameter::Ptr getQuickControlParameter()
const;
304 void setQuickControlParameter (AutomatableParameter*);
327 PluginList* getOwnerList()
const;
329 Ptr findPluginThatFeedsIntoThis()
const;
330 Ptr findPluginThatThisFeedsInto()
const;
337 void reassignReferencedItem (
const ReferencedItem&, ProjectItemID newID,
double newStartTime)
override;
351 virtual void updateFromMirroredPluginIfNeeded (
Plugin&) {}
352 Plugin::Ptr getMirroredPlugin()
const;
363 bool baseClassNeedsInitialising() const noexcept {
return initialiseCount == 0; }
364 void baseClassInitialise (
const PluginInitialisationInfo&);
365 void baseClassDeinitialise();
368 void setSidechainSourceID (EditItemID newID) { sidechainSourceID = newID; }
369 EditItemID getSidechainSourceID()
const {
return sidechainSourceID; }
374 virtual bool allowWindowResizing() = 0;
394 void showWindowExplicitly();
395 void hideWindowForShutdown();
406 juce::CachedValue<
bool> frozen, processing;
407 juce::CachedValue<
juce::String> quickParamName;
410 double sampleRate = 44100.0;
411 int blockSizeSamples = 512;
413 void valueTreePropertyChanged (
juce::ValueTree&, const
juce::Identifier&) override;
414 void valueTreeChanged() override;
416 void valueTreeChildAdded (
juce::ValueTree&,
juce::ValueTree&) override;
417 void valueTreeChildRemoved (
juce::ValueTree&,
juce::ValueTree&,
int) override;
418 void valueTreeParentChanged (
juce::ValueTree&) override;
420 virtual
void processingChanged();
425 std::function<
juce::String(
float)> valueToStringFunction,
426 std::function<
float(const
juce::String&)> stringToValueFunction);
429 static
void getLeftRightChannelNames (
juce::StringArray* ins,
juce::StringArray* outs);
430 static
void getLeftRightChannelNames (
juce::StringArray* chans);
435 std::atomic<
int> initialiseCount { 0 };
436 double timeToCpuScale = 0;
Base class for elements that have some kind of automatable parameters.
The Tracktion Edit class!
The Engine is the central class for all tracktion sessions.
An interface for objects within an edit that can be exported.
Base class for elements which can contain macro parameters.
void changed() override
method from Selectable, that's been overridden here to also tell the edit that it's changed.
virtual void reset()
Should reset synth voices, tails, clear delay buffers, etc.
virtual void deinitialise()=0
Called after play stops to release resources.
virtual juce::String getName() const override=0
The name of the type, e.g.
virtual bool hasNameForMidiNoteNumber(int note, int midiChannel, juce::String &name)
If it's a synth that names its notes, this can return the name it uses for this note 0-127.
virtual juce::String getTooltip()
default returns the name, others can return special stuff if needed
virtual void prepareForNextBlock(TimePosition)
Called between successive rendering blocks.
virtual void initialiseWithoutStopping(const PluginInitialisationInfo &)
Tells the plugin that the audio graph has changed but the plugin isn't being re-initialised - i....
void setFrozen(bool shouldBeFrozen)
This is a bit different to being enabled as when frozen a plugin can't be interacted with.
virtual bool shoulMeasureCpuUsage() const noexcept
Plugins can return false if they want to avoid the overhead of measuring the CPU usage.
void setProcessingEnabled(bool p)
Enable/Disable processing.
virtual bool isDisabled()
Plugins can be disabled to avoid them crashing Edits.
virtual bool isMissing()
for things like VSTs where the DLL is missing.
virtual int getNumOutputChannelsGivenInputs(int numInputChannels)
This must return the number of output channels that the plugin will produce, given a number of input ...
void removeFromParent()
Detaches the plugin from any parent it might be in.
Clip * getOwnerClip() const
Returns the clip if that's what it's in.
virtual void sourceMediaChanged()
Called when ProjectItem sources are re-assigned so you can reload from the new source.
virtual juce::String getIdentifierString()
A unique string to idenitify plugin independant of install location.
void playStartedOrStopped()
called by the system to let the plugin manage its automation stuff
virtual void setEnabled(bool)
Enable/disable the plugin.
double getCpuUsage() const noexcept
Returns the proportion of the current buffer size spent processing this plugin.
virtual void trackPropertiesChanged()
Track name or colour has changed.
virtual void initialiseFully()
Gives the plugin a chance to do extra initialisation when it's been added to an edit.
void selectableAboutToBeDeleted() override
Called just before the selectable is about to be deleted so any subclasses should still be valid at t...
virtual void applyToBuffer(const PluginRenderContext &)=0
Process the next block of data.
virtual bool hasNameForMidiProgram(int programNum, int bank, juce::String &name)
Returns the name for a midi program, if there is one.
Track * getOwnerTrack() const
Returns the track if it's a track or clip plugin.
virtual void deleteFromParent()
Attempts to delete this plugin, whether it's a master plugin, track plugin, etc.
virtual void initialise(const PluginInitialisationInfo &)=0
Gives the plugin a chance to set itself up before being played.
Base class for things that can be selected, and whose properties can appear in the properties panel.
Manages a list of items that are currently selected.
Type jlimit(Type lowerLimit, Type upperLimit, Type valueToConstrain) noexcept
Passed into Plugins when they are being initialised, to give them useful contextual information that ...
Represents a position in real-life time.
Wraps an atomic with an interface compatible with var so it can be used within CachedValues in a thre...
ID for objects of type EditElement - e.g.
The context passed to plugin render methods to provide it with buffers to fill.
int bufferNumSamples
The number of samples to write into the audio buffer.
bool isScrubbing
True if the the audio is currently being scrubbed.
MidiMessageArray * bufferForMidiMessages
A buffer of MIDI events to process.
juce::AudioBuffer< float > * destBuffer
The target audio buffer which needs to be filled.
PluginRenderContext & operator=(const PluginRenderContext &)=delete
Deleted assignment operators.
int bufferStartSample
The index of the start point in the audio buffer from which data must be written.
double midiBufferOffset
A time offset to add to the timestamp of any events in the MIDI buffer.
bool allowBypassedProcessing
If this is true and the plugin supports it, this will call the bypassed processing method of the plug...
bool isRendering
True if the rendering is happening as part of an offline render rather than live playback.
bool isPlaying
True if the the playhead is currently playing.
PluginRenderContext(const PluginRenderContext &)=default
Creates a copy of another PluginRenderContext.
TimeRange editTime
The edit time range this context represents.
juce::AudioChannelSet destBufferChannels
A description of the type of channels in each of the channels in destBuffer.