axmolengine / axmol

Axmol Engine – A Multi-platform Engine for Desktop, XBOX (UWP) and Mobile games. (A fork of Cocos2d-x-4.0)
https://axmol.dev
MIT License
922 stars 205 forks source link

Android: Axmol is failing to play m4a audio file format #1909

Closed asnagni closed 5 months ago

asnagni commented 5 months ago

Hello, On Android platform when we try to preload m4a audio files, the operation will fail. We are not sure if the m4a is not supported yet by Axmol. Maybe we need to setup a flag in the project CMake file? We are not sure at this point.

When the app is running, the files are located in a folder named "voiceMesages" in the app writable path.

  1. Create a simple Axmole project
  2. Add the files somewhere in your writable path
  3. preload the files
  4. Play the sound audioFiles.zip

Thank you for your help, Stay safe

rh101 commented 5 months ago

The engine supports OGG, MP3 and WAV formats.

asnagni commented 5 months ago

Any plan to support m4a file format? I think it's the default on Android. It was supported on Cocos2d-x maybe we can just port over what is there? What do you think?

rh101 commented 5 months ago

It was supported on Cocos2d-x maybe we can just port over what is there?

Are you certain that Cocos2d-x supported M4A files? Which version of Cocos2d-x?

If you can find the implementation, then consider porting it over to Axmol.

rh101 commented 5 months ago

Also, you don't need to use the built-in audio support if there are features you require that do not exist in the Axmol implementation. You could always use other audio libraries, such as FMOD, which other developers have linked to their Axmol apps successfully.

asnagni commented 5 months ago

Yes coco2d-x does supportm4a audio file format since a long time. I think from 3.6.x . Since we were on 3.17.2 before migrating I can ensure you that it does.

Ok that works with FMOD or we may just change the format. Thank you for the advice 👍, I do appreciate. But I still think it would be nice if we could port what exist already in cocos2d-x. That way we make sure to have more compare to cocos2d-x not less.

Thank you again, Stay safe.

rh101 commented 5 months ago

But I still think it would be nice if we could port what exist already in cocos2d-x.

If you can find the implementation, then point out where it is, because looking through the Cocos2d-x code I cannot see any references to M4A, and even in the Cocos2d-x v3 and v4 cpp-tests project I can only see tests for OGG, WAV and MP3.

Also, in the Cocos v4 documentation, there is no mention of M4A for Android or Windows: https://docs.cocos2d-x.org/cocos2d-x/v4/en/audio/getting_started.html

The safest compressed formats to use that are supported on all platforms in Axmol would probably be OGG or MP3.

asnagni commented 5 months ago

Strange, because we have it working. Let me check what was done and I will come back to you.

Thank you again

asnagni commented 5 months ago

Hi rh101, After investigating the legacy code, I can say that you are right. Ccos2d-x doesn't support that audio format. What was done it was to integrate and use ExoPlayer to support more audio format.

Thank you for your support, I do appreciate. Stay safe

asnagni commented 5 months ago

Not an issue