|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectwavFiles.ByteConverter
public abstract class ByteConverter
Classes to convert between various wav and aif stream formats and double data scaled from -1 to +1 for PAMGUARD.
The double data will often need to be packed into a nChan*nSamples 2D array, so provide functionality for this as well as packing single channels of data.
Wav files follow a Windows standard of little endienness and Aif files follow the Mac/Linux standard of bigendienness. Java is Bigendian.
| Constructor Summary | |
|---|---|
ByteConverter()
|
|
| Method Summary | |
|---|---|
abstract int |
bytesToDouble(byte[] byteData,
double[][] doubleData,
int numBytes)
Converts a byte array into a double array. |
static ByteConverter |
createByteConverter(javax.sound.sampled.AudioFormat audioFormat)
|
static ByteConverter |
createByteConverter(int bytesPerSample,
boolean bigEndian,
javax.sound.sampled.AudioFormat.Encoding encoding)
Create a byte converter based on the number of bytes per sample and on the endienness of the byte data. |
abstract int |
doubleToBytes(double[][] doubleData,
byte[] byteData,
int numSamples)
Converts a double array into a byte array. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ByteConverter()
| Method Detail |
|---|
public static ByteConverter createByteConverter(int bytesPerSample,
boolean bigEndian,
javax.sound.sampled.AudioFormat.Encoding encoding)
bytesPerSample - number of bytes per sample (1,2,3 or 4)bigEndian - true if it's big Endian data, false for small Endians.
public static ByteConverter createByteConverter(javax.sound.sampled.AudioFormat audioFormat)
public abstract int bytesToDouble(byte[] byteData,
double[][] doubleData,
int numBytes)
byteData - byte datadoubleData - double data
public abstract int doubleToBytes(double[][] doubleData,
byte[] byteData,
int numSamples)
doubleData - double databyteData - byte data
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||