-
Notifications
You must be signed in to change notification settings - Fork 6
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
Sim crashes with audio=disabled
if user tries to enable audio from the Preferences dialog
#746
Comments
The comment before the assertion is
@zepumph do you think we can remove this? I think one of the benefits of using However, the real bug for this issue is that any Audio controls are available in the Preferences Dialog when |
I thought about this patch: Index: js/preferences/PreferencesConfiguration.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- js/preferences/PreferencesConfiguration.js (revision 207264bc008a8f37535bf475521bb0b1c7d267d3)
+++ js/preferences/PreferencesConfiguration.js (date 1631915041553)
@@ -24,6 +24,10 @@
// are requested.
const phetFeatures = phet.chipper.queryParameters;
+ // if the 'audio' query parameter is used to disable all audio, none of the features under audioOptions
+ // will be supported
+ const supportsAudio = phetFeatures.audio !== 'disabled';
+
// For now, the Voicing feature is only available when we are running in the english locale, accessibility
// strings are not made available for translation.
const simLocale = phet.chipper.locale || 'en';
@@ -51,14 +55,17 @@
// The entry point for Voicing, and if true the sim will support Voicing and Voicing options in Preferences.
// The feature is only available on platforms where SpeechSynthesis is supported. For now, it is only available
// when running with english locales, accessibility strings are not made available for translation yet.
- supportsVoicing: phetFeatures.supportsVoicing && voicingManager.isSpeechSynthesisSupported() && simLocale === 'en',
+ supportsVoicing: phetFeatures.supportsVoicing &&
+ voicingManager.isSpeechSynthesisSupported() &&
+ simLocale === 'en' &&
+ supportsAudio,
// {boolean} - Whether or not to include checkboxes related to sound and enhanced sound. supportsEnhancedSound
// can only be included if supportsSound is also true.
// NOTE: When initialize-globals uses package.json to control sound features the packageJSON check
// here can be removed
- supportsSound: phetFeatures.supportsSound,
- supportsEnhancedSound: phetFeatures.supportsEnhancedSound
+ supportsSound: phetFeatures.supportsSound && supportsAudio,
+ supportsEnhancedSound: phetFeatures.supportsEnhancedSound && supportsAudio
},
// configuration for controls in the "Input" tab of the PreferencesDialog But don't like that So I went with the above commit instead to remove audio controls from Preferences with audio=disabled. @zepumph can you please review this commit and the suggestion to remove the assertion in ParallelDOM? |
It seems like there is a setup already for handling the view, but this feels a bit more "modely" to me. Perhaps there is no spot currently, but there will be after #743. Also, in my naive perspective, I would think you should use AudioManager.supportsAudio instead of checking on the query parameter. What do you think? |
Hiding the Audio tab of the Preferences dialog when What happens if the only content left in a Preferences dialog is the blurb under General? The Preferences dialog would be essentially empty at that point. Should we hide the Preferences dialog/button completely in that situation? |
I think you are correct. PreferencesConfiguration is essentially the model for this, do you prefer the first patch in #746 (comment)?
You are right about this if we keep it in the view, just updated that part at least. |
That patch is a bit quirky, but I don't hate it, those features should already be listening to the global control in general. Presumably that is just demonstrating the underlying lack of model. Wouldn't that get better once we consolidate the config and control Properties into a PreferencesModel? |
I would recommend keeping this assertion for now. Without it, there will be a no op when we would expect to see an utterance. This will be much more difficult catch without the assertion. |
OK sounds good, lets come back to this after #743. Adding the "on-hold" label.
OK sounds good. |
@arouinfar correct, it would only have the "General" tab. I hadn't thought of this case because the Preferences dialog is added as to sims as they get new features that would use it instead of across the board eagerly. But this didn't consider query parameters like this. If you would like to hide the button in cases like this we can do that. The only downside I can imagine is in development, I could see someone trying to add the NavigationBarPreferencesButton for the first time without content and wondering why the button isn't showing up. But some documentation would hopefully avoid confusion. |
It sounds like it could be messy and less dev-friendly to completely hide the dialog if query parameters reduce its contents to essentially nothing (General tab with just the default blurb). It's possible that this scenario isn't actually realistic. I looked through the sims with a11y features and Waves Intro is the only sim that supports sound without also supporting alt input (though it has partial support for alt input). If a sim supports alt input, it would likely have a Visual tab with the Interactive Highlights option, right? Moving forward, the goal is for sims to include both sound and alt input in their 1.0 releases (though this doesn't apply to sims currently nearing the finish line). @jessegreenberg if you think |
@jessegreenberg can you please recommend which commits @jbphet should cherry-pick into BASE? |
Yes, after reviewing I think both commits in this should be cherry-picked into a joist branch for BASE 1.5. That includes |
Now that we have a better PreferencesModel from #743 we can wrap this up. Though I am not exactly sure what is best. My thinking is that we need to move the check added in 034eacb into the PreferencesModel such that Done in the above commit. @zepumph can you please look at this in conjunction with the changes from #743? Can this now be closed? |
Looks great! Thanks. |
Steps to reproduce:
audio=disabled
such as GLFB or BASE.Troubleshooting Info for BASE
Name: Balloons and Static Electricity
URL: https://bayes.colorado.edu/dev/phettest/balloons-and-static-electricity/balloons-and-static-electricity_en.html?ea&brand=phet&audio=disabled
Version: 1.6.0-dev.0 (unbuilt)
Features missing: applicationcache, applicationcache, touch
Flags: pixelRatioScaling
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36
Language: en-US
Window: 1440x789
Pixel Ratio: 2/1
WebGL: WebGL 1.0 (OpenGL ES 2.0 Chromium)
GLSL: WebGL GLSL ES 1.0 (OpenGL ES GLSL ES 1.0 Chromium)
Vendor: WebKit (WebKit WebGL)
Vertex: attribs: 16 varying: 15 uniform: 1024
Texture: size: 16384 imageUnits: 16 (vertex: 16, combined: 80)
Max viewport: 16384x16384
OES_texture_float: true
Dependencies JSON: {}
Troubleshooting Info for GFLB
Name: Gravity Force Lab: Basics
URL: https://bayes.colorado.edu/dev/phettest/gravity-force-lab-basics/gravity-force-lab-basics_en.html?ea&brand=phet&audio=disabled
Version: 1.2.0-dev.0 (unbuilt)
Features missing: applicationcache, applicationcache, touch
Flags: pixelRatioScaling
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36
Language: en-US
Window: 1440x789
Pixel Ratio: 2/1
WebGL: WebGL 1.0 (OpenGL ES 2.0 Chromium)
GLSL: WebGL GLSL ES 1.0 (OpenGL ES GLSL ES 1.0 Chromium)
Vendor: WebKit (WebKit WebGL)
Vertex: attribs: 16 varying: 15 uniform: 1024
Texture: size: 16384 imageUnits: 16 (vertex: 16, combined: 80)
Max viewport: 16384x16384
OES_texture_float: true
Dependencies JSON: {}
Both of these sims are currently in RC testing. This particular bug is not present in the RC branches, but the behavior is buggy, see phetsims/balloons-and-static-electricity#543 and phetsims/gravity-force-lab-basics#311.
The text was updated successfully, but these errors were encountered: