| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 class WavFile { | 25 class WavFile { |
| 26 public: | 26 public: |
| 27 virtual ~WavFile() {} | 27 virtual ~WavFile() {} |
| 28 | 28 |
| 29 virtual int sample_rate() const = 0; | 29 virtual int sample_rate() const = 0; |
| 30 virtual int num_channels() const = 0; | 30 virtual int num_channels() const = 0; |
| 31 virtual uint32_t num_samples() const = 0; | 31 virtual uint32_t num_samples() const = 0; |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 // Simple C++ class for writing 16-bit PCM WAV files. All error handling is | 34 // Simple C++ class for writing 16-bit PCM WAV files. All error handling is |
| 35 // by calls to CHECK(), making it unsuitable for anything but debug code. | 35 // by calls to RTC_CHECK(), making it unsuitable for anything but debug code. |
| 36 class WavWriter final : public WavFile { | 36 class WavWriter final : public WavFile { |
| 37 public: | 37 public: |
| 38 // Open a new WAV file for writing. | 38 // Open a new WAV file for writing. |
| 39 WavWriter(const std::string& filename, int sample_rate, int num_channels); | 39 WavWriter(const std::string& filename, int sample_rate, int num_channels); |
| 40 | 40 |
| 41 // Close the WAV file, after writing its header. | 41 // Close the WAV file, after writing its header. |
| 42 ~WavWriter(); | 42 ~WavWriter(); |
| 43 | 43 |
| 44 // Write additional samples to the file. Each sample is in the range | 44 // Write additional samples to the file. Each sample is in the range |
| 45 // [-32768,32767], and there must be the previously specified number of | 45 // [-32768,32767], and there must be the previously specified number of |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 size_t num_samples); | 106 size_t num_samples); |
| 107 int rtc_WavSampleRate(const rtc_WavWriter* wf); | 107 int rtc_WavSampleRate(const rtc_WavWriter* wf); |
| 108 int rtc_WavNumChannels(const rtc_WavWriter* wf); | 108 int rtc_WavNumChannels(const rtc_WavWriter* wf); |
| 109 uint32_t rtc_WavNumSamples(const rtc_WavWriter* wf); | 109 uint32_t rtc_WavNumSamples(const rtc_WavWriter* wf); |
| 110 | 110 |
| 111 #ifdef __cplusplus | 111 #ifdef __cplusplus |
| 112 } // extern "C" | 112 } // extern "C" |
| 113 #endif | 113 #endif |
| 114 | 114 |
| 115 #endif // WEBRTC_COMMON_AUDIO_WAV_FILE_H_ | 115 #endif // WEBRTC_COMMON_AUDIO_WAV_FILE_H_ |
| OLD | NEW |