| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_AUDIO_IO_H_ | 5 #ifndef MEDIA_AUDIO_AUDIO_IO_H_ |
| 6 #define MEDIA_AUDIO_AUDIO_IO_H_ | 6 #define MEDIA_AUDIO_AUDIO_IO_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 // Models an audio stream that gets rendered to the audio hardware output. | 42 // Models an audio stream that gets rendered to the audio hardware output. |
| 43 // Because we support more audio streams than physically available channels | 43 // Because we support more audio streams than physically available channels |
| 44 // a given AudioOutputStream might or might not talk directly to hardware. | 44 // a given AudioOutputStream might or might not talk directly to hardware. |
| 45 // An audio stream allocates several buffers for audio data and calls | 45 // An audio stream allocates several buffers for audio data and calls |
| 46 // AudioSourceCallback::OnMoreData() periodically to fill these buffers, | 46 // AudioSourceCallback::OnMoreData() periodically to fill these buffers, |
| 47 // as the data is written to the audio device. Size of each packet is determined | 47 // as the data is written to the audio device. Size of each packet is determined |
| 48 // by |samples_per_packet| specified in AudioParameters when the stream is | 48 // by |samples_per_packet| specified in AudioParameters when the stream is |
| 49 // created. | 49 // created. |
| 50 | 50 |
| 51 namespace base { |
| 52 class FilePath; |
| 53 } |
| 54 |
| 51 namespace media { | 55 namespace media { |
| 52 | 56 |
| 53 class MEDIA_EXPORT AudioOutputStream { | 57 class MEDIA_EXPORT AudioOutputStream { |
| 54 public: | 58 public: |
| 55 // Audio sources must implement AudioSourceCallback. This interface will be | 59 // Audio sources must implement AudioSourceCallback. This interface will be |
| 56 // called in a random thread which very likely is a high priority thread. Do | 60 // called in a random thread which very likely is a high priority thread. Do |
| 57 // not rely on using this thread TLS or make calls that alter the thread | 61 // not rely on using this thread TLS or make calls that alter the thread |
| 58 // itself such as creating Windows or initializing COM. | 62 // itself such as creating Windows or initializing COM. |
| 59 class MEDIA_EXPORT AudioSourceCallback { | 63 class MEDIA_EXPORT AudioSourceCallback { |
| 60 public: | 64 public: |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 // Stops playing audio. Effect might not be instantaneous as the hardware | 101 // Stops playing audio. Effect might not be instantaneous as the hardware |
| 98 // might have locked audio data that is processing. | 102 // might have locked audio data that is processing. |
| 99 virtual void Stop() = 0; | 103 virtual void Stop() = 0; |
| 100 | 104 |
| 101 // Sets the relative volume, with range [0.0, 1.0] inclusive. | 105 // Sets the relative volume, with range [0.0, 1.0] inclusive. |
| 102 virtual void SetVolume(double volume) = 0; | 106 virtual void SetVolume(double volume) = 0; |
| 103 | 107 |
| 104 // Gets the relative volume, with range [0.0, 1.0] inclusive. | 108 // Gets the relative volume, with range [0.0, 1.0] inclusive. |
| 105 virtual void GetVolume(double* volume) = 0; | 109 virtual void GetVolume(double* volume) = 0; |
| 106 | 110 |
| 111 // Enable debug recording. |
| 112 virtual void EnableDebugRecording(const base::FilePath& file_name) {} // = 0; |
| 113 |
| 114 // Disable debug recording. |
| 115 virtual void DisableDebugRecording() {} // = 0; |
| 116 |
| 107 // Close the stream. This also generates AudioSourceCallback::OnClose(). | 117 // Close the stream. This also generates AudioSourceCallback::OnClose(). |
| 108 // After calling this method, the object should not be used anymore. | 118 // After calling this method, the object should not be used anymore. |
| 109 virtual void Close() = 0; | 119 virtual void Close() = 0; |
| 110 }; | 120 }; |
| 111 | 121 |
| 112 // Models an audio sink receiving recorded audio from the audio driver. | 122 // Models an audio sink receiving recorded audio from the audio driver. |
| 113 class MEDIA_EXPORT AudioInputStream { | 123 class MEDIA_EXPORT AudioInputStream { |
| 114 public: | 124 public: |
| 115 class MEDIA_EXPORT AudioInputCallback { | 125 class MEDIA_EXPORT AudioInputCallback { |
| 116 public: | 126 public: |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 // Returns the Automatic Gain Control (AGC) state. | 185 // Returns the Automatic Gain Control (AGC) state. |
| 176 virtual bool GetAutomaticGainControl() = 0; | 186 virtual bool GetAutomaticGainControl() = 0; |
| 177 | 187 |
| 178 // Returns the current muting state for the microphone. | 188 // Returns the current muting state for the microphone. |
| 179 virtual bool IsMuted() = 0; | 189 virtual bool IsMuted() = 0; |
| 180 }; | 190 }; |
| 181 | 191 |
| 182 } // namespace media | 192 } // namespace media |
| 183 | 193 |
| 184 #endif // MEDIA_AUDIO_AUDIO_IO_H_ | 194 #endif // MEDIA_AUDIO_AUDIO_IO_H_ |
| OLD | NEW |