50class MeterProcessor :
public QObject
54 Q_PROPERTY (QVariant port READ port WRITE setPort REQUIRED)
55 Q_PROPERTY (
int channel READ channel WRITE setChannel)
57 float currentAmplitude READ currentAmplitude NOTIFY currentAmplitudeChanged)
58 Q_PROPERTY (
float peakAmplitude READ peakAmplitude NOTIFY peakAmplitudeChanged)
61 using MeterPortVariant = std::variant<dsp::MidiPort, dsp::AudioPort>;
62 using MeterPortPtrVariant = to_pointer_variant<MeterPortVariant>;
64 MeterProcessor (QObject * parent =
nullptr);
70 QVariant port ()
const {
return QVariant::fromValue (
port_obj_); }
71 void setPort (QVariant port_var);
73 int channel ()
const {
return channel_; }
74 void setChannel (
int channel);
76 float currentAmplitude ()
const
78 return current_amp_.load (std::memory_order_relaxed);
80 Q_SIGNAL
void currentAmplitudeChanged (
float value);
82 float peakAmplitude ()
const
84 return peak_amp_.load (std::memory_order_relaxed);
86 Q_SIGNAL
void peakAmplitudeChanged (
float value);
88 Q_INVOKABLE
float toDBFS (
float amp)
const;
89 Q_INVOKABLE
float toFader (
float amp)
const;
106 std::optional<dsp::RingBufferOwningPortMixin::RingBufferReader>
111 std::unique_ptr<zrythm::dsp::TruePeakDsp> true_peak_max_processor_;
115 float true_peak_max_ = 0.f;
120 std::unique_ptr<zrythm::dsp::PeakDsp> peak_processor_;
139 qint64 last_midi_trigger_time_ = 0;
142 std::vector<float> tmp_buf_;
144 std::atomic<float> current_amp_ = 0.f;
145 std::atomic<float> peak_amp_ = 0.f;
150 boost::container::static_vector<dsp::MidiEvent, 256> tmp_events_;