diff options
author | Eric Laurent <elaurent@google.com> | 2010-07-02 08:12:41 -0700 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2010-07-07 11:00:28 -0700 |
commit | df9b81ced437b11f8a3fcf4ba3ea6af703d121e2 (patch) | |
tree | c80b989df744ea74f62c800a8848813174792cc2 /media/jni/audioeffect/android_media_AudioEffect.cpp | |
parent | 31e0ffe8444b70500cac319da084c4c45e62aca2 (diff) | |
download | frameworks_base-df9b81ced437b11f8a3fcf4ba3ea6af703d121e2.zip frameworks_base-df9b81ced437b11f8a3fcf4ba3ea6af703d121e2.tar.gz frameworks_base-df9b81ced437b11f8a3fcf4ba3ea6af703d121e2.tar.bz2 |
Added Visualizer effect.
The visualizer enables application to retrieve part of the currently playing audio for visualization purpose.
It is not an audio recording interface and only returns partial and low quality audio content as a waveform or
a frequency representation (FFT).
Removed temporary hack made in MediaPlayer for animated wall papers based on audio visualization (snoop() method.
This commit also includes a change in AudioEffect class:
- the enable()/disable() methods have been replaced bya more standard setEnabled() method.
- some fixes in javadoc
Change-Id: Id092a1340e9e38dae68646ade7be054e3a36980e
Diffstat (limited to 'media/jni/audioeffect/android_media_AudioEffect.cpp')
-rw-r--r-- | media/jni/audioeffect/android_media_AudioEffect.cpp | 41 |
1 files changed, 14 insertions, 27 deletions
diff --git a/media/jni/audioeffect/android_media_AudioEffect.cpp b/media/jni/audioeffect/android_media_AudioEffect.cpp index 17f2d8f..02474a4 100644 --- a/media/jni/audioeffect/android_media_AudioEffect.cpp +++ b/media/jni/audioeffect/android_media_AudioEffect.cpp @@ -455,9 +455,8 @@ static void android_media_AudioEffect_native_release(JNIEnv *env, jobject thiz) env->SetIntField(thiz, fields.fidJniData, 0); } - static jint -android_media_AudioEffect_native_enable(JNIEnv *env, jobject thiz) +android_media_AudioEffect_native_setEnabled(JNIEnv *env, jobject thiz, jboolean enabled) { // retrieve the AudioEffect object AudioEffect* lpAudioEffect = (AudioEffect *)env->GetIntField( @@ -469,29 +468,11 @@ android_media_AudioEffect_native_enable(JNIEnv *env, jobject thiz) return AUDIOEFFECT_ERROR_NO_INIT; } - return translateError(lpAudioEffect->enable()); + return translateError(lpAudioEffect->setEnabled(enabled)); } - -static jint -android_media_AudioEffect_native_disable(JNIEnv *env, jobject thiz) -{ - // retrieve the AudioEffect object - AudioEffect* lpAudioEffect = (AudioEffect *)env->GetIntField( - thiz, fields.fidNativeAudioEffect); - - if (lpAudioEffect == NULL) { - jniThrowException(env, "java/lang/IllegalStateException", - "Unable to retrieve AudioEffect pointer for disable()"); - return AUDIOEFFECT_ERROR_NO_INIT; - } - - return translateError(lpAudioEffect->disable()); -} - - static jboolean -android_media_AudioEffect_native_getEnable(JNIEnv *env, jobject thiz) +android_media_AudioEffect_native_getEnabled(JNIEnv *env, jobject thiz) { // retrieve the AudioEffect object AudioEffect* lpAudioEffect = (AudioEffect *)env->GetIntField( @@ -503,7 +484,7 @@ android_media_AudioEffect_native_getEnable(JNIEnv *env, jobject thiz) return false; } - return (jboolean)lpAudioEffect->isEnabled(); + return (jboolean)lpAudioEffect->getEnabled(); } @@ -516,7 +497,7 @@ android_media_AudioEffect_native_hasControl(JNIEnv *env, jobject thiz) if (lpAudioEffect == NULL) { jniThrowException(env, "java/lang/IllegalStateException", - "Unable to retrieve AudioEffect pointer for getEnabled()"); + "Unable to retrieve AudioEffect pointer for hasControl()"); return false; } @@ -817,9 +798,8 @@ static JNINativeMethod gMethods[] = { (void *)android_media_AudioEffect_native_setup}, {"native_finalize", "()V", (void *)android_media_AudioEffect_native_finalize}, {"native_release", "()V", (void *)android_media_AudioEffect_native_release}, - {"native_enable", "()I", (void *)android_media_AudioEffect_native_enable}, - {"native_disable", "()I", (void *)android_media_AudioEffect_native_disable}, - {"native_getEnable", "()Z", (void *)android_media_AudioEffect_native_getEnable}, + {"native_setEnabled", "(Z)I", (void *)android_media_AudioEffect_native_setEnabled}, + {"native_getEnabled", "()Z", (void *)android_media_AudioEffect_native_getEnabled}, {"native_hasControl", "()Z", (void *)android_media_AudioEffect_native_hasControl}, {"native_setParameter", "(I[BI[B)I", (void *)android_media_AudioEffect_native_setParameter}, {"native_getParameter", "(I[B[I[B)I", (void *)android_media_AudioEffect_native_getParameter}, @@ -830,6 +810,8 @@ static JNINativeMethod gMethods[] = { // ---------------------------------------------------------------------------- +extern int register_android_media_visualizer(JNIEnv *env); + int register_android_media_AudioEffect(JNIEnv *env) { return AndroidRuntime::registerNativeMethods(env, kClassPathName, gMethods, NELEM(gMethods)); @@ -852,6 +834,11 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved) goto bail; } + if (register_android_media_visualizer(env) < 0) { + LOGE("ERROR: Visualizer native registration failed\n"); + goto bail; + } + /* success -- return valid version number */ result = JNI_VERSION_1_4; |