Package wavFiles

Class WavHeader

java.lang.Object
wavFiles.WavHeader

public class WavHeader extends Object
  • Constructor Details

    • WavHeader

      public WavHeader()
      Construct a blank Wav Header object, generally used when about to read a header from a file.
    • WavHeader

      public WavHeader(AudioFormat audioFormat)
      Construct a WavHeader from a Java AudioFormat.
      Parameters:
      audioFormat - Java audio format.
  • Method Details

    • readHeader

      public boolean readHeader(WindowsFile windowsWavFile)
      Read the header data from file.
      Parameters:
      windowsWavFile - Windows file
      Returns:
      true if header unpacked successfully.
    • writeHeader

      public boolean writeHeader(WindowsFile windowsWavFile)
      Read the header data from file.
      Parameters:
      windowsWavFile - Windows file
      Returns:
      true if header unpacked successfully.
    • getAudioFormat

      public AudioFormat getAudioFormat()
      Returns:
      all data from the header as an AudioFormat object.
    • setFmtTag

      public void setFmtTag(short fmtTag)
      Parameters:
      fmtTag - the fmtTag to set
    • getFmtTag

      public int getFmtTag()
      Returns:
      the fmtTag
    • setNChannels

      public void setNChannels(short nChannels)
      Parameters:
      nChannels - the nChannels to set
    • getNChannels

      public short getNChannels()
      Returns:
      the nChannels
    • setBlockAlign

      public void setBlockAlign(short blockAlign)
      Parameters:
      blockAlign - the blockAlign to set
    • getBlockAlign

      public short getBlockAlign()
      Returns:
      the blockAlign
    • setBitsPerSample

      public void setBitsPerSample(short bitsPerSample)
      Parameters:
      bitsPerSample - the bitsPerSample to set
    • getBitsPerSample

      public short getBitsPerSample()
      Returns:
      the bitsPerSample
    • setSampleRate

      public void setSampleRate(int sampleRate)
      Parameters:
      sampleRate - the sampleRate to set
    • getSampleRate

      public int getSampleRate()
      Returns:
      the sampleRate
    • setBytesPerSec

      public void setBytesPerSec(int bytesPerSec)
      Parameters:
      bytesPerSec - the bytesPerSec to set
    • getBytesPerSec

      public int getBytesPerSec()
      Returns:
      the bytesPerSec
    • setHeaderOk

      public void setHeaderOk(boolean headerOk)
      Parameters:
      headerOk - the headerOk to set
    • isHeaderOk

      public boolean isHeaderOk()
      Returns:
      the headerOk
    • setDataStart

      public void setDataStart(long dataStart)
      Parameters:
      dataStart - the dataStart to set
    • getDataStart

      public long getDataStart()
      Returns:
      byte number for the start of the data.
    • setDataSize

      public void setDataSize(long dataSize)
      Parameters:
      dataSize - the dataSize to set
    • getDataSize

      public long getDataSize()
      Returns:
      the dataSize
    • getNumHeadChunks

      public int getNumHeadChunks()
      Get the number of additional chunks in the wav header.
      Returns:
      the number of additional chunks in the wav header.
    • getHeadChunk

      public WavHeadChunk getHeadChunk(int iChunk)
      Get a chunk from the wav header.
      Parameters:
      iChunk - chunk number
      Returns:
      Chunk read from wav header.
    • getHeaderSize

      public long getHeaderSize()
      Returns:
      the headerSize