35class MeterProcessor :
public QObject
39 Q_PROPERTY (QVariant port READ port WRITE setPort REQUIRED)
40 Q_PROPERTY (
int channel READ channel WRITE setChannel)
45 float currentAmplitude READ currentAmplitude NOTIFY currentAmplitudeChanged)
46 Q_PROPERTY (
float peakAmplitude READ peakAmplitude NOTIFY peakAmplitudeChanged)
54 METER_ALGORITHM_DIGITAL_PEAK,
62 using MeterPortVariant = std::variant<dsp::MidiPort, dsp::AudioPort>;
63 using MeterPortPtrVariant = to_pointer_variant<MeterPortVariant>;
71 QVariant port ()
const {
return QVariant::fromValue (
port_obj_); }
72 void setPort (QVariant port_var);
74 int channel ()
const {
return channel_; }
75 void setChannel (
int channel);
80 float currentAmplitude ()
const
82 return current_amp_.load (std::memory_order_relaxed);
84 Q_SIGNAL
void currentAmplitudeChanged (
float value);
86 float peakAmplitude ()
const
88 return peak_amp_.load (std::memory_order_relaxed);
90 Q_SIGNAL
void peakAmplitudeChanged (
float value);
92 Q_INVOKABLE
float toDBFS (
float amp)
const;
93 Q_INVOKABLE
float toFader (
float amp)
const;
110 std::optional<dsp::RingBufferOwningPortMixin::RingBufferReader>
115 std::unique_ptr<zrythm::dsp::TruePeakDsp> true_peak_max_processor_;
119 float true_peak_max_ = 0.f;
124 std::unique_ptr<zrythm::dsp::PeakDsp> peak_processor_;
143 qint64 last_midi_trigger_time_ = 0;
146 std::vector<float> tmp_buf_;
148 std::atomic<float> current_amp_ = 0.f;
149 std::atomic<float> peak_amp_ = 0.f;
154 QPointer<dsp::AudioEngine> audio_engine_;
156 boost::container::static_vector<dsp::MidiEvent, 256> tmp_events_;