[squeak-dev] The Trunk: Sound-eem.72.mcz
commits at source.squeak.org
commits at source.squeak.org
Sat Sep 19 13:41:06 UTC 2020
Eliot Miranda uploaded a new version of Sound to project The Trunk:
http://source.squeak.org/trunk/Sound-eem.72.mcz
==================== Summary ====================
Name: Sound-eem.72
Author: eem
Time: 19 September 2020, 6:41:04.690078 am
UUID: 993decea-486a-4d07-badb-dda290a3194e
Ancestors: Sound-ct.71
Fix an annopying behaviour in MixedSound. If the same SampledSound is added more than once to a MixedSound then mix-down will produce weird results. Fix by checking for duplicates in MixedSound>>add:pan:volume: and silently taking a copy. Levente, if this is the wrong approach LMK and I can commit a version that raises an error instead.
=============== Diff against Sound-ct.71 ===============
Item was changed:
----- Method: MixedSound>>add:pan:volume: (in category 'composition') -----
add: aSound pan: leftRightPan volume: volume
"Add the given sound with the given left-right pan, where 0.0 is full left, 1.0 is full right, and 0.5 is centered. The loudness of the sound will be scaled by volume, which ranges from 0 to 1.0."
| pan vol |
pan := ((leftRightPan * ScaleFactor) asInteger max: 0) min: ScaleFactor.
vol := ((volume * ScaleFactor) asInteger max: 0) min: ScaleFactor.
+ "Sounds have state. If a sound occurs more than once in sounds then mixing can produce some very strange results"
+ sounds := sounds copyWith: ((sounds includes: aSound) ifTrue: [aSound copy] ifFalse: [aSound]).
- sounds := sounds copyWith: aSound.
leftVols := leftVols copyWith: ((ScaleFactor - pan) * vol) // ScaleFactor.
+ rightVols := rightVols copyWith: (pan * vol) // ScaleFactor!
- rightVols := rightVols copyWith: (pan * vol) // ScaleFactor.
- !
More information about the Squeak-dev
mailing list
|