AudioPlayer close() NullPointerException
in
Core Library Questions
•
2 years ago
Hi guys,
I'm new of processing... I've to use AudioPlayer to play a song to a specific output, but I have a problem, I cant close the AudioPlayer after I have played a song
processing.app.debug.RunnerException: NullPointerException
at processing.app.Sketch.placeException(Sketch.java:1543)
at processing.app.debug.Runner.findException(Runner.java:582)
at processing.app.debug.Runner.reportException(Runner.java:558)
at processing.app.debug.Runner.exception(Runner.java:498)
at processing.app.debug.EventThread.exceptionEvent(EventThread.java:367)
at processing.app.debug.EventThread.handleEvent(EventThread.java:255)
at processing.app.debug.EventThread.run(EventThread.java:89)
Exception in thread "Animation Thread" java.lang.NullPointerException
at ddf.minim.javasound.JSBaseAudioRecordingStream.close(JSBaseAudioRecordingStream.java:407)
at ddf.minim.AudioSource.close(AudioSource.java:99)
at sketch_mar03a.stop(sketch_mar03a.java:51)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:619)
How can I close the AudioPlayer? Where am I wrong?
I'm new of processing... I've to use AudioPlayer to play a song to a specific output, but I have a problem, I cant close the AudioPlayer after I have played a song
- import ddf.minim.*;
- Minim minim;
- AudioPlayer groove;
- void setup()
- {
- size(512, 200, P3D);
- minim = new Minim(this);
- groove = minim.loadFile("D:\\Music\\Musica\\11.mp3", 2048);
- }
- void draw()
- {
- background(0);
- }
- void keyPressed()
- {
- if ( key == 'p' ) groove.play();
- if ( key == 's' ) stop();
- }
- void stop()
- {
- // always close Minim audio classes when you are done with them
- groove.close();
- // always stop Minim before exiting.
- minim.stop();
- super.stop();
- }
processing.app.debug.RunnerException: NullPointerException
at processing.app.Sketch.placeException(Sketch.java:1543)
at processing.app.debug.Runner.findException(Runner.java:582)
at processing.app.debug.Runner.reportException(Runner.java:558)
at processing.app.debug.Runner.exception(Runner.java:498)
at processing.app.debug.EventThread.exceptionEvent(EventThread.java:367)
at processing.app.debug.EventThread.handleEvent(EventThread.java:255)
at processing.app.debug.EventThread.run(EventThread.java:89)
Exception in thread "Animation Thread" java.lang.NullPointerException
at ddf.minim.javasound.JSBaseAudioRecordingStream.close(JSBaseAudioRecordingStream.java:407)
at ddf.minim.AudioSource.close(AudioSource.java:99)
at sketch_mar03a.stop(sketch_mar03a.java:51)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:619)
How can I close the AudioPlayer? Where am I wrong?
1