[squeak-dev] The Trunk: Sound-nice.27.mcz
commits at source.squeak.org
commits at source.squeak.org
Mon Mar 28 08:41:54 UTC 2011
Nicolas Cellier uploaded a new version of Sound to project The Trunk:
http://source.squeak.org/trunk/Sound-nice.27.mcz
==================== Summary ====================
Name: Sound-nice.27
Author: nice
Time: 28 March 2011, 10:41:52.961 am
UUID: f929c429-686e-a046-8fb1-8ca85f1fb691
Ancestors: Sound-ul.26
Minor #ifNil: refactorings
=============== Diff against Sound-ul.26 ===============
Item was changed:
----- Method: QueueSound>>currentSound (in category 'accessing') -----
currentSound
+ ^ currentSound ifNil: [currentSound := self nextSound]!
- currentSound isNil ifTrue: [currentSound := self nextSound].
- ^ currentSound!
Item was changed:
----- Method: QueueSound>>doControl (in category 'sound generation') -----
doControl
super doControl.
+ self currentSound ifNotNil: [:curSound | curSound doControl]!
- self currentSound notNil ifTrue: [self currentSound doControl]!
Item was changed:
----- Method: QueueSound>>mixSampleCount:into:startingAt:leftVol:rightVol: (in category 'sound generation') -----
mixSampleCount: n into: aSoundBuffer startingAt: startIndex leftVol: leftVol rightVol: rightVol
"Play a collection of sounds in sequence."
| finalIndex i remaining count rate |
+ self currentSound ifNil: [^ self]. "already done"
- self currentSound isNil ifTrue: [^ self]. "already done"
self startTime > Time millisecondClockValue ifTrue: [^ self].
rate := self samplingRate.
finalIndex := (startIndex + n) - 1.
i := startIndex.
[i <= finalIndex] whileTrue: [
+ [
+ self currentSound ifNil: [^ self].
+ (remaining := self currentSound samplesRemaining) <= 0]
+ whileTrue: [self currentSound: self nextSound].
- [self currentSound isNil ifTrue: [^ self].
- (remaining := self currentSound samplesRemaining) <= 0]
- whileTrue: [self currentSound: self nextSound].
count := (finalIndex - i) + 1.
remaining < count ifTrue: [count := remaining].
self currentSound mixSampleCount: count into: aSoundBuffer startingAt: i leftVol: leftVol rightVol: rightVol.
i := i + count]!
Item was changed:
----- Method: QueueSound>>reset (in category 'sound generation') -----
reset
super reset.
+ self currentSound
+ ifNil: [self currentSound: self nextSound]
+ ifNotNil: [:curSound | curSound reset]!
- self currentSound notNil
- ifTrue: [self currentSound reset]
- ifFalse: [self currentSound: self nextSound]!
Item was changed:
----- Method: RandomEnvelope>>points (in category 'envelopeEditor compatibility') -----
points
| env |
+ points ifNil: [
- points isNil ifTrue: [
env := self target envelopes first.
points := OrderedCollection new.
points
add: 0@(self delta * 5 + 0.5);
add: (env points at: env loopStartIndex)x@(self highLimit -1 * 5 + 0.5);
add: (env points at: env loopEndIndex)x@(self highLimit -1 * 5 + 0.5);
add: (env points last)x@(self lowLimit -1 * 5 + 0.5).
loopStartIndex := 2.
loopEndIndex := 3.
].
^points!
More information about the Squeak-dev
mailing list
|