Improved handling of audio subsystem delays

This commit is contained in:
ftc
2021-01-06 12:13:14 +03:00
parent 2440d0aa3f
commit 0a3947ebf2
6 changed files with 104 additions and 71 deletions
+11
View File
@@ -3,6 +3,8 @@
#include <QAudioDeviceInfo>
#include "fft.h"
enum MeasureChannel
{
Left,
@@ -11,15 +13,24 @@ enum MeasureChannel
class Measurer
{
// frequency for generating tone
const int TONE_FREQUENCY = 6000;
// frequency window width to search for resulting tone
const int FREQUENCY_GAP = 100;
// our resulting amplitude should differ at least this times from average
// to be considered as measured signal
const float PEAK_LEVEL = 1.0;
//
const int SAMPLE_RATE = 44100;
const float SILENCE_LEVEL = 0.3;
const float INITIAL_DELAY_PERCENTAGE = 0.3;
MeasureChannel channel;
QAudioDeviceInfo input, output;
bool debug;
float ProcessData(QByteArray data);
float ProcessSpectrum(int pow, Complex* d);
public:
Measurer(QAudioDeviceInfo input, QAudioDeviceInfo output, MeasureChannel channel, bool debug);
float Measure(float duration);