com.sun.jna.ptr.FloatByReference Java Examples

The following examples show how to use com.sun.jna.ptr.FloatByReference. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OpenVRBounds.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Initialize the VR bounds.
 * @return <code>true</code> if the initialization is a success and <code>false</code> otherwise.
 */
public boolean init(OpenVR api) {
	
	logger.config("Initialize VR bounds...");
	
    if( vrChaperone == null ) {
        vrChaperone = new VR_IVRChaperone_FnTable(JOpenVRLibrary.VR_GetGenericInterface(JOpenVRLibrary.IVRChaperone_Version, api.hmdErrorStore).getPointer());
        if( vrChaperone != null ) {
            vrChaperone.setAutoSynch(false);
            vrChaperone.read();
            FloatByReference fbX = new FloatByReference();
            FloatByReference fbZ = new FloatByReference();
            vrChaperone.GetPlayAreaSize.apply(fbX, fbZ);
            playSize = new Vector2f(fbX.getValue(), fbZ.getValue());
            
            logger.config("Initialize VR bounds [SUCCESS]");
            return true; // init success
        }
        
        logger.warning("Initialize VR bounds [FAILED].");
        return false; // failed to init
    }
    
    logger.config("Initialize VR bounds already done.");
    return true; // already initialized
}
 
Example #2
Source File: Nc4wrapper.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public synchronized int nc_get_var_chunk_cache(int ncid, int varid, SizeTByReference sizep, SizeTByReference nelemsp,
    FloatByReference preemptionp) {
  int ret;
  try {
    ce();
    ret = nc4.nc_get_var_chunk_cache(ncid, varid, sizep, nelemsp, preemptionp);
    if (TRACE) {
      trace(ret, "nc_get_var_chunk_cache", ncid, varid, sizep, nelemsp, preemptionp);
    }
  } finally {
    cx();
  }
  return ret;
}
 
Example #3
Source File: Nc4wrapper.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public synchronized int nc_get_chunk_cache(SizeTByReference sizep, SizeTByReference nelemsp,
    FloatByReference preemptionp) {
  int ret;
  try {
    ce();
    ret = nc4.nc_get_chunk_cache(sizep, nelemsp, preemptionp);
    if (TRACE) {
      trace(ret, "nc_get_chunk_cache", sizep, nelemsp, preemptionp);
    }
  } finally {
    cx();
  }
  return ret;
}
 
Example #4
Source File: Nc4prototypes.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
int nc_get_var_chunk_cache(int ncid, int varid, SizeTByReference sizep, SizeTByReference nelemsp,
FloatByReference preemptionp);
 
