Merge pull request #8072 from Dhilan007/v3-audio903

move AudioEngine to cocos2d:experimental namespace
This commit is contained in:
minggo 2014-09-16 17:12:03 +08:00
commit da29b92ff4
15 changed files with 146 additions and 128 deletions

View File

@ -36,6 +36,7 @@
#define TIME_DELAY_PRECISION 0.0001
using namespace cocos2d;
using namespace cocos2d::experimental;
const int AudioEngine::INVAILD_AUDIO_ID = -1;
const float AudioEngine::TIME_UNKNOWN = -1.0f;

View File

@ -39,6 +39,7 @@
#include <jni.h>
using namespace cocos2d;
using namespace cocos2d::experimental;
void PlayOverEvent(SLPlayItf caller, void* context, SLuint32 playEvent)
{

View File

@ -37,7 +37,7 @@
#define ERRORLOG(msg) log("fun:%s,line:%d,msg:%s",__func__,__LINE__,#msg)
NS_CC_BEGIN
namespace experimental{
class AudioEngineImpl;
class AudioPlayer
@ -102,7 +102,7 @@ private:
};
#endif // __AUDIO_ENGINE_INL_H_
}
NS_CC_END
#endif

View File

@ -36,6 +36,7 @@
#endif // ERROR
NS_CC_BEGIN
namespace experimental{
class EXPORT_DLL AudioProfile
{
@ -265,6 +266,7 @@ protected:
friend class AudioEngineImpl;
};
}
NS_CC_END
#endif // __AUDIO_ENGINE_H_

View File

@ -39,6 +39,7 @@
#define QUEUEBUFFER_TIME_STEP 0.1
NS_CC_BEGIN
namespace experimental{
class AudioEngineImpl;
class AudioPlayer;
@ -91,6 +92,7 @@ private:
friend class AudioPlayer;
} ;
}
NS_CC_END
#endif // __AUDIO_CACHE_H_

View File

@ -44,6 +44,7 @@ static ALvoid alBufferDataStaticProc(const ALint bid, ALenum format, ALvoid* da
return;
}
using namespace cocos2d;
using namespace cocos2d::experimental;
AudioCache::AudioCache()
: _pcmData(nullptr)

View File

@ -33,7 +33,7 @@
#include "AudioPlayer.h"
NS_CC_BEGIN
namespace experimental{
#define MAX_AUDIOINSTANCES 32
class AudioEngineThreadPool;
@ -88,6 +88,7 @@ private:
int _currentAudioID;
};
}
NS_CC_END
#endif // __AUDIO_ENGINE_INL_H_
#endif

View File

