-
Notifications
You must be signed in to change notification settings - Fork 4
/
audio.h
62 lines (45 loc) · 1.04 KB
/
audio.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
#ifndef AUDIO_H
#define AUDIO_H
//windows下的CoreAudio技术
#ifdef WIN32
#define _WIN_COMPILE
#endif
#ifdef _WIN_COMPILE
#include <Windows.h>
#include <initguid.h>
#include <MMDeviceAPI.h>
#include <AudioClient.h> //WSAPI
#include <AudioPolicy.h> //WSAPI
#endif
#include <QObject>
class Audio: public QObject
{
Q_OBJECT
public:
Audio();
~Audio();
quint8 *pBuffer = NULL;
void initAudio();
void uninitAudio();
signals:
void collectData(QByteArray );
public slots:
void record();
void stopRecord();
void startRecord();
private:
#ifdef _WIN_COMPILE
IAudioClient * _AudioClient = NULL;
IAudioCaptureClient *_CaptureClient = NULL;
IMMDevice * _Device = NULL;
IMMDeviceEnumerator * _DeviceEnumerator = NULL;
HANDLE _AudioSamplesReadyEvent = NULL;
WAVEFORMATEX * _MixFormat = NULL;
HRESULT hr;
size_t _FrameSize;
UINT bufferFrameCount;
#endif
// BYTE *pBuffer;
bool recording;
};
#endif // AUDIO_H