]> 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 7ae5464d44ab61fe336e28603460f693cc9a33ea..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()).
@@ -76,8 +78,18 @@ public:
                return alsa_pool.get_card_state(index);
        }
 
+       // See comments on ALSAPool::create_dead_card().
+       DeviceSpec create_dead_card(const std::string &name, const std::string &info, unsigned num_channels)
+       {
+               unsigned dead_card_index = alsa_pool.create_dead_card(name, info, num_channels);
+               return DeviceSpec{InputSourceType::ALSA_INPUT, dead_card_index};
+       }
+
        void set_display_name(DeviceSpec device_spec, const std::string &name);
 
+       // Note: The card should be held (currently this isn't enforced, though).
+       void serialize_device(DeviceSpec device_spec, DeviceSpecProto *device_spec_proto);
+
        void set_input_mapping(const InputMapping &input_mapping);
        InputMapping get_input_mapping() const;
 
@@ -241,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;
@@ -315,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;