-
Notifications
You must be signed in to change notification settings - Fork 3
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
When sound for the Fourier series is turned on, duck all user-interface sounds. #55
Comments
I looked at the ducking solution in WaveMeterNode.js. It is very sim-specific. When either of the meter's probes is inside the box, "the water drops, speaker or light sound" are ducked: // Turn down the water drops, speaker or light sound when the wave meter is being used.
this.duckingProperty = new DerivedProperty( [ series1PlayingProperty, series2PlayingProperty ], ( a, b ) => {
if ( a || b ) {
return 0.3;
}
else {
return 1;
}
} ); It was a little difficult to hear the effects of this, so I changed 0.3 to 0 in the above code, and confirmed that those sounds are totally turned off. So this is ducking a few sounds for which sim is fully responsible -- it owns their sound clips, can directly set their output levels, etc. There is nothing here that can be used to duck all "user-interface" category sounds. What we need is an output level control for each category of sounds. Hopefully something like that exists. I'll discuss with @jbphet. |
Use |
Ducking for 'user-interface' sounds has been implemented. When We can fiddle with balancing output levels later in #54. Closing. |
Reopening, there's a problem here. The Fourier series sound is attenuating sound on other screens. I think I've figured out how to address this, but I need a sanity check. When the Fourier series sound is turned on, all sounds for the 'user-interface' category are attenuated. In DiscreteScreenView.js, we observe // When sound is enabled for the Fourier series, duck all user-interface sounds.
const userInterfaceDefaultOutputLevel = soundManager.getOutputLevelForCategory( 'user-interface' );
model.fourierSeriesSoundEnabledProperty.link( enabled => {
const outputLevel = enabled ? 0.1 * userInterfaceDefaultOutputLevel : userInterfaceDefaultOutputLevel;
soundManager.setOutputLevelForCategory( 'user-interface', outputLevel );
} ); In #101, we associated FourierSoundGenerator with the Discrete screen, so that it will be silenced when switching screens. But To demonstrate the problem:
Observing FourierSoundGenerator's // When the FourierSoundGenerator is producing sound, duck all user-interface sounds.
const userInterfaceDefaultOutputLevel = soundManager.getOutputLevelForCategory( 'user-interface' );
fourierSoundGenerator.fullyEnabledProperty.link( fullyEnabled => {
const outputLevel = fullyEnabled ? 0.1 * userInterfaceDefaultOutputLevel : userInterfaceDefaultOutputLevel;
soundManager.setOutputLevelForCategory( 'user-interface', outputLevel );
} ); I've read the doc, and I don't really understand @jbphet please advise. |
I took a shot at incorporating the visibility of the screen view into the logic for when the UI sounds are ducked. Here is what I came up with. I tested it, and it seemed to work. Will this do the trick? // When the FourierSoundGenerator is producing sound, duck all user-interface sounds.
const userInterfaceDefaultOutputLevel = soundManager.getOutputLevelForCategory( 'user-interface' );
const viewDisplayedProperty = new DisplayedProperty( this );
Property.multilink(
[ viewDisplayedProperty, model.fourierSeriesSoundEnabledProperty ],
( viewDisplayed, soundEnabled ) => {
const uiComponentSoundOutputLevel = viewDisplayed && soundEnabled ?
0.1 * userInterfaceDefaultOutputLevel :
userInterfaceDefaultOutputLevel;
soundManager.setOutputLevelForCategory( 'user-interface', uiComponentSoundOutputLevel );
}
) |
I guess that would work. But was there a problem with how I solved this, by observing I'd also like to understand SoundGenerator |
Sorry, I should have read #55 (comment) more carefully. I thought you were still looking for a solution. I think using As far as being locally versus fully enabled, locally enabled is akin to having |
Great, thanks! Then I'll stick with the current solution of observing |
Reopening. Sound ducking is broken again. 'user-interface' category sounds are now ALWAYS ducked on the Discrete screen. They should only be ducked when the checkbox is checked for the Fourier series sound. This was working in 1.0.0-dev.31 on 7/7/21. Looks like listening to |
SoundGenerator |
From #54 (comment):
The text was updated successfully, but these errors were encountered: