Saturday 15 September 2012

Java 7 update 25: Dynamic audio no longer working in local applet. Is there an alternate method? -


I am creating dynamic audio by looping a clip and updating the buffer on the fly.

With Java Update 7 25 (June 18, 2013) the clip now changes the buffer in your buffer, not just in plays, but simply loop its original content, in the clip below, white noise It is played if test == 0, but otherwise test == 1 This noise was used to run both methods, and it happens even when running as a console app instead of a local applet is.

After the clip, I really need to update that buffer: many pieces of software suddenly shut up. Is there another (or correct) way to do this? thank you in advanced. Audio Format Encoding encoding = new audio format. Encoding ("PCMCAnneD"); Audio format frmt = new audio format (encl, 22050, 16, 2, 4, 22050, false); DataLine.Info Info = New DataLine.Info (clip class, frmt); Clip loop_clip; Int size = 8192; Byte [] sound_buf = new byte [size]; For (int i = 0; i & lt; size; i ++) sound_buf [i] = 0; Int test = 1; For (test == 0) (int i = 0; i & lt; size; i ++) sound_buff [i] = (byte) (Math.Randem (* * 256); Try {loop_clip = (clip) AudioSystem.getLine (info); Loop_clip.open (frmt, sound_buf, 0, size);} hold (LineUnavailableException e) {e.printStackTrace (); return;} if (test == 1) for (int = 0 ; I & lt; size; i ++) sound_book [i] = (byte) (Math.Random) * 256; Loop_clip.setLoopPoints (0, -1); loop_clip.loop (999); clip after clip I did not find any solution to make the buffer accessible, but I used a source DataAline and a feed buffer. Clip simulated. It is certainly more CPU intensive, but at least it can be tested in local applet.

No comments:

Post a Comment