FileDocCategorySizeDatePackage
WavFormatHeader.javaAPI DocJaudiotagger 2.0.42283Wed Mar 30 16:11:54 BST 2011org.jaudiotagger.audio.wav.util

WavFormatHeader

public class WavFormatHeader extends Object

Fields Summary
private boolean
isValid
private int
channels
private int
sampleRate
private int
bytesPerSecond
private int
bitrate
Constructors Summary
public WavFormatHeader(byte[] b)


      
    
        String fmt = new String(b, 0, 3);
        //System.err.println(fmt);
        if (fmt.equals("fmt") && b[8] == 1)
        {
            channels = b[10];
            //System.err.println(channels);
            sampleRate = u(b[15]) * 16777216 + u(b[14]) * 65536 + u(b[13]) * 256 + u(b[12]);
            //System.err.println(sampleRate);
            bytesPerSecond = u(b[19]) * 16777216 + u(b[18]) * 65536 + u(b[17]) * 256 + u(b[16]);
            //System.err.println(bytesPerSecond);
            bitrate = u(b[22]);

            isValid = true;
        }

    
Methods Summary
public intgetBitrate()

        return bitrate;
    
public intgetBytesPerSecond()

        return bytesPerSecond;
    
public intgetChannelNumber()

        return channels;
    
public intgetSamplingRate()

        return sampleRate;
    
public booleanisValid()

        return isValid;
    
public java.lang.StringtoString()

        String out = "RIFF-WAVE Header:\n";
        out += "Is valid?: " + isValid;
        return out;
    
private intu(int n)

        return n & 0xff;