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

« « « Anklang Documentation
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
tracktion::engine::WaveInputDeviceInstance Class Reference
Inheritance diagram for tracktion::engine::WaveInputDeviceInstance:
tracktion::engine::InputDeviceInstance juce::ValueTree::Listener

Classes

struct  WaveRecordingContext
 

Public Member Functions

 WaveInputDeviceInstance (WaveInputDevice &dev, EditPlaybackContext &c)
 
bool isRecordingActive () const override
 Returns true if recording is enabled and the input is connected to any target.
 
bool isRecordingActive (EditItemID targetID) const override
 Returns true if recording is enabled and the input is connected the given target.
 
bool isRecordingQueuedToStop (EditItemID targetID) override
 Returns true if the async stopRecording function has been used and this target is waiting to stop.
 
bool shouldTrackContentsBeMuted (const Track &t) override
 Should return true if this input is currently actively recording into a track and it wants the existing track contents to be muted.
 
juce::AudioFormatgetFormatToUse () const
 
tl::expected< std::unique_ptr< RecordingContext >, juce::StringprepareToRecordTarget (EditItemID targetID, TimeRange punchRange)
 
std::vector< tl::expected< std::unique_ptr< RecordingContext >, juce::String > > prepareToRecord (RecordingParameters params) override
 Prepares a recording operation.
 
std::vector< std::unique_ptr< RecordingContext > > startRecording (std::vector< std::unique_ptr< RecordingContext > > newContexts) override
 Starts a recording.
 
TimePosition getPunchInTime (EditItemID targetID) override
 Returns the time that a given target started recording.
 
bool isRecording (EditItemID targetID) override
 Returns true if there are any active recordings for this device.
 
bool isRecording () override
 Returns true if there are any active recordings for this device.
 
tl::expected< Clip::Array, juce::StringstopRecording (StopRecordingParameters params) override
 Stops a recording.
 
void stopRecording (StopRecordingParameters params, std::function< void(tl::expected< Clip::Array, juce::String >)> callback) override
 Stops a recording asyncronously.
 
juce::File getRecordingFile (EditItemID targetID) const override
 Returns the File that the given target is currently recording to.
 
tl::expected< Clip::Array, juce::StringapplyRecording (std::unique_ptr< WaveRecordingContext > rc, TimePosition unloopedEndTime, bool isLooping, TimeRange loopRange, bool discardRecordings)
 
tl::expected< Clip::Array, juce::StringapplyLastRecording (const WaveRecordingContext &rc, const AudioFile &recordedFile, ClipOwner &destClipOwner, TimeRange recordedRange, bool isLooping, bool isPunching, TimePosition loopEnd)
 
tl::expected< Clip::Array, juce::StringapplyLastRecording (const WaveRecordingContext &rc, const ProjectItem::Ptr projectItem, const AudioFile &recordedFile, ClipOwner &destClipOwner, TimeDuration recordedFileLength, TimeDuration newClipLen, bool isLooping, bool isPunching, TimePosition loopEnd)
 
juce::Array< Clip * > applyRetrospectiveRecord (bool armedOnly) override
 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.
 
void copyIncomingDataIntoBuffer (const float *const *allChannels, int numChannels, int numSamples)
 
void acceptInputBuffer (const float *const *allChannels, int numChannels, int numSamples, double streamTime, LevelMeasurer *measurerToUpdate, RetrospectiveRecordBuffer *retrospectiveBuffer, bool addToRetrospective)
 
- Public Member Functions inherited from tracktion::engine::InputDeviceInstance
 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.
 
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 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.
 

Static Public Member Functions

static tl::expected< juce::File, juce::StringgetDestinationRecordingFile (Edit &ed, EditItemID targetID, const juce::AudioFormat &format, juce::String filenameMask)
 
static bool splitRecordingIntoMultipleTakes (EditPlaybackContext &epc, const AudioFile &recordedFile, const ProjectItem::Ptr &projectItem, TimeDuration recordedFileLength, juce::ReferenceCountedArray< ProjectItem > &extraTakes, juce::Array< juce::File > &filesCreated)
 

