[LUA]Add New AudioEngine on window

This commit is contained in:
Dhilan007 2014-10-17 17:53:33 +08:00
parent 4bede5067e
commit 81a8e80496
9 changed files with 27 additions and 13 deletions

View File

@ -21,7 +21,10 @@
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 || CC_TARGET_PLATFORM == CC_PLATFORM_MAC
#include "platform/CCPlatformConfig.h"
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
#include "lua_cocos2dx_audioengine_manual.h"
#include "lua_cocos2dx_audioengine_auto.hpp"
#include "tolua_fix.h"

View File

@ -24,7 +24,6 @@
#ifndef COCOS_SCRIPTING_LUA_BINDINGS_MANUAL_AUDIOENGINE_LUA_COCOS2DX_AUDIOENGINE_MANUAL_H__
#define COCOS_SCRIPTING_LUA_BINDINGS_MANUAL_AUDIOENGINE_LUA_COCOS2DX_AUDIOENGINE_MANUAL_H__
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC
#ifdef __cplusplus
extern "C" {
#endif
@ -35,6 +34,5 @@ extern "C" {
TOLUA_API int register_audioengine_module(lua_State* L);
#endif
#endif // #ifndef COCOS_SCRIPTING_LUA_BINDINGS_MANUAL_AUDIOENGINE_LUA_COCOS2DX_AUDIOENGINE_MANUAL_H__

View File

@ -37,6 +37,7 @@
<ClCompile Include="..\..\..\..\external\lua\tolua\tolua_to.c" />
<ClCompile Include="..\..\..\..\external\xxtea\xxtea.cpp" />
<ClCompile Include="..\auto\lua_cocos2dx_3d_auto.cpp" />
<ClCompile Include="..\auto\lua_cocos2dx_audioengine_auto.cpp" />
<ClCompile Include="..\auto\lua_cocos2dx_auto.cpp" />
<ClCompile Include="..\auto\lua_cocos2dx_cocosbuilder_auto.cpp" />
<ClCompile Include="..\auto\lua_cocos2dx_cocosdenshion_auto.cpp" />
@ -48,6 +49,7 @@
<ClCompile Include="..\auto\lua_cocos2dx_studio_auto.cpp" />
<ClCompile Include="..\auto\lua_cocos2dx_ui_auto.cpp" />
<ClCompile Include="..\manual\3d\lua_cocos2dx_3d_manual.cpp" />
<ClCompile Include="..\manual\audioengine\lua_cocos2dx_audioengine_manual.cpp" />
<ClCompile Include="..\manual\CCLuaBridge.cpp" />
<ClCompile Include="..\manual\CCLuaEngine.cpp" />
<ClCompile Include="..\manual\CCLuaStack.cpp" />
@ -105,6 +107,7 @@
<ClInclude Include="..\..\..\..\external\lua\tolua\tolua_event.h" />
<ClInclude Include="..\..\..\..\external\xxtea\xxtea.h" />
<ClInclude Include="..\auto\lua_cocos2dx_3d_auto.hpp" />
<ClInclude Include="..\auto\lua_cocos2dx_audioengine_auto.hpp" />
<ClInclude Include="..\auto\lua_cocos2dx_auto.hpp" />
<ClInclude Include="..\auto\lua_cocos2dx_cocosbuilder_auto.hpp" />
<ClInclude Include="..\auto\lua_cocos2dx_cocosdenshion_auto.hpp" />
@ -116,6 +119,7 @@
<ClInclude Include="..\auto\lua_cocos2dx_studio_auto.hpp" />
<ClInclude Include="..\auto\lua_cocos2dx_ui_auto.hpp" />
<ClInclude Include="..\manual\3d\lua_cocos2dx_3d_manual.h" />
<ClInclude Include="..\manual\audioengine\lua_cocos2dx_audioengine_manual.h" />
<ClInclude Include="..\manual\CCLuaBridge.h" />
<ClInclude Include="..\manual\CCLuaEngine.h" />
<ClInclude Include="..\manual\CCLuaStack.h" />

View File

@ -73,6 +73,9 @@
<Filter Include="quick">
<UniqueIdentifier>{e6d6c5da-e7da-40cf-bde0-f383f9dd9dbe}</UniqueIdentifier>
</Filter>
<Filter Include="manual\audioengine">
<UniqueIdentifier>{08e7d51a-6f8a-4e54-8abe-a86101be8dad}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\auto\lua_cocos2dx_auto.cpp">
@ -267,6 +270,12 @@
<ClCompile Include="..\..\..\..\external\lua\quick\LuaNodeManager.cpp">
<Filter>quick</Filter>
</ClCompile>
<ClCompile Include="..\auto\lua_cocos2dx_audioengine_auto.cpp">
<Filter>auto</Filter>
</ClCompile>
<ClCompile Include="..\manual\audioengine\lua_cocos2dx_audioengine_manual.cpp">
<Filter>manual\audioengine</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\auto\lua_cocos2dx_auto.hpp">
@ -467,6 +476,12 @@
<ClInclude Include="..\..\..\..\external\lua\quick\LuaEventNode.h">
<Filter>quick</Filter>
</ClInclude>
<ClInclude Include="..\auto\lua_cocos2dx_audioengine_auto.hpp">
<Filter>auto</Filter>
</ClInclude>
<ClInclude Include="..\manual\audioengine\lua_cocos2dx_audioengine_manual.h">
<Filter>manual\audioengine</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\script\CCBReaderLoad.lua">

View File

@ -23,9 +23,7 @@ int lua_module_register(lua_State* L)
register_extension_module(L);
register_spine_module(L);
register_cocos3d_module(L);
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS
register_audioengine_module(L);
#endif
return 1;
}

View File

@ -23,9 +23,7 @@ int lua_module_register(lua_State* L)
register_network_module(L);
register_cocosdenshion_module(L);
register_cocos3d_module(L);
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC
register_audioengine_module(L);
#endif
return 1;
}

