-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathportaudiorec.h
executable file
·65 lines (42 loc) · 1.3 KB
/
portaudiorec.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
#ifndef PORTAUDIOREC_H
#define PORTAUDIOREC_H
#include <portaudio.h>
#include <QStringList>
#include <QThread>
class PointerRingBuffer;
#define SAMPLE_RATE (44100)
class PortaudioRec : public QThread
{
public:
PortaudioRec(PointerRingBuffer* rb);
~PortaudioRec();
int startRec(int deviceIndex);
QStringList getInputDeviceList();
int getInputDeviceIndex(QString name);
int getStandardInputDeviceIndex();
QString getDeviceName(int index);
PointerRingBuffer* getRingBuffer() { return this->rb; }
void stop() { Pa_StopStream(stream); this->rb = NULL; }
int myMemberCallback(const void *input, void *,
unsigned long frameCount, const PaStreamCallbackTimeInfo*, PaStreamCallbackFlags);
static int myPaCallback(
const void *input, void *output,
unsigned long frameCount,
const PaStreamCallbackTimeInfo* timeInfo,
PaStreamCallbackFlags statusFlags,
void *userData )
{
return ((PortaudioRec*)userData)
->myMemberCallback(input, output, frameCount, timeInfo, statusFlags);
}
QStringList getHostApiList();
void printDeviceList();
private:
void run();
PaError error;
QString lastError;
PointerRingBuffer* rb;
PaStream* stream;
PaDeviceIndex deviceIndex;
};
#endif // PORTAUDIOREC_H