1b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org/*
2b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org *
4b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org *  Use of this source code is governed by a BSD-style license
5b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org *  that can be found in the LICENSE file in the root of the source
6b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org *  tree. An additional intellectual property rights grant can be found
7b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org *  in the file PATENTS.  All contributing project authors may
8b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org *  be found in the AUTHORS file in the root of the source tree.
9b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org */
10b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
11b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org// This sub-API supports the following functionalities:
12b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org//
13b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org//  - Noise Suppression (NS).
14b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org//  - Automatic Gain Control (AGC).
15b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org//  - Echo Control (EC).
16b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org//  - Receiving side VAD, NS and AGC.
17b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org//  - Measurements of instantaneous speech, noise and echo levels.
18b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org//  - Generation of AP debug recordings.
19b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org//  - Detection of keyboard typing which can disrupt a voice conversation.
20b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org//
21b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org// Usage example, omitting error checking:
22b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org//
23b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org//  using namespace webrtc;
24b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org//  VoiceEngine* voe = VoiceEngine::Create();
25b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org//  VoEBase* base = VoEBase::GetInterface();
26b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org//  VoEAudioProcessing* ap = VoEAudioProcessing::GetInterface(voe);
27b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org//  base->Init();
28b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org//  ap->SetEcStatus(true, kAgcAdaptiveAnalog);
29b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org//  ...
30b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org//  base->Terminate();
31b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org//  base->Release();
32b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org//  ap->Release();
33b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org//  VoiceEngine::Delete(voe);
34b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org//
35b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org#ifndef WEBRTC_VOICE_ENGINE_VOE_AUDIO_PROCESSING_H
36b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org#define WEBRTC_VOICE_ENGINE_VOE_AUDIO_PROCESSING_H
37b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
387b72264dd14dcffb873d096339de6ed47015ac43henrikg@webrtc.org#include <stdio.h>
397b72264dd14dcffb873d096339de6ed47015ac43henrikg@webrtc.org
40471ae72f18e7b23a96b245dbd508386fe139449cpbos@webrtc.org#include "webrtc/common_types.h"
41b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
42b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.orgnamespace webrtc {
43b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
44b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.orgclass VoiceEngine;
45b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
46b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org// VoERxVadCallback
47b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.orgclass WEBRTC_DLLEXPORT VoERxVadCallback
48b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org{
49b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.orgpublic:
50b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual void OnRxVad(int channel, int vadDecision) = 0;
51b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
52b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.orgprotected:
53b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual ~VoERxVadCallback() {}
54b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org};
55b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
56b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org// VoEAudioProcessing
57b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.orgclass WEBRTC_DLLEXPORT VoEAudioProcessing
58b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org{
59b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.orgpublic:
60b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Factory for the VoEAudioProcessing sub-API. Increases an internal
61b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // reference counter if successful. Returns NULL if the API is not
62b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // supported or if construction fails.
63b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    static VoEAudioProcessing* GetInterface(VoiceEngine* voiceEngine);
64b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
65b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Releases the VoEAudioProcessing sub-API and decreases an internal
66b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // reference counter. Returns the new reference count. This value should
67b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // be zero for all sub-API:s before the VoiceEngine object can be safely
68b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // deleted.
69b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual int Release() = 0;
70b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
71b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Sets Noise Suppression (NS) status and mode.
72b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // The NS reduces noise in the microphone signal.
73b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual int SetNsStatus(bool enable, NsModes mode = kNsUnchanged) = 0;
74b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
75b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Gets the NS status and mode.
76b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual int GetNsStatus(bool& enabled, NsModes& mode) = 0;
77b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
78b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Sets the Automatic Gain Control (AGC) status and mode.
79b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // The AGC adjusts the microphone signal to an appropriate level.
80b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual int SetAgcStatus(bool enable, AgcModes mode = kAgcUnchanged) = 0;
81b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
82b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Gets the AGC status and mode.
83b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual int GetAgcStatus(bool& enabled, AgcModes& mode) = 0;
84b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
85b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Sets the AGC configuration.
86b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Should only be used in situations where the working environment
87b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // is well known.
88ca7a9a2696d2f73f543241093c4faeb4c608678cpbos@webrtc.org    virtual int SetAgcConfig(AgcConfig config) = 0;
89b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
90b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Gets the AGC configuration.
91b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual int GetAgcConfig(AgcConfig& config) = 0;
92b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
93b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Sets the Echo Control (EC) status and mode.
94b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // The EC mitigates acoustic echo where a user can hear their own
95b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // speech repeated back due to an acoustic coupling between the
96b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // speaker and the microphone at the remote end.
97b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual int SetEcStatus(bool enable, EcModes mode = kEcUnchanged) = 0;
98b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
99b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Gets the EC status and mode.
100b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual int GetEcStatus(bool& enabled, EcModes& mode) = 0;
101b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
102b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Enables the compensation of clock drift between the capture and render
103b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // streams by the echo canceller (i.e. only using EcMode==kEcAec). It will
104b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // only be enabled if supported on the current platform; otherwise an error
105b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // will be returned. Check if the platform is supported by calling
106b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // |DriftCompensationSupported()|.
107b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual int EnableDriftCompensation(bool enable) = 0;
108b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual bool DriftCompensationEnabled() = 0;
109b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    static bool DriftCompensationSupported();
110b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
111b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Sets a delay |offset| in ms to add to the system delay reported by the
112b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // OS, which is used by the AEC to synchronize far- and near-end streams.
113b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // In some cases a system may introduce a delay which goes unreported by the
114b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // OS, but which is known to the user. This method can be used to compensate
115b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // for the unreported delay.
116b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual void SetDelayOffsetMs(int offset) = 0;
117b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual int DelayOffsetMs() = 0;
118b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
119b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Modifies settings for the AEC designed for mobile devices (AECM).
120b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual int SetAecmMode(AecmModes mode = kAecmSpeakerphone,
121b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                            bool enableCNG = true) = 0;
122b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
123b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Gets settings for the AECM.
124b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual int GetAecmMode(AecmModes& mode, bool& enabledCNG) = 0;
125b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
126b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Enables a high pass filter on the capture signal. This removes DC bias
127b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // and low-frequency noise. Recommended to be enabled.
128b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual int EnableHighPassFilter(bool enable) = 0;
129b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual bool IsHighPassFilterEnabled() = 0;
130b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
131b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Sets status and mode of the receiving-side (Rx) NS.
132b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // The Rx NS reduces noise in the received signal for the specified
133b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // |channel|. Intended for advanced usage only.
134b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual int SetRxNsStatus(int channel,
135b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                              bool enable,
136b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                              NsModes mode = kNsUnchanged) = 0;
137b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
138b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Gets status and mode of the receiving-side NS.
139b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual int GetRxNsStatus(int channel,
140b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                              bool& enabled,
141b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                              NsModes& mode) = 0;
142b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
143b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Sets status and mode of the receiving-side (Rx) AGC.
144b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // The Rx AGC adjusts the received signal to an appropriate level
145b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // for the specified |channel|. Intended for advanced usage only.
146b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual int SetRxAgcStatus(int channel,
147b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                               bool enable,
148b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                               AgcModes mode = kAgcUnchanged) = 0;
149b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
150b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Gets status and mode of the receiving-side AGC.
151b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual int GetRxAgcStatus(int channel,
152b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                               bool& enabled,
153b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                               AgcModes& mode) = 0;
154b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
155b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Modifies the AGC configuration on the receiving side for the
156b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // specified |channel|.
157ca7a9a2696d2f73f543241093c4faeb4c608678cpbos@webrtc.org    virtual int SetRxAgcConfig(int channel, AgcConfig config) = 0;
158b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
159b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Gets the AGC configuration on the receiving side.
160b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual int GetRxAgcConfig(int channel, AgcConfig& config) = 0;
161b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
162b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Registers a VoERxVadCallback |observer| instance and enables Rx VAD
163b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // notifications for the specified |channel|.
164b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual int RegisterRxVadObserver(int channel,
165b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                                      VoERxVadCallback &observer) = 0;
166b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
167b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Deregisters the VoERxVadCallback |observer| and disables Rx VAD
168b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // notifications for the specified |channel|.
169b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual int DeRegisterRxVadObserver(int channel) = 0;
170b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
171b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Gets the VAD/DTX activity for the specified |channel|.
172b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // The returned value is 1 if frames of audio contains speech
173b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // and 0 if silence. The output is always 1 if VAD is disabled.
174b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual int VoiceActivityIndicator(int channel) = 0;
175b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
176b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Enables or disables the possibility to retrieve echo metrics and delay
177b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // logging values during an active call. The metrics are only supported in
178b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // AEC.
179b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual int SetEcMetricsStatus(bool enable) = 0;
180b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
181b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Gets the current EC metric status.
182b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual int GetEcMetricsStatus(bool& enabled) = 0;
183b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
184b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Gets the instantaneous echo level metrics.
185b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual int GetEchoMetrics(int& ERL, int& ERLE, int& RERL, int& A_NLP) = 0;
186b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
187b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Gets the EC internal |delay_median| and |delay_std| in ms between
188b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // near-end and far-end. The values are calculated over the time period
189b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // since the last GetEcDelayMetrics() call.
190b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual int GetEcDelayMetrics(int& delay_median, int& delay_std) = 0;
191b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
192b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Enables recording of Audio Processing (AP) debugging information.
193b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // The file can later be used for off-line analysis of the AP performance.
194b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual int StartDebugRecording(const char* fileNameUTF8) = 0;
195b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
1967b72264dd14dcffb873d096339de6ed47015ac43henrikg@webrtc.org    // Same as above but sets and uses an existing file handle. Takes ownership
1977b72264dd14dcffb873d096339de6ed47015ac43henrikg@webrtc.org    // of |file_handle| and passes it on to the audio processing module.
1987b72264dd14dcffb873d096339de6ed47015ac43henrikg@webrtc.org    virtual int StartDebugRecording(FILE* file_handle) = 0;
1997b72264dd14dcffb873d096339de6ed47015ac43henrikg@webrtc.org
200b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Disables recording of AP debugging information.
201b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual int StopDebugRecording() = 0;
202b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
203b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Enables or disables detection of disturbing keyboard typing.
204b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // An error notification will be given as a callback upon detection.
205b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual int SetTypingDetectionStatus(bool enable) = 0;
206b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
207b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Gets the current typing detection status.
208b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual int GetTypingDetectionStatus(bool& enabled) = 0;
209b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
210b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Reports the lower of:
211b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // * Time in seconds since the last typing event.
212b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // * Time in seconds since the typing detection was enabled.
213b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Returns error if typing detection is disabled.
214b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual int TimeSinceLastTyping(int &seconds) = 0;
215b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
216b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Optional setting of typing detection parameters
217b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Parameter with value == 0 will be ignored
218b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // and left with default config.
219b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // TODO(niklase) Remove default argument as soon as libJingle is updated!
220b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual int SetTypingDetectionParameters(int timeWindow,
221b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                                             int costPerTyping,
222b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                                             int reportingThreshold,
223b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                                             int penaltyDecay,
224b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                                             int typeEventDelay = 0) = 0;
225b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
226b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // Swaps the capture-side left and right audio channels when enabled. It
227b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // only has an effect when using a stereo send codec. The setting is
228b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // persistent; it will be applied whenever a stereo send codec is enabled.
229b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    //
230b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // The swap is applied only to the captured audio, and not mixed files. The
231b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // swap will appear in file recordings and when accessing audio through the
232b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    // external media interface.
233b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual void EnableStereoChannelSwapping(bool enable) = 0;
234b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual bool IsStereoChannelSwappingEnabled() = 0;
235b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
236b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.orgprotected:
237b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    VoEAudioProcessing() {}
238b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    virtual ~VoEAudioProcessing() {}
239b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org};
240b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
2413b89e10f31160da35b408fd00cb8f89d2b08862dpbos@webrtc.org}  // namespace webrtc
242b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
243b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org#endif  // WEBRTC_VOICE_ENGINE_VOE_AUDIO_PROCESSING_H
244