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

A meter processor for a single GUI element. More...

#include <src/gui/qquick/meter_processor.h>

Inheritance diagram for zrythm::gui::qquick::MeterProcessor:
Collaboration diagram for zrythm::gui::qquick::MeterProcessor:

Public Types

enum class  MeterAlgorithm : std::uint8_t {
  METER_ALGORITHM_AUTO , METER_ALGORITHM_DIGITAL_PEAK , METER_ALGORITHM_TRUE_PEAK , METER_ALGORITHM_RMS ,
  METER_ALGORITHM_K
}
using MeterPortVariant = std::variant<dsp::MidiPort, dsp::AudioPort>
using MeterPortPtrVariant = to_pointer_variant<MeterPortVariant>

Public Member Functions

 MeterProcessor (QObject *parent=nullptr)
QVariant port () const
void setPort (QVariant port_var)
int channel () const
void setChannel (int channel)
dsp::AudioEngineaudioEngine () const
void setAudioEngine (dsp::AudioEngine *engine)
float currentAmplitude () const
Q_SIGNAL void currentAmplitudeChanged (float value)
float peakAmplitude () const
Q_SIGNAL void peakAmplitudeChanged (float value)
Q_INVOKABLE float toDBFS (float amp) const
Q_INVOKABLE float toFader (float amp) const

Data Fields

QPointer< QObject > port_obj_
 Port associated with this meter.
std::optional< dsp::RingBufferOwningPortMixin::RingBufferReaderring_buffer_reader_
std::unique_ptr< zrythm::dsp::TruePeakDsptrue_peak_processor_
 True peak processor.
std::unique_ptr< zrythm::dsp::TruePeakDsptrue_peak_max_processor_
float true_peak_ = 0.f
 Current true peak.
float true_peak_max_ = 0.f
std::unique_ptr< zrythm::dsp::KMeterDspkmeter_processor_
 K RMS processor, if K meter.
std::unique_ptr< zrythm::dsp::PeakDsppeak_processor_
MeterAlgorithm algorithm_ = MeterAlgorithm::METER_ALGORITHM_AUTO
 Algorithm to use.
float prev_max_ = 0.f
 Previous max, used when holding the max value.
float last_amp_ = 0.f
 Last meter value (in amplitude), used to show a falloff and avoid sudden dips.
SteadyTimePoint last_draw_time_
 Time the last val was taken at (last draw time).
qint64 last_midi_trigger_time_ = 0

Properties

QML_ELEMENT QVariant port
int channel
zrythm::dsp::AudioEngineaudioEngine
float currentAmplitude
float peakAmplitude

Detailed Description

A meter processor for a single GUI element.

This class is responsible for processing the meter values for a single GUI element, such as a volume meter. It supports various meter algorithms, including digital peak, true peak, RMS, and K-meter.

The meter processor is associated with a port, which can be either an AudioPort or a MidiPort. The meter values are updated based on the data from the associated port.

The meter processor emits the valuesChanged signal whenever the meter values are updated, allowing the GUI to update the display accordingly.

Definition at line 35 of file meter_processor.h.

Member Typedef Documentation

◆ MeterPortPtrVariant

using zrythm::gui::qquick::MeterProcessor::MeterPortPtrVariant = to_pointer_variant<MeterPortVariant>

Definition at line 61 of file meter_processor.h.

◆ MeterPortVariant

using zrythm::gui::qquick::MeterProcessor::MeterPortVariant = std::variant<dsp::MidiPort, dsp::AudioPort>

Definition at line 60 of file meter_processor.h.

Member Enumeration Documentation

◆ MeterAlgorithm

enum class zrythm::gui::qquick::MeterProcessor::MeterAlgorithm : std::uint8_t
strong
Enumerator
METER_ALGORITHM_AUTO 

Use default algorithm for the port.

METER_ALGORITHM_TRUE_PEAK 
Note
True peak is intensive, only use it where needed (mixer).

Definition at line 47 of file meter_processor.h.

Member Function Documentation

◆ audioEngine()

dsp::AudioEngine * zrythm::gui::qquick::MeterProcessor::audioEngine ( ) const
inline

Definition at line 75 of file meter_processor.h.

◆ channel()

int zrythm::gui::qquick::MeterProcessor::channel ( ) const
inline

Definition at line 72 of file meter_processor.h.

