| 
                Last change
                  on this file since 5039 was
                  4985,
                  checked in by bensch, 20 years ago
           | 
        
        
          | 
               
orxonox/trunk: loading some stuff from ths sound-engine 
 
           | 
        
        | 
            File size:
            1.3 KB
           | 
      
      
        
  | Line |   | 
|---|
| 1 | /*! | 
|---|
| 2 |  * @file ogg_player.h | 
|---|
| 3 |  * Ogg-Player definition | 
|---|
| 4 |  */ | 
|---|
| 5 |  | 
|---|
| 6 |  | 
|---|
| 7 | #ifndef _OGG_PLAYER_H | 
|---|
| 8 | #define _OGG_PLAYER_H | 
|---|
| 9 |  | 
|---|
| 10 | #include <iostream> | 
|---|
| 11 | using namespace std; | 
|---|
| 12 |  | 
|---|
| 13 | #include "base_object.h" | 
|---|
| 14 |  | 
|---|
| 15 | #include <AL/al.h> | 
|---|
| 16 | #include <ogg/ogg.h> | 
|---|
| 17 | #include <vorbis/vorbisfile.h> | 
|---|
| 18 |  | 
|---|
| 19 |  | 
|---|
| 20 |  | 
|---|
| 21 | #define BUFFER_SIZE (4096 * 4) | 
|---|
| 22 |  | 
|---|
| 23 |  | 
|---|
| 24 | // the definition of a Ogg-Player | 
|---|
| 25 | class OggPlayer : public BaseObject | 
|---|
| 26 |   { | 
|---|
| 27 |   public: | 
|---|
| 28 |     OggPlayer(const char* fileName = NULL); | 
|---|
| 29 |  | 
|---|
| 30 |     void open(const char* fileName); | 
|---|
| 31 |     void release(); | 
|---|
| 32 |     void display(); | 
|---|
| 33 |     bool playback(); | 
|---|
| 34 |     bool playing(); | 
|---|
| 35 |     bool update(); | 
|---|
| 36 |  | 
|---|
| 37 |   protected: | 
|---|
| 38 |  | 
|---|
| 39 |     bool stream(ALuint buffer); | 
|---|
| 40 |     void empty(); | 
|---|
| 41 |     void check(); | 
|---|
| 42 |     const char* errorString(int code); | 
|---|
| 43 |  | 
|---|
| 44 |   private: | 
|---|
| 45 |  | 
|---|
| 46 |     FILE*               oggFile;              //!< general file-handler, to open the sound-file | 
|---|
| 47 |     OggVorbis_File      oggStream;            //!< The stream this Ogg-player is playing back | 
|---|
| 48 |     vorbis_info*        vorbisInfo;           //!< The information held in the opened ogg-file | 
|---|
| 49 |     vorbis_comment*     vorbisComment;        //!< Comments about the ogg-file | 
|---|
| 50 |  | 
|---|
| 51 |     ALuint              buffers[2];           //!< buffers that handle sequentially buffering of the audio | 
|---|
| 52 |     ALuint              source;               //!< The source we play back on | 
|---|
| 53 |     ALenum              format;               //!< The format we play back | 
|---|
| 54 |   }; | 
|---|
| 55 |  | 
|---|
| 56 |  | 
|---|
| 57 | #endif /* _OGG_PLAYER_H */ | 
|---|
       
      
      Note: See 
TracBrowser
        for help on using the repository browser.