@ -31,6 +31,7 @@
#include "base/ccUtils.h"
using namespace cocos2d;
using namespace cocos2d::experimental;
static ALCdevice *s_ALDevice = nullptr;
static ALCcontext *s_ALContext = nullptr;
@ -47,88 +48,90 @@ static void AudioInterrupionListenerCallback(void* user_data, UInt32 interruptio
}
namespace cocos2d {
class AudioEngineThreadPool
{
public:
AudioEngineThreadPool()
: _running(true)
, _numThread(6)
namespace experimental {
class AudioEngineThreadPool
{
_threads.reserve(_numThread);
_tasks.reserve(_numThread);
public:
AudioEngineThreadPool()
: _running(true)
, _numThread(6)
{
_threads.reserve(_numThread);
_tasks.reserve(_numThread);
for (int index = 0; index < _numThread; ++index) {
_tasks.push_back(nullptr);
_threads.push_back( std::thread( std::bind(&AudioEngineThreadPool::threadFunc,this,index) ) );
}
}
void addTask(const std::function<void()> &task){
_taskMutex.lock();
int targetIndex = -1;
for (int index = 0; index < _numThread; ++index) {
if (_tasks[index] == nullptr) {
targetIndex = index;
_tasks[index] = task;
break;
for (int index = 0; index < _numThread; ++index) {
_tasks.push_back(nullptr);
_threads.push_back( std::thread( std::bind(&AudioEngineThreadPool::threadFunc,this,index) ) );
}
}
if (targetIndex == -1) {
_tasks.push_back(task);
_threads.push_back( std::thread( std::bind(&AudioEngineThreadPool::threadFunc,this,_numThread) ) );
_numThread++;
}
_taskMutex.unlock();
_sleepCondition.notify_all();
}
void destroy()
{
_running = false;
_sleepCondition.notify_all();
for (int index = 0; index < _numThread; ++index) {
_threads[index].join();
}
}
private:
bool _running;
std::vector<std::thread> _threads;
std::vector< std::function<void ()> > _tasks;
void threadFunc(int index)
{
while (_running) {
std::function<void ()> task = nullptr;
void addTask(const std::function<void()> &task){
_taskMutex.lock();
task = _tasks[index];
_taskMutex.unlock();
if (nullptr == task)
{
std::unique_lock<std::mutex> lk(_sleepMutex);
_sleepCondition.wait(lk);
continue;
int targetIndex = -1;
for (int index = 0; index < _numThread; ++index) {
if (_tasks[index] == nullptr) {
targetIndex = index;
_tasks[index] = task;
break;
}
}
if (targetIndex == -1) {
_tasks.push_back(task);
_threads.push_back( std::thread( std::bind(&AudioEngineThreadPool::threadFunc,this,_numThread) ) );
task();
_taskMutex.lock();
_tasks[index] = nullptr;
_numThread++;
}
_taskMutex.unlock();
_sleepCondition.notify_all();
}
}
int _numThread;
void destroy()
{
_running = false;
_sleepCondition.notify_all();
std::mutex _taskMutex;
std::mutex _sleepMutex;
std::condition_variable _sleepCondition;
for (int index = 0; index < _numThread; ++index) {
_threads[index].join();
}
}
};
private:
bool _running;
std::vector<std::thread> _threads;
std::vector< std::function<void ()> > _tasks;
void threadFunc(int index)
{
while (_running) {
std::function<void ()> task = nullptr;
_taskMutex.lock();
task = _tasks[index];
_taskMutex.unlock();
if (nullptr == task)
{
std::unique_lock<std::mutex> lk(_sleepMutex);
_sleepCondition.wait(lk);
continue;
}
task();
_taskMutex.lock();
_tasks[index] = nullptr;
_taskMutex.unlock();
}
}
int _numThread;
std::mutex _taskMutex;
std::mutex _sleepMutex;
std::condition_variable _sleepCondition;
};
}
}
AudioEngineImpl::AudioEngineImpl()

View File

@ -32,6 +32,8 @@
#include "CCPlatformMacros.h"
NS_CC_BEGIN
namespace experimental{
class AudioCache;
class AudioEngineImpl;
@ -70,6 +72,8 @@ private:
friend class AudioEngineImpl;
};
}
NS_CC_END
#endif // __AUDIO_PLAYER_H_
#endif

View File

@ -27,6 +27,7 @@
#import <AudioToolbox/ExtendedAudioFile.h>
using namespace cocos2d;
using namespace cocos2d::experimental;
AudioPlayer::AudioPlayer()
: _exitThread(false)

View File

@ -31,14 +31,14 @@
static int lua_get_AudioProfile_name(lua_State* L)
{
cocos2d::AudioProfile* self = nullptr;
cocos2d::experimental::AudioProfile* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"cc.AudioProfile",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertype(L,1,"ccexp.AudioProfile",0,&tolua_err)) goto tolua_lerror;
#endif
self = (cocos2d::AudioProfile*) tolua_tousertype(L,1,0);
self = (cocos2d::experimental::AudioProfile*) tolua_tousertype(L,1,0);
#if COCOS2D_DEBUG >= 1
if (nullptr == self)
{
@ -60,14 +60,14 @@ tolua_lerror:
static int lua_set_AudioProfile_name(lua_State* L)
{
int argc = 0;
cocos2d::AudioProfile* self = nullptr;
cocos2d::experimental::AudioProfile* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"cc.AudioProfile",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertype(L,1,"ccexp.AudioProfile",0,&tolua_err)) goto tolua_lerror;
#endif
self = (cocos2d::AudioProfile*) tolua_tousertype(L,1,0);
self = (cocos2d::experimental::AudioProfile*) tolua_tousertype(L,1,0);
#if COCOS2D_DEBUG >= 1
if (nullptr == self)
{
@ -99,14 +99,14 @@ tolua_lerror:
static int lua_get_AudioProfile_maxInstances(lua_State* L)
{
cocos2d::AudioProfile* self = nullptr;
cocos2d::experimental::AudioProfile* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"cc.AudioProfile",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertype(L,1,"ccexp.AudioProfile",0,&tolua_err)) goto tolua_lerror;
#endif
self = (cocos2d::AudioProfile*) tolua_tousertype(L,1,0);
self = (cocos2d::experimental::AudioProfile*) tolua_tousertype(L,1,0);
#if COCOS2D_DEBUG >= 1
if (nullptr == self)
{
@ -128,14 +128,14 @@ tolua_lerror:
static int lua_set_AudioProfile_maxInstances(lua_State* L)
{
int argc = 0;
cocos2d::AudioProfile* self = nullptr;
cocos2d::experimental::AudioProfile* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"cc.AudioProfile",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertype(L,1,"ccexp.AudioProfile",0,&tolua_err)) goto tolua_lerror;
#endif
self = (cocos2d::AudioProfile*) tolua_tousertype(L,1,0);
self = (cocos2d::experimental::AudioProfile*) tolua_tousertype(L,1,0);
#if COCOS2D_DEBUG >= 1
if (nullptr == self)
{
@ -167,14 +167,14 @@ tolua_lerror:
static int lua_get_AudioProfile_minDelay(lua_State* L)
{
cocos2d::AudioProfile* self = nullptr;
cocos2d::experimental::AudioProfile* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"cc.AudioProfile",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertype(L,1,"ccexp.AudioProfile",0,&tolua_err)) goto tolua_lerror;
#endif
self = (cocos2d::AudioProfile*) tolua_tousertype(L,1,0);
self = (cocos2d::experimental::AudioProfile*) tolua_tousertype(L,1,0);
#if COCOS2D_DEBUG >= 1
if (nullptr == self)
{
@ -196,14 +196,14 @@ tolua_lerror:
static int lua_set_AudioProfile_minDelay(lua_State* L)
{
int argc = 0;
cocos2d::AudioProfile* self = nullptr;
cocos2d::experimental::AudioProfile* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"cc.AudioProfile",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertype(L,1,"ccexp.AudioProfile",0,&tolua_err)) goto tolua_lerror;
#endif
self = (cocos2d::AudioProfile*) tolua_tousertype(L,1,0);
self = (cocos2d::experimental::AudioProfile*) tolua_tousertype(L,1,0);
#if COCOS2D_DEBUG >= 1
if (nullptr == self)
{
@ -243,7 +243,7 @@ int lua_cocos2dx_audioengine_AudioEngine_setFinishCallback(lua_State* tolua_S)
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.AudioEngine",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertable(tolua_S,1,"ccexp.AudioEngine",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
@ -251,7 +251,7 @@ int lua_cocos2dx_audioengine_AudioEngine_setFinishCallback(lua_State* tolua_S)
if (argc == 2)
{
int arg0;
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.AudioEngine:setFinishCallback");
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccexp.AudioEngine:setFinishCallback");
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(tolua_S,3,"LUA_FUNCTION",0,&tolua_err))
@ -262,7 +262,7 @@ int lua_cocos2dx_audioengine_AudioEngine_setFinishCallback(lua_State* tolua_S)
LUA_FUNCTION handler = ( toluafix_ref_function(tolua_S,3,0));
cocos2d::AudioEngine::setFinishCallback(arg0, [handler](int audioID, std::string filePath){
cocos2d::experimental::AudioEngine::setFinishCallback(arg0, [handler](int audioID, std::string filePath){
LuaStack* stack = LuaEngine::getInstance()->getLuaStack();
stack->pushInt(audioID);
@ -275,7 +275,7 @@ int lua_cocos2dx_audioengine_AudioEngine_setFinishCallback(lua_State* tolua_S)
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "cc.AudioEngine:setFinishCallback",argc, 2);
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "ccexp.AudioEngine:setFinishCallback",argc, 2);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
@ -292,7 +292,7 @@ int register_audioengine_module(lua_State* L)
register_all_cocos2dx_audioengine(L);
if (L)
{
lua_pushstring(L, "cc.AudioProfile");
lua_pushstring(L, "ccexp.AudioProfile");
lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_istable(L,-1))
{
@ -302,7 +302,7 @@ int register_audioengine_module(lua_State* L)
}
lua_pop(L, 1);
lua_pushstring(L, "cc.AudioEngine");
lua_pushstring(L, "ccexp.AudioEngine");
lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_istable(L,-1))
{

View File

@ -25,7 +25,9 @@
#include "NewAudioEngineTest.h"
#include "ui/CocosGUI.h"
using namespace cocos2d;
using namespace cocos2d::ui;
using namespace cocos2d::experimental;
namespace {
@ -166,7 +168,7 @@ Layer* restartAction()
bool _enabled;
};
class SliderEx : public ui::Slider
class SliderEx : public Slider
{
public:
enum class TouchEvent

View File

@ -111,7 +111,7 @@ public:
private:
static const int FILE_COUNT = 4;
std::string _files[FILE_COUNT];
AudioProfile _audioProfile;
cocos2d::experimental::AudioProfile _audioProfile;
int _audioCount;
Label* _showLabel;

View File

@ -123,7 +123,7 @@ function AudioControlTest.create()
------playItem
local function playAudio(tag, sender)
if AudioControlTest._audioID == cc.AUDIO_INVAILD_ID then
AudioControlTest._audioID = cc.AudioEngine:play2d("background.mp3", AudioControlTest._loopEnabled, AudioControlTest._volume)
AudioControlTest._audioID = ccexp.AudioEngine:play2d("background.mp3", AudioControlTest._loopEnabled, AudioControlTest._volume)
if AudioControlTest._audioID ~= cc.AUDIO_INVAILD_ID then
AudioControlTest._playItem:setEnabled(false)
@ -133,7 +133,7 @@ function AudioControlTest.create()
AudioControlTest._playItem:setEnabled(true)
end
cc.AudioEngine:setFinishCallback(AudioControlTest._audioID,finishCallback)
ccexp.AudioEngine:setFinishCallback(AudioControlTest._audioID,finishCallback)
end
end
end
@ -145,7 +145,7 @@ function AudioControlTest.create()
------stopItem
local function stopAudio(tag, sender)
if AudioControlTest._audioID ~= cc.AUDIO_INVAILD_ID then
cc.AudioEngine:stop(AudioControlTest._audioID)
ccexp.AudioEngine:stop(AudioControlTest._audioID)
AudioControlTest._audioID = cc.AUDIO_INVAILD_ID
AudioControlTest._playItem:setEnabled(true)
end
@ -158,7 +158,7 @@ function AudioControlTest.create()
------pauseItem
local function pauseAudio(tag, sender)
if AudioControlTest._audioID ~= cc.AUDIO_INVAILD_ID then
cc.AudioEngine:pause(AudioControlTest._audioID)
ccexp.AudioEngine:pause(AudioControlTest._audioID)
end
end
@ -169,7 +169,7 @@ function AudioControlTest.create()
------resumeItem
local function resumeAudio(tag, sender)
if AudioControlTest._audioID ~= cc.AUDIO_INVAILD_ID then
cc.AudioEngine:resume(AudioControlTest._audioID)
ccexp.AudioEngine:resume(AudioControlTest._audioID)
end
end
@ -181,7 +181,7 @@ function AudioControlTest.create()
local function switchLoop(tag, sender)
AudioControlTest._loopEnabled = not AudioControlTest._loopEnabled
if AudioControlTest._audioID ~= cc.AUDIO_INVAILD_ID then
cc.AudioEngine:setLoop(AudioControlTest._audioID, AudioControlTest._loopEnabled)
ccexp.AudioEngine:setLoop(AudioControlTest._audioID, AudioControlTest._loopEnabled)
end
if AudioControlTest._loopEnabled then
AudioControlTest.loopItem:setString("disable-loop")
@ -196,7 +196,7 @@ function AudioControlTest.create()
------uncacheItem
local function uncache(tag, sender)
cc.AudioEngine:uncache("background.mp3")
ccexp.AudioEngine:uncache("background.mp3")
AudioControlTest._audioID = cc.AUDIO_INVAILD_ID
AudioControlTest._playItem:setEnabled(true)
end
@ -218,7 +218,7 @@ function AudioControlTest.create()
local function volumeSliderChangedEvent(sender,eventType)
AudioControlTest._volume = sender:getPercent() / 100.0
if AudioControlTest._audioID ~= cc.AUDIO_INVAILD_ID then
cc.AudioEngine:setVolume(AudioControlTest._audioID, AudioControlTest._volume)
ccexp.AudioEngine:setVolume(AudioControlTest._audioID, AudioControlTest._volume)
end
end
local volumeSlider = ccui.Slider:create()
@ -247,7 +247,7 @@ function AudioControlTest.create()
AudioControlTest._updateTimeSlider = false
else
if (AudioControlTest._audioID ~= cc.AUDIO_INVAILD_ID and AudioControlTest._duration ~= cc.AUDIO_TIME_UNKNOWN) then
cc.AudioEngine:setCurrentTime(AudioControlTest._audioID,AudioControlTest._duration * ratio)
ccexp.AudioEngine:setCurrentTime(AudioControlTest._audioID,AudioControlTest._duration * ratio)
end
AudioControlTest._updateTimeSlider = true
end
@ -261,10 +261,10 @@ function AudioControlTest.create()
local function step(dt)
if AudioControlTest._audioID ~= cc.AUDIO_INVAILD_ID then
if AudioControlTest._duration == cc.AUDIO_TIME_UNKNOWN then
AudioControlTest._duration = cc.AudioEngine:getDuration(AudioControlTest._audioID)
AudioControlTest._duration = ccexp.AudioEngine:getDuration(AudioControlTest._audioID)
end
if AudioControlTest._duration ~= cc.AUDIO_TIME_UNKNOWN then
local time = cc.AudioEngine:getCurrentTime(AudioControlTest._audioID)
local time = ccexp.AudioEngine:getCurrentTime(AudioControlTest._audioID)
AudioControlTest._timeRatio = time / AudioControlTest._duration
if AudioControlTest._updateTimeSlider then
AudioControlTest._timeSlider:setRatio(AudioControlTest._timeRatio)
@ -277,7 +277,7 @@ function AudioControlTest.create()
function onNodeEvent(tag)
if tag == "exit" then
cc.AudioEngine:stopAll()
ccexp.AudioEngine:stopAll()
end
end
layer:registerScriptHandler(onNodeEvent)
@ -302,7 +302,7 @@ function PlaySimultaneouslyTest.create()
local audioID = cc.AUDIO_INVAILD_ID
--for k, v in pairs(PlaySimultaneouslyTest.files) do
for index=1,10 do
audioID = cc.AudioEngine:play2d(PlaySimultaneouslyTest.files[index])
audioID = ccexp.AudioEngine:play2d(PlaySimultaneouslyTest.files[index])
if audioID ~= cc.AUDIO_INVAILD_ID then
PlaySimultaneouslyTest._playItem:setEnabled(false)
@ -315,7 +315,7 @@ function PlaySimultaneouslyTest.create()
end
end
cc.AudioEngine:setFinishCallback(audioID,finishCallback)
ccexp.AudioEngine:setFinishCallback(audioID,finishCallback)
end
end
end
@ -330,7 +330,7 @@ function PlaySimultaneouslyTest.create()
function onNodeEvent(tag)
if tag == "exit" then
cc.AudioEngine:stopAll()
ccexp.AudioEngine:stopAll()
end
end
layer:registerScriptHandler(onNodeEvent)
@ -358,7 +358,7 @@ function AudioProfileTest.create()
AudioProfileTest._files[3] = "background.wav"
AudioProfileTest._files[4] = "pew-pew-lei.wav"
AudioProfileTest._profile = cc.AudioProfile:new()
AudioProfileTest._profile = ccexp.AudioProfile:new()
AudioProfileTest._profile.name = "AudioProfileTest"
AudioProfileTest._profile.maxInstances = 3
AudioProfileTest._profile.minDelay = 1.0
@ -374,7 +374,7 @@ function AudioProfileTest.create()
local heightRatio = 0.7
for index=1,4 do
local function itemClickCallback(tag, sender)
local audioID = cc.AudioEngine:play2d(AudioProfileTest._files[tag],false,1.0,AudioProfileTest._profile)
local audioID = ccexp.AudioEngine:play2d(AudioProfileTest._files[tag],false,1.0,AudioProfileTest._profile)
if audioID ~= cc.AUDIO_INVAILD_ID then
AudioProfileTest._time = AudioProfileTest._minDelay
AudioProfileTest._audioCount = AudioProfileTest._audioCount + 1
@ -385,7 +385,7 @@ function AudioProfileTest.create()
AudioProfileTest._showLabel:setString(string.format("audio count:%d",AudioProfileTest._audioCount))
end
cc.AudioEngine:setFinishCallback(audioID,finishCallback)
ccexp.AudioEngine:setFinishCallback(audioID,finishCallback)
end
end
@ -431,7 +431,7 @@ function AudioProfileTest.create()
function onNodeEvent(tag)
if tag == "exit" then
cc.AudioEngine:stopAll()
ccexp.AudioEngine:stopAll()
end
end
layer:registerScriptHandler(onNodeEvent)
@ -452,10 +452,10 @@ function InvalidAudioFileTest.create()
local function playUnsupportedAudio(tag, sender)
local targetPlatform = cc.Application:getInstance():getTargetPlatform()
if (cc.PLATFORM_OS_IPHONE == targetPlatform or cc.PLATFORM_OS_IPAD == targetPlatform) then
cc.AudioEngine:play2d("background.ogg")
ccexp.AudioEngine:play2d("background.ogg")
end
if (cc.PLATFORM_OS_ANDROID == targetPlatform) then
cc.AudioEngine:play2d("background.caf")
ccexp.AudioEngine:play2d("background.caf")
end
end
@ -465,7 +465,7 @@ function InvalidAudioFileTest.create()
-- not-existent audio
local function playNotExistentAudio(tag, sender)
cc.AudioEngine:play2d("not-existent file.mp3")
ccexp.AudioEngine:play2d("not-existent file.mp3")
end
local playItem2 = cc.MenuItemFont:create("play not-existent file")
@ -490,7 +490,7 @@ function LargeAudioFileTest.create()
local layerSize = layer:getContentSize()
local function playAudio(tag, sender)
cc.AudioEngine:play2d("audio/Chee Lai(Arise).mp3")
ccexp.AudioEngine:play2d("audio/Chee Lai(Arise).mp3")
end
local playItem = cc.MenuItemFont:create("play large audio file")
@ -503,7 +503,7 @@ function LargeAudioFileTest.create()
function onNodeEvent(tag)
if tag == "exit" then
cc.AudioEngine:stopAll()
ccexp.AudioEngine:stopAll()
end
end
layer:registerScriptHandler(onNodeEvent)

View File

@ -5,7 +5,7 @@ prefix = cocos2dx_audioengine
# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`)
# all classes will be embedded in that namespace
target_namespace = cc
target_namespace = ccexp
android_headers = -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/include
android_flags = -D_SIZE_T_DEFINED_