From 936c3b3f79ec1b1b301785312f20a57a1e62271b Mon Sep 17 00:00:00 2001 From: Dhilan007 Date: Mon, 22 Sep 2014 15:38:12 +0800 Subject: [PATCH] New Audio Engine -MAC --- build/cocos2d_libs.xcodeproj/project.pbxproj | 16 +++++++++++++ build/cocos2d_tests.xcodeproj/project.pbxproj | 6 +++++ cocos/audio/AudioEngine.cpp | 4 ++-- cocos/audio/include/AudioEngine.h | 2 +- cocos/audio/ios/AudioCache.h | 2 +- cocos/audio/ios/AudioCache.mm | 3 +++ cocos/audio/ios/AudioEngine-inl.h | 2 +- cocos/audio/ios/AudioEngine-inl.mm | 24 +++++++------------ cocos/audio/ios/AudioPlayer.h | 2 +- cocos/audio/ios/AudioPlayer.mm | 3 +++ .../NewAudioEngineTest/NewAudioEngineTest.cpp | 4 ++-- .../NewAudioEngineTest/NewAudioEngineTest.h | 2 +- tests/cpp-tests/Classes/controller.cpp | 2 +- tests/cpp-tests/Classes/tests.h | 2 +- 14 files changed, 48 insertions(+), 26 deletions(-) diff --git a/build/cocos2d_libs.xcodeproj/project.pbxproj b/build/cocos2d_libs.xcodeproj/project.pbxproj index eb33637bf1..5daa9ee827 100644 --- a/build/cocos2d_libs.xcodeproj/project.pbxproj +++ b/build/cocos2d_libs.xcodeproj/project.pbxproj @@ -1275,6 +1275,14 @@ 3E2BDAE919C0329B0055CDCD /* AudioPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E2BDAE319C0329B0055CDCD /* AudioPlayer.h */; }; 3E2BDAEA19C0329B0055CDCD /* AudioPlayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3E2BDAE419C0329B0055CDCD /* AudioPlayer.mm */; }; 3E2BDAEC19C0436F0055CDCD /* AudioEngine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E2BDAEB19C0436F0055CDCD /* AudioEngine.cpp */; }; + 3E2F27A619CFBFE100E7C490 /* AudioEngine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E2BDAEB19C0436F0055CDCD /* AudioEngine.cpp */; }; + 3E2F27A719CFBFE400E7C490 /* AudioEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E2BDADD19C030ED0055CDCD /* AudioEngine.h */; }; + 3E2F27A819CFBFE900E7C490 /* AudioCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E2BDADF19C0329B0055CDCD /* AudioCache.h */; }; + 3E2F27A919CFBFEC00E7C490 /* AudioCache.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3E2BDAE019C0329B0055CDCD /* AudioCache.mm */; }; + 3E2F27AA19CFBFEE00E7C490 /* AudioEngine-inl.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E2BDAE119C0329B0055CDCD /* AudioEngine-inl.h */; }; + 3E2F27AB19CFBFF100E7C490 /* AudioEngine-inl.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3E2BDAE219C0329B0055CDCD /* AudioEngine-inl.mm */; }; + 3E2F27AC19CFBFF300E7C490 /* AudioPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E2BDAE319C0329B0055CDCD /* AudioPlayer.h */; }; + 3E2F27AD19CFBFF700E7C490 /* AudioPlayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3E2BDAE419C0329B0055CDCD /* AudioPlayer.mm */; }; 3E6176681960F89B00DE83F5 /* CCController-iOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3E6176551960F89B00DE83F5 /* CCController-iOS.mm */; }; 3E6176691960F89B00DE83F5 /* CCController.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E6176561960F89B00DE83F5 /* CCController.h */; }; 3E6176741960F89B00DE83F5 /* CCEventController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E6176611960F89B00DE83F5 /* CCEventController.cpp */; }; @@ -4825,6 +4833,7 @@ 15AE191419AAD35000C27E9E /* CCSGUIReader.h in Headers */, 15AE196D19AAD35700C27E9E /* CCActionTimeline.h in Headers */, 15AE1A6D19AAD40300C27E9E /* b2ChainAndPolygonContact.h in Headers */, + 3E2F27A719CFBFE400E7C490 /* AudioEngine.h in Headers */, 15AE183A19AAD2F700C27E9E /* CCRay.h in Headers */, 15AE19E919AAD3A700C27E9E /* Slot.h in Headers */, B375107B1823AC9F00B3BA6A /* CCPhysicsWorldInfo_chipmunk.h in Headers */, @@ -4893,6 +4902,7 @@ 46C02E0918E91123004B7456 /* xxhash.h in Headers */, 15AE1A6B19AAD40300C27E9E /* b2ChainAndCircleContact.h in Headers */, 1A570110180BC8EE0088DEC7 /* CCDrawingPrimitives.h in Headers */, + 3E2F27AC19CFBFF300E7C490 /* AudioPlayer.h in Headers */, B37510791823AC9F00B3BA6A /* CCPhysicsShapeInfo_chipmunk.h in Headers */, 1A570114180BC8EE0088DEC7 /* CCDrawNode.h in Headers */, 15AE1A6019AAD40300C27E9E /* b2ContactManager.h in Headers */, @@ -5012,6 +5022,7 @@ 50643BE219BFCF1800EF68ED /* CCPlatformConfig.h in Headers */, 5034CA49191D591100CE6051 /* ccShader_Label_df.frag in Headers */, 292DB14119B4574100A80320 /* UIEditBoxImpl.h in Headers */, + 3E2F27AA19CFBFEE00E7C490 /* AudioEngine-inl.h in Headers */, 1A01C68C18F57BE800EFE3A6 /* CCDeprecated.h in Headers */, 50ABBD561925AB0000A911A9 /* TransformUtils.h in Headers */, 299754F6193EC95400A54AC3 /* ObjectFactory.h in Headers */, @@ -5117,6 +5128,7 @@ 15AE199519AAD39600C27E9E /* LayoutReader.h in Headers */, 15AE183219AAD2F700C27E9E /* CCOBB.h in Headers */, 15AE1BE319AAE01E00C27E9E /* CCScrollView.h in Headers */, + 3E2F27A819CFBFE900E7C490 /* AudioCache.h in Headers */, 50ABC01F1926664800A911A9 /* CCThread.h in Headers */, 1A57035A180BD0B00088DEC7 /* unzip.h in Headers */, 15AE188B19AAD33D00C27E9E /* CCControlLoader.h in Headers */, @@ -5887,6 +5899,7 @@ 15AE1A5019AAD40300C27E9E /* b2BlockAllocator.cpp in Sources */, 15AE1A8219AAD40300C27E9E /* b2GearJoint.cpp in Sources */, 1A570071180BC5A10088DEC7 /* CCActionGrid.cpp in Sources */, + 3E2F27AD19CFBFF700E7C490 /* AudioPlayer.mm in Sources */, B37510761823AC9F00B3BA6A /* CCPhysicsJointInfo_chipmunk.cpp in Sources */, 50ABBFFF1926664800A911A9 /* CCFileUtils-apple.mm in Sources */, 1A570075180BC5A10088DEC7 /* CCActionGrid3D.cpp in Sources */, @@ -5943,6 +5956,7 @@ 29394CF219B01DBA00D2DE1A /* UIWebView.mm in Sources */, 15AE1BD419AAE01E00C27E9E /* CCControlSaturationBrightnessPicker.cpp in Sources */, 1A57019D180BCB590088DEC7 /* CCFont.cpp in Sources */, + 3E2F27AB19CFBFF100E7C490 /* AudioEngine-inl.mm in Sources */, 1A5701A1180BCB590088DEC7 /* CCFontAtlas.cpp in Sources */, 15AE1A8619AAD40300C27E9E /* b2MouseJoint.cpp in Sources */, 1A5701A5180BCB590088DEC7 /* CCFontAtlasCache.cpp in Sources */, @@ -6109,6 +6123,7 @@ 15AE1B7019AADA9900C27E9E /* CocosGUI.cpp in Sources */, 15AE19D019AAD3A700C27E9E /* AttachmentLoader.cpp in Sources */, 15AE19DE19AAD3A700C27E9E /* RegionAttachment.cpp in Sources */, + 3E2F27A919CFBFEC00E7C490 /* AudioCache.mm in Sources */, 15AE19C819AAD3A700C27E9E /* AnimationStateData.cpp in Sources */, 15AE18FA19AAD35000C27E9E /* CCColliderDetector.cpp in Sources */, 50ABBEA71925AB6F00A911A9 /* CCTouch.cpp in Sources */, @@ -6157,6 +6172,7 @@ 15AE190B19AAD35000C27E9E /* CCDisplayFactory.cpp in Sources */, 1A9DCA27180E6955007A3AD4 /* CCGLBufferedNode.cpp in Sources */, 50ABBD541925AB0000A911A9 /* TransformUtils.cpp in Sources */, + 3E2F27A619CFBFE100E7C490 /* AudioEngine.cpp in Sources */, 15AE1A3619AAD3D500C27E9E /* b2PolygonShape.cpp in Sources */, 50ABBD9B1925AB4100A911A9 /* ccGLStateCache.cpp in Sources */, 15AE188119AAD33D00C27E9E /* CCBReader.cpp in Sources */, diff --git a/build/cocos2d_tests.xcodeproj/project.pbxproj b/build/cocos2d_tests.xcodeproj/project.pbxproj index d86ff073b4..5191ecd5fd 100644 --- a/build/cocos2d_tests.xcodeproj/project.pbxproj +++ b/build/cocos2d_tests.xcodeproj/project.pbxproj @@ -876,6 +876,9 @@ 3E2BDAFF19C5E5B40055CDCD /* audio in Resources */ = {isa = PBXBuildFile; fileRef = 3E2BDAD119BEA3E20055CDCD /* audio */; }; 3E2BDB0119C5E5D40055CDCD /* background.wav in Resources */ = {isa = PBXBuildFile; fileRef = 3E2BDB0019C5E5D40055CDCD /* background.wav */; }; 3E2BDB0219C5E5D40055CDCD /* background.wav in Resources */ = {isa = PBXBuildFile; fileRef = 3E2BDB0019C5E5D40055CDCD /* background.wav */; }; + 3E2F27B919CFF4AF00E7C490 /* NewAudioEngineTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E2BDACE19BEA3410055CDCD /* NewAudioEngineTest.cpp */; }; + 3E2F27BA19CFF52300E7C490 /* audio in Resources */ = {isa = PBXBuildFile; fileRef = 3E2BDAD119BEA3E20055CDCD /* audio */; }; + 3E2F27BB19CFF52A00E7C490 /* background.wav in Resources */ = {isa = PBXBuildFile; fileRef = 3E2BDB0019C5E5D40055CDCD /* background.wav */; }; 3E6177221960FAED00DE83F5 /* libcocos2d iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46A15FBE1807A4F9005B8026 /* libcocos2d iOS.a */; }; 3E6177241960FAED00DE83F5 /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D60AE43317F7FFE100757E4B /* CoreMotion.framework */; }; 3E6177251960FAED00DE83F5 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C6482E165F399D007D4F18 /* libz.dylib */; }; @@ -7777,9 +7780,11 @@ 1AC35CFA18CED84500F37B72 /* Misc in Resources */, 38FA2E76194AECF800FF2BE4 /* ActionTimeline in Resources */, 1AC35D0418CED84500F37B72 /* Shaders in Resources */, + 3E2F27BA19CFF52300E7C490 /* audio in Resources */, 1AC35CD818CED84500F37B72 /* CocosBuilderExample.ccbresourcelog in Resources */, B2507B6B192589AF00FA4972 /* Shaders3D in Resources */, 1AC35D0618CED84500F37B72 /* spine in Resources */, + 3E2F27BB19CFF52A00E7C490 /* background.wav in Resources */, 1AC35CE818CED84500F37B72 /* extensions in Resources */, 1AC35CDE18CED84500F37B72 /* components in Resources */, 1AC35D0818CED84500F37B72 /* TileMaps in Resources */, @@ -8131,6 +8136,7 @@ 1AC35C6518CECF0C00F37B72 /* UnitTest.cpp in Sources */, 29080DC9191B595E0066F8DF /* UISceneManager_Editor.cpp in Sources */, 1AC35B3F18CECF0C00F37B72 /* Bug-458.cpp in Sources */, + 3E2F27B919CFF4AF00E7C490 /* NewAudioEngineTest.cpp in Sources */, 1AC35C3918CECF0C00F37B72 /* PerformanceTextureTest.cpp in Sources */, 1AC35B5318CECF0C00F37B72 /* CocosDenshionTest.cpp in Sources */, 29080DD3191B595E0066F8DF /* UITextAtlasTest.cpp in Sources */, diff --git a/cocos/audio/AudioEngine.cpp b/cocos/audio/AudioEngine.cpp index 11c1556744..59bd23a0da 100644 --- a/cocos/audio/AudioEngine.cpp +++ b/cocos/audio/AudioEngine.cpp @@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ -#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS +#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC #include "audio/include/AudioEngine.h" #include "platform/CCFileUtils.h" @@ -29,7 +29,7 @@ #if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID #include "android/AudioEngine-inl.h" -#elif CC_TARGET_PLATFORM == CC_PLATFORM_IOS +#elif CC_TARGET_PLATFORM == CC_PLATFORM_IOS|| CC_TARGET_PLATFORM == CC_PLATFORM_MAC #include "ios/AudioEngine-inl.h" #endif diff --git a/cocos/audio/include/AudioEngine.h b/cocos/audio/include/AudioEngine.h index 8501000b02..38b73a4081 100644 --- a/cocos/audio/include/AudioEngine.h +++ b/cocos/audio/include/AudioEngine.h @@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ -#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS +#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC #ifndef __AUDIO_ENGINE_H_ #define __AUDIO_ENGINE_H_ diff --git a/cocos/audio/ios/AudioCache.h b/cocos/audio/ios/AudioCache.h index ca4e81b64f..4aa1375d84 100644 --- a/cocos/audio/ios/AudioCache.h +++ b/cocos/audio/ios/AudioCache.h @@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ -#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS +#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC #ifndef __AUDIO_CACHE_H_ #define __AUDIO_CACHE_H_ diff --git a/cocos/audio/ios/AudioCache.mm b/cocos/audio/ios/AudioCache.mm index bb8fae552f..49c0a48af7 100644 --- a/cocos/audio/ios/AudioCache.mm +++ b/cocos/audio/ios/AudioCache.mm @@ -21,6 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ +#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC #include "AudioCache.h" #include #import @@ -238,3 +239,5 @@ void AudioCache::addCallbacks(const std::function &callback) } _callbackMutex.unlock(); } + +#endif diff --git a/cocos/audio/ios/AudioEngine-inl.h b/cocos/audio/ios/AudioEngine-inl.h index 78f7dd161e..c83f63ed91 100644 --- a/cocos/audio/ios/AudioEngine-inl.h +++ b/cocos/audio/ios/AudioEngine-inl.h @@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ -#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS +#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC #ifndef __AUDIO_ENGINE_INL_H_ #define __AUDIO_ENGINE_INL_H_ diff --git a/cocos/audio/ios/AudioEngine-inl.mm b/cocos/audio/ios/AudioEngine-inl.mm index 98868ff1dd..e8bb489509 100644 --- a/cocos/audio/ios/AudioEngine-inl.mm +++ b/cocos/audio/ios/AudioEngine-inl.mm @@ -21,6 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ +#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC #include "AudioEngine-inl.h" #include "audio/include/AudioEngine.h" @@ -36,17 +37,6 @@ using namespace cocos2d::experimental; static ALCdevice *s_ALDevice = nullptr; static ALCcontext *s_ALContext = nullptr; -static void AudioInterrupionListenerCallback(void* user_data, UInt32 interruption_state) -{ - if(kAudioSessionBeginInterruption == interruption_state){ - alcMakeContextCurrent(nullptr); - } - else if (kAudioSessionEndInterruption == interruption_state){ - AudioSessionSetActive(true); - alcMakeContextCurrent(s_ALContext); - } -} - namespace cocos2d { namespace experimental { class AudioEngineThreadPool @@ -149,6 +139,7 @@ AudioEngineImpl::~AudioEngineImpl() _audioCaches.clear(); + alcMakeContextCurrent(nullptr); alcDestroyContext(s_ALContext); } if (s_ALDevice) { @@ -162,9 +153,6 @@ AudioEngineImpl::~AudioEngineImpl() bool AudioEngineImpl::init() { - //set up the audio session - AudioSessionInitialize(nullptr, nullptr, AudioInterrupionListenerCallback, nullptr); - bool ret = false; do{ s_ALDevice = alcOpenDevice(nullptr); @@ -450,6 +438,10 @@ void AudioEngineImpl::update(float dt) auto playerIt = _audioPlayers.find(audioID); if (playerIt != _audioPlayers.end()) { _alSourceUsed[playerIt->second._alSource] = false; + if(playerIt->second._finishCallbak) { + auto& audioInfo = AudioEngine::_audioIDInfoMap[audioID]; + playerIt->second._finishCallbak(audioID, *audioInfo.filePath); + } _audioPlayers.erase(audioID); AudioEngine::remove(audioID); } @@ -474,8 +466,8 @@ void AudioEngineImpl::update(float dt) if (player._ready && sourceState == AL_STOPPED) { _alSourceUsed[player._alSource] = false; - auto& audioInfo = AudioEngine::_audioIDInfoMap[audioID]; if (player._finishCallbak) { + auto& audioInfo = AudioEngine::_audioIDInfoMap[audioID]; player._finishCallbak(audioID, *audioInfo.filePath); } @@ -506,3 +498,5 @@ void AudioEngineImpl::uncacheAll() { _audioCaches.clear(); } + +#endif diff --git a/cocos/audio/ios/AudioPlayer.h b/cocos/audio/ios/AudioPlayer.h index 08e83d13be..fc2b6c0f1d 100644 --- a/cocos/audio/ios/AudioPlayer.h +++ b/cocos/audio/ios/AudioPlayer.h @@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ -#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS +#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC #ifndef __AUDIO_PLAYER_H_ #define __AUDIO_PLAYER_H_ diff --git a/cocos/audio/ios/AudioPlayer.mm b/cocos/audio/ios/AudioPlayer.mm index 36633f676d..0e46dfd5a6 100644 --- a/cocos/audio/ios/AudioPlayer.mm +++ b/cocos/audio/ios/AudioPlayer.mm @@ -21,6 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ +#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC #include "AudioPlayer.h" #include "AudioCache.h" #include "platform/CCFileUtils.h" @@ -213,3 +214,5 @@ bool AudioPlayer::setTime(float time) } return false; } + +#endif diff --git a/tests/cpp-tests/Classes/NewAudioEngineTest/NewAudioEngineTest.cpp b/tests/cpp-tests/Classes/NewAudioEngineTest/NewAudioEngineTest.cpp index d7163a2974..81baee9bf1 100644 --- a/tests/cpp-tests/Classes/NewAudioEngineTest/NewAudioEngineTest.cpp +++ b/tests/cpp-tests/Classes/NewAudioEngineTest/NewAudioEngineTest.cpp @@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ -#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS +#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC #include "NewAudioEngineTest.h" #include "ui/CocosGUI.h" @@ -561,7 +561,7 @@ bool AudioProfileTest::init() char text[30]; _files[0] = "background.mp3"; -#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS +#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC _files[1] = "background.caf"; #else _files[1] = "background.ogg"; diff --git a/tests/cpp-tests/Classes/NewAudioEngineTest/NewAudioEngineTest.h b/tests/cpp-tests/Classes/NewAudioEngineTest/NewAudioEngineTest.h index 9137c207c0..6c5f60eb85 100644 --- a/tests/cpp-tests/Classes/NewAudioEngineTest/NewAudioEngineTest.h +++ b/tests/cpp-tests/Classes/NewAudioEngineTest/NewAudioEngineTest.h @@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ -#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS +#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC #ifndef __NEWAUDIOENGINE_TEST_H_ #define __NEWAUDIOENGINE_TEST_H_ diff --git a/tests/cpp-tests/Classes/controller.cpp b/tests/cpp-tests/Classes/controller.cpp index b5864d45ac..d1969ecbb0 100644 --- a/tests/cpp-tests/Classes/controller.cpp +++ b/tests/cpp-tests/Classes/controller.cpp @@ -39,7 +39,7 @@ Controller g_aTestNames[] = { { "Actions - Ease", [](){return new ActionsEaseTestScene();} }, { "Actions - Progress", [](){return new ProgressActionsTestScene(); } }, { "Audio - CocosDenshion", []() { return new CocosDenshionTestScene(); } }, -#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) +#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC) { "Audio - NewAudioEngine", []() { return new AudioEngineTestScene(); } }, #endif { "Box2d - Basic", []() { return new Box2DTestScene(); } }, diff --git a/tests/cpp-tests/Classes/tests.h b/tests/cpp-tests/Classes/tests.h index 0fd5748a1e..c4dc6b8ce6 100644 --- a/tests/cpp-tests/Classes/tests.h +++ b/tests/cpp-tests/Classes/tests.h @@ -37,7 +37,7 @@ #include "PerformanceTest/PerformanceTest.h" #include "ZwoptexTest/ZwoptexTest.h" #include "CocosDenshionTest/CocosDenshionTest.h" -#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) +#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC) #include "NewAudioEngineTest/NewAudioEngineTest.h" #endif #if (CC_TARGET_PLATFORM != CC_PLATFORM_EMSCRIPEN)