![]() |
The Java Developers Almanac 1.4 |
|
e726. Determining the File Format of a Sampled Audio File try {
// From file
AudioFileFormat fformat = AudioSystem.getAudioFileFormat(new File("audiofile"));
// From URL
fformat = AudioSystem.getAudioFileFormat(new URL("http://hostname/audiofile"));
if (fformat.getType() == AudioFileFormat.Type.AIFC) {
} else if (fformat.getType() == AudioFileFormat.Type.AIFF) {
} else if (fformat.getType() == AudioFileFormat.Type.AU) {
} else if (fformat.getType() == AudioFileFormat.Type.WAVE) {
}
} catch (MalformedURLException e) {
} catch (IOException e) {
} catch (UnsupportedAudioFileException e) {
// File format is not supported.
}
e728. Determining the Duration of a Sampled Audio File e729. Determining the Position of a Sampled Audio Player e730. Setting the Volume of a Sampled Audio Player
© 2002 Addison-Wesley. |