Protected Member Functions

WaveRecordingContextgetContextForID (EditItemID targetID) const
 
RecordStoppergetRecordStopper ()
 
WaveInputDevicegetWaveInput () const noexcept
 
void addConsumer (Consumer *consumer) override
 Base classes should override this to add any Consumers internally.
 
void removeConsumer (Consumer *consumer) override
 Base classes should override this to remove the Consumer internally.
 
- Protected Member Functions inherited from tracktion::engine::InputDeviceInstance
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)
 

Protected Attributes

std::shared_mutex contextLock
 
std::vector< std::unique_ptr< WaveRecordingContext > > recordingContexts
 
std::unique_ptr< RecordStopperrecordStopper
 
juce::AudioBuffer< floatinputBuffer
 
juce::Array< Consumer * > consumers
 
juce::CriticalSection consumerLock
 

Additional Inherited Members

- Public Types inherited from tracktion::engine::InputDeviceInstance
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 Attributes inherited from tracktion::engine::InputDeviceInstance
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.
 

Detailed Description

Definition at line 211 of file tracktion_WaveInputDevice.cpp.

Constructor & Destructor Documentation

◆ WaveInputDeviceInstance()

tracktion::engine::WaveInputDeviceInstance::WaveInputDeviceInstance ( WaveInputDevice dev,
EditPlaybackContext c 
)

Definition at line 214 of file tracktion_WaveInputDevice.cpp.

◆ ~WaveInputDeviceInstance()

tracktion::engine::WaveInputDeviceInstance::~WaveInputDeviceInstance ( )
override

Definition at line 221 of file tracktion_WaveInputDevice.cpp.

Member Function Documentation

◆ acceptInputBuffer()

void tracktion::engine::WaveInputDeviceInstance::acceptInputBuffer ( const float *const *  allChannels,
int  numChannels,
int  numSamples,
double  streamTime,
LevelMeasurer measurerToUpdate,
RetrospectiveRecordBuffer retrospectiveBuffer,
bool  addToRetrospective 
)

Definition at line 1124 of file tracktion_WaveInputDevice.cpp.

◆ addConsumer()

void tracktion::engine::WaveInputDeviceInstance::addConsumer ( Consumer )
overrideprotectedvirtual

Base classes should override this to add any Consumers internally.

Implements tracktion::engine::InputDeviceInstance.

Definition at line 1282 of file tracktion_WaveInputDevice.cpp.

◆ applyLastRecording() [1/2]

tl::expected< Clip::Array, juce::String > tracktion::engine::WaveInputDeviceInstance::applyLastRecording ( const WaveRecordingContext rc,
const AudioFile recordedFile,
ClipOwner destClipOwner,
TimeRange  recordedRange,
bool  isLooping,
bool  isPunching,
TimePosition  loopEnd 
)

Definition at line 716 of file tracktion_WaveInputDevice.cpp.

◆ applyLastRecording() [2/2]

tl::expected< Clip::Array, juce::String > tracktion::engine::WaveInputDeviceInstance::applyLastRecording ( const WaveRecordingContext rc,
const ProjectItem::Ptr  projectItem,
const AudioFile recordedFile,
ClipOwner destClipOwner,
TimeDuration  recordedFileLength,
TimeDuration  newClipLen,
bool  isLooping,
bool  isPunching,
TimePosition  loopEnd 
)

Definition at line 778 of file tracktion_WaveInputDevice.cpp.

◆ applyRecording()

tl::expected< Clip::Array, juce::String > tracktion::engine::WaveInputDeviceInstance::applyRecording ( std::unique_ptr< WaveRecordingContext rc,
TimePosition  unloopedEndTime,
bool  isLooping,
TimeRange  loopRange,
bool  discardRecordings 
)

Definition at line 670 of file tracktion_WaveInputDevice.cpp.

◆ applyRetrospectiveRecord()

juce::Array< Clip * > tracktion::engine::WaveInputDeviceInstance::applyRetrospectiveRecord ( bool  armedOnly)
overridevirtual

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.

