Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Jul 28, 2005, 1:19:50 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: music now plays back, as one would expect, and the ReosurceManager handles ogg's.
Also the naming has changed a bit, and doxygen tags are complete in ogg_player.h/cc

File:
1 edited

Legend:

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

    r4750 r4961  
    2323#include "debug.h"
    2424
    25 void OggStream::open(string path)
     25
     26/**
     27 * initializes an Ogg-player from a file
     28 * @param fileName the file to load
     29 */
     30OggPlayer::OggPlayer(const char* fileName)
     31{
     32  this->setClassID(CL_SOUND_OGG_PLAYER, "OggPlayer");
     33  if (fileName != NULL)
     34  {
     35    this->open(fileName);
     36    this->setName(fileName);
     37  }
     38}
     39
     40/**
     41 * opens a file for playback
     42 * @param fileName the file to open
     43 */
     44void OggPlayer::open(const char* fileName)
    2645{
    2746    int result;
    2847
    29     if(!(oggFile = fopen(path.c_str(), "rb")))
     48    if(!(oggFile = fopen(fileName, "rb")))
    3049        PRINTF(2)("Could not open Ogg file.");
    3150
     
    5877}
    5978
    60 
    61 
    62 
    63 void OggStream::release()
     79/**
     80 * releases a stream
     81 */
     82void OggPlayer::release()
    6483{
    6584    alSourceStop(source);
     
    7392}
    7493
    75 
    76 
    77 
    78 void OggStream::display()
     94/**
     95 * displays some info about the ogg-file
     96 */
     97void OggPlayer::display()
    7998{
    8099    cout
     
    96115
    97116
    98 
    99 
    100 bool OggStream::playback()
     117/**
     118 * plays back the sound
     119 * @return true if running, false otherwise
     120 */
     121bool OggPlayer::playback()
    101122{
    102123    if(playing())
     
    115136}
    116137
    117 
    118 
    119 
    120 bool OggStream::playing()
     138/**
     139 *
     140 * @returns true if the file is playing
     141 */
     142bool OggPlayer::playing()
    121143{
    122144    ALenum state;
     
    127149}
    128150
    129 
    130 
    131 
    132 bool OggStream::update()
     151/**
     152 * updates the stream, this has to be done every few parts of a second, for sound-consistency
     153 * @returns true, if the Sound is playing flawlessly
     154 */
     155bool OggPlayer::update()
    133156{
    134157    int processed;
     
    153176}
    154177
    155 
    156 
    157 
    158 bool OggStream::stream(ALuint buffer)
     178/**
     179 * gets a new Stream from buffer
     180 * @param buffer the buffer to get the stream from
     181 * @return true, if everything worked as planed
     182 */
     183bool OggPlayer::stream(ALuint buffer)
    159184{
    160185    char pcm[BUFFER_SIZE];
     
    186211
    187212
    188 
    189 
    190 void OggStream::empty()
     213/**
     214 * empties the buffers
     215 */
     216void OggPlayer::empty()
    191217{
    192218    int queued;
     
    203229}
    204230
    205 
    206 
    207 
    208 void OggStream::check()
     231/**
     232 * checks for errors
     233 */
     234void OggPlayer::check()
    209235{
    210236        int error = alGetError();
     
    214240}
    215241
    216 
    217 
    218 const char* OggStream::errorString(int code)
     242/**
     243 * returns errors
     244 * @param code the error-code
     245 * @return the error as a String
     246 */
     247const char* OggPlayer::errorString(int code)
    219248{
    220249     switch(code)
Note: See TracChangeset for help on using the changeset viewer.