Merge pull request #3972 from RisingFog/merge_addstereosamples

Remove AddStereoSamples function
This commit is contained in:
Chris Burgener 2016-07-01 01:03:14 -04:00 committed by GitHub
commit fcbb39d236
2 changed files with 3 additions and 35 deletions

View File

@ -94,31 +94,6 @@ void WaveFileWriter::Write4(const char* ptr)
file.WriteBytes(ptr, 4);
}
void WaveFileWriter::AddStereoSamples(const short* sample_data, u32 count, int sample_rate)
{
if (!file)
PanicAlertT("WaveFileWriter - file not open.");
if (skip_silence)
{
bool all_zero = true;
for (u32 i = 0; i < count * 2; i++)
{
if (sample_data[i])
all_zero = false;
}
if (all_zero)
return;
}
CheckSampleRate(sample_rate);
file.WriteBytes(sample_data, count * 4);
audio_size += count * 4;
}
void WaveFileWriter::AddStereoSamplesBE(const short* sample_data, u32 count, int sample_rate)
{
if (!file)
@ -148,14 +123,6 @@ void WaveFileWriter::AddStereoSamplesBE(const short* sample_data, u32 count, int
conv_buffer[2 * i + 1] = Common::swap16((u16)sample_data[2 * i]);
}
CheckSampleRate(sample_rate);
file.WriteBytes(conv_buffer.data(), count * 4);
audio_size += count * 4;
}
void WaveFileWriter::CheckSampleRate(int sample_rate)
{
if (sample_rate != current_sample_rate)
{
Stop();
@ -165,4 +132,7 @@ void WaveFileWriter::CheckSampleRate(int sample_rate)
Start(filename.str(), sample_rate);
current_sample_rate = sample_rate;
}
file.WriteBytes(conv_buffer.data(), count * 4);
audio_size += count * 4;
}

View File

@ -30,7 +30,6 @@ public:
void Stop();
void SetSkipSilence(bool skip) { skip_silence = skip; }
void AddStereoSamples(const short* sample_data, u32 count, int sample_rate);
void AddStereoSamplesBE(const short* sample_data, u32 count, int sample_rate); // big endian
u32 GetAudioSize() const { return audio_size; }
private:
@ -42,7 +41,6 @@ private:
std::array<short, BUFFER_SIZE> conv_buffer{};
void Write(u32 value);
void Write4(const char* ptr);
void CheckSampleRate(int sample_rate);
std::string basename;
int current_sample_rate;
int file_index = 0;