OLD | NEW |
1 // Copyright (c) 2012 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 #ifndef MEDIA_AUDIO_SIMPLE_SOURCES_H_ | 5 #ifndef MEDIA_AUDIO_SIMPLE_SOURCES_H_ |
6 #define MEDIA_AUDIO_SIMPLE_SOURCES_H_ | 6 #define MEDIA_AUDIO_SIMPLE_SOURCES_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 | 9 |
10 #include "media/audio/audio_io.h" | 10 #include "media/audio/audio_io.h" |
11 #include "media/base/seekable_buffer.h" | 11 #include "media/base/seekable_buffer.h" |
12 | 12 |
13 namespace media { | |
14 | |
15 // An audio source that produces a pure sinusoidal tone. | 13 // An audio source that produces a pure sinusoidal tone. |
16 class MEDIA_EXPORT SineWaveAudioSource | 14 class MEDIA_EXPORT SineWaveAudioSource |
17 : public AudioOutputStream::AudioSourceCallback { | 15 : public AudioOutputStream::AudioSourceCallback { |
18 public: | 16 public: |
19 enum Format { | 17 enum Format { |
20 FORMAT_8BIT_LINEAR_PCM, | 18 FORMAT_8BIT_LINEAR_PCM, |
21 FORMAT_16BIT_LINEAR_PCM, | 19 FORMAT_16BIT_LINEAR_PCM, |
22 }; | 20 }; |
23 // |channels| is the number of audio channels, |freq| is the frequency in | 21 // |channels| is the number of audio channels, |freq| is the frequency in |
24 // hertz and it has to be less than half of the sampling frequency | 22 // hertz and it has to be less than half of the sampling frequency |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // Discard all buffered data and reset to initial state. | 81 // Discard all buffered data and reset to initial state. |
84 void ClearAll(); | 82 void ClearAll(); |
85 | 83 |
86 private: | 84 private: |
87 // Free acquired resources. | 85 // Free acquired resources. |
88 void CleanUp(); | 86 void CleanUp(); |
89 | 87 |
90 media::SeekableBuffer buffer_; | 88 media::SeekableBuffer buffer_; |
91 }; | 89 }; |
92 | 90 |
93 } // namespace media | |
94 | |
95 #endif // MEDIA_AUDIO_SIMPLE_SOURCES_H_ | 91 #endif // MEDIA_AUDIO_SIMPLE_SOURCES_H_ |
OLD | NEW |