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 | using namespace std; |
---|
11 | |
---|
12 | #include "base_object.h" |
---|
13 | |
---|
14 | #include "alincl.h" |
---|
15 | #include <ogg/ogg.h> |
---|
16 | #include <vorbis/vorbisfile.h> |
---|
17 | |
---|
18 | struct File; |
---|
19 | |
---|
20 | |
---|
21 | #define BUFFER_SIZE (8096 * 16) |
---|
22 | |
---|
23 | |
---|
24 | // the definition of a Ogg-Player |
---|
25 | class OggPlayer : public BaseObject |
---|
26 | { |
---|
27 | public: |
---|
28 | OggPlayer(const std::string& fileName = ""); |
---|
29 | virtual ~OggPlayer(); |
---|
30 | |
---|
31 | bool open(const std::string& fileName); |
---|
32 | void release(); |
---|
33 | void debug(); |
---|
34 | bool playback(); |
---|
35 | bool playing(); |
---|
36 | bool update(); |
---|
37 | |
---|
38 | void printState(); |
---|
39 | |
---|
40 | protected: |
---|
41 | bool stream(ALuint buffer); |
---|
42 | void empty(); |
---|
43 | const char* errorString(int code); |
---|
44 | |
---|
45 | public: |
---|
46 | typedef enum { |
---|
47 | None = 0x000, |
---|
48 | FileOpened = 0x100, |
---|
49 | SourceAllocated = 0x200, |
---|
50 | BuffersAllocated = 0x400, |
---|
51 | Stopped = 0x010, |
---|
52 | Playing = 0x020, |
---|
53 | Paused = 0x040, |
---|
54 | Error = 0x001, |
---|
55 | } State; |
---|
56 | |
---|
57 | private: |
---|
58 | FILE* oggFile; //!< general file-handler, to open the sound-file |
---|
59 | OggVorbis_File oggStream; //!< The stream this Ogg-player is playing back |
---|
60 | vorbis_info* vorbisInfo; //!< The information held in the opened ogg-file |
---|
61 | vorbis_comment* vorbisComment; //!< Comments about the ogg-file |
---|
62 | |
---|
63 | ALuint buffers[2]; //!< buffers that handle sequentially buffering of the audio |
---|
64 | ALuint source; //!< The source we play back on |
---|
65 | ALenum format; //!< The format we play back |
---|
66 | unsigned int state; |
---|
67 | //bool trackLoaded; //!< If a Track has been loaded. |
---|
68 | }; |
---|
69 | |
---|
70 | |
---|
71 | #endif /* _OGG_PLAYER_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.