]> git.sesse.net Git - nageru/blobdiff - nageru/delay_analyzer.h
Begin working on a delay analyzer.
[nageru] / nageru / delay_analyzer.h
diff --git a/nageru/delay_analyzer.h b/nageru/delay_analyzer.h
new file mode 100644 (file)
index 0000000..cc75325
--- /dev/null
@@ -0,0 +1,47 @@
+#ifndef _DELAY_ANALYZER_H
+#define _DELAY_ANALYZER_H 1
+
+#include <QMainWindow>
+
+#include <atomic>
+#include <string>
+
+#include "audio_clip.h"
+#include "delay_analyzer_interface.h"
+#include "input_mapping.h"
+
+namespace bmusb {
+struct AudioFormat;
+}  // namespace bmusb
+
+namespace Ui {
+class DelayAnalyzer;
+}  // namespace Ui
+
+class QComboBox;
+
+class DelayAnalyzer : public QMainWindow, public DelayAnalyzerInterface
+{
+       Q_OBJECT
+
+public:
+       DelayAnalyzer();
+       ~DelayAnalyzer();
+
+       bool is_grabbing() const override { return grabbing; }
+       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;
+
+private:
+       Ui::DelayAnalyzer *ui;
+       AudioClip clip1, clip2;
+
+       void grab_clicked();
+       void card_selected(QComboBox *card_combo, int selected_index);
+       void channel_selected(QComboBox *channel_combo);
+       DeviceSpec get_selected_device(QComboBox *card_combo);
+
+       std::atomic<bool> grabbing{false};
+       std::map<DeviceSpec, DeviceInfo> devices;
+};
+
+#endif  // !defined(_DELAY_ANALYZER_H)