From 7ec770844b386658254821a42b4f9d90b9bfc2a0 Mon Sep 17 00:00:00 2001 From: natural-law Date: Fri, 12 Nov 2010 03:51:17 +0000 Subject: [PATCH] issue #168 debug of TestAudioEngine project --- TestAudioEngine/Makefile.ARM | 4 +- .../Res/TestAudioEngine_Res.ENU.tr3 | 15 +- .../Res/TestAudioEngine_Res.ENU.tr3.tts | 2 +- TestAudioEngine/Res/TestAudioEngine_Res.TR3 | 14 +- TestAudioEngine/Res/TestAudioEngine_Res.h | 5 +- TestAudioEngine/Res/testaudioengine_res_c.h | 1087 ----------------- .../testaudioengine_res_c.h.REMOVED.git-id | 1 + TestAudioEngine/Res/testaudioengine_res_def.h | 5 +- TestAudioEngine/Res/testaudioengine_res_h.h | 2 +- TestAudioEngine/TestAudioEngine.vcproj | 14 +- TestAudioEngine/TestAudioEngineEntry.cpp | 2 +- TestAudioEngine/TestAudioEngineMainForm.cpp | 28 +- TestAudioEngine/TestAudioEngine_Arm.TMK3 | 4 +- 13 files changed, 73 insertions(+), 1110 deletions(-) delete mode 100644 TestAudioEngine/Res/testaudioengine_res_c.h create mode 100644 TestAudioEngine/Res/testaudioengine_res_c.h.REMOVED.git-id diff --git a/TestAudioEngine/Makefile.ARM b/TestAudioEngine/Makefile.ARM index b8f4384a38..8d916e3fca 100644 --- a/TestAudioEngine/Makefile.ARM +++ b/TestAudioEngine/Makefile.ARM @@ -14,8 +14,8 @@ include $(TO_PROJECT_ROOT)/MakeInclude/Makefile_TOPS_Def.ARM DEFINES += -DUNDER_UPHONE INCLUDE_PATH += -I. -I./Res \ - -I../CocosDenshion -LIBS += -lCocosDenshion + -I../CocosDenshion/include +LIBS += -lCocosDenshion -lTSoundPlayer OBJECTS_DIR = ./Debug-ARM DESTDIR = $(TO_PROJECT_ROOT)/$(BIN_OUTPUT_DIR) diff --git a/TestAudioEngine/Res/TestAudioEngine_Res.ENU.tr3 b/TestAudioEngine/Res/TestAudioEngine_Res.ENU.tr3 index 1f019188f9..1a5c0b468b 100644 --- a/TestAudioEngine/Res/TestAudioEngine_Res.ENU.tr3 +++ b/TestAudioEngine/Res/TestAudioEngine_Res.ENU.tr3 @@ -1,9 +1,9 @@ // Original file name: TestAudioEngine_Res.ENU.tr3 -// Generated by TOPS Builder 1.2.3.235 Date:2010-9-29 +// Generated by TOPS Builder 1.2.3.239 Date:2010-11-2 -//$VERSION 60004 +//$VERSION 60005 //$SETTINGS //$Begin //$VCPRJFILE=$002E$002E$005C$0054$0065$0073$0074$0041$0075$0064$0069$006F$0045$006E$0067$0069$006E$0065$002E$0076$0063$0070$0072$006F$006A @@ -28,6 +28,8 @@ FORM ID Form1002 AT(0,0,320,480) FRAME NOSAVEBEHIND BIClose + DisableSystemStatusBar + FullScreen VISIBLED ENABLED CHARSET 0 @@ -149,5 +151,14 @@ BEGIN END // raw data +RAWDATA ID background FileName $0073$006F$0075$006E$0064$0073$005C$0062$0061$0063$006B$0067$0072$006F$0075$006E$0064$002E$006D$0070$0033 +//sounds\background.mp3 + +RAWDATA ID Effect1 FileName $0073$006F$0075$006E$0064$0073$005C$0045$0066$0066$0065$0063$0074$0031$002E$0077$0061$0076 +//sounds\Effect1.wav + +RAWDATA ID Effect2 FileName $0073$006F$0075$006E$0064$0073$005C$0045$0066$0066$0065$0063$0074$0032$002E$0077$0061$0076 +//sounds\Effect2.wav + // Application diff --git a/TestAudioEngine/Res/TestAudioEngine_Res.ENU.tr3.tts b/TestAudioEngine/Res/TestAudioEngine_Res.ENU.tr3.tts index a1d0cfdc15..4114fc5c84 100644 --- a/TestAudioEngine/Res/TestAudioEngine_Res.ENU.tr3.tts +++ b/TestAudioEngine/Res/TestAudioEngine_Res.ENU.tr3.tts @@ -4,6 +4,6 @@ // update the controls' trnaslation status. // Original file name: TestAudioEngine_Res.ENU.tr3.tts -// Generated by TOPS Builder 1.2.3.235 Date:2010-9-29 +// Generated by TOPS Builder 1.2.3.239 Date:2010-11-2 diff --git a/TestAudioEngine/Res/TestAudioEngine_Res.TR3 b/TestAudioEngine/Res/TestAudioEngine_Res.TR3 index 05b682099c..a09beef999 100644 --- a/TestAudioEngine/Res/TestAudioEngine_Res.TR3 +++ b/TestAudioEngine/Res/TestAudioEngine_Res.TR3 @@ -1,11 +1,11 @@ // Original file name: TestAudioEngine_Res.TR3 -// Generated by TOPS Builder 1.2.3.235 Date:2010-9-29 +// Generated by TOPS Builder 1.2.3.239 Date:2010-11-2 #include "TestAudioEngine_Res.h" -//$VERSION 60004 +//$VERSION 60005 //$SETTINGS //$Begin //$VCPRJFILE=$002E$002E$005C$0054$0065$0073$0074$0041$0075$0064$0069$006F$0045$006E$0067$0069$006E$0065$002E$0076$0063$0070$0072$006F$006A @@ -30,6 +30,7 @@ FORM ID Form1002 AT(0,0,320,480) FRAME NOSAVEBEHIND BIClose + DisableSystemStatusBar FullScreen VISIBLED ENABLED @@ -152,5 +153,14 @@ BEGIN END // raw data +RAWDATA ID background FileName $0073$006F$0075$006E$0064$0073$005C$0062$0061$0063$006B$0067$0072$006F$0075$006E$0064$002E$006D$0070$0033 +//sounds\background.mp3 + +RAWDATA ID Effect1 FileName $0073$006F$0075$006E$0064$0073$005C$0045$0066$0066$0065$0063$0074$0031$002E$0077$0061$0076 +//sounds\Effect1.wav + +RAWDATA ID Effect2 FileName $0073$006F$0075$006E$0064$0073$005C$0045$0066$0066$0065$0063$0074$0032$002E$0077$0061$0076 +//sounds\Effect2.wav + // Application diff --git a/TestAudioEngine/Res/TestAudioEngine_Res.h b/TestAudioEngine/Res/TestAudioEngine_Res.h index a3fcb74261..01085b013f 100644 --- a/TestAudioEngine/Res/TestAudioEngine_Res.h +++ b/TestAudioEngine/Res/TestAudioEngine_Res.h @@ -1,5 +1,5 @@ // Original file name: TestAudioEngine_Res.h -// Generated by TOPS Builder 1.2.3.235 Date:2010-9-29 +// Generated by TOPS Builder 1.2.3.239 Date:2010-11-2 #define ResFolder1001 1001 #define Form1002 1002 @@ -9,3 +9,6 @@ #define PlayLoaded 1006 #define PlayEffect 1007 #define UnLoadBtn 1008 +#define background 1009 +#define Effect1 1010 +#define Effect2 1011 diff --git a/TestAudioEngine/Res/testaudioengine_res_c.h b/TestAudioEngine/Res/testaudioengine_res_c.h deleted file mode 100644 index c729364437..0000000000 --- a/TestAudioEngine/Res/testaudioengine_res_c.h +++ /dev/null @@ -1,1087 +0,0 @@ -//------------------------------------------------------------------------------ -// TestAudioEngine_Res_c.h -// 资源编译器转换文件数据定义文件 -// -// -// Copyright (C) Tranzda CORPORATION -// -//---┤编译器信息├--- -// 编译器名称: TR3C.exe -// 编译器版本: TG3 资源编译器 版本V1.5 Build 91 -// -//---┤注意├--- -// 警告:未经允许,任何人不准擅自修改此文件!!!否则后果自负! -// -//------------------------------------------------------------------------------ -#include "testaudioengine_res_h.h" //类型定义头文件 -#ifndef WIN32 -//#pragma diag_remark 1296 -#endif -#if 11 + + + + + + diff --git a/TestAudioEngine/TestAudioEngineEntry.cpp b/TestAudioEngine/TestAudioEngineEntry.cpp index 7eebf233cc..15247292c6 100644 --- a/TestAudioEngine/TestAudioEngineEntry.cpp +++ b/TestAudioEngine/TestAudioEngineEntry.cpp @@ -14,7 +14,7 @@ const ResourceRegisterEntry ResRegList_TestAudioEngine[] = TG_RESOURCE_DEFINE }; -const AppResourceEntry TestAudioEngineResourceEntry = +extern const AppResourceEntry TestAudioEngineResourceEntry = { (ResourceRegisterEntry*)ResRegList_TestAudioEngine, // res list in this app sizeof(ResRegList_TestAudioEngine) / sizeof(ResourceRegisterEntry), //number of item in res diff --git a/TestAudioEngine/TestAudioEngineMainForm.cpp b/TestAudioEngine/TestAudioEngineMainForm.cpp index ff2ca4595a..f23a229527 100644 --- a/TestAudioEngine/TestAudioEngineMainForm.cpp +++ b/TestAudioEngine/TestAudioEngineMainForm.cpp @@ -11,9 +11,18 @@ #include "SimpleAudioEngine.h" #include -const static char s_BackgroundFile[] = "/NEWPLUS/TDA_DATA/UserData/background.mp3"; -const static char s_Effect1File[] = "/NEWPLUS/TDA_DATA/UserData/Effect1.mp3"; -const static char s_Effect2File[] = "/NEWPLUS/TDA_DATA/UserData/Effect2.mp3"; +extern const AppResourceEntry TestAudioEngineResourceEntry; + +/** +@warning 在声音数据信息的结构体中,FileName必须包含文件的扩展名,并且需要与原始文件的扩展名一致 +否则无法播。另:音效文件只支持 wav 格式。 +*/ +const T_SoundResInfo SoundResInfo[] = +{ + { "background.mp3", TESTAU_ID_RAWDATA_background }, + { "Effect1.wav", TESTAU_ID_RAWDATA_Effect1 }, + { "Effect2.wav", TESTAU_ID_RAWDATA_Effect2 }, +}; TMainForm::TMainForm(TApplication * pApp):TWindow(pApp) , m_nEffect1ID(0) @@ -35,6 +44,8 @@ Boolean TMainForm::EventHandler(TApplication * pApp, EventType * pEvent) { case EVENT_WinInit: { + SimpleAudioEngine::getSharedEngine()->setResourceEntry(&TestAudioEngineResourceEntry); + SimpleAudioEngine::getSharedEngine()->setSoundResInfo(SoundResInfo, sizeof(SoundResInfo) / sizeof(T_SoundResInfo)); bHandled = TRUE; } break; @@ -79,8 +90,8 @@ Boolean TMainForm::CtrlSelected(TApplication * pApp, EventType * pEvent) { case TESTAU_ID_Form1002_PlayBack: // play background music - pAudioEngine->playBackgroundMusic(s_BackgroundFile, true); pAudioEngine->SetBackgroundMusicVolume(30); + pAudioEngine->playBackgroundMusic(SoundResInfo[0].FileName, true); bHandled = TRUE; break; @@ -92,7 +103,7 @@ Boolean TMainForm::CtrlSelected(TApplication * pApp, EventType * pEvent) case TESTAU_ID_Form1002_LoadEffect: // load effect1 - m_nEffect1ID = pAudioEngine->preloadEffect(s_Effect1File); + m_nEffect1ID = pAudioEngine->preloadEffect(SoundResInfo[1].FileName); assert(m_nEffect1ID > 0); bHandled = TRUE; break; @@ -112,17 +123,16 @@ Boolean TMainForm::CtrlSelected(TApplication * pApp, EventType * pEvent) } else { - pAudioEngine->playPreloadedEffect(m_nEffect1ID); pAudioEngine->SetEffectsVolume(30); + pAudioEngine->playPreloadedEffect(m_nEffect1ID); } bHandled = TRUE; break; case TESTAU_ID_Form1002_PlayEffect: // play effect2 - m_nEffect2ID = pAudioEngine->playEffect(s_Effect2File); - assert(m_nEffect2ID > 0); - pAudioEngine->SetEffectsVolume(30); + m_nEffect2ID = pAudioEngine->playEffect(SoundResInfo[2].FileName); + assert(m_nEffect2ID > 0); bHandled = TRUE; break; default: diff --git a/TestAudioEngine/TestAudioEngine_Arm.TMK3 b/TestAudioEngine/TestAudioEngine_Arm.TMK3 index 86a1e36af2..042347e66e 100644 --- a/TestAudioEngine/TestAudioEngine_Arm.TMK3 +++ b/TestAudioEngine/TestAudioEngine_Arm.TMK3 @@ -34,10 +34,10 @@ DEFINES=-DUNDER_UPHONE ; ;DEFINES=-D__TCOM_SUPPORT__ ;生成的是TCOM组件(注意:TOPS应用也可以同时是TCOM组件) ;包含路径,可以使用多个INCLUDE_PATH串,也可以使用INCLUDE_PATH1、INCLUDE_PATH2等方式,MakeFile中依据出现顺序(不是数字大小)排列 -INCLUDE_PATH=-I../CocosDenshion ;应用额外的包含路径。注意:ITOPS自己的所有路径都会自动包含,故此这里仅仅包含应用自己特有的路径即可 +INCLUDE_PATH=-I../CocosDenshion/include ;应用额外的包含路径。注意:ITOPS自己的所有路径都会自动包含,故此这里仅仅包含应用自己特有的路径即可 ;连接的库文件,可以使用多个LIBS串,也可以使用LIBS1、LIBS2等方式,MakeFile中依据出现顺序(不是数字大小)排列 -LIBS=-lCocosDenshion ;应用额外的连接库。注意:ITOPS自己的所需库自动包含,而且库包含路径也已经包含,故此这里仅仅包含应用自己特有的库的名字即可 +LIBS=-lCocosDenshion -lTSoundPlayer ;应用额外的连接库。注意:ITOPS自己的所需库自动包含,而且库包含路径也已经包含,故此这里仅仅包含应用自己特有的库的名字即可 ;强制包含文件的名字,不能使用通配符,一定要使用相对或者绝对路径 ;极力要求使用相对路径,多个文件之间使用“|”分隔