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/audio_device_generic.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.8 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_AUDIO_DEVICE_AUDIO_DEVICE_GENERIC_H
12#define WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_GENERIC_H
13
14#include "webrtc/modules/audio_device/audio_device_buffer.h"
15#include "webrtc/modules/audio_device/include/audio_device.h"
16
17namespace webrtc {
18
19class AudioDeviceGeneric
20{
21 public:
22
23        // Retrieve the currently utilized audio layer
24        virtual int32_t ActiveAudioLayer(
25        AudioDeviceModule::AudioLayer& audioLayer) const = 0;
26
27        // Main initializaton and termination
28    virtual int32_t Init() = 0;
29    virtual int32_t Terminate() = 0;
30        virtual bool Initialized() const = 0;
31
32        // Device enumeration
33        virtual int16_t PlayoutDevices() = 0;
34        virtual int16_t RecordingDevices() = 0;
35        virtual int32_t PlayoutDeviceName(
36        uint16_t index,
37        char name[kAdmMaxDeviceNameSize],
38        char guid[kAdmMaxGuidSize]) = 0;
39    virtual int32_t RecordingDeviceName(
40        uint16_t index,
41        char name[kAdmMaxDeviceNameSize],
42        char guid[kAdmMaxGuidSize]) = 0;
43
44        // Device selection
45        virtual int32_t SetPlayoutDevice(uint16_t index) = 0;
46        virtual int32_t SetPlayoutDevice(
47        AudioDeviceModule::WindowsDeviceType device) = 0;
48    virtual int32_t SetRecordingDevice(uint16_t index) = 0;
49        virtual int32_t SetRecordingDevice(
50        AudioDeviceModule::WindowsDeviceType device) = 0;
51
52        // Audio transport initialization
53    virtual int32_t PlayoutIsAvailable(bool& available) = 0;
54    virtual int32_t InitPlayout() = 0;
55    virtual bool PlayoutIsInitialized() const = 0;
56    virtual int32_t RecordingIsAvailable(bool& available) = 0;
57    virtual int32_t InitRecording() = 0;
58    virtual bool RecordingIsInitialized() const = 0;
59
60        // Audio transport control
61    virtual int32_t StartPlayout() = 0;
62    virtual int32_t StopPlayout() = 0;
63    virtual bool Playing() const = 0;
64        virtual int32_t StartRecording() = 0;
65    virtual int32_t StopRecording() = 0;
66    virtual bool Recording() const = 0;
67
68    // Microphone Automatic Gain Control (AGC)
69    virtual int32_t SetAGC(bool enable) = 0;
70    virtual bool AGC() const = 0;
71
72    // Volume control based on the Windows Wave API (Windows only)
73    virtual int32_t SetWaveOutVolume(uint16_t volumeLeft,
74                                     uint16_t volumeRight) = 0;
75    virtual int32_t WaveOutVolume(uint16_t& volumeLeft,
76                                  uint16_t& volumeRight) const = 0;
77
78        // Audio mixer initialization
79        virtual int32_t SpeakerIsAvailable(bool& available) = 0;
80    virtual int32_t InitSpeaker() = 0;
81    virtual bool SpeakerIsInitialized() const = 0;
82        virtual int32_t MicrophoneIsAvailable(bool& available) = 0;
83    virtual int32_t InitMicrophone() = 0;
84    virtual bool MicrophoneIsInitialized() const = 0;
85
86    // Speaker volume controls
87        virtual int32_t SpeakerVolumeIsAvailable(bool& available) = 0;
88    virtual int32_t SetSpeakerVolume(uint32_t volume) = 0;
89    virtual int32_t SpeakerVolume(uint32_t& volume) const = 0;
90    virtual int32_t MaxSpeakerVolume(uint32_t& maxVolume) const = 0;
91    virtual int32_t MinSpeakerVolume(uint32_t& minVolume) const = 0;
92    virtual int32_t SpeakerVolumeStepSize(
93        uint16_t& stepSize) const = 0;
94
95    // Microphone volume controls
96        virtual int32_t MicrophoneVolumeIsAvailable(bool& available) = 0;
97    virtual int32_t SetMicrophoneVolume(uint32_t volume) = 0;
98    virtual int32_t MicrophoneVolume(uint32_t& volume) const = 0;
99    virtual int32_t MaxMicrophoneVolume(
100        uint32_t& maxVolume) const = 0;
101    virtual int32_t MinMicrophoneVolume(
102        uint32_t& minVolume) const = 0;
103    virtual int32_t MicrophoneVolumeStepSize(
104        uint16_t& stepSize) const = 0;
105
106    // Speaker mute control
107    virtual int32_t SpeakerMuteIsAvailable(bool& available) = 0;
108    virtual int32_t SetSpeakerMute(bool enable) = 0;
109    virtual int32_t SpeakerMute(bool& enabled) const = 0;
110
111        // Microphone mute control
112    virtual int32_t MicrophoneMuteIsAvailable(bool& available) = 0;
113    virtual int32_t SetMicrophoneMute(bool enable) = 0;
114    virtual int32_t MicrophoneMute(bool& enabled) const = 0;
115
116    // Microphone boost control
117    virtual int32_t MicrophoneBoostIsAvailable(bool& available) = 0;
118        virtual int32_t SetMicrophoneBoost(bool enable) = 0;
119    virtual int32_t MicrophoneBoost(bool& enabled) const = 0;
120
121    // Stereo support
122    virtual int32_t StereoPlayoutIsAvailable(bool& available) = 0;
123        virtual int32_t SetStereoPlayout(bool enable) = 0;
124    virtual int32_t StereoPlayout(bool& enabled) const = 0;
125    virtual int32_t StereoRecordingIsAvailable(bool& available) = 0;
126    virtual int32_t SetStereoRecording(bool enable) = 0;
127    virtual int32_t StereoRecording(bool& enabled) const = 0;
128
129    // Delay information and control
130        virtual int32_t SetPlayoutBuffer(
131        const AudioDeviceModule::BufferType type,
132        uint16_t sizeMS = 0) = 0;
133    virtual int32_t PlayoutBuffer(
134        AudioDeviceModule::BufferType& type, uint16_t& sizeMS) const = 0;
135    virtual int32_t PlayoutDelay(uint16_t& delayMS) const = 0;
136        virtual int32_t RecordingDelay(uint16_t& delayMS) const = 0;
137
138    // CPU load
139    virtual int32_t CPULoad(uint16_t& load) const = 0;
140   
141    // Native sample rate controls (samples/sec)
142        virtual int32_t SetRecordingSampleRate(
143        const uint32_t samplesPerSec);
144        virtual int32_t SetPlayoutSampleRate(
145        const uint32_t samplesPerSec);
146
147    // Speaker audio routing (for mobile devices)
148    virtual int32_t SetLoudspeakerStatus(bool enable);
149    virtual int32_t GetLoudspeakerStatus(bool& enable) const;
150   
151    // Reset Audio Device (for mobile devices)
152    virtual int32_t ResetAudioDevice();
153
154    // Sound Audio Device control (for WinCE only)
155    virtual int32_t SoundDeviceControl(unsigned int par1 = 0,
156                                       unsigned int par2 = 0,
157                                       unsigned int par3 = 0,
158                                       unsigned int par4 = 0);
159
160    // Windows Core Audio only.
161    virtual int32_t EnableBuiltInAEC(bool enable);
162    virtual bool BuiltInAECIsEnabled() const;
163
164public:
165    virtual bool PlayoutWarning() const = 0;
166    virtual bool PlayoutError() const = 0;
167    virtual bool RecordingWarning() const = 0;
168    virtual bool RecordingError() const = 0;
169    virtual void ClearPlayoutWarning() = 0;
170    virtual void ClearPlayoutError() = 0;
171    virtual void ClearRecordingWarning() = 0;
172    virtual void ClearRecordingError() = 0;
173
174public:
175    virtual void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) = 0;
176
177    virtual ~AudioDeviceGeneric() {}
178};
179
180}  // namespace webrtc
181
182#endif  // WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_GENERIC_H
Note: See TracBrowser for help on using the repository browser.