setEarMonitoringAudioFrameParameters abstract method
- required int sampleRate,
- required int channel,
- required RawAudioFrameOpModeType mode,
- required int samplesPerCall,
Sets the data format for the onEarMonitoringAudioFrame callback.
This method sets the data format for the onEarMonitoringAudioFrame callback. Before calling this method, you need to call enableInEarMonitoring and set includeAudioFilters to earMonitoringFilterBuiltInAudioFilters or earMonitoringFilterNoiseSuppression. The SDK calculates the sampling interval using the samplesPerCall, sampleRate, and channel parameters in this method. The formula is: sampling interval = samplesPerCall / (sampleRate × channel). Ensure the sampling interval is no less than 0.01 seconds. The SDK triggers the onEarMonitoringAudioFrame callback based on this interval.
sampleRateSampling rate (Hz) of the audio reported in onEarMonitoringAudioFrame, can be set to 8000, 16000, 32000, 44100, or 48000.channelNumber of audio channels reported in onEarMonitoringAudioFrame, can be set to 1 or 2: 1: Mono. 2: Stereo.modeUsage mode of the audio frame. See RawAudioFrameOpModeType.samplesPerCallNumber of audio samples reported in onEarMonitoringAudioFrame, typically 1024 in applications like push streaming.
Returns When the method call succeeds, there is no return value; when fails, the AgoraRtcException exception is thrown. You need to catch the exception and handle it accordingly. See Error Codes for details and resolution suggestions. < 0: The method call fails. See Error Codes for details and resolution suggestions.
Implementation
Future<void> setEarMonitoringAudioFrameParameters(
{required int sampleRate,
required int channel,
required RawAudioFrameOpModeType mode,
required int samplesPerCall});