|
Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
|
A TrackProcessor is a processor that is used as the first entry point when processing a track. More...
#include <src/gui/dsp/track_processor.h>


Public Types | |
| using | SixteenPortUuidArray = std::array<PortUuidReference, 16> |
Public Types inherited from IPortOwner | |
| using | TrackUuid = dsp::PortIdentifier::TrackUuid |
| using | PluginUuid = dsp::PortIdentifier::PluginUuid |
| using | PortUuid = dsp::PortIdentifier::PortUuid |
Public Member Functions | |
| TrackProcessor (ProcessableTrack &track, PortRegistry &port_registry, bool new_identity) | |
| Creates a new track processor for the given track. | |
| bool | is_in_active_project () const override |
| bool | is_audio () const |
| bool | is_midi () const |
| void | set_port_metadata_from_owner (dsp::PortIdentifier &id, PortRange &range) const override |
| Function that will be called by the Port to update the identifier's relevant members based on this port owner. | |
| void | on_control_change_event (const dsp::PortIdentifier::PortUuid &port_uuid, const dsp::PortIdentifier &id, float value) override |
| Will be called when a control port's value changes. | |
| utils::Utf8String | get_full_designation_for_port (const dsp::PortIdentifier &id) const override |
| bool | should_sum_data_from_backend () const override |
| Whether during processing, the port should sum the data from its backend buffers coming in. | |
| bool | should_bounce_to_master (utils::audio::BounceStep step) const override |
| Whether the port should add its data to the master output when bouncing. | |
| bool | are_events_on_midi_channel_approved (midi_byte_t channel) const override |
| Returns whether MIDI events on this channel on an input port should be processed (not ignored). | |
| void | on_midi_activity (const dsp::PortIdentifier &id) override |
| Called during processing if the MIDI port contains new MIDI events. | |
| dsp::PortConnectionsManager * | get_port_connections_manager () const |
| ProcessableTrack * | get_track () const |
| void | init_loaded (ProcessableTrack *track, PortRegistry &port_registry) |
| Inits a TrackProcessor after a project is loaded. | |
| void | clear_buffers (std::size_t block_length) |
| Clears all buffers. | |
| void | disconnect_all () |
| Disconnects all ports connected to the TrackProcessor. | |
| 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< Port * > &ports) |
| void | init_after_cloning (const TrackProcessor &other, ObjectCloneType clone_type) override |
| Initializes the cloned object. | |
| std::pair< AudioPort &, AudioPort & > | get_stereo_in_ports () const |
| std::pair< AudioPort &, AudioPort & > | get_stereo_out_ports () const |
| ControlPort & | get_mono_port () const |
| ControlPort & | get_input_gain_port () const |
| ControlPort & | get_output_gain_port () const |
| ControlPort & | get_monitor_audio_port () const |
| MidiPort & | get_midi_in_port () const |
| MidiPort & | get_midi_out_port () const |
| MidiPort & | get_piano_roll_port () const |
| ControlPort & | get_midi_cc_port (int channel_index, int cc_index) const |
| ControlPort & | get_pitch_bend_port (int channel_index) const |
| ControlPort & | get_poly_key_pressure_port (int channel_index) const |
| ControlPort & | get_channel_pressure_port (int channel_index) const |
Public Member Functions inherited from ICloneable< TrackProcessor > | |
| std::unique_ptr< TrackProcessor > | clone_unique (ObjectCloneType clone_type=ObjectCloneType::Snapshot, Args &&... args) const |
| std::shared_ptr< TrackProcessor > | clone_shared (ObjectCloneType clone_type=ObjectCloneType::Snapshot, Args &&... args) const |
| TrackProcessor * | clone_raw_ptr (ObjectCloneType clone_type=ObjectCloneType::Snapshot, Args &&... args) const |
| TrackProcessor * | clone_qobject (QObject *parent, ObjectCloneType clone_type=ObjectCloneType::Snapshot, Args &&... args) const |
| QScopedPointer< TrackProcessor > | clone_unique_qobject (QObject *parent, ObjectCloneType clone_type=ObjectCloneType::Snapshot, Args &&... args) const |
Data Fields | |
| PortRegistry & | port_registry_ |
| std::optional< PortUuidReference > | stereo_in_left_id_ |
| L & R audio input ports, if audio. | |
| std::optional< PortUuidReference > | stereo_in_right_id_ |
| std::optional< PortUuidReference > | mono_id_ |
| Mono toggle, if audio. | |
| std::optional< PortUuidReference > | input_gain_id_ |
| Input gain, if audio. | |
| std::optional< PortUuidReference > | output_gain_id_ |
| Output gain, if audio. | |
| std::optional< PortUuidReference > | stereo_out_left_id_ |
| L & R audio output ports, if audio. | |
| std::optional< PortUuidReference > | stereo_out_right_id_ |
| std::optional< PortUuidReference > | midi_in_id_ |
| MIDI in Port. | |
| std::optional< PortUuidReference > | midi_out_id_ |
| MIDI out port, if MIDI. | |
| std::optional< PortUuidReference > | piano_roll_id_ |
| MIDI input for receiving MIDI signals from the piano roll (i.e., MIDI notes inside regions) or other sources. | |
| std::optional< PortUuidReference > | monitor_audio_id_ |
| Whether to monitor the audio output. | |
| std::unique_ptr< MidiMappings > | cc_mappings_ |
| Mappings to each CC port. | |
| std::unique_ptr< std::array< PortUuidReference, 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 |
| ProcessableTrack * | track_ = 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< ControlPort * > > | updated_midi_automatable_ports_ |
| A queue of MIDI CC ports whose values have been recently updated. | |
Data Fields inherited from ICloneable< TrackProcessor > | |
| friend | Derived |
Friends | |
| void | to_json (nlohmann::json &j, const TrackProcessor &tp) |
| void | from_json (const nlohmann::json &j, TrackProcessor &tp) |
A TrackProcessor is a processor that is used as the first entry point when processing a track.
Definition at line 33 of file track_processor.h.
| using TrackProcessor::SixteenPortUuidArray = std::array<PortUuidReference, 16> |
Definition at line 396 of file track_processor.h.
|
overridevirtual |
Returns whether MIDI events on this channel on an input port should be processed (not ignored).
This is used to implement MIDI channel filtering in tracks that have piano rolls based on the enabled MIDI channels.
Reimplemented from IPortOwner.
| void 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.
| void TrackProcessor::disconnect_from_prefader | ( | ) |
Disconnect the TrackProcessor's stereo out ports from the prefader.
Used when there is no plugin in the channel.
|
inline |
Definition at line 222 of file track_processor.h.
|
overridevirtual |
Reimplemented from IPortOwner.
|
inline |
Definition at line 179 of file track_processor.h.
|
inline |
Definition at line 203 of file track_processor.h.
|
inline |
Definition at line 191 of file track_processor.h.
|
inline |
Definition at line 195 of file track_processor.h.
|
inline |
Definition at line 187 of file track_processor.h.
|
inline |
Definition at line 175 of file track_processor.h.
|
inline |
Definition at line 183 of file track_processor.h.
|
inline |
Definition at line 199 of file track_processor.h.
|
inline |
Definition at line 210 of file track_processor.h.
|
inline |
Definition at line 215 of file track_processor.h.
Definition at line 154 of file track_processor.h.
Definition at line 164 of file track_processor.h.
|
inline |
Definition at line 75 of file track_processor.h.
|
overridevirtual |
Initializes the cloned object.
| ZrythmException | If the object could not be cloned. |
Implements ICloneable< TrackProcessor >.
|
overridevirtual |
Implements IPortOwner.
|
overridevirtual |
Will be called when a control port's value changes.
| val | The real value of the control port. |
Reimplemented from IPortOwner.
|
overridevirtual |
Called during processing if the MIDI port contains new MIDI events.
Reimplemented from IPortOwner.
| void TrackProcessor::process | ( | const EngineProcessTimeInfo & | time_nfo | ) |
Process the TrackProcessor.
This function performs the following:
| g_start_frames | The global start frames. |
| local_offset | The local start frames. |
| nframes | The number of frames to process. |
|
overridevirtual |
Function that will be called by the Port to update the identifier's relevant members based on this port owner.
| id | The identifier to update. |
Implements IPortOwner.
|
overridevirtual |
Whether the port should add its data to the master output when bouncing.
When bouncing a track directly to master (e.g., when bouncing the track on its own without parents), the buffer should be added to the master track output.
This is only utilized for stereo output audio ports.
Reimplemented from IPortOwner.
|
overridevirtual |
Whether during processing, the port should sum the data from its backend buffers coming in.
If this is a TrackProcessor input port for a recordable track, this should only return true when currently armed recording. Otherwise, we always consider incoming external data.
Reimplemented from IPortOwner.
|
friend |
Definition at line 266 of file track_processor.h.
|
friend |
Definition at line 246 of file track_processor.h.
| std::unique_ptr<MidiMappings> TrackProcessor::cc_mappings_ |
Mappings to each CC port.
Definition at line 391 of file track_processor.h.
| std::unique_ptr<SixteenPortUuidArray> 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 418 of file track_processor.h.
| std::optional<PortUuidReference> TrackProcessor::input_gain_id_ |
Input gain, if audio.
Definition at line 338 of file track_processor.h.
| float TrackProcessor::l_port_db_ = 0.0f |
Current dBFS after processing each output port.
Transient variables only used by the GUI.
Definition at line 426 of file track_processor.h.
| std::unique_ptr<std::array<PortUuidReference, 16_zu * 128> > TrackProcessor::midi_cc_ids_ |
MIDI CC control ports, 16 channels x 128 controls.
Definition at line 394 of file track_processor.h.
| std::optional<PortUuidReference> 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 361 of file track_processor.h.
| std::optional<PortUuidReference> TrackProcessor::midi_out_id_ |
MIDI out port, if MIDI.
Definition at line 366 of file track_processor.h.
| std::optional<PortUuidReference> 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 386 of file track_processor.h.
| std::optional<PortUuidReference> TrackProcessor::mono_id_ |
Mono toggle, if audio.
Definition at line 335 of file track_processor.h.
| std::optional<PortUuidReference> TrackProcessor::output_gain_id_ |
Output gain, if audio.
This is applied after regions are processed to stereo_out_.
Definition at line 345 of file track_processor.h.
| bool 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 438 of file track_processor.h.
| std::optional<PortUuidReference> 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 375 of file track_processor.h.
| std::unique_ptr<SixteenPortUuidArray> TrackProcessor::pitch_bend_ids_ |
Pitch bend x 16 channels.
Definition at line 399 of file track_processor.h.
| std::unique_ptr<SixteenPortUuidArray> 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 410 of file track_processor.h.
| PortRegistry& TrackProcessor::port_registry_ |
Definition at line 326 of file track_processor.h.
| float TrackProcessor::r_port_db_ = 0.0f |
Definition at line 427 of file track_processor.h.
| std::optional<PortUuidReference> TrackProcessor::stereo_in_left_id_ |
L & R audio input ports, if audio.
Definition at line 331 of file track_processor.h.
| std::optional<PortUuidReference> TrackProcessor::stereo_in_right_id_ |
Definition at line 332 of file track_processor.h.
| std::optional<PortUuidReference> TrackProcessor::stereo_out_left_id_ |
L & R audio output ports, if audio.
Definition at line 350 of file track_processor.h.
| std::optional<PortUuidReference> TrackProcessor::stereo_out_right_id_ |
Definition at line 351 of file track_processor.h.
| ProcessableTrack* TrackProcessor::track_ = nullptr |
Pointer to owner track, if any.
Definition at line 430 of file track_processor.h.
| std::unique_ptr<MPMCQueue<ControlPort *> > 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 446 of file track_processor.h.