]> git.sesse.net Git - nageru/blobdiff - audio_mixer.h
Do not use the timing of dropped frames as part of the video master clock.
[nageru] / audio_mixer.h
index 3a1334a66656e9979cc8ca3148f3c7761acced5e..1570d26373eb3592fbf897990954521ba36d1fb4 100644 (file)
@@ -19,6 +19,7 @@
 #include <zita-resampler/resampler.h>
 
 #include "alsa_input.h"
+#include "alsa_pool.h"
 #include "bmusb/bmusb.h"
 #include "correlation_measurer.h"
 #include "db.h"
@@ -63,6 +64,7 @@ public:
 
        std::vector<float> get_output(double pts, unsigned num_samples, ResamplingQueue::RateAdjustmentPolicy rate_adjustment_policy);
 
+       float get_fader_volume(unsigned bus_index) const { return fader_volume_db[bus_index]; }
        void set_fader_volume(unsigned bus_index, float level_db) { fader_volume_db[bus_index] = level_db; }
 
        // Note: This operation holds all ALSA devices (see ALSAPool::get_devices()).
@@ -251,6 +253,22 @@ public:
                }
        }
 
+       // A combination of all settings for a bus. Useful if you want to get
+       // or store them as a whole without bothering to call all of the get_*
+       // or set_* functions for that bus.
+       struct BusSettings {
+               float fader_volume_db;
+               bool locut_enabled;
+               float eq_level_db[NUM_EQ_BANDS];
+               float gain_staging_db;
+               bool level_compressor_enabled;
+               float compressor_threshold_dbfs;
+               bool compressor_enabled;
+       };
+       static BusSettings get_default_bus_settings();
+       BusSettings get_bus_settings(unsigned bus_index) const;
+       void set_bus_settings(unsigned bus_index, const BusSettings &settings);
+
 private:
        struct AudioDevice {
                std::unique_ptr<ResamplingQueue> resampling_queue;
@@ -325,6 +343,7 @@ private:
        std::atomic<float> fader_volume_db[MAX_BUSES] {{ 0.0f }};
        float last_fader_volume_db[MAX_BUSES] { 0.0f };  // Under audio_mutex.
        std::atomic<float> eq_level_db[MAX_BUSES][NUM_EQ_BANDS] {{{ 0.0f }}};
+       float last_eq_level_db[MAX_BUSES][NUM_EQ_BANDS] {{ 0.0f }};
 
        audio_level_callback_t audio_level_callback = nullptr;
        state_changed_callback_t state_changed_callback = nullptr;