Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
zrythm::dsp::Fader Class Reference

A Fader is a processor that is used for volume controls and pan. More...

#include <src/dsp/fader.h>

Inheritance diagram for zrythm::dsp::Fader:
Collaboration diagram for zrythm::dsp::Fader:

Public Types

enum class  MidiFaderMode : uint8_t { MIDI_FADER_MODE_VEL_MULTIPLIER , MIDI_FADER_MODE_CC_VOLUME }
using ShouldBeMutedCallback = std::function<bool (bool fader_solo_status)>
 A callback to check if the fader should be muted based on various external factors (such as solo status of other tracks).
using MuteGainCallback = std::function<float ()>
 Callback to get the gain that should be used if the fader is effectively muted.
using PreProcessAudioCallback
 Callback to pre-process the incoming audio before applying gain, pan, etc.

Public Member Functions

 Fader (dsp::ProcessorBase::ProcessorBaseDependencies dependencies, dsp::PortType signal_type, bool hard_limit_output, bool make_params_automatable, std::optional< std::function< utils::Utf8String()> > owner_name_provider, ShouldBeMutedCallback should_be_muted_cb, QObject *parent=nullptr)
 Creates a new fader.
MidiFaderMode midiMode () const
void setMidiMode (MidiFaderMode mode)
Q_SIGNAL void midiModeChanged (MidiFaderMode mode)
zrythm::dsp::ProcessorParametergain () const
zrythm::dsp::ProcessorParameterbalance () const
zrythm::dsp::ProcessorParametermute () const
zrythm::dsp::ProcessorParametersolo () const
zrythm::dsp::ProcessorParameterlisten () const
zrythm::dsp::ProcessorParametermonoToggle () const
zrythm::dsp::ProcessorParameterswapPhaseToggle () const
bool currently_muted () const
 Returns if the fader is muted.
bool currently_soloed () const
 Returns if the track is soloed.
bool currently_listened () const
 Returns whether the fader is listened.
float get_current_amp () const
 Gets the fader amplitude (not db).
std::string db_string_getter () const
void set_mute_gain_callback (MuteGainCallback cb)
void set_preprocess_audio_callback (PreProcessAudioCallback cb)
void custom_prepare_for_processing (const graph::GraphNode *node, units::sample_rate_t sample_rate, units::sample_u32_t max_block_length) override
void custom_release_resources () override
void custom_process_block (dsp::graph::EngineProcessTimeInfo time_nfo, const dsp::ITransport &transport, const dsp::TempoMap &tempo_map) noexcept override
 Custom processor logic after processing all owned parameters.
bool is_audio () const
bool is_midi () const
bool hard_limiting_enabled () const
dsp::ProcessorParameterget_amp_param () const
dsp::ProcessorParameterget_balance_param () const
dsp::ProcessorParameterget_mute_param () const
dsp::ProcessorParameterget_solo_param () const
dsp::ProcessorParameterget_listen_param () const
dsp::ProcessorParameterget_mono_compat_enabled_param () const
dsp::ProcessorParameterget_swap_phase_param () const
dsp::AudioPortget_stereo_in_port () const
dsp::AudioPortget_stereo_out_port () const
dsp::MidiPortget_midi_in_port () const
dsp::MidiPortget_midi_out_port () const
auto currently_soloed_rt () const noexcept
bool currently_listened_rt () const noexcept
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
const ParameterChangeTrackerchange_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::EngineProcessTimeInfo 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 (const graph::GraphNode *node, units::sample_rate_t sample_rate, units::sample_u32_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 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).

Properties

MidiFaderMode midiMode
zrythm::dsp::ProcessorParametergain
zrythm::dsp::ProcessorParameterbalance
zrythm::dsp::ProcessorParametermute
zrythm::dsp::ProcessorParametersolo
zrythm::dsp::ProcessorParameterlisten
zrythm::dsp::ProcessorParametermonoToggle
zrythm::dsp::ProcessorParameterswapPhaseToggle

Friends

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

Additional Inherited Members

Protected Member Functions inherited from zrythm::dsp::ProcessorBase
auto dependencies () const

Detailed Description

A Fader is a processor that is used for volume controls and pan.

Definition at line 14 of file fader.h.

Member Typedef Documentation

◆ MuteGainCallback

using zrythm::dsp::Fader::MuteGainCallback = std::function<float ()>

Callback to get the gain that should be used if the fader is effectively muted.

Definition at line 71 of file fader.h.

◆ PreProcessAudioCallback

