Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9019 in orxonox.OLD for trunk/src/lib/sound/ogg_player.cc


Ignore:
Timestamp:
Jul 2, 2006, 4:41:32 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: OggPlayer retrieves Information about the current Title
The Title Played is relayed to the Hud's Notifier

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/sound/ogg_player.cc

    r8362 r9019  
    3232#include "debug.h"
    3333#include "compiler.h"
     34
     35#include "helper_functions.h"
    3436
    3537#ifdef HAVE_SDL_SDL_H
     
    137139    vorbisInfo = ov_info(&oggStream, -1);
    138140    vorbisComment = ov_comment(&oggStream, -1);
     141    this->retrieveFileInfo(&oggStream);
    139142
    140143    if(vorbisInfo->channels == 1)
     
    469472      alSourceUnqueueBuffers(source, 1, &buffer);
    470473      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;
    471494    }
    472495  }
Note: See TracChangeset for help on using the changeset viewer.