Pyrogenesis  trunk
SoundData.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_SOUNDDATA_H
19 #define INCLUDED_SOUNDDATA_H
20 
21 #include "lib/config2.h"
22 
23 #if CONFIG2_AUDIO
24 
25 #include "lib/file/vfs/vfs_path.h"
26 #include "ps/CStr.h"
27 
28 #include <map>
29 
30 class CSoundData;
31 typedef std::map<std::wstring, CSoundData*> DataMap;
32 
33 
35 {
36 public:
37  static CSoundData* SoundDataFromFile(const VfsPath& itemPath);
38  static CSoundData* SoundDataFromOgg(const VfsPath& itemPath);
39 
40  static void ReleaseSoundData(CSoundData* theData);
41 
42  CSoundData();
43  virtual ~CSoundData();
44 
46  bool DecrementCount();
47  virtual bool IsOneShot();
48  virtual bool IsStereo();
49 
50 
51  virtual unsigned int GetBuffer();
52  virtual int GetBufferCount();
53  virtual const Path& GetFileName();
54  virtual void SetFileName(const Path& aName);
55 
56  virtual unsigned int* GetBufferPtr();
57 
58 protected:
60 
61  unsigned int m_ALBuffer;
64 
65 };
66 
67 #endif // CONFIG2_AUDIO
68 
69 #endif // INCLUDED_SOUNDDATA_H
70 
std::map< std::wstring, CSoundData * > DataMap
Definition: SoundData.h:30
int m_RetentionCount
Definition: SoundData.h:62
virtual bool IsStereo()
Definition: SoundData.cpp:141
static CSoundData * SoundDataFromFile(const VfsPath &itemPath)
Definition: SoundData.cpp:58
Path m_FileName
Definition: SoundData.h:63
unsigned int m_ALBuffer
Definition: SoundData.h:61
CSoundData * IncrementCount()
Definition: SoundData.cpp:118
virtual const Path & GetFileName()
Definition: SoundData.cpp:108
Definition: SoundData.h:34
Definition: path.h:77
virtual int GetBufferCount()
Definition: SoundData.cpp:103
virtual void SetFileName(const Path &aName)
Definition: SoundData.cpp:113
virtual unsigned int * GetBufferPtr()
Definition: SoundData.cpp:136
virtual unsigned int GetBuffer()
Definition: SoundData.cpp:131
virtual bool IsOneShot()
Definition: SoundData.cpp:83
bool DecrementCount()
Definition: SoundData.cpp:124
virtual ~CSoundData()
Definition: SoundData.cpp:35
static DataMap sSoundData
Definition: SoundData.h:59
static void ReleaseSoundData(CSoundData *theData)
Definition: SoundData.cpp:44
static CSoundData * SoundDataFromOgg(const VfsPath &itemPath)
Definition: SoundData.cpp:89
CSoundData()
Definition: SoundData.cpp:30