GLBasic forum

Main forum => GLBasic - en => Topic started by: Darmakwolf on 2015-Apr-10

Title: android extras
Post by: Darmakwolf on 2015-Apr-10
So what's the deal with the alternative sound API for androidextras? I've gotten it working, and it's great because it plays instantly, no horrible sound latency like with PLAYSOUND. But it only has four TOTAL SOUNDS... and you have to unload them and reload them to play another different sound. I tried making a system that unloads a sound and loads a new one every time it plays, but EVEN with unloading to free memory, it eventually crashes. Is there a way to load all my sounds at the beginning, and play them either by name or ID without having only 4?
Title: Re: android extras
Post by: Darmakwolf on 2015-Apr-10
NEVERMIND! haha. I made it load all WAVs at load, and an INSTANCE of TSound for each "sound." Dumping them all in Pool 0 somehow makes all sounds have infinity buffers and no extra ram/cpu usage, and sounds don't overlap each other. This is pretty great actually.
Title: Re: android extras
Post by: spacefractal on 2015-Apr-10
Yes Tsound is just a object, not a channel.

There is something like same style as LOADSOUND using with buffers.

Sometimes you might need to uses different buffer for some sound to make sure the same sound can been played top on each other (like a shoot command). This is property why FiveSprites added the buffers.

Also TMusic does NOT support Mods files. But TSound can also uses other formats than wav me thinks. But newer tested it really.
Title: Re: android extras
Post by: Darmakwolf on 2015-Apr-11
Yes Tsound is just a object, not a channel.

There is something like same style as LOADSOUND using with buffers.

Sometimes you might need to uses different buffer for some sound to make sure the same sound can been played top on each other (like a shoot command). This is property why FiveSprites added the buffers.

Also TMusic does NOT support Mods files. But TSound can also uses other formats than wav me thinks. But newer tested it really.

It's fine, you can use PLAYMUSIC on Android to play MODs, and then TSound for sound effects just fine.
Title: Re: android extras
Post by: fivesprites on 2015-Apr-14
Apologies for not being around to answer any questions or provide updates.  Life and work are very busy =/

Yes, I created TSound as the sound functionality in GLB was too limiting for my needs (I needed the ability to alter the pitch (rate) of a sound).  I also had problems with latency and where multiple sounds were being used at the same time - it was often the case that some of the sounds didn't play or were cut off short. 

TSound addressed both issues by using a different method of sound playback on Android.  It's not ideal and has the disadvantage that the samples needed to be short or of lower quality (they're all loaded in memory rather than streamed).  You also needed to spread the sounds out across the four available pools to avoid using up the space allocated by Android.

In all honesty, I'm surprised you got them all to work on pool 0, but I guess it depends how many you have, how big they are and if Android has made improvements in this area :)

TMusic was provided because I was totally fed up with the delay when asking GLB PLAYMUSIC to actually start playing a track.  It also took a variable amount of time for it to respond to requests to pause or stop.  TMusic again uses a different approach to PLAYMUSIC and provides greater control of music playback - without the delays.

//Andy


Title: Re: android extras
Post by: spacefractal on 2015-Apr-14
nice to hear back again and Android Extras have been expanded greatly :-).

Sound cutoff could actuelly been fixed by length of the sample after the end. Glbasic dosent like very short samples. Here just add silince to the sound. But yes im do uses tSound for all my games as well due stability is better using SoundPool.

Im could have added SoundPool integrated using glbasic official commands, but im do thinks its two different worlds here. So im dont donna do that now.

Same with TMusic, because its will lost the Mod/XM player. Im dont think the path issue was ever fixed in PLAYMUSIC, but adding full path do allways have do the job throught.

Just to mention, Android Extras uses API-19 today, and added various new features since that and have been much more stable now.

We dsoent uses the old Android 2.3 anymore and have moved on. The newest Android Extras might not even run on Android 2.3 anymore, which today using by few procent today (its like iOS4.x, which im also cant support anymore, due 64bit requirements).
Title: Re: android extras
Post by: fivesprites on 2015-Apr-14
nice to hear back again and Android Extras have been expanded greatly :-).

Sound cutoff could actuelly been fixed by length of the sample after the end. Glbasic dosent like very short samples. Here just add silince to the sound. But yes im do uses tSound for all my games as well due stability is better using SoundPool.

Im could have added SoundPool integrated using glbasic official commands, but im do thinks its two different worlds here. So im dont donna do that now.

Same with TMusic, because its will lost the Mod/XM player. Im dont think the path issue was ever fixed in PLAYMUSIC, but adding full path do allways have do the job throught.

Just to mention, Android Extras uses API-19 today, and added various new features since that and have been much more stable now.

We dsoent uses the old Android 2.3 anymore and have moved on. The newest Android Extras might not even run on Android 2.3 anymore, which today using by few procent today (its like iOS4.x, which im also cant support anymore, due 64bit requirements).

Yes - I should have said - thank you Spacefractal for taking the helm and improving Android Extras - you've done a great job :)

//Andy
Title: Re: android extras
Post by: spacefractal on 2015-Apr-14
he, thanks. Im even have fixed various issues after im got glbasic source code and have helped Gernot with that. Some basic fixes does no longer require Android Extras, but its does now run on Api-19 (Android 4.4) instead of Api-8 (Android 2.3) as original. Im do only can support devices running a least Api-14 (Android 4.0) today. Its do might run on older devices, but im cant garantee.

Its same as im can no longer support iOS 4 at all, due 64bit requirement. Here its will require iOS 5.1.1 today.
Title: Re: android extras
Post by: Kitty Hello on 2015-Apr-14
What about using the sound sytem directly in PLAYSOUND?

Gesendet von meinem GT-N7100 mit Tapatalk

Title: Re: android extras
Post by: spacefractal on 2015-Apr-14
Im can do that if you want, but later. Im do howover not want to do that for PLAYMUSIC, due missing the module player (other than im could check for music extension using).

TSound can been included in sdl_main.cpp (using the compiled source and clean it up) and then call it from there. Im do better focus on GameInput API yet currectly.

Most people hopeful using FUNCTION to load and play sounds, which im allways have do in all my games.

So property a API could also do the job really.