I’m displaying a dialog as follows, and it beeps when it opens. It’s basically code copied from the Windows demo of the Juce Demo, and those windows also beep when they open. However I don’t see where the beep is coming from. How can the window be opened silently?
I just found this bug also occurs in the ThreadWithProgressWindow class. The progress window always beeps when it opens! Clearly this would be annoying to users. Surely these dialogs should not default to beeping when opened.
Can you post the call stack that’s calling playAlertSound? I don’t see it called from anywhere in the juce code except KeyPressMappingSet::keyPressed() when a shortcut key is disabled.
The beep is easy to recreate. Just run the JuceDemo app. Click the Windows demo heading. Then click the Show Windows button. It beeps.
I had posted a workaround for the beep earlier in this thread: Subclassing GlobalLookAndFeel with a feel with a silent beep. However its not a complete solution. It leaves the entire app’s look and feel changed with no way to reset it.
The documentation in juce_Desktop.h for setDefaultLookAndFeel says: “if this is set to nullptr, it will revert to using the system’s default one.”
But this:
LookAndFeel::setDefaultLookAndFeel(nullptr);
… does not work. The look and feel remains changed.
As daniel suggested, could we have an option in LaunchOptions to open silently? Presumably it should default to silent, as usually it’s not considered polite these days to beep on opening a dialog, even an alert.
I can’t reproduce the issue, if I set a break point in playAlertSound() it is never hit.
The only place playAlertSound() is called from is Component::inputAttemptWhenModal() or KeyPressMappingSet::keyPressed(), I don’t see why either of these would be getting called opening a Dialog.
If you could post a callstack, I could maybe figure out why it’s happening.
The only way I can get it to beep is to click on the main demo window after the dialog has opened, in this case it should beep, since the window is blocked from receiving input by the modal dialog.
I just pulled the latest dev branch of JUCE, built Juce Demo, and the beep is gone. It was there in my application and also in Juce Demo when I first posted this thread. I’m not sure why it’s gone now. Anyway I guess we can consider it fixed.
The beep is back! Both in my application and in Juce Demo.
Juce Demo does stop at a breakpoint on playAlertSound() when opening the Windows demo. Since it’s intermittent it’s probably something that’s not being initialized. Here is a stack trace: