-
Notifications
You must be signed in to change notification settings - Fork 0
/
audioinfo.h
executable file
·77 lines (61 loc) · 1.91 KB
/
audioinfo.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef AUDIOINFO_H
#define AUDIOINFO_H
#include <QIODevice>
#include <QAudioFormat>
#include <QVector>
#include <QQueue>
class AudioInfo : public QIODevice
{
Q_OBJECT
public:
AudioInfo(const QAudioFormat &format, QObject *parent);
~AudioInfo();
QIODevice * start(QIODevice *);
QIODevice * start();
void stop();
qreal level() const { return m_level; }
qint64 readData(char *data, qint64 maxlen);
qint64 writeData(const char *data, qint64 len);
quint16 getMaxAmplitude(){return m_maxAmplitude;}
void isNeedSaveTmpFiles(bool val){ m_isNeedSaveTmpFiles=val; }
void switchAutoMod(bool val){ m_isAuto = val; }
void setOverK(double val){ kOverValue = val;}
void recalc();
void setIT1(int val){ kIT1 = val; recalc();}
void setITstep1(int val){ kITstep1 = val; recalc();}
void setIT2(int val){ kIT2 = val; recalc();}
void setITstep2(int val){ kITstep2 = val; recalc();}
void setDelay(int val){ kDelay = val; recalc();}
int calculateNoiseLevel();
void setTmpFileName(QString fname){ this->tmpFileName = fname;}
private:
void setArgs();
bool m_isNeedSaveTmpFiles;
void saveToFile();
void calculate(int);
bool isCriticalOver;
int criticalValue;
double kOverValue;
int counter1, counter2;
int kIT1, kITstep1, kIT2, kITstep2, kDelay;
int firstPeriod, secondPeriod;
int firstPeriodStep, secondPeriodStep;
QVector<int> * firstStepValues;
QVector<int> * secondStepValues;
QVector<int> * bufferedValues;
QVector<int> * firstStepValuesBuf;
void clearBuffers();
int tempMaxBuff;
QQueue<QByteArray> * tempBuff;
bool m_isAuto;
bool m_isNeedSaveFile;
QIODevice * underlyingDevice;
const QAudioFormat m_format;
quint16 m_maxAmplitude;
qreal m_level; // 0.0 <= m_level <= 1.0
QString tmpFileName;
signals:
void update();
void needToStop();
};
#endif // AUDIOINFO_H