Home | History | Annotate | Download | only in dummy
      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 
     18 namespace webrtc {
     19 
     20 class AudioDeviceDummy : public AudioDeviceGeneric {
     21  public:
     22   AudioDeviceDummy(const int32_t id) {}
     23   virtual ~AudioDeviceDummy() {}
     24 
     25   // Retrieve the currently utilized audio layer
     26   int32_t ActiveAudioLayer(
     27       AudioDeviceModule::AudioLayer& audioLayer) const override;
     28 
     29   // Main initializaton and termination
     30   int32_t Init() override;
     31   int32_t Terminate() override;
     32   bool Initialized() const override;
     33 
     34   // Device enumeration
     35   int16_t PlayoutDevices() override;
     36   int16_t RecordingDevices() override;
     37   int32_t PlayoutDeviceName(uint16_t index,
     38                             char name[kAdmMaxDeviceNameSize],
     39                             char guid[kAdmMaxGuidSize]) override;
     40   int32_t RecordingDeviceName(uint16_t index,
     41                               char name[kAdmMaxDeviceNameSize],
     42                               char guid[kAdmMaxGuidSize]) override;
     43 
     44   // Device selection
     45   int32_t SetPlayoutDevice(uint16_t index) override;
     46   int32_t SetPlayoutDevice(
     47       AudioDeviceModule::WindowsDeviceType device) override;
     48   int32_t SetRecordingDevice(uint16_t index) override;
     49   int32_t SetRecordingDevice(
     50       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;
     74   int32_t WaveOutVolume(uint16_t& volumeLeft,
     75                         uint16_t& volumeRight) const override;
     76 
     77   // Audio mixer initialization
     78   int32_t InitSpeaker() override;
     79   bool SpeakerIsInitialized() const override;
     80   int32_t InitMicrophone() override;
     81   bool MicrophoneIsInitialized() const override;
     82 
     83   // Speaker volume controls
     84   int32_t SpeakerVolumeIsAvailable(bool& available) override;
     85   int32_t SetSpeakerVolume(uint32_t volume) override;
     86   int32_t SpeakerVolume(uint32_t& volume) const override;
     87   int32_t MaxSpeakerVolume(uint32_t& maxVolume) const override;
     88   int32_t MinSpeakerVolume(uint32_t& minVolume) const override;
     89   int32_t SpeakerVolumeStepSize(uint16_t& stepSize) const override;
     90 
     91   // Microphone volume controls
     92   int32_t MicrophoneVolumeIsAvailable(bool& available) override;
     93   int32_t SetMicrophoneVolume(uint32_t volume) override;
     94   int32_t MicrophoneVolume(uint32_t& volume) const override;
     95   int32_t MaxMicrophoneVolume(uint32_t& maxVolume) const override;
     96   int32_t MinMicrophoneVolume(uint32_t& minVolume) const override;
     97   int32_t MicrophoneVolumeStepSize(uint16_t& stepSize) const override;
     98 
     99   // Speaker mute control
    100   int32_t SpeakerMuteIsAvailable(bool& available) override;
    101   int32_t SetSpeakerMute(bool enable) override;
    102   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;
    111   int32_t SetMicrophoneBoost(bool enable) override;
    112   int32_t MicrophoneBoost(bool& enabled) const override;
    113 
    114   // Stereo support
    115   int32_t StereoPlayoutIsAvailable(bool& available) override;
    116   int32_t SetStereoPlayout(bool enable) override;
    117   int32_t StereoPlayout(bool& enabled) const override;
    118   int32_t StereoRecordingIsAvailable(bool& available) override;
    119   int32_t SetStereoRecording(bool enable) override;
    120   int32_t StereoRecording(bool& enabled) const override;
    121 
    122   // Delay information and control
    123   int32_t SetPlayoutBuffer(const AudioDeviceModule::BufferType type,
    124                            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;
    132 
    133   bool PlayoutWarning() const override;
    134   bool PlayoutError() const override;
    135   bool RecordingWarning() const override;
    136   bool RecordingError() const override;
    137   void ClearPlayoutWarning() override;
    138   void ClearPlayoutError() override;
    139   void ClearRecordingWarning() override;
    140   void ClearRecordingError() override;
    141 
    142   void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) override;
    143 };
    144 
    145 }  // namespace webrtc
    146 
    147 #endif  // WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_DUMMY_H
    148