FileDocCategorySizeDatePackage
TBPMTextInformationID3V2Frame.javaAPI Docjid3 0.463942Wed Sep 21 02:05:29 BST 2005org.blinkenlights.jid3.v2

TBPMTextInformationID3V2Frame

public class TBPMTextInformationID3V2Frame extends TextInformationID3V2Frame
author
paul Text frame which contains the number of beats per minute in the recording.

Fields Summary
private int
m_iBeatsPerMinute
Constructors Summary
public TBPMTextInformationID3V2Frame(int iBeatsPerMinute)
Constructor.

param
iBeatsPerMinute the number of beats per minute in the recording

        super(Integer.toString(iBeatsPerMinute));
        
        m_iBeatsPerMinute = iBeatsPerMinute;
    
public TBPMTextInformationID3V2Frame(InputStream oIS)

        super(oIS);
        
        try
        {
            // BPM is supposed to be an integer, but a program named Mixmeister BPM Analyzer writes floating
            // point values.  So we accept floating point values, but cast to an int (ie. we will only write an integer).
            m_iBeatsPerMinute = (int)Double.parseDouble(m_sInformation);
        }
        catch (Exception e)
        {
            throw new InvalidFrameID3Exception("Encountered corrupt TBPM frame while reading tag.", e);
        }
    
Methods Summary
public voidaccept(ID3Visitor oID3Visitor)

        oID3Visitor.visitTBPMTextInformationID3V2Frame(this);
    
public booleanequals(java.lang.Object oOther)

        if ((oOther == null) || (!(oOther instanceof TBPMTextInformationID3V2Frame)))
        {
            return false;
        }
        
        TBPMTextInformationID3V2Frame oOtherTBPM = (TBPMTextInformationID3V2Frame)oOther;
        
        return ((m_iBeatsPerMinute == oOtherTBPM.m_iBeatsPerMinute) &&
                m_oTextEncoding.equals(oOtherTBPM.m_oTextEncoding) &&
                m_sInformation.equals(oOtherTBPM.m_sInformation));
    
public intgetBeatsPerMinute()
Get the number of beats per minute for this recording.

return
the number of beats per minute

        return m_iBeatsPerMinute;
    
protected byte[]getFrameId()

        return "TBPM".getBytes();
    
public intsetBeatsPerMinute(int iBeatsPerMinute)
Set the number of beats per minute for this recording.

param
iBeatsPerMinute the number of beats per minute
return
the previous value set for the beats per minute

        int iOldBeatsPerMinute = m_iBeatsPerMinute;
        
        m_oTextEncoding = TextEncoding.getDefaultTextEncoding();
        m_sInformation = Integer.toString(iBeatsPerMinute);
        m_iBeatsPerMinute = iBeatsPerMinute;
        
        return iOldBeatsPerMinute;
    
public java.lang.StringtoString()

        return "Beats per minute: [" + m_sInformation + "]";