OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 } else { | 140 } else { |
141 bytes_written += bytes; | 141 bytes_written += bytes; |
142 } | 142 } |
143 } | 143 } |
144 | 144 |
145 // Seek back to the beginning of our output file and update the header. | 145 // Seek back to the beginning of our output file and update the header. |
146 wav.chunk_size = 36 + bytes_written; | 146 wav.chunk_size = 36 + bytes_written; |
147 wav.subchunk1_size = 16; | 147 wav.subchunk1_size = 16; |
148 wav.subchunk2_size = bytes_written; | 148 wav.subchunk2_size = bytes_written; |
149 fseek(output.get(), 0, SEEK_SET); | 149 fseek(output.get(), 0, SEEK_SET); |
150 fwrite(&wav, sizeof(wav), 1, output.get()); | 150 if (fwrite(&wav, sizeof(wav), 1, output.get()) < 1) { |
| 151 LOG(ERROR) << "could not write wav header."; |
| 152 return 1; |
| 153 } |
151 | 154 |
152 return 0; | 155 return 0; |
153 } | 156 } |
OLD | NEW |