OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This application is a test for AudioRendererAlgorithmOLA. It reads in a | 5 // This application is a test for AudioRendererAlgorithmOLA. It reads in a |
6 // specified wav file (so far only 8, 16 and 32 bit are supported) and uses | 6 // specified wav file (so far only 8, 16 and 32 bit are supported) and uses |
7 // ARAO to scale the playback by a specified rate. Then it outputs the result | 7 // ARAO to scale the playback by a specified rate. Then it outputs the result |
8 // to the specified location. Command line calls should be as follows: | 8 // to the specified location. Command line calls should be as follows: |
9 // | 9 // |
10 // wav_ola_test RATE INFILE OUTFILE | 10 // wav_ola_test RATE INFILE OUTFILE |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 size_t window_size_; | 66 size_t window_size_; |
67 | 67 |
68 DISALLOW_COPY_AND_ASSIGN(Dummy); | 68 DISALLOW_COPY_AND_ASSIGN(Dummy); |
69 }; | 69 }; |
70 | 70 |
71 int main(int argc, const char** argv) { | 71 int main(int argc, const char** argv) { |
72 AudioRendererAlgorithmOLA ola; | 72 AudioRendererAlgorithmOLA ola; |
73 CommandLine::Init(argc, argv); | 73 CommandLine::Init(argc, argv); |
74 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 74 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
75 | 75 |
76 const std::vector<CommandLine::StringType>& filenames = cmd_line->args(); | 76 const CommandLine::StringVector& filenames = cmd_line->GetArgs(); |
77 if (filenames.empty()) { | 77 if (filenames.empty()) { |
78 std::cerr << "Usage: " << argv[0] << " RATE INFILE OUTFILE\n" | 78 std::cerr << "Usage: " << argv[0] << " RATE INFILE OUTFILE\n" |
79 << std::endl; | 79 << std::endl; |
80 return 1; | 80 return 1; |
81 } | 81 } |
82 | 82 |
83 // Retrieve command line options. | 83 // Retrieve command line options. |
84 FilePath in_path(filenames[1]); | 84 FilePath in_path(filenames[1]); |
85 FilePath out_path(filenames[2]); | 85 FilePath out_path(filenames[2]); |
86 double playback_rate = 0.0; | 86 double playback_rate = 0.0; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 wav.subchunk1_size = 16; | 166 wav.subchunk1_size = 16; |
167 wav.subchunk2_size = bytes_written; | 167 wav.subchunk2_size = bytes_written; |
168 fseek(output.get(), 0, SEEK_SET); | 168 fseek(output.get(), 0, SEEK_SET); |
169 if (fwrite(&wav, sizeof(wav), 1, output.get()) < 1) { | 169 if (fwrite(&wav, sizeof(wav), 1, output.get()) < 1) { |
170 LOG(ERROR) << "could not write wav header."; | 170 LOG(ERROR) << "could not write wav header."; |
171 return 1; | 171 return 1; |
172 } | 172 } |
173 CommandLine::Reset(); | 173 CommandLine::Reset(); |
174 return 0; | 174 return 0; |
175 } | 175 } |
OLD | NEW |