Today, let's learn aboutMusicAndSound EffectsWhy do you like watching silent movies? (Narrator: I like playing with my voice closed). Let's leave it alone. She's a madman.
Old Rules: Prepare resources:
A piece of
Well, by the way, let's take a look at the differences between music and sound effects:
Music is generally a song, used as the background
Cocos2d-x ios game development (9) sound effects, particle system and storage, cocos2d-xios
We know that a game is indispensable for sound, and some nice sounds will bring you up your interest in the game. Of course, sound is not what we want to learn, our goal is to put the sound
First, Brief introductionIn simple terms, audio can be divided into 2 types(1) Sound effectsAlso known as "short audio", usually plays in the program for 1-2 secondsEnhance the overall user experience with embellishment in the app(2) MusicFor example, the "background music" in the game, the general playing time is longerFrame: Play audio needs to use avfoundation.framework frameSecond, the
(SeekBar seekBar) {// method stub automatically generated by TODO }}Main. xml:
Play audio using SoundPool: In Android development, we often use MediaPlayer to play audio files. However, MediaPlayer has some shortcomings, such: high resource usage, long latency, and simultaneous playback of multiple audios are not supported. These disadvantages determine that MediaPlayer is not ideal in some scenarios, for
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
Chapter 2 music and sound effects
The advertisement says "there is no sound, no sound, no matter how good it is". Let's add the sound effect to the program.
In general, the game sounds are divided into two parts: music and sound.
Games that lack background music and sound effects are incomplete.
First, two variables are defined, one for playing background music and the other for playing sound effects.
Private music mmusic; private
Cocos2d-x with UserDefault data persistence instance: Save background music and sound settings,UserDefault can store data, but it cannot be used in a flood. In general, it will not be used to store a large amount of data, and it is not as flexible as SQL statements. In addition to saving game settings, UserDefault can also maintain the status of Game Genie and other objects for a long time.An example is pro
In the previous chapter, we made a lot of dynamic effects. As a game, apart from visual effects, we also needed music effects. This article will add some sound effects to the game. For example, music prompts will be sent when an item is found, and
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 pla
background music SimpleAudioEngine: sharedEngine ()-> rewindBackgroundMusic (); // call background music SimpleAudioEngine: sharedEngine ()-> isBackgroundMusicPlaying () // return a Boolean parameter indicating whether the background music SimpleAudioEngine: sharedEngine ()-> setBackgroundMusicVolume (0.5) is being played. // set the volume to 0.0-1.0
Sim
Cocos2d-x instance: Set background music and sound-AppDelegate implementation, appdelegateTo learn more about playing background music and sound effects, let's use an example. As shown in, there are two scenarios: HelloWorld and Setting. In the HelloWorld scenario, click the
1. Play Sound1.1 First get to audio file path1 nsstring *path = [[NSBundle mainbundle] Pathforresource:soundfilename Oftype:nil];1.2 Convert the sound file path to NsurlNsurl *url = [Nsurl Fileurlwithpath:path];1.3 Load the audio file and return to Systemsoundid (for playing this sound)systemsoundid soundid; // The following way is the C language framework, is the audio file processing after the return
Jquery helps you improve your website architecture. As part of the Javascript framework, jquery is constantly updated and has been updated to 1.8. You can see billboards on the street and pictures fade out. This can be done with jquery, you can see that some websites refresh the page each time, and the background image changes every time. This effect can also be achieved using it.ArticleIn, I will introduce you to 20 awesome jquery effect plug-ins. Yo
[IOS development-118] AVFoundation framework: AudioServices... sound effects, AVAudioPlayer music, AVAudioRecord recording,
(1) sound playback: the Core code mainly creates a player and then plays the video.
# Import "WPSound. h "# import
(2) music playback and core code. Note that the created player must be a global variable.
# Import "MusicTool. h "@ imple
Recently encountered a COCOS2DX bone animation registration event playback sound effects, when the bone animation playback, press the home button to return to the desktop, when the game is opened again, will be black screen.The solution is as follows, probably not too perfect, at least to solve most of the problems.1. Add the native method to the Cocos2dxrenderer.java under Org.cocos2dx.lib Public Static na
Share 70 + free jquery image slider effects plug-ins and tutorials, 70 jquery
The jQuery Slider plug-in is generally composed of a Slider and a sliding button. There are also some pause and continue buttons. Generally, Slider plug-in can be divided into two types according to the display mode: horizontal sliding and vertical sliding. Of course there are many specific special
App boot page (background image switching and page animation effects ),
Unconsciously, I worked overtime until and spent more than a day on the entire startup page. There were three pages in total, each with an animated effect, debugging of animation effects is troublesome. It must be consistent with ios and match different mobile phones. Then, the product manage
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.