Merge with develop

--HG--
branch : compatibility-develop
This commit is contained in:
kervala 2015-11-15 13:33:37 +01:00
commit 0fa40775f4
10 changed files with 120 additions and 30 deletions

View file

@ -1793,8 +1793,15 @@ void registerGlExtensions(CGlExtensions &ext)
if (ext.NVXGPUMemoryInfo)
{
// GPU_MEMORY_INFO_EVICTION_COUNT_NVX;
// GPU_MEMORY_INFO_EVICTED_MEMORY_NVX;
GLint nEvictionCount = 0;
#ifdef GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX
glGetIntegerv(GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX, &nEvictionCount);
#endif
GLint nEvictionMemory = 0;
#ifdef GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX
glGetIntegerv(GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX, &nEvictionMemory);
#endif
GLint nDedicatedMemoryInKB = 0;
#ifdef GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX

View file

@ -124,7 +124,12 @@ bool IAudioDecoder::getInfo(const std::string &filepath, std::string &artist, st
/// Get audio/container extensions that are currently supported by the nel sound library.
void IAudioDecoder::getMusicExtensions(std::vector<std::string> &extensions)
{
extensions.push_back("ogg");
// only add ogg format if not already in extensions list
if (std::find(extensions.begin(), extensions.end(), "ogg") == extensions.end())
{
extensions.push_back("ogg");
}
// extensions.push_back("wav"); // TODO: Easy.
}

View file

@ -54,6 +54,7 @@
#include "nel/sound/sound_bank.h"
#include "nel/sound/group_controller.h"
#include "nel/sound/containers.h"
#include "nel/sound/audio_decoder.h"
using namespace std;
using namespace NLMISC;
@ -2689,21 +2690,30 @@ bool CAudioMixerUser::getSongTitle(const std::string &filename, std::string &res
{
std::string artist;
std::string title;
if (_SoundDriver->getMusicInfo(filename, artist, title))
if (!_SoundDriver->getMusicInfo(filename, artist, title))
{
if (!title.empty())
{
if (!artist.empty()) result = artist + " - " + title;
else result = title;
}
else if (!artist.empty())
{
result = artist + " - " + CFile::getFilename(filename);
}
else result = CFile::getFilename(filename);
return true;
// use 3rd party libraries supported formats
IAudioDecoder::getInfo(filename, artist, title);
}
if (!title.empty())
{
if (!artist.empty()) result = artist + " - " + title;
else result = title;
}
else if (!artist.empty())
{
result = artist + " - " + CFile::getFilename(filename);
}
else
{
result = CFile::getFilename(filename);
}
return true;
}
result = "???";
return false;
}
@ -2751,7 +2761,14 @@ bool CAudioMixerUser::isEventMusicEnded()
/// Get audio/container extensions that are currently supported by nel or the used driver implementation.
void CAudioMixerUser::getMusicExtensions(std::vector<std::string> &extensions)
{
_SoundDriver->getMusicExtensions(extensions);
if (_SoundDriver)
{
// add file formats supported by driver
_SoundDriver->getMusicExtensions(extensions);
}
// add 3rd party libraries support file formats
IAudioDecoder::getMusicExtensions(extensions);
}
/// Add a reverb environment

View file

@ -53,7 +53,7 @@ using namespace NL3D;
// ---------------------------------------------------------------------------
// Out a string to the stdout and log.log
void outString (string &sText)
void outString (const string &sText)
{
createDebug ();
InfoLog->displayRaw(sText.c_str());

View file

@ -83,7 +83,7 @@ void CMusicPlayer::play ()
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewText *pVT = dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:mp3_player:screen:text"));
if (pVT)
pVT->setText (_Songs[_CurrentSong].Title);
pVT->setText (ucstring::makeFromUtf8(_Songs[_CurrentSong].Title));
}
}
@ -181,6 +181,12 @@ public:
if (Params == "play_songs")
{
std::vector<std::string> extensions;
SoundMngr->getMixer()->getMusicExtensions(extensions);
// no format supported
if (extensions.empty()) return;
#ifdef NL_OS_WINDOWS
// Backup the current directory
string currentPath = CPath::getCurrentPath ();
@ -195,13 +201,68 @@ public:
}
else
{
static char szFilter[] =
"All Supported Files\0*.mp3;*.mp2;*.mp1;*.ogg;*.m3u\0"
"MPEG Audio Files (*.mp3;*.mp2;*.mp1)\0*.mp3;*.mp2;*.mp1\0"
"Vorbis Files (*.ogg)\0*.ogg\0"
"Playlist Files (*.m3u)\0*.m3u\0"
"All Files (*.*)\0*.*\0"
"\0";
bool oggSupported = false;
bool mp3Supported = false;
for(uint i = 0; i < extensions.size(); ++i)
{
if (extensions[i] == "ogg")
{
oggSupported = true;
}
else if (extensions[i] == "mp3")
{
mp3Supported = true;
}
}
std::vector<std::string> filters;
// supported formats
filters.push_back("All Supported Files");
std::string filter;
if (mp3Supported) filter += "*.mp3;*.mp2;*.mp1;";
if (oggSupported) filter += "*.ogg;";
filter += "*.m3u";
filters.push_back(filter);
// mp3 format
if (mp3Supported)
{
filters.push_back("MPEG Audio Files (*.mp3;*.mp2;*.mp1)");
filters.push_back("*.mp3;*.mp2;*.mp1");
}
// ogg format
if (oggSupported)
{
filters.push_back("Vorbis Files (*.ogg)");
filters.push_back("*.ogg");
}
// playlist
filters.push_back("Playlist Files (*.m3u)");
filters.push_back("*.m3u");
// all files
filters.push_back("All Files (*.*)");
filters.push_back("*.*");
filters.push_back("");
static char szFilter[1024] = { '\0' };
uint offset = 0;
for(uint i = 0; i < filters.size(); ++i)
{
strcpy(szFilter + offset, filters[i].c_str());
// move offset to string length + 1 for \0
offset += filters[i].length() + 1;
}
// Filename buffer
char buffer[65535];

View file

@ -2475,7 +2475,7 @@ void CClientEditionModule::loadScenarioSucceded(const std::string& filename, con
}
if (CFile::fileExists(filename))
{
CFile::copyFile("save/r2_buffer.dat", filename.c_str());
CFile::copyFile("save/r2_buffer.dat", filename);
}
}

View file

@ -116,7 +116,7 @@ private:
struct CIdHash
{
enum { bucket_size = 4, min_buckets = 8, };
enum { bucket_size = 4, min_buckets = 8 };
size_t operator () (NLMISC::CEntityId id) const { return (uint32)id.getShortId(); }
bool operator() (const NLMISC::CEntityId& left, const NLMISC::CEntityId& right) { return left < right; }
};

View file

@ -71,7 +71,7 @@ typedef uint32 TUid;
*/
struct CInetAddressHashMapTraits
{
enum { bucket_size = 4, min_buckets = 8, };
enum { bucket_size = 4, min_buckets = 8 };
inline size_t operator() ( const NLNET::CInetAddress& x ) const
{
//return x.port();

View file

@ -139,7 +139,7 @@ public:
struct CEntityIdHash
{
enum { bucket_size = 4, min_buckets = 8, };
enum { bucket_size = 4, min_buckets = 8 };
size_t operator () (const NLMISC::CEntityId &id) const { return (uint32)id.getShortId(); }
size_t operator () (const NLMISC::CEntityId &left, const NLMISC::CEntityId &right) const { return left < right; }
};

View file

@ -490,7 +490,7 @@ typedef std::vector<CObjectIndex> TIndexList;
struct CColumnIndexHashMapTraits
{
enum { bucket_size = 4, min_buckets = 8, };
enum { bucket_size = 4, min_buckets = 8 };
CColumnIndexHashMapTraits() { }
size_t operator() (const CColumnIndex &id) const
{