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_MANAGER_H_ | 5 #ifndef MEDIA_AUDIO_AUDIO_MANAGER_H_ |
6 #define MEDIA_AUDIO_AUDIO_MANAGER_H_ | 6 #define MEDIA_AUDIO_AUDIO_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 // of the audio stream to be created. | 81 // of the audio stream to be created. |
82 // | 82 // |
83 // |params.sample_per_packet| is the requested buffer allocation which the | 83 // |params.sample_per_packet| is the requested buffer allocation which the |
84 // audio source thinks it can usually fill without blocking. Internally two | 84 // audio source thinks it can usually fill without blocking. Internally two |
85 // or three buffers are created, one will be locked for playback and one will | 85 // or three buffers are created, one will be locked for playback and one will |
86 // be ready to be filled in the call to AudioSourceCallback::OnMoreData(). | 86 // be ready to be filled in the call to AudioSourceCallback::OnMoreData(). |
87 // | 87 // |
88 // To create a stream for the default output device, pass an empty string | 88 // To create a stream for the default output device, pass an empty string |
89 // for |device_id|, otherwise the specified audio device will be opened. | 89 // for |device_id|, otherwise the specified audio device will be opened. |
90 // | 90 // |
91 // The |input_device_id| is used for low-latency unified streams | |
92 // (input+output) only and then only if the audio parameters specify a >0 | |
93 // input channel count. In other cases this id is ignored and should be | |
94 // empty. | |
95 // | |
96 // Returns NULL if the combination of the parameters is not supported, or if | 91 // Returns NULL if the combination of the parameters is not supported, or if |
97 // we have reached some other platform specific limit. | 92 // we have reached some other platform specific limit. |
98 // | 93 // |
99 // |params.format| can be set to AUDIO_PCM_LOW_LATENCY and that has two | 94 // |params.format| can be set to AUDIO_PCM_LOW_LATENCY and that has two |
100 // effects: | 95 // effects: |
101 // 1- Instead of triple buffered the audio will be double buffered. | 96 // 1- Instead of triple buffered the audio will be double buffered. |
102 // 2- A low latency driver or alternative audio subsystem will be used when | 97 // 2- A low latency driver or alternative audio subsystem will be used when |
103 // available. | 98 // available. |
104 // | 99 // |
105 // Do not free the returned AudioOutputStream. It is owned by AudioManager. | 100 // Do not free the returned AudioOutputStream. It is owned by AudioManager. |
106 virtual AudioOutputStream* MakeAudioOutputStream( | 101 virtual AudioOutputStream* MakeAudioOutputStream( |
107 const AudioParameters& params, | 102 const AudioParameters& params, |
108 const std::string& device_id, | 103 const std::string& device_id) = 0; |
109 const std::string& input_device_id) = 0; | |
110 | 104 |
111 // Creates new audio output proxy. A proxy implements | 105 // Creates new audio output proxy. A proxy implements |
112 // AudioOutputStream interface, but unlike regular output stream | 106 // AudioOutputStream interface, but unlike regular output stream |
113 // created with MakeAudioOutputStream() it opens device only when a | 107 // created with MakeAudioOutputStream() it opens device only when a |
114 // sound is actually playing. | 108 // sound is actually playing. |
115 virtual AudioOutputStream* MakeAudioOutputStreamProxy( | 109 virtual AudioOutputStream* MakeAudioOutputStreamProxy( |
116 const AudioParameters& params, | 110 const AudioParameters& params, |
117 const std::string& device_id, | 111 const std::string& device_id) = 0; |
118 const std::string& input_device_id) = 0; | |
119 | 112 |
120 // Factory to create audio recording streams. | 113 // Factory to create audio recording streams. |
121 // |channels| can be 1 or 2. | 114 // |channels| can be 1 or 2. |
122 // |sample_rate| is in hertz and can be any value supported by the platform. | 115 // |sample_rate| is in hertz and can be any value supported by the platform. |
123 // |bits_per_sample| can be any value supported by the platform. | 116 // |bits_per_sample| can be any value supported by the platform. |
124 // |samples_per_packet| is in hertz as well and can be 0 to |sample_rate|, | 117 // |samples_per_packet| is in hertz as well and can be 0 to |sample_rate|, |
125 // with 0 suggesting that the implementation use a default value for that | 118 // with 0 suggesting that the implementation use a default value for that |
126 // platform. | 119 // platform. |
127 // Returns NULL if the combination of the parameters is not supported, or if | 120 // Returns NULL if the combination of the parameters is not supported, or if |
128 // we have reached some other platform specific limit. | 121 // we have reached some other platform specific limit. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 protected: | 184 protected: |
192 AudioManager(); | 185 AudioManager(); |
193 | 186 |
194 private: | 187 private: |
195 DISALLOW_COPY_AND_ASSIGN(AudioManager); | 188 DISALLOW_COPY_AND_ASSIGN(AudioManager); |
196 }; | 189 }; |
197 | 190 |
198 } // namespace media | 191 } // namespace media |
199 | 192 |
200 #endif // MEDIA_AUDIO_AUDIO_MANAGER_H_ | 193 #endif // MEDIA_AUDIO_AUDIO_MANAGER_H_ |
OLD | NEW |