AudioCommon: Convert alerts over to fmt-based variants

Continues the migration over to fmt

Converts two panic alerts into error logs, since they aren't really
things a user can do anything about.
This commit is contained in:
Lioncash 2020-11-26 21:36:49 -05:00
parent 9b03cdf93e
commit 56d233c47c
2 changed files with 13 additions and 12 deletions

View File

@ -96,7 +96,7 @@ bool OpenALStream::Init()
{ {
if (!palcIsExtensionPresent(nullptr, "ALC_ENUMERATION_EXT")) if (!palcIsExtensionPresent(nullptr, "ALC_ENUMERATION_EXT"))
{ {
PanicAlertT("OpenAL: can't find sound devices"); PanicAlertFmtT("OpenAL: can't find sound devices");
return false; return false;
} }
@ -106,7 +106,7 @@ bool OpenALStream::Init()
ALCdevice* device = palcOpenDevice(default_device_dame); ALCdevice* device = palcOpenDevice(default_device_dame);
if (!device) if (!device)
{ {
PanicAlertT("OpenAL: can't open device %s", default_device_dame); PanicAlertFmtT("OpenAL: can't open device {0}", default_device_dame);
return false; return false;
} }
@ -114,7 +114,7 @@ bool OpenALStream::Init()
if (!context) if (!context)
{ {
palcCloseDevice(device); palcCloseDevice(device);
PanicAlertT("OpenAL: can't create context for device %s", default_device_dame); PanicAlertFmtT("OpenAL: can't create context for device {0}", default_device_dame);
return false; return false;
} }

View File

@ -9,6 +9,7 @@
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/File.h" #include "Common/File.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/Logging/Log.h"
#include "Common/MsgHandler.h" #include "Common/MsgHandler.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Common/Swap.h" #include "Common/Swap.h"
@ -31,7 +32,7 @@ bool WaveFileWriter::Start(const std::string& filename, unsigned int HLESampleRa
if (File::Exists(filename)) if (File::Exists(filename))
{ {
if (SConfig::GetInstance().m_DumpAudioSilent || if (SConfig::GetInstance().m_DumpAudioSilent ||
AskYesNoT("Delete the existing file '%s'?", filename.c_str())) AskYesNoFmtT("Delete the existing file '{0}'?", filename))
{ {
File::Delete(filename); File::Delete(filename);
} }
@ -45,17 +46,17 @@ bool WaveFileWriter::Start(const std::string& filename, unsigned int HLESampleRa
// Check if the file is already open // Check if the file is already open
if (file) if (file)
{ {
PanicAlertT("The file %s was already open, the file header will not be written.", PanicAlertFmtT("The file {0} was already open, the file header will not be written.", filename);
filename.c_str());
return false; return false;
} }
file.Open(filename, "wb"); file.Open(filename, "wb");
if (!file) if (!file)
{ {
PanicAlertT("The file %s could not be opened for writing. Please check if it's already opened " PanicAlertFmtT(
"The file {0} could not be opened for writing. Please check if it's already opened "
"by another program.", "by another program.",
filename.c_str()); filename);
return false; return false;
} }
@ -87,7 +88,7 @@ bool WaveFileWriter::Start(const std::string& filename, unsigned int HLESampleRa
// We are now at offset 44 // We are now at offset 44
if (file.Tell() != 44) if (file.Tell() != 44)
PanicAlert("Wrong offset: %lld", (long long)file.Tell()); PanicAlertFmt("Wrong offset: {}", file.Tell());
return true; return true;
} }
@ -117,10 +118,10 @@ void WaveFileWriter::Write4(const char* ptr)
void WaveFileWriter::AddStereoSamplesBE(const short* sample_data, u32 count, int sample_rate) void WaveFileWriter::AddStereoSamplesBE(const short* sample_data, u32 count, int sample_rate)
{ {
if (!file) if (!file)
PanicAlertT("WaveFileWriter - file not open."); ERROR_LOG_FMT(AUDIO, "WaveFileWriter - file not open.");
if (count > BUFFER_SIZE * 2) if (count > BUFFER_SIZE * 2)
PanicAlert("WaveFileWriter - buffer too small (count = %u).", count); ERROR_LOG_FMT(AUDIO, "WaveFileWriter - buffer too small (count = {}).", count);
if (skip_silence) if (skip_silence)
{ {