set_final_makeup_gain_auto(global_flags.final_makeup_gain_auto);
// Generate a very simple, default input mapping.
- InputMapping::Input input;
+ InputMapping::Bus input;
input.name = "Main";
input.input_source_type = InputSourceType::CAPTURE_CARD;
input.input_source_index = 0;
input.source_channel[1] = 1;
InputMapping new_input_mapping;
- new_input_mapping.inputs.push_back(input);
+ new_input_mapping.buses.push_back(input);
set_input_mapping(new_input_mapping);
}
CaptureCard *card = &cards[card_index];
if (card->resampling_queue == nullptr) {
- // No inputs use this card; throw it away.
+ // No buses use this card; throw it away.
return;
}
lock_guard<mutex> lock(audio_mutex);
if (card->resampling_queue == nullptr) {
- // No inputs use this card; throw it away.
+ // No buses use this card; throw it away.
return;
}
vector<float> samples_out;
samples_out.resize(num_samples * 2);
samples_bus.resize(num_samples * 2);
- for (unsigned input_index = 0; input_index < input_mapping.inputs.size(); ++input_index) {
- const InputMapping::Input &input = input_mapping.inputs[input_index];
+ for (unsigned bus_index = 0; bus_index < input_mapping.buses.size(); ++bus_index) {
+ const InputMapping::Bus &input = input_mapping.buses[bus_index];
if (input.input_source_type == InputSourceType::SILENCE) {
memset(&samples_bus[0], 0, samples_bus.size() * sizeof(samples_bus[0]));
} else {
}
}
- float volume = from_db(fader_volume_db[input_index]);
- if (input_index == 0) {
+ float volume = from_db(fader_volume_db[bus_index]);
+ if (bus_index == 0) {
for (unsigned i = 0; i < num_samples * 2; ++i) {
samples_out[i] = samples_bus[i] * volume;
}
lock_guard<mutex> lock(audio_mutex);
map<unsigned, set<unsigned>> interesting_channels;
- for (const InputMapping::Input &input : new_input_mapping.inputs) {
- if (input.input_source_type == InputSourceType::CAPTURE_CARD) {
+ for (const InputMapping::Bus &bus : new_input_mapping.buses) {
+ if (bus.input_source_type == InputSourceType::CAPTURE_CARD) {
for (unsigned channel = 0; channel < 2; ++channel) {
- if (input.source_channel[channel] != -1) {
- interesting_channels[input.input_source_index].insert(input.source_channel[channel]);
+ if (bus.source_channel[channel] != -1) {
+ interesting_channels[bus.input_source_index].insert(bus.source_channel[channel]);
}
}
}
enum class InputSourceType { SILENCE, CAPTURE_CARD };
struct InputMapping {
- struct Input { // TODO: rename to Bus?
+ struct Bus {
std::string name;
InputSourceType input_source_type;
unsigned input_source_index;
int source_channel[2] { -1, -1 }; // Left and right. -1 = none.
};
- std::vector<Input> inputs;
+ std::vector<Bus> buses;
};
class AudioMixer {
// See comments inside get_output().
void set_current_loudness(double level_lufs) { loudness_lufs = level_lufs; }
- void set_fader_volume(unsigned input_index, float level_db) { fader_volume_db[input_index] = level_db; }
+ void set_fader_volume(unsigned bus_index, float level_db) { fader_volume_db[bus_index] = level_db; }
std::vector<std::string> get_names() const;
void set_name(unsigned card_index, const std::string &name);
ui->table->horizontalHeader()->setSectionResizeMode(3, QHeaderView::ResizeToContents);
ui->table->horizontalHeader()->setSectionsClickable(false);
- ui->table->setRowCount(mapping.inputs.size());
- for (unsigned row = 0; row < mapping.inputs.size(); ++row) {
- fill_row_from_input(row, mapping.inputs[row]);
+ ui->table->setRowCount(mapping.buses.size());
+ for (unsigned row = 0; row < mapping.buses.size(); ++row) {
+ fill_row_from_bus(row, mapping.buses[row]);
}
}
-void InputMappingDialog::fill_row_from_input(unsigned row, const InputMapping::Input &input)
+void InputMappingDialog::fill_row_from_bus(unsigned row, const InputMapping::Bus &bus)
{
- QString name(QString::fromStdString(input.name));
+ QString name(QString::fromStdString(bus.name));
ui->table->setItem(row, 0, new QTableWidgetItem(name));
// Card choices.
for (const string &name : card_names) {
card_combo->addItem(QString::fromStdString(name + " "));
}
- switch (input.input_source_type) {
+ switch (bus.input_source_type) {
case InputSourceType::SILENCE:
card_combo->setCurrentIndex(0);
break;
case InputSourceType::CAPTURE_CARD:
- card_combo->setCurrentIndex(mapping.inputs[row].input_source_index + 1);
+ card_combo->setCurrentIndex(mapping.buses[row].input_source_index + 1);
break;
default:
assert(false);
bind(&InputMappingDialog::card_selected, this, row, _1));
ui->table->setCellWidget(row, 1, card_combo);
- setup_channel_choices_from_input(row, input);
+ setup_channel_choices_from_bus(row, bus);
}
-void InputMappingDialog::setup_channel_choices_from_input(unsigned row, const InputMapping::Input &input)
+void InputMappingDialog::setup_channel_choices_from_bus(unsigned row, const InputMapping::Bus &bus)
{
// Left and right channel.
for (unsigned channel = 0; channel < 2; ++channel) {
QComboBox *channel_combo = new QComboBox;
channel_combo->addItem(QString("(none)"));
- if (input.input_source_type == InputSourceType::CAPTURE_CARD) {
+ if (bus.input_source_type == InputSourceType::CAPTURE_CARD) {
for (unsigned source = 0; source < 8; ++source) { // TODO: Ask the card about number of channels, and names.
char buf[256];
snprintf(buf, sizeof(buf), "Channel %u ", source + 1);
channel_combo->addItem(QString(buf));
}
- channel_combo->setCurrentIndex(input.source_channel[channel] + 1);
+ channel_combo->setCurrentIndex(bus.source_channel[channel] + 1);
} else {
channel_combo->setCurrentIndex(0);
}
// Spurious; only really the name column should fire these.
return;
}
- mapping.inputs[row].name = ui->table->item(row, column)->text().toStdString();
+ mapping.buses[row].name = ui->table->item(row, column)->text().toStdString();
}
void InputMappingDialog::card_selected(unsigned row, int index)
{
if (index == 0) {
- mapping.inputs[row].input_source_type = InputSourceType::SILENCE;
+ mapping.buses[row].input_source_type = InputSourceType::SILENCE;
} else {
- mapping.inputs[row].input_source_type = InputSourceType::CAPTURE_CARD;
- mapping.inputs[row].input_source_index = index - 1;
+ mapping.buses[row].input_source_type = InputSourceType::CAPTURE_CARD;
+ mapping.buses[row].input_source_index = index - 1;
}
- setup_channel_choices_from_input(row, mapping.inputs[row]);
+ setup_channel_choices_from_bus(row, mapping.buses[row]);
}
void InputMappingDialog::channel_selected(unsigned row, unsigned channel, int index)
{
- mapping.inputs[row].source_channel[channel] = index - 1;
+ mapping.buses[row].source_channel[channel] = index - 1;
}
void InputMappingDialog::add_clicked()
{
- InputMapping::Input new_input;
- new_input.name = "New input";
- new_input.input_source_type = InputSourceType::SILENCE;
- mapping.inputs.push_back(new_input);
- ui->table->setRowCount(mapping.inputs.size());
-
- unsigned row = mapping.inputs.size() - 1;
- fill_row_from_input(row, new_input);
+ InputMapping::Bus new_bus;
+ new_bus.name = "New input";
+ new_bus.input_source_type = InputSourceType::SILENCE;
+ mapping.buses.push_back(new_bus);
+ ui->table->setRowCount(mapping.buses.size());
+
+ unsigned row = mapping.buses.size() - 1;
+ fill_row_from_bus(row, new_bus);
ui->table->editItem(ui->table->item(row, 0)); // Start editing the name.
}
private:
void fill_ui_from_mapping(const InputMapping &mapping);
- void fill_row_from_input(unsigned row, const InputMapping::Input &input);
- void setup_channel_choices_from_input(unsigned row, const InputMapping::Input &input);
+ void fill_row_from_bus(unsigned row, const InputMapping::Bus &bus);
+ void setup_channel_choices_from_bus(unsigned row, const InputMapping::Bus &bus);
void cell_changed(int row, int column);
void card_selected(unsigned row, int index);
void channel_selected(unsigned row, unsigned channel, int index);
// Set up brand new ones from the input mapping.
InputMapping mapping = global_mixer->get_audio_mixer()->get_input_mapping();
- for (unsigned i = 0; i < mapping.inputs.size(); ++i) {
+ for (unsigned bus_index = 0; bus_index < mapping.buses.size(); ++bus_index) {
QWidget *channel = new QWidget(this);
Ui::AudioMiniView *ui_audio_miniview = new Ui::AudioMiniView;
ui_audio_miniview->setupUi(channel);
- ui_audio_miniview->channel_desc_label->setFullText(
- QString::fromStdString(mapping.inputs[i].name));
+ ui_audio_miniview->bus_desc_label->setFullText(
+ QString::fromStdString(mapping.buses[bus_index].name));
// TODO: Set the fader position.
ui->faders->addWidget(channel);
connect(ui_audio_miniview->fader, &QAbstractSlider::valueChanged,
- bind(&MainWindow::mini_fader_changed, this, ui_audio_miniview, i, _1));
+ bind(&MainWindow::mini_fader_changed, this, ui_audio_miniview, bus_index, _1));
}
}
<number>6</number>
</property>
<item>
- <widget class="EllipsisLabel" name="channel_desc_label">
+ <widget class="EllipsisLabel" name="bus_desc_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>