Author Topic: Android sounds not always playing  (Read 763 times)

Offline MrPlow

  • Prof. Inline
  • *****
  • Posts: 1715
    • View Profile
Android sounds not always playing
« 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
« Last Edit: 2019-Nov-13 by MrPlow »
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4310
    • View Profile
    • Portfolio
Re: Android sounds not always playing
« Reply #1 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.

Offline MrPlow

  • Prof. Inline
  • *****
  • Posts: 1715
    • View Profile
Re: Android sounds not always playing
« Reply #2 on: 2019-Nov-14 »
Yeah, I might change around the sounds and maybe increase sound length.
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3918
    • View Profile
    • Space Fractal
Re: Android sounds not always playing
« Reply #3 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.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation and The beagle Jam.

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4310
    • View Profile
    • Portfolio
Re: Android sounds not always playing
« Reply #4 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.

Offline MrPlow

  • Prof. Inline
  • *****
  • Posts: 1715
    • View Profile
Re: Android sounds not always playing
« Reply #5 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.

:)
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4310
    • View Profile
    • Portfolio
Re: Android sounds not always playing
« Reply #6 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! :)

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3918
    • View Profile
    • Space Fractal
Re: Android sounds not always playing
« Reply #7 on: 2019-Nov-14 »
adb.exe used when you launch your emulator and install on your phone. no idea how its works instance wice.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation and The beagle Jam.

Offline MrPlow

  • Prof. Inline
  • *****
  • Posts: 1715
    • View Profile
Re: Android sounds not always playing
« Reply #8 on: 2019-Nov-16 »
On monday - I will post how to add the ads - it's quite straightforward...

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! :)
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs