Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7305 in orxonox.OLD for trunk/src/lib/sound/ogg_player.h


Ignore:
Timestamp:
Apr 16, 2006, 8:46:38 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: cleanup of the SoundEngine. man, this was necessary :)

File:
1 edited

Legend:

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

    r7304 r7305  
    2727{
    2828public:
    29   OggPlayer(const std::string& fileName = "");
    30   virtual ~OggPlayer();
    31 
    32   bool open(const std::string& fileName);
    33   void release();
    34   bool play();
    35   bool playing();
    36   bool update();
    37 
    38   void jumpTo(float timeCode);
    39 
    40   void debug();
    41   void printState();
    42 
    43   static int createAudioThread(void* oggPlayer);
    44 
    45 
    46 protected:
    47   bool stream(ALuint buffer);
    48   void empty();
    49   const char* errorString(int code);
    50 
    51 private:
    52   bool playback();
    53 
    54 
    55 public:
     29  /**
     30   * An enumerator defining in what State the OggPlayer is.
     31   * The OggPlayer can be in multiple States listed here.
     32   * It can as an example be in FileOpened and Stopped.
     33   */
    5634  typedef enum {
    5735    None                   = 0x000,
     
    6543  } State;
    6644
     45  OggPlayer(const std::string& fileName = "");
     46  virtual ~OggPlayer();
     47  /** @param state compare this State with the internal State */
     48  bool operator==(OggPlayer::State state) { return this->state & state; };
     49
     50  bool open(const std::string& fileName = "");
     51
     52  bool play();
     53  void stop();
     54  void pause();
     55  void rewind(); // convenience
     56  void jumpTo(float timeCode);
     57
     58  bool isPlaying();
     59  bool getState() { return this->state; };
     60
     61  void debug() const;
     62  void printState() const;
     63  const char* getVorbisError(int code);
     64
     65
     66private:
     67  static int createAudioThread(void* oggPlayer);
     68  bool playback();
     69  bool update();
     70
     71  void release();
     72
     73  bool stream(ALuint buffer);
     74  void empty();
     75
     76public:
     77
    6778private:
    6879  FILE*               oggFile;              //!< general file-handler, to open the sound-file
     
    7485  ALuint              source;               //!< The source we play back on
    7586  ALenum              format;               //!< The format we play back
    76   unsigned int        state;
     87  unsigned int        state;                //!< The States the OggPlayer is in (this can be multiple entries from OggPlayer::State).
    7788
    7889  SDL_Thread*         musicThread;          //!< The Thread in which music is Played back.
Note: See TracChangeset for help on using the changeset viewer.