< prev index next >

src/java.desktop/share/classes/com/sun/media/sound/SoftJitterCorrector.java

Print this page

        

*** 20,37 **** * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package com.sun.media.sound; - import javax.sound.sampled.AudioFormat; - import javax.sound.sampled.AudioInputStream; import java.io.EOFException; import java.io.IOException; import java.io.InputStream; /** * A jitter corrector to be used with SoftAudioPusher. * * @author Karl Helgason */ --- 20,39 ---- * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ + package com.sun.media.sound; import java.io.EOFException; import java.io.IOException; import java.io.InputStream; + import javax.sound.sampled.AudioFormat; + import javax.sound.sampled.AudioInputStream; + /** * A jitter corrector to be used with SoftAudioPusher. * * @author Karl Helgason */
*** 122,131 **** --- 124,134 ---- this.stream = s; Runnable runnable = new Runnable() { + @Override public void run() { AudioFormat format = stream.getFormat(); int bufflen = buffers[0].length; int frames = bufflen / format.getFrameSize(); long nanos = (long) (frames * 1000000000.0
*** 218,227 **** --- 221,231 ---- thread.setDaemon(true); thread.setPriority(Thread.MAX_PRIORITY); thread.start(); } + @Override public void close() throws IOException { synchronized (this) { active = false; } try {
*** 230,239 **** --- 234,244 ---- //e.printStackTrace(); } stream.close(); } + @Override public int read() throws IOException { byte[] b = new byte[1]; if (read(b) == -1) return -1; return b[0] & 0xFF;
*** 242,251 **** --- 247,257 ---- public void fillBuffer() { bbuffer = nextReadBuffer(); bbuffer_pos = 0; } + @Override public int read(byte[] b, int off, int len) { if (bbuffer == null) fillBuffer(); int bbuffer_len = bbuffer.length; int offlen = off + len;
*** 261,270 **** --- 267,277 ---- } } return len; } + @Override public int available() { return bbuffer.length - bbuffer_pos; } }
< prev index next >