Skip to content

Commit

Permalink
do not throw error if failed to set audio device
Browse files Browse the repository at this point in the history
  • Loading branch information
Odizinne committed Nov 8, 2024
1 parent fd1566c commit b683f79
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions AudioManager/AudioManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ void AudioManager::setAudioDevice(QString ID)
while (retryCount < maxRetries) {
// Correctly add double quotes around the ID, without adding escape characters
QString setCommand = QString("Set-AudioDevice -ID \"") + ID + "\"";
qDebug() << setCommand;
result = executeCommand(setCommand);

if (result.find("Error") == std::string::npos) {
Expand All @@ -66,8 +65,7 @@ void AudioManager::setAudioDevice(QString ID)
}

if (!deviceFound) {
throw std::runtime_error("Failed to set the audio device after "
+ std::to_string(maxRetries) + " attempts.");
qDebug() << "Unable to set audio device.";
}
}

Expand Down Expand Up @@ -170,10 +168,8 @@ QList<Device> AudioManager::ListAudioOutputDevices()

void AudioManager::PrintAudioOutputDevices()
{
// Call ListAudioOutputDevices to get the list of devices
QList<Device> devices = ListAudioOutputDevices();

// Loop through the devices and print their names and IDs
for (const Device& device : devices) {
qDebug() << "Device Name: " << device.name;
qDebug() << "Device ID: " << device.ID;
Expand Down

0 comments on commit b683f79

Please sign in to comment.