Squeak Class Documentation category index | class index  
 
EventRecorderMorph
  category: Morphic-Support
  superclass: AlignmentMorph
  subclasses:

During recording, the EventRecorder subscribes to all events of the normal morphic hand, and saves them as they occur.

For replay, a second playback hand is created that reads events from the recorder and plays them back in the world.

The EventRecorder began with the work of Ted Kaehler and John Malone. This was then signifcantly expanded by Leandro Caniglia and Valeria Murgia as a tutorial aid for the Morphic Wrapper project.

Since that time, I have...
Changed to a simple inboard array for the tape (event storage).
Provided the ability to condense linear mouse movement with interpolation at replay.
Made simple provisions for wrap-around of the millisecond clock.
Eliminated step methods in favor of using the processEvents cycle in the playback hand.
Provided a pause/resume mechanism that is capable of surviving project changes.
Added the ability to spawn a simple 'play me' button that can be saved as a morph.
Caused the playback hand to display its cursor double size for visibility.
Integrated a voice recorder with on-the-fly compression.
This currently does NOT survive project changes, not is its data stored on the tape.
Right now it can only be saved by saving the entire recorder as a morph.
This will be fixed by adding a startSound event at each project change.
We will also convert read/write file to use saveOnFile.
Added a journal file facility for recording sequences that end in a crash.
The above two features can be engaged via the ER's morph menu.
- Dan Ingalls 3/6/99

instance methods
  accessing
  button:
recTime

  commands
  button
condense
play
record
setStatusLight:
shrink
step
stepTime
stop
wantsSteps

  event handling
  handleListenEvent:
nextEventToPlay
synchronize

  fileIn/Out
  checkTape
convertV0Tape:
readFrom:
readFromV0:
readFromV1:
readTape
readTape:
writeCheck
writeFileNamed:
writeTape
writeTape:

  initialization
  addButtons
addCustomMenuItems:hand:
addJournalFile
addVoiceControls
buttonFor:
caption:voiceRecorder:tape:
initialize
makeARowForButtons
makeASpacer
makeStatusLight

  object fileIn
 

  pause/resume
  pauseIn:
resumeIn:
resumePlayIn:
resumeRecordIn:

  piano rolls
  addMorphsTo:pianoRoll:eventTime:betweenTime:and:
encounteredAtTime:inScorePlayer:atIndex:inEventTrack:secsPerTick:
justDroppedIntoPianoRoll:event:
myDurationInMS

class methods
  instance creation
  descriptionForPartsBin
fromFileNamed:
readFrom:

instance methods
  accessing top  
 

button:


 

recTime


  commands top  
 

button

Make a simple button interface for replay only


 

condense

Shorten the tape by deleting mouseMove events that can just as well be
interpolated later at playback time.


 

play


 

record


 

setStatusLight:


 

shrink

Shorten the tape by deleting mouseMove events that can just as well be
interpolated later at playback time.


 

step

Do some periodic activity. Use startStepping/stopStepping to start and stop getting sent this message. The time between steps is specified by this morph's answer to the stepTime message. The generic version dispatches control to the player, if any. The nasty circumlocation about owner's transformation is necessitated by the flexing problem that the player remains in the properties dictionary both of the flex and the real morph. In the current architecture, only the top renderer's pointer to the player should actually be honored for the purpose of firing.


 

stepTime

Answer the desired time between steps in milliseconds. This default implementation requests that the 'step' method be called once every second.


 

stop

Stop running my script. For ordinary morphs, this means stop stepping.


 

wantsSteps

Return true if the receiver overrides the default Morph step method.


  event handling top  
 

handleListenEvent:

Record the given event


 

nextEventToPlay

Return the next event when it is time to be replayed.
If it is not yet time, then return an interpolated mouseMove.
Return nil if nothing has happened.
Return an EOF event if there are no more events to be played.


 

synchronize


  fileIn/Out top  
 

checkTape

See if this tape was already converted to the new format


 

convertV0Tape:

Convert the tape into the new format


 

readFrom:

Private


 

readFromV0:


 

readFromV1:


 

readTape


 

readTape:


 

writeCheck


 

writeFileNamed:


 

writeTape


 

writeTape:


  initialization top  
 

addButtons


 

addCustomMenuItems:hand:

Add morph-specific items to the given menu which was invoked by the given hand. This method provides is invoked both from the halo-menu and from the control-menu regimes.


 

addJournalFile

In case there is a chance of not regaining control to stop recording and save a file, the EventRecorder can write directly to file as it is recording. This is useful for capturing a sequence that results in a nasty crash.


 

addVoiceControls


 

buttonFor:


 

caption:voiceRecorder:tape:


 

initialize


 

makeARowForButtons


 

makeASpacer


 

makeStatusLight


  object fileIn top  

  pause/resume top  
 

pauseIn:

Suspend playing or recording, either as part of a stop command,
or as part of a project switch, after which it will be resumed.


 

resumeIn:

Resume playing or recording after a project switch.


 

resumePlayIn:


 

resumeRecordIn:


  piano rolls top  
 

addMorphsTo:pianoRoll:eventTime:betweenTime:and:

a hack to allow for abitrary morphs to be dropped into piano roll


 

encounteredAtTime:inScorePlayer:atIndex:inEventTrack:secsPerTick:

a hack to allow for abitrary morphs to be dropped into piano roll


 

justDroppedIntoPianoRoll:event:


 

myDurationInMS


class methods
  instance creation top  
 

descriptionForPartsBin

Answer a description for use in a parts bin


 

fromFileNamed:


 

readFrom:

Create an object based on the contents of aStream.