View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Sp02 Final Exam Review: Multimedia Programming in Squeak

Is this one too hard? Mark Guzdial



1.
myPen := Pen new.
myNotes := #(((c4 1.0 500)) ((d2 2.0 500)) ((e3 1.0 500)) ((f4 1.0 500))).
myPen down.
1 to: 4 do:[:i|
myPen go:50.
myPen turn: 90.
(AbstractSound noteSequenceOn: (FMSound soundNamed: 'clarinet')
from: (myNotes at: i) ) play.
].

Question: Why do I need double parenthesis around the notes when I declare it on the second line? It would not compile if I just put one around them.
Think about what a note sequence is and what you're passing in. Mark Guzdial

2. No Idea!

Jai Kejriwal
On (b), think about EllipseMorph new openInWorld, position:, bounds:, bounds, extent, and top:/left: messages. Mark Guzdial

I believe this is because you are qualifying the object with the inner most parens and then qualifying that this object is an element in a collection with the second set of parens. i.e. when defining a Point instance you define (x@y) not x@y, then you have to qualify that object as an instance in the collection so it would be ((x@y)) unlike in the extent example where you're passing to a message so all you need is a Point not a Collection. Is this correct??? Anyone?

Michael Wentzel


(b)

playNote: aNote
| sound |
sound := (AbstractSound noteSequenceOn:
(FMSound soundNamed: 'brass1')
from: OrderedCollection with: aNote ) play.
SoundPlayer waitUntilDonePlaying: sound.

multimediaMoveTest
| myNotes ellipseMorph |
myNotes := #((c4 1.0 500) (d4 1.0 500) (e4 1.0 500) (f4 1.0 500)).
ellipseMorph := EllipseMorph new.
ellipseMorph color: Color red.
ellipseMorph bounds: (Rectangle origin: 0@0 extent: 100@100).
ellipseMorph openInWorld.
World doOneCycle.
self playNote: (myNotes at: 1).
ellipseMorph position: 0@100.
World doOneCycle.
self playNote: (myNotes at: 2).
ellipseMorph position: 100@100.
World doOneCycle.
self playNote: (myNotes at: 3).
ellipseMorph position: 100@0.
World doOneCycle.
self playNote: (myNotes at: 4).

Boo-yah
Michael L. Mitchell
While we're at it, why not write an application that makes the Squeak mouse's eyes move to the beat?
Michael L. Mitchell
Does it work without all those World doOneCycle's? Mark Guzdial





Link to this Page