Example #5
Source File: OpenVR.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public boolean initialize() {
	
	logger.config("Initializing OpenVR system...");
	
    hmdErrorStore = new IntByReference();
    vrsystemFunctions = null;
    
    // Init the native linking to the OpenVR library.
    try{
      JOpenVRLibrary.init();
    } catch(Throwable t){
      logger.log(Level.SEVERE, "Cannot link to OpenVR system library: "+t.getMessage(), t);
      return false;
    }
    
    JOpenVRLibrary.VR_InitInternal(hmdErrorStore, JOpenVRLibrary.EVRApplicationType.EVRApplicationType_VRApplication_Scene);
    
    if( hmdErrorStore.getValue() == 0 ) {
        vrsystemFunctions = new VR_IVRSystem_FnTable(JOpenVRLibrary.VR_GetGenericInterface(JOpenVRLibrary.IVRSystem_Version, hmdErrorStore).getPointer());
    }
    
    if( vrsystemFunctions == null || hmdErrorStore.getValue() != 0 ) {
        logger.severe("OpenVR Initialize Result: " + JOpenVRLibrary.VR_GetVRInitErrorAsEnglishDescription(hmdErrorStore.getValue()).getString(0));
        logger.severe("Initializing OpenVR system [FAILED]");
        return false;
    } else {
        logger.config("OpenVR initialized & VR connected.");
        
        vrsystemFunctions.setAutoSynch(false);
        vrsystemFunctions.read();
        
        
        tlastVsync = new FloatByReference();
        _tframeCount = new LongByReference();
        
        hmdDisplayFrequency = IntBuffer.allocate(1);
        hmdDisplayFrequency.put(JOpenVRLibrary.ETrackedDeviceProperty.ETrackedDeviceProperty_Prop_DisplayFrequency_Float);
        hmdTrackedDevicePoseReference = new TrackedDevicePose_t.ByReference();
        hmdTrackedDevicePoses = (TrackedDevicePose_t[])hmdTrackedDevicePoseReference.toArray(JOpenVRLibrary.k_unMaxTrackedDeviceCount);
        poseMatrices = new Matrix4f[JOpenVRLibrary.k_unMaxTrackedDeviceCount];
        for(int i=0;i<poseMatrices.length;i++) poseMatrices[i] = new Matrix4f();

        timePerFrame = 1.0 / hmdDisplayFrequency.get(0);
        
        // disable all this stuff which kills performance
        hmdTrackedDevicePoseReference.setAutoRead(false);
        hmdTrackedDevicePoseReference.setAutoWrite(false);
        hmdTrackedDevicePoseReference.setAutoSynch(false);
        for(int i=0;i<JOpenVRLibrary.k_unMaxTrackedDeviceCount;i++) {
            hmdTrackedDevicePoses[i].setAutoRead(false);
            hmdTrackedDevicePoses[i].setAutoWrite(false);
            hmdTrackedDevicePoses[i].setAutoSynch(false);
        }
        
        // init controllers for the first time
        VRinput = new OpenVRInput(environment);
        VRinput.init();
        VRinput.updateConnectedControllers();
        
        // init bounds & chaperone info
        OpenVRBounds bounds = new OpenVRBounds();
        bounds.init(this);
        environment.setVRBounds(bounds);
        
        logger.config("Initializing OpenVR system [SUCCESS]");
        initSuccess = true;
        return true;
    }
}
 
Example #6
Source File: Pta.java    From lept4j with Apache License 2.0 3 votes vote down vote up
/**
 * @param n actual number of pts<br>
 * C type : l_int32<br>
 * @param nalloc size of allocated arrays<br>
 * C type : l_int32<br>
 * @param refcount reference count (1 if no clones)<br>
 * C type : l_uint32<br>
 * @param x arrays of floats<br>
 * C type : l_float32*<br>
 * @param y arrays of floats<br>
 * C type : l_float32*
 */
public Pta(int n, int nalloc, int refcount, FloatByReference x, FloatByReference y) {
	super();
	this.n = n;
	this.nalloc = nalloc;
	this.refcount = refcount;
	this.x = x;
	this.y = y;
}
 
Example #7
Source File: FPix.java    From lept4j with Apache License 2.0 3 votes vote down vote up
/**
 * @param w width in pixels<br>
 * C type : l_int32<br>
 * @param h height in pixels<br>
 * C type : l_int32<br>
 * @param wpl 32-bit words/line<br>
 * C type : l_int32<br>
 * @param refcount reference count (1 if no clones)<br>
 * C type : l_uint32<br>
 * @param xres image res (ppi) in x direction<br>
 * C type : l_int32<br>
 * @param yres image res (ppi) in y direction<br>
 * C type : l_int32<br>
 * @param data the float image data<br>
 * C type : l_float32*
 */
public FPix(int w, int h, int wpl, int refcount, int xres, int yres, FloatByReference data) {
	super();
	this.w = w;
	this.h = h;
	this.wpl = wpl;
	this.refcount = refcount;
	this.xres = xres;
	this.yres = yres;
	this.data = data;
}
 
Example #8
Source File: Numa.java    From lept4j with Apache License 2.0 3 votes vote down vote up
/**
 * @param nalloc size of allocated number array<br>
 * C type : l_int32<br>
 * @param n number of numbers saved<br>
 * C type : l_int32<br>
 * @param refcount reference count (1 if no clones)<br>
 * C type : l_int32<br>
 * @param startx x value assigned to array[0]<br>
 * C type : l_float32<br>
 * @param delx change in x value as i --&gt; i + 1<br>
 * C type : l_float32<br>
 * @param array number array<br>
 * C type : l_float32*
 */
