冰淇淋三明治上的 Android Visualizer(音频效果)运行时异常
在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这似乎是模拟器的问题。我已经在运行 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.
在某些 Android 设备上似乎存在问题。我在 Lenovo a369i SDK 版本 17 上遇到此崩溃 http://pastebin.com/7kqPbxkV。 `ve发现是检查设备上是否支持均衡器效果:
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: