Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
zrythm::structure::tracks::TrackProcessor Class Referencefinal

A TrackProcessor is a processor that is used as the first entry point when processing a track. More...

#include <src/structure/tracks/track_processor.h>

Collaboration diagram for zrythm::structure::tracks::TrackProcessor:

Public Types

using SixteenPortUuidArray

Public Member Functions

 TrackProcessor (ProcessableTrack &track, dsp::PortRegistry &port_registry, dsp::ProcessorParameterRegistry &param_registry, bool new_identity)
 Creates a new track processor for the given track.
bool is_audio () const
bool is_midi () const
utils::Utf8String get_full_designation_for_port (const dsp::Port &port) const
dsp::PortConnectionsManagerget_port_connections_manager () const
ProcessableTrackget_track () const
void init_loaded (ProcessableTrack *track, dsp::PortRegistry &port_registry, dsp::ProcessorParameterRegistry &param_registry)
 Inits a TrackProcessor after a project is loaded.
void clear_buffers (std::size_t block_length)
 Clears all buffers.
void process (const EngineProcessTimeInfo &time_nfo)
 Process the TrackProcessor.
void disconnect_from_prefader ()
 Disconnect the TrackProcessor's stereo out ports from the prefader.
void connect_to_prefader ()
 Connects the TrackProcessor's stereo out ports to the Channel's prefader in ports.
void disconnect_from_plugin (gui::old_dsp::plugins::Plugin &pl)
 Disconnect the TrackProcessor's out ports from the Plugin's input ports.
void connect_to_plugin (gui::old_dsp::plugins::Plugin &pl)
 Connect the TrackProcessor's out ports to the Plugin's input ports.
void append_ports (std::vector< dsp::Port * > &ports)
std::pair< dsp::AudioPort &, dsp::AudioPort & > get_stereo_in_ports () const
std::pair< dsp::AudioPort &, dsp::AudioPort & > get_stereo_out_ports () const
dsp::ProcessorParameterget_mono_param () const
dsp::ProcessorParameterget_input_gain_param () const
dsp::ProcessorParameterget_output_gain_param () const
dsp::ProcessorParameterget_monitor_audio_param () const
dsp::MidiPortget_midi_in_port () const
dsp::MidiPortget_midi_out_port () const
dsp::MidiPortget_piano_roll_port () const
dsp::ProcessorParameterget_midi_cc_param (int channel_index, int cc_index) const
dsp::ProcessorParameterget_pitch_bend_param (int channel_index) const
dsp::ProcessorParameterget_poly_key_pressure_param (int channel_index) const
dsp::ProcessorParameterget_channel_pressure_param (int channel_index) const

Data Fields

dsp::PortRegistryport_registry_
dsp::ProcessorParameterRegistryparam_registry_
std::optional< dsp::PortUuidReferencestereo_in_left_id_
 L & R audio input ports, if audio.
std::optional< dsp::PortUuidReferencestereo_in_right_id_
std::optional< dsp::ProcessorParameterUuidReferencemono_id_
 Mono toggle, if audio.
std::optional< dsp::ProcessorParameterUuidReferenceinput_gain_id_
 Input gain, if audio.
std::optional< dsp::ProcessorParameterUuidReferenceoutput_gain_id_
 Output gain, if audio.
std::optional< dsp::PortUuidReferencestereo_out_left_id_
 L & R audio output ports, if audio.
std::optional< dsp::PortUuidReferencestereo_out_right_id_
std::optional< dsp::PortUuidReferencemidi_in_id_
 MIDI in Port.
std::optional< dsp::PortUuidReferencemidi_out_id_
 MIDI out port, if MIDI.
std::optional< dsp::PortUuidReferencepiano_roll_id_
 MIDI input for receiving MIDI signals from the piano roll (i.e., MIDI notes inside regions) or other sources.
std::optional< dsp::ProcessorParameterUuidReferencemonitor_audio_id_
 Whether to monitor the audio output.
std::unique_ptr< engine::session::MidiMappingscc_mappings_
 Mappings to each CC port.
