Added Audio Profiles
This commit is contained in:
@@ -57,8 +57,7 @@ SOURCES += src/main.cpp\
|
|||||||
src/tabcontrollers/UtilitiesTabController.cpp \
|
src/tabcontrollers/UtilitiesTabController.cpp \
|
||||||
src/utils/ChaperoneUtils.cpp \
|
src/utils/ChaperoneUtils.cpp \
|
||||||
src/main.cpp \
|
src/main.cpp \
|
||||||
src/overlaycontroller.cpp \
|
src/overlaycontroller.cpp
|
||||||
src/tabcontrollers/AudioProfileController.cpp
|
|
||||||
|
|
||||||
HEADERS += src/overlaycontroller.h \
|
HEADERS += src/overlaycontroller.h \
|
||||||
src/logging.h \
|
src/logging.h \
|
||||||
@@ -108,8 +107,7 @@ HEADERS += src/overlaycontroller.h \
|
|||||||
third-party/openvr/bin/osx64/OpenVR.framework/Versions/A/Headers/openvr_driver.h \
|
third-party/openvr/bin/osx64/OpenVR.framework/Versions/A/Headers/openvr_driver.h \
|
||||||
third-party/openvr/headers/openvr.h \
|
third-party/openvr/headers/openvr.h \
|
||||||
third-party/openvr/headers/openvr_capi.h \
|
third-party/openvr/headers/openvr_capi.h \
|
||||||
third-party/openvr/headers/openvr_driver.h \
|
third-party/openvr/headers/openvr_driver.h
|
||||||
src/tabcontrollers/AudioProfileController.h
|
|
||||||
|
|
||||||
win32 {
|
win32 {
|
||||||
SOURCES += src/tabcontrollers/audiomanager/AudioManagerWindows.cpp \
|
SOURCES += src/tabcontrollers/audiomanager/AudioManagerWindows.cpp \
|
||||||
|
|||||||
@@ -464,7 +464,8 @@ namespace advsettings {
|
|||||||
|
|
||||||
|
|
||||||
/*AUDIO PROFILE FUNCTIONS
|
/*AUDIO PROFILE FUNCTIONS
|
||||||
The functions in this section pertain to saving the Audio settings.
|
The following section includes the code required to save and load Audio Profiles.
|
||||||
|
|
||||||
Saved Settings Include:
|
Saved Settings Include:
|
||||||
Playback Device
|
Playback Device
|
||||||
Mirror Device
|
Mirror Device
|
||||||
@@ -475,6 +476,19 @@ namespace advsettings {
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Name: reloadAudioProfiles
|
||||||
|
|
||||||
|
Inputs: args: none
|
||||||
|
other: Reads audioProfiles setting from file
|
||||||
|
|
||||||
|
|
||||||
|
Output: return:none
|
||||||
|
other:none
|
||||||
|
|
||||||
|
Description: Clears working copy, and reloads from Settings file.
|
||||||
|
|
||||||
|
*/
|
||||||
void AudioTabController::reloadAudioProfiles() {
|
void AudioTabController::reloadAudioProfiles() {
|
||||||
audioProfiles.clear();
|
audioProfiles.clear();
|
||||||
auto settings = OverlayController::appSettings();
|
auto settings = OverlayController::appSettings();
|
||||||
@@ -488,11 +502,28 @@ namespace advsettings {
|
|||||||
entry.playbackName = settings->value("playbackName").toString().toStdString();
|
entry.playbackName = settings->value("playbackName").toString().toStdString();
|
||||||
entry.micName = settings->value("micName").toString().toStdString();
|
entry.micName = settings->value("micName").toString().toStdString();
|
||||||
entry.mirrorName = settings->value("mirrorName").toString().toStdString();
|
entry.mirrorName = settings->value("mirrorName").toString().toStdString();
|
||||||
|
entry.micMute = settings->value("micMute", false).toBool();
|
||||||
|
entry.mirrorMute = settings->value("mirrorMute", false).toBool();
|
||||||
|
entry.mirrorVol = settings->value("mirrorVol", 0.0).toFloat();
|
||||||
|
entry.micVol = settings->value("micVol", 1.0).toFloat();
|
||||||
}
|
}
|
||||||
settings->endArray();
|
settings->endArray();
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Name: saveAudioProfile
|
||||||
|
|
||||||
|
Inputs: args: none
|
||||||
|
other: none
|
||||||
|
|
||||||
|
|
||||||
|
Output: return: none
|
||||||
|
other: Writes audioProfiles setting to file
|
||||||
|
|
||||||
|
Description: saves a copy of the audio profiles from working to Settings file.
|
||||||
|
|
||||||
|
*/
|
||||||
void AudioTabController::saveAudioProfiles() {
|
void AudioTabController::saveAudioProfiles() {
|
||||||
auto settings = OverlayController::appSettings();
|
auto settings = OverlayController::appSettings();
|
||||||
settings->beginGroup(getSettingsName());
|
settings->beginGroup(getSettingsName());
|
||||||
@@ -504,6 +535,10 @@ namespace advsettings {
|
|||||||
settings->setValue("playbackName", QString::fromStdString(p.playbackName));
|
settings->setValue("playbackName", QString::fromStdString(p.playbackName));
|
||||||
settings->setValue("micName", QString::fromStdString(p.micName));
|
settings->setValue("micName", QString::fromStdString(p.micName));
|
||||||
settings->setValue("mirrorName", QString::fromStdString(p.mirrorName));
|
settings->setValue("mirrorName", QString::fromStdString(p.mirrorName));
|
||||||
|
settings->setValue("micMute", p.micMute);
|
||||||
|
settings->setValue("mirrorMute", p.mirrorMute);
|
||||||
|
settings->setValue("micVol", p.micVol);
|
||||||
|
settings->setValue("mirrorVol", p.mirrorVol);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
settings->endArray();
|
settings->endArray();
|
||||||
@@ -512,6 +547,19 @@ namespace advsettings {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Name: addAudioProfile
|
||||||
|
|
||||||
|
Inputs: args: Qstring name - the name of the audio profile
|
||||||
|
other: none
|
||||||
|
|
||||||
|
|
||||||
|
Output: return: none
|
||||||
|
other: audioProfile to audioProfiles array
|
||||||
|
|
||||||
|
Description: Creates an audioProfile, and adds it to the working copy of audioProfiles[]
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
void AudioTabController::addAudioProfile(QString name) {
|
void AudioTabController::addAudioProfile(QString name) {
|
||||||
AudioProfile* profile = nullptr;
|
AudioProfile* profile = nullptr;
|
||||||
@@ -530,26 +578,74 @@ namespace advsettings {
|
|||||||
profile->playbackName = getPlaybackDeviceName(m_playbackDeviceIndex).toStdString();
|
profile->playbackName = getPlaybackDeviceName(m_playbackDeviceIndex).toStdString();
|
||||||
profile->mirrorName = getPlaybackDeviceName(m_mirrorDeviceIndex).toStdString();
|
profile->mirrorName = getPlaybackDeviceName(m_mirrorDeviceIndex).toStdString();
|
||||||
profile->micName = getRecordingDeviceName(m_recordingDeviceIndex).toStdString();
|
profile->micName = getRecordingDeviceName(m_recordingDeviceIndex).toStdString();
|
||||||
|
profile->micMute = m_micMuted;
|
||||||
|
profile->mirrorMute = m_mirrorMuted;
|
||||||
|
profile->mirrorVol = m_mirrorVolume;
|
||||||
|
profile->micVol = m_micVolume;
|
||||||
|
|
||||||
saveAudioProfiles();
|
saveAudioProfiles();
|
||||||
OverlayController::appSettings()->sync();
|
OverlayController::appSettings()->sync();
|
||||||
emit audioProfilesUpdated();
|
emit audioProfilesUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
//POSSIBLE TODO MIRROR/PLAYBACK SAME ON SWTICH
|
|
||||||
|
/*
|
||||||
|
Name: applyAudioProfile
|
||||||
|
|
||||||
|
Inputs: args: index - index of audioProfile in audioProfiles[]
|
||||||
|
other: audioProfile based on index
|
||||||
|
|
||||||
|
|
||||||
|
Output: return: none
|
||||||
|
other: none
|
||||||
|
|
||||||
|
Description: Applies the required logic to activate the audio profile.
|
||||||
|
|
||||||
|
*/
|
||||||
|
//TODO Remembers Mirror Volume when switching to main volume.
|
||||||
void AudioTabController::applyAudioProfile(unsigned index) {
|
void AudioTabController::applyAudioProfile(unsigned index) {
|
||||||
if (index < audioProfiles.size()) {
|
if (index < audioProfiles.size()) {
|
||||||
auto& profile = audioProfiles[index];
|
auto& profile = audioProfiles[index];
|
||||||
setMirrorDeviceIndex(getMirrorIndex(profile.mirrorName), true);
|
int mInd = getMirrorIndex(profile.mirrorName);
|
||||||
setPlaybackDeviceIndex(getPlaybackIndex(profile.playbackName), true);
|
int pInd = getPlaybackIndex(profile.playbackName);
|
||||||
|
|
||||||
|
//Needed to keep remembering when swtiching from mirror/main etc.
|
||||||
|
setMicMuted(false, false);
|
||||||
|
setMirrorMuted(false, false);
|
||||||
|
|
||||||
|
if ((m_playbackDeviceIndex == mInd) && (m_mirrorDeviceIndex == pInd)) {
|
||||||
|
setMirrorDeviceIndex(-1, true);
|
||||||
|
}
|
||||||
|
if (m_playbackDeviceIndex == mInd) {
|
||||||
|
setPlaybackDeviceIndex(pInd, true);
|
||||||
|
setMirrorDeviceIndex(mInd, true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
setMirrorDeviceIndex(mInd, true);
|
||||||
|
setPlaybackDeviceIndex(pInd, true);
|
||||||
|
}
|
||||||
setMicDeviceIndex(getRecordingIndex(profile.micName), true);
|
setMicDeviceIndex(getRecordingIndex(profile.micName), true);
|
||||||
//TODO apply logic here
|
setMicMuted(profile.micMute, true);
|
||||||
//setPttShowNotification(profile.showNotification);
|
setMirrorMuted(profile.mirrorMute, true);
|
||||||
//reloadAudioProfiles();
|
setMicVolume(profile.micVol, true);
|
||||||
|
setMirrorVolume(profile.mirrorVol, true);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Name: deleteAudioProfile
|
||||||
|
|
||||||
|
Inputs: args: index - index of audioProfile in audioProfiles[]
|
||||||
|
other: audioProfile based on index
|
||||||
|
|
||||||
|
|
||||||
|
Output: return: none
|
||||||
|
other: none
|
||||||
|
|
||||||
|
Description: Removes selected Audio Profile
|
||||||
|
|
||||||
|
*/
|
||||||
void AudioTabController::deleteAudioProfile(unsigned index) {
|
void AudioTabController::deleteAudioProfile(unsigned index) {
|
||||||
if (index < audioProfiles.size()) {
|
if (index < audioProfiles.size()) {
|
||||||
auto pos = audioProfiles.begin() + index;
|
auto pos = audioProfiles.begin() + index;
|
||||||
@@ -561,7 +657,6 @@ namespace advsettings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
unsigned AudioTabController::getAudioProfileCount() {
|
unsigned AudioTabController::getAudioProfileCount() {
|
||||||
return (unsigned)audioProfiles.size();
|
return (unsigned)audioProfiles.size();
|
||||||
}
|
}
|
||||||
@@ -574,7 +669,7 @@ namespace advsettings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Function 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), setMirrorDeviceIndex(int,bool) setPlayBackDeviceIndex(int,bool)
|
output: integer for use In: setMicDeviceIndex(int,bool), setMirrorDeviceIndex(int,bool) setPlayBackDeviceIndex(int,bool)
|
||||||
|
|||||||
@@ -22,8 +22,6 @@ namespace advsettings {
|
|||||||
float micVol = 0.0;
|
float micVol = 0.0;
|
||||||
bool micMute = false;
|
bool micMute = false;
|
||||||
bool mirrorMute = false;
|
bool mirrorMute = false;
|
||||||
//TODO all the settings!!! huehue
|
|
||||||
//bool showNotification = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user