|
Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
|
A TrackProcessor is a standalone processor that is used as the first step when processing a track in the DSP graph. More...
#include <src/structure/tracks/track_processor.h>


Public Types | |
| enum class | ActiveMidiEventProviders : uint8_t { Timeline = 1 << 0 , ClipLauncher = 1 << 1 , PianoRoll = 1 << 2 , Recording = 1 << 3 , Custom = 1 << 4 } |
| enum class | ActiveAudioProviders : uint8_t { Timeline = 1 << 0 , ClipLauncher = 1 << 1 , Recording = 1 << 2 , Custom = 1 << 3 } |
| using | StereoPortPair = std::pair<std::span<float>, std::span<float>> |
| using | ConstStereoPortPair |
| using | FillEventsCallback |
| Function called during processing to fill events. | |
| using | HandleRecordingCallback |
| Callback to record the given audio or MIDI data. | |
| using | AppendMidiInputsToOutputsFunc |
| Custom logic to use when appending the MIDI input events to the output events. | |
| using | TransformMidiInputsFunc = std::function<void (dsp::MidiEventVector &)> |
| Function to transform the given MIDI inputs. | |
| using | EnabledProvider = std::function<bool ()> |
| Function that returns if the track for this processor is enabled. | |
| using | TrackNameProvider = std::function<utils::Utf8String ()> |
| using | MidiEventProviderProcessFunc |
Public Member Functions | |
| TrackProcessor (const dsp::TempoMap &tempo_map, PortType signal_type, TrackNameProvider track_name_provider, EnabledProvider enabled_provider, bool generates_midi_events, bool has_midi_cc, bool is_audio_track, ProcessorBaseDependencies dependencies, std::optional< FillEventsCallback > fill_events_cb=std::nullopt, std::optional< TransformMidiInputsFunc > transform_midi_inputs_func=std::nullopt, std::optional< AppendMidiInputsToOutputsFunc > append_midi_inputs_to_outputs_func=std::nullopt, QObject *parent=nullptr) | |
| Creates a new track processor for the given track. | |
| void | set_handle_recording_callback (HandleRecordingCallback handle_rec_cb) |
| bool | is_audio () const |
| constexpr bool | is_midi () const |
| utils::Utf8String | get_full_designation_for_port (const dsp::Port &port) const |
| void | custom_process_block (EngineProcessTimeInfo time_nfo, const dsp::ITransport &transport) noexcept override |
| Process the TrackProcessor. | |
| void | custom_prepare_for_processing (const dsp::graph::GraphNode *node, units::sample_rate_t sample_rate, nframes_t max_block_length) override |
| void | custom_release_resources () override |
| dsp::AudioPort & | get_stereo_in_port () const |
| dsp::AudioPort & | get_stereo_out_port () const |
| dsp::ProcessorParameter & | get_mono_param () const |
| dsp::ProcessorParameter & | get_input_gain_param () const |
| dsp::ProcessorParameter & | get_output_gain_param () const |
| dsp::ProcessorParameter & | get_monitor_audio_param () const |
| dsp::ProcessorParameter & | get_midi_cc_param (midi_byte_t channel, midi_byte_t control_no) |
| dsp::MidiPort & | get_midi_in_port () const |
| MIDI in Port. | |
| dsp::MidiPort & | get_midi_out_port () const |
| MIDI out port, if MIDI. | |
| dsp::MidiPort & | get_piano_roll_port () const |
| MIDI input for receiving MIDI signals from the piano roll (i.e., MIDI notes inside regions) or other sources. | |
| auto & | timeline_audio_data_provider () |
| auto & | timeline_midi_data_provider () |
| auto & | clip_playback_data_provider () |
| void | set_midi_providers_active (ActiveMidiEventProviders event_providers, bool active) |
| Used to enable or disable MIDI event providers. | |
| void | set_audio_providers_active (ActiveAudioProviders audio_providers, bool active) |
| Used to enable or disable audio providers. | |
| void | set_custom_midi_event_provider (MidiEventProviderProcessFunc process_func) |
| Replaces the "Custom" MIDI event provider. | |
| void | fill_midi_events (const EngineProcessTimeInfo &time_nfo, const dsp::ITransport &transport, dsp::MidiEventVector &midi_events) |
| Wrapper for MIDI/instrument/chord tracks to fill in MidiEvents from the timeline data. | |
| void | fill_audio_events (const EngineProcessTimeInfo &time_nfo, const dsp::ITransport &transport, StereoPortPair stereo_ports) |
| Wrapper for audio tracks to fill in StereoPorts from the timeline data. | |
| Public Member Functions inherited from zrythm::dsp::ProcessorBase | |
| ProcessorBase (ProcessorBaseDependencies dependencies, utils::Utf8String name={ u8"ProcessorBase" }) | |
| void | set_name (const utils::Utf8String &name) |
| Set a custom name to be used in the DSP graph. | |
| void | add_input_port (const dsp::PortUuidReference &uuid) |
| void | add_output_port (const dsp::PortUuidReference &uuid) |
| void | add_parameter (const dsp::ProcessorParameterUuidReference &uuid) |
| auto & | get_input_ports () const |
| auto & | get_output_ports () const |
| auto & | get_parameters () const |
| utils::Utf8String | get_node_name () const final |
| Returns a human friendly name of the node. | |
| void | process_block (EngineProcessTimeInfo time_nfo, const dsp::ITransport &transport) noexcept final |
| Calls custom_process_block() internally after processing all the parameters. | |
| void | prepare_for_processing (const graph::GraphNode *node, units::sample_rate_t sample_rate, nframes_t max_block_length) final |
| Called to allocate resources required for processing. | |
| void | release_resources () final |
| Called to release resources allocated by prepare_for_processing(). | |
| Public Member Functions inherited from zrythm::dsp::graph::IProcessable | |
| virtual nframes_t | get_single_playback_latency () const |
| Returns the latency of only the given processable, without adding the previous/next latencies. | |
Friends | |
| void | to_json (nlohmann::json &j, const TrackProcessor &tp) |
| void | from_json (const nlohmann::json &j, TrackProcessor &tp) |
| void | init_from (TrackProcessor &obj, const TrackProcessor &other, utils::ObjectCloneType clone_type) |
Additional Inherited Members | |
| Protected Member Functions inherited from zrythm::dsp::ProcessorBase | |
| auto | dependencies () const |
A TrackProcessor is a standalone processor that is used as the first step when processing a track in the DSP graph.
Definition at line 25 of file track_processor.h.
Custom logic to use when appending the MIDI input events to the output events.
If not explicitly set, this will simply copy the events over.
Mainly used by ChordTrack to transform input MIDI notes into multiple output notes that match the chord.
Definition at line 85 of file track_processor.h.
| using zrythm::structure::tracks::TrackProcessor::ConstStereoPortPair |
Definition at line 49 of file track_processor.h.
| using zrythm::structure::tracks::TrackProcessor::EnabledProvider = std::function<bool ()> |
Function that returns if the track for this processor is enabled.
Used to conditionally skip processing if disabled.
Definition at line 102 of file track_processor.h.
Function called during processing to fill events.
For regions, a helper method is provided for filling events from a single region. Implementations of this are supposed to call that for all their regions (including muted/disabled/etc.).
Definition at line 59 of file track_processor.h.
Callback to record the given audio or MIDI data.
| midi_events | MIDI events that should be recorded, if any. |
| stereo_ports | Audio data that should be recorded, if any. |
Definition at line 71 of file track_processor.h.
| using zrythm::structure::tracks::TrackProcessor::MidiEventProviderProcessFunc |
Definition at line 106 of file track_processor.h.
| using zrythm::structure::tracks::TrackProcessor::StereoPortPair = std::pair<std::span<float>, std::span<float>> |
Definition at line 48 of file track_processor.h.
| using zrythm::structure::tracks::TrackProcessor::TrackNameProvider = std::function<utils::Utf8String ()> |
Definition at line 104 of file track_processor.h.
| using zrythm::structure::tracks::TrackProcessor::TransformMidiInputsFunc = std::function<void (dsp::MidiEventVector &)> |
Function to transform the given MIDI inputs.
This is used to, for example, change the channel of all events.
Definition at line 95 of file track_processor.h.
|
strong |
Definition at line 119 of file track_processor.h.
|
strong |
Definition at line 110 of file track_processor.h.
| zrythm::structure::tracks::TrackProcessor::TrackProcessor | ( | const dsp::TempoMap & | tempo_map, |
| PortType | signal_type, | ||
| TrackNameProvider | track_name_provider, | ||
| EnabledProvider | enabled_provider, | ||
| bool | generates_midi_events, | ||
| bool | has_midi_cc, | ||
| bool | is_audio_track, | ||
| ProcessorBaseDependencies | dependencies, | ||
| std::optional< FillEventsCallback > | fill_events_cb = std::nullopt, | ||
| std::optional< TransformMidiInputsFunc > | transform_midi_inputs_func = std::nullopt, | ||
| std::optional< AppendMidiInputsToOutputsFunc > | append_midi_inputs_to_outputs_func = std::nullopt, | ||
| QObject * | parent = nullptr ) |
Creates a new track processor for the given track.
| generates_midi_events | Whether this processor requires a "piano roll" port to generate MIDI events into (midi, instrument and chord tracks should set this to true). |
|
inline |
Definition at line 279 of file track_processor.h.
|
overridevirtual |
Reimplemented from zrythm::dsp::ProcessorBase.
|
overridevirtualnoexcept |
Process the TrackProcessor.
This function performs the following:
Reimplemented from zrythm::dsp::ProcessorBase.
|
overridevirtual |
Reimplemented from zrythm::dsp::ProcessorBase.
| void zrythm::structure::tracks::TrackProcessor::fill_audio_events | ( | const EngineProcessTimeInfo & | time_nfo, |
| const dsp::ITransport & | transport, | ||
| StereoPortPair | stereo_ports ) |
Wrapper for audio tracks to fill in StereoPorts from the timeline data.
| stereo_ports | StereoPorts to fill. |
| void zrythm::structure::tracks::TrackProcessor::fill_midi_events | ( | const EngineProcessTimeInfo & | time_nfo, |
| const dsp::ITransport & | transport, | ||
| dsp::MidiEventVector & | midi_events ) |
Wrapper for MIDI/instrument/chord tracks to fill in MidiEvents from the timeline data.
| midi_events | MidiEvents to fill. |
|
inline |
Definition at line 208 of file track_processor.h.
|
inline |
| channel | Channel (0-15) |
| control_no | Control (0-127) |
Definition at line 231 of file track_processor.h.
|
inline |
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 247 of file track_processor.h.
|
inline |
MIDI out port, if MIDI.
Definition at line 256 of file track_processor.h.
|
inline |
Definition at line 218 of file track_processor.h.
|
inline |
Definition at line 203 of file track_processor.h.
|
inline |
Definition at line 213 of file track_processor.h.
|
inline |
MIDI input for receiving MIDI signals from the piano roll (i.e., MIDI notes inside regions) or other sources.
This bypasses any MIDI transformations by transform_midi_inputs_func_.
Definition at line 268 of file track_processor.h.
|
inline |
Definition at line 192 of file track_processor.h.
|
inline |
Definition at line 197 of file track_processor.h.
|
inline |
Definition at line 156 of file track_processor.h.
|
inlineconstexpr |
Definition at line 158 of file track_processor.h.
| void zrythm::structure::tracks::TrackProcessor::set_audio_providers_active | ( | ActiveAudioProviders | audio_providers, |
| bool | active ) |
Used to enable or disable audio providers.
For example, when a clip is launched this should be called once to disable the timeline and once more to enable the clip provider.
|
inline |
Definition at line 151 of file track_processor.h.
| void zrythm::structure::tracks::TrackProcessor::set_midi_providers_active | ( | ActiveMidiEventProviders | event_providers, |
| bool | active ) |
Used to enable or disable MIDI event providers.
For example, when a clip is launched this should be called once to disable the timeline and once more to enable the clip provider.
|
inline |
Definition at line 273 of file track_processor.h.
|
inline |
Definition at line 277 of file track_processor.h.
|
friend |
Definition at line 338 of file track_processor.h.