Просмотр исходного кода

improve SoundResource and update others

mikymod 12 лет назад
Родитель
Сommit
7661818972

+ 11 - 3
tools/CMakeLists.txt

@@ -9,7 +9,7 @@ set (INCLUDES
 	${CMAKE_SOURCE_DIR}/tools/core/strings
 	${CMAKE_SOURCE_DIR}/tools/compilers
 	${CMAKE_SOURCE_DIR}/tools/compilers/tga
-	${CMAKE_SOURCE_DIR}/tools/compilers/wav
+	${CMAKE_SOURCE_DIR}/tools/compilers/sound
 	${CMAKE_SOURCE_DIR}/tools/compilers/dae
 )
 
@@ -35,7 +35,7 @@ set (CORE_HEADERS
 set (COMPILERS_SRC
 	compilers/Compiler.cpp
 	compilers/tga/TGACompiler.cpp
-	compilers/wav/WAVCompiler.cpp
+	compilers/sound/SoundCompiler.cpp
 	compilers/dae/DAECompiler.cpp
 	compilers/dae/tinyxml2.cpp
 )
@@ -43,7 +43,7 @@ set (COMPILERS_SRC
 set (COMPILER_HEADERS
 	compilers/Compiler.h
 	compilers/tga/TGACompiler.h
-	compilers/wav/WAVCompiler.h
+	compilers/sound/SoundCompiler.h
 	compilers/dae/DAECompiler.h
 	compilers/dae/tinyxml2.h
 )
@@ -58,10 +58,18 @@ set (TOOLS_HEADERS
 	${COMPILERS_HEADERS}
 )
 
+set (TOOLS_LIBRARIES
+		vorbis
+		vorbisenc
+		vorbisfile
+		ogg
+	)
+
 include_directories(${INCLUDES})
 
 configure_file (${CMAKE_CURRENT_SOURCE_DIR}/Config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/Config.h)
 
+link_libraries(${TOOLS_LIBRARIES})
 # tools library
 add_library(crown-tools ${TOOLS_SRC} ${TOOLS_HEADERS})
 

+ 5 - 3
tools/cli/resource-compiler.cpp

@@ -32,8 +32,9 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "Path.h"
 #include "StringUtils.h"
 #include "Hash.h"
+
+#include "SoundCompiler.h"
 #include "TGACompiler.h"
-#include "WAVCompiler.h"
 #include "DAECompiler.h"
 
 using namespace crown;
@@ -145,12 +146,13 @@ int main(int argc, char** argv)
 
 	// Register compilers
 	TGACompiler tga;
-	WAVCompiler wav;
+	SoundCompiler sound;
 	DAECompiler dae;
 
 	map<std::string, Compiler*> compilers;
+
+	compilers["sound"] = &sound;
 	compilers["tga"] = &tga;
-	compilers["wav"] = &wav;
 	compilers["dae"] = &dae;
 
 	for (int32_t i = 0; i < argc - first_resource; i++)

+ 2 - 2
tools/core/Resource.h

@@ -35,7 +35,7 @@ const char* const TEXT_EXTENSION			= "txt";
 const char* const MATERIAL_EXTENSION		= "material";
 const char* const VERTEX_SHADER_EXTENSION	= "vs";
 const char* const PIXEL_SHADER_EXTENSION	= "ps";
-const char* const SOUND_EXTENSION			= "wav";
+const char* const SOUND_EXTENSION			= "sound";
 
 const uint32_t TEXTURE_TYPE					= 0x1410A16A;
 const uint32_t MESH_TYPE					= 0xE8239EEC;
@@ -44,6 +44,6 @@ const uint32_t TEXT_TYPE					= 0x9000BF0B;
 const uint32_t MATERIAL_TYPE				= 0x46807A92;
 const uint32_t VERTEX_SHADER_TYPE			= 0xDC7F061F;
 const uint32_t PIXEL_SHADER_TYPE			= 0x2A461B45;
-const uint32_t SOUND_TYPE					= 0x8E128AA1;
+const uint32_t SOUND_TYPE					= 0xD196AB6E;
 
 } // namespace crown

+ 1 - 0
tools/core/formats/SoundFormat.h

@@ -40,6 +40,7 @@ struct SoundHeader
 	uint32_t	sample_rate;
 	uint32_t	channels;
 	uint32_t 	bits_per_sample;
+	uint8_t		sound_type;
 };
 
 }

+ 2 - 2
tools/pycrown/Repository.py

@@ -30,9 +30,9 @@ MESH_EXTENSION				= ('.dae')
 LUA_EXTENSION				= ('.lua')
 VERTEX_SHADER_EXTENSION		= ('.vs')
 PIXEL_SHADER_EXTENSION		= ('.ps')
-SOUND_EXTENSION				= ('.wav')
+SOUND_EXTENSION				= ('.sound')
 
-resource_extensions = ('.txt', '.tga', '.dae', '.lua', '.vs', '.ps', '.wav')
+resource_extensions = ('.txt', '.tga', '.dae', '.lua', '.vs', '.ps', '.sound')
 
 # Represents the folder containing the resources
 # Can filter resources by type and other useful stuff