Linux multi-monitor fullscreen support
[ryzomcore.git] / nel / tools / sound / build_soundbank / build_soundbank.cpp
blobf00c4df9c960dddd3ac7344cc33baf574db7ad97
1 /**
2 * Build Soundbank
3 * \file build_soundbank.cpp
4 * \brief Build Soundbank
5 * \date 2010-03-06 21:43GMT
6 * \author Jan Boon (Kaetemi)
7 */
9 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
10 // Copyright (C) 2010-2019 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
12 // This program is free software: you can redistribute it and/or modify
13 // it under the terms of the GNU Affero General Public License as
14 // published by the Free Software Foundation, either version 3 of the
15 // License, or (at your option) any later version.
17 // This program is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU Affero General Public License for more details.
22 // You should have received a copy of the GNU Affero General Public License
23 // along with this program. If not, see <http://www.gnu.org/licenses/>.
25 #include <nel/misc/types_nl.h>
27 // STL includes
28 #include <vector>
29 #include <string>
30 #include <map>
31 #include <iostream>
32 #include <fstream>
34 // NeL includes
35 #include <nel/misc/common.h>
36 #include <nel/misc/file.h>
37 #include <nel/misc/log.h>
38 #include <nel/misc/path.h>
39 #include <nel/sound/u_audio_mixer.h>
41 // Project includes
42 // ...
44 using namespace std;
45 using namespace NLMISC;
46 using namespace NLSOUND;
48 namespace {
50 } /* anonymous namespace */
52 int main(int nNbArg, char **ppArgs)
54 // create debug stuff
55 createDebug();
57 // verify all params
58 if (nNbArg < 4)
60 nlinfo("ERROR : Wrong number of arguments\n");
61 nlinfo("USAGE : build_soundbank <leveldesign> <dfn> <build_packed_sheets>\n");
62 return EXIT_FAILURE;
64 string leveldesignDir = string(ppArgs[1]);
65 if (!CFile::isDirectory(leveldesignDir))
67 nlerrornoex("Directory leveldesign '%s' does not exist", leveldesignDir.c_str());
68 return EXIT_FAILURE;
70 string dfnDir = string(ppArgs[2]);
71 if (!CFile::isDirectory(dfnDir))
73 nlerrornoex("Directory dfn '%s' does not exist", dfnDir.c_str());
74 return EXIT_FAILURE;
76 string exportDir = string(ppArgs[3]);
77 if (!CFile::isDirectory(exportDir))
79 nlerrornoex("Directory build_packed_sheets '%s' does not exist", exportDir.c_str());
80 return EXIT_FAILURE;
83 // add search paths
84 CPath::addSearchPath(leveldesignDir, true, false);
85 std::string relativeDfnDir = dfnDir; // only add dfn if not a subdir of leveldesignDir
86 if (!CPath::makePathRelative(leveldesignDir, dfnDir) || relativeDfnDir.size() < 2 || (relativeDfnDir[0] == '.' && relativeDfnDir[1] == '.'))
87 CPath::addSearchPath(dfnDir, true, false);
89 // build the sound bank
90 UAudioMixer::buildSoundBank(exportDir);
91 UAudioMixer::buildClusteredSoundGroupSheets(exportDir);
92 UAudioMixer::buildUserVarBindingSheets(exportDir);
94 // and that's all folks
95 return EXIT_SUCCESS;
98 /* end of file */