Example usage for javax.sound.sampled AudioSystem getAudioFileFormat

List of usage examples for javax.sound.sampled AudioSystem getAudioFileFormat

Introduction

In this page you can find the example usage for javax.sound.sampled AudioSystem getAudioFileFormat.

Prototype

public static AudioFileFormat getAudioFileFormat(final File file)
        throws UnsupportedAudioFileException, IOException 

Source Link

Document

Obtains the audio file format of the specified File .

Usage

From source file:com.limegroup.gnutella.gui.mp3.BasicPlayer.java

/**
 * Inits Audio ressources from file./*www.  jav a 2 s  . c o m*/
 */
private void initAudioInputStream(File file) throws UnsupportedAudioFileException, IOException {
    _file = file;
    m_audioInputStream = AudioSystem.getAudioInputStream(file);
    m_audioFileFormat = AudioSystem.getAudioFileFormat(file);
}

From source file:com.limegroup.gnutella.gui.mp3.BasicPlayer.java

/**
 * Inits Audio ressources from URL./*from  w  w  w  .j a  va2  s. com*/
 */
private void initAudioInputStream(URL url) throws UnsupportedAudioFileException, IOException {
    m_audioInputStream = AudioSystem.getAudioInputStream(url);
    m_audioFileFormat = AudioSystem.getAudioFileFormat(url);
}

From source file:com.player.BasicMP3Player.java

/**
 * Inits Audio ressources from file.//from   ww w .  j  a va  2 s .  c  o  m
 */
private void initAudioInputStream(File file) throws UnsupportedAudioFileException, IOException {
    m_audioInputStream = AudioSystem.getAudioInputStream(file);
    m_audioFileFormat = AudioSystem.getAudioFileFormat(file);
}

From source file:com.player.BasicMP3Player.java

/**
 * Inits Audio ressources from InputStream.
 *///from   w ww .  j a  v  a2  s  .  c  o  m
private void initAudioInputStream(InputStream inputStream) throws UnsupportedAudioFileException, IOException {
    m_audioInputStream = AudioSystem.getAudioInputStream(inputStream);
    m_audioFileFormat = AudioSystem.getAudioFileFormat(inputStream);
}

From source file:BasicPlayer.java

/**
 * Inits Audio ressources from file./*  w w w .java  2 s  . c o m*/
 */
protected void initAudioInputStream(File file) throws UnsupportedAudioFileException, IOException {
    m_audioInputStream = AudioSystem.getAudioInputStream(file);
    m_audioFileFormat = AudioSystem.getAudioFileFormat(file);
}

From source file:BasicPlayer.java

/**
 * Inits Audio ressources from URL.//from w  ww .  ja  v a 2s  . c  o  m
 */
protected void initAudioInputStream(URL url) throws UnsupportedAudioFileException, IOException {
    m_audioInputStream = AudioSystem.getAudioInputStream(url);
    m_audioFileFormat = AudioSystem.getAudioFileFormat(url);
}

From source file:BasicPlayer.java

/**
 * Inits Audio ressources from InputStream.
 *///from   w ww .j  av  a2 s  .  co  m
protected void initAudioInputStream(InputStream inputStream) throws UnsupportedAudioFileException, IOException {
    m_audioInputStream = AudioSystem.getAudioInputStream(inputStream);
    m_audioFileFormat = AudioSystem.getAudioFileFormat(inputStream);
}

From source file:com.flipzu.PostProcThread.java

private long getDurationWithMp3Spi(File file) {

    AudioFileFormat fileFormat;// w ww  .ja  v  a2 s .  c  om
    try {
        fileFormat = AudioSystem.getAudioFileFormat(file);
        if (fileFormat instanceof TAudioFileFormat) {
            Map<?, ?> properties = ((TAudioFileFormat) fileFormat).properties();
            String key = "duration";
            Long microseconds = (Long) properties.get(key);
            long sec = (microseconds / 1000000);
            return sec;
        } else {
            return 0;
        }
    } catch (UnsupportedAudioFileException e) {
        debug.logPostProc("getDurationWithMp3Spi UnsupportedAudioFile error ");
    } catch (IOException e) {
        debug.logPostProc("getDurationWithMp3Spi IOException error ");
    }
    return 0;
}