New Audio Engine -MAC

This commit is contained in:
Dhilan007 2014-09-22 15:38:12 +08:00
parent 533a454914
commit 936c3b3f79
14 changed files with 48 additions and 26 deletions

View File

@ -1275,6 +1275,14 @@
3E2BDAE919C0329B0055CDCD /* AudioPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E2BDAE319C0329B0055CDCD /* AudioPlayer.h */; }; 3E2BDAE919C0329B0055CDCD /* AudioPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E2BDAE319C0329B0055CDCD /* AudioPlayer.h */; };
3E2BDAEA19C0329B0055CDCD /* AudioPlayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3E2BDAE419C0329B0055CDCD /* AudioPlayer.mm */; }; 3E2BDAEA19C0329B0055CDCD /* AudioPlayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3E2BDAE419C0329B0055CDCD /* AudioPlayer.mm */; };
3E2BDAEC19C0436F0055CDCD /* AudioEngine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E2BDAEB19C0436F0055CDCD /* AudioEngine.cpp */; }; 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 */; }; 3E6176681960F89B00DE83F5 /* CCController-iOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3E6176551960F89B00DE83F5 /* CCController-iOS.mm */; };
3E6176691960F89B00DE83F5 /* CCController.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E6176561960F89B00DE83F5 /* CCController.h */; }; 3E6176691960F89B00DE83F5 /* CCController.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E6176561960F89B00DE83F5 /* CCController.h */; };
3E6176741960F89B00DE83F5 /* CCEventController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E6176611960F89B00DE83F5 /* CCEventController.cpp */; }; 3E6176741960F89B00DE83F5 /* CCEventController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E6176611960F89B00DE83F5 /* CCEventController.cpp */; };
@ -4825,6 +4833,7 @@
15AE191419AAD35000C27E9E /* CCSGUIReader.h in Headers */, 15AE191419AAD35000C27E9E /* CCSGUIReader.h in Headers */,
15AE196D19AAD35700C27E9E /* CCActionTimeline.h in Headers */, 15AE196D19AAD35700C27E9E /* CCActionTimeline.h in Headers */,
15AE1A6D19AAD40300C27E9E /* b2ChainAndPolygonContact.h in Headers */, 15AE1A6D19AAD40300C27E9E /* b2ChainAndPolygonContact.h in Headers */,
3E2F27A719CFBFE400E7C490 /* AudioEngine.h in Headers */,
15AE183A19AAD2F700C27E9E /* CCRay.h in Headers */, 15AE183A19AAD2F700C27E9E /* CCRay.h in Headers */,
15AE19E919AAD3A700C27E9E /* Slot.h in Headers */, 15AE19E919AAD3A700C27E9E /* Slot.h in Headers */,
B375107B1823AC9F00B3BA6A /* CCPhysicsWorldInfo_chipmunk.h in Headers */, B375107B1823AC9F00B3BA6A /* CCPhysicsWorldInfo_chipmunk.h in Headers */,
@ -4893,6 +4902,7 @@
46C02E0918E91123004B7456 /* xxhash.h in Headers */, 46C02E0918E91123004B7456 /* xxhash.h in Headers */,
15AE1A6B19AAD40300C27E9E /* b2ChainAndCircleContact.h in Headers */, 15AE1A6B19AAD40300C27E9E /* b2ChainAndCircleContact.h in Headers */,
1A570110180BC8EE0088DEC7 /* CCDrawingPrimitives.h in Headers */, 1A570110180BC8EE0088DEC7 /* CCDrawingPrimitives.h in Headers */,
3E2F27AC19CFBFF300E7C490 /* AudioPlayer.h in Headers */,
B37510791823AC9F00B3BA6A /* CCPhysicsShapeInfo_chipmunk.h in Headers */, B37510791823AC9F00B3BA6A /* CCPhysicsShapeInfo_chipmunk.h in Headers */,
1A570114180BC8EE0088DEC7 /* CCDrawNode.h in Headers */, 1A570114180BC8EE0088DEC7 /* CCDrawNode.h in Headers */,
15AE1A6019AAD40300C27E9E /* b2ContactManager.h in Headers */, 15AE1A6019AAD40300C27E9E /* b2ContactManager.h in Headers */,
@ -5012,6 +5022,7 @@
50643BE219BFCF1800EF68ED /* CCPlatformConfig.h in Headers */, 50643BE219BFCF1800EF68ED /* CCPlatformConfig.h in Headers */,
5034CA49191D591100CE6051 /* ccShader_Label_df.frag in Headers */, 5034CA49191D591100CE6051 /* ccShader_Label_df.frag in Headers */,
292DB14119B4574100A80320 /* UIEditBoxImpl.h in Headers */, 292DB14119B4574100A80320 /* UIEditBoxImpl.h in Headers */,
3E2F27AA19CFBFEE00E7C490 /* AudioEngine-inl.h in Headers */,
1A01C68C18F57BE800EFE3A6 /* CCDeprecated.h in Headers */, 1A01C68C18F57BE800EFE3A6 /* CCDeprecated.h in Headers */,
50ABBD561925AB0000A911A9 /* TransformUtils.h in Headers */, 50ABBD561925AB0000A911A9 /* TransformUtils.h in Headers */,
299754F6193EC95400A54AC3 /* ObjectFactory.h in Headers */, 299754F6193EC95400A54AC3 /* ObjectFactory.h in Headers */,
@ -5117,6 +5128,7 @@
15AE199519AAD39600C27E9E /* LayoutReader.h in Headers */, 15AE199519AAD39600C27E9E /* LayoutReader.h in Headers */,
15AE183219AAD2F700C27E9E /* CCOBB.h in Headers */, 15AE183219AAD2F700C27E9E /* CCOBB.h in Headers */,
15AE1BE319AAE01E00C27E9E /* CCScrollView.h in Headers */, 15AE1BE319AAE01E00C27E9E /* CCScrollView.h in Headers */,
3E2F27A819CFBFE900E7C490 /* AudioCache.h in Headers */,
50ABC01F1926664800A911A9 /* CCThread.h in Headers */, 50ABC01F1926664800A911A9 /* CCThread.h in Headers */,
1A57035A180BD0B00088DEC7 /* unzip.h in Headers */, 1A57035A180BD0B00088DEC7 /* unzip.h in Headers */,
15AE188B19AAD33D00C27E9E /* CCControlLoader.h in Headers */, 15AE188B19AAD33D00C27E9E /* CCControlLoader.h in Headers */,
@ -5887,6 +5899,7 @@
15AE1A5019AAD40300C27E9E /* b2BlockAllocator.cpp in Sources */, 15AE1A5019AAD40300C27E9E /* b2BlockAllocator.cpp in Sources */,
15AE1A8219AAD40300C27E9E /* b2GearJoint.cpp in Sources */, 15AE1A8219AAD40300C27E9E /* b2GearJoint.cpp in Sources */,
1A570071180BC5A10088DEC7 /* CCActionGrid.cpp in Sources */, 1A570071180BC5A10088DEC7 /* CCActionGrid.cpp in Sources */,
3E2F27AD19CFBFF700E7C490 /* AudioPlayer.mm in Sources */,
B37510761823AC9F00B3BA6A /* CCPhysicsJointInfo_chipmunk.cpp in Sources */, B37510761823AC9F00B3BA6A /* CCPhysicsJointInfo_chipmunk.cpp in Sources */,
50ABBFFF1926664800A911A9 /* CCFileUtils-apple.mm in Sources */, 50ABBFFF1926664800A911A9 /* CCFileUtils-apple.mm in Sources */,
1A570075180BC5A10088DEC7 /* CCActionGrid3D.cpp in Sources */, 1A570075180BC5A10088DEC7 /* CCActionGrid3D.cpp in Sources */,
@ -5943,6 +5956,7 @@
29394CF219B01DBA00D2DE1A /* UIWebView.mm in Sources */, 29394CF219B01DBA00D2DE1A /* UIWebView.mm in Sources */,
15AE1BD419AAE01E00C27E9E /* CCControlSaturationBrightnessPicker.cpp in Sources */, 15AE1BD419AAE01E00C27E9E /* CCControlSaturationBrightnessPicker.cpp in Sources */,
1A57019D180BCB590088DEC7 /* CCFont.cpp in Sources */, 1A57019D180BCB590088DEC7 /* CCFont.cpp in Sources */,
3E2F27AB19CFBFF100E7C490 /* AudioEngine-inl.mm in Sources */,
1A5701A1180BCB590088DEC7 /* CCFontAtlas.cpp in Sources */, 1A5701A1180BCB590088DEC7 /* CCFontAtlas.cpp in Sources */,
15AE1A8619AAD40300C27E9E /* b2MouseJoint.cpp in Sources */, 15AE1A8619AAD40300C27E9E /* b2MouseJoint.cpp in Sources */,
1A5701A5180BCB590088DEC7 /* CCFontAtlasCache.cpp in Sources */, 1A5701A5180BCB590088DEC7 /* CCFontAtlasCache.cpp in Sources */,
@ -6109,6 +6123,7 @@
15AE1B7019AADA9900C27E9E /* CocosGUI.cpp in Sources */, 15AE1B7019AADA9900C27E9E /* CocosGUI.cpp in Sources */,
15AE19D019AAD3A700C27E9E /* AttachmentLoader.cpp in Sources */, 15AE19D019AAD3A700C27E9E /* AttachmentLoader.cpp in Sources */,
15AE19DE19AAD3A700C27E9E /* RegionAttachment.cpp in Sources */, 15AE19DE19AAD3A700C27E9E /* RegionAttachment.cpp in Sources */,
3E2F27A919CFBFEC00E7C490 /* AudioCache.mm in Sources */,
15AE19C819AAD3A700C27E9E /* AnimationStateData.cpp in Sources */, 15AE19C819AAD3A700C27E9E /* AnimationStateData.cpp in Sources */,
15AE18FA19AAD35000C27E9E /* CCColliderDetector.cpp in Sources */, 15AE18FA19AAD35000C27E9E /* CCColliderDetector.cpp in Sources */,
50ABBEA71925AB6F00A911A9 /* CCTouch.cpp in Sources */, 50ABBEA71925AB6F00A911A9 /* CCTouch.cpp in Sources */,
@ -6157,6 +6172,7 @@
15AE190B19AAD35000C27E9E /* CCDisplayFactory.cpp in Sources */, 15AE190B19AAD35000C27E9E /* CCDisplayFactory.cpp in Sources */,
1A9DCA27180E6955007A3AD4 /* CCGLBufferedNode.cpp in Sources */, 1A9DCA27180E6955007A3AD4 /* CCGLBufferedNode.cpp in Sources */,
50ABBD541925AB0000A911A9 /* TransformUtils.cpp in Sources */, 50ABBD541925AB0000A911A9 /* TransformUtils.cpp in Sources */,
3E2F27A619CFBFE100E7C490 /* AudioEngine.cpp in Sources */,
15AE1A3619AAD3D500C27E9E /* b2PolygonShape.cpp in Sources */, 15AE1A3619AAD3D500C27E9E /* b2PolygonShape.cpp in Sources */,
50ABBD9B1925AB4100A911A9 /* ccGLStateCache.cpp in Sources */, 50ABBD9B1925AB4100A911A9 /* ccGLStateCache.cpp in Sources */,
15AE188119AAD33D00C27E9E /* CCBReader.cpp in Sources */, 15AE188119AAD33D00C27E9E /* CCBReader.cpp in Sources */,