public Numa(int nalloc, int n, int refcount, float startx, float delx, FloatByReference array) {
	super();
	this.nalloc = nalloc;
	this.n = n;
	this.refcount = refcount;
	this.startx = startx;
	this.delx = delx;
	this.array = array;
}
 
Example #9
Source File: JNAOpus.java    From speech-android-sdk with Apache License 2.0 2 votes vote down vote up
/**
 * Encodes a frame of audio.<br>
 * @param [in] st <tt>OpusCustomEncoder*</tt>: Encoder state<br>
 * @param [in] pcm <tt>float*</tt>: PCM audio in float format, with a normal range of +/-1.0.<br>
 *          Samples with a range beyond +/-1.0 are supported but will<br>
 *          be clipped by decoders using the integer API and should<br>
 *          only be used if it is known that the far end supports<br>
 *          extended dynamic range. There must be exactly<br>
 *          frame_size samples per channel.<br>
 * @param [in] frame_size <tt>int</tt>: Number of samples per frame of input signal<br>
 * @param [out] compressed <tt>char *</tt>: The compressed data is written here. This may not alias pcm and must be at least maxCompressedBytes long.<br>
 * @param [in] maxCompressedBytes <tt>int</tt>: Maximum number of bytes to use for compressing the frame<br>
 *          (can change from one frame to another)<br>
 * @return Number of bytes written to "compressed".<br>
 *       If negative, an error has occurred (see error codes). It is IMPORTANT that<br>
 *       the length returned be somehow transmitted to the decoder. Otherwise, no<br>
 *       decoding is possible.<br>
 * Original signature : <code>int opus_custom_encode_float(OpusCustomEncoder*, const float*, int, unsigned char*, int)</code><br>
 * <i>native declaration : /tmp/opus_custom.h:202</i>
 */
int opus_custom_encode_float(PointerByReference st, FloatByReference pcm, int frame_size, Pointer compressed, int maxCompressedBytes);
 
Example #10
Source File: JNAOpus.java    From speech-android-sdk with Apache License 2.0 2 votes vote down vote up
/**
 * Decode an opus custom frame with floating point output<br>
 * @param [in] st <tt>OpusCustomDecoder*</tt>: Decoder state<br>
 * @param [in] data <tt>char*</tt>: Input payload. Use a NULL pointer to indicate packet loss<br>
 * @param [in] len <tt>int</tt>: Number of bytes in payload<br>
 * @param [out] pcm <tt>float*</tt>: Output signal (interleaved if 2 channels). length<br>
 *  is frame_size*channels*sizeof(float)<br>
 * @param [in] frame_size Number of samples per channel of available space in *pcm.<br>
 * @returns Number of decoded samples or @ref opus_errorcodes<br>
 * Original signature : <code>int opus_custom_decode_float(OpusCustomDecoder*, const unsigned char*, int, float*, int)</code><br>
 * <i>native declaration : /tmp/opus_custom.h:302</i>
 */
int opus_custom_decode_float(PointerByReference st, Pointer data, int len, FloatByReference pcm, int frame_size);
 
Example #11
Source File: OsvrRenderManagerLibrary.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 2 votes vote down vote up
/**
 * @return True on success, false on failure (null pointer).<br>
 * Original signature : <code>OSVR_ReturnCode OSVR_Projection_to_D3D(float[16], OSVR_ProjectionMatrix)</code><br>
 * @deprecated use the safer methods {@link #OSVR_Projection_to_D3D(java.nio.FloatBuffer, com.jme3.system.osvr.osvrrendermanager.OSVR_ProjectionMatrix.ByValue)} and {@link #OSVR_Projection_to_D3D(com.sun.jna.ptr.FloatByReference, com.jme3.system.osvr.osvrrendermanager.OSVR_ProjectionMatrix.ByValue)} instead
 */
@Deprecated 
public static native byte OSVR_Projection_to_D3D(FloatByReference D3D_out, com.jme3.system.osvr.osvrrendermanager.OSVR_ProjectionMatrix.ByValue projection_in);
 
