冰淇淋三明治上的 Android Visualizer(音频效果)运行时异常

发布于 2024-12-19 00:52:29 字数 1089 浏览 1 评论 0原文

在 SDK 提供的示例 AudioFxDemo.java 中,

java.lang.RuntimeException: Cannot initialize Visualizer engine, error: -4

当我尝试创建 android.media.audiofx.Visualizer

mVisualizer = new Visualizer(mMediaPlayer.getAudioSessionId());

(AudioFxDemo.java:173) 时,我得到了一个错误。

据我所知,错误源于 native代码,(第266行ff。)尝试创建android.media.audiofx.Equalizer时也会发生错误:

mEqualizer = new Equalizer(0, mMediaPlayer.getAudioSessionId());

(AudioFxDemo.java:98)

我得到一个

java.lang.IllegalArgumentException: Effect type: 0bed4300-ddd6-11db-8f34-0002a5d5c51b not supported.

我已经为我的项目声明了以下权限:

<uses-permission android:name="android.permission.RECORD_AUDIO"
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>

你知道这里可能出了什么问题吗?

看来是API级别的问题。我对 Gingerbread(API 级别 10)没有任何问题。我只在虚拟设备上进行过测试。

In the sample AudioFxDemo.java, provided with the SDK, I get a

java.lang.RuntimeException: Cannot initialize Visualizer engine, error: -4

when trying to create the android.media.audiofx.Visualizer

mVisualizer = new Visualizer(mMediaPlayer.getAudioSessionId());

(AudioFxDemo.java:173).

As far as I can see, the error originates in the native code, (lines 266 ff.) An error also happens when trying to create the android.media.audiofx.Equalizer:

mEqualizer = new Equalizer(0, mMediaPlayer.getAudioSessionId());

(AudioFxDemo.java:98)

I get a

java.lang.IllegalArgumentException: Effect type: 0bed4300-ddd6-11db-8f34-0002a5d5c51b not supported.

I have declared the following permissions for my project:

<uses-permission android:name="android.permission.RECORD_AUDIO"
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>

Any ideas what might be going wrong here?

It seems to be a problem with the API level. I have no problems on Gingerbread (API Level 10). I have only tested on virtual devices.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

恍梦境° 2024-12-26 00:52:29

这似乎是模拟器的问题。我已经在运行 Android 4.0.3 的实际设备上进行了测试,效果很好。

This seems to be an issue with the Emulator. I have tested on an actual device running Android 4.0.3 and it worked just fine.

梦回旧景 2024-12-26 00:52:29

在某些 Android 设备上似乎存在问题。我在 Lenovo a369i SDK 版本 17 上遇到此崩溃 http://pastebin.com/7kqPbxkV。 `ve发现是检查设备上是否支持均衡器效果:

boolean supports_equalizer=false;
AudioEffect.Descriptor [] effects = Equalizer.queryEffects();
for (AudioEffect.Descriptor lDescriptor:effects){
   if (Build.VERSION.SDK_INT>=18) { //Equalizer present only starting with API 18. Cam try to hardcode its UUID
     if (AudioEffect.EFFECT_TYPE_EQUALIZER.equals(lDescriptor.uuid)){
        supports_equalizer=true;
     }
   }
}

it seems issue on some android devices. I got this crash http://pastebin.com/7kqPbxkV on Lenovo a369i SDK version 17. For now only thing i`ve found is to check if equalizer effect is supported on device:

boolean supports_equalizer=false;
AudioEffect.Descriptor [] effects = Equalizer.queryEffects();
for (AudioEffect.Descriptor lDescriptor:effects){
   if (Build.VERSION.SDK_INT>=18) { //Equalizer present only starting with API 18. Cam try to hardcode its UUID
     if (AudioEffect.EFFECT_TYPE_EQUALIZER.equals(lDescriptor.uuid)){
        supports_equalizer=true;
     }
   }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文