TracktionEngine
|
An instance of an InputDevice that's available to an Edit. More...
#include <tracktion_InputDevice.h>
Inherits juce::ValueTree::Listener.
Classes | |
struct | Consumer |
Base class for classes that want to listen to an InputDevice and get a callback for each block of input. More... | |
struct | Destination |
struct | DestinationList |
struct | MidiInputDestination |
class | RecordingContext |
Base class for RecordingContexts. More... | |
struct | RecordingParameters |
struct | StopRecordingParameters |
The params passed to stopRecording. More... | |
struct | VirtualMidiInputDestination |
struct | WaveInputDestination |
Public Types | |
using | PreparedContext = std::vector< tl::expected< std::unique_ptr< RecordingContext >, juce::String > > |
An array of either valid RecordingContexts or an error message if the recording couldn't be started. | |
Public Member Functions | |
InputDeviceInstance (InputDevice &, EditPlaybackContext &) | |
~InputDeviceInstance () override | |
Destructor. | |
InputDevice & | getInputDevice () noexcept |
Returns the InputDevice this instance belongs to. | |
juce::Array< EditItemID > | getTargets () const |
Returns the targets this instance is assigned to. | |
tl::expected< Destination *, juce::String > | setTarget (EditItemID targetID, bool moveToTrack, juce::UndoManager *, std::optional< int > index=std::nullopt) |
Assigns this input to either an AudioTrack or a ClipSlot. | |
juce::Result | removeTarget (EditItemID targetID, juce::UndoManager *) |
Removes the destination with the given targetID. | |
virtual bool | isLivePlayEnabled (const Track &) const |
Whether the track should monitor the input or not. | |
virtual bool | isRecordingActive () const |
Returns true if recording is enabled and the input is connected to any target. | |
virtual bool | isRecordingActive (EditItemID) const |
Returns true if recording is enabled and the input is connected the given target. | |
virtual bool | isRecordingQueuedToStop (EditItemID)=0 |
Returns true if the async stopRecording function has been used and this target is waiting to stop. | |
bool | isRecordingEnabled (EditItemID) const |
Returns true if recording is enabled for the given target. | |
void | setRecordingEnabled (EditItemID, bool) |
Enabled/disables recording for a given target. | |
virtual bool | shouldTrackContentsBeMuted (const Track &) |
Should return true if this input is currently actively recording into a track and it wants the existing track contents to be muted. | |
virtual PreparedContext | prepareToRecord (RecordingParameters)=0 |
Prepares a recording operation. | |
virtual std::vector< std::unique_ptr< RecordingContext > > | startRecording (std::vector< std::unique_ptr< RecordingContext > >)=0 |
Starts a recording. | |
virtual void | prepareToStopRecording (std::vector< EditItemID > targetsToStop)=0 |
Stops a recording from receiving any more input. | |
virtual tl::expected< Clip::Array, juce::String > | stopRecording (StopRecordingParameters)=0 |
Stops a recording. | |
virtual void | stopRecording (StopRecordingParameters, std::function< void(tl::expected< Clip::Array, juce::String >)>)=0 |
Stops a recording asyncronously. | |
virtual bool | isRecording (EditItemID)=0 |
Returns true if there are any active recordings for this device. | |
virtual bool | isRecording ()=0 |
Returns true if there are any active recordings for this device. | |
virtual juce::File | getRecordingFile (EditItemID) const |
Returns the File that the given target is currently recording to. | |
virtual std::shared_ptr< choc::fifo::SingleReaderSingleWriterFIFO< juce::MidiMessage > > | getRecordingNotes (EditItemID) const |
Returns a fifo of recorded MIDInotes that can be used for drawing UI components. | |
virtual TimePosition | getPunchInTime (EditItemID)=0 |
Returns the time that a given target started recording. | |
virtual juce::Array< Clip * > | applyRetrospectiveRecord (bool armedOnly)=0 |
Takes the retrospective buffer and creates clips from it, as if recording had been triggered in the past and stopped at the time of calling this function. | |
virtual void | addConsumer (Consumer *)=0 |
Base classes should override this to add any Consumers internally. | |
virtual void | removeConsumer (Consumer *)=0 |
Base classes should override this to remove the Consumer internally. | |
Public Attributes | |
juce::ValueTree | state |
InputDevice & | owner |
The state of this instance. | |
EditPlaybackContext & | context |
The EditPlaybackContext this instance belongs to. | |
Edit & | edit |
The Edit this instance belongs to. | |
DestinationList | destinations { *this, state } |
The list of assigned destinations. | |
Protected Member Functions | |
void | valueTreePropertyChanged (juce::ValueTree &, const juce::Identifier &) override |
void | valueTreeChildAdded (juce::ValueTree &, juce::ValueTree &) override |
void | valueTreeChildRemoved (juce::ValueTree &, juce::ValueTree &, int) override |
ClipSlot * | getFreeSlot (AudioTrack &) |
An instance of an InputDevice that's available to an Edit.
Whereas InputDevice[s] are Engine level objects, instances apply to an Edit and can therefore be assigned to slots/tracks etc.
using tracktion::engine::InputDeviceInstance::PreparedContext = std::vector<tl::expected<std::unique_ptr<RecordingContext>, juce::String> > |
An array of either valid RecordingContexts or an error message if the recording couldn't be started.
tracktion::engine::InputDeviceInstance::InputDeviceInstance | ( | InputDevice & | , |
EditPlaybackContext & | |||
) |
|
override |
Destructor.
|
noexcept |
Returns the InputDevice this instance belongs to.
References owner.
Referenced by tracktion::engine::InputDeviceInstance::DestinationList::createNewObject(), and tracktion::engine::InputDeviceInstance::Destination::getSelectableDescription().
juce::Array< EditItemID > tracktion::engine::InputDeviceInstance::getTargets | ( | ) | const |
Returns the targets this instance is assigned to.
tl::expected< Destination *, juce::String > tracktion::engine::InputDeviceInstance::setTarget | ( | EditItemID | targetID, |
bool | moveToTrack, | ||
juce::UndoManager * | , | ||
std::optional< int > | index = std::nullopt |
||
) |
Assigns this input to either an AudioTrack or a ClipSlot.
juce::Result tracktion::engine::InputDeviceInstance::removeTarget | ( | EditItemID | targetID, |
juce::UndoManager * | |||
) |
Removes the destination with the given targetID.
|
virtual |
Whether the track should monitor the input or not.
|
virtual |
Returns true if recording is enabled and the input is connected to any target.
|
virtual |
Returns true if recording is enabled and the input is connected the given target.
|
pure virtual |
Returns true if the async stopRecording function has been used and this target is waiting to stop.
bool tracktion::engine::InputDeviceInstance::isRecordingEnabled | ( | EditItemID | ) | const |
Returns true if recording is enabled for the given target.
void tracktion::engine::InputDeviceInstance::setRecordingEnabled | ( | EditItemID | , |
bool | |||
) |
Enabled/disables recording for a given target.
If the transport is currently recording, this will start a punch-in recording.
|
virtual |
Should return true if this input is currently actively recording into a track and it wants the existing track contents to be muted.
|
pure virtual |
Prepares a recording operation.
RecordingParameters | Determines the destinations and punch ranges |
|
pure virtual |
Starts a recording.
The | prepared recording contexts to start. |
|
pure virtual |
Stops a recording from receiving any more input.
Because stopRecording is blocking, if you have many inputs recording, some inputs can continue to record whilst others are having their files closed. Calling this first prevents this.
targetsToStop | The targets to stop, others will continue allowing you to punch out only specific targets. If this is empty, all active recordings will be stopped. |
|
pure virtual |
Stops a recording.
StopRecordingParameters | determines how stopped recordings are treated. |
|
pure virtual |
Stops a recording asyncronously.
This can be used to trigger a recording to stop at a time in the future. This function will return immidiately and call the provided callback when the recording actually stops.
StopRecordingParameters | Determines how stopped recordings are treated. |
recordingStoppedCallback | A callback to call when the recording stops. |
|
pure virtual |
Returns true if there are any active recordings for this device.
|
pure virtual |
Returns true if there are any active recordings for this device.
|
virtual |
Returns the File that the given target is currently recording to.
|
virtual |
Returns a fifo of recorded MIDInotes that can be used for drawing UI components.
|
pure virtual |
Returns the time that a given target started recording.
|
pure virtual |
Takes the retrospective buffer and creates clips from it, as if recording had been triggered in the past and stopped at the time of calling this function.
|
pure virtual |
Base classes should override this to add any Consumers internally.
|
pure virtual |
Base classes should override this to remove the Consumer internally.
|
overrideprotected |
|
overrideprotected |
|
overrideprotected |
|
protected |
juce::ValueTree tracktion::engine::InputDeviceInstance::state |
InputDevice& tracktion::engine::InputDeviceInstance::owner |
EditPlaybackContext& tracktion::engine::InputDeviceInstance::context |
The EditPlaybackContext this instance belongs to.
DestinationList tracktion::engine::InputDeviceInstance::destinations { *this, state } |
The list of assigned destinations.