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

    Fields inherited from interface x3.X3Encoder

    ERROR_FAIL, ERROR_OK
  • 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 recording
    int 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

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • 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.
      Specified by:
      wavToX3 in interface X3Encoder
      Parameters:
      sourceFile - Wav file name
      destFile - X3 file name
      Returns:
      0 if sucessful
    • 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
      Specified by:
      x3ToWav in interface X3Encoder
      Parameters:
      sourceFile - X3 file name
      destFile - Wav file name
      Returns:
      0 if sucessful.
    • 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 file
      nBits - number of bits in the data
      sampleRate - sample rate
      channelMap - 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.