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