std::unique_ptr< std::array< dsp::ProcessorParameterUuidReference, 16_zu *128 > > midi_cc_ids_
 MIDI CC control ports, 16 channels x 128 controls.
std::unique_ptr< SixteenPortUuidArray > pitch_bend_ids_
 Pitch bend x 16 channels.
std::unique_ptr< SixteenPortUuidArray > poly_key_pressure_ids_
 Polyphonic key pressure (aftertouch).
std::unique_ptr< SixteenPortUuidArray > channel_pressure_ids_
 Channel pressure (aftertouch).
float l_port_db_ = 0.0f
 Current dBFS after processing each output port.
float r_port_db_ = 0.0f
ProcessableTracktrack_ = nullptr
 Pointer to owner track, if any.
bool pending_midi_panic_ = false
 To be set to true when a panic (all notes off) message should be sent during processing.
std::unique_ptr< MPMCQueue< dsp::ProcessorParameter * > > updated_midi_automatable_ports_
 A queue of MIDI CC ports whose values have been recently updated.

Friends

void init_from (TrackProcessor &obj, const TrackProcessor &other, utils::ObjectCloneType clone_type)
void to_json (nlohmann::json &j, const TrackProcessor &tp)
void from_json (const nlohmann::json &j, TrackProcessor &tp)

Detailed Description

A TrackProcessor is a processor that is used as the first entry point when processing a track.

Definition at line 22 of file track_processor.h.

Member Typedef Documentation

◆ SixteenPortUuidArray

using zrythm::structure::tracks::TrackProcessor::SixteenPortUuidArray
Initial value:
std::array<dsp::ProcessorParameterUuidReference, 16>

Definition at line 347 of file track_processor.h.

Member Function Documentation

◆ connect_to_prefader()

void zrythm::structure::tracks::TrackProcessor::connect_to_prefader ( )

Connects the TrackProcessor's stereo out ports to the Channel's prefader in ports.

Used when deleting the only plugin left.

◆ disconnect_from_prefader()

void zrythm::structure::tracks::TrackProcessor::disconnect_from_prefader ( )

Disconnect the TrackProcessor's stereo out ports from the prefader.

Used when there is no plugin in the channel.

◆ get_channel_pressure_param()

dsp::ProcessorParameter & zrythm::structure::tracks::TrackProcessor::get_channel_pressure_param ( int channel_index) const
inline

Definition at line 191 of file track_processor.h.

◆ get_input_gain_param()

dsp::ProcessorParameter & zrythm::structure::tracks::TrackProcessor::get_input_gain_param ( ) const
inline

Definition at line 148 of file track_processor.h.

◆ get_midi_cc_param()

dsp::ProcessorParameter & zrythm::structure::tracks::TrackProcessor::get_midi_cc_param ( int channel_index,
int cc_index ) const
inline

Definition at line 173 of file track_processor.h.

◆ get_midi_in_port()

dsp::MidiPort & zrythm::structure::tracks::TrackProcessor::get_midi_in_port ( ) const
inline

Definition at line 160 of file track_processor.h.

◆ get_midi_out_port()

dsp::MidiPort & zrythm::structure::tracks::TrackProcessor::get_midi_out_port ( ) const
inline

Definition at line 164 of file track_processor.h.

◆ get_monitor_audio_param()

dsp::ProcessorParameter & zrythm::structure::tracks::TrackProcessor::get_monitor_audio_param ( ) const
inline

Definition at line 156 of file track_processor.h.

◆ get_mono_param()

dsp::ProcessorParameter & zrythm::structure::tracks::TrackProcessor::get_mono_param ( ) const
inline

Definition at line 144 of file track_processor.h.

◆ get_output_gain_param()

dsp::ProcessorParameter & zrythm::structure::tracks::TrackProcessor::get_output_gain_param ( ) const
inline

Definition at line 152 of file track_processor.h.

◆ get_piano_roll_port()

dsp::MidiPort & zrythm::structure::tracks::TrackProcessor::get_piano_roll_port ( ) const
inline

Definition at line 168 of file track_processor.h.

