[squeak-dev] The Inbox: Sound-dtl.68.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Dec 12 12:20:39 UTC 2019


David T. Lewis uploaded a new version of Sound to project The Inbox:
http://source.squeak.org/inbox/Sound-dtl.68.mcz

==================== Summary ====================

Name: Sound-dtl.68
Author: dtl
Time: 12 December 2019, 7:20:38.226903 am
UUID: c7b5a141-2b1b-4d24-ab88-0a96dd78600b
Ancestors: Sound-dtl.67

Resolve unimplemented calls in the previous update.
Discussion on squeak-dev http://lists.squeakfoundation.org/pipermail/squeak-dev/2019-December/205515.html

=============== Diff against Sound-dtl.67 ===============

Item was changed:
  ----- Method: AbstractSound>>loudness (in category 'volume') -----
  loudness
  	"Answer the current volume setting for this sound."
  
+ 	^ envelopes detect: [:e | e isKindOf: VolumeEnvelope]
+ 		ifFound: [ :envelope | envelope scale ]
+ 		ifNone: [scaledVol asFloat / FloatScaleFactor]
+ !
- 	self hasVolumeEnvelope ifTrue: [^ self volumeEnvelope scale].
- 
- 	^ scaledVol asFloat / ScaleFactor!

Item was changed:
  ----- Method: SequentialSound>>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."
  	"PluckedSound chromaticScale play"
  
  	| finalIndex i snd remaining count leftScaledVol rightScaledVol |
  	currentIndex = 0 ifTrue: [^ self].  "already done"
  
+ 	leftScaledVol := leftVol * scaledVol / ScaleFactor asFloat.
+ 	rightScaledVol := rightVol * scaledVol / ScaleFactor asFloat.
- 	leftScaledVol := leftVol * scaledVol /// ScaleFactor.
- 	rightScaledVol := rightVol * scaledVol /// ScaleFactor.
  
  	finalIndex := (startIndex + n) - 1.
  	i := startIndex.
  	[i <= finalIndex] whileTrue: [
  		snd := (sounds at: currentIndex).
  		[(remaining := snd samplesRemaining) <= 0] whileTrue: [
  			"find next undone sound"
  			currentIndex < sounds size
  				ifTrue: [
  					currentIndex := currentIndex + 1.
  					snd := (sounds at: currentIndex)]
  				ifFalse: [
  					currentIndex := 0.
  					^ self]].  "no more sounds"
  		count := (finalIndex - i) + 1.
  		remaining < count ifTrue: [count := remaining].
  		snd mixSampleCount: count into: aSoundBuffer startingAt: i 
  			leftVol: leftScaledVol
  			rightVol: rightScaledVol.
  		i := i + count].
  !



More information about the Squeak-dev mailing list