View File

@ -876,6 +876,9 @@
3E2BDAFF19C5E5B40055CDCD /* audio in Resources */ = {isa = PBXBuildFile; fileRef = 3E2BDAD119BEA3E20055CDCD /* audio */; }; 3E2BDAFF19C5E5B40055CDCD /* audio in Resources */ = {isa = PBXBuildFile; fileRef = 3E2BDAD119BEA3E20055CDCD /* audio */; };
3E2BDB0119C5E5D40055CDCD /* background.wav in Resources */ = {isa = PBXBuildFile; fileRef = 3E2BDB0019C5E5D40055CDCD /* background.wav */; }; 3E2BDB0119C5E5D40055CDCD /* background.wav in Resources */ = {isa = PBXBuildFile; fileRef = 3E2BDB0019C5E5D40055CDCD /* background.wav */; };
3E2BDB0219C5E5D40055CDCD /* 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 */; }; 3E6177221960FAED00DE83F5 /* libcocos2d iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46A15FBE1807A4F9005B8026 /* libcocos2d iOS.a */; };
3E6177241960FAED00DE83F5 /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D60AE43317F7FFE100757E4B /* CoreMotion.framework */; }; 3E6177241960FAED00DE83F5 /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D60AE43317F7FFE100757E4B /* CoreMotion.framework */; };
3E6177251960FAED00DE83F5 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C6482E165F399D007D4F18 /* libz.dylib */; }; 3E6177251960FAED00DE83F5 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C6482E165F399D007D4F18 /* libz.dylib */; };
@ -7777,9 +7780,11 @@
1AC35CFA18CED84500F37B72 /* Misc in Resources */, 1AC35CFA18CED84500F37B72 /* Misc in Resources */,
38FA2E76194AECF800FF2BE4 /* ActionTimeline in Resources */, 38FA2E76194AECF800FF2BE4 /* ActionTimeline in Resources */,
1AC35D0418CED84500F37B72 /* Shaders in Resources */, 1AC35D0418CED84500F37B72 /* Shaders in Resources */,
3E2F27BA19CFF52300E7C490 /* audio in Resources */,
1AC35CD818CED84500F37B72 /* CocosBuilderExample.ccbresourcelog in Resources */, 1AC35CD818CED84500F37B72 /* CocosBuilderExample.ccbresourcelog in Resources */,
B2507B6B192589AF00FA4972 /* Shaders3D in Resources */, B2507B6B192589AF00FA4972 /* Shaders3D in Resources */,
1AC35D0618CED84500F37B72 /* spine in Resources */, 1AC35D0618CED84500F37B72 /* spine in Resources */,
3E2F27BB19CFF52A00E7C490 /* background.wav in Resources */,
1AC35CE818CED84500F37B72 /* extensions in Resources */, 1AC35CE818CED84500F37B72 /* extensions in Resources */,
1AC35CDE18CED84500F37B72 /* components in Resources */, 1AC35CDE18CED84500F37B72 /* components in Resources */,
1AC35D0818CED84500F37B72 /* TileMaps in Resources */, 1AC35D0818CED84500F37B72 /* TileMaps in Resources */,
@ -8131,6 +8136,7 @@
1AC35C6518CECF0C00F37B72 /* UnitTest.cpp in Sources */, 1AC35C6518CECF0C00F37B72 /* UnitTest.cpp in Sources */,
29080DC9191B595E0066F8DF /* UISceneManager_Editor.cpp in Sources */, 29080DC9191B595E0066F8DF /* UISceneManager_Editor.cpp in Sources */,
1AC35B3F18CECF0C00F37B72 /* Bug-458.cpp in Sources */, 1AC35B3F18CECF0C00F37B72 /* Bug-458.cpp in Sources */,
3E2F27B919CFF4AF00E7C490 /* NewAudioEngineTest.cpp in Sources */,
1AC35C3918CECF0C00F37B72 /* PerformanceTextureTest.cpp in Sources */, 1AC35C3918CECF0C00F37B72 /* PerformanceTextureTest.cpp in Sources */,
1AC35B5318CECF0C00F37B72 /* CocosDenshionTest.cpp in Sources */, 1AC35B5318CECF0C00F37B72 /* CocosDenshionTest.cpp in Sources */,
29080DD3191B595E0066F8DF /* UITextAtlasTest.cpp in Sources */, 29080DD3191B595E0066F8DF /* UITextAtlasTest.cpp in Sources */,

