setAttenuationModel method
@detail api
@author huangshouqin
@brief 设置范围语音的音量衰减模式。
@param type 音量衰减模式。默认为线性衰减。详见 AttenuationType{@link #AttenuationType}。
@param coefficient 指数衰减模式下的音量衰减系数,默认值为 1。范围 0.1,100,推荐设置为 50。数值越大,音量的衰减速度越快。
@return 调用是否成功
- 0:调用成功
- -1:调用失败。原因为在调用 enableRangeAudio{@link #IRangeAudio#enableRangeAudio} 开启范围语音前或进房前调用本接口
@note 音量衰减范围通过 updateReceiveRange{@link #IRangeAudio#updateReceiveRange} 进行设置。
Implementation
Future<int?> setAttenuationModel(
AttenuationType type, float coefficient) async {
$a() => ($instance as $p_a.IRangeAudio).setAttenuationModel(
t_AttenuationType.code_to_android(type), coefficient);
$i() => ($instance as $p_i.ByteRTCRangeAudio)
.setAttenuationModel(t_AttenuationType.code_to_ios(type), coefficient);
if (Platform.isAndroid) {
return $a();
} else if (Platform.isIOS) {
return $i();
} else {
throw UnsupportedError(
'Not Support Platform ${Platform.operatingSystem}');
}
}