public class JVMAudioInputStream extends java.lang.Object implements TarsosDSPAudioInputStream
AudioInputStream
to make it work with the core TarsosDSP library.Constructor and Description |
---|
JVMAudioInputStream(javax.sound.sampled.AudioInputStream stream) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this audio input stream and releases any system resources associated
with the stream.
|
TarsosDSPAudioFormat |
getFormat() |
long |
getFrameLength() |
int |
read(byte[] b,
int off,
int len)
Reads up to a specified maximum number of bytes of data from the audio
stream, putting them into the given byte array.
|
void |
skip(long bytesToSkip) |
static javax.sound.sampled.AudioFormat |
toAudioFormat(TarsosDSPAudioFormat format)
Converts a
TarsosDSPAudioFormat to a AudioFormat . |
static TarsosDSPAudioFormat |
toTarsosDSPFormat(javax.sound.sampled.AudioFormat format)
Converts a
AudioFormat to a TarsosDSPAudioFormat . |
public JVMAudioInputStream(javax.sound.sampled.AudioInputStream stream)
public void skip(long bytesToSkip) throws java.io.IOException
skip
in interface TarsosDSPAudioInputStream
java.io.IOException
public int read(byte[] b, int off, int len) throws java.io.IOException
TarsosDSPAudioInputStream
This method will always read an integral number of frames.
If len
does not specify an integral number
of frames, a maximum of len - (len % frameSize)
bytes will be read.
read
in interface TarsosDSPAudioInputStream
b
- the buffer into which the data is readoff
- the offset, from the beginning of array b
, at which
the data will be writtenlen
- the maximum number of bytes to readjava.io.IOException
- if an input or output error occursTarsosDSPAudioInputStream.skip(long)
public void close() throws java.io.IOException
TarsosDSPAudioInputStream
close
in interface TarsosDSPAudioInputStream
java.io.IOException
- if an input or output error occurspublic long getFrameLength()
getFrameLength
in interface TarsosDSPAudioInputStream
public TarsosDSPAudioFormat getFormat()
getFormat
in interface TarsosDSPAudioInputStream
public static TarsosDSPAudioFormat toTarsosDSPFormat(javax.sound.sampled.AudioFormat format)
AudioFormat
to a TarsosDSPAudioFormat
.format
- The AudioFormat
TarsosDSPAudioFormat
public static javax.sound.sampled.AudioFormat toAudioFormat(TarsosDSPAudioFormat format)
TarsosDSPAudioFormat
to a AudioFormat
.format
- The TarsosDSPAudioFormat
AudioFormat