Some Amazing problems that soundpool may encounter in practical applications

Source: Internet
Author: User
Some Amazing problems that soundpool may encounter in practical applications:

1. audioflingercocould not Create track, status:-12

 The maxstream parameter created by soundpool indicates the maximum number of sound effects that can be played simultaneously. Do not use it properly. If it is too large, audioflingercocould notCreate track, status:-12 .... Once this error is reported, you cannot hear the sound.

  2. 256 audio effects     When the load method is called, the sound effect is actually loaded into the soundpool, and the returned streamid is actually the ID of the sound effect in the soundpool. This ID is from 0 or 1 (a bit hard to remember) incremental, but note that the value must not exceed 256 This critical point. That is to say, after loading 257th voices, the call to the play method cannot be played, and some previously loaded sounds may be squeezed out. This 256 restriction can be easily understood by viewing the SDK source code. It is implemented at the underlying layer and stored in a stack similar to that of the SDK.   3. Unload and release methods     If you have many sound effects, do not expect the unload method to clear some sound effects and load the new ones. Although the sound effects are uninstalled after unload, however, the ID assigned to it in the soundpool can not be released. That is to say, when you load the new ID, it will only accumulate at the end, and when it increases, it will exceed 256, then you won't be able to hear the sound, and then you won't be able to hear it. To completely clear the preceding sound effects, use the release method, which will be released together with the resources occupied in the memory.  
In other cases, load takes a little time. Do not immediately unload after load. Load --- play -- unload is not advisable. Do not load too large sound effects. It only applies for 1 MB of memory space. After an error occurs in soundpool, The retuen value is usually 0.

Some Amazing problems that soundpool may encounter in practical applications

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.