Changeset 3892 in orxonox.OLD for orxonox/branches
- Timestamp:
- Apr 19, 2005, 2:54:20 AM (20 years ago)
- Location:
- orxonox/branches/sound_engine/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/sound_engine/src/lib/sound/sound_engine.cc
r3890 r3892 28 28 SOUND AND MUSIC 29 29 ---------------*/ 30 30 /** 31 \brief determines the Type of a Sound by extension 32 */ 31 33 Sound::Sound(const char* fileName, SOUND_TYPE soundType) 32 34 { … … 53 55 } 54 56 57 /** 58 \brief deletes a Sound 59 */ 55 60 Sound::~Sound() 56 61 { … … 58 63 } 59 64 65 66 /** 67 \brief loads a SoundEffect 68 */ 60 69 SoundEffect::SoundEffect(const char* fileName, SOUND_TYPE soundType) : Sound(fileName, soundType) 61 70 { … … 75 84 } 76 85 86 /** 87 \brief unloads a SoundEffect 88 */ 77 89 SoundEffect::~SoundEffect(void) 78 90 { … … 81 93 } 82 94 95 void SoundEffect::play(void) 96 { 97 if(unlikely(Mix_PlayChannel(-1, this->effect, 0) == -1)) 98 printf("Mix_PlayChannel: %s\n", Mix_GetError()); 99 } 100 101 void SoundEffect::stop(void) 102 { 103 104 } 105 106 /** 107 \brief loads a Music 108 */ 83 109 Music::Music(const char* fileName, SOUND_TYPE soundType) : Sound(fileName, soundType) 84 110 { 111 PRINTF(1)("Loading Music %s\n", fileName); 85 112 this->music = NULL; 86 113 if (likely(SoundEngine::isInit)) … … 99 126 } 100 127 128 /** 129 \brief unloads a Music 130 */ 101 131 Music::~Music() 102 132 { 103 133 Mix_FreeMusic(this->music); 134 } 135 136 void Music::play(void) 137 { 138 if(unlikely(Mix_PlayMusic(music, 1) == -1)) 139 printf("Mix_PlayMusic: %s\n",Mix_GetError()); 140 } 141 142 void Music::stop(void) 143 { 144 104 145 } 105 146 -
orxonox/branches/sound_engine/src/lib/sound/sound_engine.h
r3890 r3892 43 43 Sound(const char* fileName, SOUND_TYPE soundType); 44 44 virtual ~Sound(void); 45 46 virtual void play() = 0; 47 virtual void stop() = 0; 48 45 49 protected: 46 50 SOUND_TYPE soundType; 47 51 int channel; 52 int volume; 48 53 }; 49 54 … … 52 57 SoundEffect(const char* fileName, SOUND_TYPE soundType = SOUND_NONE); 53 58 virtual ~SoundEffect(void); 59 60 virtual void play(); 61 virtual void stop(); 54 62 private: 55 63 Mix_Chunk* effect; … … 60 68 Music(const char* fileName, SOUND_TYPE soundType = SOUND_NONE); 61 69 virtual ~Music(void); 70 71 virtual void play(); 72 virtual void stop(); 62 73 private: 63 74 Mix_Music* music; -
orxonox/branches/sound_engine/src/orxonox.cc
r3889 r3892 60 60 if( resources != NULL) delete resources; 61 61 delete GraphicsEngine::getInstance(); // delets the Graphics Engine 62 //delete SoundEngine::getInstance(); // deletes the Sound Engine62 delete SoundEngine::getInstance(); // deletes the Sound Engine 63 63 delete ResourceManager::getInstance(); // deletes the Resource Manager 64 64 delete TextEngine::getInstance(); … … 102 102 // initialize everything 103 103 if( initVideo() == -1) return -1; 104 // init sound 104 105 if( initSound() == -1) return -1; 105 106 printf("> Initializing input\n"); … … 112 113 //if( init_world () == -1) return -1; PB: world will be initialized when started 113 114 115 Sound* test = (Sound*)ResourceManager::getInstance()->load("sound/16.mp3", RESOURCE_SOUND_MUSIC, RP_LEVEL); 116 test->play(); 117 114 118 return 0; 115 119 }
Note: See TracChangeset
for help on using the changeset viewer.