Audio Capture
adjustRecordingSignalVolume
Adjusts the volume of the recorded audio signal.
public abstract int adjustRecordingSignalVolume(int volume);
If you only need to mute the audio signal, Agora recommends using the muteRecordingSignal method.
Timing
You can call this method before or after joining a channel.
Parameters
- volume
- User volume, range [0,400]:
- 0: Mute.
- 100: (Default) Original volume.
- 400: Four times the original volume (amplifies the audio signal by four times).
Return Values
- 0: Success.
- < 0: Failure.
enableInEarMonitoring [1/2]
Enables or disables in-ear monitoring.
public abstract int enableInEarMonitoring(boolean enabled);
Timing
You can call this method before or after joining a channel.
Parameters
- enabled
- Whether to enable in-ear monitoring (default is false):
- true: Enable in-ear monitoring.
- false: Disable in-ear monitoring.
Return Values
- 0: Success.
- < 0: Failure.
- -8: Please ensure the current audio route is Bluetooth or wired headset.
enableInEarMonitoring [2/2]
Enables or disables the in-ear monitoring feature.
public abstract int enableInEarMonitoring(boolean enabled, int includeAudioFilters);
Timing
You can call this method before or after joining a channel.
Parameters
- enabled
- Whether to enable the in-ear monitoring feature.
- true: Enable in-ear monitoring.
- false: (Default) Disable in-ear monitoring.
- includeAudioFilters
-
Note: This parameter takes effect only whenAudio filter types for in-ear monitoring:
enabledis true.EAR_MONITORING_FILTER_NONE (1 << 0): (1) No audio filter is added to in-ear monitoring.EAR_MONITORING_FILTER_BUILT_IN_AUDIO_FILTERS (1 << 1): (2) Adds voice beautification audio filters to in-ear monitoring. If you implement effects like beautification or sound effects, users can hear the processed sound. This enum value supports bitwise OR combination.EAR_MONITORING_FILTER_NOISE_SUPPRESSION (1 << 2): (4) Adds noise suppression audio filter to in-ear monitoring. This enum value supports bitwise OR combination.EAR_MONITORING_FILTER_REUSE_POST_PROCESSING_FILTER (1 << 15): Reuses the audio filter processed by the sender for in-ear monitoring. This can reduce CPU usage but increases monitoring latency. Suitable for scenarios that are not sensitive to delay but require low CPU usage. This enum value only supports standalone use. When selected, other audio filter configurations are automatically disabled.
Return Values
- 0: Success.
- < 0: Failure.
- -8: Please ensure the current audio route is Bluetooth or wired headset.
enableLocalAudio
Enables or disables the local audio capture function.
public abstract int enableLocalAudio(boolean enabled);
- enableLocalAudio: Controls whether to enable local audio capture and processing.
- muteLocalAudioStream: Only controls whether to send the local audio stream, without affecting the audio capture state.
Scenario
enableLocalAudio(false) is suitable for scenarios where only remote audio streams are received without sending locally captured audio. This method does not affect receiving remote audio streams.
Timing
You can call this method before or after joining a channel. Calling it before joining only sets the device state and takes effect immediately after joining.
Parameters
- enabled
- Whether to enable the local audio function:
- true: (Default) Re-enable the local audio function, i.e., start the local audio capture device (e.g., microphone).
- false: Disable the local audio function, i.e., stop local audio capture.
Return Values
- 0: Success.
- < 0: Failure.
muteRecordingSignal
Sets whether to mute the recording signal.
public abstract int muteRecordingSignal(boolean muted);
- Records the adjusted volume.
- Mutes the recording signal.
Timing
This method can be called before or after joining a channel.
Parameters
- muted
- Whether to mute the recording signal:
- true: Mute the recording signal.
- false: (default) Do not mute the recording signal.
Return Values
- 0: Success.
- < 0: Failure.
setInEarMonitoringVolume
Sets the in-ear monitoring volume.
public abstract int setInEarMonitoringVolume(int volume);
Timing
You can call this method before or after joining a channel.
Parameters
- volume
- User volume, range is [0, 400]. 0 means mute, 100 (default) means original volume, 400 means four times the original volume (amplifies the audio signal by four times).
Return Values
- 0: Success.
- < 0: Failure.
- -2: Invalid parameter setting, e.g., volume out of valid range (less than 0 or greater than 400).