View File

@ -352,11 +352,9 @@ function AudioProfileTest.create()
local targetPlatform = cc.Application:getInstance():getTargetPlatform()
if (cc.PLATFORM_OS_MAC == targetPlatform or cc.PLATFORM_OS_IPHONE == targetPlatform or cc.PLATFORM_OS_IPAD == targetPlatform) then
AudioProfileTest._files[2] = "background.caf"
elseif (cc.PLATFORM_OS_ANDROID == targetPlatform) then
else
AudioProfileTest._files[2] = "background.ogg"
end
AudioProfileTest._files[3] = "background.wav"
AudioProfileTest._files[4] = "pew-pew-lei.wav"
AudioProfileTest._profile = ccexp.AudioProfile:new()
AudioProfileTest._profile.name = "AudioProfileTest"
@ -372,7 +370,7 @@ function AudioProfileTest.create()
layer:addChild(menu)
local heightRatio = 0.7
for index=1,4 do
for index=1,2 do
local function itemClickCallback(tag, sender)
local audioID = ccexp.AudioEngine:play2d(AudioProfileTest._files[tag],false,1.0,AudioProfileTest._profile)
if audioID ~= cc.AUDIO_INVAILD_ID then

View File

@ -62,7 +62,7 @@ local BeginPos = {x = 0, y = 0}
local audioEndineSupported = false
local currPlatform = cc.Application:getInstance():getTargetPlatform()
if (cc.PLATFORM_OS_MAC == currPlatform or cc.PLATFORM_OS_IPHONE == currPlatform or cc.PLATFORM_OS_IPAD == currPlatform or cc.PLATFORM_OS_ANDROID == currPlatform) then
if (cc.PLATFORM_OS_WINDOWS == currPlatform or cc.PLATFORM_OS_MAC == currPlatform or cc.PLATFORM_OS_IPHONE == currPlatform or cc.PLATFORM_OS_IPAD == currPlatform or cc.PLATFORM_OS_ANDROID == currPlatform) then
audioEndineSupported = true
end

View File

@ -7,7 +7,7 @@ prefix = cocos2dx_audioengine
# all classes will be embedded in that namespace
target_namespace = ccexp
macro_judgement = #if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC
macro_judgement = #if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
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_