Implements tracktion::engine::InputDeviceInstance.

Definition at line 956 of file tracktion_WaveInputDevice.cpp.

◆ copyIncomingDataIntoBuffer()

void tracktion::engine::WaveInputDeviceInstance::copyIncomingDataIntoBuffer ( const float *const *  allChannels,
int  numChannels,
int  numSamples 
)

Definition at line 1097 of file tracktion_WaveInputDevice.cpp.

◆ getContextForID()

WaveRecordingContext * tracktion::engine::WaveInputDeviceInstance::getContextForID ( EditItemID  targetID) const
protected

Definition at line 1234 of file tracktion_WaveInputDevice.cpp.

◆ getDestinationRecordingFile()

static tl::expected< juce::File, juce::String > tracktion::engine::WaveInputDeviceInstance::getDestinationRecordingFile ( Edit ed,
EditItemID  targetID,
const juce::AudioFormat format,
juce::String  filenameMask 
)
static

Definition at line 288 of file tracktion_WaveInputDevice.cpp.

◆ getFormatToUse()

juce::AudioFormat * tracktion::engine::WaveInputDeviceInstance::getFormatToUse ( ) const

Definition at line 283 of file tracktion_WaveInputDevice.cpp.

◆ getPunchInTime()

TimePosition tracktion::engine::WaveInputDeviceInstance::getPunchInTime ( EditItemID  )
overridevirtual

Returns the time that a given target started recording.

Implements tracktion::engine::InputDeviceInstance.

Definition at line 470 of file tracktion_WaveInputDevice.cpp.

◆ getRecordingFile()

juce::File tracktion::engine::WaveInputDeviceInstance::getRecordingFile ( EditItemID  ) const
overridevirtual

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

Reimplemented from tracktion::engine::InputDeviceInstance.

Definition at line 609 of file tracktion_WaveInputDevice.cpp.

◆ getRecordStopper()

RecordStopper & tracktion::engine::WaveInputDeviceInstance::getRecordStopper ( )
protected

Definition at line 1245 of file tracktion_WaveInputDevice.cpp.

◆ getWaveInput()

WaveInputDevice & tracktion::engine::WaveInputDeviceInstance::getWaveInput ( ) const
protectednoexcept

Definition at line 1276 of file tracktion_WaveInputDevice.cpp.

◆ isRecording() [1/2]

bool tracktion::engine::WaveInputDeviceInstance::isRecording ( )
overridevirtual

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

Implements tracktion::engine::InputDeviceInstance.

Definition at line 488 of file tracktion_WaveInputDevice.cpp.

◆ isRecording() [2/2]

bool tracktion::engine::WaveInputDeviceInstance::isRecording ( EditItemID  )
overridevirtual

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

Implements tracktion::engine::InputDeviceInstance.

Definition at line 483 of file tracktion_WaveInputDevice.cpp.

◆ isRecordingActive() [1/2]

bool tracktion::engine::WaveInputDeviceInstance::isRecordingActive ( ) const
overridevirtual

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

Reimplemented from tracktion::engine::InputDeviceInstance.

Definition at line 237 of file tracktion_WaveInputDevice.cpp.

◆ isRecordingActive() [2/2]

bool tracktion::engine::WaveInputDeviceInstance::isRecordingActive ( EditItemID  targetID) const
overridevirtual

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

Reimplemented from tracktion::engine::InputDeviceInstance.

Definition at line 242 of file tracktion_WaveInputDevice.cpp.

◆ isRecordingQueuedToStop()

bool tracktion::engine::WaveInputDeviceInstance::isRecordingQueuedToStop ( EditItemID  )
overridevirtual

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

Implements tracktion::engine::InputDeviceInstance.

Definition at line 247 of file tracktion_WaveInputDevice.cpp.

◆ prepareToRecord()

std::vector< tl::expected< std::unique_ptr< RecordingContext >, juce::String > > tracktion::engine::WaveInputDeviceInstance::prepareToRecord ( RecordingParameters  )
overridevirtual

Prepares a recording operation.

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

