-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwavedata.h
63 lines (51 loc) · 1.39 KB
/
wavedata.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
#ifndef WAVEDATA_H
#define WAVEDATA_H
#include <QThread>
#include <QFile>
#include <QVector>
#include <QReadWriteLock>
#define MAXCHANNEL 2
class WaveData : public QThread
{
Q_OBJECT
public:
WaveData();
~WaveData();
void FileOpen(QFile *newFile);
QString FileName() { return fileloaded ? file->fileName() : ""; }
qint64 Length();
int Count();
int Channel() { return channel; }
QVector<int> Data(uint count, qint64 newpos = -1);
qint64 Pos() { return _pos; }
void SetPos( qint64 newpos ) { _pos = newpos; }
uint DotWidth () { return dotwidth; }
void SetDotWidth ( uint newwidth ) { dotwidth = newwidth; }
int MaxClip() { return maxclip; }
void setDebugNr(int nr) { debugnr = nr; }
void Clear() { if (isworking) { breakWork = true; } else { lastdata.clear(); } }
void setSamplesize(int newSamplesize) { samplesize = newSamplesize; }
bool SampleSize() { return samplesize; }
void run();
signals:
void CanReadNow();
private:
void read(qlonglong pos, int count);
QReadWriteLock lock;
bool isworking;
bool fileloaded;
bool breakWork;
QFile *file;
qint64 _headersize;
qint64 _pos;
QVector<int> lastdata;
qint64 lastpos;
uint lastcount;
uint lastwidth;
uint channel, samplesize, dotwidth;
int maxclip;
qlonglong readpos;
int readcount;
int debugnr;
};
#endif // WAVEDATA_H