Software Archive
Read-only legacy content
17061 Discussions

[SOLVED] CRASH in Java speech synthesis JNI PXCMAudio.AcquireAccess

Alessio_Vinerbi
Beginner
752 Views

Good news for those who use speech synthesis to RealSense in Java.
Interface (JNI pxcmaudio.cpp) there is a bug that send a crash the JVM during the function call PXCMAudio.AquireAccess

The reason is simple.
The signatures of the two functions (C ++, Java) do not coincide, creating an offset on the object pointer java

C++ (pxcmaudio.cpp)

extern "C" JNIEXPORT jobject JNICALL Java_intel_rssdk_PXCMAudio_PXCMAudio_1AcquireAccess
  (JNIEnv *jni, jclass, jlong instance, jobject access, jobject accelerator, jint format, jint options, jobject data)

 

Java (PXCMAudio.java)

public pxcmStatus AcquireAccess(Access access, AudioFormat format, Option options, AudioData data) {
        return PXCMAudio_AcquireAccess(instance, access, format.value, options.value, data);
    }

The problem is in the parameter called "accelerator" absent in Java signature

It will be sufficient comment and regenerate the DLL

extern "C" JNIEXPORT jobject JNICALL Java_intel_rssdk_PXCMAudio_PXCMAudio_1AcquireAccess
  (JNIEnv *jni, jclass, jlong instance, jobject access, /* jobject accelerator,*/ jint format, jint options, jobject data)

Another problem relates to the field AudioData.DataSize
To retrieve the byte array of audio is not correct to execute the command

byte buffer[] = data.ToByteArray(data.dataSize);

Because it is not returned all the audio buffer. This is because the frame rate used is equal to 2.
So to have the entire audio buffer must execute the command:

byte buffer[] = data.ToByteArray(data.dataSize * 2);

I hope will be helpful.
Ennj

Alessio

0 Kudos
1 Reply
Xusheng_L_Intel
Employee
752 Views

We will fix this bug in the future release. Thanks for supporting RealSense SDK.

0 Kudos
Reply