]> git.sesse.net Git - nageru/blobdiff - mixer.h
Various cosmetics in the readback code.
[nageru] / mixer.h
diff --git a/mixer.h b/mixer.h
index ffae67a6e398687640c155ae12d8dd81c33f11e0..ef112b8c73c07648bba43fd262d3f54c87fc5094 100644 (file)
--- a/mixer.h
+++ b/mixer.h
@@ -35,6 +35,7 @@
 #include "stereocompressor.h"
 #include "filter.h"
 #include "input_state.h"
+#include "correlation_measurer.h"
 
 class H264Encoder;
 class QSurface;
@@ -103,7 +104,8 @@ public:
 
        typedef std::function<void(float level_lufs, float peak_db,
                                   float global_level_lufs, float range_low_lufs, float range_high_lufs,
-                                  float gain_staging_db, float final_makeup_gain_db)> audio_level_callback_t;
+                                  float gain_staging_db, float final_makeup_gain_db,
+                                  float correlation)> audio_level_callback_t;
        void set_audio_level_callback(audio_level_callback_t callback)
        {
                audio_level_callback = callback;
@@ -124,6 +126,31 @@ public:
                return theme->get_channel_name(channel);
        }
 
+       int get_channel_signal(unsigned channel) const
+       {
+               return theme->get_channel_signal(channel);
+       }
+
+       int map_signal(unsigned channel)
+       {
+               return theme->map_signal(channel);
+       }
+
+       unsigned get_audio_source() const
+       {
+               return audio_source_channel;
+       }
+
+       void set_audio_source(unsigned channel)
+       {
+               audio_source_channel = channel;
+       }
+
+       void set_signal_mapping(int signal, int card)
+       {
+               return theme->set_signal_mapping(signal, card);
+       }
+
        bool get_supports_set_wb(unsigned channel) const
        {
                return theme->get_supports_set_wb(channel);
@@ -139,6 +166,11 @@ public:
                locut_cutoff_hz = cutoff_hz;
        }
 
+       void set_locut_enabled(bool enabled)
+       {
+               locut_enabled = enabled;
+       }
+
        float get_limiter_threshold_dbfs()
        {
                return limiter_threshold_dbfs;
@@ -202,6 +234,13 @@ public:
 
        void reset_meters();
 
+       unsigned get_num_cards() const { return num_cards; }
+
+       std::string get_card_description(unsigned card_index) const {
+               assert(card_index < num_cards);
+               return cards[card_index].usb->get_description();
+       }
+
 private:
        void bm_frame(unsigned card_index, uint16_t timecode,
                FrameAllocator::Frame video_frame, size_t video_offset, uint16_t video_format,
@@ -220,6 +259,7 @@ private:
        QSurface *mixer_surface, *h264_encoder_surface;
        std::unique_ptr<movit::ResourcePool> resource_pool;
        std::unique_ptr<Theme> theme;
+       std::atomic<unsigned> audio_source_channel{0};
        std::unique_ptr<movit::EffectChain> display_chain;
        GLuint cbcr_program_num;  // Owned by <resource_pool>.
        std::unique_ptr<H264Encoder> h264_encoder;
@@ -288,12 +328,14 @@ private:
        audio_level_callback_t audio_level_callback = nullptr;
        std::mutex compressor_mutex;
        Ebu_r128_proc r128;  // Under compressor_mutex.
+       CorrelationMeasurer correlation;  // Under compressor_mutex.
 
        Resampler peak_resampler;
        std::atomic<float> peak{0.0f};
 
-       StereoFilter locut;  // Default cutoff 150 Hz, 24 dB/oct.
+       StereoFilter locut;  // Default cutoff 120 Hz, 24 dB/oct.
        std::atomic<float> locut_cutoff_hz;
+       std::atomic<bool> locut_enabled{true};
 
        // First compressor; takes us up to about -12 dBFS.
        StereoCompressor level_compressor;  // Under compressor_mutex. Used to set/override gain_staging_db if <level_compressor_enabled>.