Example usage for javax.sound.sampled AudioFormat equals

List of usage examples for javax.sound.sampled AudioFormat equals

Introduction

In this page you can find the example usage for javax.sound.sampled AudioFormat equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Indicates whether some other object is "equal to" this one.

Usage

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

/**
 * Inits Audio ressources from AudioSystem.<br>
 * DateSource must be present.//w  w w  . j a  va  2 s  .c o  m
 */
protected void initLine() throws LineUnavailableException {
    if (m_line == null) {
        createLine();
        LOG.trace("Create Line OK ");
        openLine();
    } else {
        AudioFormat lineAudioFormat = m_line.getFormat();
        AudioFormat audioInputStreamFormat = m_audioInputStream == null ? null : m_audioInputStream.getFormat();
        if (!lineAudioFormat.equals(audioInputStreamFormat)) {
            m_line.close();
            openLine();
        }
    }
}

From source file:BasicPlayer.java

/**
 * Inits Audio ressources from AudioSystem.<br>
 *///www .  ja v  a2 s . c  om
protected void initLine() throws LineUnavailableException {
    log.info("initLine()");
    if (m_line == null)
        createLine();
    if (!m_line.isOpen()) {
        openLine();
    } else {
        AudioFormat lineAudioFormat = m_line.getFormat();
        AudioFormat audioInputStreamFormat = m_audioInputStream == null ? null : m_audioInputStream.getFormat();
        if (!lineAudioFormat.equals(audioInputStreamFormat)) {
            m_line.close();
            openLine();
        }
    }
}