LCOV - code coverage report
Current view: top level - media/webrtc/trunk/webrtc/modules/audio_device - audio_device_generic.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 2 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 3 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : 
      17             : namespace webrtc {
      18             : 
      19           0 : class AudioDeviceGeneric {
      20             :  public:
      21             :   // For use with UMA logging. Must be kept in sync with histograms.xml in
      22             :   // Chrome, located at
      23             :   // https://cs.chromium.org/chromium/src/tools/metrics/histograms/histograms.xml
      24             :   enum class InitStatus {
      25             :     OK = 0,
      26             :     PLAYOUT_ERROR = 1,
      27             :     RECORDING_ERROR = 2,
      28             :     OTHER_ERROR = 3,
      29             :     NUM_STATUSES = 4
      30             :   };
      31             :   // Retrieve the currently utilized audio layer
      32             :   virtual int32_t ActiveAudioLayer(
      33             :       AudioDeviceModule::AudioLayer& audioLayer) const = 0;
      34             : 
      35             :   // Main initializaton and termination
      36             :   virtual InitStatus Init() = 0;
      37             :   virtual int32_t Terminate() = 0;
      38             :   virtual bool Initialized() const = 0;
      39             : 
      40             :   // Device enumeration
      41             :   virtual int16_t PlayoutDevices() = 0;
      42             :   virtual int16_t RecordingDevices() = 0;
      43             :   virtual int32_t PlayoutDeviceName(uint16_t index,
      44             :                                     char name[kAdmMaxDeviceNameSize],
      45             :                                     char guid[kAdmMaxGuidSize]) = 0;
      46             :   virtual int32_t RecordingDeviceName(uint16_t index,
      47             :                                       char name[kAdmMaxDeviceNameSize],
      48             :                                       char guid[kAdmMaxGuidSize]) = 0;
      49             : 
      50             :   // Device selection
      51             :   virtual int32_t SetPlayoutDevice(uint16_t index) = 0;
      52             :   virtual int32_t SetPlayoutDevice(
      53             :       AudioDeviceModule::WindowsDeviceType device) = 0;
      54             :   virtual int32_t SetRecordingDevice(uint16_t index) = 0;
      55             :   virtual int32_t SetRecordingDevice(
      56             :       AudioDeviceModule::WindowsDeviceType device) = 0;
      57             : 
      58             :   // Audio transport initialization
      59             :   virtual int32_t PlayoutIsAvailable(bool& available) = 0;
      60             :   virtual int32_t InitPlayout() = 0;
      61             :   virtual bool PlayoutIsInitialized() const = 0;
      62             :   virtual int32_t RecordingIsAvailable(bool& available) = 0;
      63             :   virtual int32_t InitRecording() = 0;
      64             :   virtual bool RecordingIsInitialized() const = 0;
      65             : 
      66             :   // Audio transport control
      67             :   virtual int32_t StartPlayout() = 0;
      68             :   virtual int32_t StopPlayout() = 0;
      69             :   virtual bool Playing() const = 0;
      70             :   virtual int32_t StartRecording() = 0;
      71             :   virtual int32_t StopRecording() = 0;
      72             :   virtual bool Recording() const = 0;
      73             : 
      74             :   // Microphone Automatic Gain Control (AGC)
      75             :   virtual int32_t SetAGC(bool enable) = 0;
      76             :   virtual bool AGC() const = 0;
      77             : 
      78             :   // Volume control based on the Windows Wave API (Windows only)
      79             :   virtual int32_t SetWaveOutVolume(uint16_t volumeLeft,
      80             :                                    uint16_t volumeRight) = 0;
      81             :   virtual int32_t WaveOutVolume(uint16_t& volumeLeft,
      82             :                                 uint16_t& volumeRight) const = 0;
      83             : 
      84             :   // Audio mixer initialization
      85             :   virtual int32_t InitSpeaker() = 0;
      86             :   virtual bool SpeakerIsInitialized() const = 0;
      87             :   virtual int32_t InitMicrophone() = 0;
      88             :   virtual bool MicrophoneIsInitialized() const = 0;
      89             : 
      90             :   // Speaker volume controls
      91             :   virtual int32_t SpeakerVolumeIsAvailable(bool& available) = 0;
      92             :   virtual int32_t SetSpeakerVolume(uint32_t volume) = 0;
      93             :   virtual int32_t SpeakerVolume(uint32_t& volume) const = 0;
      94             :   virtual int32_t MaxSpeakerVolume(uint32_t& maxVolume) const = 0;
      95             :   virtual int32_t MinSpeakerVolume(uint32_t& minVolume) const = 0;
      96             :   virtual int32_t SpeakerVolumeStepSize(uint16_t& stepSize) const = 0;
      97             : 
      98             :   // Microphone volume controls
      99             :   virtual int32_t MicrophoneVolumeIsAvailable(bool& available) = 0;
     100             :   virtual int32_t SetMicrophoneVolume(uint32_t volume) = 0;
     101             :   virtual int32_t MicrophoneVolume(uint32_t& volume) const = 0;
     102             :   virtual int32_t MaxMicrophoneVolume(uint32_t& maxVolume) const = 0;
     103             :   virtual int32_t MinMicrophoneVolume(uint32_t& minVolume) const = 0;
     104             :   virtual int32_t MicrophoneVolumeStepSize(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(const AudioDeviceModule::BufferType type,
     131             :                                    uint16_t sizeMS = 0) = 0;
     132             :   virtual int32_t PlayoutBuffer(AudioDeviceModule::BufferType& type,
     133             :                                 uint16_t& sizeMS) const = 0;
     134             :   virtual int32_t PlayoutDelay(uint16_t& delayMS) const = 0;
     135             :   virtual int32_t RecordingDelay(uint16_t& delayMS) const = 0;
     136             : 
     137             :   // CPU load
     138             :   virtual int32_t CPULoad(uint16_t& load) const = 0;
     139             : 
     140             :   // Native sample rate controls (samples/sec)
     141             :   virtual int32_t SetRecordingSampleRate(const uint32_t samplesPerSec);
     142             :   virtual int32_t SetPlayoutSampleRate(const uint32_t samplesPerSec);
     143             : 
     144             :   // Speaker audio routing (for mobile devices)
     145             :   virtual int32_t SetLoudspeakerStatus(bool enable);
     146             :   virtual int32_t GetLoudspeakerStatus(bool& enable) const;
     147             : 
     148             :   // Reset Audio Device (for mobile devices)
     149             :   virtual int32_t ResetAudioDevice();
     150             : 
     151             :   // Sound Audio Device control (for WinCE only)
     152             :   virtual int32_t SoundDeviceControl(unsigned int par1 = 0,
     153             :                                      unsigned int par2 = 0,
     154             :                                      unsigned int par3 = 0,
     155             :                                      unsigned int par4 = 0);
     156             : 
     157             :   // Android only
     158             :   virtual bool BuiltInAECIsAvailable() const;
     159             :   virtual bool BuiltInAGCIsAvailable() const;
     160             :   virtual bool BuiltInNSIsAvailable() const;
     161             : 
     162             :   // Windows Core Audio and Android only.
     163             :   virtual int32_t EnableBuiltInAEC(bool enable);
     164             :   virtual int32_t EnableBuiltInAGC(bool enable);
     165             :   virtual int32_t EnableBuiltInNS(bool enable);
     166             : 
     167             :   // iOS only.
     168             :   // TODO(henrika): add Android support.
     169             : #if defined(WEBRTC_IOS)
     170             :   virtual int GetPlayoutAudioParameters(AudioParameters* params) const;
     171             :   virtual int GetRecordAudioParameters(AudioParameters* params) const;
     172             : #endif  // WEBRTC_IOS
     173             : 
     174             :   virtual bool PlayoutWarning() const = 0;
     175             :   virtual bool PlayoutError() const = 0;
     176             :   virtual bool RecordingWarning() const = 0;
     177             :   virtual bool RecordingError() const = 0;
     178             :   virtual void ClearPlayoutWarning() = 0;
     179             :   virtual void ClearPlayoutError() = 0;
     180             :   virtual void ClearRecordingWarning() = 0;
     181             :   virtual void ClearRecordingError() = 0;
     182             : 
     183             :   virtual void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) = 0;
     184             : 
     185           0 :   virtual ~AudioDeviceGeneric() {}
     186             : };
     187             : 
     188             : }  // namespace webrtc
     189             : 
     190             : #endif  // WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_GENERIC_H

Generated by: LCOV version 1.13