UlrikHrldssn / gamekit

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

Integration of MIT License Audio Library #285

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Branch name:
Gamekit revision r1213
Windows 8 with Visual Studio 2012

Feature description:
I am working on integrating a MIT license audio library into Gamekit. So the 
android build will be able to build along with audio support directly instead 
of linking with OpenAL library.

The particular MIT license audio library is aumiks
https://code.google.com/p/aumiks/

According to the website it supports:
Linux (via pulseaudio)
Windows (via DirectSound)
Android (via OpenSL)

It is required for threading and file management for aumiks

(It also includes a socket library)

It has a dependency on another MIT license library ting
http://code.google.com/p/ting/

Thanks for the author, igagis@gmail.com, of both libraries for the great work.

Since the two library is relative small so I just include both of them in the 
dependencies. Copmpile aumiks will force CMAKE to compile ting.

What works:
Build and work on Windows
Compile success for Android (but not test whether it can play correctly yet)

Right now the patch will only add both ting and aumiks build option and build 
them.  However, I did force android build to build both of them. And they seem 
to build.

I made a simple demo for Windows that will test to play a single .wav file. The 
CMake inside the folder is just the modified version of the CMAKE in sample 
folder to include to build AumiksDemo.

What not done:
Any other platform not tested

They are not part of gamekit engine yet. 

Since they are not part of gamekit yet, I still need to figure out how to test 
whether they work with gamekit on Android platform. I only know they build 
successfully, but whether they work or not is still questionable.

I am thinking that I should not change current OpenAL setting since it works 
for IPhone and other platforms. So maybe I should add another gkAumiksSound?

I just want to share the integration code and get some feedback about it. I am 
also kind of stuck on how to integrate them into gamekit library.

The aumiks-0.2.0.zip and ting-1.0.0.zip are the original codes that I 
downloaded from above google code website.

Hope it is useful for someone.

Sincerely,
Danil

Original issue reported on code.google.com by KAI.TING...@gmail.com on 18 Nov 2012 at 9:42

Attachments:

GoogleCodeExporter commented 8 years ago
For get to mention that the sample.wav file that I used is from here:
http://freewavesamples.com/korg-ds8-rotary-organ-c6

I do not own the sample and please do not distribute it any form that violates 
the license.

Hope it helps.

Sincerely,
Danil

Original comment by KAI.TING...@gmail.com on 19 Nov 2012 at 1:46

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
@Silverk...@gmail.com

The ting library is also included as part of the patch. Since aumiks depends on 
it.

(Do not know why the comment disappears, but it shows up in my email account, 
so I just end up replies it).

Hope it is helpful.

Sincerely,
Danil

Original comment by KAI.TING...@gmail.com on 20 Nov 2012 at 6:52

GoogleCodeExporter commented 8 years ago
First of all thx for putting energy into gamekit-development. I really 
appreciate that.
Looking at your sample it seems that
aumiks::WavSound is more less equal to gkSound
and
Channel is more or less equal to gkSource

Since those gk-classes have openal-code inside you will have to get rid of this 
somehow. E.g. using #ifdef-s inside or create new classes with the same header 
that will be included if cmake says "build android". 
Actually you will need to check gkSoundManager and for sure other classes as 
well. 
Additionally you will have to find a way to bypass the sound-data from 
blend-files to this as well. Sounds not that hard, but won't be that trivial 
either...

Actually I would prefer using opensl directly the way we use openal already, 
but if you want to give it a try with this lib it would be ok as well. At least 
for playing wav-files.

Original comment by thomas.t...@googlemail.com on 21 Nov 2012 at 3:35

GoogleCodeExporter commented 8 years ago
To dertom,

You are right. I am still looking through the code but I find that I will need 
to support some features of OpenAL that aumiks does not seem to provide. 
Android might have different sound behaviors than other platform if I did this 
way. I originally thought that it was a good idea to use another MIT library so 
people do not need to link external binary when compiling Android, but it was 
asking to bring more trouble.

I will to try to use opensl directly and try to find a solution that does not 
require extra library linking.

Thanks for the comment and feedback. Maybe I should post in forum instead of at 
here since it is still not a working proposal yet? So sorry if I post it at the 
wrong place.

Sincerely,
Danil

Original comment by KAI.TING...@gmail.com on 21 Nov 2012 at 4:53

GoogleCodeExporter commented 8 years ago
Well actually there is nothing against an extra library. If it does a good job 
and makes it simpler to develop... I also took a look into that topic yesterday 
and even though opensl1.0.1 as it is used in android can provide 3d-audio it is 
not supported on every device. (At least not on my htc desire, which actually 
was shipped with android-8. So that might be the reason.) Actually after much 
thinking and headache I came to the conclusion that 3d sound isn't important on 
a mobile device at all and that you might simulate this with volume to distance 
(plus if stereo is supported using left and right channels) so opensl should be 
fine.
Actually I also started to prepare on doing this, but it is like the networking 
stuff. I want to and shouldn't be a problem. But it takes some time that I 
don't necessarly have a the moment...

Original comment by thomas.t...@googlemail.com on 22 Nov 2012 at 11:30

GoogleCodeExporter commented 8 years ago
To dertom,

Yes, I agree that the whole point is to make things simpler to develop with. 
Maybe I should just devote time into make a toolchain that links against openal 
library? OpenSL ES does not seem to work on devices that were shipped with 
android - 8 or lower (even if they can be upgraded to android - 9). So it will 
be compatible with more devices?

By the way, is it okay to include the .so precompiled openal binary with the 
gamekit or it still violates MIT license? So I thought maybe we can include the 
binary so people do not need to download the binary for compiling.

Original comment by KAI.TING...@gmail.com on 22 Nov 2012 at 8:36

GoogleCodeExporter commented 8 years ago
To be honest, it is not that hard to change the cmake-files to link against 
openal-soft .so. I did it long time ago already, but struggled with that 
licensing issue that  I take very serious. We can of course setup gamekit with 
the option to select the shared-lib in cmake. But the compilation have to be 
done on your own, so no shared-lib inside the repository. Maybe we can provide 
a version a download (will ask erwin about that)

If you struggle in using the official openal-soft version try to use 
http://github.com/AerialX/openal-soft-android
That worked for me out of the box just by using its headers and its shared lib 
and of course a bit cmake-terror :D

About opensl,... opensl works on my desire (only 3d-sound seems not to work). 
And usually devices that were shipped <=android 8/9 are most of the times not 
even half way capable to run gamekit at proper speed

 I will try to do the port to opensl as a side-project and already ripped openal-specific gkSound...-classes apart so I can start adding an opensl-version of the gkSoundManager. Nevertheless don't rely on me finishing this too quick,...

On question don't hesitate to ask.

Keep on rocking

Original comment by thomas.t...@googlemail.com on 22 Nov 2012 at 9:00

GoogleCodeExporter commented 8 years ago
Just remembered that there is still something not so trivial. That is the 
android-lifecycle. Adding openal-support isn't that hard but you will have to 
stop playing when leaving the app via home-button. That was kind of ugly cause 
you will have to touch the gkStreamer which is running in a thread of its own. 
Maybe there are other possibilities...not 100% sure about this.

Original comment by thomas.t...@googlemail.com on 22 Nov 2012 at 9:28