|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.sciss.io.AudioFileDescr
public class AudioFileDescr
An AudioFileDescr
is
a data structure that describes the
format of an AudioFile
.
It was public readable fields for
common parameters such as sample rate
and bitdepth. More specific features
such as markers or gain chunks
are stored using a Map
object
being accessed throught the setProperty
and getProperty
methods.
A corresponding GUI element,
the AudioFileFormatPane
exists
which presents the common fields to the user.
AudioFile
,
AudioFileFormatPane
Field Summary | |
---|---|
java.lang.String |
appCode
application (creator) code |
int |
bitsPerSample
bits per sample |
int |
channels
number of channels (interleaved) |
java.io.File |
file
This denotes a corresponding file on a harddisk. |
static int |
FORMAT_FLOAT
sampleFormat type : pcm floating point |
static int |
FORMAT_INT
sampleFormat type : linear pcm integer |
static java.lang.String |
KEY_APPCODE
property key : application specific code. value class = byte[]; note that AbstractApplication.getApplication().getMacOSCreator() is used to write the app chunk, and when reading anything but app-code from the current application is skipped! |
static java.lang.String |
KEY_COMMENT
property key : comment text. value class = String; |
static java.lang.String |
KEY_GAIN
property key : playback gain (multiplier). value class = Float |
static java.lang.String |
KEY_LOOP
property key : loop region. value class = Region |
static java.lang.String |
KEY_MARKERS
property key : marker list. value class = (java.util.)List whose elements are of class Marker |
static java.lang.String |
KEY_REGIONS
property key : region list. value class = (java.util.)List whose elements are of class Region |
long |
length
sound file length in sample frames |
double |
rate
sampling rate in hertz |
int |
sampleFormat
sample number format, FORMAT_INT or FORMAT_FLOAT |
int |
type
file format such as TYPE_AIFF |
static int |
TYPE_AIFF
type value : apple aiff sound file format |
static int |
TYPE_IRCAM
type value : ircam sound file format |
static int |
TYPE_RAW
type value : raw (headerless) file format |
static int |
TYPE_SND
type value : sun/next file format .au aka .snd |
static int |
TYPE_UNKNOWN
type value : undefined audio file format |
static int |
TYPE_WAVE
type value : wave (riff) sound file format |
static int |
TYPE_WAVE64
type value : sony wave64 sound file format |
Constructor Summary | |
---|---|
AudioFileDescr()
Construct a new AudioFileDescr
whose fields are all undefined |
|
AudioFileDescr(AudioFileDescr orig)
Construct a new AudioFileDescr
whose common fields are copied from a
template (type, channels, rate, bitsPerSample,
sampleFormat, length, properties). |
Method Summary | |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener l)
|
java.lang.String |
getFormat()
Create a human readable text string describing the audio file format. |
static StringItem[] |
getFormatItems()
Gets a list of items suitable to attaching to a PrefComboBox, describing the supported audio file formats. |
static java.lang.String |
getFormatSuffix(int type)
Gets the suffix commonly used for attaching to a file name of the given format. |
java.lang.Object |
getProperty(java.lang.Object key)
Gets a specific property |
int |
getType()
Returns the file format type |
boolean |
isPropertySupported(java.lang.String key)
Reports if a sound file format can handle a particular property. |
static double |
millisToSamples(AudioFileDescr afd,
double ms)
Utility method to convert milliseconds to sample frames according to the given audio file format |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener l)
|
static double |
samplesToMillis(AudioFileDescr afd,
long samples)
Utility method to convert sample frames to milliseconds according to the given audio file format |
void |
setProperty(java.lang.Object source,
java.lang.String key,
java.lang.Object value)
Sets a specific property and dispatches a PropertyChangeEvent to registered listeners |
void |
setProperty(java.lang.String key,
java.lang.Object value)
Sets a specific property. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int TYPE_UNKNOWN
public static final int TYPE_AIFF
public static final int TYPE_SND
public static final int TYPE_IRCAM
public static final int TYPE_WAVE
public static final int TYPE_RAW
public static final int TYPE_WAVE64
public static final int FORMAT_INT
public static final int FORMAT_FLOAT
public java.io.File file
public int type
public int channels
public double rate
public int bitsPerSample
public int sampleFormat
public long length
public java.lang.String appCode
public static final java.lang.String KEY_LOOP
Region
,
Constant Field Valuespublic static final java.lang.String KEY_MARKERS
Marker
,
Constant Field Valuespublic static final java.lang.String KEY_REGIONS
Region
,
Constant Field Valuespublic static final java.lang.String KEY_GAIN
public static final java.lang.String KEY_APPCODE
public static final java.lang.String KEY_COMMENT
Constructor Detail |
---|
public AudioFileDescr()
AudioFileDescr
whose fields are all undefined
public AudioFileDescr(AudioFileDescr orig)
AudioFileDescr
whose common fields are copied from a
template (type, channels, rate, bitsPerSample,
sampleFormat, length, properties).
orig
- a preexisting description whose
values will be copied to the newly
constructed descriptionMethod Detail |
---|
public int getType()
public java.lang.Object getProperty(java.lang.Object key)
key
- the key of the property to query,
such as KEY_MARKERS
public void setProperty(java.lang.String key, java.lang.Object value)
isPropertySupported
method
to find out if the chosen file format can store
the property.
key
- the key of the property to setvalue
- the properties value. Note that the
value is not checked at all. It is the
callers responsibility to ensure the value's
class is the one specified for the particular key.isPropertySupported( String )
public void setProperty(java.lang.Object source, java.lang.String key, java.lang.Object value)
PropertyChangeEvent
to registered listeners
key
- the key of the property to setvalue
- the properties value.addPropertyChangeListener( PropertyChangeListener )
public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
public boolean isPropertySupported(java.lang.String key)
key
- the key of the property to check
true
the sound file format
given by getType()
supports
the property. false
if not.
Note that if a property is not supported,
it is no harm to set it using setProperty
,
it just won't be written to the sound file's header.public java.lang.String getFormat()
public static StringItem[] getFormatItems()
PrefComboBox to learn about the use of StringItems
public static java.lang.String getFormatSuffix(int type)
type
- format such as TYPE_AIFF, TYPE_RAW etc.
null
if the type was invalid.public static double millisToSamples(AudioFileDescr afd, double ms)
afd
- the audio file description whose
rate field is used to do the conversionms
- arbitrary offset in milliseconds. note
that this doesn't have to be within the
range of the current length of the audio file.
public static double samplesToMillis(AudioFileDescr afd, long samples)
afd
- the audio file description whose
rate field is used to do the conversionsamples
- arbitrary offset in sample frames. note
that this doesn't have to be within the
range of the current length of the audio file.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |