< prev index next >
src/java.desktop/share/classes/com/sun/media/sound/ModelByteBufferWavetable.java
Print this page
@@ -20,18 +20,20 @@
*
* 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 javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioFormat.Encoding;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
-import javax.sound.sampled.AudioFormat.Encoding;
/**
* Wavetable oscillator for pre-loaded data.
*
* @author Karl Helgason
@@ -50,10 +52,11 @@
Buffer8PlusInputStream() {
framesize_pc = format.getFrameSize() / format.getChannels();
bigendian = format.isBigEndian();
}
+ @Override
public int read(byte[] b, int off, int len) throws IOException {
int avail = available();
if (avail <= 0)
return -1;
if (len > avail)
@@ -80,10 +83,11 @@
pos -= buffer.arrayOffset();
pos2 -= buffer8.arrayOffset();
return len;
}
+ @Override
public long skip(long n) throws IOException {
int avail = available();
if (avail <= 0)
return -1;
if (n > avail)
@@ -91,35 +95,41 @@
pos += (n / (framesize_pc + 1)) * (framesize_pc);
pos2 += n / (framesize_pc + 1);
return super.skip(n);
}
+ @Override
public int read(byte[] b) throws IOException {
return read(b, 0, b.length);
}
+ @Override
public int read() throws IOException {
byte[] b = new byte[1];
int ret = read(b, 0, 1);
if (ret == -1)
return -1;
return 0 & 0xFF;
}
+ @Override
public boolean markSupported() {
return true;
}
+ @Override
public int available() throws IOException {
return (int)buffer.capacity() + (int)buffer8.capacity() - pos - pos2;
}
+ @Override
public synchronized void mark(int readlimit) {
markpos = pos;
markpos2 = pos2;
}
+ @Override
public synchronized void reset() throws IOException {
pos = markpos;
pos2 = markpos2;
}
@@ -187,10 +197,11 @@
return format;
}
return format;
}
+ @Override
public AudioFloatInputStream openStream() {
if (buffer == null)
return null;
if (format == null) {
InputStream is = buffer.getInputStream();
@@ -228,36 +239,41 @@
}
return AudioFloatInputStream.getInputStream(format, buffer.array(),
(int)buffer.arrayOffset(), (int)buffer.capacity());
}
+ @Override
public int getChannels() {
return getFormat().getChannels();
}
+ @Override
public ModelOscillatorStream open(float samplerate) {
// ModelWavetableOscillator doesn't support ModelOscillatorStream
return null;
}
// attenuation is in cB
+ @Override
public float getAttenuation() {
return attenuation;
}
// attenuation is in cB
public void setAttenuation(float attenuation) {
this.attenuation = attenuation;
}
+ @Override
public float getLoopLength() {
return loopLength;
}
public void setLoopLength(float loopLength) {
this.loopLength = loopLength;
}
+ @Override
public float getLoopStart() {
return loopStart;
}
public void setLoopStart(float loopStart) {
@@ -266,14 +282,16 @@
public void setLoopType(int loopType) {
this.loopType = loopType;
}
+ @Override
public int getLoopType() {
return loopType;
}
+ @Override
public float getPitchcorrection() {
return pitchcorrection;
}
public void setPitchcorrection(float pitchcorrection) {
< prev index next >