barikang / SoundPoolCompat

Android SoundPoolCompat Library using OpenSLES
MIT License
3 stars 0 forks source link

sound volume when start playing #1

Open bobrokrol opened 8 years ago

bobrokrol commented 8 years ago

Hi, there is wierd behavior of SL ES version on my phone. When I play sound it looks like tween volume, it happens when delay between played sounds > 2 seconds. It's very noticable as sounds short and I miss start of the sound. Is it possible to fix somehow or it's behavior of OpenSL ES or it's reproduced only on my environment? I just play preloaded .ogg sounds, if delay between playing less than few seconds everything is ok but if more it's not play sound as it is but tween volume from 0. Thanks

barikang commented 8 years ago

Hi, I have no idea what happen to you exactly. I made this for avoiding soundpool bug in some devices such as Nexus 5X. Nexus 5X has very slow bug for decoding several sounds at the same time. Anyway, try these.

  1. Play sound after "OnLoadCompleteListener"
  2. Set 'tryPreDecode' to false.
  3. Increase Max Stream Count.

Thanks.

bobrokrol commented 8 years ago

Thanks. Looks like it some problem with my device. I have HTC One and it have Beats Audio plugin. This bug reproduced only if plugin turned off. I thought you add some kind of logic to play sounds dealyed or tween volume on start if not than it's some bug with SL ES compatability not with library itself. I didn't check C++ code I just compiled it to use as Adobe Native Extention for Air application. In general this lib works great and faster than Soundpool and it also solves Android 5.0... bugs with SoundPool.load

As for suggestions: Play sound after "OnLoadCompleteListener" I load all sounds on level start and check this handler. It does not relate to this Set 'tryPreDecode' to false. Didn't check as I need best performance Increase Max Stream Count. this bug happence only when I play one sond and no other sounds is playing. For eaxmple I start playing sond1 and before it's finished I starting playing sound2 - than sound2 playing without any problems. But if I wait till sound1 finished and than start sound2 I'll hear that sound2 is playing not from start snd it's sound like volume increasing from 0 first 100-200ms