|
Zrythm v2.0.0-alpha.1
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 | Capabilities : uint8_t { PianoRoll = 1 << 0 , AudioTrack = 1 << 1 , Recording = 1 << 2 } |
| enum class | MonitorMode : uint8_t { Off , On , Auto } |
| 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 | RecordingCallbackRT |
| 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::MidiEventBuffer &)> |
| 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, dsp::PortType signal_type, TrackNameProvider track_name_provider, EnabledProvider enabled_provider, Capabilities capabilities, utils::IObjectRegistry ®istry, 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, RecordingCallbackRT recording_cb=[](units::sample_t, const dsp::ITransport &, const dsp::MidiEventBuffer *, std::optional< ConstStereoPortPair >, units::sample_u32_t) { }, QObject *parent=nullptr) | |
| Creates a new track processor for the given track. | |
| 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 (dsp::graph::ProcessBlockInfo time_nfo, const dsp::ITransport &transport, const dsp::TempoMap &tempo_map) noexcept override |
| Process the TrackProcessor. | |
| void | custom_prepare_for_processing (const dsp::graph::GraphNode *node, units::sample_rate_t sample_rate, units::sample_u32_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_recording_param () const |
| bool | is_recording_armed () const |
| bool | is_recording_armed_rt () const noexcept |
| void | set_recording_armed (bool armed) |
| 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 clips) or other sources. | |
| dsp::MidiPort & | get_hw_midi_in_port () const |
| Hardware MIDI input port. | |
| arrangement::AudioTimelineDataProvider & | timeline_audio_data_provider () |
| arrangement::MidiTimelineDataProvider & | timeline_midi_data_provider () |
| ClipPlaybackDataProvider & | clip_playback_data_provider () |
| void | set_hw_midi_channel (int channel) |
| Sets the hardware MIDI input channel filter for this processor. | |
| 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 dsp::graph::ProcessBlockInfo &time_nfo, const dsp::ITransport &transport, dsp::MidiEventBuffer &midi_events) |
| Wrapper for MIDI/instrument/chord tracks to fill in MidiEvents from the timeline data. | |
| void | fill_audio_events (const dsp::graph::ProcessBlockInfo &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 (utils::IObjectRegistry ®istry, 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 |
| const ParameterChangeTracker & | change_tracker () const noexcept |
| Returns the change tracker. | |
| utils::Utf8String | get_node_name () const final |
| Returns a human friendly name of the node. | |
| void | process_block (dsp::graph::ProcessBlockInfo time_nfo, const dsp::ITransport &transport, const dsp::TempoMap &tempo_map) noexcept final |
| Calls custom_process_block() internally after processing all the parameters. | |
| void | prepare_for_processing_impl (const graph::GraphNode *node, units::sample_rate_t sample_rate, units::sample_u32_t max_block_length) final |
| void | release_resources () final |
| Called to release resources allocated by prepare_for_processing(). | |
| Public Member Functions inherited from zrythm::dsp::graph::IProcessable | |
| virtual units::sample_u32_t | get_single_playback_latency () const |
| Returns the latency of only the given processable, without adding the previous/next latencies (zero latency by default). | |
| void | prepare_for_processing (const GraphNode *node, units::sample_rate_t sample_rate, units::sample_u32_t max_block_length) |
| Called to allocate resources required for processing. | |
Static Public Attributes | |
| static constexpr auto | midi_in_symbol |
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 | registry () const -> utils::IObjectRegistry & |
A TrackProcessor is a standalone processor that is used as the first step when processing a track in the DSP graph.
Definition at line 29 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 80 of file track_processor.h.
| using zrythm::structure::tracks::TrackProcessor::ConstStereoPortPair |
Definition at line 38 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 97 of file track_processor.h.
Function called during processing to fill events.
For clips, a helper method is provided for filling events from a single clip. Implementations of this are supposed to call that for all their clips (including muted/disabled/etc.).
Definition at line 50 of file track_processor.h.
| using zrythm::structure::tracks::TrackProcessor::MidiEventProviderProcessFunc |
Definition at line 115 of file track_processor.h.
Callback to record the given audio or MIDI data.
| timeline_position | The absolute timeline position of this data. |
| transport | Transport state (for recording_enabled check). |
| midi_events | MIDI events that should be recorded, if any. |
| stereo_ports | Audio data that should be recorded, if any. |
Definition at line 64 of file track_processor.h.
| using zrythm::structure::tracks::TrackProcessor::StereoPortPair = std::pair<std::span<float>, std::span<float>> |
Definition at line 37 of file track_processor.h.
| using zrythm::structure::tracks::TrackProcessor::TrackNameProvider = std::function<utils::Utf8String ()> |
Definition at line 99 of file track_processor.h.
| using zrythm::structure::tracks::TrackProcessor::TransformMidiInputsFunc = std::function<void (dsp::MidiEventBuffer &)> |
Function to transform the given MIDI inputs.
This is used to, for example, change the channel of all events.
Definition at line 90 of file track_processor.h.
|
strong |
Definition at line 128 of file track_processor.h.
|
strong |
Definition at line 119 of file track_processor.h.
|
strong |
Definition at line 101 of file track_processor.h.
|
strong |
Definition at line 108 of file track_processor.h.
| zrythm::structure::tracks::TrackProcessor::TrackProcessor | ( | const dsp::TempoMap & | tempo_map, |
| dsp::PortType | signal_type, | ||
| TrackNameProvider | track_name_provider, | ||
| EnabledProvider | enabled_provider, | ||
| Capabilities | capabilities, | ||
| utils::IObjectRegistry & | registry, | ||
| 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, | ||
| RecordingCallbackRT | recording_cb = [](units::sample_t, const dsp::ITransport &, const dsp::MidiEventBuffer *, std::optional< ConstStereoPortPair >, units::sample_u32_t) { }, | ||
| QObject * | parent = nullptr ) |
Creates a new track processor for the given track.
| capabilities | Flags describing what features this processor supports. |
|
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 dsp::graph::ProcessBlockInfo & | 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 dsp::graph::ProcessBlockInfo & | time_nfo, |
| const dsp::ITransport & | transport, | ||
| dsp::MidiEventBuffer & | midi_events ) |
Wrapper for MIDI/instrument/chord tracks to fill in MidiEvents from the timeline data.
| midi_events | MidiEvents to fill. |
| dsp::MidiPort & zrythm::structure::tracks::TrackProcessor::get_hw_midi_in_port | ( | ) | const |
Hardware MIDI input port.
Receives MIDI events from MidiInputProcessor in the DSP graph. Channel filtering is applied during processing based on the hw_midi_channel_ setting.
|
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 229 of file track_processor.h.
|
inline |
MIDI out port, if MIDI.
Definition at line 238 of file track_processor.h.
| dsp::MidiPort & zrythm::structure::tracks::TrackProcessor::get_piano_roll_port | ( | ) | const |
MIDI input for receiving MIDI signals from the piano roll (i.e., MIDI notes inside clips) or other sources.
This bypasses any MIDI transformations by transform_midi_inputs_func_.
|
inline |
Definition at line 200 of file track_processor.h.
|
inline |
Definition at line 205 of file track_processor.h.
|
inline |
Definition at line 163 of file track_processor.h.
|
inlineconstexpr |
Definition at line 165 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.
| void zrythm::structure::tracks::TrackProcessor::set_hw_midi_channel | ( | int | channel | ) |
Sets the hardware MIDI input channel filter for this processor.
Called from the main thread when the user changes the MIDI input channel for this track. The value is stored in a realtime-safe container and read during audio processing to filter incoming hardware MIDI events.
0 = omni (all channels pass), 1-16 = specific channel.
| 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.
|
staticconstexpr |
Definition at line 40 of file track_processor.h.