[squeak-dev] Adjusting the volume of a sound as it's playing

Stéphane Rollandin lecteur at zogotounga.net
Sun Aug 18 10:07:24 UTC 2019


> For the volume control to work in MixedSound, it seems you would have to
> replace the lines
> 
> 	left := (leftVol * (leftVols at: i)) // ScaleFactor.
> 	right := (rightVol * (rightVols at: i)) // ScaleFactor.
> 
> with
> 
> 	left := (leftVol * (leftVols at: i) * scaledVol) // ScaleFactor.
> 	right := (rightVol * (rightVols at: i) * scaledVol) // ScaleFactor.
> 
> in MixedSound>>#mixSampleCount:into:startingAt:leftVol:rightVol:

scaledVol is not in the [0,1] range, so that would be

	left := (leftVol * (leftVols at: i) * scaledVol // ScaleFactor) // 
ScaleFactor.
	right := (rightVol * (rightVols at: i) * scaledVol // ScaleFactor) // 
ScaleFactor.

Stef


More information about the Squeak-dev mailing list