Example #12
Source File: OsvrRenderManagerLibrary.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 2 votes vote down vote up
/**
 * @return True on success, false on failure (null pointer).<br>
 * Original signature : <code>OSVR_ReturnCode OSVR_Projection_to_Unreal(float[16], OSVR_ProjectionMatrix)</code><br>
 * @deprecated use the safer methods {@link #OSVR_Projection_to_Unreal(java.nio.FloatBuffer, com.jme3.system.osvr.osvrrendermanager.OSVR_ProjectionMatrix.ByValue)} and {@link #OSVR_Projection_to_Unreal(com.sun.jna.ptr.FloatByReference, com.jme3.system.osvr.osvrrendermanager.OSVR_ProjectionMatrix.ByValue)} instead
 */
@Deprecated 
public static native byte OSVR_Projection_to_Unreal(FloatByReference Unreal_out, com.jme3.system.osvr.osvrrendermanager.OSVR_ProjectionMatrix.ByValue projection_in);
 
Example #13
Source File: OsvrRenderManagerOpenGLLibrary.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 2 votes vote down vote up
/**
 * @return True on success, false on failure (null pointer).<br>
 * Original signature : <code>OSVR_ReturnCode OSVR_Projection_to_D3D(float[16], OSVR_ProjectionMatrix)</code><br>
 * @deprecated use the safer methods {@link #OSVR_Projection_to_D3D(java.nio.FloatBuffer, com.jme3.system.osvr.osvrrendermanageropengl.OSVR_ProjectionMatrix.ByValue)} and {@link #OSVR_Projection_to_D3D(com.sun.jna.ptr.FloatByReference, com.jme3.system.osvr.osvrrendermanageropengl.OSVR_ProjectionMatrix.ByValue)} instead
 */
@Deprecated 
public static native byte OSVR_Projection_to_D3D(FloatByReference D3D_out, com.jme3.system.osvr.osvrrendermanageropengl.OSVR_ProjectionMatrix.ByValue projection_in);
 
Example #14
Source File: OsvrRenderManagerOpenGLLibrary.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 2 votes vote down vote up
/**
 * @return True on success, false on failure (null pointer).<br>
 * Original signature : <code>OSVR_ReturnCode OSVR_Projection_to_Unreal(float[16], OSVR_ProjectionMatrix)</code><br>
 * @deprecated use the safer methods {@link #OSVR_Projection_to_Unreal(java.nio.FloatBuffer, com.jme3.system.osvr.osvrrendermanageropengl.OSVR_ProjectionMatrix.ByValue)} and {@link #OSVR_Projection_to_Unreal(com.sun.jna.ptr.FloatByReference, com.jme3.system.osvr.osvrrendermanageropengl.OSVR_ProjectionMatrix.ByValue)} instead
 */
@Deprecated 
public static native byte OSVR_Projection_to_Unreal(FloatByReference Unreal_out, com.jme3.system.osvr.osvrrendermanageropengl.OSVR_ProjectionMatrix.ByValue projection_in);
 
Example #15
Source File: OsvrMatrixConventionsLibrary.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 2 votes vote down vote up
/**
 * Set a matrix of floats based on a Pose3.<br>
 * @param pose The Pose3 to convert<br>
 * @param flags Memory ordering flag - see @ref MatrixFlags<br>
 * @param mat an array of 16 floats<br>
 * Original signature : <code>OSVR_ReturnCode osvrPose3ToMatrixf(const OSVR_Pose3*, OSVR_MatrixConventions, float*)</code><br>
 * @deprecated use the safer method
        * {@link #osvrPose3ToMatrixf(com.jme3.system.osvr.osvrmatrixconventions.OSVR_Pose3, short, java.nio.FloatBuffer)}
        * instead
 */
@Deprecated 
public static native byte osvrPose3ToMatrixf(OSVR_Pose3 pose, short flags, FloatByReference mat);
 
Example #16
Source File: OsvrMatrixConventionsLibrary.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 2 votes vote down vote up
/**
 * Set a matrix based on a Pose3. (C++-only overload - detecting scalar<br>
 * type)<br>
 * Original signature : <code>OSVR_ReturnCode osvrPose3ToMatrix(const OSVR_Pose3*, OSVR_MatrixConventions, float*)</code><br>
 * @deprecated use the safer method
        * {@link #osvrPose3ToMatrix(com.jme3.system.osvr.osvrmatrixconventions.OSVR_Pose3, short, java.nio.FloatBuffer)}
        * instead
 */
