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 AUDIO_DEVICE_AUDIO_DEVICE_DUMMY_H_
12 #define AUDIO_DEVICE_AUDIO_DEVICE_DUMMY_H_
13 
14 #include <stdint.h>
15 
16 #include "modules/audio_device/audio_device_buffer.h"
17 #include "modules/audio_device/audio_device_generic.h"
18 #include "modules/audio_device/include/audio_device.h"
19 #include "modules/audio_device/include/audio_device_defines.h"
20 
21 namespace webrtc {
22 
23 class AudioDeviceDummy : public AudioDeviceGeneric {
24  public:
AudioDeviceDummy()25   AudioDeviceDummy() {}
~AudioDeviceDummy()26   virtual ~AudioDeviceDummy() {}
27 
28   // Retrieve the currently utilized audio layer
29   int32_t ActiveAudioLayer(
30       AudioDeviceModule::AudioLayer& audioLayer) const override;
31 
32   // Main initializaton and termination
33   InitStatus Init() override;
34   int32_t Terminate() override;
35   bool Initialized() const override;
36 
37   // Device enumeration
38   int16_t PlayoutDevices() override;
39   int16_t RecordingDevices() override;
40   int32_t PlayoutDeviceName(uint16_t index,
41                             char name[kAdmMaxDeviceNameSize],
42                             char guid[kAdmMaxGuidSize]) override;
43   int32_t RecordingDeviceName(uint16_t index,
44                               char name[kAdmMaxDeviceNameSize],
45                               char guid[kAdmMaxGuidSize]) override;
46 
47   // Device selection
48   int32_t SetPlayoutDevice(uint16_t index) override;
49   int32_t SetPlayoutDevice(
50       AudioDeviceModule::WindowsDeviceType device) override;
51   int32_t SetRecordingDevice(uint16_t index) override;
52   int32_t SetRecordingDevice(
53       AudioDeviceModule::WindowsDeviceType device) override;
54 
55   // Audio transport initialization
56   int32_t PlayoutIsAvailable(bool& available) override;
57   int32_t InitPlayout() override;
58   bool PlayoutIsInitialized() const override;
59   int32_t RecordingIsAvailable(bool& available) override;
60   int32_t InitRecording() override;
61   bool RecordingIsInitialized() const override;
62 
63   // Audio transport control
64   int32_t StartPlayout() override;
65   int32_t StopPlayout() override;
66   bool Playing() const override;
67   int32_t StartRecording() override;
68   int32_t StopRecording() override;
69   bool Recording() const override;
70 
71   // Audio mixer initialization
72   int32_t InitSpeaker() override;
73   bool SpeakerIsInitialized() const override;
74   int32_t InitMicrophone() override;
75   bool MicrophoneIsInitialized() const override;
76 
77   // Speaker volume controls
78   int32_t SpeakerVolumeIsAvailable(bool& available) override;
79   int32_t SetSpeakerVolume(uint32_t volume) override;
80   int32_t SpeakerVolume(uint32_t& volume) const override;
81   int32_t MaxSpeakerVolume(uint32_t& maxVolume) const override;
82   int32_t MinSpeakerVolume(uint32_t& minVolume) const override;
83 
84   // Microphone volume controls
85   int32_t MicrophoneVolumeIsAvailable(bool& available) override;
86   int32_t SetMicrophoneVolume(uint32_t volume) override;
87   int32_t MicrophoneVolume(uint32_t& volume) const override;
88   int32_t MaxMicrophoneVolume(uint32_t& maxVolume) const override;
89   int32_t MinMicrophoneVolume(uint32_t& minVolume) const override;
90 
91   // Speaker mute control
92   int32_t SpeakerMuteIsAvailable(bool& available) override;
93   int32_t SetSpeakerMute(bool enable) override;
94   int32_t SpeakerMute(bool& enabled) const override;
95 
96   // Microphone mute control
97   int32_t MicrophoneMuteIsAvailable(bool& available) override;
98   int32_t SetMicrophoneMute(bool enable) override;
99   int32_t MicrophoneMute(bool& enabled) const override;
100 
101   // Stereo support
102   int32_t StereoPlayoutIsAvailable(bool& available) override;
103   int32_t SetStereoPlayout(bool enable) override;
104   int32_t StereoPlayout(bool& enabled) const override;
105   int32_t StereoRecordingIsAvailable(bool& available) override;
106   int32_t SetStereoRecording(bool enable) override;
107   int32_t StereoRecording(bool& enabled) const override;
108 
109   // Delay information and control
110   int32_t PlayoutDelay(uint16_t& delayMS) const override;
111 
112   void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) override;
113 };
114 
115 }  // namespace webrtc
116 
117 #endif  // AUDIO_DEVICE_AUDIO_DEVICE_DUMMY_H_
118