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

Change audio from OpenAL to AVAudioEngine for Apple #1491

Closed paulocoutinhox closed 11 months ago

paulocoutinhox commented 11 months ago

Is your feature request related to a problem? Please describe.

Hi,

Xcode is warning about OpenAL deprecation (macOS, iOS and tvOS).

Example:

/Users/paulo/Developer/workspaces/cpp/axmol/core/audio/AudioPlayer.cpp:78:9: warning: 'alDeleteBuffers' is deprecated: first deprecated in macOS 10.15 - OpenAL is deprecated in favor of AVAudioEngine [-Wdeprecated-declarations]
        alDeleteBuffers(QUEUEBUFFER_NUM, _bufferIds);
image

Describe the solution you'd like

OpenAL was deprecated. Make axmol compatible with AVAudioEngine.

https://developer.apple.com/documentation/ios-ipados-release-notes/ios-13-release-notes#Deprecations

Thanks.

halx99 commented 11 months ago

can switch to AX_USE_ALSOFT=ON

paulocoutinhox commented 11 months ago

I can use this inside my CMakeLists.txt using set(AX_USE_ALSOFT ON)? Or have another way to do this?

rh101 commented 11 months ago

set(AX_USE_ALSOFT ON CACHE BOOL "Use ALSOFT on apple" FORCE) should work. Just remember to clear the [build_folder]/CMakeCache.txt and re-run the cmake command after you do this (via axmol build ... etc.).

halx99 commented 11 months ago

see also readme