[squeak-dev] The Trunk: Sound-eem.80.mcz

commits at source.squeak.org commits at source.squeak.org
Tue May 25 23:07:34 UTC 2021


Eliot Miranda uploaded a new version of Sound to project The Trunk:
http://source.squeak.org/trunk/Sound-eem.80.mcz

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

Name: Sound-eem.80
Author: eem
Time: 25 May 2021, 4:07:32.508103 pm
UUID: c65df365-47b5-4670-8ec6-411aac823b15
Ancestors: Sound-eem.79

Fix FFT>>plot:in: for an all-zero collection.

=============== Diff against Sound-eem.79 ===============

Item was changed:
  ----- Method: FFT>>plot:in: (in category 'testing') -----
  plot: samples in: rect
  	"Throw-away code just to check out a couple of examples"
+ 	| dx pen min max x divisor offset |
- 	| dx pen min max x |
  	Display fillWhite: rect; border: (rect expandBy: 2) width: 2.
  	min := 1.0e30.  max := -1.0e30.
  	samples do:
  		[:v |
  		min := min min: v.
  		max := max max: v].
+ 	max = min
+ 		ifTrue: [divisor := rect height asFloat.
+ 				offset := rect height / 2.0]
+ 		ifFalse: [divisor := max - min.
+ 				offset := 0.0].
  	pen := Pen new.  pen up.
  	x := rect left.
  	dx := rect width asFloat / samples size.
  	samples do:
  		[:v | | y |
+ 		y := (max - v) / divisor * rect height + offset.
+ 		pen goto: x asInteger @ (rect top + y asInteger); down.
- 		y := (max-v) / (max-min) * rect height asFloat.
- 		pen goto: x asInteger @ (rect top + y asInteger).
- 		pen down.
  		x := x + dx].
+ 	max printString displayOn: Display at: (x + 2) @ (rect top - 9).
+ 	min printString displayOn: Display at: (x + 2) @ (rect bottom - 9)!
- 	max printString displayOn: Display at: (x+2) @ (rect top-9).
- 	min printString displayOn: Display at: (x+2) @ (rect bottom - 9)!



More information about the Squeak-dev mailing list