blob: aa855e439c598a048f5c1af23a06ca81dace09b8 (
plain)
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
|
// Copyright 2005-2019 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
#ifndef MUMBLE_MUMBLE_WASAPI_H_
#define MUMBLE_MUMBLE_WASAPI_H_
#include <QtCore/QObject>
#include <QtCore/QUuid>
#include <windows.h>
#include <mmreg.h>
#include <strsafe.h>
#include <mmdeviceapi.h>
#include <avrt.h>
#include <audioclient.h>
#include <ksmedia.h>
#include <functiondiscoverykeys.h>
#ifdef _INC_FUNCTIONDISCOVERYKEYS
# undef _INC_FUNCTIONDISCOVERYKEYS
#endif
#include <functiondiscoverykeys_devpkey.h>
#include <propidl.h>
#include <audiopolicy.h>
#include "AudioInput.h"
#include "AudioOutput.h"
class WASAPISystem : public QObject {
private:
Q_OBJECT
Q_DISABLE_COPY(WASAPISystem)
public:
static const QHash<QString, QString> getDevices(EDataFlow dataflow);
static const QHash<QString, QString> getInputDevices();
static const QHash<QString, QString> getOutputDevices();
static const QList<audioDevice> mapToDevice(const QHash<QString, QString>&, const QString&);
};
class WASAPIInput : public AudioInput {
private:
Q_OBJECT
Q_DISABLE_COPY(WASAPIInput)
public:
WASAPIInput();
~WASAPIInput() Q_DECL_OVERRIDE;
void run() Q_DECL_OVERRIDE;
};
class WASAPIOutput : public AudioOutput {
private:
Q_OBJECT
Q_DISABLE_COPY(WASAPIOutput)
bool setVolumeForSessionControl(IAudioSessionControl *control, const DWORD mumblePID, QSet<QUuid> &seen);
bool setVolumeForSessionControl2(IAudioSessionControl2 *control2, const DWORD mumblePID, QSet<QUuid> &seen);
protected:
typedef QPair<float, float> VolumePair;
QMap<ISimpleAudioVolume *, VolumePair> qmVolumes;
void setVolumes(IMMDevice *, bool talking);
public:
WASAPIOutput();
~WASAPIOutput() Q_DECL_OVERRIDE;
void run() Q_DECL_OVERRIDE;
};
#endif
|