xoreos  0.0.5
xactwavebank.cpp
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 #include "src/common/ustring.h"
26 
27 #include "src/aurora/resman.h"
28 
29 #include "src/sound/xactwavebank.h"
32 
33 namespace Sound {
34 
36  try {
37  Common::SeekableReadStream *stream = 0;
38 
39  stream = ResMan.getResource(name, Aurora::kFileTypeXWB);
40  if (stream)
41  return new XACTWaveBank_Binary(stream);
42 
43  stream = ResMan.getResource(name + "_xwb", Aurora::kFileTypeTXT);
44  if (stream)
45  return new XACTWaveBank_ASCII(stream);
46 
47  throw Common::Exception("No such WaveBank");
48 
49  } catch (Common::Exception &e) {
50  e.add("Failed loading XACT WaveBank \"%s\"", name.c_str());
51  throw;
52  }
53 
54  return 0;
55 }
56 
57 } // End of namespace Sound
#define ResMan
Shortcut for accessing the sound manager.
Definition: resman.h:557
void add(const char *s,...) GCC_PRINTF(2
Definition: error.cpp:58
static XACTWaveBank * load(const Common::UString &name)
Load an XACT WaveBank, of either ASCII or Binary format.
A class holding an UTF-8 string.
Definition: ustring.h:48
A binary XACT WaveBank, found in the Xbox version of Jade Empire as XWB files.
An abstract XACT WaveBank interface.
Definition: xactwavebank.h:46
Exception that provides a stack of explanations.
Definition: error.h:36
Definition: game.h:37
Class to hold audio resource data of an ASCII representation of an XWB wavebank file.
const char * c_str() const
Return the (utf8 encoded) string data.
Definition: ustring.cpp:249
StackException Exception
Definition: error.h:59
XACT WaveBank.
Definition: types.h:382
Unicode string handling.
Class to hold audio resource data of an XWB wavebank file.
An ASCII XACT WaveBank, found in the non-Xbox versions of Jade Empire as _xwb.txt files...
Interface for a seekable & readable data stream.
Definition: readstream.h:265
The global resource manager for Aurora resources.
An abstract XACT WaveBank, containing sound files.
Text, raw.
Definition: types.h:67