@Deprecated 
public static native byte osvrPose3ToMatrix(OSVR_Pose3 pose, short flags, FloatByReference mat);
 
Example #17
Source File: OsvrDisplayLibrary.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 2 votes vote down vote up
/**
 * Get the view matrix (inverse of pose) for the given eye of a<br>
 * viewer in a display config - matrix of **floats**.<br>
 * Will only succeed if osvrClientCheckDisplayStartup() succeeds.<br>
 * @param disp Display config object<br>
 * @param viewer Viewer ID<br>
 * @param eye Eye ID<br>
 * @param flags Bitwise OR of matrix convention flags (see @ref MatrixFlags)<br>
 * @param mat Pass a float[::OSVR_MATRIX_SIZE] to get the transformation<br>
 * matrix from room space to eye space (not relative to pose of the viewer)<br>
 * @return OSVR_RETURN_FAILURE if invalid parameters were passed or no pose was<br>
 * yet available, in which case the output argument is unmodified.<br>
 * Original signature : <code>OSVR_ReturnCode osvrClientGetViewerEyeViewMatrixf(OSVR_DisplayConfig, OSVR_ViewerCount, OSVR_EyeCount, OSVR_MatrixConventions, float*)</code><br>
 * @deprecated use the safer method
        * {@link #osvrClientGetViewerEyeViewMatrixf(com.jme3.system.osvr.osvrdisplay.OsvrDisplayLibrary.OSVR_DisplayConfig, int, byte, short, java.nio.FloatBuffer)}
        * instead
 */
@Deprecated 
public static native byte osvrClientGetViewerEyeViewMatrixf(Pointer disp, int viewer, byte eye, short flags, FloatByReference mat);
 
Example #18
Source File: OsvrDisplayLibrary.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 2 votes vote down vote up
/**
 * Get the projection matrix for a surface seen by an eye of a viewer<br>
 * in a display config. (float version)<br>
 * @param disp Display config object<br>
 * @param viewer Viewer ID<br>
 * @param eye Eye ID<br>
 * @param surface Surface ID<br>
 * @param near Distance to near clipping plane - must be nonzero, typically<br>
 * positive.<br>
 * @param far Distance to far clipping plane - must be nonzero, typically<br>
 * positive and greater than near.<br>
 * @param flags Bitwise OR of matrix convention flags (see @ref MatrixFlags)<br>
 * @param matrix Output projection matrix: supply an array of 16<br>
 * (::OSVR_MATRIX_SIZE) floats.<br>
 * @return OSVR_RETURN_FAILURE if invalid parameters were passed, in which case<br>
 * the output argument is unmodified.<br>
 * Original signature : <code>OSVR_ReturnCode osvrClientGetViewerEyeSurfaceProjectionMatrixf(OSVR_DisplayConfig, OSVR_ViewerCount, OSVR_EyeCount, OSVR_SurfaceCount, float, float, OSVR_MatrixConventions, float*)</code><br>
 * @deprecated use the safer method
        * {@link #osvrClientGetViewerEyeSurfaceProjectionMatrixf(com.jme3.system.osvr.osvrdisplay.OsvrDisplayLibrary.OSVR_DisplayConfig, int, byte, int, float, float, short, java.nio.FloatBuffer)}
        * instead
 */
@Deprecated 
public static native byte osvrClientGetViewerEyeSurfaceProjectionMatrixf(Pointer disp, int viewer, byte eye, int surface, float near, float far, short flags, FloatByReference matrix);
 
