MCPcopy Create free account
hub / github.com/audacity/audacity / CompressionMeterPanel

Method CompressionMeterPanel

src/effects/CompressionMeterPanel.cpp:38–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36END_EVENT_TABLE()
37
38CompressionMeterPanel::CompressionMeterPanel(
39 wxWindow* parent, int id, CompressorInstance& instance, float dbRange,
40 std::function<void()> onClipped)
41 : wxPanelWrapper { parent, id }
42 , mMeterValuesQueue { std::make_unique<
43 DynamicRangeProcessorMeterValuesQueue>(audioFramesPerTick) }
44 , mPlaybackStartStopSubscription { static_cast<
45 InitializeProcessingSettingsPublisher&>(
46 instance)
47 .Subscribe(
48 [&](const std::optional<
49 InitializeProcessingSettings>&
50 evt) {
51 if (evt)
52 Reset();
53 else
54 mStopWhenZero = true;
55 }) }
56 , mPlaybackPausedSubscription { AudioIO::Get()->Subscribe(
57 [this](const AudioIOEvent& evt) {
58 if (evt.type != AudioIOEvent::PAUSE)
59 return;
60 if (evt.on)
61 mTimer.Stop();
62 else
63 mTimer.Start(compressorMeterUpdatePeriodMs);
64 }) }
65 , mOnClipped { onClipped }
66 , mDbBottomEdgeValue { -dbRange }
67 , mCompressionMeter { MeterValueProvider::Create(
68 MeterValueProvider::Direction::Downwards) }
69 , mOutputMeter { MeterValueProvider::Create(
70 MeterValueProvider::Direction::Upwards) }
71{
72 if (instance.GetSampleRate().has_value())
73 // Playback is ongoing, and so the `InitializeProcessingSettings` event
74 // was already fired.
75 Reset();
76 instance.SetMeterValuesQueue(mMeterValuesQueue);
77 mTimer.SetOwner(this, timerId);
78 SetDoubleBuffered(true);
79}
80
81void CompressionMeterPanel::SetDbRange(float dbRange)
82{

Callers

nothing calls this directly

Calls 9

GetFunction · 0.85
CreateFunction · 0.85
has_valueMethod · 0.80
SetMeterValuesQueueMethod · 0.80
SetOwnerMethod · 0.80
SubscribeMethod · 0.45
StopMethod · 0.45
StartMethod · 0.45
GetSampleRateMethod · 0.45

Tested by

no test coverage detected