mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 16:13:28 +02:00
finishing up the wrapper code implementation.
This commit is contained in:
parent
4fb31ad479
commit
bdfb82c072
3 changed files with 40 additions and 9 deletions
libraries/audio-client/src
|
@ -1763,7 +1763,7 @@ bool AudioClient::switchInputToAudioDevice(const QAudioDeviceInfo inputDeviceInf
|
|||
_audioInput = NULL;
|
||||
_numInputCallbackBytes = 0;
|
||||
|
||||
_inputDeviceInfo = HifiAudioDeviceInfo(); //QAudioDeviceInfo();
|
||||
_inputDeviceInfo = HifiAudioDeviceInfo();
|
||||
}
|
||||
|
||||
if (_dummyAudioInput) {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include <QString>
|
||||
|
||||
class HifiAudioDeviceInfo : public QObject {
|
||||
QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
HifiAudioDeviceInfo() {}
|
||||
|
@ -28,12 +28,34 @@ public:
|
|||
void setMode(QAudio::Mode mode);
|
||||
void setIsDefault(bool isDefault = false);
|
||||
void setDeviceName(QString name);
|
||||
void setDevice(QAudioDeviceInfo devInfo) {
|
||||
_audioDeviceInfo = devInfo;
|
||||
setDeviceName();
|
||||
}
|
||||
|
||||
QAudioDeviceInfo getDevice() const { return _audioDeviceInfo; }
|
||||
QString deviceName() const { return _deviceName; }
|
||||
bool isDefault() const { return isDefault; }
|
||||
bool isDefault() const { return _isDefault; }
|
||||
QAudio::Mode getMode() const { return _mode; }
|
||||
|
||||
|
||||
HifiAudioDeviceInfo& operator=(const HifiAudioDeviceInfo& other) {
|
||||
_audioDeviceInfo = other.getDevice();
|
||||
_deviceName = other.deviceName();
|
||||
_mode = other.getMode();
|
||||
_isDefault = other.isDefault();
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator==(const HifiAudioDeviceInfo& rhs) const {
|
||||
return _audioDeviceInfo == rhs.getDevice();
|
||||
}
|
||||
|
||||
bool operator!=(const HifiAudioDeviceInfo& rhs) const {
|
||||
return _audioDeviceInfo != rhs.getDevice();
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
void setDeviceName();
|
||||
|
||||
|
|
|
@ -1,16 +1,25 @@
|
|||
#include "HifiAudioDeviceInfo.h"
|
||||
|
||||
void HifiAudioDeviceInfo::setMode(QAudio::Mode mode) {
|
||||
_mode = mode;
|
||||
setDeviceName();
|
||||
}
|
||||
|
||||
void HifiAudioDeviceInfo::setIsDefault(bool isDefault) {
|
||||
}
|
||||
|
||||
void HifiAudioDeviceInfo::setDeviceName(QString name) {
|
||||
|
||||
isDefault = isDefault;
|
||||
setDeviceName();
|
||||
}
|
||||
|
||||
void HifiAudioDeviceInfo::setDeviceName() {
|
||||
if (isDefault) {
|
||||
if (_mode == QAudio::Mode::AudioInput) {
|
||||
_deviceName = "Default microphone (recommended)";
|
||||
} else {
|
||||
_deviceName = "Default audio (recommended)";
|
||||
}
|
||||
} else {
|
||||
_deviceName = _audioDeviceInfo.deviceName();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in a new issue