Example #19
Source File: JNAOpus.java    From speech-android-sdk with Apache License 2.0 2 votes vote down vote up
/**
 * Encodes a multistream Opus frame from floating point input.<br>
 * @param st <tt>OpusMSEncoder*</tt>: Multistream encoder state.<br>
 * @param[in] pcm <tt>const float*</tt>: The input signal as interleaved<br>
 *                                       samples with a normal range of<br>
 *                                       +/-1.0.<br>
 *                                       Samples with a range beyond +/-1.0<br>
 *                                       are supported but will be clipped by<br>
 *                                       decoders using the integer API and<br>
 *                                       should only be used if it is known<br>
 *                                       that the far end supports extended<br>
 *                                       dynamic range.<br>
 *                                       This must contain<br>
 *                                       <code>frame_size*channels</code><br>
 *                                       samples.<br>
 * @param frame_size <tt>int</tt>: Number of samples per channel in the input<br>
 *                                 signal.<br>
 *                                 This must be an Opus frame size for the<br>
 *                                 encoder's sampling rate.<br>
 *                                 For example, at 48 kHz the permitted values<br>
 *                                 are 120, 240, 480, 960, 1920, and 2880.<br>
 *                                 Passing in a duration of less than 10 ms<br>
 *                                 (480 samples at 48 kHz) will prevent the<br>
 *                                 encoder from using the LPC or hybrid modes.<br>
 * @param[out] data <tt>unsigned char*</tt>: Output payload.<br>
 *                                           This must contain storage for at<br>
 *                                           least \a max_data_bytes.<br>
 * @param [in] max_data_bytes <tt>opus_int32</tt>: Size of the allocated<br>
 *                                                 memory for the output<br>
 *                                                 payload. This may be<br>
 *                                                 used to impose an upper limit on<br>
 *                                                 the instant bitrate, but should<br>
 *                                                 not be used as the only bitrate<br>
 *                                                 control. Use #OPUS_SET_BITRATE to<br>
 *                                                 control the bitrate.<br>
 * @returns The length of the encoded packet (in bytes) on success or a<br>
 *          negative error code (see @ref opus_errorcodes) on failure.<br>
 * Original signature : <code>int opus_multistream_encode_float(OpusMSEncoder*, const float*, int, unsigned char*, opus_int32)</code><br>
 * <i>native declaration : /tmp/opus_multistream.h:421</i>
 */
int opus_multistream_encode_float(PointerByReference st, FloatByReference pcm, int frame_size, Pointer data, int max_data_bytes);
 
Example #20
Source File: FaceLibrary.java    From arcface with MIT License 2 votes vote down vote up
/**
 * 人脸特征比对
 * 
 * @param hEngine
 *            [in] 引擎handle
 * @param feature1
 *            [in] 待比较人脸特征1
 * @param feature2
 *            [in] 待比较人脸特征2
 * @param confidenceLevel
 *            [out] 比较结果,置信度数值
 * @return 成功返回MOK,失败返回错误码
 */
NativeLong ASFFaceFeatureCompare(Pointer hEngine, FaceFeature feature1, FaceFeature feature2,
		FloatByReference confidenceLevel);
 
Example #21
Source File: EngineUtil.java    From arcface with MIT License 2 votes vote down vote up
/**
 * 对比特征值
 *
 * @param feature1
 *            特征值1
 * @param feature2
 *            特征值2
 * @return 相似度(置信度)
 */
public static float compareFeature(FaceFeature feature1, FaceFeature feature2) {
	FloatByReference similar = new FloatByReference();
	getInstance().ASFFaceFeatureCompare(phEngine.getValue(), feature1, feature2, similar);
	return similar.getValue();
}
 
Example #22
Source File: JNAOpus.java    From android-sdk with Apache License 2.0 2 votes vote down vote up
/**
 * Opus encode float.
 *
 * @param st             the st
 * @param pcm            the pcm
 * @param frame_size     the frame size
 * @param data           the data
 * @param max_data_bytes the max data bytes
 * @return the int
 */
int opus_encode_float(PointerByReference st, FloatByReference pcm, int frame_size, Pointer data, int max_data_bytes);
 
Example #23
Source File: JNAOpus.java    From android-sdk with Apache License 2.0 2 votes vote down vote up
/**
 * Opus decode float.
 *
 * @param st         the st
 * @param data       the data
 * @param len        the len
 * @param pcm        the pcm
 * @param frame_size the frame size
 * @param decode_fec the decode fec
 * @return the int
 */
int opus_decode_float(PointerByReference st, Pointer data, int len, FloatByReference pcm, int frame_size,
                      int decode_fec);
 
