xoreos  0.0.5
fmodsamplebank.h
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
25 #ifndef SOUND_FMODSAMPLEBANK_H
26 #define SOUND_FMODSAMPLEBANK_H
27 
28 #include "src/common/ustring.h"
29 #include "src/common/scopedptr.h"
30 #include "src/common/readstream.h"
31 
32 namespace Sound {
33 
34 class RewindableAudioStream;
35 
48 public:
50  FMODSampleBank(const Common::UString &name);
52 
54  size_t getSampleCount() const;
55 
57  const Common::UString &getSampleName(size_t index) const;
59  bool hasSample(const Common::UString &name) const;
60 
62  RewindableAudioStream *getSample(size_t index) const;
65 
66 private:
67  struct Sample {
69 
71 
74 
76 
81 
83 
84  float minDistance;
85  float maxDistance;
86 
90 
91  size_t offset;
92  size_t size;
93  };
94 
95 
97 
98  std::vector<Sample> _samples;
99 
100  std::map<Common::UString, const Sample *> _sampleMap;
101 
102 
103  void load(Common::SeekableReadStream &fsb);
104 
105  RewindableAudioStream *getSample(const Sample &sample) const;
106 };
107 
108 } // End of namespace Sound
109 
110 #endif // SOUND_FMODSAMPLEBANK_H
uint32 length
Length of the sample, in audio samples.
FMODSampleBank(Common::SeekableReadStream *fsb)
A class holding an UTF-8 string.
Definition: ustring.h:48
bool hasSample(const Common::UString &name) const
Does a sample with this name exist in the sample bank?
size_t offset
Offset to the sample within the FSB.
std::vector< Sample > _samples
void load(Common::SeekableReadStream &fsb)
int16_t int16
Definition: types.h:201
A simple scoped smart pointer template.
size_t size
Size of the sample in bytes.
Definition: game.h:37
A rewindable audio stream.
Definition: audiostream.h:125
uint16_t uint16
Definition: types.h:202
Common::UString name
Name of the sample.
size_t getSampleCount() const
Return the number of sample files.
Basic reading stream interfaces.
Class to hold audio resource data of an FMOD samplebank file.
Unicode string handling.
Common::ScopedPtr< Common::SeekableReadStream > _fsb
uint32_t uint32
Definition: types.h:204
RewindableAudioStream * getSample(size_t index) const
Return the audio stream of a sample, by index.
const Common::UString & getSampleName(size_t index) const
Return the name of a sample.
std::map< Common::UString, const Sample * > _sampleMap
Interface for a seekable & readable data stream.
Definition: readstream.h:265
int32_t int32
Definition: types.h:203