cocos2d/cocos2d-x

Replace fmod on Linux with SDL Audio or something similar

Opened this issue ยท 38 comments

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.

yes, other alternatives are:

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

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.

@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.

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.

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.

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

It also may create big problems with licensing target product.

v1993 commented

Is there any progress in this direction?

v1993 commented

Any progress?

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

Any document about it?

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

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.

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

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

Sounds good.

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

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.

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

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

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

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

Please read my comments about Android OpenAL and mpg123
#18961 (comment)
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 :) )

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

ildar commented

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

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!)

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

ildar commented

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.

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: #18000

ildar commented

I have build with cocos2d-x-3.17

@halx99 could you create PR for Linux only?

I will create when I have time

that will be better, if we do #16307 after this issue solved.

#18000, this is another reason why I recommand we also should use openal at android platform.