tracktion-engine 3.0-10-g034fdde4aa5
Tracktion Engine — High level data model for audio applications

« « « Anklang Documentation
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Public Attributes | Protected Member Functions | List of all members
tracktion::engine::InputDeviceInstance Class Referenceabstract

An instance of an InputDevice that's available to an Edit. More...

#include "tracktion_InputDevice.h"

Inheritance diagram for tracktion::engine::InputDeviceInstance:
juce::ValueTree::Listener tracktion::engine::MidiInputDeviceInstanceBase tracktion::engine::WaveInputDeviceInstance tracktion::engine::PhysicalMidiInputDeviceInstance tracktion::engine::VirtualMidiInputDeviceInstance

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.
 
InputDevicegetInputDevice () noexcept
 Returns the InputDevice this instance belongs to.
 
juce::Array< EditItemIDgetTargets () const
 Returns the targets this instance is assigned to.
 
tl::expected< Destination *, juce::StringsetTarget (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 tl::expected< Clip::Array, juce::StringstopRecording (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
 
InputDeviceowner
 The state of this instance.
 
EditPlaybackContextcontext
 The EditPlaybackContext this instance belongs to.
 
Editedit
 The Edit this instance belongs to.
 
DestinationList destinations
 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
 
ClipSlotgetFreeSlot (AudioTrack &)
 
- Protected Member Functions inherited from juce::ValueTree::Listener
virtual void valueTreeChildOrderChanged (ValueTree &parentTreeWhoseChildrenHaveMoved, int oldIndex, int newIndex)
 
virtual void valueTreeParentChanged (ValueTree &treeWhoseParentHasChanged)
 
virtual void valueTreeRedirected (ValueTree &treeWhichHasBeenChanged)
 

Detailed Description

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.

See also
EditInputDevices

Definition at line 108 of file tracktion_InputDevice.h.


Class Documentation

◆ tracktion::engine::InputDeviceInstance::RecordingParameters

struct tracktion::engine::InputDeviceInstance::RecordingParameters

Definition at line 161 of file tracktion_InputDevice.h.

Class Members
TimeRange punchRange The transport time range at which the recording should happen.
vector< EditItemID > targets The targets to record to, if this is empty, all armed targets will be added.

◆ tracktion::engine::InputDeviceInstance::StopRecordingParameters

struct tracktion::engine::InputDeviceInstance::StopRecordingParameters

The params passed to stopRecording.

Definition at line 208 of file tracktion_InputDevice.h.

Class Members
bool discardRecordings Whether to discard recordings or keep them.
bool isLooping Whether to treat the stopped recordings as looped or not.
TimeRange markedRange The marked range used for either loop or punch times.
vector< EditItemID > 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.

TimePosition unloopedTimeToEndRecording The TimePosition this recording should be stopped at.
See also
EditPlaybackContext::getUnloopedPosition.

Member Typedef Documentation

◆ PreparedContext

An array of either valid RecordingContexts or an error message if the recording couldn't be started.

See also

Definition at line 189 of file tracktion_InputDevice.h.

Constructor & Destructor Documentation

◆ InputDeviceInstance()

tracktion::engine::InputDeviceInstance::InputDeviceInstance ( InputDevice d,
EditPlaybackContext c 
)

Definition at line 89 of file tracktion_InputDevice.cpp.

◆ ~InputDeviceInstance()

tracktion::engine::InputDeviceInstance::~InputDeviceInstance ( )
override

Destructor.

Definition at line 110 of file tracktion_InputDevice.cpp.

Member Function Documentation

◆ addConsumer()

virtual void tracktion::engine::InputDeviceInstance::addConsumer ( Consumer )
pure virtual

Base classes should override this to add any Consumers internally.

Implemented in tracktion::engine::WaveInputDeviceInstance.

◆ applyRetrospectiveRecord()

virtual juce::Array< Clip * > tracktion::engine::InputDeviceInstance::applyRetrospectiveRecord ( bool  armedOnly)
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.

Implemented in tracktion::engine::MidiInputDeviceInstanceBase, and tracktion::engine::WaveInputDeviceInstance.

◆ getFreeSlot()

ClipSlot * tracktion::engine::InputDeviceInstance::getFreeSlot ( AudioTrack t)
protected

Definition at line 291 of file tracktion_InputDevice.cpp.

◆ getInputDevice()

InputDevice & tracktion::engine::InputDeviceInstance::getInputDevice ( )
noexcept

Returns the InputDevice this instance belongs to.

Definition at line 122 of file tracktion_InputDevice.h.

◆ getPunchInTime()

virtual TimePosition tracktion::engine::InputDeviceInstance::getPunchInTime ( EditItemID  )
pure virtual

Returns the time that a given target started recording.

Implemented in tracktion::engine::MidiInputDeviceInstanceBase, and tracktion::engine::WaveInputDeviceInstance.

◆ getRecordingFile()

virtual juce::File tracktion::engine::InputDeviceInstance::getRecordingFile ( EditItemID  ) const
virtual

Returns the File that the given target is currently recording to.

Reimplemented in tracktion::engine::WaveInputDeviceInstance.

Definition at line 240 of file tracktion_InputDevice.h.

◆ getRecordingNotes()

virtual std::shared_ptr< choc::fifo::SingleReaderSingleWriterFIFO< juce::MidiMessage > > tracktion::engine::InputDeviceInstance::getRecordingNotes ( EditItemID  ) const
virtual

Returns a fifo of recorded MIDInotes that can be used for drawing UI components.

Reimplemented in tracktion::engine::MidiInputDeviceInstanceBase.

Definition at line 243 of file tracktion_InputDevice.h.

◆ getTargets()

juce::Array< EditItemID > tracktion::engine::InputDeviceInstance::getTargets ( ) const

Returns the targets this instance is assigned to.

Definition at line 115 of file tracktion_InputDevice.cpp.

◆ isLivePlayEnabled()

bool tracktion::engine::InputDeviceInstance::isLivePlayEnabled ( const Track t) const
virtual

Whether the track should monitor the input or not.

Definition at line 224 of file tracktion_InputDevice.cpp.

◆ isRecording() [1/2]

virtual bool tracktion::engine::InputDeviceInstance::isRecording ( )
pure virtual

Returns true if there are any active recordings for this device.

Implemented in tracktion::engine::MidiInputDeviceInstanceBase, and tracktion::engine::WaveInputDeviceInstance.

◆ isRecording() [2/2]

virtual bool tracktion::engine::InputDeviceInstance::isRecording ( EditItemID  )
pure virtual

Returns true if there are any active recordings for this device.

Implemented in tracktion::engine::MidiInputDeviceInstanceBase, and tracktion::engine::WaveInputDeviceInstance.

◆ isRecordingActive() [1/2]

bool tracktion::engine::InputDeviceInstance::isRecordingActive ( ) const
virtual

Returns true if recording is enabled and the input is connected to any target.

Reimplemented in tracktion::engine::MidiInputDeviceInstanceBase, and tracktion::engine::WaveInputDeviceInstance.

Definition at line 189 of file tracktion_InputDevice.cpp.

◆ isRecordingActive() [2/2]

bool tracktion::engine::InputDeviceInstance::isRecordingActive ( EditItemID  targetID) const
virtual

Returns true if recording is enabled and the input is connected the given target.

Reimplemented in tracktion::engine::MidiInputDeviceInstanceBase, and tracktion::engine::WaveInputDeviceInstance.

Definition at line 198 of file tracktion_InputDevice.cpp.

◆ isRecordingEnabled()

bool tracktion::engine::InputDeviceInstance::isRecordingEnabled ( EditItemID  targetID) const

Returns true if recording is enabled for the given target.

Definition at line 207 of file tracktion_InputDevice.cpp.

◆ isRecordingQueuedToStop()

virtual bool tracktion::engine::InputDeviceInstance::isRecordingQueuedToStop ( EditItemID  )
pure virtual

Returns true if the async stopRecording function has been used and this target is waiting to stop.

Implemented in tracktion::engine::MidiInputDeviceInstanceBase, and tracktion::engine::WaveInputDeviceInstance.

◆ prepareToRecord()

virtual PreparedContext tracktion::engine::InputDeviceInstance::prepareToRecord ( RecordingParameters  )
pure virtual

Prepares a recording operation.

Parameters
RecordingParametersDetermines the destinations and punch ranges
Returns
An array of either valid RecordingContexts or error messages

Implemented in tracktion::engine::MidiInputDeviceInstanceBase, tracktion::engine::PhysicalMidiInputDeviceInstance, and tracktion::engine::WaveInputDeviceInstance.

◆ removeConsumer()

virtual void tracktion::engine::InputDeviceInstance::removeConsumer ( Consumer )
pure virtual

Base classes should override this to remove the Consumer internally.

Implemented in tracktion::engine::WaveInputDeviceInstance.

◆ removeTarget()

juce::Result tracktion::engine::InputDeviceInstance::removeTarget ( EditItemID  targetID,
juce::UndoManager um 
)

Removes the destination with the given targetID.

Definition at line 173 of file tracktion_InputDevice.cpp.

◆ setRecordingEnabled()

void tracktion::engine::InputDeviceInstance::setRecordingEnabled ( EditItemID  targetID,
bool  b 
)

Enabled/disables recording for a given target.

If the transport is currently recording, this will start a punch-in recording.

Definition at line 217 of file tracktion_InputDevice.cpp.

◆ setTarget()

tl::expected< InputDeviceInstance::Destination *, juce::String > tracktion::engine::InputDeviceInstance::setTarget ( EditItemID  targetID,
bool  moveToTrack,
juce::UndoManager um,
std::optional< int index = std::nullopt 
)

Assigns this input to either an AudioTrack or a ClipSlot.

Definition at line 136 of file tracktion_InputDevice.cpp.

◆ shouldTrackContentsBeMuted()

virtual bool tracktion::engine::InputDeviceInstance::shouldTrackContentsBeMuted ( const Track )
virtual

Should return true if this input is currently actively recording into a track and it wants the existing track contents to be muted.

Reimplemented in tracktion::engine::MidiInputDeviceInstanceBase, and tracktion::engine::WaveInputDeviceInstance.

Definition at line 157 of file tracktion_InputDevice.h.

◆ startRecording()

virtual std::vector< std::unique_ptr< RecordingContext > > tracktion::engine::InputDeviceInstance::startRecording ( std::vector< std::unique_ptr< RecordingContext > >  )
pure virtual

Starts a recording.

Parameters
Theprepared recording contexts to start.
Returns
Any recording contexts that couldn't be started by this device. E.g. If the contexts are mixed MIDI and audio and this is an audio device, it will returns the MIDI contexts to pass to a MIDI device.

Implemented in tracktion::engine::MidiInputDeviceInstanceBase, and tracktion::engine::WaveInputDeviceInstance.

◆ stopRecording() [1/2]

virtual tl::expected< Clip::Array, juce::String > tracktion::engine::InputDeviceInstance::stopRecording ( StopRecordingParameters  )
pure virtual

Stops a recording.

Parameters
StopRecordingParametersdetermines how stopped recordings are treated.

Implemented in tracktion::engine::MidiInputDeviceInstanceBase, and tracktion::engine::WaveInputDeviceInstance.

◆ stopRecording() [2/2]

virtual void tracktion::engine::InputDeviceInstance::stopRecording ( StopRecordingParameters  ,
std::function< void(tl::expected< Clip::Array, juce::String >)>   
)
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.

Parameters
StopRecordingParametersDetermines how stopped recordings are treated.
recordingStoppedCallbackA callback to call when the recording stops.

Implemented in tracktion::engine::MidiInputDeviceInstanceBase, and tracktion::engine::WaveInputDeviceInstance.

◆ valueTreeChildAdded()

void tracktion::engine::InputDeviceInstance::valueTreeChildAdded ( juce::ValueTree p,
juce::ValueTree c 
)
overrideprotectedvirtual

Reimplemented from juce::ValueTree::Listener.

Definition at line 263 of file tracktion_InputDevice.cpp.

◆ valueTreeChildRemoved()

void tracktion::engine::InputDeviceInstance::valueTreeChildRemoved ( juce::ValueTree p,
juce::ValueTree c,
int   
)
overrideprotectedvirtual

Reimplemented from juce::ValueTree::Listener.

Definition at line 277 of file tracktion_InputDevice.cpp.

◆ valueTreePropertyChanged()

void tracktion::engine::InputDeviceInstance::valueTreePropertyChanged ( juce::ValueTree v,
const juce::Identifier id 
)
overrideprotectedvirtual

Reimplemented from juce::ValueTree::Listener.

Definition at line 245 of file tracktion_InputDevice.cpp.

Member Data Documentation

◆ context

EditPlaybackContext& tracktion::engine::InputDeviceInstance::context

The EditPlaybackContext this instance belongs to.

Definition at line 256 of file tracktion_InputDevice.h.

◆ destinations

DestinationList tracktion::engine::InputDeviceInstance::destinations

The list of assigned destinations.

Definition at line 364 of file tracktion_InputDevice.h.

◆ edit

Edit& tracktion::engine::InputDeviceInstance::edit

The Edit this instance belongs to.

Definition at line 257 of file tracktion_InputDevice.h.

◆ owner

InputDevice& tracktion::engine::InputDeviceInstance::owner

The state of this instance.

The InputDevice this is an instance of.

Definition at line 255 of file tracktion_InputDevice.h.

◆ state

juce::ValueTree tracktion::engine::InputDeviceInstance::state

Definition at line 254 of file tracktion_InputDevice.h.


The documentation for this class was generated from the following files: