/*
* 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.
*/
/**
* This is a SourceDataLine simulator used for testing SoftSynthesizer
* without using real SourceDataLine / Audio Device.
*
* @author Karl Helgason
*/
private boolean active = false;
private boolean opened = false;
public DummySourceDataLine()
{
AudioSystem.NOT_SPECIFIED, false));
AudioSystem.NOT_SPECIFIED, false));
}
AudioSystem.NOT_SPECIFIED, false));
AudioSystem.NOT_SPECIFIED, true));
AudioSystem.NOT_SPECIFIED, false));
AudioSystem.NOT_SPECIFIED, true));
}
.size()]);
}
}
if (bufferSize == -1)
* format.getFrameSize();
}
throws LineUnavailableException {
this.bufferSize = bufferSize;
opened = true;
}
public boolean isOpen() {
return opened;
}
if (!isOpen())
return 0;
throw new IllegalArgumentException(
"Number of bytes does not represent an integral number of sample frames.");
.getSampleRate()));
try {
} catch (InterruptedException e) {
e.printStackTrace();
return 0;
}
return len;
}
public int available() {
return 0;
}
public void drain() {
}
public void flush() {
}
public int getBufferSize() {
return bufferSize;
}
return format;
}
public int getFramePosition() {
return (int) getLongFramePosition();
}
public float getLevel() {
return AudioSystem.NOT_SPECIFIED;
}
public long getLongFramePosition() {
return framepos;
}
public long getMicrosecondPosition() {
.getSampleRate()));
}
public boolean isActive() {
return active;
}
public boolean isRunning() {
return active;
}
public void start() {
active = true;
}
public void stop() {
active = false;
}
public void close() {
stop();
}
throw new IllegalArgumentException("Unsupported control type : "
+ control);
}
return new Control[0];
}
return sourceLineInfo;
}
return false;
}
}
}
}