Changeset 9019 in orxonox.OLD for trunk/src/lib/sound
- Timestamp:
- Jul 2, 2006, 4:41:32 PM (18 years ago)
- Location:
- trunk/src/lib/sound
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/sound/ogg_player.cc
r8362 r9019 32 32 #include "debug.h" 33 33 #include "compiler.h" 34 35 #include "helper_functions.h" 34 36 35 37 #ifdef HAVE_SDL_SDL_H … … 137 139 vorbisInfo = ov_info(&oggStream, -1); 138 140 vorbisComment = ov_comment(&oggStream, -1); 141 this->retrieveFileInfo(&oggStream); 139 142 140 143 if(vorbisInfo->channels == 1) … … 469 472 alSourceUnqueueBuffers(source, 1, &buffer); 470 473 SoundEngine::checkError("OggPlayer::empty()::unqueue Buffers", __LINE__); 474 } 475 } 476 477 478 void OggPlayer::retrieveFileInfo(OggVorbis_File* file) 479 { 480 vorbis_comment* comment = ov_comment(file, -1); 481 if (comment == NULL) 482 { 483 PRINTF(2)("Retrieving Comment of %s failed\n", this->getName()); 484 return; 485 } 486 for (int i = 0; i < comment->comments; ++i) 487 { 488 if (!nocaseCmp("artist=", comment->user_comments[i], 7)) 489 this->_artist = comment->user_comments[i]+7; 490 if (!nocaseCmp("title=", comment->user_comments[i], 6)) 491 this->_title = comment->user_comments[i] + 6; 492 if (!nocaseCmp("album=", comment->user_comments[i], 6)) 493 this->_album = comment->user_comments[i]+6; 471 494 } 472 495 } -
trunk/src/lib/sound/ogg_player.h
r7737 r9019 59 59 bool getState() { return this->state; }; 60 60 61 const std::string& artist() const { return this->_artist; }; 62 const std::string& title() const { return this->_title; }; 63 const std::string& album() const { return this->_album; }; 64 65 61 66 void debug() const; 62 67 void printState() const; … … 75 80 void empty(); 76 81 82 void retrieveFileInfo(OggVorbis_File* file); 83 77 84 private: 78 85 FILE* oggFile; //!< general file-handler, to open the sound-file … … 88 95 SDL_Thread* musicThreadID; //!< The Thread in which music is Played back. 89 96 OrxThread::Mutex musicMutex; //!< A Mutex so that the two threads do not interfere. 97 98 99 100 std::string _title; 101 std::string _artist; 102 std::string _album; 103 std::string _vendor; 90 104 }; 91 105
Note: See TracChangeset
for help on using the changeset viewer.