Example #24
Source File: JNAOpus.java    From android-sdk with Apache License 2.0 2 votes vote down vote up
/**
 * Opus multistream encode float.
 *
 * @param st             the st
 * @param pcm            the pcm
 * @param frame_size     the frame size
 * @param data           the data
 * @param max_data_bytes the max data bytes
 * @return the int
 */
int opus_multistream_encode_float(PointerByReference st, FloatByReference pcm, int frame_size, Pointer data,
                                  int max_data_bytes);
 
Example #25
Source File: JNAOpus.java    From android-sdk with Apache License 2.0 2 votes vote down vote up
/**
 * Opus custom encode float.
 *
 * @param st                 the st
 * @param pcm                the pcm
 * @param frame_size         the frame size
 * @param compressed         the compressed
 * @param maxCompressedBytes the max compressed bytes
 * @return the int
 */
int opus_custom_encode_float(PointerByReference st, FloatByReference pcm, int frame_size, Pointer compressed,
                             int maxCompressedBytes);
 
Example #26
Source File: JNAOpus.java    From android-sdk with Apache License 2.0 2 votes vote down vote up
/**
 * Opus custom decode float.
 *
 * @param st         the st
 * @param data       the data
 * @param len        the len
 * @param pcm        the pcm
 * @param frame_size the frame size
 * @return the int
 */
int opus_custom_decode_float(PointerByReference st, Pointer data, int len, FloatByReference pcm, int frame_size);
 
Example #27
Source File: JNAOpus.java    From speech-android-sdk with Apache License 2.0 2 votes vote down vote up
/**
 * Encodes an Opus frame from floating point input.<br>
 * @param [in] st <tt>OpusEncoder*</tt>: Encoder state<br>
 * @param [in] pcm <tt>float*</tt>: Input in float format (interleaved if 2 channels), with a normal range of +/-1.0.<br>
 *          Samples with a range beyond +/-1.0 are supported but will<br>
 *          be clipped by decoders using the integer API and should<br>
 *          only be used if it is known that the far end supports<br>
 *          extended dynamic range.<br>
 *          length is frame_size*channels*sizeof(float)<br>
 * @param [in] frame_size <tt>int</tt>: Number of samples per channel in the<br>
 *                                      input signal.<br>
 *                                      This must be an Opus frame size for<br>
 *                                      the encoder's sampling rate.<br>
 *                                      For example, at 48 kHz the permitted<br>
 *                                      values are 120, 240, 480, 960, 1920,<br>
 *                                      and 2880.<br>
 *                                      Passing in a duration of less than<br>
 *                                      10 ms (480 samples at 48 kHz) will<br>
 *                                      prevent the encoder from using the LPC<br>
 *                                      or hybrid modes.<br>
 * @param [out] data <tt>unsigned char*</tt>: Output payload.<br>
 *                                            This must contain storage for at<br>
 *                                            least \a max_data_bytes.<br>
 * @param [in] max_data_bytes <tt>opus_int32</tt>: Size of the allocated<br>
 *                                                 memory for the output<br>
 *                                                 payload. This may be<br>
 *                                                 used to impose an upper limit on<br>
 *                                                 the instant bitrate, but should<br>
 *                                                 not be used as the only bitrate<br>
 *                                                 control. Use #OPUS_SET_BITRATE to<br>
 *                                                 control the bitrate.<br>
 * @returns The length of the encoded packet (in bytes) on success or a<br>
 *          negative error code (see @ref opus_errorcodes) on failure.<br>
 * Original signature : <code>opus_int32 opus_encode_float(OpusEncoder*, const float*, int, unsigned char*, opus_int32)</code><br>
 * <i>native declaration : /tmp/opus.h:267</i>
 */
int opus_encode_float(PointerByReference st, FloatByReference pcm, int frame_size, Pointer data, int max_data_bytes);
 
