![]() ![]() Should you need to hack it to add or access other methods on SoundPool, you won't have to write any native code or go compile a new. This ANA plugin is based on various Java helper classes in Unity mentioned earlier, which helps you do C# -> Java talk without actually using any Java. That means a plethora of functions that Native Audio cannot do like setting play rate. If you need SoundPool-based solution for Unity, a plugin Android Native Audio by CHRISTOPHER CREATES is the choice (now free!). With (Java) AudioTrack if you want to do the same you will have to command the push and pull of audio data manually to change sounds. It is ideal for example entering a level and you load all the possible sounds in that level to one pool. You can fine tune this by giving " priority" weight to each native source (stream) as well. If you wait a bit and play the 4th sound and some earlier sound ended, SoundPool knows which one to reuse. Those native source are sometimes referrred as "stream".įor example you play 3 different sounds quickly while having 2 sources, it will allocate you a new one. One from many native sources will be selected and maintained automatically, instantiated more if not enough. The definition of SoundPool is so that you don't have to worry about underlying "native source" but rather a pool of sounds you want to use. ![]() I have confirmed that SoundPool is slower than (Java) AudioTrack. Which you will get to know them next.Ī SoundPool is a collection of samples that can be loaded into memory from a resource inside the APK or from a file in… This open up a way to access MediaPlayer, SoundPool, and (Java) AudioTrack from Unity. They are not directly related to audio, but with these helper classes, you are able to use Java stuff from C# without writing a single Java code. AndroidJavaClass / AndroidJavaObject / AndroidJavaProxy / AndroidJNI / AndroidJNIHelper This is opposite of “Best Performance” with BIG buffer to ensure the audio does not drop out but the latency will go to hell with that setting. (It minimize the buffer size, but we don’t know how small it is or could it be smaller). Note : When I say “faster than Unity” from this point on, that is compared with Unity + the setting “Best Latency” (plays the fastest possible) in Audio Settings. We will start from learning why my plugin Native Audio choose OpenSL ES as the implementation in Android side. Ways of playing native audio in Android from Unity You will learn about "native source" later how to get the fast one and various experiments like, what happen if we request too many. They will sound at slightly different time depending on which one comes first, since native plugin doesn't wait for frame.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |