Changeset 4961 in orxonox.OLD for orxonox/trunk/src/lib/sound/ogg_player.cc
- Timestamp:
- Jul 28, 2005, 1:19:50 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/sound/ogg_player.cc
r4750 r4961 23 23 #include "debug.h" 24 24 25 void OggStream::open(string path) 25 26 /** 27 * initializes an Ogg-player from a file 28 * @param fileName the file to load 29 */ 30 OggPlayer::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 */ 44 void OggPlayer::open(const char* fileName) 26 45 { 27 46 int result; 28 47 29 if(!(oggFile = fopen( path.c_str(), "rb")))48 if(!(oggFile = fopen(fileName, "rb"))) 30 49 PRINTF(2)("Could not open Ogg file."); 31 50 … … 58 77 } 59 78 60 61 62 63 void Ogg Stream::release()79 /** 80 * releases a stream 81 */ 82 void OggPlayer::release() 64 83 { 65 84 alSourceStop(source); … … 73 92 } 74 93 75 76 77 78 void Ogg Stream::display()94 /** 95 * displays some info about the ogg-file 96 */ 97 void OggPlayer::display() 79 98 { 80 99 cout … … 96 115 97 116 98 99 100 bool OggStream::playback() 117 /** 118 * plays back the sound 119 * @return true if running, false otherwise 120 */ 121 bool OggPlayer::playback() 101 122 { 102 123 if(playing()) … … 115 136 } 116 137 117 118 119 120 bool OggStream::playing() 138 /** 139 * 140 * @returns true if the file is playing 141 */ 142 bool OggPlayer::playing() 121 143 { 122 144 ALenum state; … … 127 149 } 128 150 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 */ 155 bool OggPlayer::update() 133 156 { 134 157 int processed; … … 153 176 } 154 177 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 */ 183 bool OggPlayer::stream(ALuint buffer) 159 184 { 160 185 char pcm[BUFFER_SIZE]; … … 186 211 187 212 188 189 190 void OggStream::empty() 213 /** 214 * empties the buffers 215 */ 216 void OggPlayer::empty() 191 217 { 192 218 int queued; … … 203 229 } 204 230 205 206 207 208 void Ogg Stream::check()231 /** 232 * checks for errors 233 */ 234 void OggPlayer::check() 209 235 { 210 236 int error = alGetError(); … … 214 240 } 215 241 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 */ 247 const char* OggPlayer::errorString(int code) 219 248 { 220 249 switch(code)
Note: See TracChangeset
for help on using the changeset viewer.