Merge branch 'master' into gui-windows

actorid
Jan Borsodi 14 years ago
commit e47568ea2e

@ -226,6 +226,16 @@ link_directories(${Boost_LIBRARY_DIRS} ${OGRE_LIB_DIR})
add_subdirectory( extern/caelum ) add_subdirectory( extern/caelum )
add_subdirectory( extern/mygui_3.0.1 ) add_subdirectory( extern/mygui_3.0.1 )
# Make sure that certain libraries are used as static libraries
# This is in effect turns off __declspec (dllexport) for windows
# Each library will also need to be configured to build as a static lib
# MyGUI: extern/mygui_3.0.0/
add_definitions(-DMYGUI_STATIC)
# Caelum: extern/caelum/
add_definitions(-DCAELUM_STATIC)
# Specify build paths # Specify build paths
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${OpenMW_BINARY_DIR}") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${OpenMW_BINARY_DIR}")

@ -110,20 +110,21 @@ namespace MWSound
cameraTracker.unfollowCamera(); cameraTracker.unfollowCamera();
} }
std::string toMp3(const std::string &str) static std::string toMp3(std::string str)
{ {
std::string wav = str; std::string::size_type i = str.rfind('.');
int i = str.size()-3; if(str.find('/', i) == std::string::npos &&
wav[i++] = 'm'; str.find('\\', i) == std::string::npos)
wav[i++] = 'p'; str = str.substr(0, i) + ".mp3";
wav[i++] = '3'; else
return wav; str += ".mp3";
return str;
} }
bool hasFile(const std::string &str) bool hasFile(const std::string &str)
{ {
if(files.has(str)) return true; if(files.has(str)) return true;
// Not found? Try exchanging .wav with .mp3 // Not found? Try with .mp3
return files.has(toMp3(str)); return files.has(toMp3(str));
} }
@ -153,10 +154,24 @@ namespace MWSound
const ESM::Sound *snd = store.sounds.search(soundId); const ESM::Sound *snd = store.sounds.search(soundId);
if(snd == NULL) return ""; if(snd == NULL) return "";
volume *= snd->data.volume / 255.0f; if(snd->data.volume == 0)
// These factors are not very fine tuned. volume = 0.0f;
min = snd->data.minRange * 7.0f; else
max = snd->data.maxRange * 2000.0f; volume *= pow(10.0, (snd->data.volume/255.0f*3348.0 - 3348.0) / 2000.0);
if(snd->data.minRange == 0 && snd->data.maxRange == 0)
{
min = 100.0f;
max = 2000.0f;
}
else
{
min = snd->data.minRange * 20.0f;
max = snd->data.maxRange * 50.0f;
min = std::max(min, 1.0f);
max = std::max(min, max);
}
return convertPath(snd->sound); return convertPath(snd->sound);
} }
@ -309,7 +324,7 @@ namespace MWSound
// The range values are not tested // The range values are not tested
if(!mData) return; if(!mData) return;
if(mData->hasFile(filename)) if(mData->hasFile(filename))
mData->add(mData->convertPath(filename), ptr, "_say_sound", 1, 1, 100, 10000, false); mData->add(mData->convertPath(filename), ptr, "_say_sound", 1, 1, 100, 20000, false);
else else
cout << "Sound file " << filename << " not found, skipping.\n"; cout << "Sound file " << filename << " not found, skipping.\n";
} }
@ -342,10 +357,11 @@ namespace MWSound
const std::string &file = mData->lookup(soundId, volume, min, max); const std::string &file = mData->lookup(soundId, volume, min, max);
if(file != "") if(file != "")
{ {
SoundPtr snd = mData->mgr->play(file); SoundPtr snd = mData->mgr->load(file);
snd->setVolume(volume); snd->setVolume(volume);
snd->setRange(min,max); snd->setRange(min,max);
snd->setPitch(pitch); snd->setPitch(pitch);
snd->play();
} }
} }

@ -4,7 +4,7 @@ IF(MSVC)
add_definitions("-D_SCL_SECURE_NO_WARNINGS /wd4305 /wd4244" ) add_definitions("-D_SCL_SECURE_NO_WARNINGS /wd4305 /wd4244" )
ENDIF(MSVC) ENDIF(MSVC)
ADD_DEFINITIONS(-DCAELUM_LIB) ADD_DEFINITIONS(-DCAELUM_STATIC)
INCLUDE_DIRECTORIES( INCLUDE_DIRECTORIES(
${CMAKE_HOME_DIRECTORY}/extern/caelum/include ${CMAKE_HOME_DIRECTORY}/extern/caelum/include
${OGRE_INCLUDE_DIR}/Ogre ${OGRE_INCLUDE_DIR}/Ogre

@ -32,7 +32,10 @@ along with Caelum. If not, see <http://www.gnu.org/licenses/>.
// Define the dll export qualifier if compiling for Windows // Define the dll export qualifier if compiling for Windows
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
#ifdef CAELUM_LIB #ifdef CAELUM_STATIC
// Don't use dll export qualifier when built as a static lib
#define CAELUM_EXPORT
#elif CAELUM_LIB
#define CAELUM_EXPORT __declspec (dllexport) #define CAELUM_EXPORT __declspec (dllexport)
#else #else
#ifdef __MINGW32__ #ifdef __MINGW32__

@ -1 +1 @@
Subproject commit 7a22068da611235190fa7343ca3f8c1d1944a68c Subproject commit 7345f2307f3ce6682a4044b98a811fac2cb7c4f0
Loading…
Cancel
Save