Eliot Miranda uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-eem.405.mcz==================== Summary ====================
Name: EToys-eem.405
Author: eem
Time: 8 October 2020, 11:35:40.630409 am
UUID: c661ab6d-7d37-4723-ab5b-f049ea31b5c2
Ancestors: EToys-eem.404
CameraInterface: surface the little known fact that 352@288 is a supported resolution, at least on WIndows and Mac (and that due to downsampling to 320@280 352@288 may give a cnsiderably higher frame rate, on my ASUS VivoBook S laptop with WIndows 10 Home Ed, 9 fps vs 7 fps).
=============== Diff against EToys-eem.404 ===============
Item was changed:
----- Method: CameraInterface class>>interruptDrivenVideoTest: (in category 'test') -----
interruptDrivenVideoTest: camNum
"A quick test of video input. Displays video on the screen until the mouse is pressed.
Answer nil if the interrupt-driven interface is unavailable."
"self interruptDrivenVideoTest: 1"
"self interruptDrivenVideoTest: 2"
"[self interruptDrivenVideoTest: 2] fork.
self interruptDrivenVideoTest: 1"
| semaphore height |
height := 16.
1 to: camNum - 1 do:
[:camIndex| "N.B. the of an unopened camera is 0@0"
height := height + (CameraInterface frameExtent: camIndex) y + 16].
(CameraInterface cameraIsOpen: camNum) ifFalse:
+ [(CameraInterface openCamera: camNum width: 352 height: 288) ifNil:
- [(CameraInterface openCamera: camNum width: 320 height: 240) ifNil:
[self inform: 'no camera'.
^nil]].
semaphore := Semaphore new.
[CameraInterface camera: camNum setSemaphore: (Smalltalk registerExternalObject: semaphore)]
on: Error
do: [:err|
Smalltalk unregisterExternalObject: semaphore.
self inform: 'interrupt-driven camera interface unavailable: ', err messageText.
^nil].
[| f n startTime frameCount msecs fps |
[semaphore wait.
+ "N.B. the frame extent may not be known until the delivery of the first frame.
- "N.B. the frame extet may not be known until the delivery of the first frame.
Si we have to delay initialization."
startTime ifNil:
[(self frameExtent: camNum) x = 0 ifTrue: [self inform: 'no camera'. ^nil].
f := Form extent: (CameraInterface frameExtent: camNum) depth: 32.
frameCount := 0.
startTime := Time millisecondClockValue].
Sensor anyButtonPressed] whileFalse:
[n := CameraInterface getFrameForCamera: camNum into: f bits.
n > 0 ifTrue:
[frameCount := frameCount + 1.
f displayAt: 16 @ height]].
msecs := Time millisecondClockValue - startTime.
fps := (frameCount * 1000) // msecs.
^frameCount printString, ' frames at ', fps printString, ' frames/sec']
ensure:
[CameraInterface closeCamera: camNum.
Smalltalk unregisterExternalObject: semaphore.
Sensor waitNoButton]!