GLBasic forum

Main forum => GLBasic - en => Topic started by: MrPlow on 2019-Nov-13

Title: Android sounds not always playing
Post by: MrPlow on 2019-Nov-13
Hi

I am using stopsound to help create a audio effect in my app but notice this affects other channels as well as my intended sound.
Any idea of how to improve or guarantee a sound playing?
BTW - only happening so far with the mobile version
Title: Re: Android sounds not always playing
Post by: erico on 2019-Nov-13
I experienced some trouble with android sounds too in the past.
Mostly, sounds that were short in length (like half a second and less) and got played and stopped very fast didn´t work out, It ended up not playing some of the samples (imagine a machine gun sound). That didn´t happen on pc of course.

Can you be more specific? If you have code and needs testing I can give a hand.

In my case, I ended up changing those sounds until I got into a "working" condition.
Title: Re: Android sounds not always playing
Post by: MrPlow on 2019-Nov-14
Yeah, I might change around the sounds and maybe increase sound length.
Title: Re: Android sounds not always playing
Post by: spacefractal on 2019-Nov-14
im experirede that very early as well in Greedy Mouse. So......

what im did as im remember was just make sure samples is about 2 secs in length. if they are shorter, just add empty bit too it. Im are not sure how short they can been unclipped.

Soundpool from AndroidExtras does not have this issue.
Title: Re: Android sounds not always playing
Post by: erico on 2019-Nov-14
Exactly, increase sound length with silence and add the 4 buffers so they can play together overlapping from a single playsound call.
Gotta be aware not to go over the buffer limits per sample or you can design a sound system with multiple playsound calls.
Title: Re: Android sounds not always playing
Post by: MrPlow on 2019-Nov-14
Anyone notice multiple (over 20) instances of adb.exe with their Android Studio setup?!

Erico, I think your Burger time (modified for mobile or used as a remake for original game) would do well on Playstore and you could put an Interstitial ad into it easily.

:)
Title: Re: Android sounds not always playing
Post by: erico on 2019-Nov-14
I have the burger and the avocado game ready for android, as far as coding, controls and screen goes. I have no idea on how to add the ads.
I still have to save for the android license but I struggle between making another PC game against taking time to finish the android port.
Most probably before march I can come up with something, then I will come around pestering you guys for advises! :)
Title: Re: Android sounds not always playing
Post by: spacefractal on 2019-Nov-14
adb.exe used when you launch your emulator and install on your phone. no idea how its works instance wice.
Title: Re: Android sounds not always playing
Post by: MrPlow on 2019-Nov-16
On monday - I will post how to add the ads - it's quite straightforward...

Quote from: erico on 2019-Nov-14
I have the burger and the avocado game ready for android, as far as coding, controls and screen goes. I have no idea on how to add the ads.
I still have to save for the android license but I struggle between making another PC game against taking time to finish the android port.
Most probably before march I can come up with something, then I will come around pestering you guys for advises! :)