|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.beadsproject.beads.data.audiofile.AudioFile
public abstract class AudioFile
An AudioFile provides a handle to an audio file located either on disk or online.
AudioFile is used by Sample
, however if you want
to use it, then AudioIO.getAudioFile
will return an audio file.
Depending on the AudioIO implementation different audio file types may or may not be available.
Nested Class Summary | |
---|---|
static class |
AudioFile.OperationUnsupportedException
Thrown if an operation is unsupported for this AudioFile. |
Field Summary | |
---|---|
protected AudioFormat |
audioFormat
The format of the decoded audio data. |
protected java.util.Map<java.lang.String,java.lang.Object> |
audioInfo
Additional properties of this AudioFile. |
protected float |
length
Length of the file in milliseconds If <0 then it is unknown. |
protected java.lang.String |
name
The name of this audiofile. |
protected long |
nFrames
The total number of frames. |
protected boolean |
trace
Advanced. |
Constructor Summary | |
---|---|
AudioFile()
|
Method Summary | |
---|---|
abstract void |
close()
Close the audio file. |
AudioFormat |
getFormat()
|
int |
getFrameSize()
|
java.lang.String |
getInformation()
|
float |
getLength()
|
java.lang.String |
getName()
|
int |
getNumChannels()
|
long |
getNumFrames()
|
java.util.Map<java.lang.String,java.lang.Object> |
getProperties()
|
abstract boolean |
isClosed()
Is the file stream closed? |
boolean |
isOpen()
Is the file stream open? |
abstract void |
open()
Opens the audio file. |
abstract int |
read(byte[] buffer)
Read bytes from this audiofile. |
abstract int |
read(float[][] buffer)
Read decoded audio data in a non-interleaved, Beads-friendly format. |
void |
reset()
Reset the audio input stream. |
void |
seek(int frame)
Seek to a specific frame number. |
protected void |
setLength(float length)
|
protected void |
setNumFrames(long nFrames)
|
void |
setTrace(boolean trace)
A debugging tool. |
void |
skip(long frames)
Skips a number of frames. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String name
protected AudioFormat audioFormat
protected long nFrames
protected float length
protected java.util.Map<java.lang.String,java.lang.Object> audioInfo
protected boolean trace
Constructor Detail |
---|
public AudioFile()
Method Detail |
---|
public void reset() throws AudioFile.OperationUnsupportedException
OperationUnsupported
AudioFile.OperationUnsupportedException
public void skip(long frames) throws AudioFile.OperationUnsupportedException
OperationUnsupported
AudioFile.OperationUnsupportedException
public void seek(int frame) throws AudioFile.OperationUnsupportedException
frame
- The frame number, relative to the start of the audio data.
OperationUnsupported
AudioFile.OperationUnsupportedException
public abstract void open() throws javax.sound.sampled.UnsupportedAudioFileException, java.io.IOException
javax.sound.sampled.UnsupportedAudioFileException
java.io.IOException
public java.lang.String getName()
public java.lang.String getInformation()
public abstract void close() throws java.io.IOException
java.io.IOException
public boolean isOpen()
public abstract boolean isClosed()
public AudioFormat getFormat()
public abstract int read(byte[] buffer)
buffer
- A buffer to fill.
public abstract int read(float[][] buffer)
buffer
- The buffer to fill. After execution buffer[i][j] will contain the sample in channel i, frame j. Buffer has size (numChannels,numFramesRequested).
public java.util.Map<java.lang.String,java.lang.Object> getProperties()
public int getNumChannels()
protected void setNumFrames(long nFrames)
public long getNumFrames()
protected void setLength(float length)
public float getLength()
public int getFrameSize()
public void setTrace(boolean trace)
trace
- Enable or disable a trace of file accesses. Useful for debugging.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |