< prev index next >

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

Print this page

        

*** 20,29 **** --- 20,30 ---- * * 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.IOException; import java.io.InputStream; import java.util.Arrays;
*** 74,131 **** --- 75,142 ---- NonBlockingFloatInputStream(AudioFloatInputStream ais) { this.ais = ais; } + @Override public int available() throws IOException { return ais.available(); } + @Override public void close() throws IOException { ais.close(); } + @Override public AudioFormat getFormat() { return ais.getFormat(); } + @Override public long getFrameLength() { return ais.getFrameLength(); } + @Override public void mark(int readlimit) { ais.mark(readlimit); } + @Override public boolean markSupported() { return ais.markSupported(); } + @Override public int read(float[] b, int off, int len) throws IOException { int avail = available(); if (len > avail) { int ret = ais.read(b, off, avail); Arrays.fill(b, off + ret, off + len, 0); return len; } return ais.read(b, off, len); } + @Override public void reset() throws IOException { ais.reset(); } + @Override public long skip(long len) throws IOException { return ais.skip(len); } } SoftMixingSourceDataLine(SoftMixingMixer mixer, DataLine.Info info) { super(mixer, info); } + @Override public int write(byte[] b, int off, int len) { if (!isOpen()) return 0; if (len % framesize != 0) throw new IllegalArgumentException(
*** 200,217 **** --- 211,230 ---- private float _eff1gain; private float _eff2gain; + @Override protected void processControlLogic() { _active = active; _rightgain = rightgain; _leftgain = leftgain; _eff1gain = eff1gain; _eff2gain = eff2gain; } + @Override protected void processAudioLogic(SoftAudioBuffer[] buffers) { if (_active) { float[] left = buffers[SoftMixingMainMixer.CHANNEL_LEFT].array(); float[] right = buffers[SoftMixingMainMixer.CHANNEL_RIGHT].array(); int bufferlen = buffers[SoftMixingMainMixer.CHANNEL_LEFT].getSize();
*** 272,292 **** --- 285,308 ---- } } } + @Override public void open() throws LineUnavailableException { open(format); } + @Override public void open(AudioFormat format) throws LineUnavailableException { if (bufferSize == -1) bufferSize = ((int) (format.getFrameRate() / 2)) * format.getFrameSize(); open(format, bufferSize); } + @Override public void open(AudioFormat format, int bufferSize) throws LineUnavailableException { LineEvent event = null;
*** 321,344 **** --- 337,363 ---- cycling_avail = 0; cycling_framepos = 0; InputStream cycling_inputstream = new InputStream() { + @Override public int read() throws IOException { byte[] b = new byte[1]; int ret = read(b); if (ret < 0) return ret; return b[0] & 0xFF; } + @Override public int available() throws IOException { synchronized (cycling_buffer) { return cycling_avail; } } + @Override public int read(byte[] b, int off, int len) throws IOException { synchronized (cycling_buffer) { if (len > cycling_avail)
*** 385,400 **** --- 404,421 ---- if (event != null) sendEvent(event); } + @Override public int available() { synchronized (cycling_buffer) { return cycling_buffer.length - cycling_avail; } } + @Override public void drain() { while (true) { int avail; synchronized (cycling_buffer) { avail = cycling_avail;
*** 407,467 **** --- 428,498 ---- return; } } } + @Override public void flush() { synchronized (cycling_buffer) { cycling_read_pos = 0; cycling_write_pos = 0; cycling_avail = 0; } } + @Override public int getBufferSize() { synchronized (control_mutex) { return bufferSize; } } + @Override public AudioFormat getFormat() { synchronized (control_mutex) { return format; } } + @Override public int getFramePosition() { return (int) getLongFramePosition(); } + @Override public float getLevel() { return AudioSystem.NOT_SPECIFIED; } + @Override public long getLongFramePosition() { synchronized (cycling_buffer) { return cycling_framepos; } } + @Override public long getMicrosecondPosition() { return (long) (getLongFramePosition() * (1000000.0 / (double) getFormat() .getSampleRate())); } + @Override public boolean isActive() { synchronized (control_mutex) { return active; } } + @Override public boolean isRunning() { synchronized (control_mutex) { return active; } } + @Override public void start() { LineEvent event = null; synchronized (control_mutex) {
*** 476,485 **** --- 507,517 ---- if (event != null) sendEvent(event); } + @Override public void stop() { LineEvent event = null; synchronized (control_mutex) { if (isOpen()) {
*** 493,502 **** --- 525,535 ---- if (event != null) sendEvent(event); } + @Override public void close() { LineEvent event = null; synchronized (control_mutex) {
*** 514,525 **** if (event != null) sendEvent(event); } public boolean isOpen() { synchronized (control_mutex) { return open; } } - } --- 547,558 ---- if (event != null) sendEvent(event); } + @Override public boolean isOpen() { synchronized (control_mutex) { return open; } } }
< prev index next >