Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

Minim won't loadFile() AIFF, even though file is in data folder.

$
0
0
I need to load a song and play it during the opening screen of my application, even though the file is in the data folder. I still recieve a NullPointerException.

Here's my sound setup code:
  1. import ddf.minim.*;

  2. AudioPlayer title_music;
  3. AudioPlayer jacob_fire;
  4. AudioPlayer enemy_fire;
  5. AudioPlayer level1_music;
  6. AudioPlayer explosion;
  7. AudioPlayer damage;

  8. Minim minim;

  9. void setupSound()
  10. {
  11.   minim = new Minim(this);
  12.   title_music = minim.loadFile("/sfx/explosion.wav");
  13. }

  14. void playTitleMusic()
  15. {
  16.   if(GAME_STATE == MAIN_MENU)
  17.   {
  18.     title_music.play();
  19.     title_music.loop();
  20.   }
  21.   else
  22.   {
  23.     title_music.pause();
  24.   }
  25. }

  26. void stop()
  27. {
  28.   title_music.close();
  29.   //jacob_fire.close();
  30.   //enemy_fire.close();
  31.   //level1_music.close();
  32.   //explosion.close();
  33.   //damage.close();
  34.   minim.stop();
  35.   super.stop();
  36. }
Also here is the error:
  1. ==== JavaSound Minim Error ====
  2. ==== IOException: Resetting to invalid mark

  3. Exception in thread "Animation Thread" java.lang.NullPointerException
  4. at ddf.minim.javasound.JSMinim.getAudioRecordingStream(Unknown Source)
  5. at ddf.minim.Minim.loadFile(Unknown Source)
  6. at ddf.minim.Minim.loadFile(Unknown Source)
  7. at JTVG.setupSound(JTVG.java:270)
  8. at JTVG.setup(JTVG.java:35)
  9. at processing.core.PApplet.handleDraw(PApplet.java:2117)
  10. at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:193)
  11. at processing.core.PApplet.run(PApplet.java:2020)
  12. at java.lang.Thread.run(Thread.java:680)
  13.  



Viewing all articles
Browse latest Browse all 1768

Trending Articles