/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* 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.
*/
/**
* SourceDataLine implemention for the SoftMixingMixer.
*
* @author Karl Helgason
*/
implements SourceDataLine {
private boolean open = false;
private int framesize;
private float[] readbuffer;
private boolean active = false;
private byte[] cycling_buffer;
private static class NonBlockingFloatInputStream extends
}
}
}
}
public long getFrameLength() {
return ais.getFrameLength();
}
}
public boolean markSupported() {
return ais.markSupported();
}
return len;
}
}
}
}
}
}
if (!isOpen())
return 0;
throw new IllegalArgumentException(
"Number of bytes does not represent an integral number of sample frames.");
if (off < 0) {
throw new ArrayIndexOutOfBoundsException(off);
}
throw new ArrayIndexOutOfBoundsException(b.length);
}
byte[] buff = cycling_buffer;
int l = 0;
while (l != len) {
int avail;
synchronized (cycling_buffer) {
int pos = cycling_write_pos;
while (l != len) {
break;
l++;
avail++;
pos = 0;
}
if (l == len)
return l;
}
try {
} catch (InterruptedException e) {
return l;
}
if (!isRunning())
return l;
}
}
return l;
}
//
// BooleanControl.Type.APPLY_REVERB
// BooleanControl.Type.MUTE
// EnumControl.Type.REVERB
//
// FloatControl.Type.SAMPLE_RATE
// FloatControl.Type.REVERB_SEND
// FloatControl.Type.VOLUME
// FloatControl.Type.PAN
// FloatControl.Type.MASTER_GAIN
// FloatControl.Type.BALANCE
private boolean _active = false;
private int out_nrofchannels;
private int in_nrofchannels;
private float _rightgain;
private float _leftgain;
private float _eff1gain;
private float _eff2gain;
protected void processControlLogic() {
}
if (_active) {
readbuffer = new float[readlen];
}
int ret = 0;
try {
if (ret != in_nrofchannels)
} catch (IOException e) {
}
int in_c = in_nrofchannels;
}
if (out_nrofchannels != 1) {
if (in_nrofchannels == 1) {
}
} else {
}
}
}
if (_eff1gain > 0.0001) {
.array();
}
if (in_nrofchannels == 2) {
}
}
}
if (_eff2gain > 0.0001) {
.array();
}
if (in_nrofchannels == 2) {
}
}
}
}
}
}
if (bufferSize == -1)
* format.getFrameSize();
}
throws LineUnavailableException {
synchronized (control_mutex) {
if (!isOpen()) {
mixer.implicitOpen = true;
}
% format.getFrameSize();
open = true;
cycling_read_pos = 0;
cycling_write_pos = 0;
cycling_avail = 0;
cycling_framepos = 0;
public int read() throws IOException {
byte[] b = new byte[1];
if (ret < 0)
return ret;
return b[0] & 0xFF;
}
public int available() throws IOException {
synchronized (cycling_buffer) {
return cycling_avail;
}
}
throws IOException {
synchronized (cycling_buffer) {
if (len > cycling_avail)
len = cycling_avail;
int pos = cycling_read_pos;
byte[] buff = cycling_buffer;
for (int i = 0; i < len; i++) {
pos++;
pos = 0;
}
cycling_avail -= len;
}
return len;
}
};
} else {
throw new IllegalStateException(
"Line is already open with format " + getFormat()
+ " and bufferSize " + getBufferSize());
}
}
}
}
public int available() {
synchronized (cycling_buffer) {
}
}
public void drain() {
while (true) {
int avail;
synchronized (cycling_buffer) {
}
if (avail != 0)
return;
try {
} catch (InterruptedException e) {
return;
}
}
}
public void flush() {
synchronized (cycling_buffer) {
cycling_read_pos = 0;
cycling_write_pos = 0;
cycling_avail = 0;
}
}
public int getBufferSize() {
synchronized (control_mutex) {
return bufferSize;
}
}
synchronized (control_mutex) {
return format;
}
}
public int getFramePosition() {
return (int) getLongFramePosition();
}
public float getLevel() {
return AudioSystem.NOT_SPECIFIED;
}
public long getLongFramePosition() {
synchronized (cycling_buffer) {
return cycling_framepos;
}
}
public long getMicrosecondPosition() {
.getSampleRate()));
}
public boolean isActive() {
synchronized (control_mutex) {
return active;
}
}
public boolean isRunning() {
synchronized (control_mutex) {
return active;
}
}
public void start() {
synchronized (control_mutex) {
if (isOpen()) {
if (active)
return;
active = true;
}
}
}
public void stop() {
synchronized (control_mutex) {
if (isOpen()) {
if (!active)
return;
active = false;
}
}
}
public void close() {
synchronized (control_mutex) {
if (!isOpen())
return;
stop();
open = false;
}
}
public boolean isOpen() {
synchronized (control_mutex) {
return open;
}
}
}