Changeset 3887 in orxonox.OLD for orxonox/branches
- Timestamp:
- Apr 19, 2005, 12:28:55 AM (20 years ago)
- Location:
- orxonox/branches/sound_engine/src
- Files:
-
- 1 added
- 4 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/sound_engine/src/Makefile.am
r3869 r3887 8 8 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/graphics 9 9 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/graphics/importer 10 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/sound 10 11 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/gui 11 12 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/lang … … 69 70 lib/graphics/importer/material.cc \ 70 71 lib/graphics/importer/texture.cc \ 72 lib/sound/sound_engine.cc \ 71 73 lib/lang/base_entity.cc \ 72 74 lib/lang/base_object.cc \ … … 125 127 lib/graphics/light.h \ 126 128 lib/graphics/text_engine.h \ 129 lib/sound/sound_engine.h \ 127 130 lib/data/data_tank.h \ 128 131 lib/lang/base_entity.h \ -
orxonox/branches/sound_engine/src/Makefile.in
r3869 r3887 68 68 text_engine.$(OBJEXT) array.$(OBJEXT) objModel.$(OBJEXT) \ 69 69 primitive_model.$(OBJEXT) model.$(OBJEXT) material.$(OBJEXT) \ 70 texture.$(OBJEXT) base_entity.$(OBJEXT) base_object.$(OBJEXT) \ 71 ini_parser.$(OBJEXT) list.$(OBJEXT) resource_manager.$(OBJEXT) \ 72 vector.$(OBJEXT) curve.$(OBJEXT) glmenu_imagescreen.$(OBJEXT) 70 texture.$(OBJEXT) sound_engine.$(OBJEXT) base_entity.$(OBJEXT) \ 71 base_object.$(OBJEXT) ini_parser.$(OBJEXT) list.$(OBJEXT) \ 72 resource_manager.$(OBJEXT) vector.$(OBJEXT) curve.$(OBJEXT) \ 73 glmenu_imagescreen.$(OBJEXT) 73 74 orxonox_OBJECTS = $(am_orxonox_OBJECTS) 74 75 orxonox_LDADD = $(LDADD) … … 102 103 @AMDEP_TRUE@ ./$(DEPDIR)/satellite.Po ./$(DEPDIR)/skybox.Po \ 103 104 @AMDEP_TRUE@ ./$(DEPDIR)/skysphere.Po \ 105 @AMDEP_TRUE@ ./$(DEPDIR)/sound_engine.Po \ 104 106 @AMDEP_TRUE@ ./$(DEPDIR)/story_entity.Po ./$(DEPDIR)/terrain.Po \ 105 107 @AMDEP_TRUE@ ./$(DEPDIR)/test_bullet.Po ./$(DEPDIR)/test_gun.Po \ … … 237 239 target_vendor = @target_vendor@ 238 240 MAINSRCDIR = . 239 AM_CXXFLAGS = -I$(MAINSRCDIR) -I$(MAINSRCDIR)/world_entities -I$(MAINSRCDIR)/story_entities -I$(MAINSRCDIR)/lib -I$(MAINSRCDIR)/lib/coord -I$(MAINSRCDIR)/lib/data -I$(MAINSRCDIR)/lib/graphics -I$(MAINSRCDIR)/lib/graphics/importer -I$(MAINSRCDIR)/lib/ gui -I$(MAINSRCDIR)/lib/lang -I$(MAINSRCDIR)/lib/util -I$(MAINSRCDIR)/lib/math -I$(MAINSRCDIR)/defs -I$(MAINSRCDIR)/font -I$(MAINSRCDIR)/network -I$(MAINSRCDIR)/glmenu -I$(MAINSRCDIR)/ai -I$(MAINSRCDIR)/util -I$(MAINSRCDIR)/util/animation -I$(MAINSRCDIR)/util/common241 AM_CXXFLAGS = -I$(MAINSRCDIR) -I$(MAINSRCDIR)/world_entities -I$(MAINSRCDIR)/story_entities -I$(MAINSRCDIR)/lib -I$(MAINSRCDIR)/lib/coord -I$(MAINSRCDIR)/lib/data -I$(MAINSRCDIR)/lib/graphics -I$(MAINSRCDIR)/lib/graphics/importer -I$(MAINSRCDIR)/lib/sound -I$(MAINSRCDIR)/lib/gui -I$(MAINSRCDIR)/lib/lang -I$(MAINSRCDIR)/lib/util -I$(MAINSRCDIR)/lib/math -I$(MAINSRCDIR)/defs -I$(MAINSRCDIR)/font -I$(MAINSRCDIR)/network -I$(MAINSRCDIR)/glmenu -I$(MAINSRCDIR)/ai -I$(MAINSRCDIR)/util -I$(MAINSRCDIR)/util/animation -I$(MAINSRCDIR)/util/common 240 242 AM_LDFLAGS = $(MWINDOWS) 241 243 orxonox_SOURCES = orxonox.cc \ … … 279 281 lib/graphics/importer/material.cc \ 280 282 lib/graphics/importer/texture.cc \ 283 lib/sound/sound_engine.cc \ 281 284 lib/lang/base_entity.cc \ 282 285 lib/lang/base_object.cc \ … … 335 338 lib/graphics/light.h \ 336 339 lib/graphics/text_engine.h \ 340 lib/sound/sound_engine.h \ 337 341 lib/data/data_tank.h \ 338 342 lib/lang/base_entity.h \ … … 461 465 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/skybox.Po@am__quote@ 462 466 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/skysphere.Po@am__quote@ 467 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sound_engine.Po@am__quote@ 463 468 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/story_entity.Po@am__quote@ 464 469 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/terrain.Po@am__quote@ … … 1017 1022 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1018 1023 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o texture.obj `if test -f 'lib/graphics/importer/texture.cc'; then $(CYGPATH_W) 'lib/graphics/importer/texture.cc'; else $(CYGPATH_W) '$(srcdir)/lib/graphics/importer/texture.cc'; fi` 1024 1025 sound_engine.o: lib/sound/sound_engine.cc 1026 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sound_engine.o -MD -MP -MF "$(DEPDIR)/sound_engine.Tpo" -c -o sound_engine.o `test -f 'lib/sound/sound_engine.cc' || echo '$(srcdir)/'`lib/sound/sound_engine.cc; \ 1027 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/sound_engine.Tpo" "$(DEPDIR)/sound_engine.Po"; else rm -f "$(DEPDIR)/sound_engine.Tpo"; exit 1; fi 1028 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='lib/sound/sound_engine.cc' object='sound_engine.o' libtool=no @AMDEPBACKSLASH@ 1029 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/sound_engine.Po' tmpdepfile='$(DEPDIR)/sound_engine.TPo' @AMDEPBACKSLASH@ 1030 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1031 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sound_engine.o `test -f 'lib/sound/sound_engine.cc' || echo '$(srcdir)/'`lib/sound/sound_engine.cc 1032 1033 sound_engine.obj: lib/sound/sound_engine.cc 1034 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sound_engine.obj -MD -MP -MF "$(DEPDIR)/sound_engine.Tpo" -c -o sound_engine.obj `if test -f 'lib/sound/sound_engine.cc'; then $(CYGPATH_W) 'lib/sound/sound_engine.cc'; else $(CYGPATH_W) '$(srcdir)/lib/sound/sound_engine.cc'; fi`; \ 1035 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/sound_engine.Tpo" "$(DEPDIR)/sound_engine.Po"; else rm -f "$(DEPDIR)/sound_engine.Tpo"; exit 1; fi 1036 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='lib/sound/sound_engine.cc' object='sound_engine.obj' libtool=no @AMDEPBACKSLASH@ 1037 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/sound_engine.Po' tmpdepfile='$(DEPDIR)/sound_engine.TPo' @AMDEPBACKSLASH@ 1038 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1039 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sound_engine.obj `if test -f 'lib/sound/sound_engine.cc'; then $(CYGPATH_W) 'lib/sound/sound_engine.cc'; else $(CYGPATH_W) '$(srcdir)/lib/sound/sound_engine.cc'; fi` 1019 1040 1020 1041 base_entity.o: lib/lang/base_entity.cc … … 1268 1289 1269 1290 distdir: $(DISTFILES) 1270 $(mkdir_p) $(distdir)/ai $(distdir)/defs $(distdir)/glmenu $(distdir)/lib/coord $(distdir)/lib/data $(distdir)/lib/graphics $(distdir)/lib/lang $(distdir)/lib/math $(distdir)/lib/ util $(distdir)/network $(distdir)/proto $(distdir)/story_entities $(distdir)/util $(distdir)/util/animation $(distdir)/util/common $(distdir)/world_entities1291 $(mkdir_p) $(distdir)/ai $(distdir)/defs $(distdir)/glmenu $(distdir)/lib/coord $(distdir)/lib/data $(distdir)/lib/graphics $(distdir)/lib/lang $(distdir)/lib/math $(distdir)/lib/sound $(distdir)/lib/util $(distdir)/network $(distdir)/proto $(distdir)/story_entities $(distdir)/util $(distdir)/util/animation $(distdir)/util/common $(distdir)/world_entities 1271 1292 @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ 1272 1293 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ -
orxonox/branches/sound_engine/src/defs/debug.h
r3875 r3887 72 72 #define DEBUG_MODULE_FONT 1 73 73 #define DEBUG_MODULE_ANIM 1 74 #define DEBUG_MODULE_SOUND 4 74 75 75 76 #define DEBUG_MODULE_NULL_PARENT 0 -
orxonox/branches/sound_engine/src/lib/sound/sound_engine.cc
r3884 r3887 10 10 11 11 ### File Specific: 12 main-programmer: ...12 main-programmer: Benjamin Grauer 13 13 co-programmer: ... 14 15 Some code was taken from Simon's first implementation of the SoundEngine. 14 16 */ 15 17 16 //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY 18 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_SOUND 17 19 18 #include " proto_singleton.h"20 #include "sound_engine.h" 19 21 20 22 using namespace std; 21 22 23 23 24 /** 24 25 \brief standard constructor 25 26 */ 26 ProtoSingleton::ProtoSingleton()27 SoundEngine::SoundEngine () 27 28 { 28 this->setClassName ("ProtoSingleton"); 29 29 this->setClassName ("SoundEngine"); 30 this->isInit = false; 31 this->enableSound(); 30 32 } 31 33 32 /** 33 \brief the singleton reference to this class 34 */ 35 ProtoSingleton* ProtoSingleton::singletonRef = NULL; 34 //! brief the singleton reference to this class 35 SoundEngine* SoundEngine::singletonRef = NULL; 36 36 37 37 /** 38 38 \returns a Pointer to this Class 39 39 */ 40 ProtoSingleton* ProtoSingleton::getInstance(void)40 SoundEngine* SoundEngine::getInstance(void) 41 41 { 42 if (! ProtoSingleton::singletonRef)43 ProtoSingleton::singletonRef = new ProtoSingleton();44 return ProtoSingleton::singletonRef;42 if (!SoundEngine::singletonRef) 43 SoundEngine::singletonRef = new SoundEngine(); 44 return SoundEngine::singletonRef; 45 45 } 46 46 … … 49 49 50 50 */ 51 ProtoSingleton::~ProtoSingleton()51 SoundEngine::~SoundEngine () 52 52 { 53 ProtoSingleton::singletonRef = NULL; 53 SoundEngine::singletonRef = NULL; 54 55 this->disableSound(); 56 } 54 57 58 59 /** 60 \brief enables the SDL_mixer library 61 */ 62 void SoundEngine::enableSound(void) 63 { 64 if (!this->isInit) 65 if (SDL_Init(SDL_INIT_AUDIO)) 66 { 67 PRINTF(1)("SDL-sound could not be initialized\n"); 68 return; 69 } 70 this->isInit = true; 55 71 } 72 73 /** 74 \brief disabled SDL_mixer 75 */ 76 void SoundEngine::disableSound(void) 77 { 78 if (this->isInit) 79 { 80 SDL_QuitSubSystem(SDL_INIT_AUDIO); 81 } 82 else 83 PRINTF(4)("SDL_mixer was not initialized.\n"); 84 } 85 86 /** 87 \brief checks if the compiled version and the local version of SDL_mixer match. 88 \returns true if match, false otherwise 89 */ 90 bool SoundEngine::checkVersion(void) 91 { 92 SDL_version compile_version; 93 SDL_version link_version; 94 MIX_VERSION(&compile_version); 95 link_version = *Mix_Linked_Version(); 96 97 if (compile_version.major == link_version.major && 98 compile_version.minor == link_version.minor && 99 compile_version.patch == link_version.patch) 100 { 101 return true; 102 } 103 else 104 { 105 PRINTF(2)("compiled with SDL_mixer version: %d.%d.%d\n", 106 compile_version.major, 107 compile_version.minor, 108 compile_version.patch); 109 110 PRINTF(2)("running with SDL_mixer version: %d.%d.%d\n", 111 link_version.major, 112 link_version.minor, 113 link_version.patch); 114 return false; 115 } 116 } -
orxonox/branches/sound_engine/src/lib/sound/sound_engine.h
r3884 r3887 1 1 /*! 2 \file proto_singleton.h 3 \brief Definition of the proto class template, used quickly start work 4 5 a simple file to copy and create a singleton-class from 2 \file sound_engine.h 3 \brief Definition of the SoundEngine 4 5 !!AVOID!!: 6 SDL_OpenAudio 7 Use Mix_OpenAudio instead. 8 SDL_CloseAudio 9 Use Mix_CloseAudio instead. 10 SDL_PauseAudio 11 Use Mix_Pause(-1) and Mix_PauseMusic instead, to pause. 12 Use Mix_Resume(-1) and Mix_ResumeMusic instead, to unpause. 13 SDL_LockAudio 14 This is just not needed since SDL_mixer handles this for you. 15 Using it may cause problems as well. 16 SDL_UnlockAudio 17 This is just not needed since SDL_mixer handles this for you. 18 Using it may cause problems as well. 6 19 */ 7 20 8 #ifndef _ PROTO_SINGLETON_H9 #define _ PROTO_SINGLETON_H21 #ifndef _SOUND_ENGINE_H 22 #define _SOUND_ENGINE_H 10 23 11 24 #include "base_object.h" 25 #include <SDL_mixer.h> 12 26 13 // FORWARD DEFINITION \\27 // FORWARD DEFINITION 14 28 15 //! A default singleton class.16 class ProtoSingleton: public BaseObject {29 //! The Main Sound Engine 30 class SoundEngine : public BaseObject { 17 31 18 32 public: 19 static ProtoSingleton* getInstance(void);20 virtual ~ ProtoSingleton(void);33 static SoundEngine* getInstance(void); 34 virtual ~SoundEngine(void); 21 35 22 36 private: 23 ProtoSingleton(void); 24 static ProtoSingleton* singletonRef; 37 SoundEngine(void); 38 static SoundEngine* singletonRef; 39 40 41 42 void enableSound(void); 43 void disableSound(void); 44 static bool checkVersion(void); 45 46 bool isInit; 25 47 }; 26 48 27 #endif /* _PROTO_SINGLETON_H */ 49 50 #endif /* _SOUND_ENGINE_H */ -
orxonox/branches/sound_engine/src/orxonox.cc
r3790 r3887 32 32 #include "game_loader.h" 33 33 #include "graphics_engine.h" 34 #include "sound_engine.h" 34 35 #include "resource_manager.h" 35 36 #include "text_engine.h" … … 57 58 if( localinput != NULL) delete world; 58 59 if( resources != NULL) delete resources; 59 delete GraphicsEngine::getInstance(); // deleting the Graphics 60 delete GraphicsEngine::getInstance(); // delets the Graphics Engine 61 delete SoundEngine::getInstance(); // deletes the Sound Engine 60 62 delete ResourceManager::getInstance(); // deletes the Resource Manager 61 63 delete TextEngine::getInstance(); … … 131 133 { 132 134 printf("> Initializing sound\n"); 133 // SDL_Init(SDL_INIT_AUDIO);134 printf(" Not yet implemented\n");135 SoundEngine::getInstance(); 136 printf("implementing\n"); 135 137 return 0; 136 138 }
Note: See TracChangeset
for help on using the changeset viewer.