summaryrefslogtreecommitdiff
path: root/Source/Core/AudioCommon
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2013-01-11 22:22:55 -0500
committerLioncash <mathew1800@gmail.com>2013-01-11 22:22:55 -0500
commitdcc216a02728fc258a0b9fb1a8d6f779c8680aba (patch)
tree399ba5801e15860d76379a732d79cc9372d76825 /Source/Core/AudioCommon
parentdfc0c4b08d339502989fdfaf21e89f8ed77366a3 (diff)
'count' parameter for AddStereoSamples and AddStereoSamplesBE in WaveFile should be unsigned. Doesn't make sense to have them signed.
Diffstat (limited to 'Source/Core/AudioCommon')
-rw-r--r--Source/Core/AudioCommon/Src/WaveFile.cpp31
-rw-r--r--Source/Core/AudioCommon/Src/WaveFile.h4
2 files changed, 24 insertions, 11 deletions
diff --git a/Source/Core/AudioCommon/Src/WaveFile.cpp b/Source/Core/AudioCommon/Src/WaveFile.cpp
index 802f3f7417..d98348b8bf 100644
--- a/Source/Core/AudioCommon/Src/WaveFile.cpp
+++ b/Source/Core/AudioCommon/Src/WaveFile.cpp
@@ -100,39 +100,52 @@ void WaveFileWriter::Write4(const char *ptr)
file.WriteBytes(ptr, 4);
}
-void WaveFileWriter::AddStereoSamples(const short *sample_data, int count)
+void WaveFileWriter::AddStereoSamples(const short *sample_data, u32 count)
{
if (!file)
PanicAlertT("WaveFileWriter - file not open.");
- if (skip_silence) {
+
+ if (skip_silence)
+ {
bool all_zero = true;
- for (int i = 0; i < count * 2; i++)
- if (sample_data[i]) all_zero = false;
- if (all_zero) return;
+
+ for (u32 i = 0; i < count * 2; i++)
+ {
+ if (sample_data[i])
+ all_zero = false;
+ }
+
+ if (all_zero)
+ return;
}
+
file.WriteBytes(sample_data, count * 4);
audio_size += count * 4;
}
-void WaveFileWriter::AddStereoSamplesBE(const short *sample_data, int count)
+void WaveFileWriter::AddStereoSamplesBE(const short *sample_data, u32 count)
{
if (!file)
PanicAlertT("WaveFileWriter - file not open.");
if (count > BUF_SIZE * 2)
- PanicAlert("WaveFileWriter - buffer too small (count = %i).", count);
+ PanicAlert("WaveFileWriter - buffer too small (count = %u).", count);
if (skip_silence)
{
bool all_zero = true;
- for (int i = 0; i < count * 2; i++)
+
+ for (u32 i = 0; i < count * 2; i++)
+ {
if (sample_data[i])
all_zero = false;
+ }
+
if (all_zero)
return;
}
- for (int i = 0; i < count * 2; i++)
+ for (u32 i = 0; i < count * 2; i++)
conv_buffer[i] = Common::swap16((u16)sample_data[i]);
file.WriteBytes(conv_buffer, count * 4);
diff --git a/Source/Core/AudioCommon/Src/WaveFile.h b/Source/Core/AudioCommon/Src/WaveFile.h
index 72a090814b..11fbb4ced5 100644
--- a/Source/Core/AudioCommon/Src/WaveFile.h
+++ b/Source/Core/AudioCommon/Src/WaveFile.h
@@ -50,8 +50,8 @@ public:
void SetSkipSilence(bool skip) { skip_silence = skip; }
- void AddStereoSamples(const short *sample_data, int count);
- void AddStereoSamplesBE(const short *sample_data, int count); // big endian
+ void AddStereoSamples(const short *sample_data, u32 count);
+ void AddStereoSamplesBE(const short *sample_data, u32 count); // big endian
u32 GetAudioSize() { return audio_size; }
};