Android NDK ile Proje C ve Java Programlama Dili Metod Tanımlama Şekilleri

Java da com_example_nativeaudio package içindeki NativeAudio classı içindeki metod

public static native void shutdown();

/** Load jni .so on initialization */
static {
System.loadLibrary("native-audio-jni");
}
public static native void shutdown();

C’ deki karşılığı
void Java_com_example_nativeaudio_NativeAudio_shutdown(JNIEnv* env, jclass clazz)

public static native boolean createAudioRecorder();
jboolean Java_com_example_nativeaudio_NativeAudio_createAudioRecorder(JNIEnv* env, jclass clazz)
Yukarıdaki metod için C kodunda geri dönüş değeri return JNI_FALSE veya JNI_TRUE olmalıdır.

public static native void setPlayingUriAudioPlayer(boolean isPlaying);
void Java_com_example_nativeaudio_NativeAudio_setPlayingAssetAudioPlayer(JNIEnv* env,
jclass clazz, jboolean isPlaying)

public static native void setChannelMuteUriAudioPlayer(int chan, boolean mute);
void Java_com_example_nativeaudio_NativeAudio_setChannelMuteUriAudioPlayer(JNIEnv* env,
jclass clazz, jint chan, jboolean mute)

public static native boolean createAssetAudioPlayer(AssetManager assetManager, String filename);
jboolean Java_com_example_nativeaudio_NativeAudio_createAssetAudioPlayer(JNIEnv* env, jclass clazz,
jobject assetManager, jstring filename)

public static native boolean createUriAudioPlayer(String uri);
jboolean Java_com_example_nativeaudio_NativeAudio_createUriAudioPlayer(JNIEnv* env, jclass clazz,
jstring uri)

public static native boolean selectClip(int which, int count);
jboolean Java_com_example_nativeaudio_NativeAudio_selectClip(JNIEnv* env, jclass clazz, jint which,
jint count)

Bir cevap yazın