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 // Implementation notes: | 5 // Implementation notes: |
6 // | 6 // |
7 // - It is recommended to first acquire the native sample rate of the default | 7 // - It is recommended to first acquire the native sample rate of the default |
8 // output device and then use the same rate when creating this object. | 8 // output device and then use the same rate when creating this object. |
9 // Use AUAudioOutputStream::HardwareSampleRate() to retrieve the sample rate. | 9 // Use AUAudioOutputStream::HardwareSampleRate() to retrieve the sample rate. |
10 // - Calling Close() also leads to self destruction. | 10 // - Calling Close() also leads to self destruction. |
11 // - The latency consists of two parts: | 11 // - The latency consists of two parts: |
12 // 1) Hardware latency, which includes Audio Unit latency, audio device | 12 // 1) Hardware latency, which includes Audio Unit latency, audio device |
13 // latency; | 13 // latency; |
14 // 2) The delay between the moment getting the callback and the scheduled time | 14 // 2) The delay between the moment getting the callback and the scheduled time |
15 // stamp that tells when the data is going to be played out. | 15 // stamp that tells when the data is going to be played out. |
16 // | 16 // |
17 #ifndef MEDIA_AUDIO_MAC_AUDIO_LOW_LATENCY_OUTPUT_MAC_H_ | 17 #ifndef MEDIA_AUDIO_MAC_AUDIO_LOW_LATENCY_OUTPUT_MAC_H_ |
18 #define MEDIA_AUDIO_MAC_AUDIO_LOW_LATENCY_OUTPUT_MAC_H_ | 18 #define MEDIA_AUDIO_MAC_AUDIO_LOW_LATENCY_OUTPUT_MAC_H_ |
19 | 19 |
20 #include <AudioUnit/AudioUnit.h> | 20 #include <AudioUnit/AudioUnit.h> |
21 | 21 |
22 #include "base/memory/scoped_ptr.h" | 22 #include "base/memory/scoped_ptr.h" |
23 #include "media/audio/audio_io.h" | 23 #include "media/audio/audio_io.h" |
24 #include "media/audio/audio_parameters.h" | 24 #include "media/audio/audio_parameters.h" |
25 | 25 |
| 26 namespace media { |
| 27 |
26 class AudioManagerMac; | 28 class AudioManagerMac; |
27 | 29 |
28 // Implementation of AudioOuputStream for Mac OS X using the | 30 // Implementation of AudioOuputStream for Mac OS X using the |
29 // default output Audio Unit present in OS 10.4 and later. | 31 // default output Audio Unit present in OS 10.4 and later. |
30 // The default output Audio Unit is for low-latency audio I/O. | 32 // The default output Audio Unit is for low-latency audio I/O. |
31 class AUAudioOutputStream : public AudioOutputStream { | 33 class AUAudioOutputStream : public AudioOutputStream { |
32 public: | 34 public: |
33 // The ctor takes all the usual parameters, plus |manager| which is the | 35 // The ctor takes all the usual parameters, plus |manager| which is the |
34 // the audio manager who is creating this object. | 36 // the audio manager who is creating this object. |
35 AUAudioOutputStream(AudioManagerMac* manager, | 37 AUAudioOutputStream(AudioManagerMac* manager, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 91 |
90 // Volume level from 0 to 1. | 92 // Volume level from 0 to 1. |
91 float volume_; | 93 float volume_; |
92 | 94 |
93 // Fixed playout hardware latency in frames. | 95 // Fixed playout hardware latency in frames. |
94 double hardware_latency_frames_; | 96 double hardware_latency_frames_; |
95 | 97 |
96 DISALLOW_COPY_AND_ASSIGN(AUAudioOutputStream); | 98 DISALLOW_COPY_AND_ASSIGN(AUAudioOutputStream); |
97 }; | 99 }; |
98 | 100 |
| 101 } // namespace media |
| 102 |
99 #endif // MEDIA_AUDIO_MAC_AUDIO_LOW_LATENCY_OUTPUT_MAC_H_ | 103 #endif // MEDIA_AUDIO_MAC_AUDIO_LOW_LATENCY_OUTPUT_MAC_H_ |
OLD | NEW |