summaryrefslogtreecommitdiff
path: root/Source/Core/AudioCommon/WaveFile.cpp
diff options
context:
space:
mode:
authorDentomologist <dentomologist@gmail.com>2025-06-01 11:39:12 -0700
committerDentomologist <dentomologist@gmail.com>2025-06-01 11:41:09 -0700
commit61ccdb0a3c8079bd1479eaeed81e646078d91bb5 (patch)
tree91890ae3b7ba7a7e52791e523adc888a98d67929 /Source/Core/AudioCommon/WaveFile.cpp
parent88122ae9569287394519c755a726c78a6985b428 (diff)
WaveFile: Add m_ prefix to member variables
Diffstat (limited to 'Source/Core/AudioCommon/WaveFile.cpp')
-rw-r--r--Source/Core/AudioCommon/WaveFile.cpp56
1 files changed, 28 insertions, 28 deletions
diff --git a/Source/Core/AudioCommon/WaveFile.cpp b/Source/Core/AudioCommon/WaveFile.cpp
index 3c74bd0cc4..89cdced4de 100644
--- a/Source/Core/AudioCommon/WaveFile.cpp
+++ b/Source/Core/AudioCommon/WaveFile.cpp
@@ -47,14 +47,14 @@ bool WaveFileWriter::Start(const std::string& filename, u32 sample_rate_divisor)
}
// Check if the file is already open
- if (file)
+ if (m_file)
{
PanicAlertFmtT("The file {0} was already open, the file header will not be written.", filename);
return false;
}
- file.Open(filename, "wb");
- if (!file)
+ m_file.Open(filename, "wb");
+ if (!m_file)
{
PanicAlertFmtT(
"The file {0} could not be opened for writing. Please check if it's already opened "
@@ -63,12 +63,12 @@ bool WaveFileWriter::Start(const std::string& filename, u32 sample_rate_divisor)
return false;
}
- audio_size = 0;
+ m_audio_size = 0;
- if (basename.empty())
- SplitPath(filename, nullptr, &basename, nullptr);
+ if (m_basename.empty())
+ SplitPath(filename, nullptr, &m_basename, nullptr);
- current_sample_rate_divisor = sample_rate_divisor;
+ m_current_sample_rate_divisor = sample_rate_divisor;
// -----------------
// Write file header
@@ -90,37 +90,37 @@ bool WaveFileWriter::Start(const std::string& filename, u32 sample_rate_divisor)
Write(100 * 1000 * 1000 - 32);
// We are now at offset 44
- if (file.Tell() != 44)
- PanicAlertFmt("Wrong offset: {}", file.Tell());
+ if (m_file.Tell() != 44)
+ PanicAlertFmt("Wrong offset: {}", m_file.Tell());
return true;
}
void WaveFileWriter::Stop()
{
- file.Seek(4, File::SeekOrigin::Begin);
- Write(audio_size + 36);
+ m_file.Seek(4, File::SeekOrigin::Begin);
+ Write(m_audio_size + 36);
- file.Seek(40, File::SeekOrigin::Begin);
- Write(audio_size);
+ m_file.Seek(40, File::SeekOrigin::Begin);
+ Write(m_audio_size);
- file.Close();
+ m_file.Close();
}
void WaveFileWriter::Write(u32 value)
{
- file.WriteArray(&value, 1);
+ m_file.WriteArray(&value, 1);
}
void WaveFileWriter::Write4(const char* ptr)
{
- file.WriteBytes(ptr, 4);
+ m_file.WriteBytes(ptr, 4);
}
void WaveFileWriter::AddStereoSamplesBE(const short* sample_data, u32 count,
u32 sample_rate_divisor, int l_volume, int r_volume)
{
- if (!file)
+ if (!m_file)
{
ERROR_LOG_FMT(AUDIO, "WaveFileWriter - file not open.");
return;
@@ -132,7 +132,7 @@ void WaveFileWriter::AddStereoSamplesBE(const short* sample_data, u32 count,
return;
}
- if (skip_silence)
+ if (m_skip_silence)
{
bool all_zero = true;
@@ -149,24 +149,24 @@ void WaveFileWriter::AddStereoSamplesBE(const short* sample_data, u32 count,
for (u32 i = 0; i < count; i++)
{
// Flip the audio channels from RL to LR
- conv_buffer[2 * i] = Common::swap16((u16)sample_data[2 * i + 1]);
- conv_buffer[2 * i + 1] = Common::swap16((u16)sample_data[2 * i]);
+ m_conv_buffer[2 * i] = Common::swap16((u16)sample_data[2 * i + 1]);
+ m_conv_buffer[2 * i + 1] = Common::swap16((u16)sample_data[2 * i]);
// Apply volume (volume ranges from 0 to 256)
- conv_buffer[2 * i] = conv_buffer[2 * i] * l_volume / 256;
- conv_buffer[2 * i + 1] = conv_buffer[2 * i + 1] * r_volume / 256;
+ m_conv_buffer[2 * i] = m_conv_buffer[2 * i] * l_volume / 256;
+ m_conv_buffer[2 * i + 1] = m_conv_buffer[2 * i + 1] * r_volume / 256;
}
- if (sample_rate_divisor != current_sample_rate_divisor)
+ if (sample_rate_divisor != m_current_sample_rate_divisor)
{
Stop();
- file_index++;
+ m_file_index++;
const std::string filename =
- fmt::format("{}{}{}.wav", File::GetUserPath(D_DUMPAUDIO_IDX), basename, file_index);
+ fmt::format("{}{}{}.wav", File::GetUserPath(D_DUMPAUDIO_IDX), m_basename, m_file_index);
Start(filename, sample_rate_divisor);
- current_sample_rate_divisor = sample_rate_divisor;
+ m_current_sample_rate_divisor = sample_rate_divisor;
}
- file.WriteBytes(conv_buffer.data(), count * 4);
- audio_size += count * 4;
+ m_file.WriteBytes(m_conv_buffer.data(), count * 4);
+ m_audio_size += count * 4;
}