We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexDiscussionExhibition › Metronome using MVC
Page Index Toggle Pages: 1
Metronome using MVC (Read 1188 times)
Metronome using MVC
Jan 5th, 2006, 8:29am
 
Hi,

I just did a quick implementation of a metronome to help me out with practicing my mandolin. It's a rough sketch, and isn't very sophisticated visually. However, I wrote it using a model-view-controller (mvc) pattern, so it should be faily easy to modify and improve. The Timer class is the model, and keeps track of the time between beats. It's update method is called every frame. The view is implemented as a Java interface; it's the API for getting information about the model to the view. The controller is the ObserverList class. The views are registered with the ObserverList. When the Timer is updated, it notifies the ObserverList with then passes the state on to the views. In the applet, located at http://codetree.org/artwork/art.php?id=161, the audible tick, the flashing boxes, the rate indicator, and the pendulum are all viewers of the Timer model. If anyone has suggestions for prettying up the interface I would love to hear them.

Thanks,
Chris
Page Index Toggle Pages: 1