Android sound SoundPool: soundpool 1 not retry
SoundPool is used in development today. When soundpool 1 not retry cannot play the sound, MediaPlay can
After some research, we found that:
Unable to play the sound because of the soundpool 1 not retry error code
Mgr = (AudioM
SoundPool usage for Android Development
Play Sound Effects using SoundPool
MediaPlayer is not suitable for applications that often play intensive, fast, and short-lived audio effects (such as game sound effects. MediaPlayer has the following Disadvantages:
1) The latency is long and the resource usage is high.
2) Multiple audios cannot be played simultaneously.
In addition to playing audio using MediaPlaye
In game development, I learned from materials and books that two formats of playing audio can be used in our game development: MediaPlayer and SoundPool!
PS: Of course, there is another JetPlayer, but the format of the file to be played is quite troublesome, so I will not explain it here. If you are interested, you can study it on your own;
Run:
MediaPlayer and: SoundPool class! What are their advantage
Use of SoundPool in Android
We all know that MediaPlayer uses a lot of resources and cannot play multiple audios at the same time. Therefore, we have a SoundPool, such as our common key tone or mobile phone prompt sound, for example, we have a lot of sound effects in game development. Below we will introduce her usage:
The procedure is as follows:1. Create a SoundPool
When developing Android applications, we may often need to play multimedia audio files. Generally, the mediaplayer class is used. However, this class occupies a large amount of resources and may not be suitable for games and other applications, soundpool class in the SDK android. media. soundpool, as its name implies, is the meaning of the sound pool. It mainly plays a few short sound clips that can be load
When developing android software, you often need to play multimedia audio files. This type of operation is usually performed using the MediaPlayer class. However, the MediaPlayer class consumes a large amount of resources, which can reduce the performance of games and other applications. In Android, The SoundPool class is used to play the audio. The SoundPool class consumes less CPU resources and responds q
Android uses SoundPool to play sound effects, and androidsoundpool
In Android development, we often use MediaPlayer to play audio files. However, MediaPlayer has some shortcomings, such as high resource usage, long latency, and not support simultaneous playback of multiple audios. These disadvantages determine that MediaPlayer is not ideal in some scenarios, for example, in game development with relatively high time precision.
URL: http://www.cnblogs.
Soundpool (Android.media.SoundPool), as the name implies is the meaning of the sound pool, mainly used to play some short audio clips, support from the program's resources or file system loading. Compared with MediaPlayer, the Soundpool has the advantage of low CPU resource consumption and small reaction delay. In addition, Soundpool supports setting the sound qu
Use soundpool to place soundWhen developing Android software, we may often need to play multimedia audio files. Generally, the mediaplayer class is used, but this class occupies a large amount of resources,It may not be suitable for games and other applications. The soundpool class is described here. The soundpool class is in the SDK Android. Media.
[1] mediaplayer for normal audio playback
Mediaplayer plays normal audio files
Mediaplayer = new mediaplayer ();
Program example:
/**
[2] Using soundpool for short-term sound effects
In Android development, we often use mediaplayer to play audio files. However, mediaplayer has some shortcomings, such as high resource usage, long latency, and not support simultaneous playback of multiple audios. These disadvantages determine that mediaplayer
Disadvantages of MediaPlayer:
High resource occupation and long latency
Multiple sound effects cannot be played simultaneously.
SoundPoolIt is mainly used to play a few short audio clips, with low CPU resource usage and low response latency. It also supports setting parameters such as sound quality, volume, and playback ratio by color, do not use SoundPool to play songs or background music for games. Only short and intensive sounds are considered play
Implementation Technology: android. media. SoundPool (manages and plays audio resources of applications and loads them directly to the memory ).
I. Basic Knowledge:
1. Create a SoundPool:
Let's take a look at the definition of the SoundPool function, as follows:
[Java]
Public SoundPool (
Int maxStream, // maximum numbe
I only know that mediaplayer can be used to play music in Android.Soundpool can be used, and soundpool can be used to play a few short sounds with high response speed requirements,For example, in the game, the burst sound, and mediaplayer is suitable for playing long points.1. The soundpool uses an independent thread to load music files and does not block operations in the main UI thread. However, if the au
From: http://dev.10086.cn/cmdn/wiki/index.php? Doc-view-5522.html
There are two ways to play audio on the Android platform:
1. soundpool-suitable for scenarios with short promotion and high response speed (game sound effects or button sounds)
2. mediaplayer-suitable for long and time-demanding scenarios
Bytes -------------------------------------------------------------------------------------------
Soundpool
Soundpool of Android Buffet
Soundpool of Android Buffet
Soundpool Introduction
Main methods
How to use
Using the example
SoundPool介绍
Soundpool plays a short but high response speed and plays multiple sounds at the sam
Dense, short sounds are often required for applications because MediaPlayer has the following drawbacks:1. Resource consumption is high, the delay time is longer.2. Multiple sound effects are not supported at the same time.Soundpool uses the concept of a sound pool to manage multiple short sounds, such as the ability to start with 20 sound effects, and then play them in the program by the ID of the sound.Soundpool is mainly used to play a few short sound clips, compared to MediaPlayer, the advan
current music.Ii. AudioManager (music management class, which can obtain the current music size and maximum volume)1. Obtain the AudioManager instance[Java]AudioManager am = new AudioManager ();2. Common AudioManager Functions[Java]SetStreamVolume (IBD streamType, int index, int flags); // sets the volume. Parameter 1: music type (AudioManager. STREAM_MUSIC), parameter 2: volume size, parameter 3: set one or more flagsGetStreamVolume (int streamType); // gets the current volume. The parameter g
Previously only knew Android can use MediaPlayer to play music, originally only today discoveredcan use the Soundpool, with Soundpool can sow some short reaction speed requires high sound,such as the blasting sound in the game, and MediaPlayer suitable for playing long points.1. Soundpool Loading music files uses a separate thread that does not block the operatio
previously only knew Android can use MediaPlayer to play music, originally only today discoveredcan use the Soundpool, with Soundpool can sow some short reaction speed requires high sound,such as the blasting sound in the game, and MediaPlayer suitable for playing long points. 1. Soundpool Loading music files uses a separate thread that does not block the operati
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.