Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't imply that multiple drivers have errors #2168

Closed

Conversation

ann0see
Copy link
Member

@ann0see ann0see commented Dec 10, 2021

Short description of changes

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.

The following is not exactly what my (fixed) code looks like.
error message

Context: Fixes an issue?

Idea from #2163 (reply in thread)
Does this change need documentation? What needs to be documented and how?
No

Status of this Pull Request

Draft. It remains to test what happens if lNumDevs > 1.
What is missing until this pull request can be merged?
Untested since it's just a quick fix. Will test it by checking the artifacts.

Checklist

  • I've verified that this Pull Request follows the general code principles
  • I tested my code and it does what I want
  • My code follows the style guide
  • I waited some time after this Pull Request was opened and all GitHub checks completed without errors.
  • I've filled all the content above

@gilgongo
Copy link
Member

Do you think we can remove the ambiguity in the first part of the message? The driver(s) in question my in fact be perfectly usable, it's just that there is a problem with them that may or may not be temporary.

So if only one driver is erroring, just present this error message with an option to open the settings:

image

If multiple drivers are erroring, try to let the errors speak for themselves:

image

In general, long dialogue messages tend not to get read though. I find that had to accept, and don't really know why it is, but it's a very observable and common thing. So the other approach might be not to show the errors themselves and instead just have a call to action to open the settings? Depends on how helpful the messages are I guess:

image

@pljones
Copy link
Collaborator

pljones commented Dec 11, 2021

I like the first two. In the second, I'd add "If needed" at the start of the guidance - as it lists where the errors were, it may be that nothing needs be done. If the pop up does need attention - i.e. no audio device is available - that needs to be clear,

I don't like the third one because it's far too vague to decide what to do. "Maybe something is wrong with one of your sound devices but I'm not going to tell you which one or what the problem was." Thanks....

And is it "sound" or "audio"?

@gilgongo
Copy link
Member

gilgongo commented Dec 11, 2021

@pljones Ah yes the last one doesn't indicate which card has the fail. OK that's no good then :-)

BTW why "if needed"? Seems redundant. Or implies you may not want to fix the fact that Jamulus doesn't work for you?

I can never remember what we said about sound vs audio. I think it's audio as that's maybe more specific to computer things.

We now have https://jamulus.io/contribute/Style-and-Tone ! Which says... "Sound hardware" I think.

@pljones
Copy link
Collaborator

pljones commented Dec 11, 2021

BTW why "if needed"? Seems redundant. Or implies you may not want to fix the fact that Jamulus doesn't work for you?

Because you list drivers that failed. If I'm not using those drivers, why would I want to correct them? The

You may be able to correct these in the driver settings

makes it sound like it should be looked at and may be fixable. It's better to make it clear the user needs to decide what steps to take: we're not telling them to fix it - just that something went wrong that could need fixing.

You could add "if applicable", if you prefer :).


