Hello, I created a new project yesterday to create a virtual guitar trainer. However, it seems like Greenfoot cannot play 2 sound in a row. An error will pop out saying "Exception in thread "Thread-1182" java.lang.NullPointerException
at greenfoot.sound.SoundClip.processState(SoundClip.java:276)
at greenfoot.sound.ClipProcessThread.run(ClipProcessThread.java:74)
at java.lang.Thread.run(Thread.java:744)"
So far i have each "key" as an new subclass of guitar and they all look like this:
Another issue that arised is when i tried to have keys to play certian sounds, and there seems to be a lag time in the playing of the sound
IDK if this is a issue with greenfoot sound system or my settings, but can someone help me out?
cheers
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * plays the low E key on the guitar */ public class OpenLowE extends Open { private static GreenfootSound tone = new GreenfootSound("2e.wav"); /** * plays the lowE key */ public void act() { checkKey(); } public void checkKey() { if(Greenfoot.mousePressed(this)) { guitar.play(tone); } } }