[squeak-dev] Adjusting the volume of a sound as it's playing
Jim Rosenberg
jr at amanue.com
Sun Aug 18 06:37:21 UTC 2019
Apologies in advance if this has been fixed in more recent versions of
Squeak; I'm developing at the moment under Squeak 4.3.
I have a project in which I'm adding sound to a longstanding body of
artistic work implemented in Squeak. I'm going to need several sounds
playing at once; typically there will be one or more instances of
RepeatingSound and probably just one (or zero) MixedSound. When the
MixedSound comes on I want to turn down the volume on the other sounds. How
to do this. It has been driving me crazy. I was getting absolutely nothing
to work to actually change the volume.
There seems to be the right method in AbstractSound --
adjustVolumeTo:overMSecs: -- but in Squeak 4.3 this seems to not be
properly overridden in MixedSound or RepeatingSound. I was getting
absolutely nothing to work until I stumbled onto changing leftVols and
rightVols by brute force at an explorer. This DOES WORK.
leftVols and rightVols are instance variables in MixedSound, so it seems to
me they should be changed by MixedSound's own implementation of
adjustVolumeTo:overMSecs:. RepeatingSound should have its own
implementation which just passes on to its sound.
Maybe there's a better way to do this, but given that AbstractSound does
have the right method, it seems like overriding here is the right thing to
do.
Comments?
-Thanks, Jim
More information about the Squeak-dev
mailing list
|