Package wavFiles
Class WavHeader
java.lang.Object
wavFiles.WavHeader
-
Constructor Summary
ConstructorDescriptionConstruct a blank Wav Header object, generally used when about to read a header from a file.WavHeader
(AudioFormat audioFormat) Construct a WavHeader from a Java AudioFormat. -
Method Summary
Modifier and TypeMethodDescriptionshort
short
int
long
long
int
getHeadChunk
(int iChunk) Get a chunk from the wav header.long
short
int
Get the number of additional chunks in the wav header.int
boolean
boolean
readHeader
(WindowsFile windowsWavFile) Read the header data from file.void
setBitsPerSample
(short bitsPerSample) void
setBlockAlign
(short blockAlign) void
setBytesPerSec
(int bytesPerSec) void
setDataSize
(long dataSize) void
setDataStart
(long dataStart) void
setFmtTag
(short fmtTag) void
setHeaderOk
(boolean headerOk) void
setNChannels
(short nChannels) void
setSampleRate
(int sampleRate) boolean
writeHeader
(WindowsFile windowsWavFile) Read the header data from file.
-
Constructor Details
-
WavHeader
public WavHeader()Construct a blank Wav Header object, generally used when about to read a header from a file. -
WavHeader
Construct a WavHeader from a Java AudioFormat.- Parameters:
audioFormat
- Java audio format.
-
-
Method Details
-
readHeader
Read the header data from file.- Parameters:
windowsWavFile
- Windows file- Returns:
- true if header unpacked successfully.
-
writeHeader
Read the header data from file.- Parameters:
windowsWavFile
- Windows file- Returns:
- true if header unpacked successfully.
-
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
Get a chunk from the wav header.- Parameters:
iChunk
- chunk number- Returns:
- Chunk read from wav header.
-
getHeaderSize
public long getHeaderSize()- Returns:
- the headerSize
-