aboutsummaryrefslogtreecommitdiff
path: root/sdk/android/api/org/webrtc/audio/AudioDeviceModule.java
blob: 5a0bf5c74d708b5b68b70752cda47ce37ee391ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
 *  Copyright 2018 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

package org.webrtc.audio;

/**
 * This interface is a thin wrapper on top of a native C++ webrtc::AudioDeviceModule (ADM). The
 * reason for basing it on a native ADM instead of a pure Java interface is that we have two native
 * Android implementations (OpenSLES and AAudio) that does not make sense to wrap through JNI.
 *
 * <p>Note: This class is still under development and may change without notice.
 */
public interface AudioDeviceModule {
  /**
   * Returns a C++ pointer to a webrtc::AudioDeviceModule. Caller does _not_ take ownership and
   * lifetime is handled through the release() call.
   */
  long getNativeAudioDeviceModulePointer();

  /**
   * Release resources for this AudioDeviceModule, including native resources. The object should not
   * be used after this call.
   */
  void release();

  /** Control muting/unmuting the speaker. */
  void setSpeakerMute(boolean mute);

  /** Control muting/unmuting the microphone. */
  void setMicrophoneMute(boolean mute);

  /**
   * Enable or disable built in noise suppressor. Returns true if the enabling was successful,
   * otherwise false is returned.
   */
  default boolean setNoiseSuppressorEnabled(boolean enabled) {
    return false;
  }

  /**
   * Sets the preferred field dimension for the built-in microphone. Returns
   * true if setting was successful, otherwise false is returned.
   * This functionality can be implemented with
   * {@code android.media.MicrophoneDirection.setPreferredMicrophoneFieldDimension}.
   */
  default boolean setPreferredMicrophoneFieldDimension(float dimension) {
    return false;
  }
}