全球音频与Android 4.0.3+上的会话ID

时间:2012-10-15 02:37:02

标签: android audio

我在市场上有一款应用低音增强效果的全球音频组合应用。不幸的是,自4.0.3以来,音频会话0的使用已被弃用,我无法找到解决方法。有没有办法扫描音频会话ID?这是我的logcat:

10-16 20:58:01.569: E/AndroidRuntime(645): FATAL EXCEPTION: main
10-16 20:58:01.569: E/AndroidRuntime(645): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.rustlesoft.bassbooster/com.rustlesoft.bassbooster.BassBooster}: java.lang.IllegalArgumentException: Effect type: 0634f220-ddd4-11db-a0fc-0002a5d5c51b not supported.
10-16 20:58:01.569: E/AndroidRuntime(645):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1983)
10-16 20:58:01.569: E/AndroidRuntime(645):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
10-16 20:58:01.569: E/AndroidRuntime(645):  at android.app.ActivityThread.access$600(ActivityThread.java:130)
10-16 20:58:01.569: E/AndroidRuntime(645):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
10-16 20:58:01.569: E/AndroidRuntime(645):  at android.os.Handler.dispatchMessage(Handler.java:99)
10-16 20:58:01.569: E/AndroidRuntime(645):  at android.os.Looper.loop(Looper.java:137)
10-16 20:58:01.569: E/AndroidRuntime(645):  at android.app.ActivityThread.main(ActivityThread.java:4745)
10-16 20:58:01.569: E/AndroidRuntime(645):  at java.lang.reflect.Method.invokeNative(Native Method)
10-16 20:58:01.569: E/AndroidRuntime(645):  at java.lang.reflect.Method.invoke(Method.java:511)
10-16 20:58:01.569: E/AndroidRuntime(645):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
10-16 20:58:01.569: E/AndroidRuntime(645):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
10-16 20:58:01.569: E/AndroidRuntime(645):  at dalvik.system.NativeStart.main(Native Method)
10-16 20:58:01.569: E/AndroidRuntime(645): Caused by: java.lang.IllegalArgumentException: Effect type: 0634f220-ddd4-11db-a0fc-0002a5d5c51b not supported.
10-16 20:58:01.569: E/AndroidRuntime(645):  at android.media.audiofx.AudioEffect.<init>(AudioEffect.java:381)
10-16 20:58:01.569: E/AndroidRuntime(645):  at android.media.audiofx.BassBoost.<init>(BassBoost.java:101)
10-16 20:58:01.569: E/AndroidRuntime(645):  at com.rustlesoft.bassbooster.BassBooster.<init>(BassBooster.java:14)
10-16 20:58:01.569: E/AndroidRuntime(645):  at java.lang.Class.newInstanceImpl(Native Method)
10-16 20:58:01.569: E/AndroidRuntime(645):  at java.lang.Class.newInstance(Class.java:1319)
10-16 20:58:01.569: E/AndroidRuntime(645):  at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
10-16 20:58:01.569: E/AndroidRuntime(645):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)
10-16 20:58:01.569: E/AndroidRuntime(645):  ... 11 more

2 个答案:

答案 0 :(得分:1)

它可能已被弃用,但是对全局输出组合(会话0)应用效果应该仍然可以在ICS和JB中使用,只要您获得MODIFY_AUDIO_SETTINGS权限并且您没有&#39 ; t也对0以外的会话应用任何效果。

答案 1 :(得分:0)

这可能会抓住一根稻草但看着你的堆栈跟踪,但我怀疑你试图应用的音频效果可能根本不受支持。

您可以尝试调用queryEffects()并遍历Descriptor个对象,检查您是否首先支持您尝试应用的音频效果类型