| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2016 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 15 matching lines...) Expand all Loading... |
| 26 AudioBufferList* io_data) = 0; | 26 AudioBufferList* io_data) = 0; |
| 27 | 27 |
| 28 // Callback function called on a real-time priority I/O thread from the audio | 28 // Callback function called on a real-time priority I/O thread from the audio |
| 29 // unit. This method is used to provide audio samples to the audio unit. | 29 // unit. This method is used to provide audio samples to the audio unit. |
| 30 virtual OSStatus OnGetPlayoutData(AudioUnitRenderActionFlags* io_action_flags, | 30 virtual OSStatus OnGetPlayoutData(AudioUnitRenderActionFlags* io_action_flags, |
| 31 const AudioTimeStamp* time_stamp, | 31 const AudioTimeStamp* time_stamp, |
| 32 UInt32 bus_number, | 32 UInt32 bus_number, |
| 33 UInt32 num_frames, | 33 UInt32 num_frames, |
| 34 AudioBufferList* io_data) = 0; | 34 AudioBufferList* io_data) = 0; |
| 35 | 35 |
| 36 // Callback function called when the sample rate changes. |
| 37 virtual void OnSampleRateChange(float sample_rate) = 0; |
| 38 |
| 36 protected: | 39 protected: |
| 37 ~VoiceProcessingAudioUnitObserver() {} | 40 ~VoiceProcessingAudioUnitObserver() {} |
| 38 }; | 41 }; |
| 39 | 42 |
| 40 // Convenience class to abstract away the management of a Voice Processing | 43 // Convenience class to abstract away the management of a Voice Processing |
| 41 // I/O Audio Unit. The Voice Processing I/O unit has the same characteristics | 44 // I/O Audio Unit. The Voice Processing I/O unit has the same characteristics |
| 42 // as the Remote I/O unit (supports full duplex low-latency audio input and | 45 // as the Remote I/O unit (supports full duplex low-latency audio input and |
| 43 // output) and adds AEC for for two-way duplex communication. It also adds AGC, | 46 // output) and adds AEC for for two-way duplex communication. It also adds AGC, |
| 44 // adjustment of voice-processing quality, and muting. Hence, ideal for | 47 // adjustment of voice-processing quality, and muting. Hence, ideal for |
| 45 // VoIP applications. | 48 // VoIP applications. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 const AudioTimeStamp* time_stamp, | 103 const AudioTimeStamp* time_stamp, |
| 101 UInt32 bus_number, | 104 UInt32 bus_number, |
| 102 UInt32 num_frames, | 105 UInt32 num_frames, |
| 103 AudioBufferList* io_data); | 106 AudioBufferList* io_data); |
| 104 static OSStatus OnDeliverRecordedData(void* in_ref_con, | 107 static OSStatus OnDeliverRecordedData(void* in_ref_con, |
| 105 AudioUnitRenderActionFlags* flags, | 108 AudioUnitRenderActionFlags* flags, |
| 106 const AudioTimeStamp* time_stamp, | 109 const AudioTimeStamp* time_stamp, |
| 107 UInt32 bus_number, | 110 UInt32 bus_number, |
| 108 UInt32 num_frames, | 111 UInt32 num_frames, |
| 109 AudioBufferList* io_data); | 112 AudioBufferList* io_data); |
| 113 static void OnSampleRateChange(void* in_ref_con, |
| 114 AudioUnit audio_unit, |
| 115 AudioUnitPropertyID property_id, |
| 116 AudioUnitScope scope, |
| 117 AudioUnitElement element); |
| 110 | 118 |
| 111 // Notifies observer that samples are needed for playback. | 119 // Notifies observer that samples are needed for playback. |
| 112 OSStatus NotifyGetPlayoutData(AudioUnitRenderActionFlags* flags, | 120 OSStatus NotifyGetPlayoutData(AudioUnitRenderActionFlags* flags, |
| 113 const AudioTimeStamp* time_stamp, | 121 const AudioTimeStamp* time_stamp, |
| 114 UInt32 bus_number, | 122 UInt32 bus_number, |
| 115 UInt32 num_frames, | 123 UInt32 num_frames, |
| 116 AudioBufferList* io_data); | 124 AudioBufferList* io_data); |
| 117 // Notifies observer that recorded samples are available for render. | 125 // Notifies observer that recorded samples are available for render. |
| 118 OSStatus NotifyDeliverRecordedData(AudioUnitRenderActionFlags* flags, | 126 OSStatus NotifyDeliverRecordedData(AudioUnitRenderActionFlags* flags, |
| 119 const AudioTimeStamp* time_stamp, | 127 const AudioTimeStamp* time_stamp, |
| 120 UInt32 bus_number, | 128 UInt32 bus_number, |
| 121 UInt32 num_frames, | 129 UInt32 num_frames, |
| 122 AudioBufferList* io_data); | 130 AudioBufferList* io_data); |
| 131 // Notifies observer that sample rate has changed. |
| 132 void NotifySampleRateChange(AudioUnit audio_unit, |
| 133 AudioUnitPropertyID property_id, |
| 134 AudioUnitScope scope, |
| 135 AudioUnitElement element); |
| 123 | 136 |
| 124 // Returns the predetermined format with a specific sample rate. See | 137 // Returns the predetermined format with a specific sample rate. See |
| 125 // implementation file for details on format. | 138 // implementation file for details on format. |
| 126 AudioStreamBasicDescription GetFormat(Float64 sample_rate) const; | 139 AudioStreamBasicDescription GetFormat(Float64 sample_rate) const; |
| 127 | 140 |
| 128 // Deletes the underlying audio unit. | 141 // Deletes the underlying audio unit. |
| 129 void DisposeAudioUnit(); | 142 void DisposeAudioUnit(); |
| 130 | 143 |
| 131 VoiceProcessingAudioUnitObserver* observer_; | 144 VoiceProcessingAudioUnitObserver* observer_; |
| 132 AudioUnit vpio_unit_; | 145 AudioUnit vpio_unit_; |
| 133 VoiceProcessingAudioUnit::State state_; | 146 VoiceProcessingAudioUnit::State state_; |
| 134 }; | 147 }; |
| 135 } // namespace webrtc | 148 } // namespace webrtc |
| 136 | 149 |
| 137 #endif // WEBRTC_MODULES_AUDIO_DEVICE_IOS_VOICE_PROCESSING_AUDIO_UNIT_H_ | 150 #endif // WEBRTC_MODULES_AUDIO_DEVICE_IOS_VOICE_PROCESSING_AUDIO_UNIT_H_ |
| OLD | NEW |