Add push to mute icon when using push to mute feature
The PTM icon was quickly made in mspaint and (in my opinion) adequately reflects push to mute. Fixes https://github.com/OpenVR-Advanced-Settings/OpenVR-AdvancedSettings/issues/342
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
@@ -60,46 +60,73 @@ void AudioTabController::initStage1()
|
|||||||
eventLoopTick();
|
eventLoopTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::optional<std::string> verifyIconFilePath( std::string filename )
|
||||||
|
{
|
||||||
|
const auto notifIconPath = paths::binaryDirectoryFindFile( filename );
|
||||||
|
if ( !notifIconPath.has_value() )
|
||||||
|
{
|
||||||
|
LOG( ERROR ) << "Could not find push to talk icon \"" << filename
|
||||||
|
<< "\"";
|
||||||
|
}
|
||||||
|
|
||||||
|
return notifIconPath;
|
||||||
|
}
|
||||||
|
|
||||||
void AudioTabController::initStage2()
|
void AudioTabController::initStage2()
|
||||||
{
|
{
|
||||||
std::string notifKey = std::string( application_strings::applicationKey )
|
const auto pushToTalkOverlayKey
|
||||||
+ ".pptnotification";
|
= std::string( application_strings::applicationKey )
|
||||||
|
+ ".pptnotification";
|
||||||
|
|
||||||
vr::VROverlayError overlayError = vr::VROverlay()->CreateOverlay(
|
const auto overlayError
|
||||||
notifKey.c_str(), notifKey.c_str(), &m_ulNotificationOverlayHandle );
|
= vr::VROverlay()->CreateOverlay( pushToTalkOverlayKey.c_str(),
|
||||||
if ( overlayError == vr::VROverlayError_None )
|
pushToTalkOverlayKey.c_str(),
|
||||||
{
|
&m_pushToTalkValues.overlayHandle );
|
||||||
constexpr auto notificationIconFilename
|
if ( overlayError != vr::VROverlayError_None )
|
||||||
= "/res/img/audio/microphone/ptt_notification.png";
|
|
||||||
const auto notifIconPath
|
|
||||||
= paths::binaryDirectoryFindFile( notificationIconFilename );
|
|
||||||
if ( notifIconPath.has_value() )
|
|
||||||
{
|
|
||||||
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()->SetOverlayTransformTrackedDeviceRelative(
|
|
||||||
m_ulNotificationOverlayHandle,
|
|
||||||
vr::k_unTrackedDeviceIndex_Hmd,
|
|
||||||
¬ificationTransform );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LOG( ERROR ) << "Could not find notification icon \""
|
|
||||||
<< notificationIconFilename << "\"";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
LOG( ERROR ) << "Could not create ptt notification overlay: "
|
LOG( ERROR ) << "Could not create ptt notification overlay: "
|
||||||
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
|
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
|
||||||
overlayError );
|
overlayError );
|
||||||
|
|
||||||
|
emit defaultProfileDisplay();
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constexpr auto pushToTalkIconFilepath
|
||||||
|
= "/res/img/audio/microphone/ptt_notification.png";
|
||||||
|
constexpr auto pushToMuteIconFilepath
|
||||||
|
= "/res/img/audio/microphone/ptm_notification.png";
|
||||||
|
|
||||||
|
const auto pushToTalkIconFilePath
|
||||||
|
= verifyIconFilePath( pushToTalkIconFilepath );
|
||||||
|
const auto pushToMuteIconFilePath
|
||||||
|
= verifyIconFilePath( pushToMuteIconFilepath );
|
||||||
|
|
||||||
|
if ( !pushToTalkIconFilePath.has_value()
|
||||||
|
|| !pushToMuteIconFilePath.has_value() )
|
||||||
|
{
|
||||||
|
emit defaultProfileDisplay();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_pushToTalkValues.pushToTalkPath = *pushToTalkIconFilePath;
|
||||||
|
m_pushToTalkValues.pushToMutePath = *pushToMuteIconFilePath;
|
||||||
|
|
||||||
|
vr::VROverlay()->SetOverlayFromFile(
|
||||||
|
m_pushToTalkValues.overlayHandle,
|
||||||
|
m_pushToTalkValues.pushToTalkPath.c_str() );
|
||||||
|
vr::VROverlay()->SetOverlayWidthInMeters( m_pushToTalkValues.overlayHandle,
|
||||||
|
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_pushToTalkValues.overlayHandle,
|
||||||
|
vr::k_unTrackedDeviceIndex_Hmd,
|
||||||
|
¬ificationTransform );
|
||||||
|
|
||||||
emit defaultProfileDisplay();
|
emit defaultProfileDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,6 +363,19 @@ void AudioTabController::setMicReversePtt( bool value, bool notify )
|
|||||||
|
|
||||||
settings::setSetting( settings::BoolSetting::AUDIO_micReversePtt, value );
|
settings::setSetting( settings::BoolSetting::AUDIO_micReversePtt, value );
|
||||||
|
|
||||||
|
if ( value )
|
||||||
|
{
|
||||||
|
vr::VROverlay()->SetOverlayFromFile(
|
||||||
|
m_pushToTalkValues.overlayHandle,
|
||||||
|
m_pushToTalkValues.pushToMutePath.c_str() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vr::VROverlay()->SetOverlayFromFile(
|
||||||
|
m_pushToTalkValues.overlayHandle,
|
||||||
|
m_pushToTalkValues.pushToTalkPath.c_str() );
|
||||||
|
}
|
||||||
|
|
||||||
if ( pttEnabled() )
|
if ( pttEnabled() )
|
||||||
{
|
{
|
||||||
if ( m_pttActive )
|
if ( m_pttActive )
|
||||||
|
|||||||
@@ -111,8 +111,12 @@ class AudioTabController : public QObject
|
|||||||
setPttShowNotification NOTIFY pttShowNotificationChanged )
|
setPttShowNotification NOTIFY pttShowNotificationChanged )
|
||||||
|
|
||||||
private:
|
private:
|
||||||
vr::VROverlayHandle_t m_ulNotificationOverlayHandle
|
struct
|
||||||
= vr::k_ulOverlayHandleInvalid;
|
{
|
||||||
|
vr::VROverlayHandle_t overlayHandle = vr::k_ulOverlayHandleInvalid;
|
||||||
|
std::string pushToTalkPath;
|
||||||
|
std::string pushToMutePath;
|
||||||
|
} m_pushToTalkValues;
|
||||||
|
|
||||||
int m_playbackDeviceIndex = -1;
|
int m_playbackDeviceIndex = -1;
|
||||||
|
|
||||||
@@ -149,7 +153,7 @@ private:
|
|||||||
|
|
||||||
virtual vr::VROverlayHandle_t getNotificationOverlayHandle()
|
virtual vr::VROverlayHandle_t getNotificationOverlayHandle()
|
||||||
{
|
{
|
||||||
return m_ulNotificationOverlayHandle;
|
return m_pushToTalkValues.overlayHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
void findPlaybackDeviceIndex( std::string id, bool notify = true );
|
void findPlaybackDeviceIndex( std::string id, bool notify = true );
|
||||||
|
|||||||
Reference in New Issue
Block a user