Initial value:
std::function<void (
std::pair<std::span<float>, std::span<float>> stereo_bufs,
Common struct to pass around during processing to avoid repeating the data in function arguments.
Definition graph_node.h:51

Callback to pre-process the incoming audio before applying gain, pan, etc.

Mainly for use by the monitor fader.

Definition at line 79 of file fader.h.

◆ ShouldBeMutedCallback

using zrythm::dsp::Fader::ShouldBeMutedCallback = std::function<bool (bool fader_solo_status)>

A callback to check if the fader should be muted based on various external factors (such as solo status of other tracks).

Note
If the fader itself is muted this will not be called - fader is assumed to be muted.
Parameters
current_solo_statusThe fader's own solo status.

Definition at line 65 of file fader.h.

Member Enumeration Documentation

◆ MidiFaderMode

enum class zrythm::dsp::Fader::MidiFaderMode : uint8_t
strong
Enumerator
MIDI_FADER_MODE_VEL_MULTIPLIER 

Multiply velocity of all MIDI note ons.

MIDI_FADER_MODE_CC_VOLUME 

Send CC volume event on change TODO.

Definition at line 45 of file fader.h.

Constructor & Destructor Documentation

◆ Fader()

zrythm::dsp::Fader::Fader ( dsp::ProcessorBase::ProcessorBaseDependencies dependencies,
dsp::PortType signal_type,
bool hard_limit_output,
bool make_params_automatable,
std::optional< std::function< utils::Utf8String()> > owner_name_provider,
ShouldBeMutedCallback should_be_muted_cb,
QObject * parent = nullptr )

Creates a new fader.

Parameters
hard_limit_outputWhether the output should be hard-limited (only applies to audio faders). This should be true for the master track fader, the monitor fader and the sample processor (deprecated?) fader.
make_params_automatableWhether to make (a subset of) the parameters automatable. If false, no parameter will be automatable.

Member Function Documentation

◆ balance()

zrythm::dsp::ProcessorParameter * zrythm::dsp::Fader::balance ( ) const
inline

Definition at line 124 of file fader.h.

◆ currently_listened()

bool zrythm::dsp::Fader::currently_listened ( ) const
inline

Returns whether the fader is listened.

Definition at line 196 of file fader.h.

◆ currently_listened_rt()

bool zrythm::dsp::Fader::currently_listened_rt ( ) const
inlinenoexcept

Definition at line 316 of file fader.h.

◆ currently_muted()

bool zrythm::dsp::Fader::currently_muted ( ) const
inline

Returns if the fader is muted.

Definition at line 178 of file fader.h.

◆ currently_soloed()

bool zrythm::dsp::Fader::currently_soloed ( ) const
inline

Returns if the track is soloed.

Definition at line 187 of file fader.h.

◆ currently_soloed_rt()

auto zrythm::dsp::Fader::currently_soloed_rt ( ) const
inlinenoexcept

Definition at line 310 of file fader.h.

◆ custom_prepare_for_processing()

void zrythm::dsp::Fader::custom_prepare_for_processing ( const graph::GraphNode * node,
units::sample_rate_t sample_rate,
units::sample_u32_t max_block_length )
overridevirtual

Reimplemented from zrythm::dsp::ProcessorBase.

◆ custom_process_block()

void zrythm::dsp::Fader::custom_process_block ( dsp::graph::EngineProcessTimeInfo time_nfo,
const dsp::ITransport & transport,
const dsp::TempoMap & tempo_map )
overridevirtualnoexcept

Custom processor logic after processing all owned parameters.

By default, this does passthrough to same-type ports.

Reimplemented from zrythm::dsp::ProcessorBase.

◆ custom_release_resources()

void zrythm::dsp::Fader::custom_release_resources ( )
overridevirtual

Reimplemented from zrythm::dsp::ProcessorBase.

◆ gain()

zrythm::dsp::ProcessorParameter * zrythm::dsp::Fader::gain ( ) const
inline

Definition at line 116 of file fader.h.

◆ get_amp_param()

dsp::ProcessorParameter & zrythm::dsp::Fader::get_amp_param ( ) const
inline

Definition at line 249 of file fader.h.

◆ get_balance_param()

dsp::ProcessorParameter & zrythm::dsp::Fader::get_balance_param ( ) const
inline

Definition at line 254 of file fader.h.

◆ get_current_amp()

float zrythm::dsp::Fader::get_current_amp ( ) const
inline

Gets the fader amplitude (not db).

Definition at line 205 of file fader.h.

◆ get_listen_param()

dsp::ProcessorParameter & zrythm::dsp::Fader::get_listen_param ( ) const
inline

Definition at line 269 of file fader.h.

◆ get_midi_in_port()

dsp::MidiPort & zrythm::dsp::Fader::get_midi_in_port ( ) const
inline

Definition at line 301 of file fader.h.

◆ get_midi_out_port()

dsp::MidiPort & zrythm::dsp::Fader::get_midi_out_port ( ) const
inline

Definition at line 305 of file fader.h.

◆ get_mono_compat_enabled_param()

dsp::ProcessorParameter & zrythm::dsp::Fader::get_mono_compat_enabled_param ( ) const
inline

Definition at line 274 of file fader.h.

◆ get_mute_param()

dsp::ProcessorParameter & zrythm::dsp::Fader::get_mute_param ( ) const
inline

Definition at line 259 of file fader.h.

◆ get_solo_param()

dsp::ProcessorParameter & zrythm::dsp::Fader::get_solo_param ( ) const
inline

Definition at line 264 of file fader.h.

◆ get_stereo_in_port()

dsp::AudioPort & zrythm::dsp::Fader::get_stereo_in_port ( ) const
inline

Definition at line 285 of file fader.h.

◆ get_stereo_out_port()

dsp::AudioPort & zrythm::dsp::Fader::get_stereo_out_port ( ) const
inline

Definition at line 293 of file fader.h.

◆ get_swap_phase_param()

dsp::ProcessorParameter & zrythm::dsp::Fader::get_swap_phase_param ( ) const
inline

Definition at line 280 of file fader.h.

◆ hard_limiting_enabled()

bool zrythm::dsp::Fader::hard_limiting_enabled ( ) const
inline

Definition at line 244 of file fader.h.

◆ is_audio()

bool zrythm::dsp::Fader::is_audio ( ) const
inline

Definition at line 241 of file fader.h.

◆ is_midi()

bool zrythm::dsp::Fader::is_midi ( ) const
inline

Definition at line 242 of file fader.h.

◆ listen()

zrythm::dsp::ProcessorParameter * zrythm::dsp::Fader::listen ( ) const
inline

Definition at line 148 of file fader.h.

◆ midiMode()

MidiFaderMode zrythm::dsp::Fader::midiMode ( ) const
inline

Definition at line 105 of file fader.h.

◆ monoToggle()

zrythm::dsp::ProcessorParameter * zrythm::dsp::Fader::monoToggle ( ) const
inline

Definition at line 156 of file fader.h.

◆ mute()

zrythm::dsp::ProcessorParameter * zrythm::dsp::Fader::mute ( ) const
inline

Definition at line 132 of file fader.h.

◆ set_mute_gain_callback()

void zrythm::dsp::Fader::set_mute_gain_callback ( MuteGainCallback cb)
inline

Definition at line 213 of file fader.h.

◆ set_preprocess_audio_callback()

void zrythm::dsp::Fader::set_preprocess_audio_callback ( PreProcessAudioCallback cb)
inline

Definition at line 218 of file fader.h.

◆ setMidiMode()

void zrythm::dsp::Fader::setMidiMode ( MidiFaderMode mode)
inline

Definition at line 106 of file fader.h.

◆ solo()

zrythm::dsp::ProcessorParameter * zrythm::dsp::Fader::solo ( ) const
inline

Definition at line 140 of file fader.h.

◆ swapPhaseToggle()

zrythm::dsp::ProcessorParameter * zrythm::dsp::Fader::swapPhaseToggle ( ) const
inline

Definition at line 164 of file fader.h.

Property Documentation

◆ balance

zrythm::dsp::ProcessorParameter * zrythm::dsp::Fader::balance
read

Definition at line 19 of file fader.h.

◆ gain

zrythm::dsp::ProcessorParameter * zrythm::dsp::Fader::gain
read

Definition at line 18 of file fader.h.

◆ listen

zrythm::dsp::ProcessorParameter * zrythm::dsp::Fader::listen
read

Definition at line 22 of file fader.h.

◆ midiMode

MidiFaderMode zrythm::dsp::Fader::midiMode
readwrite

Definition at line 17 of file fader.h.

◆ monoToggle

zrythm::dsp::ProcessorParameter * zrythm::dsp::Fader::monoToggle
read

Definition at line 23 of file fader.h.

◆ mute

zrythm::dsp::ProcessorParameter * zrythm::dsp::Fader::mute
read

Definition at line 20 of file fader.h.

◆ solo

zrythm::dsp::ProcessorParameter * zrythm::dsp::Fader::solo
read

Definition at line 21 of file fader.h.

◆ swapPhaseToggle

zrythm::dsp::ProcessorParameter * zrythm::dsp::Fader::swapPhaseToggle
read

Definition at line 24 of file fader.h.


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