sasikalar / gamekit

Automatically exported from code.google.com/p/gamekit
0 stars 0 forks source link

Android-Updates + (experimental) OpenAL #218

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Android-Updates and (experimental) OpenAL - support for Android.

Android-Updates:
In Android's Main.java I added a method (CopyAssets(target-dir)) that let you 
copy all files from the included asset-folder to the sd-card (from which 
gamekit can load-blend-files)

calling it like in Main.java e.g. CopyAssets("gamekit"); would copy all files 
from the assets-folder to /sdcard/gamekit

CAUTION: It doesn't overwrite-files!! If you want this behaviour comment the 
loop-continue-call in CopyAssets-Method: 

  if (f.exists()){
      Log.i("gamekit", "fileexists!");
//    continue;
  }

CAUTION:
I changed the standard-directory to "/sdcard/gamekit" so make sure to place 
momo_ogre_i.blend in there. (we should change this name :D)

OpenAL:
I used this link as start-point:
http://pielot.org/2010/12/14/openal-on-android/

(Actually I started with the current version for the git-repo he used, but 
didn't successed:
http://repo.or.cz/w/openal-soft/android.git )

How to include:
- use the normal build-script with the new parameter 'openal':
e.g.: 
./configure-android ../_build_android openal
cd ../_build_android
make
cp Dependencies/Source/OpenAL/openal/libOpenAL.so 
GAMEKIT_SRC_ROOT/Samples/AndroidDemo/Demo/libs/armeabi
edit "Main.java" and uncomment at the end of the file: 
System.loadLibrary("OpenAL")
(typical error if you forget this is an UnsatisfiedLinkError)

How the openal-driver works:
- since android has including version 2.2 no native music-support the 
openal-android-driver connects to the corresponding
java-object that is able to play soundstreams. This is fed with all the data by 
openal. This thread have to be suspended
when the application is suspended and restarted once the application got focus 
again.

Known Issues:
- noticable Latency until sound/music starts.
- If you leave the application by home-key the openal-thread keeps running 
which means phone-power is zero quite soon
- if targeting android 2.3+ we should add opensl-support (I found a driver in 
the above mentioned git-repo)

As I said, it is still very experimental....and may crash from time to time...

Original issue reported on code.google.com by thomas.t...@googlemail.com on 28 Feb 2012 at 7:20

Attachments:

GoogleCodeExporter commented 9 years ago
Here a (untested) version of configure-android.bat and I changed the 
android-manifest so you can transfer the application to the sd-card.

Original comment by thomas.t...@googlemail.com on 28 Feb 2012 at 10:32

Attachments:

GoogleCodeExporter commented 9 years ago
Actually I'm not sure anymore if it is a good idea to include openal 
(lgpl)-sources. Eventhough it is one strength of ogrekit that all 
dependency-sources are available I think we might consider to compile against 
the headers and maybe provide the shared-lib as additional download for all 
cpus.

Any opinions about that?

Original comment by thomas.t...@googlemail.com on 29 Feb 2012 at 3:14

GoogleCodeExporter commented 9 years ago
So what another option we have friend? for the moment Gamekit lacks OpenSL ES 
bidings so we have only OpenAL and FMOD is a total big no as imho is the least 
indie pro library around 

Original comment by piratele...@gmail.com on 29 Feb 2012 at 9:14

GoogleCodeExporter commented 9 years ago
Nono, openal is the way to go! I was just talking about if we should include 
the openal-sourcecode to the Dependencies, or not. I'm not sure if there is any 
consequences including lgpl-sources to a project. Somewhere in the wiki I read 
that lgpl is a nogo. 

Original comment by thomas.t...@googlemail.com on 29 Feb 2012 at 11:46

GoogleCodeExporter commented 9 years ago
ok friend but then in order to prevent license problems we should go for OpenSL 
ES then

Original comment by piratele...@gmail.com on 1 Mar 2012 at 12:41

GoogleCodeExporter commented 9 years ago
Indeed, no (l)gpl in the source tree. It is amazing that Android still has no 
sound library as part of the sdk.

Original comment by erwin.coumans on 3 Mar 2012 at 5:47

GoogleCodeExporter commented 9 years ago
Well, actually it has. Since 2.3 there is OpenSL which seems to be something 
comparable to OpenAL. I took OpenAL cause it is already integrated in gamekit 
and I found that working Android-Implementation. It works on 2.2-Devices that 
still have about 50% of the market (and more important my HTC Desire is 2.2 as 
well :D ) as well as there is an OpenAL->OpenSL-Wrapper (in another branch)

But the lgpl might be really a problem. Not only in case of including OpenAL to 
the sourcecode (which isn't really necessary). Since lpgpl says you must be 
able to switch the library to an other version, you must provide a way to do 
this. It is obvious on the desktop where the files are visible or part of the 
system. But for an APK-Android-File?
It seems to be possible that you can use a tool for unpacking the apk, replace 
the .so and repack again. (Didn't test it yet but read about this in a forum). 
Don't really know if you would be "forced" to officially provide this way if 
you want to publish a game....actually who else beside hackers or me as the 
developer would like to switch a shared library? :D 

Nevertheless,for now I will go on with working on the OpenAL 
integration...Other problems will be solved when they occur :D

Original comment by thomas.t...@googlemail.com on 3 Mar 2012 at 1:15

GoogleCodeExporter commented 9 years ago
Let's wait until someone will integrate OpenSL into gamekit then, and close the 
issue for now.

Original comment by erwin.coumans on 3 Mar 2012 at 8:33