Example #28
Source File: JNAOpus.java    From speech-android-sdk with Apache License 2.0 2 votes vote down vote up
/**
 * Decode an Opus packet with floating point output.<br>
 * @param [in] st <tt>OpusDecoder*</tt>: Decoder state<br>
 * @param [in] data <tt>char*</tt>: Input payload. Use a NULL pointer to indicate packet loss<br>
 * @param [in] len <tt>opus_int32</tt>: Number of bytes in payload<br>
 * @param [out] pcm <tt>float*</tt>: Output signal (interleaved if 2 channels). length<br>
 *  is frame_size*channels*sizeof(float)<br>
 * @param [in] frame_size Number of samples per channel of available space in \a pcm.<br>
 *  If this is less than the maximum packet duration (120ms; 5760 for 48kHz), this function will<br>
 *  not be capable of decoding some packets. In the case of PLC (data==NULL) or FEC (decode_fec=1),<br>
 *  then frame_size needs to be exactly the duration of audio that is missing, otherwise the<br>
 *  decoder will not be in the optimal state to decode the next incoming packet. For the PLC and<br>
 *  FEC cases, frame_size <b>must</b> be a multiple of 2.5 ms.<br>
 * @param [in] decode_fec <tt>int</tt>: Flag (0 or 1) to request that any in-band forward error correction data be<br>
 *  decoded. If no such data is available the frame is decoded as if it were lost.<br>
 * @returns Number of decoded samples or @ref opus_errorcodes<br>
 * Original signature : <code>int opus_decode_float(OpusDecoder*, const unsigned char*, opus_int32, float*, int, int)</code><br>
 * <i>native declaration : /tmp/opus.h:450</i>
 */
int opus_decode_float(PointerByReference st, Pointer data, int len, FloatByReference pcm, int frame_size, int decode_fec);
 
Example #29
Source File: JNAOpus.java    From speech-android-sdk with Apache License 2.0 2 votes vote down vote up
/**
 * Decode a multistream Opus packet with floating point output.<br>
 * @param st <tt>OpusMSDecoder*</tt>: Multistream decoder state.<br>
 * @param[in] data <tt>const unsigned char*</tt>: Input payload.<br>
 *                                                Use a <code>NULL</code><br>
 *                                                pointer to indicate packet<br>
 *                                                loss.<br>
 * @param len <tt>opus_int32</tt>: Number of bytes in payload.<br>
 * @param[out] pcm <tt>opus_int16*</tt>: Output signal, with interleaved<br>
 *                                       samples.<br>
 *                                       This must contain room for<br>
 *                                       <code>frame_size*channels</code><br>
 *                                       samples.<br>
 * @param frame_size <tt>int</tt>: The number of samples per channel of<br>
 *                                 available space in \a pcm.<br>
 *                                 If this is less than the maximum packet duration<br>
 *                                 (120 ms; 5760 for 48kHz), this function will not be capable<br>
 *                                 of decoding some packets. In the case of PLC (data==NULL)<br>
 *                                 or FEC (decode_fec=1), then frame_size needs to be exactly<br>
 *                                 the duration of audio that is missing, otherwise the<br>
 *                                 decoder will not be in the optimal state to decode the<br>
 *                                 next incoming packet. For the PLC and FEC cases, frame_size<br>
 *                                 <b>must</b> be a multiple of 2.5 ms.<br>
 * @param decode_fec <tt>int</tt>: Flag (0 or 1) to request that any in-band<br>
 *                                 forward error correction data be decoded.<br>
 *                                 If no such data is available, the frame is<br>
 *                                 decoded as if it were lost.<br>
 * @returns Number of samples decoded on success or a negative error code<br>
 *          (see @ref opus_errorcodes) on failure.<br>
 * Original signature : <code>int opus_multistream_decode_float(OpusMSDecoder*, const unsigned char*, opus_int32, float*, int, int)</code><br>
 * <i>native declaration : /tmp/opus_multistream.h:622</i>
 */
int opus_multistream_decode_float(PointerByReference st, Pointer data, int len, FloatByReference pcm, int frame_size, int decode_fec);
 
Example #30
Source File: JNAOpus.java    From android-sdk with Apache License 2.0 2 votes vote down vote up
/**
 * Opus multistream decode float.
 *
 * @param st         the st
 * @param data       the data
 * @param len        the len
 * @param pcm        the pcm
 * @param frame_size the frame size
 * @param decode_fec the decode fec
 * @return the int
 */
int opus_multistream_decode_float(PointerByReference st, Pointer data, int len, FloatByReference pcm, int frame_size,
                                  int decode_fec);