View File

@ -21,7 +21,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. 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 "audio/include/AudioEngine.h"
#include "platform/CCFileUtils.h" #include "platform/CCFileUtils.h"
@ -29,7 +29,7 @@
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID #if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
#include "android/AudioEngine-inl.h" #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" #include "ios/AudioEngine-inl.h"
#endif #endif

View File

@ -21,7 +21,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. 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_ #ifndef __AUDIO_ENGINE_H_
#define __AUDIO_ENGINE_H_ #define __AUDIO_ENGINE_H_

View File

@ -21,7 +21,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. 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_ #ifndef __AUDIO_CACHE_H_
#define __AUDIO_CACHE_H_ #define __AUDIO_CACHE_H_

View File

@ -21,6 +21,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC
#include "AudioCache.h" #include "AudioCache.h"
#include <thread> #include <thread>
#import <OpenAL/alc.h> #import <OpenAL/alc.h>
@ -238,3 +239,5 @@ void AudioCache::addCallbacks(const std::function<void ()> &callback)
} }
_callbackMutex.unlock(); _callbackMutex.unlock();
} }
#endif

View File

@ -21,7 +21,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. 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_ #ifndef __AUDIO_ENGINE_INL_H_
#define __AUDIO_ENGINE_INL_H_ #define __AUDIO_ENGINE_INL_H_

