2

I am using NetBeans IDE and I get this warning when writing a simple class that can play a WAV file:

enter image description here

As shown in the picture the same message appears at several parts in the sourcecode. Is the Java audio API outdated? If so, what can I adjust in my code to get rid of this warning?

public class Sound{

private AudioStream sound;

public Sound(String location){

    try{
    InputStream file = new FileInputStream(location);
    sound = new AudioStream(file);
    }
    catch(IOException error){
        //error
    }

}

public void play(){

    AudioPlayer.player.start(sound);

}

}

Thanks in advance!

Ood
  • 1,445
  • 4
  • 23
  • 43
  • 1
    Don't build your application on the internal API functionality. It's not a concrete API, and as the warning states, can disappear at a moment's notice. It's also the same reason why Javadoc is scarce for that specific class. – Makoto Jun 14 '14 at 20:04
  • What alternative is there that has the same functionality? – Ood Jun 14 '14 at 20:06
  • 3
    The `javax.sound.sampled` package is what you're looking for. See, e.g., http://stackoverflow.com/questions/2416935/how-to-play-wav-files-with-java – Mureinik Jun 14 '14 at 20:06
  • 1
    Take a look at [javax.sound](http://stackoverflow.com/tags/javasound/info); linked is the Stack Overflow tag for it. – Makoto Jun 14 '14 at 20:07
  • Thnaks! This is exactly what I needed! – Ood Jun 14 '14 at 20:11
  • Those comments can be answers... – Anubian Noob Jun 14 '14 at 20:18

0 Answers0