Oh yes, meant to add: if you want a shorter pop-up, add a "Details..." to pop up another dialog with the list of cards and errors (if there's more than one).


And finally... The first line and last line usually get read -- to answer "What is this?" (first line) and "What do I need to do about it?" (last line). The bit in between is noise... (Hence the "Details..." button when needed.)

@gilgongo
Copy link
Member

gilgongo commented Dec 11, 2021

Oh I see - in "plural" errors case, "If needed... " would be clearer there but it still seems odd in the "singular" error case to me.

Agree about the first and last line prominence. Generally though, popups that spawn popups are seen as a bad thing as you can lose track or the parent or child if you accidentally click on something (and I think it's a bit of a mare for those using assistive tech). Also don't forget the ASIO settings is yet another "popop" in this context. But I guess if there's more than about three error messages it might be OK (the best solution would be an expandable panel within the dialogue but I assume that's not going to be possible).

makes it sound like it should be looked at and may be fixable.

I disagree. The sense is that there may or may not be issues to fix, and our lack of specificity clues this as well. Any other wording will be unacceptably long and complicated and we'll be back where we started.

src/soundbase.cpp Outdated Show resolved Hide resolved
@@ -166,30 +166,38 @@ 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>";
QString sErrorMessage = "<b>";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just declare it here - the floating "<b>" makes the code hard to follow.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Still struggeling with the syntax though.

}
else
{
sErrorMessage += "<b>" + GetDeviceName ( 0 ) + "</b>: " + vsErrorList[0] ;
sErrorMessage += tr ( "Couldn't initialize audio driver (using %1)</b><br>"
Copy link
Collaborator

@pljones pljones Dec 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 173:

"Sound driver errors (using %1) found:</b><br>"

Line 184:

"Couldn't initialize audio driver (using %1)</b><br>"

Use the same string in both places. Ideally the less technical one. The first doesn't need to end with ":" as it no longer introduces a list.

Maybe

"Could not find a sound driver (using %1) that could be used.</b><br>"

(and do away entirely with "Your sound device is not compatible in its current state." as it would then be somewhat redundant).

And then the if checking the number of errors (more than 1 or not) is irrelevant, too.

#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 ( "You might be able to fix this error by changing settings of your ASIO driver. Do you want to open these settings now?" );
sErrorMessage += "<br/>" + tr ( "You may be able to fix errors in the driver settings." );
Copy link
Collaborator

@pljones pljones Dec 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems worthless - i.e. adding extra words to an already lengthy message that don't help the user. They're offered the option to Open ASIO settings if they want, which should be enough. Maybe add "What's this" help to it.

And has inconsistent use of <br/> vs <br> elsewhere.

@@ -166,30 +166,38 @@ QString CSoundBase::SetDev ( const QString strDevName )
if ( !vsErrorList.isEmpty() )
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 154 to 165 are irrelevant if this we enter this if. They should be placed after the block.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might the problem be that this code is run once at startup and also during runtime if someone changes the sound devices?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before line 197 was introduced, the variable set there wasn't referenced until after this if block. However, now line 197 is there, it makes sense.


if ( QMessageBox::Yes == QMessageBox::information ( nullptr, APP_NAME, sErrorMessage, QMessageBox::Yes | QMessageBox::No ) )
if ( mbWinErrorBox.clickedButton() == btnASIOSettings )
{
LoadAndInitializeFirstValidDriver ( true );
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vsErrorList = LoadAndInitializeFirstValidDriver ( true ); and then check the list size. If it's zero (and I've not checked the code to make sure I'm right here...), return strReturn rather than continuing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's more work needed then just that. See the commit I mentioned: Probably it's in a deeper level.

@ann0see
Copy link
Member Author

ann0see commented Dec 19, 2021

Ok. Maybe something like that would be ok:

image

if ( vsErrorList.isEmpty() ) {
return strReturn;
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned before, I think this is not enough.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like it's what's needed and removes my concern at https://github.com/jamulussoftware/jamulus/pull/2168/files#r770944946

Comment on lines 184 to 190
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();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably this can be simplified somehow

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's a constructor that allows most of those things to be set?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think/thought so too. However I couldn't find it in the documentation (or the code gave an error). The problem was with adding a "custom" button.

@@ -166,24 +166,35 @@ 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>Could not find compatible sound driver (using %1).</b><br><br>" ).arg ( strSystemDriverTechniqueName );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "... (using ASIO)." seems a bit confusing here as it implies a driver might be found using something else. Is there a reason we're saying this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It won't necessarily say "ASIO" - it provides meaningful information for diagnosing a problem preventing the use of the program.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, but we have a button that says "Open ASIO settings", so is that button conditional on what %1 is? This PR is to help people who aren't technical deal with the problem. If we qualify an error message in this way, they'd be excused for wondering why it's qualified, should they be using something else, etc.

Copy link
Collaborator

@pljones pljones Dec 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, see line 203 (new). The button only appear on Windows but this string is always used. (The button should also only appear for ASIO -- that needs fixing.)

The whole flow is really bad, I think - huge block of platform-specific code at level that should be platform-independent.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think "Could not find compatible sound driver (using ASIO)" feels a bit odd. Like it's expecting them to switch to something that isn't ASIO where the problem might not arise.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be less mysterious to just make it the subject in that case and say, "Could not find a compatible ASIO sound driver." That is, unless we want also to say "Maybe you should try using [other system]." which I doubt.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe go back to No usable %1 audio device found. then?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That reads better than a parenthesised suffix (I think).

BTW re. "audio device", it's probably the subject of a different ticket, but for such an important thing we should keep to a standard term. The style guide says we should be using "sound hardware" here but "audio device" does feel a bit more conventional somehow.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Fixed that.

The whole flow is really bad, I think - huge block of platform-specific code at level that should be platform-independent.

I'm a bit unsure, but I remember there was a discussion about fixing this. Wasn't @npostavs involved?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess pljones' remark at #1378 (comment) is similar.

}
sErrorMessage += "</ul>";

#ifdef _WIN32
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this defined if we're running JACK on Windows? If so, it's the wrong symbol.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so. Similar to the ASIO Device setting button.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, probably needs a bug raised to fix it, then.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Fixed this now.

@pljones
Copy link
Collaborator

pljones commented Dec 22, 2021

Before approval, this PR should show behavour when:

  • results for all platforms (iOS, Android, MacOS, Linux, Window JACK and Windows ASIO)
  • results when the final throw CGenErr ( sErrorMessage ); occurs
  • results when the final return strReturn; occurs
  • okay to say "platform tested but could not achieve failure", though, I suppose...

This is needed to ensure it remains sane...

@ann0see
Copy link
Member Author

ann0see commented Dec 25, 2021

I think it still throws an exception without returning. We‘d need some more debugging, but that would be out of scope of this PR.

@ann0see
Copy link
Member Author

ann0see commented Feb 2, 2022

No longer sure if this is moving into the right direction. Probably the exception handling needs to be part of another PR.

@ann0see ann0see marked this pull request as ready for review February 16, 2022 20:59

if ( qmASIOWarningBox.clickedButton() == btnASIOSettings )
{
vsErrorList = LoadAndInitializeFirstValidDriver ( true );
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should revert this to the original state and do functional changes here later.
Related to #2238

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. This should be handled in another PR.

@ann0see ann0see force-pushed the feature/smaller-asio-error-msg branch 2 times, most recently from f9bff4f to a42fd50 Compare February 26, 2022 21:45
@ann0see ann0see closed this Feb 26, 2022
@ann0see ann0see force-pushed the feature/smaller-asio-error-msg branch from a42fd50 to b37732e Compare February 26, 2022 21:47
@ann0see ann0see reopened this Feb 26, 2022
Comment on lines +194 to +195
// TODO: This or some related code aborts the app even if the driver is valid after user changes.
// This should be handled differently. For reference, please see https://github.com/jamulussoftware/jamulus/pull/2168
Copy link
Member Author

@ann0see ann0see Feb 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pljones I wrote a TODO comment here.

Copy link
Member Author

@ann0see ann0see left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebased this PR.

@ann0see ann0see requested a review from pljones February 26, 2022 21:58
@pljones
Copy link
Collaborator

pljones commented Feb 27, 2022

Overall, far too much of the code appears to be trying to handle Windows-ASIO specific issues in src/soundbase.cpp, rather than windows/sound.cpp. I'd rather any improvements were focussed on removing ASIO code from src/*.

@ann0see ann0see added the stale label Mar 4, 2022
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.
Copy link
Member Author

@ann0see ann0see left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the text part should be split out into another PR (and the addition of the open ASIO Settings button overthought again)

ann0see added a commit to ann0see/jamulus that referenced this pull request Mar 12, 2022
@ann0see
Copy link
Member Author

ann0see commented Mar 12, 2022

Closing in favour of #2496 we should probably split this PR.

@ann0see ann0see closed this Mar 12, 2022
ann0see added a commit to ann0see/jamulus that referenced this pull request Mar 13, 2022
ann0see added a commit to ann0see/jamulus that referenced this pull request Mar 13, 2022
ann0see added a commit to ann0see/jamulus that referenced this pull request Mar 13, 2022
@pgScorpio pgScorpio mentioned this pull request Mar 13, 2022
5 tasks
ann0see added a commit to ann0see/jamulus that referenced this pull request Mar 22, 2022
ann0see added a commit to ann0see/jamulus that referenced this pull request Apr 12, 2022
ann0see added a commit to ann0see/jamulus that referenced this pull request Apr 13, 2022
ann0see added a commit to ann0see/jamulus that referenced this pull request May 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants