public class AudioInputFile
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
(package private) javax.sound.sampled.AudioInputStream |
audioInputStream
The audio input stream.
|
private byte[] |
buffer
The buffer.
|
(package private) int |
bytesPerFrame
The bytes per frame.
|
private int |
chunk_counter
The chunk_counter.
|
(package private) javax.sound.sampled.AudioFormat.Encoding |
enc
The enc.
|
(package private) java.io.File |
file
The file.
|
(package private) boolean |
hasEnded
The has ended.
|
(package private) boolean |
isBigEndian
The is big endian.
|
(package private) boolean |
onLoop
The on loop.
|
(package private) float |
sampleRate
The sample rate.
|
(package private) int |
sampleSizeInBits
The sample size in bits.
|
| Constructor and Description |
|---|
AudioInputFile(java.lang.String filename,
boolean onLoop)
Instantiates a new audio input file.
|
| Modifier and Type | Method and Description |
|---|---|
long |
getNumberSamples()
Returns the total number of samples in this file.
|
float |
getSampleRate()
Gets the sample rate.
|
private void |
openFile(java.lang.String filename)
Open file.
|
double[] |
readChunk(int offset,
int chunkSize)
Reads a random segment of data from the audio file.
|
double[] |
readNextChunk(int chunkSize)
Reads the next segment of the audio file.
|
java.io.File file
javax.sound.sampled.AudioInputStream audioInputStream
boolean onLoop
boolean hasEnded
int bytesPerFrame
float sampleRate
int sampleSizeInBits
boolean isBigEndian
javax.sound.sampled.AudioFormat.Encoding enc
private byte[] buffer
private int chunk_counter
public AudioInputFile(java.lang.String filename,
boolean onLoop)
throws java.io.FileNotFoundException
filename - the filenameonLoop - the on loopjava.io.FileNotFoundException - the file not found exceptionprivate void openFile(java.lang.String filename)
throws java.io.FileNotFoundException
filename - the filenamejava.io.FileNotFoundException - the file not found exceptionpublic long getNumberSamples()
public float getSampleRate()
public double[] readChunk(int offset,
int chunkSize)
offset - start sample of the segmentchunkSize - size of the segmentpublic double[] readNextChunk(int chunkSize)
chunkSize - the size of the segment