◆ get_pitch_bend_param()

dsp::ProcessorParameter & zrythm::structure::tracks::TrackProcessor::get_pitch_bend_param ( int channel_index) const
inline

Definition at line 179 of file track_processor.h.

◆ get_poly_key_pressure_param()

dsp::ProcessorParameter & zrythm::structure::tracks::TrackProcessor::get_poly_key_pressure_param ( int channel_index) const
inline

Definition at line 185 of file track_processor.h.

◆ get_stereo_in_ports()

std::pair< dsp::AudioPort &, dsp::AudioPort & > zrythm::structure::tracks::TrackProcessor::get_stereo_in_ports ( ) const
inline

Definition at line 123 of file track_processor.h.

◆ get_stereo_out_ports()

std::pair< dsp::AudioPort &, dsp::AudioPort & > zrythm::structure::tracks::TrackProcessor::get_stereo_out_ports ( ) const
inline

Definition at line 133 of file track_processor.h.

◆ get_track()

ProcessableTrack * zrythm::structure::tracks::TrackProcessor::get_track ( ) const
inline

Definition at line 45 of file track_processor.h.

◆ process()

void zrythm::structure::tracks::TrackProcessor::process ( const EngineProcessTimeInfo & time_nfo)

Process the TrackProcessor.

This function performs the following:

  • produce output audio/MIDI into stereo out or midi out, based on any audio/MIDI regions, if has piano roll or is audio track
  • produce additional output MIDI events based on any MIDI CC automation regions, if applicable
  • change MIDI CC control port values based on any MIDI input, if recording — at this point the output is ready —
  • handle recording (create events in regions and automation, including MIDI CC automation, based on the MIDI CC control ports)
Parameters
g_start_framesThe global start frames.
local_offsetThe local start frames.
nframesThe number of frames to process.

◆ to_json

void to_json ( nlohmann::json & j,
const TrackProcessor & tp )
friend

Definition at line 214 of file track_processor.h.

Field Documentation

◆ cc_mappings_

std::unique_ptr<engine::session::MidiMappings> zrythm::structure::tracks::TrackProcessor::cc_mappings_

Mappings to each CC port.

Definition at line 341 of file track_processor.h.

◆ channel_pressure_ids_

std::unique_ptr<SixteenPortUuidArray> zrythm::structure::tracks::TrackProcessor::channel_pressure_ids_

Channel pressure (aftertouch).

This message is different from polyphonic after-touch - sends the single greatest pressure value (of all the current depressed keys).

Definition at line 370 of file track_processor.h.

◆ input_gain_id_

std::optional<dsp::ProcessorParameterUuidReference> zrythm::structure::tracks::TrackProcessor::input_gain_id_

Input gain, if audio.

Definition at line 288 of file track_processor.h.

◆ l_port_db_

float zrythm::structure::tracks::TrackProcessor::l_port_db_ = 0.0f

Current dBFS after processing each output port.

Transient variables only used by the GUI.

Definition at line 378 of file track_processor.h.

◆ midi_cc_ids_

std::unique_ptr<std::array<dsp::ProcessorParameterUuidReference, 16_zu * 128> > zrythm::structure::tracks::TrackProcessor::midi_cc_ids_

MIDI CC control ports, 16 channels x 128 controls.

Definition at line 345 of file track_processor.h.

◆ midi_in_id_

std::optional<dsp::PortUuidReference> zrythm::structure::tracks::TrackProcessor::midi_in_id_

MIDI in Port.

This port is for receiving MIDI signals from an external MIDI source.

This is also where piano roll, midi in and midi manual press will be routed to and this will be the port used to pass midi to the plugins.

Definition at line 311 of file track_processor.h.

◆ midi_out_id_

std::optional<dsp::PortUuidReference> zrythm::structure::tracks::TrackProcessor::midi_out_id_

MIDI out port, if MIDI.

Definition at line 316 of file track_processor.h.

◆ monitor_audio_id_

std::optional<dsp::ProcessorParameterUuidReference> zrythm::structure::tracks::TrackProcessor::monitor_audio_id_

