< prev index next >
src/java.desktop/share/classes/com/sun/media/sound/SoftMixingMainMixer.java
Print this page
@@ -20,10 +20,11 @@
*
* 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.ArrayList;
@@ -77,11 +78,11 @@
private final int nrofchannels;
private final Object control_mutex;
- private final List<SoftMixingDataLine> openLinesList = new ArrayList<SoftMixingDataLine>();
+ private final List<SoftMixingDataLine> openLinesList = new ArrayList<>();
private SoftMixingDataLine[] openLines = new SoftMixingDataLine[0];
public AudioInputStream getInputStream() {
return ais;
@@ -182,10 +183,11 @@
for (int i = 0; i < nrofchannels; i++)
buffers[i].get(bbuffer, i);
bbuffer_pos = 0;
}
+ @Override
public int read(byte[] b, int off, int len) {
int bbuffer_len = bbuffer.length;
int offlen = off + len;
byte[] bbuffer = this.bbuffer;
while (off < offlen)
@@ -198,21 +200,24 @@
this.bbuffer_pos = bbuffer_pos;
}
return len;
}
+ @Override
public int read() throws IOException {
int ret = read(single);
if (ret == -1)
return -1;
return single[0] & 0xFF;
}
+ @Override
public int available() {
return bbuffer.length - bbuffer_pos;
}
+ @Override
public void close() {
SoftMixingMainMixer.this.mixer.close();
}
};
@@ -237,23 +242,20 @@
.toArray(new SoftMixingDataLine[openLinesList.size()]);
if (openLines.length == 0)
if (mixer.implicitOpen)
mixer.close();
}
-
}
public SoftMixingDataLine[] getOpenLines() {
synchronized (control_mutex) {
return openLines;
}
-
}
public void close() {
SoftMixingDataLine[] openLines = this.openLines;
for (int i = 0; i < openLines.length; i++) {
openLines[i].close();
}
}
-
}
< prev index next >