]> git.sesse.net Git - nageru/blob - nageru/delay_analyzer.h
Begin working on a delay analyzer.
[nageru] / nageru / delay_analyzer.h
1 #ifndef _DELAY_ANALYZER_H
2 #define _DELAY_ANALYZER_H 1
3
4 #include <QMainWindow>
5
6 #include <atomic>
7 #include <string>
8
9 #include "audio_clip.h"
10 #include "delay_analyzer_interface.h"
11 #include "input_mapping.h"
12
13 namespace bmusb {
14 struct AudioFormat;
15 }  // namespace bmusb
16
17 namespace Ui {
18 class DelayAnalyzer;
19 }  // namespace Ui
20
21 class QComboBox;
22
23 class DelayAnalyzer : public QMainWindow, public DelayAnalyzerInterface
24 {
25         Q_OBJECT
26
27 public:
28         DelayAnalyzer();
29         ~DelayAnalyzer();
30
31         bool is_grabbing() const override { return grabbing; }
32         void add_audio(DeviceSpec device_spec, const uint8_t *data, unsigned num_samples, bmusb::AudioFormat audio_format, std::chrono::steady_clock::time_point frame_time) override;
33
34 private:
35         Ui::DelayAnalyzer *ui;
36         AudioClip clip1, clip2;
37
38         void grab_clicked();
39         void card_selected(QComboBox *card_combo, int selected_index);
40         void channel_selected(QComboBox *channel_combo);
41         DeviceSpec get_selected_device(QComboBox *card_combo);
42
43         std::atomic<bool> grabbing{false};
44         std::map<DeviceSpec, DeviceInfo> devices;
45 };
46
47 #endif  // !defined(_DELAY_ANALYZER_H)