mirror of
https://github.com/edubart/otclient.git
synced 2025-10-19 22:13:27 +02:00
change logger
This commit is contained in:
@@ -39,7 +39,7 @@ bool OggSoundFile::prepareOgg()
|
||||
|
||||
vorbis_info* vi = ov_info(&m_vorbisFile, -1);
|
||||
if(!vi) {
|
||||
logError("ogg file not supported: %s", m_file->name());
|
||||
g_logger.error(stdext::format("ogg file not supported: %s", m_file->name()));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -40,14 +40,14 @@ bool SoundBuffer::fillBuffer(const SoundFilePtr& soundFile)
|
||||
{
|
||||
ALenum format = soundFile->getSampleFormat();
|
||||
if(format == AL_UNDETERMINED) {
|
||||
logError("unable to determine sample format for '%s'", soundFile->getName());
|
||||
g_logger.error(stdext::format("unable to determine sample format for '%s'", soundFile->getName()));
|
||||
return false;
|
||||
}
|
||||
|
||||
DataBuffer<char> samples(soundFile->getSize());
|
||||
int read = soundFile->read(&samples[0], soundFile->getSize());
|
||||
if(read <= 0) {
|
||||
logError("unable to fill audio buffer data for '%s'", soundFile->getName());
|
||||
g_logger.error(stdext::format("unable to fill audio buffer data for '%s'", soundFile->getName()));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ bool SoundBuffer::fillBuffer(ALenum sampleFormat, const DataBuffer<char>& data,
|
||||
alBufferData(m_bufferId, sampleFormat, &data[0], size, rate);
|
||||
ALenum err = alGetError();
|
||||
if(err != AL_NO_ERROR) {
|
||||
logError("unable to fill audio buffer data: %s", alGetString(err));
|
||||
g_logger.error(stdext::format("unable to fill audio buffer data: %s", alGetString(err)));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@@ -33,7 +33,7 @@ SoundFilePtr SoundFile::loadSoundFile(const std::string& filename)
|
||||
{
|
||||
FileStreamPtr file = g_resources.openFile(filename);
|
||||
if(!file) {
|
||||
logTraceError("unable to open %s", filename);
|
||||
g_logger.traceError(stdext::format("unable to open %s", filename));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ SoundFilePtr SoundFile::loadSoundFile(const std::string& filename)
|
||||
if(oggSoundFile->prepareOgg())
|
||||
soundFile = oggSoundFile;
|
||||
} else
|
||||
logError("unknown sound file format %s", filename);
|
||||
g_logger.error(stdext::format("unknown sound file format %s", filename));
|
||||
|
||||
return soundFile;
|
||||
}
|
||||
|
@@ -36,13 +36,13 @@ void SoundManager::init()
|
||||
{
|
||||
m_device = alcOpenDevice(NULL);
|
||||
if(!m_device) {
|
||||
logError("unable to open audio device");
|
||||
g_logger.error("unable to open audio device");
|
||||
return;
|
||||
}
|
||||
|
||||
m_context = alcCreateContext(m_device, NULL);
|
||||
if(!m_context) {
|
||||
logError("unable to create audio context: %s", alcGetString(m_device, alcGetError(m_device)));
|
||||
g_logger.error(stdext::format("unable to create audio context: %s", alcGetString(m_device, alcGetError(m_device))));
|
||||
return;
|
||||
}
|
||||
alcMakeContextCurrent(m_context);
|
||||
@@ -136,7 +136,7 @@ void SoundManager::play(const std::string& filename)
|
||||
|
||||
SoundSourcePtr soundSource = createSoundSource(filename);
|
||||
if(!soundSource) {
|
||||
logError("unable to play '%s'", filename);
|
||||
g_logger.error(stdext::format("unable to play '%s'", filename));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ void SoundManager::playMusic(const std::string& filename, float fadetime)
|
||||
|
||||
m_musicSource = createSoundSource(filename);
|
||||
if(!m_musicSource) {
|
||||
logError("unable to play '%s'", filename);
|
||||
g_logger.error(stdext::format("unable to play '%s'", filename));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ SoundSourcePtr SoundManager::createSoundSource(const std::string& filename)
|
||||
buffer->fillBuffer(soundFile);
|
||||
source->setBuffer(buffer);
|
||||
m_buffers[filename] = buffer;
|
||||
logWarning("uncached sound '%s' requested to be played", filename);
|
||||
g_logger.warning(stdext::format("uncached sound '%s' requested to be played", filename));
|
||||
} else {
|
||||
StreamSoundSourcePtr streamSource(new StreamSoundSource);
|
||||
streamSource->setSoundFile(soundFile);
|
||||
|
@@ -46,7 +46,7 @@ void StreamSoundSource::setSoundFile(const SoundFilePtr& soundFile)
|
||||
void StreamSoundSource::play()
|
||||
{
|
||||
if(!m_soundFile) {
|
||||
logError("there is not sound file to play the stream");
|
||||
g_logger.error("there is not sound file to play the stream");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ void StreamSoundSource::update()
|
||||
if(processed == 0 || !m_looping)
|
||||
return;
|
||||
|
||||
logTraceError("restarting audio source because of buffer underrun");
|
||||
g_logger.traceError("restarting audio source because of buffer underrun");
|
||||
play();
|
||||
}
|
||||
}
|
||||
@@ -143,12 +143,12 @@ bool StreamSoundSource::fillBufferAndQueue(ALuint buffer)
|
||||
alBufferData(buffer, format, &bufferData[0], bytesRead, m_soundFile->getRate());
|
||||
ALenum err = alGetError();
|
||||
if(err != AL_NO_ERROR)
|
||||
logError("unable to refill audio buffer for '%s': %s", m_soundFile->getName(), alGetString(err));
|
||||
g_logger.error(stdext::format("unable to refill audio buffer for '%s': %s", m_soundFile->getName(), alGetString(err)));
|
||||
|
||||
alSourceQueueBuffers(m_sourceId, 1, &buffer);
|
||||
err = alGetError();
|
||||
if(err != AL_NO_ERROR)
|
||||
logError("unable to queue audio buffer for '%s': %s", m_soundFile->getName(), alGetString(err));
|
||||
g_logger.error(stdext::format("unable to queue audio buffer for '%s': %s", m_soundFile->getName(), alGetString(err)));
|
||||
}
|
||||
|
||||
// return false if there aren't more buffers to fill
|
||||
@@ -158,12 +158,12 @@ bool StreamSoundSource::fillBufferAndQueue(ALuint buffer)
|
||||
void StreamSoundSource::downMix(StreamSoundSource::DownMix downMix)
|
||||
{
|
||||
if(!m_soundFile) {
|
||||
logError("down mix must be set after setting a sound file");
|
||||
g_logger.error("down mix must be set after setting a sound file");
|
||||
return;
|
||||
}
|
||||
|
||||
if(m_soundFile->getSampleFormat() != AL_FORMAT_STEREO16) {
|
||||
logError("can only downmix 16 bit stereo audio files");
|
||||
g_logger.error("can only downmix 16 bit stereo audio files");
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user