On NetBeans(JAVA), Sound file suddenly stops playing when I start/test my program -


first of all, odd problem im trying fix since got netbeans , started programming. basically: made simple program music should playing while program running, when music starts playing, last seconds because stops playing no apparent reason. open program , click button makes music iniciate, , stops 3 or 4 seconds(this random, ll last longer).

the curious thing is: on notebook, if try test program while in netbeans yet, problem occurs, if build program, problem goes away.

in other hand, if test or build same program on pc(high-end), problem occur while testing on netbeans , after building too, no way ridding off on pc, on notebook after building it(if test while on netbeans without building, problem occur).that happens every sound file or music try, of them on wav format. im not sure have installed k-lite mega codec pack on both systems, dunno if causing that. here part of program sound file started(and importations):

//importations below import java.applet.*; import java.net.*; import java.io.file; import javax.swing.joptionpane; 

//my program sound stuff below     file file = new file("c:\\users\\my-pc\\desktop\\projetos\\src\\javaapplication9\\cave of past.wav");        audioclip clip=null;        try{        clip = applet.newaudioclip(file.touri().tourl());        }        catch(malformedurlexception lol){            system.err.println("looooooooooooool");        }         clip.loop();  

never mind, found way works want:

audioinputstream audioinputstream = audiosystem.getaudioinputstream(new file("c:/folder/musicfile.wav").getabsolutefile());         clip clip = audiosystem.getclip();         clip.open(audioinputstream);         clip.start(); 

Comments

Popular posts from this blog

jQuery Mobile app not scrolling in Firefox -

c++ - How to add Crypto++ library to Qt project -

php array slice every 2th rule -