Added combo-boxes to allow audio device selection.

This commit is contained in:
2017-02-13 22:19:42 +01:00
parent 22af8b9633
commit c8d089957d
7 changed files with 699 additions and 134 deletions
+44 -16
View File
@@ -15,12 +15,15 @@ namespace advsettings {
class AudioTabController : public PttController {
Q_OBJECT
Q_PROPERTY(bool mirrorPresent READ mirrorPresent NOTIFY mirrorPresentChanged)
Q_PROPERTY(QString mirrorDevName READ mirrorDevName NOTIFY mirrorDevNameChanged)
Q_PROPERTY(int playbackDeviceIndex READ playbackDeviceIndex WRITE setPlaybackDeviceIndex NOTIFY playbackDeviceIndexChanged)
Q_PROPERTY(int mirrorDeviceIndex READ mirrorDeviceIndex WRITE setMirrorDeviceIndex NOTIFY mirrorDeviceIndexChanged)
//Q_PROPERTY(bool mirrorPresent READ mirrorPresent NOTIFY mirrorPresentChanged)
//Q_PROPERTY(QString mirrorDevName READ mirrorDevName NOTIFY mirrorDevNameChanged)
Q_PROPERTY(float mirrorVolume READ mirrorVolume WRITE setMirrorVolume NOTIFY mirrorVolumeChanged)
Q_PROPERTY(bool mirrorMuted READ mirrorMuted WRITE setMirrorMuted NOTIFY mirrorMutedChanged)
Q_PROPERTY(bool micPresent READ micPresent NOTIFY micPresentChanged)
Q_PROPERTY(QString micDevName READ micDevName NOTIFY micDevNameChanged)
Q_PROPERTY(int micDeviceIndex READ micDeviceIndex WRITE setMicDeviceIndex NOTIFY micDeviceIndexChanged)
//Q_PROPERTY(bool micPresent READ micPresent NOTIFY micPresentChanged)
//Q_PROPERTY(QString micDevName READ micDevName NOTIFY micDevNameChanged)
Q_PROPERTY(float micVolume READ micVolume WRITE setMicVolume NOTIFY micVolumeChanged)
Q_PROPERTY(bool micMuted READ micMuted WRITE setMicMuted NOTIFY micMutedChanged)
@@ -30,19 +33,25 @@ namespace advsettings {
vr::VROverlayHandle_t m_ulNotificationOverlayHandle = vr::k_ulOverlayHandleInvalid;
bool m_mirrorPresent = false;
QString m_mirrorDevName = "<None>";
int m_playbackDeviceIndex = -1;
int m_mirrorDeviceIndex = -1;
//bool m_mirrorPresent = false;
//QString m_mirrorDevName = "<None>";
float m_mirrorVolume = 1.0;
bool m_mirrorMuted = false;
bool m_micPresent = false;
QString m_micDevName = "<None>";
int m_recordingDeviceIndex = -1;
//bool m_micPresent = false;
//QString m_micDevName = "<None>";
float m_micVolume = 1.0;
bool m_micMuted = false;
unsigned settingsUpdateCounter = 0;
std::unique_ptr<AudioManager> audioManager;
std::vector<std::pair<std::string, std::string>> m_recordingDevices;
std::vector<std::pair<std::string, std::string>> m_playbackDevices;
std::string lastMirrorDevId;
QString getSettingsName() override { return "audioSettings"; }
@@ -53,23 +62,37 @@ namespace advsettings {
bool pttChangeValid() override;
virtual vr::VROverlayHandle_t getNotificationOverlayHandle() override { return m_ulNotificationOverlayHandle; }
void findPlaybackDeviceIndex(std::string id, bool notify = true);
void findMirrorDeviceIndex(std::string id, bool notify = true);
void findMicDeviceIndex(std::string id, bool notify = true);
public:
void initStage1();
void initStage2(OverlayController* parent, QQuickWindow* widget);
void eventLoopTick();
bool mirrorPresent() const;
QString mirrorDevName() const;
int playbackDeviceIndex() const;
int mirrorDeviceIndex() const;
float mirrorVolume() const;
bool mirrorMuted() const;
bool micPresent() const;
QString micDevName() const;
int micDeviceIndex() const;
float micVolume() const;
bool micMuted() const;
Q_INVOKABLE int getPlaybackDeviceCount();
Q_INVOKABLE QString getPlaybackDeviceName(int index);
Q_INVOKABLE int getRecordingDeviceCount();
Q_INVOKABLE QString getRecordingDeviceName(int index);
void onNewRecordingDevice();
void onNewPlaybackDevice();
void onNewMirrorDevice();
void onDeviceAdded();
void onDeviceRemoved();
public slots:
void setMirrorVolume(float value, bool notify = true);
@@ -78,16 +101,21 @@ namespace advsettings {
void setMicVolume(float value, bool notify = true);
void setMicMuted(bool value, bool notify = true);
void setPlaybackDeviceIndex(int value, bool notify = true);
void setMirrorDeviceIndex(int value, bool notify = true);
void setMicDeviceIndex(int value, bool notify = true);
signals:
void mirrorPresentChanged(bool value);
void mirrorDevNameChanged(QString value);
void playbackDeviceIndexChanged(int index);
void mirrorDeviceIndexChanged(int index);
void mirrorVolumeChanged(float value);
void mirrorMutedChanged(bool value);
void micPresentChanged(bool value);
void micDevNameChanged(QString value);
void micDeviceIndexChanged(int index);
void micVolumeChanged(float value);
void micMutedChanged(bool value);
};
} // namespace advsettings