Android版的Soundpool堆限制 [英] Android SoundPool heap limits

查看:411
本文介绍了Android版的Soundpool堆限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的Soundpool加载多个声音剪辑成并进行播放。

I am using a SoundPool to load several sound clips into and play them back.

这是正确地从我可以告诉工作100%。但.load()调用期间,我得到我的日志垃圾邮件与

It is functioning 100% correctly from what I can tell. But during the .load() calls I am getting my log spammed with:

06-09 11:30:26.110: ERROR/AudioCache(23363): Heap size overflow! req size: 1050624, max size: 1048576

我加载在11的声音文件,这些2很小〜3KB,其余均为10KB之间 - 15KB。 Windows正在报告

I am loading in 11 sound files, of those 2 are very small ~3kb and the rest are between 10kb - 15kb. Windows is reporting

大小:114KB

在磁盘上的大小:128KB

Size on disk: 128kb

是我推的是什么的Soundpool是能够保持限制?有一些设置,我应该改变,以避免这种溢出?我如何应设置我的音频控制任何指导将是非常美联社preciated。

Am I pushing the limits of what SoundPool is capable of holding? Is there some setting I should be altering to avoid this overflow? Any guidance on how I should be setting up my audio controls would be much appreciated.

推荐答案

的Soundpool是要DECOM preSS加载的音频PCM数据,因此它已准备好立即播放无需解码延迟。如果您正在加载的声音为com pressed严重,如MP3,那么可以得到炸毁了不少。尝试将编码音频作为单声道立体声是否没有必要(它通常不是短暂的声音效果)。

SoundPool is going to decompress the loaded audio to PCM data so it is ready to play instantly without the latency of decoding. If the audio you are loading is compressed heavily, such as MP3, then that can get blown up quite a bit. Try encoding the audio as mono if stereo isn't necessary (it usually isn't for short sound effects).

这篇关于Android版的Soundpool堆限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