* Changed log level in sound module

* Fixed warnings in sound module
* Fixed problem with map loading when locale with different number separator
dev-ui
erihel 2012-12-25 17:46:48 +01:00
parent 6d607e3ae8
commit 1fa5f7a96f
5 changed files with 12 additions and 8 deletions

View File

@ -316,7 +316,7 @@ bool CApplication::Create()
langStr += locale;
strcpy(S_LANGUAGE, langStr.c_str());
putenv(S_LANGUAGE);
setlocale(LC_ALL, "");
setlocale(LC_ALL, locale.c_str());
GetLogger()->Debug("Set locale to '%s'\n", locale.c_str());
bindtextdomain("colobot", COLOBOT_I18N_DIR);

View File

@ -3793,6 +3793,8 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
int rankObj = 0;
int rankGadget = 0;
CObject* sel = 0;
char *locale = setlocale(LC_NUMERIC, nullptr);
setlocale(LC_NUMERIC, "C");
while (fgets(line, 500, file) != NULL)
{
@ -4526,6 +4528,8 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
}
m_dialog->SetSceneRead("");
m_dialog->SetStackRead("");
setlocale(LC_NUMERIC, locale);
}
//! Creates an object of decoration mobile or stationary

View File

@ -259,7 +259,7 @@ bool ALSound::SearchFreeBuffer(Sound sound, int &channel, bool &bAlreadyLoaded)
int lowerOrEqual = -1;
for (auto it : mChannels) {
if (it.second->GetPriority() < priority) {
GetLogger()->Info("Sound channel with lower priority will be reused.");
GetLogger()->Debug("Sound channel with lower priority will be reused.");
channel = it.first;
return true;
}
@ -269,7 +269,7 @@ bool ALSound::SearchFreeBuffer(Sound sound, int &channel, bool &bAlreadyLoaded)
if (lowerOrEqual != -1) {
channel = lowerOrEqual;
GetLogger()->Info("Sound channel with lower or equal priority will be reused.");
GetLogger()->Debug("Sound channel with lower or equal priority will be reused.");
return true;
}
@ -457,11 +457,11 @@ void ALSound::FrameMove(float delta)
if (it.second->GetEnvelope().totalTime <= it.second->GetCurrentTime()) {
if (oper.nextOper == SOPER_LOOP) {
GetLogger()->Info("Replay.\n");
GetLogger()->Trace("Sound oper: replay.\n");
it.second->SetCurrentTime(0.0f);
it.second->Play();
} else {
GetLogger()->Info("Next.\n");
GetLogger()->Trace("Sound oper: next.\n");
it.second->SetStartAmplitude(oper.finalAmplitude);
it.second->SetStartFrequency(oper.finalFrequency);
it.second->PopEnvelope();

View File

@ -36,7 +36,7 @@ Buffer::~Buffer() {
bool Buffer::LoadFromFile(std::string filename, Sound sound) {
mSound = sound;
GetLogger()->Info("Loading audio file: %s\n", filename.c_str());
GetLogger()->Debug("Loading audio file: %s\n", filename.c_str());
mBuffer = alutCreateBufferFromFile(filename.c_str());
ALenum error = alutGetError();
@ -53,7 +53,7 @@ bool Buffer::LoadFromFile(std::string filename, Sound sound) {
alGetBufferi(mBuffer, AL_CHANNELS, &channels);
alGetBufferi(mBuffer, AL_FREQUENCY, &freq);
mDuration = (ALfloat)size / channels / bits / 8 / (ALfloat)freq;
mDuration = static_cast<ALfloat>(size) / channels / bits / 8 / static_cast<ALfloat>(freq);
mLoaded = true;
return true;

View File

@ -227,7 +227,7 @@ void Channel::AdjustFrequency(float freq) {
void Channel::AdjustVolume(float volume) {
SetVolume(mStartAmplitude * (float) volume);
SetVolume(mStartAmplitude * volume);
}