OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 |
11 #ifndef WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_DUMMY_H | 11 #ifndef WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_NOT_IMPLEMENTED_IOS_H |
12 #define WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_DUMMY_H | 12 #define WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_NOT_IMPLEMENTED_IOS_H |
13 | |
14 #include <stdio.h> | |
15 | 13 |
16 #include "webrtc/modules/audio_device/audio_device_generic.h" | 14 #include "webrtc/modules/audio_device/audio_device_generic.h" |
17 | 15 |
18 namespace webrtc { | 16 namespace webrtc { |
19 | 17 |
20 class AudioDeviceDummy : public AudioDeviceGeneric { | 18 // AudioDeviceNotImplementedIOS contains default implementations of all methods |
| 19 // in the webrtc::AudioDeviceModule which are currently not supported for iOS. |
| 20 // The real implementation is in AudioDeviceIOS and it derives from this class. |
| 21 // The main purpose of breaking out non-implemented methods into a separate |
| 22 // unit is to make AudioDeviceIOS more readable and easier to maintain. |
| 23 class AudioDeviceNotImplementedIOS : public AudioDeviceGeneric { |
21 public: | 24 public: |
22 AudioDeviceDummy(const int32_t id) {} | 25 AudioDeviceNotImplementedIOS(); |
23 virtual ~AudioDeviceDummy() {} | |
24 | 26 |
25 // Retrieve the currently utilized audio layer | 27 // Methods in webrtc::AudioDeviceModule which are not yet implemented. |
26 int32_t ActiveAudioLayer( | 28 // The idea is that we can move methods from this class to the real |
27 AudioDeviceModule::AudioLayer& audioLayer) const override; | 29 // implementation in AudioDeviceIOS when needed. |
28 | 30 int32_t ActiveAudioLayer(AudioDeviceModule::AudioLayer& audioLayer) const; |
29 // Main initializaton and termination | 31 int32_t ResetAudioDevice() override; |
30 int32_t Init() override; | 32 int32_t PlayoutIsAvailable(bool& available) override; |
31 int32_t Terminate() override; | 33 int32_t RecordingIsAvailable(bool& available) override; |
32 bool Initialized() const override; | 34 int32_t SetAGC(bool enable) override; |
33 | 35 bool AGC() const override; |
34 // Device enumeration | |
35 int16_t PlayoutDevices() override; | 36 int16_t PlayoutDevices() override; |
36 int16_t RecordingDevices() override; | 37 int16_t RecordingDevices() override; |
37 int32_t PlayoutDeviceName(uint16_t index, | 38 int32_t PlayoutDeviceName(uint16_t index, |
38 char name[kAdmMaxDeviceNameSize], | 39 char name[kAdmMaxDeviceNameSize], |
39 char guid[kAdmMaxGuidSize]) override; | 40 char guid[kAdmMaxGuidSize]) override; |
40 int32_t RecordingDeviceName(uint16_t index, | 41 int32_t RecordingDeviceName(uint16_t index, |
41 char name[kAdmMaxDeviceNameSize], | 42 char name[kAdmMaxDeviceNameSize], |
42 char guid[kAdmMaxGuidSize]) override; | 43 char guid[kAdmMaxGuidSize]) override; |
43 | |
44 // Device selection | |
45 int32_t SetPlayoutDevice(uint16_t index) override; | 44 int32_t SetPlayoutDevice(uint16_t index) override; |
46 int32_t SetPlayoutDevice( | 45 int32_t SetPlayoutDevice( |
47 AudioDeviceModule::WindowsDeviceType device) override; | 46 AudioDeviceModule::WindowsDeviceType device) override; |
48 int32_t SetRecordingDevice(uint16_t index) override; | 47 int32_t SetRecordingDevice(uint16_t index) override; |
49 int32_t SetRecordingDevice( | 48 int32_t SetRecordingDevice( |
50 AudioDeviceModule::WindowsDeviceType device) override; | 49 AudioDeviceModule::WindowsDeviceType device) override; |
51 | |
52 // Audio transport initialization | |
53 int32_t PlayoutIsAvailable(bool& available) override; | |
54 int32_t InitPlayout() override; | |
55 bool PlayoutIsInitialized() const override; | |
56 int32_t RecordingIsAvailable(bool& available) override; | |
57 int32_t InitRecording() override; | |
58 bool RecordingIsInitialized() const override; | |
59 | |
60 // Audio transport control | |
61 int32_t StartPlayout() override; | |
62 int32_t StopPlayout() override; | |
63 bool Playing() const override; | |
64 int32_t StartRecording() override; | |
65 int32_t StopRecording() override; | |
66 bool Recording() const override; | |
67 | |
68 // Microphone Automatic Gain Control (AGC) | |
69 int32_t SetAGC(bool enable) override; | |
70 bool AGC() const override; | |
71 | |
72 // Volume control based on the Windows Wave API (Windows only) | |
73 int32_t SetWaveOutVolume(uint16_t volumeLeft, uint16_t volumeRight) override; | 50 int32_t SetWaveOutVolume(uint16_t volumeLeft, uint16_t volumeRight) override; |
74 int32_t WaveOutVolume(uint16_t& volumeLeft, | 51 int32_t WaveOutVolume(uint16_t& volumeLeft, |
75 uint16_t& volumeRight) const override; | 52 uint16_t& volumeRight) const override; |
76 | |
77 // Audio mixer initialization | |
78 int32_t InitSpeaker() override; | 53 int32_t InitSpeaker() override; |
79 bool SpeakerIsInitialized() const override; | 54 bool SpeakerIsInitialized() const override; |
80 int32_t InitMicrophone() override; | 55 int32_t InitMicrophone() override; |
81 bool MicrophoneIsInitialized() const override; | 56 bool MicrophoneIsInitialized() const override; |
82 | |
83 // Speaker volume controls | |
84 int32_t SpeakerVolumeIsAvailable(bool& available) override; | 57 int32_t SpeakerVolumeIsAvailable(bool& available) override; |
85 int32_t SetSpeakerVolume(uint32_t volume) override; | 58 int32_t SetSpeakerVolume(uint32_t volume) override; |
86 int32_t SpeakerVolume(uint32_t& volume) const override; | 59 int32_t SpeakerVolume(uint32_t& volume) const override; |
87 int32_t MaxSpeakerVolume(uint32_t& maxVolume) const override; | 60 int32_t MaxSpeakerVolume(uint32_t& maxVolume) const override; |
88 int32_t MinSpeakerVolume(uint32_t& minVolume) const override; | 61 int32_t MinSpeakerVolume(uint32_t& minVolume) const override; |
89 int32_t SpeakerVolumeStepSize(uint16_t& stepSize) const override; | 62 int32_t SpeakerVolumeStepSize(uint16_t& stepSize) const override; |
90 | |
91 // Microphone volume controls | |
92 int32_t MicrophoneVolumeIsAvailable(bool& available) override; | 63 int32_t MicrophoneVolumeIsAvailable(bool& available) override; |
93 int32_t SetMicrophoneVolume(uint32_t volume) override; | 64 int32_t SetMicrophoneVolume(uint32_t volume) override; |
94 int32_t MicrophoneVolume(uint32_t& volume) const override; | 65 int32_t MicrophoneVolume(uint32_t& volume) const override; |
95 int32_t MaxMicrophoneVolume(uint32_t& maxVolume) const override; | 66 int32_t MaxMicrophoneVolume(uint32_t& maxVolume) const override; |
96 int32_t MinMicrophoneVolume(uint32_t& minVolume) const override; | 67 int32_t MinMicrophoneVolume(uint32_t& minVolume) const override; |
97 int32_t MicrophoneVolumeStepSize(uint16_t& stepSize) const override; | 68 int32_t MicrophoneVolumeStepSize(uint16_t& stepSize) const override; |
98 | 69 int32_t MicrophoneMuteIsAvailable(bool& available) override; |
99 // Speaker mute control | 70 int32_t SetMicrophoneMute(bool enable) override; |
| 71 int32_t MicrophoneMute(bool& enabled) const override; |
100 int32_t SpeakerMuteIsAvailable(bool& available) override; | 72 int32_t SpeakerMuteIsAvailable(bool& available) override; |
101 int32_t SetSpeakerMute(bool enable) override; | 73 int32_t SetSpeakerMute(bool enable) override; |
102 int32_t SpeakerMute(bool& enabled) const override; | 74 int32_t SpeakerMute(bool& enabled) const override; |
103 | |
104 // Microphone mute control | |
105 int32_t MicrophoneMuteIsAvailable(bool& available) override; | |
106 int32_t SetMicrophoneMute(bool enable) override; | |
107 int32_t MicrophoneMute(bool& enabled) const override; | |
108 | |
109 // Microphone boost control | |
110 int32_t MicrophoneBoostIsAvailable(bool& available) override; | 75 int32_t MicrophoneBoostIsAvailable(bool& available) override; |
111 int32_t SetMicrophoneBoost(bool enable) override; | 76 int32_t SetMicrophoneBoost(bool enable) override; |
112 int32_t MicrophoneBoost(bool& enabled) const override; | 77 int32_t MicrophoneBoost(bool& enabled) const override; |
113 | |
114 // Stereo support | |
115 int32_t StereoPlayoutIsAvailable(bool& available) override; | 78 int32_t StereoPlayoutIsAvailable(bool& available) override; |
116 int32_t SetStereoPlayout(bool enable) override; | 79 int32_t SetStereoPlayout(bool enable) override; |
117 int32_t StereoPlayout(bool& enabled) const override; | 80 int32_t StereoPlayout(bool& enabled) const override; |
118 int32_t StereoRecordingIsAvailable(bool& available) override; | 81 int32_t StereoRecordingIsAvailable(bool& available) override; |
119 int32_t SetStereoRecording(bool enable) override; | 82 int32_t SetStereoRecording(bool enable) override; |
120 int32_t StereoRecording(bool& enabled) const override; | 83 int32_t StereoRecording(bool& enabled) const override; |
121 | |
122 // Delay information and control | |
123 int32_t SetPlayoutBuffer(const AudioDeviceModule::BufferType type, | 84 int32_t SetPlayoutBuffer(const AudioDeviceModule::BufferType type, |
124 uint16_t sizeMS) override; | 85 uint16_t sizeMS) override; |
125 int32_t PlayoutBuffer(AudioDeviceModule::BufferType& type, | |
126 uint16_t& sizeMS) const override; | |
127 int32_t PlayoutDelay(uint16_t& delayMS) const override; | |
128 int32_t RecordingDelay(uint16_t& delayMS) const override; | |
129 | |
130 // CPU load | |
131 int32_t CPULoad(uint16_t& load) const override; | 86 int32_t CPULoad(uint16_t& load) const override; |
132 | |
133 bool PlayoutWarning() const override; | 87 bool PlayoutWarning() const override; |
134 bool PlayoutError() const override; | 88 bool PlayoutError() const override; |
135 bool RecordingWarning() const override; | 89 bool RecordingWarning() const override; |
136 bool RecordingError() const override; | 90 bool RecordingError() const override; |
137 void ClearPlayoutWarning() override; | 91 void ClearPlayoutWarning() override{}; |
138 void ClearPlayoutError() override; | 92 void ClearPlayoutError() override{}; |
139 void ClearRecordingWarning() override; | 93 void ClearRecordingWarning() override{}; |
140 void ClearRecordingError() override; | 94 void ClearRecordingError() override{}; |
141 | 95 |
142 void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) override; | 96 protected: |
| 97 ~AudioDeviceNotImplementedIOS() {} |
143 }; | 98 }; |
144 | 99 |
145 } // namespace webrtc | 100 } // namespace webrtc |
146 | 101 |
147 #endif // WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_DUMMY_H | 102 #endif // WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_NOT_IMPLEMENTED_IOS_H |
OLD | NEW |