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