default profile + display ptt/audio profile
This commit is contained in:
@@ -47,9 +47,9 @@ namespace advsettings {
|
||||
}
|
||||
|
||||
|
||||
void AudioTabController::initStage2(OverlayController * parent, QQuickWindow * widget) {
|
||||
this->parent = parent;
|
||||
this->widget = widget;
|
||||
void AudioTabController::initStage2(OverlayController * var_parent, QQuickWindow * var_widget) {
|
||||
this->parent = var_parent;
|
||||
this->widget = var_widget;
|
||||
|
||||
std::string notifKey = std::string(OverlayController::applicationKey) + ".pptnotification";
|
||||
|
||||
@@ -58,12 +58,12 @@ namespace advsettings {
|
||||
std::string notifIconPath = QApplication::applicationDirPath().toStdString() + "/res/qml/ptt_notification.png";
|
||||
if (QFile::exists(QString::fromStdString(notifIconPath))) {
|
||||
vr::VROverlay()->SetOverlayFromFile(m_ulNotificationOverlayHandle, notifIconPath.c_str());
|
||||
vr::VROverlay()->SetOverlayWidthInMeters(m_ulNotificationOverlayHandle, 0.02f);
|
||||
vr::HmdMatrix34_t notificationTransform = {
|
||||
1.0f, 0.0f, 0.0f, 0.12f,
|
||||
0.0f, 1.0f, 0.0f, 0.08f,
|
||||
0.0f, 0.0f, 1.0f, -0.3f
|
||||
};
|
||||
vr::VROverlay()->SetOverlayWidthInMeters(m_ulNotificationOverlayHandle, 0.02f);
|
||||
vr::HmdMatrix34_t notificationTransform = {{
|
||||
{1.0f, 0.0f, 0.0f, 0.12f},
|
||||
{0.0f, 1.0f, 0.0f, 0.08f},
|
||||
{0.0f, 0.0f, 1.0f, -0.3f}
|
||||
}};
|
||||
vr::VROverlay()->SetOverlayTransformTrackedDeviceRelative(m_ulNotificationOverlayHandle, vr::k_unTrackedDeviceIndex_Hmd, ¬ificationTransform);
|
||||
} else {
|
||||
LOG(ERROR) << "Could not find notification icon \"" << notifIconPath << "\"";
|
||||
@@ -327,25 +327,25 @@ namespace advsettings {
|
||||
emit recordingDeviceListChanged();
|
||||
}
|
||||
|
||||
int AudioTabController::getPlaybackDeviceCount() {
|
||||
return (int)m_playbackDevices.size();
|
||||
int AudioTabController::getPlaybackDeviceCount() {
|
||||
return static_cast<int>(m_playbackDevices.size());
|
||||
}
|
||||
|
||||
QString AudioTabController::getPlaybackDeviceName(int index) {
|
||||
if (index < m_playbackDevices.size()) {
|
||||
return QString::fromStdString(m_playbackDevices[index].second);
|
||||
QString AudioTabController::getPlaybackDeviceName(int index) {
|
||||
if (index > 0 && static_cast<size_t>(index) < m_playbackDevices.size()) {
|
||||
return QString::fromStdString(m_playbackDevices[static_cast<size_t>(index)].second);
|
||||
} else {
|
||||
return "<ERROR>";
|
||||
}
|
||||
}
|
||||
|
||||
int AudioTabController::getRecordingDeviceCount() {
|
||||
return (int)m_recordingDevices.size();
|
||||
int AudioTabController::getRecordingDeviceCount() {
|
||||
return static_cast<int>(m_recordingDevices.size());
|
||||
}
|
||||
|
||||
QString AudioTabController::getRecordingDeviceName(int index) {
|
||||
if (index < m_recordingDevices.size()) {
|
||||
return QString::fromStdString(m_recordingDevices[index].second);
|
||||
if (index > 0 && static_cast<size_t>(index) < m_playbackDevices.size()) {
|
||||
return QString::fromStdString(m_recordingDevices[static_cast<size_t>(index)].second);
|
||||
} else {
|
||||
return "<ERROR>";
|
||||
}
|
||||
@@ -366,12 +366,16 @@ namespace advsettings {
|
||||
|
||||
void AudioTabController::setPlaybackDeviceIndex(int index, bool notify) {
|
||||
if (index != m_playbackDeviceIndex) {
|
||||
if (index < m_playbackDevices.size() && index != m_mirrorDeviceIndex) {
|
||||
if (index > 0 && static_cast<size_t>(index) < m_playbackDevices.size() && index != m_mirrorDeviceIndex) {
|
||||
vr::EVRSettingsError vrSettingsError;
|
||||
//Applys Audio Switch IN VR
|
||||
vr::VRSettings()->SetString(vr::k_pch_audio_Section, vr::k_pch_audio_OnPlaybackDevice_String, m_playbackDevices[index].first.c_str(), &vrSettingsError);
|
||||
vr::VRSettings()->SetString(vr::k_pch_audio_Section,
|
||||
vr::k_pch_audio_OnPlaybackDevice_String,
|
||||
m_playbackDevices[static_cast<size_t>(index)].first.c_str(),
|
||||
&vrSettingsError);
|
||||
if (vrSettingsError != vr::VRSettingsError_None) {
|
||||
LOG(WARNING) << "Could not write \"" << vr::k_pch_audio_OnPlaybackDevice_String << "\" setting: " << vr::VRSettings()->GetSettingsErrorNameFromEnum(vrSettingsError);
|
||||
|
||||
}
|
||||
else {
|
||||
vr::VRSettings()->Sync();
|
||||
@@ -395,14 +399,17 @@ namespace advsettings {
|
||||
vr::VRSettings()->Sync();
|
||||
audioManager->setMirrorDevice("", notify);
|
||||
}
|
||||
} else if (index < m_playbackDevices.size() && index != m_playbackDeviceIndex && index != m_mirrorDeviceIndex) {
|
||||
vr::EVRSettingsError vrSettingsError;
|
||||
vr::VRSettings()->SetString(vr::k_pch_audio_Section, vr::k_pch_audio_OnPlaybackMirrorDevice_String, m_playbackDevices[index].first.c_str(), &vrSettingsError);
|
||||
} else if (index > 0 && static_cast<size_t>(index) < m_playbackDevices.size() && index != m_playbackDeviceIndex && index != m_mirrorDeviceIndex) {
|
||||
vr::EVRSettingsError vrSettingsError;
|
||||
vr::VRSettings()->SetString(vr::k_pch_audio_Section,
|
||||
vr::k_pch_audio_OnPlaybackMirrorDevice_String,
|
||||
m_playbackDevices[static_cast<size_t>(index)].first.c_str(),
|
||||
&vrSettingsError);
|
||||
if (vrSettingsError != vr::VRSettingsError_None) {
|
||||
LOG(WARNING) << "Could not write \"" << vr::k_pch_audio_OnPlaybackMirrorDevice_String << "\" setting: " << vr::VRSettings()->GetSettingsErrorNameFromEnum(vrSettingsError);
|
||||
} else {
|
||||
vr::VRSettings()->Sync();
|
||||
audioManager->setMirrorDevice(m_playbackDevices[index].first, notify);
|
||||
audioManager->setMirrorDevice(m_playbackDevices[static_cast<size_t>(index)].first, notify);
|
||||
}
|
||||
} else if (notify) {
|
||||
emit mirrorDeviceIndexChanged(m_mirrorDeviceIndex);
|
||||
@@ -412,14 +419,14 @@ namespace advsettings {
|
||||
|
||||
void AudioTabController::setMicDeviceIndex(int index, bool notify) {
|
||||
if (index != m_recordingDeviceIndex) {
|
||||
if (index < m_recordingDevices.size()) {
|
||||
vr::EVRSettingsError vrSettingsError;
|
||||
vr::VRSettings()->SetString(vr::k_pch_audio_Section, vr::k_pch_audio_OnRecordDevice_String, m_recordingDevices[index].first.c_str(), &vrSettingsError);
|
||||
if (index > 0 && static_cast<size_t>(index) < m_recordingDevices.size()) {
|
||||
vr::EVRSettingsError vrSettingsError;
|
||||
vr::VRSettings()->SetString(vr::k_pch_audio_Section, vr::k_pch_audio_OnRecordDevice_String, m_recordingDevices[static_cast<size_t>(index)].first.c_str(), &vrSettingsError);
|
||||
if (vrSettingsError != vr::VRSettingsError_None) {
|
||||
LOG(WARNING) << "Could not write \"" << vr::k_pch_audio_OnRecordDevice_String << "\" setting: " << vr::VRSettings()->GetSettingsErrorNameFromEnum(vrSettingsError);
|
||||
} else {
|
||||
vr::VRSettings()->Sync();
|
||||
audioManager->setMicDevice(m_recordingDevices[index].first, notify);
|
||||
vr::VRSettings()->Sync();
|
||||
audioManager->setMicDevice(m_recordingDevices[static_cast<size_t>(index)].first, notify);
|
||||
}
|
||||
} else if (notify) {
|
||||
emit micDeviceIndexChanged(m_recordingDeviceIndex);
|
||||
@@ -518,8 +525,8 @@ namespace advsettings {
|
||||
auto profileCount = settings->beginReadArray("audioProfiles");
|
||||
for (int i = 0; i < profileCount; i++) {
|
||||
settings->setArrayIndex(i);
|
||||
audioProfiles.emplace_back();
|
||||
auto& entry = audioProfiles[i];
|
||||
audioProfiles.emplace_back();
|
||||
auto& entry = audioProfiles[static_cast<size_t>(i)];
|
||||
entry.profileName = settings->value("profileName").toString().toStdString();
|
||||
entry.playbackName = settings->value("playbackName").toString().toStdString();
|
||||
entry.micName = settings->value("micName").toString().toStdString();
|
||||
@@ -551,9 +558,9 @@ namespace advsettings {
|
||||
auto settings = OverlayController::appSettings();
|
||||
settings->beginGroup(getSettingsName());
|
||||
settings->beginWriteArray("audioProfiles");
|
||||
unsigned i = 0;
|
||||
for (auto& p : audioProfiles) {
|
||||
settings->setArrayIndex(i);
|
||||
int i = 0;
|
||||
for (auto& p : audioProfiles) {
|
||||
settings->setArrayIndex(i);
|
||||
settings->setValue("profileName", QString::fromStdString(p.profileName));
|
||||
settings->setValue("playbackName", QString::fromStdString(p.playbackName));
|
||||
settings->setValue("micName", QString::fromStdString(p.micName));
|
||||
@@ -693,9 +700,9 @@ namespace advsettings {
|
||||
}
|
||||
|
||||
|
||||
unsigned AudioTabController::getAudioProfileCount() {
|
||||
return (unsigned)audioProfiles.size();
|
||||
}
|
||||
unsigned AudioTabController::getAudioProfileCount() {
|
||||
return static_cast<unsigned int>(audioProfiles.size());
|
||||
}
|
||||
|
||||
QString AudioTabController::getAudioProfileName(unsigned index) {
|
||||
if (index < audioProfiles.size()) {
|
||||
@@ -712,29 +719,31 @@ namespace advsettings {
|
||||
|
||||
description: Gets proper index value for selecting specific devices.
|
||||
*/
|
||||
int AudioTabController::getPlaybackIndex(std::string str) {
|
||||
for (int i = 0; i < m_playbackDevices.size(); i++) {
|
||||
if (str.compare(m_playbackDevices[i].second)==0) {
|
||||
return i;
|
||||
int AudioTabController::getPlaybackIndex(std::string str) {
|
||||
//Unsigned to avoid two casts. i won't be negative because we only increment it.
|
||||
for (unsigned int i = 0; i < m_playbackDevices.size(); i++) {
|
||||
if (str.compare(m_playbackDevices[i].second)==0) {
|
||||
return static_cast<int>(i);
|
||||
}
|
||||
}
|
||||
return m_playbackDeviceIndex;
|
||||
}
|
||||
|
||||
int AudioTabController::getRecordingIndex(std::string str) {
|
||||
std::lock_guard<std::recursive_mutex> lock(eventLoopMutex);
|
||||
for (int i = 0; i < m_recordingDevices.size(); i++) {
|
||||
if (str.compare(m_recordingDevices[i].second) == 0) {
|
||||
return i;
|
||||
int AudioTabController::getRecordingIndex(std::string str) {
|
||||
//Unsigned to avoid two casts. i won't be negative because we only increment it.
|
||||
for (unsigned int i = 0; i < m_recordingDevices.size(); i++) {
|
||||
if (str.compare(m_recordingDevices[i].second) == 0) {
|
||||
return static_cast<int>(i);
|
||||
}
|
||||
}
|
||||
return m_recordingDeviceIndex;
|
||||
}
|
||||
|
||||
int AudioTabController::getMirrorIndex(std::string str) {
|
||||
for (int i = 0; i < m_playbackDevices.size(); i++) {
|
||||
if (str.compare(m_playbackDevices[i].second) == 0) {
|
||||
return i;
|
||||
//Unsigned to avoid two casts. i won't be negative because we only increment it.
|
||||
for (unsigned int i = 0; i < m_playbackDevices.size(); i++) {
|
||||
if (str.compare(m_playbackDevices[i].second) == 0) {
|
||||
return static_cast<int>(i);
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user