]> git.sesse.net Git - nageru/blobdiff - audio_mixer.h
Move the lo-cut into each bus.
[nageru] / audio_mixer.h
index 75b468a120f7d1f39aa293009e9b76153ae4e9a3..0c401d5e6b858f9f9a8c30e5eed5b5865a8a6d80 100644 (file)
@@ -101,14 +101,14 @@ public:
                locut_cutoff_hz = cutoff_hz;
        }
 
-       void set_locut_enabled(bool enabled)
+       void set_locut_enabled(unsigned bus, bool enabled)
        {
-               locut_enabled = enabled;
+               locut_enabled[bus] = enabled;
        }
 
-       bool get_locut_enabled() const
+       bool get_locut_enabled(unsigned bus)
        {
-               return locut_enabled;
+               return locut_enabled[bus];
        }
 
        float get_limiter_threshold_dbfs() const
@@ -202,6 +202,7 @@ public:
        }
 
        typedef std::function<void(float level_lufs, float peak_db,
+                                  std::vector<float> bus_level_lufs,
                                   float global_level_lufs, float range_low_lufs, float range_high_lufs,
                                   float gain_staging_db, float final_makeup_gain_db,
                                   float correlation)> audio_level_callback_t;
@@ -229,6 +230,7 @@ private:
        void reset_alsa_mutex_held(DeviceSpec device_spec);
        std::map<DeviceSpec, DeviceInfo> get_devices_mutex_held() const;
        void update_meters(const std::vector<float> &samples);
+       void measure_bus_levels(unsigned bus_index, const std::vector<float> &left, const std::vector<float> &right);
        void send_audio_level_callback();
 
        unsigned num_cards;
@@ -241,9 +243,9 @@ private:
        AudioDevice alsa_inputs[MAX_ALSA_CARDS];  // Under audio_mutex.
        std::vector<ALSAInput::Device> available_alsa_cards;
 
-       StereoFilter locut;  // Default cutoff 120 Hz, 24 dB/oct.
        std::atomic<float> locut_cutoff_hz;
-       std::atomic<bool> locut_enabled{true};
+       StereoFilter locut[MAX_BUSES];  // Default cutoff 120 Hz, 24 dB/oct.
+       std::atomic<bool> locut_enabled[MAX_BUSES];
 
        // First compressor; takes us up to about -12 dBFS.
        mutable std::mutex compressor_mutex;
@@ -273,6 +275,12 @@ private:
        CorrelationMeasurer correlation;  // Under audio_measure_mutex.
        Resampler peak_resampler;  // Under audio_measure_mutex.
        std::atomic<float> peak{0.0f};
+
+       // Under audio_measure_mutex. Note that Ebu_r128_proc has a broken
+       // copy constructor (it uses the default, but holds arrays),
+       // so we can't just use raw Ebu_r128_proc elements, but need to use
+       // unique_ptrs.
+       std::vector<std::unique_ptr<Ebu_r128_proc>> bus_r128;
 };
 
 #endif  // !defined(_AUDIO_MIXER_H)