This site requires JavaScript, please enable it in your browser!
Greenfoot back
hans.vandenbogaerde@gmail.com
hans.vandenbogaerde@gmail.com wrote ...

2016/11/8

Greenfoot.playSound() vs GreenfootSound play() method

In the piano-case from the Greenfoot book chapter 5 (1st edition, in Dutch), it would be normally be wiser to instantiate a GreenfootSound object once, reading the wav-file just once as in sound = new GreenfootSound("3a.wav") and then playing the sound as much as desired with sound.play() opposed to executing Greenfoot.playSound("3a.wav") over and over again. But, in fact, it seams that exactly the opposite is true: Greenfoot.playSound("3a.wav") performs clearly better than sound.play(). This is counter-intuitive! How come?
You need to login to post a reply.