Implements tracktion::engine::InputDeviceInstance.

Definition at line 422 of file tracktion_WaveInputDevice.cpp.

◆ prepareToRecordTarget()

tl::expected< std::unique_ptr< RecordingContext >, juce::String > tracktion::engine::WaveInputDeviceInstance::prepareToRecordTarget ( EditItemID  targetID,
TimeRange  punchRange 
)

Definition at line 332 of file tracktion_WaveInputDevice.cpp.

◆ removeConsumer()

void tracktion::engine::WaveInputDeviceInstance::removeConsumer ( Consumer )
overrideprotectedvirtual

Base classes should override this to remove the Consumer internally.

Implements tracktion::engine::InputDeviceInstance.

Definition at line 1288 of file tracktion_WaveInputDevice.cpp.

◆ shouldTrackContentsBeMuted()

bool tracktion::engine::WaveInputDeviceInstance::shouldTrackContentsBeMuted ( const Track )
overridevirtual

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

Reimplemented from tracktion::engine::InputDeviceInstance.

Definition at line 252 of file tracktion_WaveInputDevice.cpp.

◆ splitRecordingIntoMultipleTakes()

static bool tracktion::engine::WaveInputDeviceInstance::splitRecordingIntoMultipleTakes ( EditPlaybackContext epc,
const AudioFile recordedFile,
const ProjectItem::Ptr projectItem,
TimeDuration  recordedFileLength,
juce::ReferenceCountedArray< ProjectItem > &  extraTakes,
juce::Array< juce::File > &  filesCreated 
)
static

Definition at line 879 of file tracktion_WaveInputDevice.cpp.

◆ startRecording()

std::vector< std::unique_ptr< RecordingContext > > tracktion::engine::WaveInputDeviceInstance::startRecording ( std::vector< std::unique_ptr< RecordingContext > >  )
overridevirtual

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.

Implements tracktion::engine::InputDeviceInstance.

Definition at line 441 of file tracktion_WaveInputDevice.cpp.

◆ stopRecording() [1/2]

tl::expected< Clip::Array, juce::String > tracktion::engine::WaveInputDeviceInstance::stopRecording ( StopRecordingParameters  )
overridevirtual

Stops a recording.

Parameters
StopRecordingParametersdetermines how stopped recordings are treated.

Implements tracktion::engine::InputDeviceInstance.

Definition at line 494 of file tracktion_WaveInputDevice.cpp.

◆ stopRecording() [2/2]

void tracktion::engine::WaveInputDeviceInstance::stopRecording ( StopRecordingParameters  ,
std::function< void(tl::expected< Clip::Array, juce::String >)>   
)
overridevirtual

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.

Implements tracktion::engine::InputDeviceInstance.

Definition at line 555 of file tracktion_WaveInputDevice.cpp.

Member Data Documentation

◆ consumerLock

juce::CriticalSection tracktion::engine::WaveInputDeviceInstance::consumerLock
protected

Definition at line 1280 of file tracktion_WaveInputDevice.cpp.

◆ consumers

juce::Array<Consumer*> tracktion::engine::WaveInputDeviceInstance::consumers
protected

Definition at line 1279 of file tracktion_WaveInputDevice.cpp.

◆ contextLock

std::shared_mutex tracktion::engine::WaveInputDeviceInstance::contextLock
mutableprotected

Definition at line 1228 of file tracktion_WaveInputDevice.cpp.

◆ inputBuffer

juce::AudioBuffer<float> tracktion::engine::WaveInputDeviceInstance::inputBuffer
protected

Definition at line 1232 of file tracktion_WaveInputDevice.cpp.

◆ recordingContexts

std::vector<std::unique_ptr<WaveRecordingContext> > tracktion::engine::WaveInputDeviceInstance::recordingContexts
protected

Definition at line 1229 of file tracktion_WaveInputDevice.cpp.

◆ recordStopper

std::unique_ptr<RecordStopper> tracktion::engine::WaveInputDeviceInstance::recordStopper
protected

Definition at line 1230 of file tracktion_WaveInputDevice.cpp.


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