X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=mixer.h;h=6725a7f46e242fe44bdba8a7c0e583b422b42102;hb=0d7183f398856c9331e58808d0374e63593334b6;hp=cdc6f1c8c32762b6e68f86ea61c1d3745e355f92;hpb=bc5f55d6b555a82eb1b770509ccde0f41ade0d0a;p=nageru diff --git a/mixer.h b/mixer.h index cdc6f1c..6725a7f 100644 --- a/mixer.h +++ b/mixer.h @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -30,6 +31,7 @@ #include "theme.h" #include "timebase.h" #include "stereocompressor.h" +#include "filter.h" class H264Encoder; class QSurface; @@ -96,7 +98,9 @@ public: output_channel[output].set_frame_ready_callback(callback); } - typedef std::function audio_level_callback_t; + typedef std::function audio_level_callback_t; void set_audio_level_callback(audio_level_callback_t callback) { audio_level_callback = callback; @@ -127,6 +131,13 @@ public: theme->set_wb(channel, r, g, b); } + void set_locut_cutoff(float cutoff_hz) + { + locut_cutoff_hz = cutoff_hz; + } + + void reset_meters(); + private: void bm_frame(unsigned card_index, uint16_t timecode, FrameAllocator::Frame video_frame, size_t video_offset, uint16_t video_format, @@ -203,10 +214,17 @@ private: Ebu_r128_proc r128; // TODO: Implement oversampled peak detection. - float peak = 0.0f; + std::atomic peak{0.0f}; + + StereoFilter locut; // Default cutoff 150 Hz, 24 dB/oct. + std::atomic locut_cutoff_hz; // First compressor; takes us up to about -12 dBFS. StereoCompressor level_compressor; + float last_gain_staging_db = 0.0f; + + StereoCompressor limiter; + StereoCompressor compressor; }; extern Mixer *global_mixer;