]> git.sesse.net Git - nageru/blob - nageru/input_mapping_dialog.h
Support delaying audio sources selectively.
[nageru] / nageru / input_mapping_dialog.h
1 #ifndef _INPUT_MAPPING_DIALOG_H
2 #define _INPUT_MAPPING_DIALOG_H
3
4 #include <QDialog>
5 #include <QString>
6 #include <map>
7 #include <vector>
8
9 #include "audio_mixer.h"
10 #include "input_mapping.h"
11
12 class QObject;
13
14 namespace Ui {
15 class InputMappingDialog;
16 }  // namespace Ui
17
18 class QComboBox;
19
20 class InputMappingDialog : public QDialog
21 {
22         Q_OBJECT
23
24 public:
25         InputMappingDialog();
26         ~InputMappingDialog();
27
28 private:
29         void fill_ui_from_mapping(const InputMapping &mapping);
30         void fill_row_from_bus(unsigned row, const InputMapping::Bus &bus, const InputMapping &mapping);
31         void fill_delay_from_bus(unsigned row, const InputMapping::Bus &bus, const InputMapping &mapping);
32         void setup_channel_choices_from_bus(unsigned row, const InputMapping::Bus &bus);
33         void cell_changed(int row, int column);
34         void card_selected(QComboBox *card_combo, unsigned row, int index);
35         void channel_selected(unsigned row, unsigned channel, int index);
36         void delay_changed(unsigned row, double value);
37         void ok_clicked();
38         void cancel_clicked();
39         void add_clicked();
40         void remove_clicked();
41         void updown_clicked(int direction);
42         void save_clicked();
43         void load_clicked();
44         void update_button_state();
45
46         Ui::InputMappingDialog *ui;
47         InputMapping mapping;  // Under edit. Will be committed on OK.
48
49         // The old mapping. Will be re-committed on cancel, so that we
50         // unhold all the unused devices (otherwise they would be
51         // held forever).
52         InputMapping old_mapping;
53
54         // One for each bus in the mapping. Edited along with the mapping,
55         // so that old volumes etc. are being kept in place for buses that
56         // existed before.
57         std::vector<AudioMixer::BusSettings> bus_settings;
58
59         std::map<DeviceSpec, DeviceInfo> devices;  // Needs no lock, accessed only on the UI thread.
60         AudioMixer::state_changed_callback_t saved_callback;
61 };
62
63 #endif  // !defined(_INPUT_MAPPING_DIALOG_H)