* update qt6 upgrade progress

* add flawed addition for QRenderTarget and link needed libs

* update to better logging format

* move many assets and qml files into qrc

* get rid of deprecation messages

* remove additional deprecation notices

* make Qt6 finally render on desktop with some progress on vr

* initialize QRhi with QQuickRenderControl

* use default values to stop SegFaults

* fix compilation on windows

* add windows files for aiding in running exe

* fix formatting of testing qt.conf

* first attempt on using textures instead of files in AudioTabController

* Fix public/private access issue

---------

Co-authored-by: RTUnreal <unreal@rtinf.net>
This commit is contained in:
ykeara
2024-04-03 22:49:24 -05:00
committed by GitHub
co-authored by RTUnreal
parent 72e91e9116
commit ca0ec3e07d
109 changed files with 1558 additions and 9421 deletions
+98 -106
View File
@@ -1,6 +1,8 @@
#include "AudioTabController.h"
#include <QQuickWindow>
#include <QApplication>
#include <QtLogging>
#include <QtDebug>
#include "../overlaycontroller.h"
#include "../settings/settings.h"
#include "../settings/settings_object.h"
@@ -39,11 +41,11 @@ void AudioTabController::initStage1()
&vrSettingsError );
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( WARNING ) << "Could not read \""
<< vr::k_pch_audio_PlaybackMirrorDevice_String
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
qWarning() << "Could not read \""
<< vr::k_pch_audio_PlaybackMirrorDevice_String
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
}
else
{
@@ -63,8 +65,9 @@ void AudioTabController::initStage1()
eventLoopTick();
}
void AudioTabController::initStage2()
void AudioTabController::initStage2( OverlayController* var_parent )
{
this->parent = var_parent;
const auto pushToTalkOverlayKey
= std::string( application_strings::applicationKey )
+ ".pptnotification";
@@ -75,43 +78,40 @@ void AudioTabController::initStage2()
&m_pushToTalkValues.overlayHandle );
if ( overlayError != vr::VROverlayError_None )
{
LOG( ERROR ) << "Could not create ptt notification overlay: "
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
overlayError );
qCritical() << "Could not create ptt notification overlay: "
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
overlayError );
emit defaultProfileDisplay();
return;
}
constexpr auto pushToTalkIconFilepath
= "/res/img/audio/microphone/ptt_notification.png";
constexpr auto pushToMuteIconFilepath
= "/res/img/audio/microphone/ptm_notification.png";
QImage pushToTalkIcon;
Q_ASSERT( pushToTalkIcon.load(
QString( "qrc:/res/img/audio/microphone/ptt_notification.png" ) ) );
QImage pushToMuteIcon;
Q_ASSERT( pushToMuteIcon.load(
QString( "qrc:/res/img/audio/microphone/ptt_notification.png" ) ) );
const auto pushToTalkIconFilePath
= paths::verifyIconFilePath( pushToTalkIconFilepath );
const auto pushToMuteIconFilePath
= paths::verifyIconFilePath( pushToMuteIconFilepath );
emit defaultProfileDisplay();
return;
if ( !pushToTalkIconFilePath.has_value()
|| !pushToMuteIconFilePath.has_value() )
{
emit defaultProfileDisplay();
return;
}
auto* rhi = parent->m_renderControl.rhi();
m_pushToTalkValues.pushToTalkTex.reset(
rhi->newTexture( QRhiTexture::RGBA8, pushToTalkIcon.size(), 1 ) );
m_pushToTalkValues.pushToMuteTex.reset(
rhi->newTexture( QRhiTexture::RGBA8, pushToTalkIcon.size(), 1 ) );
m_pushToTalkValues.pushToTalkPath = *pushToTalkIconFilePath;
m_pushToTalkValues.pushToMutePath = *pushToMuteIconFilePath;
auto pushToPath = m_pushToTalkValues.pushToTalkPath.c_str();
auto* pushToTex = m_pushToTalkValues.pushToTalkTex.get();
if ( settings::getSetting( settings::BoolSetting::AUDIO_micReversePtt ) )
{
pushToPath = m_pushToTalkValues.pushToMutePath.c_str();
pushToTex = m_pushToTalkValues.pushToMuteTex.get();
}
vr::VROverlay()->SetOverlayFromFile( m_pushToTalkValues.overlayHandle,
pushToPath );
auto tex = parent->vrTextureFromRhiTexture( *pushToTex );
vr::VROverlay()->SetOverlayTexture( m_pushToTalkValues.overlayHandle,
&tex );
vr::VROverlay()->SetOverlayWidthInMeters( m_pushToTalkValues.overlayHandle,
0.02f );
vr::HmdMatrix34_t notificationTransform
@@ -196,11 +196,11 @@ void AudioTabController::eventLoopTick()
&vrSettingsError );
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( WARNING ) << "Could not read \""
<< vr::k_pch_audio_PlaybackMirrorDevice_String
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
qWarning() << "Could not read \""
<< vr::k_pch_audio_PlaybackMirrorDevice_String
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
}
if ( lastMirrorDevId.compare( mirrorDeviceId ) != 0 )
{
@@ -358,15 +358,11 @@ void AudioTabController::setMicReversePtt( bool value, bool notify )
if ( value )
{
vr::VROverlay()->SetOverlayFromFile(
m_pushToTalkValues.overlayHandle,
m_pushToTalkValues.pushToMutePath.c_str() );
// vr::VROverlay()->SetOverlayFromFile(m_ptt_overlayHandle,/*pt_mute*/);
}
else
{
vr::VROverlay()->SetOverlayFromFile(
m_pushToTalkValues.overlayHandle,
m_pushToTalkValues.pushToTalkPath.c_str() );
// vr::VROverlay()->SetOverlayFromFile(m_ptt_overlayHandle,/*pt_talk*/);
}
if ( pttEnabled() )
@@ -447,17 +443,17 @@ bool indexIsValid( const int index,
{
if ( index < 0 )
{
LOG( ERROR ) << functionName
<< " called with index below zero: " << index;
qCritical() << functionName
<< " called with index below zero: " << index;
return false;
}
if ( static_cast<size_t>( index ) >= devices.size() )
{
LOG( ERROR ) << functionName
<< " called with index greater than size of "
"devices '"
<< devices.size() << "', index '" << index << "'.";
qCritical() << functionName
<< " called with index greater than size of "
"devices '"
<< devices.size() << "', index '" << index << "'.";
return false;
}
@@ -571,12 +567,11 @@ void AudioTabController::setMirrorDeviceIndex( int index, bool notify )
&vrSettingsError );
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( WARNING )
<< "Could not remove \""
<< vr::k_pch_audio_PlaybackMirrorDevice_String
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
qWarning() << "Could not remove \""
<< vr::k_pch_audio_PlaybackMirrorDevice_String
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
}
else
{
@@ -596,12 +591,11 @@ void AudioTabController::setMirrorDeviceIndex( int index, bool notify )
&vrSettingsError );
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( WARNING )
<< "Could not write \""
<< vr::k_pch_audio_PlaybackMirrorDevice_String
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
qWarning() << "Could not write \""
<< vr::k_pch_audio_PlaybackMirrorDevice_String
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
}
else
{
@@ -883,12 +877,11 @@ void AudioTabController::deleteAudioProfile( unsigned index )
&vrSettingsError );
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( WARNING )
<< "Could not remove \""
<< vr::k_pch_audio_PlaybackDeviceOverrideName_String
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
qWarning() << "Could not remove \""
<< vr::k_pch_audio_PlaybackDeviceOverrideName_String
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
}
vr::VRSettings()->RemoveKeyInSection(
@@ -897,12 +890,11 @@ void AudioTabController::deleteAudioProfile( unsigned index )
&vrSettingsError );
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( WARNING )
<< "Could not remove \""
<< vr::k_pch_audio_RecordingDeviceOverrideName_String
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
qWarning() << "Could not remove \""
<< vr::k_pch_audio_RecordingDeviceOverrideName_String
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
}
}
audioProfiles.erase( pos );
@@ -936,9 +928,9 @@ void AudioTabController::setPlaybackOverride( bool value, bool notify )
&vrSettingsError );
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( ERROR ) << "Could not set playback override setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
qCritical() << "Could not set playback override setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
}
if ( notify )
{
@@ -959,9 +951,9 @@ void AudioTabController::setRecordingOverride( bool value, bool notify )
&vrSettingsError );
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( ERROR ) << "Could not set recording override setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
qCritical() << "Could not set recording override setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
}
if ( notify )
{
@@ -979,10 +971,10 @@ void AudioTabController::initOverride()
&vrSettingsError );
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( ERROR ) << "Could not get recording override setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
LOG( INFO ) << "Setting recording override to false";
qCritical() << "Could not get recording override setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
qInfo() << "Setting recording override to false";
setRecordingOverride( false );
}
else
@@ -995,10 +987,10 @@ void AudioTabController::initOverride()
&vrSettingsError );
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( ERROR ) << "Could not get playback override setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
LOG( INFO ) << "Setting playback override to false";
qCritical() << "Could not get playback override setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
qInfo() << "Setting playback override to false";
setPlaybackOverride( false );
}
else
@@ -1091,11 +1083,11 @@ void AudioTabController::setDefaultPlayback( int index, bool notify )
&vrSettingsError );
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( WARNING ) << "Could not write \""
<< vr::k_pch_audio_PlaybackDeviceOverrideName_String
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
qWarning() << "Could not write \""
<< vr::k_pch_audio_PlaybackDeviceOverrideName_String
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
}
else
{
@@ -1114,11 +1106,11 @@ void AudioTabController::setDefaultMic( int index, bool notify )
&vrSettingsError );
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( WARNING ) << "Could not write \""
<< vr::k_pch_audio_RecordingDeviceOverrideName_String
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
qWarning() << "Could not write \""
<< vr::k_pch_audio_RecordingDeviceOverrideName_String
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
}
else
{
@@ -1138,11 +1130,11 @@ void AudioTabController::setDefaultMirror( int index, bool notify )
&vrSettingsError );
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( WARNING ) << "Could not remove \""
<< vr::k_pch_audio_PlaybackMirrorDevice_String
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
qWarning() << "Could not remove \""
<< vr::k_pch_audio_PlaybackMirrorDevice_String
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
}
else
{
@@ -1159,11 +1151,11 @@ void AudioTabController::setDefaultMirror( int index, bool notify )
&vrSettingsError );
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( WARNING ) << "Could not write \""
<< vr::k_pch_audio_PlaybackMirrorDevice_String
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
qWarning() << "Could not write \""
<< vr::k_pch_audio_PlaybackMirrorDevice_String
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
}
else
{
@@ -1258,7 +1250,7 @@ void AudioTabController::shutdown()
{
setMirrorDeviceIndex( -1 );
}
LOG( INFO ) << "Audio Tab Controller Has Shut Down";
qInfo() << "Audio Tab Controller Has Shut Down";
}
bool AudioTabController::pttEnabled() const
+5 -3
View File
@@ -5,6 +5,7 @@
#include "audiomanager/AudioManager.h"
#include <memory>
#include <rhi/qrhi.h>
#include "../utils/FrameRateUtils.h"
#include "../settings/settings_object.h"
@@ -111,11 +112,12 @@ class AudioTabController : public QObject
setPttShowNotification NOTIFY pttShowNotificationChanged )
private:
OverlayController* parent;
struct
{
vr::VROverlayHandle_t overlayHandle = vr::k_ulOverlayHandleInvalid;
std::string pushToTalkPath;
std::string pushToMutePath;
std::unique_ptr<QRhiTexture> pushToTalkTex;
std::unique_ptr<QRhiTexture> pushToMuteTex;
} m_pushToTalkValues;
int m_playbackDeviceIndex = -1;
@@ -178,7 +180,7 @@ private:
public:
void initStage1();
void initStage2();
void initStage2( OverlayController* var_parent );
void reloadAudioSettings();
+18 -17
View File
@@ -1,5 +1,7 @@
#include "ChaperoneTabController.h"
#include <QQuickWindow>
#include <QtLogging>
#include <QtDebug>
#include "../overlaycontroller.h"
#include "../settings/settings.h"
#include "../utils/Matrix.h"
@@ -182,7 +184,7 @@ void ChaperoneTabController::handleChaperoneWarnings( float distance )
// Alarm Sound
if ( isChaperoneAlarmSoundEnabled() )
{
// LOG(WARNING) << "In alarm";
qWarning() << "In alarm";
float activationDistance = chaperoneAlarmSoundDistance();
if ( distance <= activationDistance && proxSensorOverrideState )
@@ -763,12 +765,12 @@ void ChaperoneTabController::setChaperoneColorR( int value, bool notify )
if ( value > 255 )
{
value = 255;
LOG( WARNING ) << "Red Channel larger than 255, setting to 255";
qWarning() << "Red Channel larger than 255, setting to 255";
}
else if ( value < 0 )
{
value = 0;
LOG( WARNING ) << "Red Channel smaller than 0, setting to 0";
qWarning() << "Red Channel smaller than 0, setting to 0";
}
m_chaperoneColorR = value;
ovr_settings_wrapper::setInt32(
@@ -791,12 +793,12 @@ void ChaperoneTabController::setChaperoneColorG( int value, bool notify )
if ( value > 255 )
{
value = 255;
LOG( WARNING ) << "Green Channel larger than 255, setting to 255";
qWarning() << "Green Channel larger than 255, setting to 255";
}
else if ( value < 0 )
{
value = 0;
LOG( WARNING ) << "Green Channel smaller than 0, setting to 0";
qWarning() << "Green Channel smaller than 0, setting to 0";
}
m_chaperoneColorG = value;
ovr_settings_wrapper::setInt32(
@@ -819,12 +821,12 @@ void ChaperoneTabController::setChaperoneColorB( int value, bool notify )
if ( value > 255 )
{
value = 255;
LOG( WARNING ) << "Blue Channel larger than 255, setting to 255";
qWarning() << "Blue Channel larger than 255, setting to 255";
}
else if ( value < 0 )
{
value = 0;
LOG( WARNING ) << "Blue Channel smaller than 0, setting to 0";
qWarning() << "Blue Channel smaller than 0, setting to 0";
}
m_chaperoneColorB = value;
ovr_settings_wrapper::setInt32(
@@ -855,12 +857,12 @@ void ChaperoneTabController::setChaperoneColorA( int value, bool notify )
if ( value > 255 )
{
value = 255;
LOG( WARNING ) << "Alpha Channel larger than 255, setting to 255";
qWarning() << "Alpha Channel larger than 255, setting to 255";
}
else if ( value < 0 )
{
value = 0;
LOG( WARNING ) << "Alpha Channel smaller than 0, setting to 0";
qWarning() << "Alpha Channel smaller than 0, setting to 0";
}
m_chaperoneColorA = value;
ovr_settings_wrapper::setInt32(
@@ -926,14 +928,13 @@ void ChaperoneTabController::setCollisionBoundStyle( int value,
if ( vr::COLLISION_BOUNDS_STYLE_COUNT < value )
{
value = 0;
LOG( WARNING )
qWarning()
<< "Invalid Collision Bound Value (>count), set to beginner";
}
else if ( value < 0 )
{
value = 0;
LOG( WARNING )
<< "Invalid Collision Bound Value (<0), set to beginner";
qWarning() << "Invalid Collision Bound Value (<0), set to beginner";
}
if ( !isTemp )
{
@@ -1468,7 +1469,7 @@ void ChaperoneTabController::createNewAutosaveProfile()
}
else
{
LOG( INFO )
qInfo()
<< "[Chaperone Autosave] «Autosaved Profile (previous)» not found";
}
@@ -1484,7 +1485,7 @@ void ChaperoneTabController::createNewAutosaveProfile()
}
else
{
LOG( INFO ) << "[Chaperone Autosave] «Autosaved Profile» not found";
qInfo() << "[Chaperone Autosave] «Autosaved Profile» not found";
}
// create a new autosave from current chaperone (all options set true)
@@ -1515,8 +1516,8 @@ void ChaperoneTabController::applyAutosavedProfile()
}
else
{
LOG( WARNING ) << "Failed to apply chaperone Autosaved Profile "
"(autosave doesn't exist)";
qWarning() << "Failed to apply chaperone Autosaved Profile "
"(autosave doesn't exist)";
}
}
@@ -1629,7 +1630,7 @@ void ChaperoneTabController::initCenterMarkerOverlay()
}
else
{
LOG( ERROR ) << "overlay Not initialized";
qCritical() << "overlay Not initialized";
// TODO Set Failure variable.
}
}
+12 -11
View File
@@ -1,5 +1,7 @@
#include "FixFloorTabController.h"
#include <QQuickWindow>
#include <QtLogging>
#include <QtDebug>
#include "../overlaycontroller.h"
// application namespace
@@ -153,7 +155,7 @@ void FixFloorTabController::dashboardLoopTick(
/*
floorOffsetY = static_cast<float>(tempOffsetY);
LOG(INFO) << "Offset For Knuckles up is: " <<
qInfo() << "Offset For Knuckles up is: " <<
floorOffsetY;
*/
}
@@ -183,7 +185,7 @@ void FixFloorTabController::dashboardLoopTick(
/*
floorOffsetY = static_cast<float>(tempOffsetY);
LOG(INFO) << "Offset For Knuckles up is: " <<
qInfo() << "Offset For Knuckles up is: " <<
floorOffsetY;
*/
}
@@ -196,10 +198,9 @@ void FixFloorTabController::dashboardLoopTick(
floorOffsetX = static_cast<float>( tempOffsetX );
floorOffsetZ = static_cast<float>( tempOffsetZ );
LOG( INFO )
<< "Fix Floor and adjust space center: Floor Offset = ["
<< floorOffsetX << ", " << floorOffsetY << ", "
<< floorOffsetZ << "]";
qInfo() << "Fix Floor and adjust space center: Floor Offset = ["
<< floorOffsetX << ", " << floorOffsetY << ", "
<< floorOffsetZ << "]";
float offset[3] = { 0, 0, 0 };
offset[1] = floorOffsetY;
if ( state == 2 )
@@ -243,12 +244,12 @@ int FixFloorTabController::getControllerType(
&error );
if ( error != vr::TrackedProp_Success )
{
LOG( ERROR ) << "Error With Controller Type: "
<< vr::VRSystem()->GetPropErrorNameFromEnum( error );
qCritical() << "Error With Controller Type: "
<< vr::VRSystem()->GetPropErrorNameFromEnum( error );
}
else if ( stringLength == 0 )
{
LOG( ERROR ) << "Device Index not valid";
qCritical() << "Device Index not valid";
}
else if ( strcmp( controllerTypeString, "knuckles" ) == 0 )
{
@@ -308,8 +309,8 @@ void FixFloorTabController::undoFixFloorClicked()
{
float off[3] = { -floorOffsetX, -floorOffsetY, -floorOffsetZ };
parent->m_moveCenterTabController.addOffset( off );
LOG( INFO ) << "Fix Floor: Undo Floor Offset = [" << -floorOffsetX << ", "
<< -floorOffsetY << ", " << -floorOffsetZ << "]";
qInfo() << "Fix Floor: Undo Floor Offset = [" << -floorOffsetX << ", "
<< -floorOffsetY << ", " << -floorOffsetZ << "]";
floorOffsetY = 0.0f;
statusMessage = "Undo ... OK";
statusMessageTimeout = 1.0;
+91 -97
View File
@@ -1,5 +1,7 @@
#include "MoveCenterTabController.h"
#include <QQuickWindow>
#include <QtLogging>
#include <QtDebug>
#include "../overlaycontroller.h"
#include "../quaternion/quaternion.h"
#include "../settings/settings.h"
@@ -116,10 +118,10 @@ void MoveCenterTabController::applyOffsetProfile( unsigned index )
emit offsetXChanged( m_offsetX );
emit offsetYChanged( m_offsetY );
emit offsetZChanged( m_offsetZ );
LOG( INFO ) << "Applying Offset Profile:" << profile.profileName
<< " X:" << m_offsetX << " Y:" << m_offsetY
<< " Z:" << m_offsetZ << " Rotation:"
<< ( static_cast<float>( m_rotation ) / 100 );
qInfo() << "Applying Offset Profile:" << profile.profileName
<< " X:" << m_offsetX << " Y:" << m_offsetY
<< " Z:" << m_offsetZ
<< " Rotation:" << ( static_cast<float>( m_rotation ) / 100 );
}
}
@@ -168,10 +170,10 @@ void MoveCenterTabController::outputLogPoses()
vr::HmdMatrix34_t hmdStanding
= devicePosesStanding[0].mDeviceToAbsoluteTracking;
LOG( INFO ) << "";
LOG( INFO ) << " ____Begin Matrices Log Ouput__________";
LOG( INFO ) << "|";
LOG( INFO ) << "HMD POSE (standing universe)";
qInfo() << "";
qInfo() << " ____Begin Matrices Log Ouput__________";
qInfo() << "|";
qInfo() << "HMD POSE (standing universe)";
outputLogHmdMatrix( hmdStanding );
vr::TrackedDevicePose_t devicePosesSeated[vr::k_unMaxTrackedDeviceCount];
@@ -185,7 +187,7 @@ void MoveCenterTabController::outputLogPoses()
vr::HmdMatrix34_t hmdSeated
= devicePosesSeated[0].mDeviceToAbsoluteTracking;
LOG( INFO ) << "HMD POSE (seated universe)";
qInfo() << "HMD POSE (seated universe)";
outputLogHmdMatrix( hmdSeated );
auto leftHand = vr::VRSystem()->GetTrackedDeviceIndexForControllerRole(
@@ -198,70 +200,65 @@ void MoveCenterTabController::outputLogPoses()
vr::HmdMatrix34_t rightHandMatrix
= devicePosesStanding[rightHand].mDeviceToAbsoluteTracking;
LOG( INFO ) << "LEFT Hand Controller Pose (standing universe)";
qInfo() << "LEFT Hand Controller Pose (standing universe)";
outputLogHmdMatrix( leftHandMatrix );
LOG( INFO ) << "RIGHT Hand Controller Pose (standing universe)";
qInfo() << "RIGHT Hand Controller Pose (standing universe)";
outputLogHmdMatrix( rightHandMatrix );
vr::HmdMatrix34_t standingZero;
vr::VRChaperoneSetup()->GetWorkingStandingZeroPoseToRawTrackingPose(
&standingZero );
LOG( INFO ) << "GetWorkingStandingZeroPoseToRawTrackingPose";
qInfo() << "GetWorkingStandingZeroPoseToRawTrackingPose";
outputLogHmdMatrix( standingZero );
vr::HmdMatrix34_t seatedZero;
vr::VRChaperoneSetup()->GetWorkingSeatedZeroPoseToRawTrackingPose(
&seatedZero );
LOG( INFO ) << "GetWorkingSeatedZeroPoseToRawTrackingPose";
qInfo() << "GetWorkingSeatedZeroPoseToRawTrackingPose";
outputLogHmdMatrix( seatedZero );
vr::HmdMatrix34_t seatedZeroLive;
vr::VRChaperoneSetup()->GetLiveSeatedZeroPoseToRawTrackingPose(
&seatedZeroLive );
LOG( INFO ) << "GetLiveSeatedZeroPoseToRawTrackingPose";
qInfo() << "GetLiveSeatedZeroPoseToRawTrackingPose";
outputLogHmdMatrix( seatedZeroLive );
vr::HmdMatrix34_t seatedToStandingAbsolute
= vr::VRSystem()->GetSeatedZeroPoseToStandingAbsoluteTrackingPose();
LOG( INFO ) << "GetSeatedZeroPoseToStandingAbsoluteTrackingPose";
qInfo() << "GetSeatedZeroPoseToStandingAbsoluteTrackingPose";
outputLogHmdMatrix( seatedToStandingAbsolute );
LOG( INFO ) << "m_universeCenterForReset";
qInfo() << "m_universeCenterForReset";
outputLogHmdMatrix( m_universeCenterForReset );
LOG( INFO ) << "m_seatedCenterForReset";
qInfo() << "m_seatedCenterForReset";
outputLogHmdMatrix( m_seatedCenterForReset );
LOG( INFO ) << "|____End Matrices Log Ouput____________";
LOG( INFO ) << "";
qInfo() << "|____End Matrices Log Ouput____________";
qInfo() << "";
}
void MoveCenterTabController::outputLogHmdMatrix( vr::HmdMatrix34_t hmdMatrix )
{
LOG( INFO ) << hmdMatrix.m[0][0] << "\t\t\t" << hmdMatrix.m[0][1]
<< "\t\t\t" << hmdMatrix.m[0][2] << "\t\t\t"
<< hmdMatrix.m[0][3];
LOG( INFO ) << hmdMatrix.m[1][0] << "\t\t\t" << hmdMatrix.m[1][1]
<< "\t\t\t" << hmdMatrix.m[1][2] << "\t\t\t"
<< hmdMatrix.m[1][3];
LOG( INFO ) << hmdMatrix.m[2][0] << "\t\t\t" << hmdMatrix.m[2][1]
<< "\t\t\t" << hmdMatrix.m[2][2] << "\t\t\t"
<< hmdMatrix.m[2][3];
qInfo() << hmdMatrix.m[0][0] << "\t\t\t" << hmdMatrix.m[0][1] << "\t\t\t"
<< hmdMatrix.m[0][2] << "\t\t\t" << hmdMatrix.m[0][3];
qInfo() << hmdMatrix.m[1][0] << "\t\t\t" << hmdMatrix.m[1][1] << "\t\t\t"
<< hmdMatrix.m[1][2] << "\t\t\t" << hmdMatrix.m[1][3];
qInfo() << hmdMatrix.m[2][0] << "\t\t\t" << hmdMatrix.m[2][1] << "\t\t\t"
<< hmdMatrix.m[2][2] << "\t\t\t" << hmdMatrix.m[2][3];
float atan2Yaw = std::atan2( hmdMatrix.m[0][2], hmdMatrix.m[2][2] );
LOG( INFO ) << "atan2 Yaw Calculation: " << atan2Yaw << "radians "
<< ( ( static_cast<double>( atan2Yaw )
* k_radiansToCentidegrees )
/ 100 )
<< "degrees";
qInfo() << "atan2 Yaw Calculation: " << atan2Yaw << "radians "
<< ( ( static_cast<double>( atan2Yaw ) * k_radiansToCentidegrees )
/ 100 )
<< "degrees";
vr::HmdQuaternion_t hmdQuat = quaternion::fromHmdMatrix34( hmdMatrix );
double hmdQuatYaw = quaternion::getYaw( hmdQuat );
LOG( INFO ) << "Quaternion Yaw Calculation: " << hmdQuatYaw << "radians "
<< ( ( hmdQuatYaw * k_radiansToCentidegrees ) / 100 )
<< "degrees";
LOG( INFO ) << "";
qInfo() << "Quaternion Yaw Calculation: " << hmdQuatYaw << "radians "
<< ( ( hmdQuatYaw * k_radiansToCentidegrees ) / 100 ) << "degrees";
qInfo() << "";
}
int MoveCenterTabController::trackingUniverse() const
@@ -283,7 +280,7 @@ void MoveCenterTabController::setTrackingUniverse( int value, bool notify )
if ( notify )
{
emit trackingUniverseChanged( m_trackingUniverse );
LOG( INFO ) << "Tracking Universe: " << m_trackingUniverse;
qInfo() << "Tracking Universe: " << m_trackingUniverse;
}
}
}
@@ -914,19 +911,19 @@ void MoveCenterTabController::incomingZeroReset()
// aspects) IN mixed tracking environments I get this issue, the check if
// there is an error and apply autosaved profile is hopefully a workaround
auto calState = vr::VRChaperone()->GetCalibrationState();
LOG( INFO ) << "Calibration State on Zero Reset is: " << calState;
qInfo() << "Calibration State on Zero Reset is: " << calState;
// If we detect a seated Recenter and are not currently in process
// we reload chaperone from disk
if ( m_recenterStages < 1 )
{
LOG( INFO ) << "Re-Center Stage 1, reload from disk";
qInfo() << "Re-Center Stage 1, reload from disk";
m_recenterStages++;
if ( calState > 199 && m_initComplete )
{
LOG( INFO ) << "Chaperone calibration state is error, attempting "
"to apply autosaved profile to fix issue";
qInfo() << "Chaperone calibration state is error, attempting "
"to apply autosaved profile to fix issue";
parent->m_chaperoneTabController.applyAutosavedProfile();
}
@@ -940,7 +937,7 @@ void MoveCenterTabController::incomingZeroReset()
// and reseting our stage counter
if ( m_recenterStages == 1 )
{
LOG( INFO ) << "Recenter Stage 2 re-set zero pos, and reset offsets";
qInfo() << "Recenter Stage 2 re-set zero pos, and reset offsets";
vr::VRChaperoneSetup()->GetWorkingStandingZeroPoseToRawTrackingPose(
&m_universeCenterForReset );
vr::VRChaperoneSetup()->GetWorkingSeatedZeroPoseToRawTrackingPose(
@@ -956,12 +953,12 @@ void MoveCenterTabController::reset()
// DO NOT attempt to apply autosaved profile on reset, as it is triggered by
// the apply chaperone profile Side effects are bad!
auto calState = vr::VRChaperone()->GetCalibrationState();
LOG( INFO ) << "Calibration State on Reset is: " << calState;
qInfo() << "Calibration State on Reset is: " << calState;
if ( !m_chaperoneBasisAcquired )
{
LOG( WARNING ) << "WARNING: Attempted reset offsets before chaperone "
"basis is acquired!";
qWarning() << "WARNING: Attempted reset offsets before chaperone "
"basis is acquired!";
return;
}
m_heightToggle = false;
@@ -1035,65 +1032,62 @@ void MoveCenterTabController::zeroOffsets()
- ( m_rotation * k_centidegreesToRadians ) );
if ( abs( currentCenterXyz[0] ) > k_maxOpenvrCommitOffset )
{
LOG( INFO ) << "Attempted Zero Offsets out of commit bounds ( X: "
<< currentCenterXyz[0] << " )";
LOG( INFO ) << "GetWorkingStandingZeroPoseToRawTrackingPose";
qInfo() << "Attempted Zero Offsets out of commit bounds ( X: "
<< currentCenterXyz[0] << " )";
qInfo() << "GetWorkingStandingZeroPoseToRawTrackingPose";
outputLogHmdMatrix( currentCenter );
// if reset happens before init is complete we set the universe
// center to the raw tracking zero point
reset();
if ( !m_chaperoneBasisAcquired )
{
LOG( WARNING )
<< "<[!]><[!]>EXECUTED RESET BEFORE BASIS "
"ACQUIRED<[!]><[!]> "
"Setting universe center to raw tracking zero point.";
qWarning() << "<[!]><[!]>EXECUTED RESET BEFORE BASIS "
"ACQUIRED<[!]><[!]> "
"Setting universe center to raw tracking zero point.";
}
else
{
LOG( INFO ) << "-Resetting offsets-";
qInfo() << "-Resetting offsets-";
}
}
else if ( abs( currentCenterXyz[1] ) > k_maxOpenvrCommitOffset )
{
LOG( INFO ) << "Attempted Zero Offsets out of commit bounds ( Y: "
<< currentCenterXyz[1] << " )";
LOG( INFO ) << "GetWorkingStandingZeroPoseToRawTrackingPose";
qInfo() << "Attempted Zero Offsets out of commit bounds ( Y: "
<< currentCenterXyz[1] << " )";
qInfo() << "GetWorkingStandingZeroPoseToRawTrackingPose";
outputLogHmdMatrix( currentCenter );
// if reset happens before init is complete we set the universe
// center to the raw tracking zero point
reset();
if ( !m_chaperoneBasisAcquired )
{
LOG( WARNING )
<< "<[!]><[!]>EXECUTED RESET BEFORE BASIS "
"ACQUIRED<[!]><[!]> "
"Setting universe center to raw tracking zero point.";
qWarning() << "<[!]><[!]>EXECUTED RESET BEFORE BASIS "
"ACQUIRED<[!]><[!]> "
"Setting universe center to raw tracking zero point.";
}
else
{
LOG( INFO ) << "-Resetting offsets-";
qInfo() << "-Resetting offsets-";
}
}
else if ( abs( currentCenterXyz[2] ) > k_maxOpenvrCommitOffset )
{
LOG( INFO ) << "Attempted Zero Offsets out of commit bounds ( Z: "
<< currentCenterXyz[2] << " )";
LOG( INFO ) << "GetWorkingStandingZeroPoseToRawTrackingPose";
qInfo() << "Attempted Zero Offsets out of commit bounds ( Z: "
<< currentCenterXyz[2] << " )";
qInfo() << "GetWorkingStandingZeroPoseToRawTrackingPose";
outputLogHmdMatrix( currentCenter );
// if reset happens before init is complete we set the universe
// center to the raw tracking zero point
reset();
if ( !m_chaperoneBasisAcquired )
{
LOG( WARNING )
<< "<[!]><[!]>EXECUTED RESET BEFORE BASIS "
"ACQUIRED<[!]><[!]> "
"Setting universe center to raw tracking zero point.";
qWarning() << "<[!]><[!]>EXECUTED RESET BEFORE BASIS "
"ACQUIRED<[!]><[!]> "
"Setting universe center to raw tracking zero point.";
}
else
{
LOG( INFO ) << "-Resetting offsets-";
qInfo() << "-Resetting offsets-";
}
}
m_oldOffsetX = 0.0f;
@@ -1121,7 +1115,7 @@ void MoveCenterTabController::zeroOffsets()
auto calState = vr::VRChaperone()->GetCalibrationState();
if ( calState == 200 )
{
LOG( WARNING )
qWarning()
<< "Chaperone State Does Not Exist Yet, will wait for "
"universe change to finish initialization";
}
@@ -1135,13 +1129,13 @@ void MoveCenterTabController::zeroOffsets()
else
{
// shutdown was unsafe last session!
LOG( WARNING ) << "DETECTED UNSAFE SHUTDOWN FROM LAST SESSION";
qWarning() << "DETECTED UNSAFE SHUTDOWN FROM LAST SESSION";
m_initComplete = false;
if ( !parent->crashRecoveryDisabled() )
{
parent->m_chaperoneTabController.applyAutosavedProfile();
LOG( INFO ) << "Applying last good chaperone "
"profile autosave";
qInfo() << "Applying last good chaperone "
"profile autosave";
}
}
// Now mark previous shutdown as unsafe in case we crash
@@ -1154,11 +1148,11 @@ void MoveCenterTabController::zeroOffsets()
}
if ( m_roomSetupModeDetected )
{
LOG( INFO ) << "room setup EXIT detected";
qInfo() << "room setup EXIT detected";
m_roomSetupModeDetected = false;
}
LOG( INFO ) << "SUCCESS: Chaperone Data Updated and Offsets zeroed out";
qInfo() << "SUCCESS: Chaperone Data Updated and Offsets zeroed out";
}
void MoveCenterTabController::sendSeatedRecenter()
@@ -1196,8 +1190,8 @@ void MoveCenterTabController::updateChaperoneResetData()
auto cstate = vr::VRChaperone()->GetCalibrationState();
if ( cstate > 199 )
{
LOG( WARNING ) << "Chaperone Calibration State is error: " << cstate
<< " While Trying to Update Reset Data";
qWarning() << "Chaperone Calibration State is error: " << cstate
<< " While Trying to Update Reset Data";
}
else
{
@@ -1905,11 +1899,11 @@ void MoveCenterTabController::resetOffsets( bool resetOffsetsJustPressed )
emit rotationChanged( m_rotation );
updateSpace( true );
auto calState = vr::VRChaperone()->GetCalibrationState();
LOG( INFO ) << "Calibration State on Reset Offsets is: " << calState;
qInfo() << "Calibration State on Reset Offsets is: " << calState;
// if ( calState > 199 && m_initComplete )
// {
// LOG( INFO ) << "Chaperone calibration state is error,
// qInfo() << "Chaperone calibration state is error,
// attempting "
// "to apply autosaved profile to fix issue";
// parent->m_chaperoneTabController.applyAutosavedProfile();
@@ -2139,8 +2133,8 @@ void MoveCenterTabController::updateHmdRotationCounter(
}
else
{
LOG( WARNING ) << "HMD Was Inverted during a Turn Count, Turn "
"counter may be in-accurate";
qWarning() << "HMD Was Inverted during a Turn Count, Turn "
"counter may be in-accurate";
}
}
@@ -2586,16 +2580,16 @@ void MoveCenterTabController::updateSpace( bool forceUpdate )
> k_maxOvrasUniverseCenteredTurningOffset
&& universeCenteredRotation() ) )
{
LOG( INFO ) << "Raw universe center out of bounds ( X: "
<< offsetUniverseCenterXyz[0] << " )";
qInfo() << "Raw universe center out of bounds ( X: "
<< offsetUniverseCenterXyz[0] << " )";
vr::HmdMatrix34_t standingZero;
vr::VRChaperoneSetup()->GetWorkingStandingZeroPoseToRawTrackingPose(
&standingZero );
LOG( INFO ) << "GetWorkingStandingZeroPoseToRawTrackingPose";
qInfo() << "GetWorkingStandingZeroPoseToRawTrackingPose";
outputLogHmdMatrix( standingZero );
reset();
parent->m_chaperoneTabController.applyAutosavedProfile();
LOG( INFO ) << "-Resetting to autosaved chaperone profile-";
qInfo() << "-Resetting to autosaved chaperone profile-";
return;
}
if ( abs( offsetUniverseCenterXyz[1] ) > k_maxOpenvrWorkingSetOffest
@@ -2603,16 +2597,16 @@ void MoveCenterTabController::updateSpace( bool forceUpdate )
> k_maxOvrasUniverseCenteredTurningOffset
&& universeCenteredRotation() ) )
{
LOG( INFO ) << "Raw universe center out of bounds ( Y: "
<< offsetUniverseCenterXyz[1] << " )";
qInfo() << "Raw universe center out of bounds ( Y: "
<< offsetUniverseCenterXyz[1] << " )";
vr::HmdMatrix34_t standingZero;
vr::VRChaperoneSetup()->GetWorkingStandingZeroPoseToRawTrackingPose(
&standingZero );
LOG( INFO ) << "GetWorkingStandingZeroPoseToRawTrackingPose";
qInfo() << "GetWorkingStandingZeroPoseToRawTrackingPose";
outputLogHmdMatrix( standingZero );
reset();
parent->m_chaperoneTabController.applyAutosavedProfile();
LOG( INFO ) << "-Resetting to autosaved chaperone profile-";
qInfo() << "-Resetting to autosaved chaperone profile-";
return;
}
if ( abs( offsetUniverseCenterXyz[2] ) > k_maxOpenvrWorkingSetOffest
@@ -2620,16 +2614,16 @@ void MoveCenterTabController::updateSpace( bool forceUpdate )
> k_maxOvrasUniverseCenteredTurningOffset
&& universeCenteredRotation() ) )
{
LOG( INFO ) << "Raw universe center out of bounds ( Z: "
<< offsetUniverseCenterXyz[2] << " )";
qInfo() << "Raw universe center out of bounds ( Z: "
<< offsetUniverseCenterXyz[2] << " )";
vr::HmdMatrix34_t standingZero;
vr::VRChaperoneSetup()->GetWorkingStandingZeroPoseToRawTrackingPose(
&standingZero );
LOG( INFO ) << "GetWorkingStandingZeroPoseToRawTrackingPose";
qInfo() << "GetWorkingStandingZeroPoseToRawTrackingPose";
outputLogHmdMatrix( standingZero );
reset();
parent->m_chaperoneTabController.applyAutosavedProfile();
LOG( INFO ) << "-Resetting to autosaved chaperone profile-";
qInfo() << "-Resetting to autosaved chaperone profile-";
return;
}
@@ -2751,7 +2745,7 @@ void MoveCenterTabController::eventLoopTick(
// the middle of room setup.
m_pendingZeroOffsets = false;
LOG( INFO ) << "room setup ENTRY detected";
qInfo() << "room setup ENTRY detected";
vr::VRChaperoneSetup()->HideWorkingSetPreview();
reset();
vr::VRChaperoneSetup()->RevertWorkingCopy();
@@ -2765,7 +2759,7 @@ void MoveCenterTabController::eventLoopTick(
if ( universe == vr::TrackingUniverseSeated && !m_seatedModeDetected )
{
m_seatedModeDetected = true;
LOG( INFO ) << "seated mode ENTRY detected";
qInfo() << "seated mode ENTRY detected";
}
// detect exiting seated mode
@@ -2773,7 +2767,7 @@ void MoveCenterTabController::eventLoopTick(
{
m_seatedModeDetected = false;
reset();
LOG( INFO ) << "seated mode EXIT detected";
qInfo() << "seated mode EXIT detected";
}
// If we're trying to redifine the origin point, but can't becaues of
+22 -20
View File
@@ -1,5 +1,7 @@
#include "RotationTabController.h"
#include <QQuickWindow>
#include <QtLogging>
#include <QtDebug>
#include "../overlaycontroller.h"
#include "../settings/settings.h"
#include "../utils/Matrix.h"
@@ -17,6 +19,8 @@ void RotationTabController::initStage1()
void RotationTabController::initStage2( OverlayController* var_parent )
{
this->parent = var_parent;
const auto autoturnOverlayKey
= std::string( application_strings::applicationKey )
+ ".autoturnnotification";
@@ -27,9 +31,9 @@ void RotationTabController::initStage2( OverlayController* var_parent )
&m_autoturnValues.overlayHandle );
if ( overlayError != vr::VROverlayError_None )
{
LOG( ERROR ) << "Could not create autoturn notification overlay: "
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
overlayError );
qCritical() << "Could not create autoturn notification overlay: "
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
overlayError );
emit defaultProfileDisplay();
@@ -70,8 +74,6 @@ void RotationTabController::initStage2( OverlayController* var_parent )
&notificationTransform );
emit defaultProfileDisplay();
this->parent = var_parent;
}
void RotationTabController::eventLoopTick(
@@ -401,9 +403,9 @@ void RotationTabController::doAutoTurn(
// Ignore if the wall we encountered is behind us
if ( std::abs( hmdToWallYaw ) >= M_PI / 2 )
{
LOG( DEBUG ) << "Ignoring turn in opposite "
"direction (angle "
<< std::abs( hmdToWallYaw ) << ")";
qDebug() << "Ignoring turn in opposite "
"direction (angle "
<< std::abs( hmdToWallYaw ) << ")";
break;
}
@@ -426,7 +428,7 @@ void RotationTabController::doAutoTurn(
// previous wall than the left.
turnLeft = m_autoTurnWallActive[circularIndex(
i, false, chaperoneDistances.size() )];
LOG( DEBUG ) << "turning away from shared corner";
qDebug() << "turning away from shared corner";
}
// If within m_cordDetanglingAngle degrees of
// 'straight at a wall', start in whatever direction
@@ -440,19 +442,19 @@ void RotationTabController::doAutoTurn(
turnLeft = ( parent->m_moveCenterTabController
.getHmdYawTotal()
< 0.0 );
LOG( DEBUG ) << "turning to detangle cord";
qDebug() << "turning to detangle cord";
}
// Turn the closest angle to the wall
else
{
turnLeft = hmdToWallYaw > 0.0;
LOG( DEBUG ) << "turning closest angle to wall";
qDebug() << "turning closest angle to wall";
}
LOG( DEBUG ) << "hmd yaw " << hmdYaw
<< ", hmd position to wall angle "
<< hmdPositionToWallYaw;
LOG( DEBUG ) << "hmd to wall angle " << hmdToWallYaw;
qDebug() << "hmd yaw " << hmdYaw
<< ", hmd position to wall angle "
<< hmdPositionToWallYaw;
qDebug() << "hmd to wall angle " << hmdToWallYaw;
// Positive hmd-to-wall is facing left, negative is
// facing right (relative to the wall)
double delta_degrees
@@ -488,17 +490,17 @@ void RotationTabController::doAutoTurn(
= static_cast<double>( std::atan2(
middleCorner.v[0] - touchingWallCorner.v[0],
middleCorner.v[2] - touchingWallCorner.v[2] ) );
LOG( DEBUG ) << "twa: " << touchingWallAngle
<< ", nwa: " << newWallAngle << ", diff: "
<< ( newWallAngle - touchingWallAngle );
qDebug() << "twa: " << touchingWallAngle
<< ", nwa: " << newWallAngle << ", diff: "
<< ( newWallAngle - touchingWallAngle );
delta_degrees = ( newWallAngle - touchingWallAngle
+ ( turnLeft ? M_PI : -M_PI ) )
* k_radiansToCentidegrees;
delta_degrees
= reduceAngle<>( delta_degrees, -18000.0, 18000.0 );
}
LOG( DEBUG ) << "rotating space " << ( delta_degrees / 100 )
<< " degrees";
qDebug() << "rotating space " << ( delta_degrees / 100 )
<< " degrees";
switch ( RotationTabController::autoTurnModeType() )
{
case AutoTurnModes::SNAP:
+5 -3
View File
@@ -1,5 +1,7 @@
#include "SettingsTabController.h"
#include <QQuickWindow>
#include <QtLogging>
#include <QtDebug>
#include "../overlaycontroller.h"
#include "../utils/update_rate.h"
@@ -105,9 +107,9 @@ void SettingsTabController::setAutoStartEnabled( bool value, bool notify )
application_strings::applicationKey, m_autoStartEnabled );
if ( apperror != vr::VRApplicationError_None )
{
LOG( ERROR ) << "Could not set auto start: "
<< vr::VRApplications()
->GetApplicationsErrorNameFromEnum( apperror );
qCritical() << "Could not set auto start: "
<< vr::VRApplications()
->GetApplicationsErrorNameFromEnum( apperror );
}
if ( notify )
{
+40 -39
View File
@@ -1,5 +1,7 @@
#include "SteamVRTabController.h"
#include <QQuickWindow>
#include <QtLogging>
#include <QtDebug>
#include "../overlaycontroller.h"
#include "../utils/update_rate.h"
#include <QDesktopServices>
@@ -504,7 +506,7 @@ void SteamVRTabController::launchBindingUI()
&inputHandle );
if ( error2 != vr::VRInputError_None )
{
LOG( ERROR )
qCritical()
<< "failed to get input handle? is your right controller on?";
}
if ( parent->isDesktopMode() )
@@ -517,7 +519,7 @@ void SteamVRTabController::launchBindingUI()
application_strings::applicationKey, actionHandle, inputHandle, false );
if ( error != vr::VRInputError_None )
{
LOG( ERROR ) << "Input Error: " << error;
qCritical() << "Input Error: " << error;
}
}
void SteamVRTabController::restartSteamVR()
@@ -525,7 +527,7 @@ void SteamVRTabController::restartSteamVR()
QString cmd = QString( "cmd.exe /C restartvrserver.bat \"" )
+ parent->getVRRuntimePathUrl().toLocalFile()
+ QString( "\"" );
LOG( INFO ) << "SteamVR Restart Command: " << cmd;
qInfo() << "SteamVR Restart Command: " << cmd;
QProcess::startDetached( cmd );
}
@@ -561,8 +563,8 @@ Q_INVOKABLE void SteamVRTabController::pairDevice( QString sn )
{
if ( !isSteamVRTracked( sn ) )
{
LOG( WARNING ) << sn.toStdString()
<< " Is Not a SteamVR Dongle, skipping Pair";
qWarning() << sn.toStdString()
<< " Is Not a SteamVR Dongle, skipping Pair";
return;
}
m_last_pair_sn = sn;
@@ -603,26 +605,26 @@ void SteamVRTabController::onConnected()
emit pairStatusChanged( QString( "Pairing..." ) );
if ( m_last_pair_sn == "" )
{
LOG( ERROR ) << "No Last SN to pair, this shouldn't happen";
qCritical() << "No Last SN to pair, this shouldn't happen";
}
m_webSocket.sendTextMessage( messageout );
// m_webSocket.close();
}
void SteamVRTabController::onDisconnect()
{
LOG( INFO ) << "Pair WS disconnect";
qInfo() << "Pair WS disconnect";
m_webSocket.close();
}
void SteamVRTabController::onMsgRec( QString Msg )
{
if ( Msg.contains( "success" ) )
{
LOG( INFO ) << "Pair Success";
qInfo() << "Pair Success";
emit pairStatusChanged( QString( "Success" ) );
}
if ( Msg.contains( "timeout" ) )
{
LOG( INFO ) << "Pair Timeout";
qInfo() << "Pair Timeout";
emit pairStatusChanged( QString( "Timeout" ) );
}
m_webSocket.close();
@@ -691,15 +693,15 @@ void SteamVRTabController::onGetBindingUrlResponse( QNetworkReply* reply )
std::string controllerName = ovr_system_wrapper::getControllerName();
if ( controllerName == "" )
{
LOG( WARNING ) << "No Controller Detected Skipping Bindings";
qWarning() << "No Controller Detected Skipping Bindings";
return;
}
json jsonfull = json::parse( data.toStdString() );
// LOG( INFO ) << "URL RESPOSNE XXXXXXX";
// LOG( INFO ) << jsonfull.dump().c_str();
// qInfo () << "URL RESPOSNE XXXXXXX";
// qInfo () << jsonfull.dump().c_str();
std::string filepath
= jsonfull["current_binding_url"][controllerName].get<std::string>();
LOG( INFO ) << "binding url at " << filepath;
qInfo() << "binding url at " << filepath;
// TODO perhaps some form of error checking if packet wrong?
reply->close();
getBindingDataReq( filepath, m_lastAppID, controllerName );
@@ -738,24 +740,24 @@ void SteamVRTabController::onGetBindingDataResponse( QNetworkReply* reply )
{
return;
}
// LOG( WARNING ) << "DATA RESPONSE";
// LOG( WARNING ) << data.toStdString();
// qWarning () << "DATA RESPONSE";
// qWarning () << data.toStdString();
json jsonfull = json::parse( data.toStdString() );
if ( !jsonfull.contains( "success" ) )
{
LOG( ERROR ) << "Binding Data Packet Mal-Formed?";
qCritical() << "Binding Data Packet Mal-Formed?";
}
if ( !jsonfull["success"].get<bool>() )
{
// TODO better error handling?
LOG( ERROR ) << "Binding Data Request Failed";
qCritical() << "Binding Data Request Failed";
}
reply->close();
output = jsonfull["binding_config"];
std::string sceneAppID = ovr_application_wrapper::getSceneAppID();
if ( sceneAppID == "error" )
{
LOG( ERROR ) << "aborting bind save, could not find scene app ID";
qCritical() << "aborting bind save, could not find scene app ID";
return;
}
std::string ctrl = ovr_system_wrapper::getControllerName();
@@ -795,11 +797,11 @@ bool SteamVRTabController::saveBind( std::string appID,
bindFile.close();
if ( bindFile.exists() )
{
LOG( INFO ) << ( def ? "Default " : ( sceneAppID + " " ) )
+ "Binding File saved at:"
<< absPath.toStdString();
qInfo() << ( def ? "Default " : ( sceneAppID + " " ) )
+ "Binding File saved at:"
<< absPath.toStdString();
std::string jsonstring = binds.dump().c_str();
LOG( INFO ) << jsonstring;
qInfo() << jsonstring;
return true;
}
return false;
@@ -861,7 +863,7 @@ void SteamVRTabController::applyBindingReq( std::string appID )
std::string sceneAppID = ovr_application_wrapper::getSceneAppID();
if ( sceneAppID == "" )
{
LOG( ERROR ) << "NO Scene App Detected unable to apply bindings";
qCritical() << "NO Scene App Detected unable to apply bindings";
return;
}
@@ -870,14 +872,14 @@ void SteamVRTabController::applyBindingReq( std::string appID )
+ ctrlType + ".json" );
if ( !QFileInfo::exists( fi.absolutePath() + QString( "/" ) + Fn ) )
{
LOG( INFO ) << "No Specific Binding Detected for: " + appID
+ "for Scene: " + sceneAppID + " Checking Default";
qInfo() << "No Specific Binding Detected for: " + appID
+ "for Scene: " + sceneAppID + " Checking Default";
Fn = QString::fromStdString( "defovl" + appID + "ctrl" + ctrlType
+ ".json" );
if ( !QFileInfo::exists( fi.absolutePath() + QString( "/" ) + Fn ) )
{
LOG( INFO ) << "No Def Binding Detected for: " + appID
+ " Not Adjusting Bindings";
qInfo() << "No Def Binding Detected for: " + appID
+ " Not Adjusting Bindings";
return;
}
}
@@ -886,14 +888,13 @@ void SteamVRTabController::applyBindingReq( std::string appID )
QUrl urlized = QUrl::fromLocalFile( absPath );
// std::string filePath = "file:///" + absPath.toStdString();
std::string url = "http://localhost:27062/input/selectconfig.action";
// LOG( INFO ) << urlized.toEncoded().toStdString();
// qInfo () << urlized.toEncoded().toStdString();
QUrl urls = QUrl( url.c_str() );
QNetworkRequest request;
request.setUrl( urls );
LOG( INFO ) << "Attempting to Apply Binding at: "
<< urlized
.toEncoded( QUrl::EncodeSpaces | QUrl::EncodeReserved )
.toStdString();
qInfo() << "Attempting to Apply Binding at: "
<< urlized.toEncoded( QUrl::EncodeSpaces | QUrl::EncodeReserved )
.toStdString();
// This is Important as otherwise Valve's VRWebServerWillIgnore the Request
// If referrer is wrong
request.setHeader( QNetworkRequest::ContentTypeHeader,
@@ -909,8 +910,8 @@ void SteamVRTabController::applyBindingReq( std::string appID )
.toStdString()
+ "\"}" )
.c_str();
// LOG( INFO ) << "Sending Binding Set Request";
// LOG( INFO ) << data.toStdString();
// qInfo () << "Sending Binding Set Request";
// qInfo () << data.toStdString();
connect( &m_networkManagerApply,
SIGNAL( finished( QNetworkReply* ) ),
this,
@@ -926,21 +927,21 @@ void SteamVRTabController::onApplyBindingResponse( QNetworkReply* reply )
{
return;
}
// LOG( INFO ) << "APPLY RESPONSE";
// LOG( INFO ) << data.toStdString();
// qInfo () << "APPLY RESPONSE";
// qInfo () << data.toStdString();
reply->close();
json jsonfull = json::parse( data.toStdString() );
if ( !jsonfull.contains( "success" ) )
{
LOG( ERROR ) << "Apply Binding Packet Mal-Formed?";
qCritical() << "Apply Binding Packet Mal-Formed?";
return;
}
if ( !jsonfull["success"].get<bool>() )
{
// TODO better error handling?
LOG( ERROR ) << "Binding Failed To Apply";
qCritical() << "Binding Failed To Apply";
}
LOG( INFO ) << "New Binding Applied";
qInfo() << "New Binding Applied";
return;
}
+18 -17
View File
@@ -1,6 +1,8 @@
#include "UtilitiesTabController.h"
#include <QQuickWindow>
#include <QApplication>
#include <QtLogging>
#include <QtDebug>
#include "../overlaycontroller.h"
#include "../keyboard_input/input_sender.h"
#include "../settings/settings.h"
@@ -236,8 +238,8 @@ QString getBatteryIconPath( int batteryState )
if ( !batteryPath.has_value() )
{
LOG( ERROR ) << "Unable to find battery image number '" << batteryState
<< "'.";
qCritical() << "Unable to find battery image number '" << batteryState
<< "'.";
return "";
}
@@ -276,19 +278,19 @@ vr::VROverlayHandle_t UtilitiesTabController::createBatteryOverlay(
}
vr::VROverlay()->SetOverlayTransformTrackedDeviceRelative(
handle, index, &notificationTransform );
LOG( INFO ) << "Created battery overlay for device " << index;
qInfo() << "Created battery overlay for device " << index;
}
else
{
LOG( ERROR ) << "Could not find battery icon \"" << batteryIconPath
<< "\"";
qCritical() << "Could not find battery icon \"" << batteryIconPath
<< "\"";
}
}
else
{
LOG( ERROR ) << "Could not create ptt notification overlay: "
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
overlayError );
qCritical() << "Could not create ptt notification overlay: "
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
overlayError );
}
return handle;
@@ -306,8 +308,8 @@ void UtilitiesTabController::destroyBatteryOverlays()
el = 0;
if ( err != vr::VROverlayError_None )
{
LOG( ERROR ) << "Could not Delete Battery Overlay: "
<< vr::VROverlay()->GetOverlayErrorNameFromEnum( err );
qCritical() << "Could not Delete Battery Overlay: "
<< vr::VROverlay()->GetOverlayErrorNameFromEnum( err );
}
}
}
@@ -337,7 +339,7 @@ void UtilitiesTabController::handleTrackerBatOvl()
}
}
LOG( INFO ) << "Creating battery overlay for device " << i;
qInfo() << "Creating battery overlay for device " << i;
m_batteryOverlayHandles[i] = createBatteryOverlay( i, style );
m_batteryVisible[i] = true;
}
@@ -373,10 +375,9 @@ void UtilitiesTabController::handleTrackerBatOvl()
if ( batteryState != m_batteryState[i] )
{
LOG( INFO )
<< "Updating battery overlay for device " << i << " to "
<< batteryState << "(" << battery << ")"
<< QString::number( m_batteryOverlayHandles[i] );
qInfo() << "Updating battery overlay for device " << i
<< " to " << batteryState << "(" << battery << ")"
<< QString::number( m_batteryOverlayHandles[i] );
QString batteryIconPath
= getBatteryIconPath( batteryState );
if ( QFile::exists( batteryIconPath ) )
@@ -387,8 +388,8 @@ void UtilitiesTabController::handleTrackerBatOvl()
}
else
{
LOG( ERROR ) << "Could not find battery icon \""
<< batteryIconPath << "\"";
qCritical() << "Could not find battery icon \""
<< batteryIconPath << "\"";
}
m_batteryState[i] = batteryState;
}
+72 -71
View File
@@ -1,6 +1,8 @@
#include "VideoTabController.h"
#include <QQuickWindow>
#include <QApplication>
#include <QtLogging>
#include <QtDebug>
#include "../settings/settings.h"
#include "../overlaycontroller.h"
#include "../utils/update_rate.h"
@@ -71,15 +73,15 @@ void VideoTabController::initBrightnessOverlay()
}
else
{
LOG( ERROR ) << "Could not find brightness overlay \""
<< video_keys::k_brightnessOverlayFilename << "\"";
qCritical() << "Could not find brightness overlay \""
<< video_keys::k_brightnessOverlayFilename << "\"";
}
}
else
{
LOG( ERROR ) << "Could not create brightness overlay: "
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
overlayError );
qCritical() << "Could not create brightness overlay: "
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
overlayError );
}
setBrightnessOpacityValue( brightnessOpacityValue(), false );
}
@@ -116,15 +118,15 @@ void VideoTabController::initColorOverlay()
}
else
{
LOG( ERROR ) << "Could not find Base color overlay: \""
<< video_keys::k_colorOverlayFilename << "\"";
qCritical() << "Could not find Base color overlay: \""
<< video_keys::k_colorOverlayFilename << "\"";
}
}
else
{
LOG( ERROR ) << "Could not create color overlay: "
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
overlayError );
qCritical() << "Could not create color overlay: "
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
overlayError );
}
}
@@ -134,18 +136,18 @@ void VideoTabController::loadColorOverlay()
m_colorOverlayHandle, colorRed(), colorGreen(), colorBlue() );
if ( overlayError != vr::VROverlayError_None )
{
LOG( ERROR ) << "Could not set Colors for color overlay: "
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
overlayError );
qCritical() << "Could not set Colors for color overlay: "
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
overlayError );
}
overlayError = vr::VROverlay()->SetOverlayAlpha( m_colorOverlayHandle,
colorOverlayOpacity() );
if ( overlayError != vr::VROverlayError_None )
{
LOG( ERROR ) << "Could not set alpha: "
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
overlayError );
qCritical() << "Could not set alpha: "
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
overlayError );
}
emit colorOverlayOpacityChanged( true );
}
@@ -214,7 +216,7 @@ void VideoTabController::setBrightnessEnabled( bool value,
setBrightnessOpacityValue( brightnessOpacityValue(), false );
ovr_overlay_wrapper::showOverlay(
getBrightnessOverlayHandle() );
LOG( INFO ) << "Brightness Overlay toggled on";
qInfo() << "Brightness Overlay toggled on";
}
}
else
@@ -223,7 +225,7 @@ void VideoTabController::setBrightnessEnabled( bool value,
{
ovr_overlay_wrapper::hideOverlay(
getBrightnessOverlayHandle() );
LOG( INFO ) << "Brightness Overlay toggled off";
qInfo() << "Brightness Overlay toggled off";
}
}
@@ -247,7 +249,7 @@ void VideoTabController::setBrightnessOpacityValue( float percvalue,
if ( realvalue >= 0.9999f || realvalue < 0.00f )
{
LOG( WARNING ) << "alpha value is invalid setting to 1.0";
qWarning() << "alpha value is invalid setting to 1.0";
settings::setSetting(
settings::DoubleSetting::VIDEO_brightnessOpacityValue, 1.0 );
realvalue = 0;
@@ -346,7 +348,7 @@ void VideoTabController::setColorOverlayEnabled( bool value,
if ( overlayHandle != vr::k_ulOverlayHandleInvalid )
{
ovr_overlay_wrapper::showOverlay( getColorOverlayHandle() );
LOG( INFO ) << "Color Overlay toggled on";
qInfo() << "Color Overlay toggled on";
}
}
else
@@ -354,7 +356,7 @@ void VideoTabController::setColorOverlayEnabled( bool value,
if ( overlayHandle != vr::k_ulOverlayHandleInvalid )
{
ovr_overlay_wrapper::hideOverlay( getColorOverlayHandle() );
LOG( INFO ) << "Color Overlay toggled off";
qInfo() << "Color Overlay toggled off";
}
}
@@ -397,11 +399,11 @@ void VideoTabController::synchGain( bool setValue )
&vrSettingsError );
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( WARNING ) << "Could not read \""
<< vr::k_pch_SteamVR_HmdDisplayColorGainR_Float
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
qWarning() << "Could not read \""
<< vr::k_pch_SteamVR_HmdDisplayColorGainR_Float
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
}
else
{
@@ -418,11 +420,11 @@ void VideoTabController::synchGain( bool setValue )
&vrSettingsError );
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( WARNING ) << "Could not read \""
<< vr::k_pch_SteamVR_HmdDisplayColorGainB_Float
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
qWarning() << "Could not read \""
<< vr::k_pch_SteamVR_HmdDisplayColorGainB_Float
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
}
else
{
@@ -439,11 +441,11 @@ void VideoTabController::synchGain( bool setValue )
&vrSettingsError );
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( WARNING ) << "Could not read \""
<< vr::k_pch_SteamVR_HmdDisplayColorGainG_Float
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
qWarning() << "Could not read \""
<< vr::k_pch_SteamVR_HmdDisplayColorGainG_Float
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
}
else
{
@@ -473,9 +475,9 @@ void VideoTabController::setColorRed( float value, bool notify, bool keepValue )
m_colorOverlayHandle, colorRed(), colorGreen(), colorBlue() );
if ( overlayError != vr::VROverlayError_None )
{
LOG( ERROR ) << "Could not set Red for color overlay: "
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
overlayError );
qCritical() << "Could not set Red for color overlay: "
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
overlayError );
}
}
else
@@ -489,13 +491,13 @@ void VideoTabController::setColorRed( float value, bool notify, bool keepValue )
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( ERROR ) << "could not set Red Gain Value, Error: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
qCritical() << "could not set Red Gain Value, Error: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
}
}
LOG( DEBUG ) << "Changed Red Value to: " << colorRed();
qDebug() << "Changed Red Value to: " << colorRed();
if ( notify )
{
@@ -523,9 +525,9 @@ void VideoTabController::setColorGreen( float value,
m_colorOverlayHandle, colorRed(), colorGreen(), colorBlue() );
if ( overlayError != vr::VROverlayError_None )
{
LOG( ERROR ) << "Could not set Green for color overlay: "
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
overlayError );
qCritical() << "Could not set Green for color overlay: "
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
overlayError );
}
}
else
@@ -539,13 +541,13 @@ void VideoTabController::setColorGreen( float value,
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( ERROR ) << "could not set Green Gain Value, Error: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
qCritical() << "could not set Green Gain Value, Error: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
}
}
LOG( DEBUG ) << "Changed Green Value to: " << colorGreen();
qDebug() << "Changed Green Value to: " << colorGreen();
if ( notify )
{
@@ -572,9 +574,9 @@ void VideoTabController::setColorBlue( float value,
m_colorOverlayHandle, colorRed(), colorGreen(), colorBlue() );
if ( overlayError != vr::VROverlayError_None )
{
LOG( ERROR ) << "Could not set Blue for color overlay: "
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
overlayError );
qCritical() << "Could not set Blue for color overlay: "
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
overlayError );
}
}
else
@@ -588,13 +590,13 @@ void VideoTabController::setColorBlue( float value,
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( ERROR ) << "could not set Blue Gain Value, Error: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
qCritical() << "could not set Blue Gain Value, Error: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
}
}
LOG( DEBUG ) << "Changed Blue Value to: " << colorBlue();
qDebug() << "Changed Blue Value to: " << colorBlue();
if ( notify )
{
@@ -613,9 +615,9 @@ void VideoTabController::resetGain()
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( ERROR ) << "could not set Red Gain Value, Error: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
qCritical() << "could not set Red Gain Value, Error: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
}
vr::VRSettings()->SetFloat( vr::k_pch_SteamVR_Section,
vr::k_pch_SteamVR_HmdDisplayColorGainG_Float,
@@ -624,9 +626,9 @@ void VideoTabController::resetGain()
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( ERROR ) << "could not set Green Gain Value, Error: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
qCritical() << "could not set Green Gain Value, Error: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
}
vr::VRSettings()->SetFloat( vr::k_pch_SteamVR_Section,
@@ -636,9 +638,9 @@ void VideoTabController::resetGain()
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( ERROR ) << "could not set Blue Gain Value, Error: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
qCritical() << "could not set Blue Gain Value, Error: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
}
}
@@ -691,13 +693,12 @@ void VideoTabController::setSuperSampling( float value, const bool notify )
// Mirrors Desktop Clamp
if ( value < 0.2f )
{
LOG( WARNING )
<< "Encountered a supersampling value <= 0.2, setting "
"supersampling to 1.0";
qWarning() << "Encountered a supersampling value <= 0.2, setting "
"supersampling to 1.0";
value = 1.0f;
}
LOG( DEBUG ) << "Supersampling value changed: " << m_superSampling
<< " => " << value;
qDebug() << "Supersampling value changed: " << m_superSampling << " => "
<< value;
m_superSampling = value;
ovr_settings_wrapper::setFloat(
vr::k_pch_SteamVR_Section,
@@ -1,4 +1,3 @@
#include <easylogging++.h>
#include "AudioManagerPulse.h"
#include "AudioManagerPulse_internal.h"
#include "../AudioTabController.h"
@@ -1,7 +1,8 @@
#pragma once
#include <pulse/pulseaudio.h>
#include <string>
#include <easylogging++.h>
#include <QtLogging>
#include <QtDebug>
#include "AudioManager.h"
// Used to get the compiler to shut up about C4100: unreferenced formal
@@ -66,58 +67,58 @@ void customPulseLoop()
// Error function
void dumpPulseAudioState()
{
LOG( ERROR ) << "____";
qCritical() << "____";
LOG( ERROR ) << "Dumping PulseAudio state: ";
LOG( ERROR ) << "mainLoop: " << pulseAudioPointers.mainLoop;
LOG( ERROR ) << "api: " << pulseAudioPointers.api;
LOG( ERROR ) << "context: " << pulseAudioPointers.context;
qCritical() << "Dumping PulseAudio state: ";
qCritical() << "mainLoop: " << pulseAudioPointers.mainLoop;
qCritical() << "api: " << pulseAudioPointers.api;
qCritical() << "context: " << pulseAudioPointers.context;
LOG( ERROR ) << "";
qCritical() << "";
LOG( ERROR ) << "Data:";
LOG( ERROR ) << "\tdefaultSinkOutputDeviceId: "
<< pulseAudioData.defaultSinkOutputDeviceId;
LOG( ERROR ) << "\tdefaultSourceInputDeviceId: "
<< pulseAudioData.defaultSourceInputDeviceId;
qCritical() << "Data:";
qCritical() << "\tdefaultSinkOutputDeviceId: "
<< pulseAudioData.defaultSinkOutputDeviceId;
qCritical() << "\tdefaultSourceInputDeviceId: "
<< pulseAudioData.defaultSourceInputDeviceId;
LOG( ERROR ) << "";
qCritical() << "";
LOG( ERROR ) << "\tcurrentDefaultSinkInfo name: "
<< pulseAudioData.currentDefaultSinkInfo.name;
LOG( ERROR ) << "\tcurrentDefaultSourceInfo name: "
<< pulseAudioData.currentDefaultSourceInfo.name;
qCritical() << "\tcurrentDefaultSinkInfo name: "
<< pulseAudioData.currentDefaultSinkInfo.name;
qCritical() << "\tcurrentDefaultSourceInfo name: "
<< pulseAudioData.currentDefaultSourceInfo.name;
LOG( ERROR ) << "";
qCritical() << "";
LOG( ERROR ) << "sinkOutputDevices: ";
LOG_IF( pulseAudioData.sinkOutputDevices.size() == 0, ERROR )
<< "\tOutput devices size zero.";
qCritical() << "sinkOutputDevices: ";
if ( pulseAudioData.sinkOutputDevices.size() == 0 )
qCritical() << "\tOutput devices size zero.";
for ( const auto& device : pulseAudioData.sinkOutputDevices )
{
LOG( ERROR ) << "\tDevice Name: " << device.name();
LOG( ERROR ) << "\tDevice Id: " << device.id();
qCritical() << "\tDevice Name: " << device.name();
qCritical() << "\tDevice Id: " << device.id();
}
LOG( ERROR ) << "";
qCritical() << "";
LOG( ERROR ) << "sourceInputDevices: ";
LOG_IF( pulseAudioData.sourceInputDevices.size() == 0, ERROR )
<< "\tInput devices size zero.";
qCritical() << "sourceInputDevices: ";
if ( pulseAudioData.sourceInputDevices.size() == 0 )
qCritical() << "\tInput devices size zero.";
for ( const auto& device : pulseAudioData.sourceInputDevices )
{
LOG( ERROR ) << "\tDevice Name: " << device.name();
LOG( ERROR ) << "\tDevice Id: " << device.id();
qCritical() << "\tDevice Name: " << device.name();
qCritical() << "\tDevice Id: " << device.id();
}
LOG( ERROR ) << "____";
qCritical() << "____";
}
PulseAudioIsLastMeaning getIsLastMeaning( const int isLast ) noexcept
{
if ( isLast < 0 )
{
LOG( ERROR ) << "Error in isLast.";
qCritical() << "Error in isLast.";
dumpPulseAudioState();
return PulseAudioIsLastMeaning::Error;
}
@@ -134,14 +135,14 @@ std::string getDeviceName( pa_proplist* p )
{
if ( !p )
{
LOG( ERROR ) << "proplist not valid.";
qCritical() << "proplist not valid.";
}
constexpr auto deviceDescription = "device.description";
if ( !pa_proplist_contains( p, deviceDescription ) )
{
LOG( ERROR ) << "proplist does not contain '" << deviceDescription
<< "'.";
qCritical() << "proplist does not contain '" << deviceDescription
<< "'.";
return "ERROR";
}
@@ -166,7 +167,7 @@ template <class T> void deviceCallback( const T* i, const int isLast )
}
else if ( deviceState == PulseAudioIsLastMeaning::Error )
{
LOG( ERROR ) << "Error in deviceCallback function.";
qCritical() << "Error in deviceCallback function.";
dumpPulseAudioState();
loopControl = PulseAudioLoopControl::Stop;
return;
@@ -179,8 +180,10 @@ template <class T> void deviceCallback( const T* i, const int isLast )
pulseAudioData.currentDefaultSourceInfo = *i;
}
LOG( DEBUG ) << "Adding device to input: '" << i->name << "', '"
<< getDeviceName( i->proplist ) << "'.";
/*
qDebug() << "Adding device to input: '" << i->name << "', '"
<< getDeviceName( i->proplist ) << "'.";
*/
pulseAudioData.sourceInputDevices.push_back(
AudioDevice( i->name, getDeviceName( i->proplist ) ) );
}
@@ -192,8 +195,10 @@ template <class T> void deviceCallback( const T* i, const int isLast )
pulseAudioData.currentDefaultSinkInfo = *i;
}
LOG( DEBUG ) << "Adding device to output: '" << i->name << "', '"
<< getDeviceName( i->proplist ) << "'.";
/*
qDebug() << "Adding device to output: '" << i->name << "', '"
<< getDeviceName( i->proplist ) << "'.";
*/
pulseAudioData.sinkOutputDevices.push_back(
AudioDevice( i->name, getDeviceName( i->proplist ) ) );
}
@@ -230,7 +235,7 @@ void getDefaultDevicesCallback( pa_context* c,
if ( !i )
{
LOG( ERROR ) << "i == 0";
qCritical() << "i == 0";
pulseAudioData.defaultSinkOutputDeviceId = "DDO:ERROR";
pulseAudioData.defaultSourceInputDeviceId = "DDI:ERROR";
return;
@@ -242,10 +247,12 @@ void getDefaultDevicesCallback( pa_context* c,
loopControl = PulseAudioLoopControl::Stop;
LOG( DEBUG ) << "getDefaultDevicesCallback done with sink output device: '"
<< pulseAudioData.defaultSinkOutputDeviceId
<< "' and source input '"
<< pulseAudioData.defaultSourceInputDeviceId << "'.";
/*
qDebug() << "getDefaultDevicesCallback done with sink output device: '"
<< pulseAudioData.defaultSinkOutputDeviceId
<< "' and source input '"
<< pulseAudioData.defaultSourceInputDeviceId << "'.";
*/
}
void stateCallbackFunction( pa_context* c, void* userdata )
@@ -256,27 +263,27 @@ void stateCallbackFunction( pa_context* c, void* userdata )
switch ( pa_context_get_state( c ) )
{
case PA_CONTEXT_TERMINATED:
LOG( ERROR ) << "PA_CONTEXT_TERMINATED in stateCallbackFunction";
qCritical() << "PA_CONTEXT_TERMINATED in stateCallbackFunction";
dumpPulseAudioState();
return;
case PA_CONTEXT_CONNECTING:
LOG( DEBUG ) << "PA_CONTEXT_CONNECTING";
qDebug() << "PA_CONTEXT_CONNECTING";
return;
case PA_CONTEXT_AUTHORIZING:
LOG( DEBUG ) << "PA_CONTEXT_AUTHORIZING";
qDebug() << "PA_CONTEXT_AUTHORIZING";
return;
case PA_CONTEXT_SETTING_NAME:
LOG( DEBUG ) << "PA_CONTEXT_SETTING_NAME";
qDebug() << "PA_CONTEXT_SETTING_NAME";
return;
case PA_CONTEXT_UNCONNECTED:
LOG( DEBUG ) << "PA_CONTEXT_UNCONNECTED";
qDebug() << "PA_CONTEXT_UNCONNECTED";
return;
case PA_CONTEXT_FAILED:
LOG( DEBUG ) << "PA_CONTEXT_FAILED";
qDebug() << "PA_CONTEXT_FAILED";
return;
case PA_CONTEXT_READY:
LOG( DEBUG ) << "PA_CONTEXT_READY";
qDebug() << "PA_CONTEXT_READY";
loopControl = PulseAudioLoopControl::Stop;
return;
}
@@ -302,7 +309,7 @@ void updateAllPulseData()
pulseAudioPointers.context, setInputDevicesCallback, noCustomUserdata );
customPulseLoop();
LOG( DEBUG ) << "updateAllPulseData done.";
qDebug() << "updateAllPulseData done.";
}
void successCallback( pa_context* c, int success, void* successVariable )
@@ -316,7 +323,7 @@ void successCallback( pa_context* c, int success, void* successVariable )
if ( !success )
{
LOG( ERROR ) << "Non successful callback operation.";
qCritical() << "Non successful callback operation.";
dumpPulseAudioState();
}
@@ -335,12 +342,12 @@ void setPlaybackDeviceInternal( const std::string& id )
if ( !success )
{
LOG( ERROR ) << "setPlaybackDeviceInternal failed to set default sink "
"for device '"
<< id << "'.";
qCritical() << "setPlaybackDeviceInternal failed to set default sink "
"for device '"
<< id << "'.";
}
LOG( DEBUG ) << "setPlaybackDeviceInternal done with id: " << id;
qDebug() << "setPlaybackDeviceInternal done with id: " << id;
}
std::string getCurrentDefaultPlaybackDeviceName()
@@ -351,12 +358,12 @@ std::string getCurrentDefaultPlaybackDeviceName()
{
if ( dev.id() == pulseAudioData.defaultSinkOutputDeviceId )
{
LOG( DEBUG ) << "getCurrentDefaultPlaybackDeviceName done with "
<< dev.name();
qDebug() << "getCurrentDefaultPlaybackDeviceName done with "
<< dev.name();
return dev.name();
}
}
LOG( ERROR ) << "Unable to find default playback device.";
qCritical() << "Unable to find default playback device.";
return "ERROR";
}
@@ -365,8 +372,8 @@ std::string getCurrentDefaultPlaybackDeviceId()
{
updateAllPulseData();
LOG( DEBUG ) << "getCurrentDefaultPlaybackDeviceId done with "
<< pulseAudioData.defaultSinkOutputDeviceId;
qDebug() << "getCurrentDefaultPlaybackDeviceId done with "
<< pulseAudioData.defaultSinkOutputDeviceId;
return pulseAudioData.defaultSinkOutputDeviceId;
}
@@ -379,12 +386,12 @@ std::string getCurrentDefaultRecordingDeviceName()
{
if ( dev.id() == pulseAudioData.defaultSourceInputDeviceId )
{
LOG( DEBUG ) << "getCurrentDefaultRecordingDeviceName done with: "
<< dev.name();
qDebug() << "getCurrentDefaultRecordingDeviceName done with: "
<< dev.name();
return dev.name();
}
}
LOG( ERROR ) << "Unable to find default playback device.";
qCritical() << "Unable to find default playback device.";
return "ERROR";
}
@@ -393,8 +400,8 @@ std::string getCurrentDefaultRecordingDeviceId()
{
updateAllPulseData();
LOG( DEBUG ) << "getCurrentDefaultRecordingDeviceId done with "
<< pulseAudioData.defaultSourceInputDeviceId;
qDebug() << "getCurrentDefaultRecordingDeviceId done with "
<< pulseAudioData.defaultSourceInputDeviceId;
return pulseAudioData.defaultSourceInputDeviceId;
}
@@ -452,7 +459,7 @@ void sourceOutputCallback( pa_context* c,
}
else if ( deviceState == PulseAudioIsLastMeaning::Error )
{
LOG( ERROR ) << "Error in sourceOutputCallback function.";
qCritical() << "Error in sourceOutputCallback function.";
dumpPulseAudioState();
return;
}
@@ -460,9 +467,9 @@ void sourceOutputCallback( pa_context* c,
const auto sourceOutputIndex = i->index;
const auto sourceIndex = pulseAudioData.currentDefaultSourceInfo.index;
LOG( DEBUG ) << "Attempting to move sourceOutputIndex: '"
<< sourceOutputIndex << "' to sourceIndex '" << sourceIndex
<< "' with source output name " << i->name << ".";
qDebug() << "Attempting to move sourceOutputIndex: '" << sourceOutputIndex
<< "' to sourceIndex '" << sourceIndex
<< "' with source output name " << i->name << ".";
pa_context_move_source_output_by_index(
c, sourceOutputIndex, sourceIndex, successCallback, &success );
@@ -470,7 +477,7 @@ void sourceOutputCallback( pa_context* c,
void setMicrophoneDevice( const std::string& id )
{
LOG( DEBUG ) << "setMicrophoneDevice called with 'id': " << id;
qDebug() << "setMicrophoneDevice called with 'id': " << id;
updateAllPulseData();
@@ -482,7 +489,7 @@ void setMicrophoneDevice( const std::string& id )
if ( !success )
{
LOG( ERROR ) << "Error setting microphone device for '" << id << "'.";
qCritical() << "Error setting microphone device for '" << id << "'.";
}
updateAllPulseData();
@@ -494,17 +501,17 @@ void setMicrophoneDevice( const std::string& id )
if ( !success )
{
LOG( ERROR ) << "Error in moving source outputs to new source.";
qCritical() << "Error in moving source outputs to new source.";
}
updateAllPulseData();
LOG( DEBUG ) << "setMicrophoneDevice done.";
qDebug() << "setMicrophoneDevice done.";
}
bool setPlaybackVolume( const float volume )
{
LOG( DEBUG ) << "setPlaybackVolume called with 'volume': " << volume;
qDebug() << "setPlaybackVolume called with 'volume': " << volume;
updateAllPulseData();
@@ -525,19 +532,19 @@ bool setPlaybackVolume( const float volume )
if ( !success )
{
LOG( ERROR ) << "setPlaybackVolume failed to set volume '" << volume
<< "' for device '"
<< pulseAudioData.defaultSinkOutputDeviceId << "'.";
qCritical() << "setPlaybackVolume failed to set volume '" << volume
<< "' for device '"
<< pulseAudioData.defaultSinkOutputDeviceId << "'.";
}
LOG( DEBUG ) << "setPlaybackVolume done with 'success': " << success;
qDebug() << "setPlaybackVolume done with 'success': " << success;
return success;
}
bool setMicrophoneVolume( const float volume )
{
LOG( DEBUG ) << "setMicrophoneVolume called with 'volume': " << volume;
qDebug() << "setMicrophoneVolume called with 'volume': " << volume;
updateAllPulseData();
@@ -558,19 +565,19 @@ bool setMicrophoneVolume( const float volume )
if ( !success )
{
LOG( ERROR ) << "seMicrophoneVolume failed to set volume '" << volume
<< "' for device '"
<< pulseAudioData.defaultSourceInputDeviceId << "'.";
qCritical() << "seMicrophoneVolume failed to set volume '" << volume
<< "' for device '"
<< pulseAudioData.defaultSourceInputDeviceId << "'.";
}
LOG( DEBUG ) << "setMicrophoneVolume done with 'success': " << success;
qDebug() << "setMicrophoneVolume done with 'success': " << success;
return success;
}
bool setMicMuteState( const bool muted )
{
LOG( DEBUG ) << "setMicMuteState called with 'muted': " << muted;
qDebug() << "setMicMuteState called with 'muted': " << muted;
bool success = false;
pa_context_set_source_mute_by_name(
@@ -584,19 +591,19 @@ bool setMicMuteState( const bool muted )
if ( !success )
{
LOG( ERROR ) << "setMicMuteState failed to set muted '" << muted
<< "' for device '"
<< pulseAudioData.defaultSourceInputDeviceId << "'.";
qCritical() << "setMicMuteState failed to set muted '" << muted
<< "' for device '"
<< pulseAudioData.defaultSourceInputDeviceId << "'.";
}
LOG( DEBUG ) << "setMicMuteState done with 'success': " << success;
qDebug() << "setMicMuteState done with 'success': " << success;
return success;
}
void restorePulseAudioState()
{
LOG( DEBUG ) << "restorePulseAudioState called.";
qDebug() << "restorePulseAudioState called.";
setPlaybackDeviceInternal( pulseAudioData.originalDefaultOutputDeviceId );
setPlaybackVolume( pulseAudioData.originalDefaultOutputDeviceVolume );
@@ -604,12 +611,12 @@ void restorePulseAudioState()
setMicrophoneDevice( pulseAudioData.originalDefaultInputDeviceId );
setMicrophoneVolume( pulseAudioData.originalDefaultInputDeviceVolume );
LOG( DEBUG ) << "restorePulseAudioState done.";
qDebug() << "restorePulseAudioState done.";
}
void initializePulseAudio()
{
LOG( DEBUG ) << "initializePulseAudio called.";
qDebug() << "initializePulseAudio called.";
pulseAudioPointers.mainLoop = pa_mainloop_new();
@@ -644,6 +651,6 @@ void initializePulseAudio()
= static_cast<float>( pa_sw_volume_to_linear(
pa_cvolume_avg( &pulseAudioData.currentDefaultSinkInfo.volume ) ) );
LOG( DEBUG ) << "initializePulseAudio finished.";
qDebug() << "initializePulseAudio finished.";
}
} // namespace advsettings
@@ -1,6 +1,7 @@
#include "AudioManagerWindows.h"
#include <exception>
#include "easylogging++.h"
#include <QtLogging>
#include <QtDebug>
#include "../AudioTabController.h"
#include <locale>
@@ -48,7 +49,7 @@ void AudioManagerWindows::init( AudioTabController* var_controller )
playbackAudioDevice = getDefaultPlaybackDevice( audioDeviceEnumerator );
if ( !playbackAudioDevice )
{
LOG( WARNING ) << "Could not find a default recording device.";
qWarning() << "Could not find a default recording device.";
}
micAudioDevice = getDefaultRecordingDevice( audioDeviceEnumerator );
if ( micAudioDevice )
@@ -57,7 +58,7 @@ void AudioManagerWindows::init( AudioTabController* var_controller )
}
else
{
LOG( WARNING ) << "Could not find a default recording device.";
qWarning() << "Could not find a default recording device.";
}
this->controller = var_controller;
audioDeviceEnumerator->RegisterEndpointNotificationCallback(
@@ -65,7 +66,7 @@ void AudioManagerWindows::init( AudioTabController* var_controller )
policyConfig = getPolicyConfig();
if ( !policyConfig )
{
LOG( ERROR ) << "Could not find PolicyConfig interface";
qCritical() << "Could not find PolicyConfig interface";
}
}
@@ -78,8 +79,7 @@ void AudioManagerWindows::setPlaybackDevice( const std::string& id,
auto dev = getDevice( audioDeviceEnumerator, id );
if ( !dev )
{
LOG( WARNING ) << "Could not find playback device \"" << id
<< "\".";
qWarning() << "Could not find playback device \"" << id << "\".";
}
else
{
@@ -142,7 +142,7 @@ void AudioManagerWindows::setMirrorDevice( const std::string& id, bool notify )
}
else
{
LOG( WARNING ) << "Could not find mirror device \"" << id << "\".";
qWarning() << "Could not find mirror device \"" << id << "\".";
}
}
if ( notify )
@@ -258,8 +258,7 @@ void AudioManagerWindows::setMicDevice( const std::string& id, bool notify )
auto dev = getDevice( audioDeviceEnumerator, id );
if ( !dev )
{
LOG( WARNING ) << "Could not find recording device \"" << id
<< "\".";
qWarning() << "Could not find recording device \"" << id << "\".";
}
else
{
@@ -617,7 +616,7 @@ AudioManagerWindows::OnDefaultDeviceChanged( EDataFlow flow,
}
else if ( !pwstrDefaultDeviceId )
{
LOG( WARNING ) << "No recording device available.";
qWarning() << "No recording device available.";
}
else
{
@@ -625,8 +624,8 @@ AudioManagerWindows::OnDefaultDeviceChanged( EDataFlow flow,
converter;
std::string name
= converter.to_bytes( pwstrDefaultDeviceId );
LOG( WARNING ) << "Could not find recording device \""
<< name << "\".";
qWarning() << "Could not find recording device \"" << name
<< "\".";
}
controller->onNewRecordingDevice();
}
@@ -647,7 +646,7 @@ AudioManagerWindows::OnDefaultDeviceChanged( EDataFlow flow,
playbackAudioDevice = device;
if ( !pwstrDefaultDeviceId )
{
LOG( WARNING ) << "No playback device available.";
qWarning() << "No playback device available.";
}
else if ( !playbackAudioDevice )
{
@@ -655,7 +654,7 @@ AudioManagerWindows::OnDefaultDeviceChanged( EDataFlow flow,
converter;
std::string name
= converter.to_bytes( pwstrDefaultDeviceId );
LOG( WARNING )
qWarning()
<< "Could not find playback device \"" << name << "\".";
}
controller->onNewPlaybackDevice();