Posted By:
Juju_Th
Posted On:
Friday, May 19, 2006 09:38 AM
I have some problems with this code, in SetSampleRate.java: private native static PaHostApiInfo[] GetAPIDevicesInfos(int size); public static void main(String args[]) { ... 15: PaHostApiInfo info[] = new PaHostApiInfo[size]; 16: info=GetAPIDevicesInfos(size); During execution: >java SetSampleRate Exception in thread "main" java.lang.NoSuchMethodError: PaHostApiInfo at SetSampleRate.GetAPIDevicesInfos(Native Method) at SetSampleRate.main(SetSampleRate.java:16) my constructor of PaHostApiInfo is : public PaHostApiInfo(int structVersion, int type, String name, int deviceCount, int defaultInputDevice, int
More>>
I have some problems with this code, in SetSampleRate.java:
private native static PaHostApiInfo[] GetAPIDevicesInfos(int size);
public static void main(String args[])
{
...
15: PaHostApiInfo info[] = new PaHostApiInfo[size];
16: info=GetAPIDevicesInfos(size);
During execution:
>java SetSampleRate
Exception in thread "main" java.lang.NoSuchMethodError: PaHostApiInfo
at SetSampleRate.GetAPIDevicesInfos(Native Method)
at SetSampleRate.main(SetSampleRate.java:16)
my constructor of PaHostApiInfo is :
public PaHostApiInfo(int structVersion, int type, String name, int deviceCount, int defaultInputDevice, int defaultOutputDevice)
and my c++ native code is :
JNIEXPORT jobjectArray JNICALL Java_SetSampleRate_GetAPIDevicesInfos (JNIEnv *env, jclass cls, jint size)
{
jobjectArray result;
PaHostApiIndex i;
const PaHostApiInfo * info;
jclass PaHostApiInfoCls = env->FindClass("PaHostApiInfo");
if (PaHostApiInfoCls == NULL) return NULL; /* exception thrown */
result = env->NewObjectArray((jsize) size, PaHostApiInfoCls, NULL);
if (result == NULL) return NULL; /* out of memory error thrown */
jmethodID constructorID = env->GetMethodID(PaHostApiInfoCls, "PaHostApiInfo", "(IILjava/lang/String;III)V");
for (i=0; i
{
info = Pa_GetHostApiInfo(i);
jobject jInfo = env->NewObject(PaHostApiInfoCls, constructorID, (jint) info->structVersion,
(jint) info->type, env->NewStringUTF(info->name), (jint) info->deviceCount,
(jint) info->defaultInputDevice, (jint) info->defaultOutputDevice);
if (jInfo == NULL) return NULL; /* exception thrown */
env->SetObjectArrayElement(result, i, jInfo);
env->DeleteLocalRef(jInfo);
}
return result;
}
If someone could help me, it would be very nice :)
<<Less