Package jmri.jmrit.sound
Class WavBuffer
java.lang.Object
jmri.jmrit.sound.WavBuffer
Wrap a byte array to provide WAV file functionality
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) byte[](package private) int(package private) int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintfindHeader(int i1, int i2, int i3, int i4) Find a specific header in the .wav fragment.(package private) intfourByte(int index) booleanbyte[]intintOffset to the last data byte in the buffer.intSize of the data segment in bytes.intOffset to the first data byte in the buffer.floatintboolean(package private) inttwoByte(int index)
-
Field Details
-
fmtOffset
int fmtOffset -
dataOffset
int dataOffset -
buffer
byte[] buffer
-
-
Constructor Details
-
WavBuffer
Create from already existing byte array.- Parameters:
content- a WAV format byte array, starting with a RIFF header
-
WavBuffer
Create from contents of file. The file contents are expected to be in .wav format, starting with a RIFF header.- Parameters:
file- file containing the .wav.- Throws:
IOException- on error.
-
-
Method Details
-
findHeader
Find a specific header in the .wav fragment.- Parameters:
i1- index 1.i2- index 2.i3- index 3.i4- index 4.- Returns:
- offset of the 1st byte of the header in the buffer
-
getSampleRate
-
getSampleSizeInBits
-
getChannels
-
getBigEndian
-
getSigned
-
getDataStart
Offset to the first data byte in the buffer.- Returns:
- first data byte offset.
-
getDataSize
Size of the data segment in bytes.- Returns:
- data size in bytes.
-
getDataEnd
Offset to the last data byte in the buffer. One more than this points to the next header.- Returns:
- data end value.
-
twoByte
-
fourByte
-
getByteArray
-