cocos2d / cocos2d-x

Cocos2d-x is a suite of open-source, cross-platform, game-development tools utilized by millions of developers across the globe. Its core has evolved to serve as the foundation for Cocos Creator 1.x & 2.x.
https://www.cocos.com/en/cocos2d-x
18.22k stars 7.05k forks source link

Replace fmod on Linux with SDL Audio or something similar #16355

Open slackmoehrle opened 8 years ago

slackmoehrle commented 8 years ago

Users have stated that we are not truly open-source on Linux because we require fmod. This isn't free and they have no other options. During our weekly meeting @ricardoquesada suggested that we could offer SDL Audio as an alternative and let users turn on fmod if they choose to. @linshun agreed. The timing of this change is TBD.

@slackmoehrle is happy to test when ready.

ricardoquesada commented 8 years ago

yes, other alternatives are:

minggo commented 8 years ago

Can refer to #16410. The PR use OpenAL for linux.

JOOpdenhoevel commented 8 years ago

I don't really know how powerful/fast/etc. those alternatives are, but from my point of view, OpenAL has a big advantage: It's a cross-platform library. The implementation for Windows only uses OpenAL, MPEG, and Vorbis, which are available for Windows as well as for Linux. Due to this fact, I could simply copy the source files and it worked. All tests were positive, the C++ test and the Lua test. Another option would be to merge those implementations into one which would make maintaining the engine way easier. I could do that for Linux and Windows if you like this idea.

minggo commented 8 years ago

@Janonard you are right. @dumganhar i think you can take a look too. I think it is better that we can use OpenAL as possible, then it is easy to main the codes.

minggo commented 8 years ago

Another option would be to merge those implementations into one which would make maintaining the engine way easier. I could do that for Linux and Windows if you like this idea.

Yep, it is better.

dumganhar commented 8 years ago

Agree this.

We only need OpenSLES for Android & OpenAL for other platforms. Easily maintaining our engine is really important.

BTW, we also need to improve New Audio Engine since I think the logic isn't very clear for developer to understand, we need to do more encapsulation, abstraction and documentation.

chuckhacker commented 7 years ago

OpenAL-soft has a OpenSLES driver built-in:

https://github.com/kcat/openal-soft/blob/2f1f7f4c6aaf54f9361865d508d82cdf027368bf/Alc/backends/opensl.c

cirosantilli commented 7 years ago

In particular, this blocks a Debian package from being created.

And creates problems that we can't solve properly because no source, e.g.:

v1993 commented 7 years ago

It also may create big problems with licensing target product.

v1993 commented 6 years ago

Is there any progress in this direction?

v1993 commented 6 years ago

Any progress?

halx99 commented 6 years ago

@dumganhar Actual, OpenAL also can be use at android platform, recently, I have done it, and seems ok.

minggo commented 6 years ago

Any document about it?

halx99 commented 6 years ago

Just compile openal, mpg123, ogg for android arm, then copy win32 implementation to android, and do some changes for log & file stream adapt.

minggo commented 6 years ago

I think OpenAL uses some system functions provided by Android, and i don't know if it has issue on some devices or some Android versions. It is not provided by Android, and also not Android documentation mention it, so it has big risk.

halx99 commented 6 years ago

you can see it's backends has a opensl.c for android.

halx99 commented 6 years ago

So, at android platform, OpenAL based on OpenSL. use it, we only needs maintains one audio engine framework.

minggo commented 6 years ago

Sounds good.

halx99 commented 6 years ago

@minggo @dumganhar Recently, I finish this, you can see the patch: https://github.com/halx99/x-studio365/tree/master/cocos2d-x-patch

minggo commented 6 years ago

@halx99 It is great. @drelaptop please take a look. It is good if we can use OpenAL for all platforms.

drelaptop commented 6 years ago

OK, this week I will try to test and confirm OpenAL works or not on android platform. If works well, I can do replace recently.

halx99 commented 6 years ago

@drelaptop By the way, I have test with ndkr14b + gcc, it work fine. maybe you need test ndkr16 + clang.

halx99 commented 6 years ago

@drelaptop I create 2 pr, you can simple to apply it to test it. https://github.com/cocos2d/cocos2d-x/pull/18958 https://github.com/cocos2d/cocos2d-x-3rd-party-libs-bin/pull/317

I have test on ndk-r17 + clang, it also work fine.

drelaptop commented 6 years ago

you are so efficient, I will check it at once.

crazyhappygame commented 6 years ago

Please read my comments about Android OpenAL and mpg123 https://github.com/cocos2d/cocos2d-x/pull/18961#issuecomment-407562295 I think that we should not add new LGPL *.so libraries to Android!

I am fine with OpenAL and mpg123 for Linux (it is better than fmod :) )

drelaptop commented 6 years ago

@slackmoehrle could you help us check the License issue in your free time?

ildar commented 6 years ago

@halx99 , can I ask if it's any progress with Linux migration? BTW, @crazyhappygame , as windows part already uses OpenAL isn't it straightforward?

crazyhappygame commented 6 years ago

I am fine with OpenAL and mpg123 for Linux (it is better than fmod :) )

(nothing changed for Android I think that we should not add new LGPL *.so libraries to Android!)

halx99 commented 6 years ago

I have test on ubuntu 18.04, the OpenAL works fine.

ildar commented 6 years ago

Could you please clarify how to build with OpenAL for Linux target?

halx99 commented 6 years ago

Actually, LGPL.*.so allow free to use, and the apple os platform intrgrate OpenAL ad system framework, so, I think all platform, OpenAL is a good choice for audio framework backend.

halx99 commented 6 years ago

And, in our project practice, OpenAL works well at android platform, and solve a deadlock bug on some android device when quickly stop/play music, see: https://github.com/cocos2d/cocos2d-x/issues/18000

ildar commented 6 years ago

Could you please clarify how to build with OpenAL for Linux target?

@HALX99 , do you build Cocos2d unpatched or with your patch? if the latter then where's the latest patch located?

halx99 commented 6 years ago

I have build with cocos2d-x-3.17

crazyhappygame commented 6 years ago

@halx99 could you create PR for Linux only?

halx99 commented 5 years ago

I will create when I have time

drelaptop commented 5 years ago

that will be better, if we do https://github.com/cocos2d/cocos2d-x/issues/16307 after this issue solved.

halx99 commented 5 years ago

https://github.com/cocos2d/cocos2d-x/issues/18000, this is another reason why I recommand we also should use openal at android platform.