Whether to monitor the audio output.

This is only used on audio tracks. During recording, if on, the recorded audio will be passed to the output. If off, the recorded audio will not be passed to the output.

When not recording, this will only take effect when paused.

Definition at line 336 of file track_processor.h.

◆ mono_id_

std::optional<dsp::ProcessorParameterUuidReference> zrythm::structure::tracks::TrackProcessor::mono_id_

Mono toggle, if audio.

Definition at line 285 of file track_processor.h.

◆ output_gain_id_

std::optional<dsp::ProcessorParameterUuidReference> zrythm::structure::tracks::TrackProcessor::output_gain_id_

Output gain, if audio.

This is applied after regions are processed to stereo_out_.

Definition at line 295 of file track_processor.h.

◆ param_registry_

dsp::ProcessorParameterRegistry& zrythm::structure::tracks::TrackProcessor::param_registry_

Definition at line 276 of file track_processor.h.

◆ pending_midi_panic_

bool zrythm::structure::tracks::TrackProcessor::pending_midi_panic_ = false

To be set to true when a panic (all notes off) message should be sent during processing.

Only applies to tracks that receive MIDI input.

Definition at line 390 of file track_processor.h.

◆ piano_roll_id_

std::optional<dsp::PortUuidReference> zrythm::structure::tracks::TrackProcessor::piano_roll_id_

MIDI input for receiving MIDI signals from the piano roll (i.e., MIDI notes inside regions) or other sources.

This will not be a separately exposed port during processing. It will be processed by the TrackProcessor internally.

Definition at line 325 of file track_processor.h.

◆ pitch_bend_ids_

std::unique_ptr<SixteenPortUuidArray> zrythm::structure::tracks::TrackProcessor::pitch_bend_ids_

Pitch bend x 16 channels.

Definition at line 351 of file track_processor.h.

◆ poly_key_pressure_ids_

std::unique_ptr<SixteenPortUuidArray> zrythm::structure::tracks::TrackProcessor::poly_key_pressure_ids_

Polyphonic key pressure (aftertouch).

This message is most often sent by pressing down on the key after it "bottoms out".

FIXME this is completely wrong. It's supposed to be per-key, so 128 x 16 ports.

Definition at line 362 of file track_processor.h.

◆ port_registry_

dsp::PortRegistry& zrythm::structure::tracks::TrackProcessor::port_registry_

Definition at line 275 of file track_processor.h.

◆ r_port_db_

float zrythm::structure::tracks::TrackProcessor::r_port_db_ = 0.0f

Definition at line 379 of file track_processor.h.

◆ stereo_in_left_id_

std::optional<dsp::PortUuidReference> zrythm::structure::tracks::TrackProcessor::stereo_in_left_id_

L & R audio input ports, if audio.

Definition at line 281 of file track_processor.h.

◆ stereo_in_right_id_

std::optional<dsp::PortUuidReference> zrythm::structure::tracks::TrackProcessor::stereo_in_right_id_

Definition at line 282 of file track_processor.h.

◆ stereo_out_left_id_

std::optional<dsp::PortUuidReference> zrythm::structure::tracks::TrackProcessor::stereo_out_left_id_

L & R audio output ports, if audio.

Definition at line 300 of file track_processor.h.

◆ stereo_out_right_id_

std::optional<dsp::PortUuidReference> zrythm::structure::tracks::TrackProcessor::stereo_out_right_id_

Definition at line 301 of file track_processor.h.

◆ track_

ProcessableTrack* zrythm::structure::tracks::TrackProcessor::track_ = nullptr

Pointer to owner track, if any.

Definition at line 382 of file track_processor.h.

◆ updated_midi_automatable_ports_

std::unique_ptr<MPMCQueue<dsp::ProcessorParameter *> > zrythm::structure::tracks::TrackProcessor::updated_midi_automatable_ports_

A queue of MIDI CC ports whose values have been recently updated.

This is used during processing to avoid checking every single MIDI CC port for changes.

Definition at line 399 of file track_processor.h.


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