+AudioMixer::BusSettings AudioMixer::get_default_bus_settings()
+{
+ BusSettings settings;
+ settings.fader_volume_db = 0.0f;
+ settings.muted = false;
+ settings.locut_enabled = global_flags.locut_enabled;
+ for (unsigned band_index = 0; band_index < NUM_EQ_BANDS; ++band_index) {
+ settings.eq_level_db[band_index] = 0.0f;
+ }
+ settings.gain_staging_db = global_flags.initial_gain_staging_db;
+ settings.level_compressor_enabled = global_flags.gain_staging_auto;
+ settings.compressor_threshold_dbfs = ref_level_dbfs - 12.0f; // -12 dB.
+ settings.compressor_enabled = global_flags.compressor_enabled;
+ return settings;
+}
+
+AudioMixer::BusSettings AudioMixer::get_bus_settings(unsigned bus_index) const
+{
+ lock_guard<timed_mutex> lock(audio_mutex);
+ BusSettings settings;
+ settings.fader_volume_db = fader_volume_db[bus_index];
+ settings.muted = mute[bus_index];
+ settings.locut_enabled = locut_enabled[bus_index];
+ for (unsigned band_index = 0; band_index < NUM_EQ_BANDS; ++band_index) {
+ settings.eq_level_db[band_index] = eq_level_db[bus_index][band_index];
+ }
+ settings.gain_staging_db = gain_staging_db[bus_index];
+ settings.level_compressor_enabled = level_compressor_enabled[bus_index];
+ settings.compressor_threshold_dbfs = compressor_threshold_dbfs[bus_index];
+ settings.compressor_enabled = compressor_enabled[bus_index];
+ return settings;
+}
+
+void AudioMixer::set_bus_settings(unsigned bus_index, const AudioMixer::BusSettings &settings)
+{
+ lock_guard<timed_mutex> lock(audio_mutex);
+ fader_volume_db[bus_index] = settings.fader_volume_db;
+ mute[bus_index] = settings.muted;
+ locut_enabled[bus_index] = settings.locut_enabled;
+ for (unsigned band_index = 0; band_index < NUM_EQ_BANDS; ++band_index) {
+ eq_level_db[bus_index][band_index] = settings.eq_level_db[band_index];
+ }
+ gain_staging_db[bus_index] = settings.gain_staging_db;
+ last_gain_staging_db[bus_index] = gain_staging_db[bus_index];
+ level_compressor_enabled[bus_index] = settings.level_compressor_enabled;
+ compressor_threshold_dbfs[bus_index] = settings.compressor_threshold_dbfs;
+ compressor_enabled[bus_index] = settings.compressor_enabled;
+}
+