View File

@ -21,6 +21,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC
#include "AudioEngine-inl.h" #include "AudioEngine-inl.h"
#include "audio/include/AudioEngine.h" #include "audio/include/AudioEngine.h"
@ -36,17 +37,6 @@ using namespace cocos2d::experimental;
static ALCdevice *s_ALDevice = nullptr; static ALCdevice *s_ALDevice = nullptr;
static ALCcontext *s_ALContext = 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 cocos2d {
namespace experimental { namespace experimental {
class AudioEngineThreadPool class AudioEngineThreadPool
@ -149,6 +139,7 @@ AudioEngineImpl::~AudioEngineImpl()
_audioCaches.clear(); _audioCaches.clear();
alcMakeContextCurrent(nullptr);
alcDestroyContext(s_ALContext); alcDestroyContext(s_ALContext);
} }
if (s_ALDevice) { if (s_ALDevice) {
@ -162,9 +153,6 @@ AudioEngineImpl::~AudioEngineImpl()
bool AudioEngineImpl::init() bool AudioEngineImpl::init()
{ {
//set up the audio session
AudioSessionInitialize(nullptr, nullptr, AudioInterrupionListenerCallback, nullptr);
bool ret = false; bool ret = false;
do{ do{
s_ALDevice = alcOpenDevice(nullptr); s_ALDevice = alcOpenDevice(nullptr);
@ -450,6 +438,10 @@ void AudioEngineImpl::update(float dt)
auto playerIt = _audioPlayers.find(audioID); auto playerIt = _audioPlayers.find(audioID);
if (playerIt != _audioPlayers.end()) { if (playerIt != _audioPlayers.end()) {
_alSourceUsed[playerIt->second._alSource] = false; _alSourceUsed[playerIt->second._alSource] = false;
if(playerIt->second._finishCallbak) {
auto& audioInfo = AudioEngine::_audioIDInfoMap[audioID];
playerIt->second._finishCallbak(audioID, *audioInfo.filePath);
}
_audioPlayers.erase(audioID); _audioPlayers.erase(audioID);
AudioEngine::remove(audioID); AudioEngine::remove(audioID);
} }
@ -474,8 +466,8 @@ void AudioEngineImpl::update(float dt)
if (player._ready && sourceState == AL_STOPPED) { if (player._ready && sourceState == AL_STOPPED) {
_alSourceUsed[player._alSource] = false; _alSourceUsed[player._alSource] = false;
auto& audioInfo = AudioEngine::_audioIDInfoMap[audioID];
if (player._finishCallbak) { if (player._finishCallbak) {
auto& audioInfo = AudioEngine::_audioIDInfoMap[audioID];
player._finishCallbak(audioID, *audioInfo.filePath); player._finishCallbak(audioID, *audioInfo.filePath);
} }
@ -506,3 +498,5 @@ void AudioEngineImpl::uncacheAll()
{ {
_audioCaches.clear(); _audioCaches.clear();
} }
#endif

View File

@ -21,7 +21,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. 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_ #ifndef __AUDIO_PLAYER_H_
#define __AUDIO_PLAYER_H_ #define __AUDIO_PLAYER_H_

View File

@ -21,6 +21,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC
#include "AudioPlayer.h" #include "AudioPlayer.h"
#include "AudioCache.h" #include "AudioCache.h"
#include "platform/CCFileUtils.h" #include "platform/CCFileUtils.h"
@ -213,3 +214,5 @@ bool AudioPlayer::setTime(float time)
} }
return false; return false;
} }
#endif

View File

@ -21,7 +21,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. 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 "NewAudioEngineTest.h"
#include "ui/CocosGUI.h" #include "ui/CocosGUI.h"
@ -561,7 +561,7 @@ bool AudioProfileTest::init()
char text[30]; char text[30];
_files[0] = "background.mp3"; _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"; _files[1] = "background.caf";
#else #else
_files[1] = "background.ogg"; _files[1] = "background.ogg";

View File

@ -21,7 +21,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. 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_ #ifndef __NEWAUDIOENGINE_TEST_H_
#define __NEWAUDIOENGINE_TEST_H_ #define __NEWAUDIOENGINE_TEST_H_

View File

@ -39,7 +39,7 @@ Controller g_aTestNames[] = {
{ "Actions - Ease", [](){return new ActionsEaseTestScene();} }, { "Actions - Ease", [](){return new ActionsEaseTestScene();} },
{ "Actions - Progress", [](){return new ProgressActionsTestScene(); } }, { "Actions - Progress", [](){return new ProgressActionsTestScene(); } },
{ "Audio - CocosDenshion", []() { return new CocosDenshionTestScene(); } }, { "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(); } }, { "Audio - NewAudioEngine", []() { return new AudioEngineTestScene(); } },
#endif #endif
{ "Box2d - Basic", []() { return new Box2DTestScene(); } }, { "Box2d - Basic", []() { return new Box2DTestScene(); } },

View File

@ -37,7 +37,7 @@
#include "PerformanceTest/PerformanceTest.h" #include "PerformanceTest/PerformanceTest.h"
#include "ZwoptexTest/ZwoptexTest.h" #include "ZwoptexTest/ZwoptexTest.h"
#include "CocosDenshionTest/CocosDenshionTest.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" #include "NewAudioEngineTest/NewAudioEngineTest.h"
#endif #endif
#if (CC_TARGET_PLATFORM != CC_PLATFORM_EMSCRIPEN) #if (CC_TARGET_PLATFORM != CC_PLATFORM_EMSCRIPEN)