@@ -5,7 +5,7 @@
|
|||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
|
|
||||||
QT += core gui qml quick multimedia widgets
|
QT += core gui qml quick multimedia widgets
|
||||||
CONFIG += c++11
|
CONFIG += c++14
|
||||||
|
|
||||||
DEFINES += ELPP_THREAD_SAFE ELPP_QT_LOGGING ELPP_NO_DEFAULT_LOG_FILE
|
DEFINES += ELPP_THREAD_SAFE ELPP_QT_LOGGING ELPP_NO_DEFAULT_LOG_FILE
|
||||||
|
|
||||||
|
|||||||
@@ -23,9 +23,12 @@ For pushing changes to the repo:
|
|||||||
2. Clang format. Part of the [LLVM collection](https://releases.llvm.org/download.html).
|
2. Clang format. Part of the [LLVM collection](https://releases.llvm.org/download.html).
|
||||||
|
|
||||||
Additionally, for fully building portable and installer release versions:
|
Additionally, for fully building portable and installer release versions:
|
||||||
|
|
||||||
3. [7zip](https://www.7-zip.org/download.html)
|
3. [7zip](https://www.7-zip.org/download.html)
|
||||||
|
|
||||||
4. [Nullsoft Scriptable Install System (NSIS)](https://sourceforge.net/projects/nsis/)
|
4. [Nullsoft Scriptable Install System (NSIS)](https://sourceforge.net/projects/nsis/)
|
||||||
|
|
||||||
|
|
||||||
<a name="locs_and_envs"></a>
|
<a name="locs_and_envs"></a>
|
||||||
## Locations and Environment Variables
|
## Locations and Environment Variables
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ MyStackViewPage {
|
|||||||
onClosed: {
|
onClosed: {
|
||||||
if (okClicked) {
|
if (okClicked) {
|
||||||
AudioTabController.deleteAudioProfile(profileIndex)
|
AudioTabController.deleteAudioProfile(profileIndex)
|
||||||
|
pttProfileComboBox.currentIndex = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -79,6 +80,7 @@ MyStackViewPage {
|
|||||||
if (okClicked) {
|
if (okClicked) {
|
||||||
if (pttNewProfileName.text != "") {
|
if (pttNewProfileName.text != "") {
|
||||||
AudioTabController.addPttProfile(pttNewProfileName.text)
|
AudioTabController.addPttProfile(pttNewProfileName.text)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
audioMessageDialog.showMessage("Create New Profile", "ERROR: No name given.")
|
audioMessageDialog.showMessage("Create New Profile", "ERROR: No name given.")
|
||||||
}
|
}
|
||||||
@@ -95,7 +97,7 @@ MyStackViewPage {
|
|||||||
id: audioNewProfileDialog
|
id: audioNewProfileDialog
|
||||||
dialogTitle: "Create New Audio Profile"
|
dialogTitle: "Create New Audio Profile"
|
||||||
dialogWidth: 600
|
dialogWidth: 600
|
||||||
dialogHeight: 220
|
dialogHeight: 300
|
||||||
dialogContentItem: ColumnLayout {
|
dialogContentItem: ColumnLayout {
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.topMargin: 16
|
Layout.topMargin: 16
|
||||||
@@ -116,6 +118,19 @@ MyStackViewPage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
RowLayout {
|
||||||
|
Layout.topMargin: 16
|
||||||
|
Layout.leftMargin: 16
|
||||||
|
Layout.rightMargin: 16
|
||||||
|
MyToggleButton {
|
||||||
|
id: audioDefaultProfileToggle
|
||||||
|
Layout.preferredWidth: 250
|
||||||
|
text: "Make Default"
|
||||||
|
onCheckedChanged: {
|
||||||
|
AudioTabController.setAudioProfileDefault(checked, false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
onClosed: {
|
onClosed: {
|
||||||
if (okClicked) {
|
if (okClicked) {
|
||||||
@@ -365,10 +380,11 @@ MyStackViewPage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
|
||||||
MyToggleButton {
|
MyToggleButton {
|
||||||
id: audioPttShowNotificationToggle
|
id: audioPttShowNotificationToggle
|
||||||
Layout.leftMargin: 265
|
Layout.leftMargin: 350
|
||||||
text: "Show notification in HMD."
|
text: "Show notification in HMD"
|
||||||
onCheckedChanged: {
|
onCheckedChanged: {
|
||||||
AudioTabController.setPttShowNotification(checked, false)
|
AudioTabController.setPttShowNotification(checked, false)
|
||||||
}
|
}
|
||||||
@@ -414,7 +430,6 @@ MyStackViewPage {
|
|||||||
onClicked: {
|
onClicked: {
|
||||||
if (audioProfileComboBox.currentIndex > 0) {
|
if (audioProfileComboBox.currentIndex > 0) {
|
||||||
AudioTabController.applyAudioProfile(audioProfileComboBox.currentIndex - 1)
|
AudioTabController.applyAudioProfile(audioProfileComboBox.currentIndex - 1)
|
||||||
audioProfileComboBox.currentIndex = 0
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -447,7 +462,6 @@ MyStackViewPage {
|
|||||||
onClicked: {
|
onClicked: {
|
||||||
if (pttProfileComboBox.currentIndex > 0) {
|
if (pttProfileComboBox.currentIndex > 0) {
|
||||||
AudioTabController.applyPttProfile(pttProfileComboBox.currentIndex - 1)
|
AudioTabController.applyPttProfile(pttProfileComboBox.currentIndex - 1)
|
||||||
pttProfileComboBox.currentIndex = 0
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -558,6 +572,7 @@ MyStackViewPage {
|
|||||||
audioPttRightControllerToggle.checked = AudioTabController.pttRightControllerEnabled
|
audioPttRightControllerToggle.checked = AudioTabController.pttRightControllerEnabled
|
||||||
audioPttShowNotificationToggle.checked = AudioTabController.pttShowNotification
|
audioPttShowNotificationToggle.checked = AudioTabController.pttShowNotification
|
||||||
audioPttReverseToggle.checked = AudioTabController.micReversePtt
|
audioPttReverseToggle.checked = AudioTabController.micReversePtt
|
||||||
|
audioDefaultProfileToggle.checked = AudioTabController.audioProfileDefault
|
||||||
componentCompleted = true
|
componentCompleted = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -629,12 +644,22 @@ MyStackViewPage {
|
|||||||
onPttRightControllerEnabledChanged: {
|
onPttRightControllerEnabledChanged: {
|
||||||
audioPttRightControllerToggle.checked = AudioTabController.pttRightControllerEnabled
|
audioPttRightControllerToggle.checked = AudioTabController.pttRightControllerEnabled
|
||||||
}
|
}
|
||||||
|
onAudioProfileDefaultChanged: {
|
||||||
|
audioDefaultProfileToggle.checked = AudioTabController.audioProfileDefault
|
||||||
|
}
|
||||||
onPttProfilesUpdated: {
|
onPttProfilesUpdated: {
|
||||||
reloadPttProfiles()
|
reloadPttProfiles()
|
||||||
}
|
}
|
||||||
onAudioProfilesUpdated:{
|
onAudioProfilesUpdated: {
|
||||||
reloadAudioProfiles()
|
reloadAudioProfiles()
|
||||||
}
|
}
|
||||||
|
onAudioProfileAdded:{
|
||||||
|
audioProfileComboBox.currentIndex = AudioTabController.getAudioProfileCount()
|
||||||
|
}
|
||||||
|
onPttProfileAdded:{
|
||||||
|
pttProfileComboBox.currentIndex = AudioTabController.getPttProfileCount()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
onPlaybackDeviceListChanged: {
|
onPlaybackDeviceListChanged: {
|
||||||
var devs1 = []
|
var devs1 = []
|
||||||
@@ -707,7 +732,7 @@ MyStackViewPage {
|
|||||||
for (var i = 0; i < profileCount; i++) {
|
for (var i = 0; i < profileCount; i++) {
|
||||||
profiles.push(AudioTabController.getAudioProfileName(i))
|
profiles.push(AudioTabController.getAudioProfileName(i))
|
||||||
}
|
}
|
||||||
audioProfileComboBox.currentIndex = 0
|
audioProfileComboBox.currentIndex = 0;
|
||||||
audioProfileComboBox.model = profiles
|
audioProfileComboBox.model = profiles
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,9 @@ void AudioTabController::initStage1()
|
|||||||
reloadPttProfiles();
|
reloadPttProfiles();
|
||||||
reloadPttConfig();
|
reloadPttConfig();
|
||||||
reloadAudioProfiles();
|
reloadAudioProfiles();
|
||||||
|
applyDefaultProfile();
|
||||||
reloadAudioSettings();
|
reloadAudioSettings();
|
||||||
|
|
||||||
eventLoopTick();
|
eventLoopTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,6 +65,7 @@ void AudioTabController::initStage2( OverlayController* var_parent,
|
|||||||
|
|
||||||
std::string notifKey
|
std::string notifKey
|
||||||
= std::string( OverlayController::applicationKey ) + ".pptnotification";
|
= std::string( OverlayController::applicationKey ) + ".pptnotification";
|
||||||
|
|
||||||
vr::VROverlayError overlayError = vr::VROverlay()->CreateOverlay(
|
vr::VROverlayError overlayError = vr::VROverlay()->CreateOverlay(
|
||||||
notifKey.c_str(), notifKey.c_str(), &m_ulNotificationOverlayHandle );
|
notifKey.c_str(), notifKey.c_str(), &m_ulNotificationOverlayHandle );
|
||||||
if ( overlayError == vr::VROverlayError_None )
|
if ( overlayError == vr::VROverlayError_None )
|
||||||
@@ -152,6 +155,11 @@ bool AudioTabController::micReversePtt() const
|
|||||||
return m_micReversePtt;
|
return m_micReversePtt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AudioTabController::audioProfileDefault() const
|
||||||
|
{
|
||||||
|
return m_isDefaultAudioProfile;
|
||||||
|
}
|
||||||
|
|
||||||
void AudioTabController::eventLoopTick()
|
void AudioTabController::eventLoopTick()
|
||||||
{
|
{
|
||||||
if ( !eventLoopMutex.try_lock() )
|
if ( !eventLoopMutex.try_lock() )
|
||||||
@@ -388,6 +396,19 @@ void AudioTabController::setMicReversePtt( bool value, bool notify )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AudioTabController::setAudioProfileDefault( bool value, bool notify )
|
||||||
|
{
|
||||||
|
std::lock_guard<std::recursive_mutex> lock( eventLoopMutex );
|
||||||
|
if ( value != m_isDefaultAudioProfile )
|
||||||
|
{
|
||||||
|
m_isDefaultAudioProfile = value;
|
||||||
|
if ( notify )
|
||||||
|
{
|
||||||
|
emit audioProfileDefaultChanged( value );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AudioTabController::onNewRecordingDevice()
|
void AudioTabController::onNewRecordingDevice()
|
||||||
{
|
{
|
||||||
findMicDeviceIndex( audioManager->getMicDevId() );
|
findMicDeviceIndex( audioManager->getMicDevId() );
|
||||||
@@ -432,7 +453,7 @@ int AudioTabController::getPlaybackDeviceCount()
|
|||||||
|
|
||||||
QString AudioTabController::getPlaybackDeviceName( int index )
|
QString AudioTabController::getPlaybackDeviceName( int index )
|
||||||
{
|
{
|
||||||
if ( index > 0 && static_cast<size_t>( index ) < m_playbackDevices.size() )
|
if ( index >= 0 && static_cast<size_t>( index ) < m_playbackDevices.size() )
|
||||||
{
|
{
|
||||||
return QString::fromStdString(
|
return QString::fromStdString(
|
||||||
m_playbackDevices[static_cast<size_t>( index )].second );
|
m_playbackDevices[static_cast<size_t>( index )].second );
|
||||||
@@ -450,7 +471,7 @@ int AudioTabController::getRecordingDeviceCount()
|
|||||||
|
|
||||||
QString AudioTabController::getRecordingDeviceName( int index )
|
QString AudioTabController::getRecordingDeviceName( int index )
|
||||||
{
|
{
|
||||||
if ( index > 0 && static_cast<size_t>( index ) < m_playbackDevices.size() )
|
if ( index >= 0 && static_cast<size_t>( index ) < m_playbackDevices.size() )
|
||||||
{
|
{
|
||||||
return QString::fromStdString(
|
return QString::fromStdString(
|
||||||
m_recordingDevices[static_cast<size_t>( index )].second );
|
m_recordingDevices[static_cast<size_t>( index )].second );
|
||||||
@@ -460,7 +481,6 @@ QString AudioTabController::getRecordingDeviceName( int index )
|
|||||||
return "<ERROR>";
|
return "<ERROR>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int AudioTabController::playbackDeviceIndex() const
|
int AudioTabController::playbackDeviceIndex() const
|
||||||
{
|
{
|
||||||
return m_playbackDeviceIndex;
|
return m_playbackDeviceIndex;
|
||||||
@@ -480,7 +500,7 @@ void AudioTabController::setPlaybackDeviceIndex( int index, bool notify )
|
|||||||
{
|
{
|
||||||
if ( index != m_playbackDeviceIndex )
|
if ( index != m_playbackDeviceIndex )
|
||||||
{
|
{
|
||||||
if ( index > 0
|
if ( index >= 0
|
||||||
&& static_cast<size_t>( index ) < m_playbackDevices.size()
|
&& static_cast<size_t>( index ) < m_playbackDevices.size()
|
||||||
&& index != m_mirrorDeviceIndex )
|
&& index != m_mirrorDeviceIndex )
|
||||||
{
|
{
|
||||||
@@ -540,7 +560,7 @@ void AudioTabController::setMirrorDeviceIndex( int index, bool notify )
|
|||||||
audioManager->setMirrorDevice( "", notify );
|
audioManager->setMirrorDevice( "", notify );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( index > 0
|
else if ( index >= 0
|
||||||
&& static_cast<size_t>( index ) < m_playbackDevices.size()
|
&& static_cast<size_t>( index ) < m_playbackDevices.size()
|
||||||
&& index != m_playbackDeviceIndex
|
&& index != m_playbackDeviceIndex
|
||||||
&& index != m_mirrorDeviceIndex )
|
&& index != m_mirrorDeviceIndex )
|
||||||
@@ -579,7 +599,7 @@ void AudioTabController::setMicDeviceIndex( int index, bool notify )
|
|||||||
{
|
{
|
||||||
if ( index != m_recordingDeviceIndex )
|
if ( index != m_recordingDeviceIndex )
|
||||||
{
|
{
|
||||||
if ( index > 0
|
if ( index >= 0
|
||||||
&& static_cast<size_t>( index ) < m_recordingDevices.size() )
|
&& static_cast<size_t>( index ) < m_recordingDevices.size() )
|
||||||
{
|
{
|
||||||
vr::EVRSettingsError vrSettingsError;
|
vr::EVRSettingsError vrSettingsError;
|
||||||
@@ -726,7 +746,7 @@ void AudioTabController::reloadAudioProfiles()
|
|||||||
{
|
{
|
||||||
settings->setArrayIndex( i );
|
settings->setArrayIndex( i );
|
||||||
audioProfiles.emplace_back();
|
audioProfiles.emplace_back();
|
||||||
auto& entry = audioProfiles[static_cast<size_t>( i )];
|
auto& entry = audioProfiles[i];
|
||||||
entry.profileName
|
entry.profileName
|
||||||
= settings->value( "profileName" ).toString().toStdString();
|
= settings->value( "profileName" ).toString().toStdString();
|
||||||
entry.playbackName
|
entry.playbackName
|
||||||
@@ -738,6 +758,8 @@ void AudioTabController::reloadAudioProfiles()
|
|||||||
entry.mirrorMute = settings->value( "mirrorMute", false ).toBool();
|
entry.mirrorMute = settings->value( "mirrorMute", false ).toBool();
|
||||||
entry.mirrorVol = settings->value( "mirrorVol", 0.0 ).toFloat();
|
entry.mirrorVol = settings->value( "mirrorVol", 0.0 ).toFloat();
|
||||||
entry.micVol = settings->value( "micVol", 1.0 ).toFloat();
|
entry.micVol = settings->value( "micVol", 1.0 ).toFloat();
|
||||||
|
entry.defaultProfile
|
||||||
|
= settings->value( "defaultProfile", false ).toBool();
|
||||||
}
|
}
|
||||||
settings->endArray();
|
settings->endArray();
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
@@ -776,6 +798,7 @@ void AudioTabController::saveAudioProfiles()
|
|||||||
settings->setValue( "mirrorMute", p.mirrorMute );
|
settings->setValue( "mirrorMute", p.mirrorMute );
|
||||||
settings->setValue( "micVol", p.micVol );
|
settings->setValue( "micVol", p.micVol );
|
||||||
settings->setValue( "mirrorVol", p.mirrorVol );
|
settings->setValue( "mirrorVol", p.mirrorVol );
|
||||||
|
settings->setValue( "defaultProfile", p.defaultProfile );
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
settings->endArray();
|
settings->endArray();
|
||||||
@@ -825,10 +848,18 @@ void AudioTabController::addAudioProfile( QString name )
|
|||||||
profile->mirrorMute = m_mirrorMuted;
|
profile->mirrorMute = m_mirrorMuted;
|
||||||
profile->mirrorVol = m_mirrorVolume;
|
profile->mirrorVol = m_mirrorVolume;
|
||||||
profile->micVol = m_micVolume;
|
profile->micVol = m_micVolume;
|
||||||
|
profile->defaultProfile = m_isDefaultAudioProfile;
|
||||||
|
if ( m_isDefaultAudioProfile )
|
||||||
|
{
|
||||||
|
removeDefaultProfile( name );
|
||||||
|
|
||||||
|
// to prevent confusion, resets checkbox
|
||||||
|
setAudioProfileDefault( false );
|
||||||
|
}
|
||||||
saveAudioProfiles();
|
saveAudioProfiles();
|
||||||
OverlayController::appSettings()->sync();
|
OverlayController::appSettings()->sync();
|
||||||
emit audioProfilesUpdated();
|
emit audioProfilesUpdated();
|
||||||
|
emit audioProfileAdded();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -847,6 +878,7 @@ Description: Applies the required logic to activate the audio profile.
|
|||||||
// TODO Remembers Mirror Volume when switching to main volume.
|
// TODO Remembers Mirror Volume when switching to main volume.
|
||||||
void AudioTabController::applyAudioProfile( unsigned index )
|
void AudioTabController::applyAudioProfile( unsigned index )
|
||||||
{
|
{
|
||||||
|
std::lock_guard<std::recursive_mutex> lock( eventLoopMutex );
|
||||||
if ( index < audioProfiles.size() )
|
if ( index < audioProfiles.size() )
|
||||||
{
|
{
|
||||||
auto& profile = audioProfiles[index];
|
auto& profile = audioProfiles[index];
|
||||||
@@ -854,6 +886,7 @@ void AudioTabController::applyAudioProfile( unsigned index )
|
|||||||
int pInd = getPlaybackIndex( profile.playbackName );
|
int pInd = getPlaybackIndex( profile.playbackName );
|
||||||
|
|
||||||
// Needed to keep remembering when swtiching from mirror/main etc.
|
// Needed to keep remembering when swtiching from mirror/main etc.
|
||||||
|
// TODO OPTI can possibly clean up logic to reduce overhead in future.
|
||||||
setMicMuted( false, false );
|
setMicMuted( false, false );
|
||||||
setMirrorMuted( false, false );
|
setMirrorMuted( false, false );
|
||||||
|
|
||||||
@@ -872,6 +905,7 @@ void AudioTabController::applyAudioProfile( unsigned index )
|
|||||||
setMirrorDeviceIndex( mInd, true );
|
setMirrorDeviceIndex( mInd, true );
|
||||||
setPlaybackDeviceIndex( pInd, true );
|
setPlaybackDeviceIndex( pInd, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
setMicDeviceIndex( getRecordingIndex( profile.micName ), true );
|
setMicDeviceIndex( getRecordingIndex( profile.micName ), true );
|
||||||
setMicMuted( profile.micMute, true );
|
setMicMuted( profile.micMute, true );
|
||||||
setMirrorMuted( profile.mirrorMute, true );
|
setMirrorMuted( profile.mirrorMute, true );
|
||||||
@@ -920,17 +954,15 @@ QString AudioTabController::getAudioProfileName( unsigned index )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Name: getPlaybackIndex, getRecordingIndex, and getMirrorIndex
|
Name: getPlaybackIndex, getRecordingIndex, and getMirrorIndex
|
||||||
|
input: string, of microphone/playback device name
|
||||||
input: string, of microphone/playback device name
|
output: integer for use In: setMicDeviceIndex(int,bool),
|
||||||
output: integer for use In: setMicDeviceIndex(int,bool),
|
setMirrorDeviceIndex(int,bool) setPlayBackDeviceIndex(int,bool)
|
||||||
setMirrorDeviceIndex(int,bool) setPlayBackDeviceIndex(int,bool)
|
description: Gets proper index value for selecting specific devices.
|
||||||
|
|
||||||
description: Gets proper index value for selecting specific devices.
|
|
||||||
*/
|
*/
|
||||||
int AudioTabController::getPlaybackIndex( std::string str )
|
int AudioTabController::getPlaybackIndex( std::string str )
|
||||||
{
|
{
|
||||||
// Unsigned to avoid two casts. i won't be negative because we only
|
// Unsigned to avoid two casts. it won't be negative because we only
|
||||||
// increment it.
|
// increment it.
|
||||||
for ( unsigned int i = 0; i < m_playbackDevices.size(); i++ )
|
for ( unsigned int i = 0; i < m_playbackDevices.size(); i++ )
|
||||||
{
|
{
|
||||||
@@ -944,7 +976,7 @@ int AudioTabController::getPlaybackIndex( std::string str )
|
|||||||
|
|
||||||
int AudioTabController::getRecordingIndex( std::string str )
|
int AudioTabController::getRecordingIndex( std::string str )
|
||||||
{
|
{
|
||||||
// Unsigned to avoid two casts. i won't be negative because we only
|
// Unsigned to avoid two casts. it won't be negative because we only
|
||||||
// increment it.
|
// increment it.
|
||||||
for ( unsigned int i = 0; i < m_recordingDevices.size(); i++ )
|
for ( unsigned int i = 0; i < m_recordingDevices.size(); i++ )
|
||||||
{
|
{
|
||||||
@@ -958,7 +990,7 @@ int AudioTabController::getRecordingIndex( std::string str )
|
|||||||
|
|
||||||
int AudioTabController::getMirrorIndex( std::string str )
|
int AudioTabController::getMirrorIndex( std::string str )
|
||||||
{
|
{
|
||||||
// Unsigned to avoid two casts. i won't be negative because we only
|
// Unsigned to avoid two casts. it won't be negative because we only
|
||||||
// increment it.
|
// increment it.
|
||||||
for ( unsigned int i = 0; i < m_playbackDevices.size(); i++ )
|
for ( unsigned int i = 0; i < m_playbackDevices.size(); i++ )
|
||||||
{
|
{
|
||||||
@@ -970,8 +1002,51 @@ int AudioTabController::getMirrorIndex( std::string str )
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------*/
|
/*
|
||||||
|
Name: removeDefaultProfile
|
||||||
|
|
||||||
/*----------------*/
|
input: QString name - name of new default profile
|
||||||
|
output: none
|
||||||
|
|
||||||
|
description: checks all profiles and removes any OTHERS that are set as default.
|
||||||
|
*/
|
||||||
|
void AudioTabController::removeDefaultProfile( QString name )
|
||||||
|
{
|
||||||
|
AudioProfile* profile = nullptr;
|
||||||
|
for ( auto& p : audioProfiles )
|
||||||
|
{
|
||||||
|
if ( p.profileName.compare( name.toStdString() ) != 0 )
|
||||||
|
{
|
||||||
|
profile = &p;
|
||||||
|
profile->defaultProfile = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Name: applyDefaultProfile
|
||||||
|
|
||||||
|
input: none
|
||||||
|
output: none
|
||||||
|
|
||||||
|
description: checks all profiles and applies the one (if any) with the default
|
||||||
|
flag);
|
||||||
|
*/
|
||||||
|
|
||||||
|
void AudioTabController::applyDefaultProfile()
|
||||||
|
{
|
||||||
|
for ( unsigned i = 0; i < audioProfiles.size(); i++ )
|
||||||
|
{
|
||||||
|
auto& profile = audioProfiles[i];
|
||||||
|
if ( profile.defaultProfile )
|
||||||
|
{
|
||||||
|
applyAudioProfile( i );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------*/
|
||||||
|
/*----------------------------*/
|
||||||
|
|
||||||
} // namespace advsettings
|
} // namespace advsettings
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include "AudioManager.h"
|
#include "AudioManager.h"
|
||||||
#include "PttController.h"
|
#include "PttController.h"
|
||||||
//#include "AudioProfileController.h"
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
class QQuickWindow;
|
class QQuickWindow;
|
||||||
@@ -23,6 +22,7 @@ struct AudioProfile
|
|||||||
float micVol = 0.0;
|
float micVol = 0.0;
|
||||||
bool micMute = false;
|
bool micMute = false;
|
||||||
bool mirrorMute = false;
|
bool mirrorMute = false;
|
||||||
|
bool defaultProfile = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AudioTabController : public PttController
|
class AudioTabController : public PttController
|
||||||
@@ -32,17 +32,12 @@ class AudioTabController : public PttController
|
|||||||
setPlaybackDeviceIndex NOTIFY playbackDeviceIndexChanged )
|
setPlaybackDeviceIndex NOTIFY playbackDeviceIndexChanged )
|
||||||
Q_PROPERTY( int mirrorDeviceIndex READ mirrorDeviceIndex WRITE
|
Q_PROPERTY( int mirrorDeviceIndex READ mirrorDeviceIndex WRITE
|
||||||
setMirrorDeviceIndex NOTIFY mirrorDeviceIndexChanged )
|
setMirrorDeviceIndex NOTIFY mirrorDeviceIndexChanged )
|
||||||
// Q_PROPERTY(bool mirrorPresent READ mirrorPresent NOTIFY
|
|
||||||
// mirrorPresentChanged) Q_PROPERTY(QString mirrorDevName READ mirrorDevName
|
|
||||||
// NOTIFY mirrorDevNameChanged)
|
|
||||||
Q_PROPERTY( float mirrorVolume READ mirrorVolume WRITE setMirrorVolume
|
Q_PROPERTY( float mirrorVolume READ mirrorVolume WRITE setMirrorVolume
|
||||||
NOTIFY mirrorVolumeChanged )
|
NOTIFY mirrorVolumeChanged )
|
||||||
Q_PROPERTY( bool mirrorMuted READ mirrorMuted WRITE setMirrorMuted NOTIFY
|
Q_PROPERTY( bool mirrorMuted READ mirrorMuted WRITE setMirrorMuted NOTIFY
|
||||||
mirrorMutedChanged )
|
mirrorMutedChanged )
|
||||||
Q_PROPERTY( int micDeviceIndex READ micDeviceIndex WRITE setMicDeviceIndex
|
Q_PROPERTY( int micDeviceIndex READ micDeviceIndex WRITE setMicDeviceIndex
|
||||||
NOTIFY micDeviceIndexChanged )
|
NOTIFY micDeviceIndexChanged )
|
||||||
// Q_PROPERTY(bool micPresent READ micPresent NOTIFY micPresentChanged)
|
|
||||||
// Q_PROPERTY(QString micDevName READ micDevName NOTIFY micDevNameChanged)
|
|
||||||
Q_PROPERTY( float micVolume READ micVolume WRITE setMicVolume NOTIFY
|
Q_PROPERTY( float micVolume READ micVolume WRITE setMicVolume NOTIFY
|
||||||
micVolumeChanged )
|
micVolumeChanged )
|
||||||
Q_PROPERTY(
|
Q_PROPERTY(
|
||||||
@@ -52,6 +47,8 @@ class AudioTabController : public PttController
|
|||||||
micProximitySensorCanMuteChanged )
|
micProximitySensorCanMuteChanged )
|
||||||
Q_PROPERTY( bool micReversePtt READ micReversePtt WRITE setMicReversePtt
|
Q_PROPERTY( bool micReversePtt READ micReversePtt WRITE setMicReversePtt
|
||||||
NOTIFY micReversePttChanged )
|
NOTIFY micReversePttChanged )
|
||||||
|
Q_PROPERTY( bool audioProfileDefault READ audioProfileDefault WRITE
|
||||||
|
setAudioProfileDefault NOTIFY audioProfileDefaultChanged )
|
||||||
|
|
||||||
private:
|
private:
|
||||||
OverlayController* parent;
|
OverlayController* parent;
|
||||||
@@ -71,6 +68,8 @@ private:
|
|||||||
bool m_micMuted = false;
|
bool m_micMuted = false;
|
||||||
bool m_micProximitySensorCanMute = false;
|
bool m_micProximitySensorCanMute = false;
|
||||||
bool m_micReversePtt = false;
|
bool m_micReversePtt = false;
|
||||||
|
bool m_isDefaultAudioProfile = false;
|
||||||
|
std::string m_defaultProfileName;
|
||||||
|
|
||||||
unsigned settingsUpdateCounter = 0;
|
unsigned settingsUpdateCounter = 0;
|
||||||
|
|
||||||
@@ -83,7 +82,6 @@ private:
|
|||||||
{
|
{
|
||||||
return "audioSettings";
|
return "audioSettings";
|
||||||
}
|
}
|
||||||
// QString getSettingsNameAudio() override { return "audioSettingsTest"; }
|
|
||||||
void onPttStart() override;
|
void onPttStart() override;
|
||||||
void onPttStop() override;
|
void onPttStop() override;
|
||||||
void onPttEnabled() override;
|
void onPttEnabled() override;
|
||||||
@@ -101,14 +99,14 @@ private:
|
|||||||
int getPlaybackIndex( std::string str );
|
int getPlaybackIndex( std::string str );
|
||||||
int getRecordingIndex( std::string str );
|
int getRecordingIndex( std::string str );
|
||||||
int getMirrorIndex( std::string str );
|
int getMirrorIndex( std::string str );
|
||||||
// void setPlaybackDeviceControl(int index, bool notify = true);
|
|
||||||
|
void removeDefaultProfile( QString name );
|
||||||
|
|
||||||
std::vector<AudioProfile> audioProfiles;
|
std::vector<AudioProfile> audioProfiles;
|
||||||
// std::recursive_mutex eventLoopMutexAudio;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void initStage1();
|
void initStage1();
|
||||||
void initStage2( OverlayController* parent, QQuickWindow* widget );
|
void initStage2( OverlayController* var_parent, QQuickWindow* var_widget );
|
||||||
|
|
||||||
void reloadAudioSettings();
|
void reloadAudioSettings();
|
||||||
void saveAudioSettings();
|
void saveAudioSettings();
|
||||||
@@ -126,9 +124,11 @@ public:
|
|||||||
bool micMuted() const;
|
bool micMuted() const;
|
||||||
bool micProximitySensorCanMute() const;
|
bool micProximitySensorCanMute() const;
|
||||||
bool micReversePtt() const;
|
bool micReversePtt() const;
|
||||||
|
bool audioProfileDefault() const;
|
||||||
|
|
||||||
void reloadAudioProfiles();
|
void reloadAudioProfiles();
|
||||||
void saveAudioProfiles();
|
void saveAudioProfiles();
|
||||||
|
Q_INVOKABLE void applyDefaultProfile();
|
||||||
|
|
||||||
Q_INVOKABLE int getPlaybackDeviceCount();
|
Q_INVOKABLE int getPlaybackDeviceCount();
|
||||||
Q_INVOKABLE QString getPlaybackDeviceName( int index );
|
Q_INVOKABLE QString getPlaybackDeviceName( int index );
|
||||||
@@ -136,7 +136,6 @@ public:
|
|||||||
Q_INVOKABLE int getRecordingDeviceCount();
|
Q_INVOKABLE int getRecordingDeviceCount();
|
||||||
Q_INVOKABLE QString getRecordingDeviceName( int index );
|
Q_INVOKABLE QString getRecordingDeviceName( int index );
|
||||||
|
|
||||||
// TODO check if needed?
|
|
||||||
Q_INVOKABLE unsigned getAudioProfileCount();
|
Q_INVOKABLE unsigned getAudioProfileCount();
|
||||||
Q_INVOKABLE QString getAudioProfileName( unsigned index );
|
Q_INVOKABLE QString getAudioProfileName( unsigned index );
|
||||||
|
|
||||||
@@ -162,6 +161,8 @@ public slots:
|
|||||||
void applyAudioProfile( unsigned index );
|
void applyAudioProfile( unsigned index );
|
||||||
void deleteAudioProfile( unsigned index );
|
void deleteAudioProfile( unsigned index );
|
||||||
|
|
||||||
|
void setAudioProfileDefault( bool value, bool notify = true );
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void playbackDeviceIndexChanged( int index );
|
void playbackDeviceIndexChanged( int index );
|
||||||
|
|
||||||
@@ -179,6 +180,7 @@ signals:
|
|||||||
void recordingDeviceListChanged();
|
void recordingDeviceListChanged();
|
||||||
|
|
||||||
void audioProfilesUpdated();
|
void audioProfilesUpdated();
|
||||||
|
void audioProfileAdded();
|
||||||
|
void audioProfileDefaultChanged( bool value );
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace advsettings
|
} // namespace advsettings
|
||||||
|
|||||||
@@ -407,6 +407,7 @@ void PttController::addPttProfile( QString name )
|
|||||||
savePttProfiles();
|
savePttProfiles();
|
||||||
OverlayController::appSettings()->sync();
|
OverlayController::appSettings()->sync();
|
||||||
emit pttProfilesUpdated();
|
emit pttProfilesUpdated();
|
||||||
|
emit pttProfileAdded();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PttController::applyPttProfile( unsigned index )
|
void PttController::applyPttProfile( unsigned index )
|
||||||
|
|||||||
@@ -139,6 +139,7 @@ signals:
|
|||||||
void pttRightControllerEnabledChanged( bool value );
|
void pttRightControllerEnabledChanged( bool value );
|
||||||
|
|
||||||
void pttProfilesUpdated();
|
void pttProfilesUpdated();
|
||||||
|
void pttProfileAdded();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace advsettings
|
} // namespace advsettings
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "audiomanagerwindows.h"
|
#include "AudioManagerWindows.h"
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include "easylogging++.h"
|
#include "easylogging++.h"
|
||||||
#include "../AudioTabController.h"
|
#include "../AudioTabController.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user