annotate bindings/java/libAudioDB_JNI.c @ 707:5d5297e5b724
Added CAMUS package (package manager has Many XML files)
author |
mas01mj |
date |
Thu, 03 Jun 2010 16:47:03 +0000 |
parents |
10d3692e0b06 |
children |
|
rev |
line source |
mas01mj@698
|
1 #include "AudioDB.h"
|
mas01mj@698
|
2
|
mas01mj@698
|
3 #include <jni.h>
|
mas01mj@698
|
4 #include "audioDB_API.h"
|
mas01mj@698
|
5
|
mas01mj@698
|
6
|
mas01mj@698
|
7 JNIEXPORT jboolean JNICALL Java_AudioDB_audiodb_1create (JNIEnv *env, jobject obj, jstring path, jint datasize, jint ntracks, jint datadim)
|
mas01mj@698
|
8 {
|
mas01mj@698
|
9 char buf[256];
|
mas01mj@698
|
10 const char *str;
|
mas01mj@698
|
11 str = (*env)->GetStringUTFChars(env, path, NULL);
|
mas01mj@698
|
12 if (str == NULL)
|
mas01mj@698
|
13 return;
|
mas01mj@698
|
14
|
mas01mj@698
|
15 adb_t *handle;
|
mas01mj@698
|
16 handle = audiodb_create(str, datasize, ntracks, datadim);
|
mas01mj@698
|
17 if(!handle)
|
mas01mj@698
|
18 return JNI_FALSE;
|
mas01mj@698
|
19
|
mas01mj@698
|
20 (*env)->ReleaseStringUTFChars(env, path, str);
|
mas01mj@698
|
21 return JNI_TRUE;
|
mas01mj@698
|
22 }
|
mas01mj@698
|
23
|
mas01mj@698
|
24 JNIEXPORT jboolean JNICALL Java_AudioDB_audiodb_1open (JNIEnv *env, jobject obj, jstring path, jobject mode)
|
mas01mj@698
|
25 {
|
mas01mj@698
|
26 jclass modeClass = (*env)->FindClass(env, "AudioDB$Mode");
|
mas01mj@698
|
27 jmethodID getNameMethod = (*env)->GetMethodID(env, modeClass, "name", "()Ljava/lang/String;");
|
mas01mj@698
|
28 jstring value = (jstring)(*env)->CallObjectMethod(env, mode, getNameMethod);
|
mas01mj@698
|
29 const char* openMode = (*env)->GetStringUTFChars(env, value, 0);
|
mas01mj@698
|
30
|
mas01mj@698
|
31 return JNI_TRUE;
|
mas01mj@698
|
32 }
|
mas01mj@698
|
33
|
mas01mj@698
|
34 JNIEXPORT void JNICALL Java_AudioDB_insert(JNIEnv *env, jobject obj)
|
mas01mj@698
|
35 {
|
mas01mj@698
|
36 }
|
mas01mj@698
|
37
|
mas01mj@698
|
38 JNIEXPORT void JNICALL Java_AudioDB_query(JNIEnv *env, jobject obj)
|
mas01mj@698
|
39 {
|
mas01mj@698
|
40 }
|
mas01mj@698
|
41
|
mas01mj@698
|
42 JNIEXPORT void JNICALL Java_AudioDB_status(JNIEnv *env, jobject obj)
|
mas01mj@698
|
43 {
|
mas01mj@698
|
44 }
|
mas01mj@698
|
45
|