Package x3
Class X3JNIEncoder
java.lang.Object
x3.X3JNIEncoder
- All Implemented Interfaces:
X3Encoder
public class X3JNIEncoder extends java.lang.Object implements X3Encoder
Encoder which makes calls through to C code JNI functions.
- Author:
- Doug Gillespie
-
Field Summary
-
Constructor Summary
Constructors Constructor Description X3JNIEncoder()
-
Method Summary
Modifier and Type Method Description int
CloseFile()
Close the current x3 file.int
jniWavToX3(java.lang.String sourceFile, java.lang.String destFile)
int
jniX3ToWav(java.lang.String sourceFile, java.lang.String destFile)
int
openFile(java.lang.String fileName, int nBits, int sampleRate, int channelMap, long timeMillis)
Open a file for x3 recordingint
recordData(short[] data, int dataSamples)
Write new data to the file.int
wavToX3(java.lang.String sourceFile, java.lang.String destFile)
Convert a wav file into an X3 file.int
x3ToWav(java.lang.String sourceFile, java.lang.String destFile)
Convert an x3 file into a wav file
-
Constructor Details
-
X3JNIEncoder
public X3JNIEncoder()
-
-
Method Details
-
jniWavToX3
public int jniWavToX3(java.lang.String sourceFile, java.lang.String destFile) -
jniX3ToWav
public int jniX3ToWav(java.lang.String sourceFile, java.lang.String destFile) -
wavToX3
public int wavToX3(java.lang.String sourceFile, java.lang.String destFile)Description copied from interface:X3Encoder
Convert a wav file into an X3 file. -
x3ToWav
public int x3ToWav(java.lang.String sourceFile, java.lang.String destFile)Description copied from interface:X3Encoder
Convert an x3 file into a wav file -
openFile
public int openFile(java.lang.String fileName, int nBits, int sampleRate, int channelMap, long timeMillis)Open a file for x3 recording- Parameters:
fileName
- Full path to filenBits
- number of bits in the datasampleRate
- sample ratechannelMap
- bitmap of used channels.timeMillis
- time in milliseconds (written into file header)- Returns:
- 1 if file opened ok.
-
CloseFile
public int CloseFile()Close the current x3 file.- Returns:
-
recordData
public int recordData(short[] data, int dataSamples)Write new data to the file.Data will be for all channels in the channel map given to the openNewFile function and are assumed to be interleaved.
First copy the data into the rawDatabuffer until the buffer is full. then send that buffer off to be compressed, written to output file and reset. dataSamples is samples per channel so the length of data should be dataSamples * the number of channels. Data should be interleaved.
-