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

David T. Lewis lewis at mail.msen.com
Fri Dec 6 14:33:13 UTC 2019


This thread died out in late August, and was mentioned today in
the "Squeak and the SoundPlugin in cog VM" thread.

@Stef, could you please attach a fileout with the fixed method? I
think that it is just one method change, so I can put that in the
inbox and make sure it gets included in trunk.

Thanks!
Dave

On Sun, Aug 18, 2019 at 12:07:24PM +0200, St??phane Rollandin wrote:
> 
> >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