Add a WavReader counterpart to WavWriter.
Don't bother with a C interface as we currently have no need to call this from C code. The first use will be in the audioproc tool. R=kwiberg@webrtc.org Review URL: https://webrtc-codereview.appspot.com/30829004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7585 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -1351,7 +1351,7 @@ int WebRtcAec_FreeAec(AecCore* aec) {
|
||||
#ifdef WEBRTC_AEC_DEBUG_DUMP
|
||||
// Open a new Wav file for writing. If it was already open with a different
|
||||
// sample frequency, close it first.
|
||||
static void ReopenWav(rtc_WavFile** wav_file,
|
||||
static void ReopenWav(rtc_WavWriter** wav_file,
|
||||
const char* name,
|
||||
int seq1,
|
||||
int seq2,
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC_AEC_CORE_INTERNAL_H_
|
||||
#define WEBRTC_MODULES_AUDIO_PROCESSING_AEC_AEC_CORE_INTERNAL_H_
|
||||
|
||||
#include "webrtc/common_audio/wav_writer.h"
|
||||
#include "webrtc/common_audio/wav_file.h"
|
||||
#include "webrtc/modules/audio_processing/aec/aec_common.h"
|
||||
#include "webrtc/modules/audio_processing/aec/aec_core.h"
|
||||
#include "webrtc/modules/audio_processing/utility/ring_buffer.h"
|
||||
@ -147,10 +147,10 @@ struct AecCore {
|
||||
int debug_dump_count;
|
||||
|
||||
RingBuffer* far_time_buf;
|
||||
rtc_WavFile* farFile;
|
||||
rtc_WavFile* nearFile;
|
||||
rtc_WavFile* outFile;
|
||||
rtc_WavFile* outLinearFile;
|
||||
rtc_WavWriter* farFile;
|
||||
rtc_WavWriter* nearFile;
|
||||
rtc_WavWriter* outFile;
|
||||
rtc_WavWriter* outLinearFile;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@ -489,7 +489,7 @@ void void_main(int argc, char* argv[]) {
|
||||
FILE* aecm_echo_path_in_file = NULL;
|
||||
FILE* aecm_echo_path_out_file = NULL;
|
||||
|
||||
scoped_ptr<WavFile> output_wav_file;
|
||||
scoped_ptr<WavWriter> output_wav_file;
|
||||
scoped_ptr<RawFile> output_raw_file;
|
||||
|
||||
if (pb_filename) {
|
||||
@ -637,9 +637,9 @@ void void_main(int argc, char* argv[]) {
|
||||
if (!raw_output) {
|
||||
// The WAV file needs to be reset every time, because it cant change
|
||||
// it's sample rate or number of channels.
|
||||
output_wav_file.reset(new WavFile(out_filename + ".wav",
|
||||
output_sample_rate,
|
||||
msg.num_output_channels()));
|
||||
output_wav_file.reset(new WavWriter(out_filename + ".wav",
|
||||
output_sample_rate,
|
||||
msg.num_output_channels()));
|
||||
}
|
||||
|
||||
} else if (event_msg.type() == Event::REVERSE_STREAM) {
|
||||
@ -876,9 +876,9 @@ void void_main(int argc, char* argv[]) {
|
||||
if (!raw_output) {
|
||||
// The WAV file needs to be reset every time, because it can't change
|
||||
// it's sample rate or number of channels.
|
||||
output_wav_file.reset(new WavFile(out_filename + ".wav",
|
||||
sample_rate_hz,
|
||||
num_capture_output_channels));
|
||||
output_wav_file.reset(new WavWriter(out_filename + ".wav",
|
||||
sample_rate_hz,
|
||||
num_capture_output_channels));
|
||||
}
|
||||
|
||||
if (verbose) {
|
||||
@ -1029,9 +1029,9 @@ void void_main(int argc, char* argv[]) {
|
||||
output_raw_file.reset(new RawFile(out_filename + ".pcm"));
|
||||
}
|
||||
if (!raw_output && !output_wav_file) {
|
||||
output_wav_file.reset(new WavFile(out_filename + ".wav",
|
||||
sample_rate_hz,
|
||||
num_capture_output_channels));
|
||||
output_wav_file.reset(new WavWriter(out_filename + ".wav",
|
||||
sample_rate_hz,
|
||||
num_capture_output_channels));
|
||||
}
|
||||
WriteIntData(near_frame.data_,
|
||||
size,
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
#include "webrtc/audio_processing/debug.pb.h"
|
||||
#include "webrtc/common_audio/include/audio_util.h"
|
||||
#include "webrtc/common_audio/wav_writer.h"
|
||||
#include "webrtc/common_audio/wav_file.h"
|
||||
#include "webrtc/modules/audio_processing/common.h"
|
||||
#include "webrtc/modules/audio_processing/include/audio_processing.h"
|
||||
#include "webrtc/modules/interface/module_common_types.h"
|
||||
@ -50,7 +50,7 @@ class RawFile {
|
||||
|
||||
static inline void WriteIntData(const int16_t* data,
|
||||
size_t length,
|
||||
WavFile* wav_file,
|
||||
WavWriter* wav_file,
|
||||
RawFile* raw_file) {
|
||||
if (wav_file) {
|
||||
wav_file->WriteSamples(data, length);
|
||||
@ -63,7 +63,7 @@ static inline void WriteIntData(const int16_t* data,
|
||||
static inline void WriteFloatData(const float* const* data,
|
||||
size_t samples_per_channel,
|
||||
int num_channels,
|
||||
WavFile* wav_file,
|
||||
WavWriter* wav_file,
|
||||
RawFile* raw_file) {
|
||||
size_t length = num_channels * samples_per_channel;
|
||||
scoped_ptr<float[]> buffer(new float[length]);
|
||||
|
||||
@ -73,9 +73,9 @@ int do_main(int argc, char* argv[]) {
|
||||
int num_reverse_channels = 0;
|
||||
int num_input_channels = 0;
|
||||
int num_output_channels = 0;
|
||||
scoped_ptr<WavFile> reverse_wav_file;
|
||||
scoped_ptr<WavFile> input_wav_file;
|
||||
scoped_ptr<WavFile> output_wav_file;
|
||||
scoped_ptr<WavWriter> reverse_wav_file;
|
||||
scoped_ptr<WavWriter> input_wav_file;
|
||||
scoped_ptr<WavWriter> output_wav_file;
|
||||
scoped_ptr<RawFile> reverse_raw_file;
|
||||
scoped_ptr<RawFile> input_raw_file;
|
||||
scoped_ptr<RawFile> output_raw_file;
|
||||
@ -235,15 +235,15 @@ int do_main(int argc, char* argv[]) {
|
||||
if (!FLAGS_raw) {
|
||||
// The WAV files need to be reset every time, because they cant change
|
||||
// their sample rate or number of channels.
|
||||
reverse_wav_file.reset(new WavFile(FLAGS_reverse_file + ".wav",
|
||||
reverse_sample_rate,
|
||||
num_reverse_channels));
|
||||
input_wav_file.reset(new WavFile(FLAGS_input_file + ".wav",
|
||||
input_sample_rate,
|
||||
num_input_channels));
|
||||
output_wav_file.reset(new WavFile(FLAGS_output_file + ".wav",
|
||||
output_sample_rate,
|
||||
num_output_channels));
|
||||
reverse_wav_file.reset(new WavWriter(FLAGS_reverse_file + ".wav",
|
||||
reverse_sample_rate,
|
||||
num_reverse_channels));
|
||||
input_wav_file.reset(new WavWriter(FLAGS_input_file + ".wav",
|
||||
input_sample_rate,
|
||||
num_input_channels));
|
||||
output_wav_file.reset(new WavWriter(FLAGS_output_file + ".wav",
|
||||
output_sample_rate,
|
||||
num_output_channels));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user