Skip to content

Commit

Permalink
Don't imply that multiple drivers have errors
Browse files Browse the repository at this point in the history
If there's only one driver with an error message, there's no need to 
imply that multiple devices have errors. This change is done to simplify 
the error message.
  • Loading branch information
ann0see committed Feb 26, 2022
1 parent b37732e commit a42fd50
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/soundbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,23 +167,32 @@ QString CSoundBase::SetDev ( const QString strDevName )
if ( !vsErrorList.isEmpty() )
{
// create error message with all details
QString sErrorMessage = "<b>" + QString ( tr ( "No usable %1 audio device found." ) ).arg ( strSystemDriverTechniqueName ) +
"</b><br><br>" + tr ( "These are all the available drivers with error messages:" ) + "<ul>";
QString sErrorMessage = tr ( "<b>No usable %1 audio device found.</b><br><br>" ).arg ( strSystemDriverTechniqueName );

for ( int i = 0; i < lNumDevs; i++ )
{
sErrorMessage += "<li><b>" + GetDeviceName ( i ) + "</b>: " + vsErrorList[i] + "</li>";
sErrorMessage += "<b>" + GetDeviceName ( i ) + "</b>: " + vsErrorList[i] + "<br><br>";
}
sErrorMessage += "</ul>";

#ifdef _WIN32
// to be able to access the ASIO driver setup for changing, e.g., the sample rate, we
// offer the user under Windows that we open the driver setups of all registered
// ASIO drivers
sErrorMessage += "<br/>" + tr ( "Do you want to open the ASIO driver setup to try changing your configuration to a working state?" );
sErrorMessage += "<br>" + tr ( "You may be able to fix errors in the driver settings." );

if ( QMessageBox::Yes == QMessageBox::information ( nullptr, APP_NAME, sErrorMessage, QMessageBox::Yes | QMessageBox::No ) )
// for Windows use a QMessageBox to show the error
QMessageBox qmASIOWarningBox;
QPushButton* btnASIOSettings = qmASIOWarningBox.addButton ( tr ( "Open ASIO settings" ), QMessageBox::AcceptRole );

qmASIOWarningBox.addButton ( QMessageBox::Cancel );
qmASIOWarningBox.setText ( sErrorMessage );
qmASIOWarningBox.setIcon ( QMessageBox::Warning );
qmASIOWarningBox.exec();

if ( qmASIOWarningBox.clickedButton() == btnASIOSettings )
{
// TODO: This or some related code aborts the app even if the driver is valid after user changes.
// This should be handled differently
LoadAndInitializeFirstValidDriver ( true );
}

Expand Down

0 comments on commit a42fd50

Please sign in to comment.