Note: We no longer publish the latest version of our code here. We primarily use a kumc-bmi github organization. The heron ETL repository, in particular, is not public. Peers in the informatics community should see MultiSiteDev for details on requesting access.

source: webrtc/webrtc/modules/audio_device/android/audio_device_opensles_android.h @ 0:4bda6873e34c

pub_scrub_3792 tip
Last change on this file since 0:4bda6873e34c was 0:4bda6873e34c, checked in by Michael Prittie <mprittie@…>, 6 years ago

Scrubbed password for publication.

File size: 6.2 KB
Line 
1/*
2 *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 *
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
6 *  tree. An additional intellectual property rights grant can be found
7 *  in the file PATENTS.  All contributing project authors may
8 *  be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_AUDIO_DEVICE_OPENSLES_ANDROID_H_
12#define WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_AUDIO_DEVICE_OPENSLES_ANDROID_H_
13
14#include "webrtc/modules/audio_device/audio_device_generic.h"
15#include "webrtc/modules/audio_device/android/opensles_input.h"
16#include "webrtc/modules/audio_device/android/opensles_output.h"
17
18namespace webrtc {
19
20// Implements the interface of AudioDeviceGeneric. OpenSlesOutput and
21// OpenSlesInput are the imlementations.
22class AudioDeviceAndroidOpenSLES : public AudioDeviceGeneric {
23 public:
24  explicit AudioDeviceAndroidOpenSLES(const int32_t id);
25  virtual ~AudioDeviceAndroidOpenSLES();
26
27  // Retrieve the currently utilized audio layer
28  virtual int32_t ActiveAudioLayer(
29      AudioDeviceModule::AudioLayer& audioLayer) const;  // NOLINT
30
31  // Main initializaton and termination
32  virtual int32_t Init();
33  virtual int32_t Terminate() ;
34  virtual bool Initialized() const;
35
36  // Device enumeration
37  virtual int16_t PlayoutDevices();
38  virtual int16_t RecordingDevices();
39  virtual int32_t PlayoutDeviceName(uint16_t index,
40                                    char name[kAdmMaxDeviceNameSize],
41                                    char guid[kAdmMaxGuidSize]);
42  virtual int32_t RecordingDeviceName(uint16_t index,
43                                      char name[kAdmMaxDeviceNameSize],
44                                      char guid[kAdmMaxGuidSize]);
45
46  // Device selection
47  virtual int32_t SetPlayoutDevice(uint16_t index);
48  virtual int32_t SetPlayoutDevice(
49      AudioDeviceModule::WindowsDeviceType device);
50  virtual int32_t SetRecordingDevice(uint16_t index);
51  virtual int32_t SetRecordingDevice(
52      AudioDeviceModule::WindowsDeviceType device);
53
54  // Audio transport initialization
55  virtual int32_t PlayoutIsAvailable(bool& available);
56  virtual int32_t InitPlayout();
57  virtual bool PlayoutIsInitialized() const;
58  virtual int32_t RecordingIsAvailable(bool& available);
59  virtual int32_t InitRecording();
60  virtual bool RecordingIsInitialized() const;
61
62  // Audio transport control
63  virtual int32_t StartPlayout();
64  virtual int32_t StopPlayout();
65  virtual bool Playing() const;
66  virtual int32_t StartRecording();
67  virtual int32_t StopRecording();
68  virtual bool Recording() const;
69
70  // Microphone Automatic Gain Control (AGC)
71  virtual int32_t SetAGC(bool enable);
72  virtual bool AGC() const;
73
74  // Volume control based on the Windows Wave API (Windows only)
75  virtual int32_t SetWaveOutVolume(uint16_t volumeLeft,
76                                   uint16_t volumeRight);
77  virtual int32_t WaveOutVolume(
78      uint16_t& volumeLeft,  // NOLINT
79      uint16_t& volumeRight) const;  // NOLINT
80
81  // Audio mixer initialization
82  virtual int32_t SpeakerIsAvailable(bool& available);
83  virtual int32_t InitSpeaker();
84  virtual bool SpeakerIsInitialized() const;
85  virtual int32_t MicrophoneIsAvailable(bool& available);
86  virtual int32_t InitMicrophone();
87  virtual bool MicrophoneIsInitialized() const;
88
89  // Speaker volume controls
90  virtual int32_t SpeakerVolumeIsAvailable(bool& available);
91  virtual int32_t SetSpeakerVolume(uint32_t volume);
92  virtual int32_t SpeakerVolume(uint32_t& volume) const;
93  virtual int32_t MaxSpeakerVolume(uint32_t& maxVolume) const;
94  virtual int32_t MinSpeakerVolume(uint32_t& minVolume) const;
95  virtual int32_t SpeakerVolumeStepSize(uint16_t& stepSize) const;
96
97  // Microphone volume controls
98  virtual int32_t MicrophoneVolumeIsAvailable(bool& available);
99  virtual int32_t SetMicrophoneVolume(uint32_t volume);
100  virtual int32_t MicrophoneVolume(uint32_t& volume) const;
101  virtual int32_t MaxMicrophoneVolume(uint32_t& maxVolume) const;
102  virtual int32_t MinMicrophoneVolume(uint32_t& minVolume) const;
103  virtual int32_t MicrophoneVolumeStepSize(
104      uint16_t& stepSize) const;
105
106  // Speaker mute control
107  virtual int32_t SpeakerMuteIsAvailable(bool& available);
108  virtual int32_t SetSpeakerMute(bool enable);
109  virtual int32_t SpeakerMute(bool& enabled) const;
110
111  // Microphone mute control
112  virtual int32_t MicrophoneMuteIsAvailable(bool& available);
113  virtual int32_t SetMicrophoneMute(bool enable);
114  virtual int32_t MicrophoneMute(bool& enabled) const;
115
116  // Microphone boost control
117  virtual int32_t MicrophoneBoostIsAvailable(bool& available);
118  virtual int32_t SetMicrophoneBoost(bool enable);
119  virtual int32_t MicrophoneBoost(bool& enabled) const;
120
121  // Stereo support
122  virtual int32_t StereoPlayoutIsAvailable(bool& available);
123  virtual int32_t SetStereoPlayout(bool enable);
124  virtual int32_t StereoPlayout(bool& enabled) const;
125  virtual int32_t StereoRecordingIsAvailable(bool& available);
126  virtual int32_t SetStereoRecording(bool enable);
127  virtual int32_t StereoRecording(bool& enabled) const;
128
129  // Delay information and control
130  virtual int32_t SetPlayoutBuffer(const AudioDeviceModule::BufferType type,
131                                   uint16_t sizeMS);
132  virtual int32_t PlayoutBuffer(AudioDeviceModule::BufferType& type,
133                                uint16_t& sizeMS) const;
134  virtual int32_t PlayoutDelay(uint16_t& delayMS) const;
135  virtual int32_t RecordingDelay(uint16_t& delayMS) const;
136
137  // CPU load
138  virtual int32_t CPULoad(uint16_t& load) const;  // NOLINT
139
140  // Error and warning information
141  virtual bool PlayoutWarning() const;
142  virtual bool PlayoutError() const;
143  virtual bool RecordingWarning() const;
144  virtual bool RecordingError() const;
145  virtual void ClearPlayoutWarning();
146  virtual void ClearPlayoutError();
147  virtual void ClearRecordingWarning();
148  virtual void ClearRecordingError();
149
150  // Attach audio buffer
151  virtual void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer);
152
153  // Speaker audio routing
154  virtual int32_t SetLoudspeakerStatus(bool enable);
155  virtual int32_t GetLoudspeakerStatus(bool& enable) const;
156
157 private:
158  OpenSlesOutput output_;
159  OpenSlesInput input_;
160};
161
162}  // namespace webrtc
163
164#endif  // WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_AUDIO_DEVICE_OPENSLES_ANDROID_H_
Note: See TracBrowser for help on using the repository browser.