java - Getting illegal request to write non-integral number of frames exception ONLY when running with jar -
i'm getting exception when programme run jar file. when run through intellij don't exception. here's code:
opening sourcedataline (clip
inputstream):
frmt = new audioformat(44100, 16, 2, true, false); info = new dataline.info(sourcedataline.class, frmt); bfr = new byte[409600]; nbtoread = 409600; seek { linein = (sourcedataline) audiosystem.getline(info); linein.open(frmt); totaltoread = clip.available(); } grab (lineunavailableexception e) { e.printstacktrace(); } grab (filenotfoundexception e) { e.printstacktrace(); } grab (ioexception e) { e.printstacktrace(); }
playing audio:
linein.start(); seek { while (total < totaltoread && !stopped) { nbread = clip.read(bfr, 0, nbtoread); if (nbread == -1) { break; } total += nbread; linein.write(bfr, 0, nbread); } } grab (ioexception e) { e.printstacktrace(); } linein.stop();
i'm getting illegalargumentexception
on line:
linein.write(bfr, 0, nbread);
java audio intellij-idea
No comments:
Post a Comment