-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathGenerator.h
56 lines (42 loc) · 1.01 KB
/
Generator.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
#ifndef GENERATOR_H
#define GENERATOR_H
#include <QtCore/QIODevice>
#include <QtCore/QTime>
class Generator : public QIODevice
{
Q_OBJECT
public:
Generator(float secs = .5, int freq=500);
Generator(Generator *copyFrom);
~Generator();
void appendDataFrom(const Generator *copyFrom);
void start();
void stop();
QTime timeLeft();
void clearBuffer();
void restartPauses();
void setupPauses();
qint64 bytesAvailable() const;
char *t;
int len;
int pos;
char *buffer;
bool finished;
int chunk_size;
int m_freq;
int m_zerocount;
qint64 bytes_left;
signals:
void generatorDone();
public slots:
void restartData();
qint64 readData(char *data, qint64 maxlen);
qint64 writeData(const char *data, qint64 len);
private:
int putShort(char *t, unsigned int value);
int fillData(char *start, int frequency, float seconds);
bool isGenerating;
bool play_silent;
int max_read;
};
#endif // GENERATOR_H