Pyrogenesis  trunk
OggData.h
Go to the documentation of this file.
1 /* Copyright (C) 2015 Wildfire Games.
2  * This file is part of 0 A.D.
3  *
4  * 0 A.D. is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * 0 A.D. is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef INCLUDED_OGGDATA_H
19 #define INCLUDED_OGGDATA_H
20 
21 #include "lib/config2.h"
22 
23 #if CONFIG2_AUDIO
24 
25 #include "ogg.h"
26 #include "SoundData.h"
27 
29 #include "lib/file/vfs/vfs_path.h"
30 
31 class COggData : public CSoundData
32 {
33  ALuint m_Format;
35 
36 public:
37  COggData();
38  virtual ~COggData();
39 
40  virtual bool InitOggFile(const VfsPath& itemPath);
41  virtual bool IsFileFinished();
42  virtual bool IsOneShot();
43  virtual bool IsStereo();
44 
45  virtual int FetchDataIntoBuffer(int count, ALuint* buffers);
46  virtual void ResetFile();
47 
48 protected:
51  bool m_OneShot;
52  ALuint m_Buffer[100];
54 
55  bool AddDataBuffer(char* data, long length);
56  void SetFormatAndFreq(int form, ALsizei freq);
57  int GetBufferCount();
58  unsigned int GetBuffer();
59  unsigned int* GetBufferPtr();
60 };
61 
62 #endif // CONFIG2_AUDIO
63 #endif // INCLUDED_OGGDATA_H
virtual bool IsFileFinished()
Definition: OggData.cpp:104
virtual void ResetFile()
Definition: OggData.cpp:109
ALuint m_Buffer[100]
Definition: OggData.h:52
unsigned int GetBuffer()
Definition: OggData.cpp:147
virtual bool IsStereo()
Definition: OggData.cpp:54
OggStreamPtr ogg
Definition: OggData.h:49
unsigned int * GetBufferPtr()
Definition: OggData.cpp:152
bool m_FileFinished
Definition: OggData.h:50
long m_Frequency
Definition: OggData.h:34
Definition: SoundData.h:34
Definition: path.h:79
ALuint m_Format
Definition: OggData.h:33
virtual bool IsOneShot()
Definition: OggData.cpp:115
std::shared_ptr< OggStream > OggStreamPtr
Definition: ogg.h:43
int GetBufferCount()
Definition: OggData.cpp:99
COggData()
Definition: OggData.cpp:29
virtual bool InitOggFile(const VfsPath &itemPath)
Definition: OggData.cpp:59
virtual ~COggData()
Definition: OggData.cpp:34
bool AddDataBuffer(char *data, long length)
int m_BuffersUsed
Definition: OggData.h:53
virtual int FetchDataIntoBuffer(int count, ALuint *buffers)
Definition: OggData.cpp:120
void SetFormatAndFreq(int form, ALsizei freq)
Definition: OggData.cpp:48
bool m_OneShot
Definition: OggData.h:51
Definition: OggData.h:31