◆ currentAmplitude()

float zrythm::gui::qquick::MeterProcessor::currentAmplitude ( ) const
inline

Definition at line 78 of file meter_processor.h.

◆ peakAmplitude()

float zrythm::gui::qquick::MeterProcessor::peakAmplitude ( ) const
inline

Definition at line 84 of file meter_processor.h.

◆ port()

QVariant zrythm::gui::qquick::MeterProcessor::port ( ) const
inline

Definition at line 69 of file meter_processor.h.

◆ setAudioEngine()

void zrythm::gui::qquick::MeterProcessor::setAudioEngine ( dsp::AudioEngine * engine)
inline

Definition at line 76 of file meter_processor.h.

Field Documentation

◆ algorithm_

MeterAlgorithm zrythm::gui::qquick::MeterProcessor::algorithm_ = MeterAlgorithm::METER_ALGORITHM_AUTO

Algorithm to use.

Auto by default.

Definition at line 129 of file meter_processor.h.

◆ kmeter_processor_

std::unique_ptr<zrythm::dsp::KMeterDsp> zrythm::gui::qquick::MeterProcessor::kmeter_processor_

K RMS processor, if K meter.

Definition at line 120 of file meter_processor.h.

◆ last_amp_

float zrythm::gui::qquick::MeterProcessor::last_amp_ = 0.f

Last meter value (in amplitude), used to show a falloff and avoid sudden dips.

Definition at line 136 of file meter_processor.h.

◆ last_draw_time_

SteadyTimePoint zrythm::gui::qquick::MeterProcessor::last_draw_time_

Time the last val was taken at (last draw time).

Definition at line 139 of file meter_processor.h.

◆ last_midi_trigger_time_

qint64 zrythm::gui::qquick::MeterProcessor::last_midi_trigger_time_ = 0

Definition at line 141 of file meter_processor.h.

◆ peak_processor_

std::unique_ptr<zrythm::dsp::PeakDsp> zrythm::gui::qquick::MeterProcessor::peak_processor_

Definition at line 122 of file meter_processor.h.

◆ port_obj_

QPointer<QObject> zrythm::gui::qquick::MeterProcessor::port_obj_

Port associated with this meter.

Definition at line 105 of file meter_processor.h.

◆ prev_max_

float zrythm::gui::qquick::MeterProcessor::prev_max_ = 0.f

Previous max, used when holding the max value.

Definition at line 132 of file meter_processor.h.

◆ ring_buffer_reader_

std::optional<dsp::RingBufferOwningPortMixin::RingBufferReader> zrythm::gui::qquick::MeterProcessor::ring_buffer_reader_

Definition at line 109 of file meter_processor.h.

◆ true_peak_

float zrythm::gui::qquick::MeterProcessor::true_peak_ = 0.f

Current true peak.

Definition at line 116 of file meter_processor.h.

◆ true_peak_max_

float zrythm::gui::qquick::MeterProcessor::true_peak_max_ = 0.f

Definition at line 117 of file meter_processor.h.

◆ true_peak_max_processor_

std::unique_ptr<zrythm::dsp::TruePeakDsp> zrythm::gui::qquick::MeterProcessor::true_peak_max_processor_

Definition at line 113 of file meter_processor.h.

◆ true_peak_processor_

std::unique_ptr<zrythm::dsp::TruePeakDsp> zrythm::gui::qquick::MeterProcessor::true_peak_processor_

True peak processor.

Definition at line 112 of file meter_processor.h.

Property Documentation

◆ audioEngine

zrythm::dsp::AudioEngine * zrythm::gui::qquick::MeterProcessor::audioEngine
readwrite

Definition at line 41 of file meter_processor.h.

◆ channel

int zrythm::gui::qquick::MeterProcessor::channel
readwrite

Definition at line 40 of file meter_processor.h.

◆ currentAmplitude

float zrythm::gui::qquick::MeterProcessor::currentAmplitude
read

Definition at line 43 of file meter_processor.h.

◆ peakAmplitude

float zrythm::gui::qquick::MeterProcessor::peakAmplitude
read

Definition at line 44 of file meter_processor.h.

◆ port

QML_ELEMENT QVariant zrythm::gui::qquick::MeterProcessor::port
readwrite

Definition at line 39 of file meter_processor.h.


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