6 #define L Java_liba_lpf
13 JNIEXPORT
void JNICALL
Java_liba_lpf_clinit(JNIEnv
*Env
, jclass Cls
)
15 jclass Nbb
= (*Env
)->FindClass(Env
, "Ljava/nio/ByteBuffer;");
16 L
.New
= (*Env
)->GetStaticMethodID(Env
, Nbb
, "allocateDirect", "(I)Ljava/nio/ByteBuffer;");
17 L
.ctx
= (*Env
)->GetFieldID(Env
, Cls
, "ctx", "Ljava/nio/ByteBuffer;");
20 JNIEXPORT
void JNICALL
Java_liba_lpf_init(JNIEnv
*Env
, jobject Obj
, jdouble fc
, jdouble ts
)
22 jobject Ctx
= (*Env
)->CallObjectMethod(Env
, Obj
, L
.New
, (jint
)sizeof(a_lpf
));
23 a_lpf
*ctx
= (a_lpf
*)(*Env
)->GetDirectBufferAddress(Env
, Ctx
);
24 (*Env
)->SetObjectField(Env
, Obj
, L
.ctx
, Ctx
);
25 a_lpf_init(ctx
, A_LPF_GEN(fc
, ts
));
28 JNIEXPORT jdouble JNICALL
Java_liba_lpf_alpha(JNIEnv
*Env
, jobject Obj
)
30 jobject Ctx
= (*Env
)->GetObjectField(Env
, Obj
, L
.ctx
);
31 a_lpf
*ctx
= (a_lpf
*)(*Env
)->GetDirectBufferAddress(Env
, Ctx
);
35 JNIEXPORT jdouble JNICALL
Java_liba_lpf_output(JNIEnv
*Env
, jobject Obj
)
37 jobject Ctx
= (*Env
)->GetObjectField(Env
, Obj
, L
.ctx
);
38 a_lpf
*ctx
= (a_lpf
*)(*Env
)->GetDirectBufferAddress(Env
, Ctx
);
42 JNIEXPORT jobject JNICALL
Java_liba_lpf_gen(JNIEnv
*Env
, jobject Obj
, jdouble fc
, jdouble ts
)
44 jobject Ctx
= (*Env
)->GetObjectField(Env
, Obj
, L
.ctx
);
45 a_lpf
*ctx
= (a_lpf
*)(*Env
)->GetDirectBufferAddress(Env
, Ctx
);
46 ctx
->alpha
= A_LPF_GEN(fc
, ts
);
50 JNIEXPORT jdouble JNICALL
Java_liba_lpf_iter(JNIEnv
*Env
, jobject Obj
, jdouble x
)
52 jobject Ctx
= (*Env
)->GetObjectField(Env
, Obj
, L
.ctx
);
53 a_lpf
*ctx
= (a_lpf
*)(*Env
)->GetDirectBufferAddress(Env
, Ctx
);
54 return a_lpf_iter(ctx
, x
);
57 JNIEXPORT jobject JNICALL
Java_liba_lpf_zero(JNIEnv
*Env
, jobject Obj
)
59 jobject Ctx
= (*Env
)->GetObjectField(Env
, Obj
, L
.ctx
);
60 a_lpf
*ctx
= (a_lpf
*)(*Env
)->GetDirectBufferAddress(Env
, Ctx
);