From 81a8e80496c690463b1f65b968b35b7431c01c29 Mon Sep 17 00:00:00 2001 From: Dhilan007 Date: Fri, 17 Oct 2014 17:53:33 +0800 Subject: [PATCH] [LUA]Add New AudioEngine on window --- .../lua_cocos2dx_audioengine_manual.cpp | 5 ++++- .../audioengine/lua_cocos2dx_audioengine_manual.h | 2 -- .../lua-bindings/proj.win32/libluacocos2d.vcxproj | 4 ++++ .../proj.win32/libluacocos2d.vcxproj.filters | 15 +++++++++++++++ .../runtime-src/Classes/lua_module_register.h | 2 -- .../project/Classes/lua_module_register.h | 2 -- .../src/NewAudioEngineTest/NewAudioEngineTest.lua | 6 ++---- tests/lua-tests/src/mainMenu.lua | 2 +- tools/tolua/cocos2dx_audioengine.ini | 2 +- 9 files changed, 27 insertions(+), 13 deletions(-) diff --git a/cocos/scripting/lua-bindings/manual/audioengine/lua_cocos2dx_audioengine_manual.cpp b/cocos/scripting/lua-bindings/manual/audioengine/lua_cocos2dx_audioengine_manual.cpp index 7548076b03..8a4fd74f20 100644 --- a/cocos/scripting/lua-bindings/manual/audioengine/lua_cocos2dx_audioengine_manual.cpp +++ b/cocos/scripting/lua-bindings/manual/audioengine/lua_cocos2dx_audioengine_manual.cpp @@ -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" diff --git a/cocos/scripting/lua-bindings/manual/audioengine/lua_cocos2dx_audioengine_manual.h b/cocos/scripting/lua-bindings/manual/audioengine/lua_cocos2dx_audioengine_manual.h index 4c55fe45a1..29e0b9a08d 100644 --- a/cocos/scripting/lua-bindings/manual/audioengine/lua_cocos2dx_audioengine_manual.h +++ b/cocos/scripting/lua-bindings/manual/audioengine/lua_cocos2dx_audioengine_manual.h @@ -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__ diff --git a/cocos/scripting/lua-bindings/proj.win32/libluacocos2d.vcxproj b/cocos/scripting/lua-bindings/proj.win32/libluacocos2d.vcxproj index 41ad3062b1..ae56cff4bc 100644 --- a/cocos/scripting/lua-bindings/proj.win32/libluacocos2d.vcxproj +++ b/cocos/scripting/lua-bindings/proj.win32/libluacocos2d.vcxproj @@ -37,6 +37,7 @@ + @@ -48,6 +49,7 @@ + @@ -105,6 +107,7 @@ + @@ -116,6 +119,7 @@ + diff --git a/cocos/scripting/lua-bindings/proj.win32/libluacocos2d.vcxproj.filters b/cocos/scripting/lua-bindings/proj.win32/libluacocos2d.vcxproj.filters index 6342a52931..0dd25138b7 100644 --- a/cocos/scripting/lua-bindings/proj.win32/libluacocos2d.vcxproj.filters +++ b/cocos/scripting/lua-bindings/proj.win32/libluacocos2d.vcxproj.filters @@ -73,6 +73,9 @@ {e6d6c5da-e7da-40cf-bde0-f383f9dd9dbe} + + {08e7d51a-6f8a-4e54-8abe-a86101be8dad} + @@ -267,6 +270,12 @@ quick + + auto + + + manual\audioengine + @@ -467,6 +476,12 @@ quick + + auto + + + manual\audioengine + diff --git a/templates/lua-template-default/frameworks/runtime-src/Classes/lua_module_register.h b/templates/lua-template-default/frameworks/runtime-src/Classes/lua_module_register.h index 202e56e99a..86a73db8e0 100644 --- a/templates/lua-template-default/frameworks/runtime-src/Classes/lua_module_register.h +++ b/templates/lua-template-default/frameworks/runtime-src/Classes/lua_module_register.h @@ -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; } diff --git a/tests/lua-tests/project/Classes/lua_module_register.h b/tests/lua-tests/project/Classes/lua_module_register.h index d32d09f607..1f560f4ac3 100644 --- a/tests/lua-tests/project/Classes/lua_module_register.h +++ b/tests/lua-tests/project/Classes/lua_module_register.h @@ -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; } diff --git a/tests/lua-tests/src/NewAudioEngineTest/NewAudioEngineTest.lua b/tests/lua-tests/src/NewAudioEngineTest/NewAudioEngineTest.lua index d737b8a29c..b2d1fd0f71 100644 --- a/tests/lua-tests/src/NewAudioEngineTest/NewAudioEngineTest.lua +++ b/tests/lua-tests/src/NewAudioEngineTest/NewAudioEngineTest.lua @@ -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 diff --git a/tests/lua-tests/src/mainMenu.lua b/tests/lua-tests/src/mainMenu.lua index 31ba5cd10d..bf99e88158 100644 --- a/tests/lua-tests/src/mainMenu.lua +++ b/tests/lua-tests/src/mainMenu.lua @@ -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 diff --git a/tools/tolua/cocos2dx_audioengine.ini b/tools/tolua/cocos2dx_audioengine.ini index 2f608e0d8f..717f3e62fe 100644 --- a/tools/tolua/cocos2dx_audioengine.ini +++ b/tools/tolua/cocos2dx_audioengine.ini @@ -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_