Kill off some usages of c_str.

Also changes some function params, but this is ok.
Some simplifications were also able to be made (ie. killing off strcmps with ==, etc).
This commit is contained in:
Lioncash
2014-03-12 15:33:41 -04:00
parent dccc6d8b47
commit a82675b7d5
170 changed files with 812 additions and 704 deletions

View File

@ -71,7 +71,7 @@ namespace AudioCommon
{
std::string audio_file_name = File::GetUserPath(D_DUMPAUDIO_IDX) + "audiodump.wav";
File::CreateFullPath(audio_file_name);
mixer->StartLogAudio(audio_file_name.c_str());
mixer->StartLogAudio(audio_file_name);
}
return soundStream;

View File

@ -4,6 +4,8 @@
#pragma once
#include <string>
#include "AudioCommon/WaveFile.h"
#include "Common/StdMutex.h"
@ -57,23 +59,31 @@ public:
// ---------------------
virtual void StartLogAudio(const char *filename) {
if (! m_logAudio) {
virtual void StartLogAudio(const std::string& filename)
{
if (! m_logAudio)
{
m_logAudio = true;
g_wave_writer.Start(filename, GetSampleRate());
g_wave_writer.SetSkipSilence(false);
NOTICE_LOG(DSPHLE, "Starting Audio logging");
} else {
}
else
{
WARN_LOG(DSPHLE, "Audio logging has already been started");
}
}
virtual void StopLogAudio() {
if (m_logAudio) {
virtual void StopLogAudio()
{
if (m_logAudio)
{
m_logAudio = false;
g_wave_writer.Stop();
NOTICE_LOG(DSPHLE, "Stopping Audio logging");
} else {
}
else
{
WARN_LOG(DSPHLE, "Audio logging has already been stopped");
}
}

View File

@ -2,6 +2,8 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <string>
#include "AudioCommon/WaveFile.h"
#include "Common/Common.h"
#include "Core/ConfigManager.h"
@ -21,7 +23,7 @@ WaveFileWriter::~WaveFileWriter()
Stop();
}
bool WaveFileWriter::Start(const char *filename, unsigned int HLESampleRate)
bool WaveFileWriter::Start(const std::string& filename, unsigned int HLESampleRate)
{
if (!conv_buffer)
conv_buffer = new short[BUF_SIZE];
@ -29,14 +31,14 @@ bool WaveFileWriter::Start(const char *filename, unsigned int HLESampleRate)
// Check if the file is already open
if (file)
{
PanicAlertT("The file %s was already open, the file header will not be written.", filename);
PanicAlertT("The file %s was already open, the file header will not be written.", filename.c_str());
return false;
}
file.Open(filename, "wb");
if (!file)
{
PanicAlertT("The file %s could not be opened for writing. Please check if it's already opened by another program.", filename);
PanicAlertT("The file %s could not be opened for writing. Please check if it's already opened by another program.", filename.c_str());
return false;
}

View File

@ -14,6 +14,7 @@
#pragma once
#include <string>
#include "Common/FileUtil.h"
class WaveFileWriter
@ -31,7 +32,7 @@ public:
WaveFileWriter();
~WaveFileWriter();
bool Start(const char *filename, unsigned int HLESampleRate);
bool Start(const std::string& filename, unsigned int HLESampleRate);
void Stop();
void SetSkipSilence(bool skip) { skip_silence = skip; }