swing - Is there a limit to audio file size java can play? -
i'm writing program loop audio file on java (bluej) continuously when button pressed. code working fine wav audio files less 1mb,but not of size greater 1mb. there limit size of file can play? , if so, how can work around this? great, thanks. here code:-
import javax.swing.*; import sun.audio.*; import java.awt.event.*; import java.io.*; public class sound { public static void main(string args[]) { jframe frame = new jframe(); frame.setsize(200,200); jbutton button = new jbutton("button name"); frame.add(button); button.addactionlistener(new al()); frame.show(true); } public static class al implements actionlistener { public final void actionperformed(actionevent e) { music(); } } public static void music() { audioplayer mgp = audioplayer.player; audiostream bgm; audiodata md; continuousaudiodatastream loop = null; try { bgm= new audiostream(new fileinputstream(file name)); md = bgm.getdata(); loop=new continuousaudiodatastream(md); } catch(ioexception error){} mgp.start(loop); } }
Comments
Post a Comment