|
Agora Java API Reference for Android
|
Public Member Functions | |
| abstract int | setMaxAudioRecvCount (int maxCount) |
| Sets the maximum number of streams that a user can receive in a specified audio reception range. More... | |
| abstract int | setAudioRecvRange (float range) |
| Sets the audio reception range of the local user. More... | |
| abstract int | setDistanceUnit (float unit) |
| Sets the length (in meters) of the game engine distance per unit. More... | |
| abstract int | updateSelfPosition (float[] position, float[] axisForward, float[] axisRight, float[] axisUp) |
| Updates the spatial position of the local user. More... | |
| abstract int | updatePlayerPositionInfo (int playerId, RemoteVoicePositionInfo positionInfo) |
| Updates the spatial position of the media player. More... | |
| abstract int | muteLocalAudioStream (boolean mute) |
| Stops or resumes publishing the local audio stream. More... | |
| abstract int | muteAllRemoteAudioStreams (boolean mute) |
| Stops or resumes subscribing to the audio streams of all remote users. More... | |
| abstract int | setZones (SpatialAudioZone[] zones) |
| Sets the sound insulation area. More... | |
| abstract int | setPlayerAttenuation (int playerId, double attenuation, boolean forceSet) |
| Sets the sound attenuation properties of the media player. More... | |
| abstract int | muteRemoteAudioStream (int uid, boolean mute) |
| abstract int | updateSelfPositionEx (float[] position, float[] axisForward, float[] axisRight, float[] axisUp, RtcConnection connection) |
| abstract int | clearRemotePositions () |
| Removes the spatial positions of all remote users. More... | |
Protected Member Functions | |
| abstract int | release () |
| Releases all resources used by the music content center. More... | |
|
abstractprotected |
Releases all resources used by the music content center.
You must call this method before calling the destroy() method of RtcEngine.
|
abstract |
Sets the maximum number of streams that a user can receive in a specified audio reception range.
If the number of receivable streams exceeds the set value, the local user receives the maxCount streams that are closest to the local user.
| maxCount | The maximum number of streams that a user can receive within a specified audio reception range. The value of this parameter should be ≤ 16, and the default value is 10. |
|
abstract |
Sets the audio reception range of the local user.
After the setting is successful, the local user can only hear the remote users within the setting range or belonging to the same team. You can call this method at any time to update the audio reception range.
| range | The maximum audio reception range. The unit is meters. The value of this parameter must be greater than 0, and the default value is 20. |
|
abstract |
Sets the length (in meters) of the game engine distance per unit.
In a game engine, the unit of distance is customized, while in the Agora spatial audio algorithm, distance is measured in meters. By default, the SDK converts the game engine distance per unit to one meter. You can call this method to convert the game engine distance per unit to a specified number of meters.
| unit | The number of meters that the game engine distance per unit is equal to. The value of this parameter must be greater than 0.00, and the default value is 1.00. For example, setting unit as 2.00 means the game engine distance per unit equals 2 meters.The larger the value is, the faster the sound heard by the local user attenuates when the remote user moves far away from the local user. |
|
abstract |
Updates the spatial position of the local user.
ILocalSpatialAudioEngine class, this method needs to be used with updateRemotePosition. The SDK calculates the relative position between the local and remote users according to this method and the parameter settings in updateRemotePosition, and then calculates the user's spatial audio effect parameters.| position | The coordinates in the world coordinate system. This parameter is an array of length 3, and the three values represent the front, right, and top coordinates in turn. |
| axisForward | The unit vector of the x axis in the coordinate system. This parameter is an array of length 3, and the three values represent the front, right, and top coordinates in turn. |
| axisRight | The unit vector of the y axis in the coordinate system. This parameter is an array of length 3, and the three values represent the front, right, and top coordinates in turn. |
| axisUp | The unit vector of the z axis in the coordinate system. This parameter is an array of length 3, and the three values represent the front, right, and top coordinates in turn. |
|
abstract |
Updates the spatial position of the media player.
After a successful update, the local user can hear the change in the spatial position of the media player. Call timing: This method can be called either before or after joining the channel.
| playerId | The ID of the media player. You can get the Device ID by calling getMediaPlayerId. |
| positionInfo | The spatial position of the media player. See RemoteVoicePositionInfo. |
|
abstract |
Stops or resumes publishing the local audio stream.
joinChannel(String token, String channelId, String optionalInfo, int uid) or joinChannel(String token, String channelId, int uid, ChannelMediaOptions options) method.muteLocalAudioStream method in RtcEngine.onUserMuteAudio and onRemoteAudioStateChanged callbacks on the remote client.| mute | Whether to stop publishing the local audio stream:
|
|
abstract |
Stops or resumes subscribing to the audio streams of all remote users.
After successfully calling this method, the local user stops or resumes subscribing to the audio streams of all remote users, including all subsequent users.
joinChannel(String token, String channelId, String optionalInfo, int uid) or joinChannel(String token, String channelId, int uid, ChannelMediaOptions options) method.muteAllRemoteAudioStreams method in RtcEngine.updateSelfPosition and updateRemotePosition to update the spatial location of the local user and the remote user; otherwise, the settings in this method do not take effect.| mute | Whether to stop subscribing to the audio streams of all remote users:
|
|
abstract |
Sets the sound insulation area.
In virtual interactive scenarios, you can use this method to set the sound insulation area and sound attenuation coefficient. When the sound source (which can be the user or the media player) and the listener belong to the inside and outside of the sound insulation area, they can experience the attenuation effect of sound similar to the real environment when it encounters a building partition.
SpatialAudioZone.SpatialAudioZone, and the sound attenuation effect is determined by the attenuation parameter in setPlayerAttenuation or setRemoteAudioAttenuation. If you do not call setPlayerAttenuation or setRemoteAudioAttenuation, the default sound attenuation coefficient of the SDK is 0.5, which simulates the attenuation of the sound in the real environment.| zones | Sound insulation area settings. See SpatialAudioZone. When you set this parameter to NULL, it means clearing all sound insulation zones. |
|
abstract |
Sets the sound attenuation properties of the media player.
| playerId | The ID of the media player. You can get the Device ID by calling getMediaPlayerId. |
| attenuation | The sound attenuation coefficient of the remote user or media player. The value range is [0,1]. The values are as follows:
|
| forceSet | Whether to force the sound attenuation effect of the media player:
|
|
abstract |
Removes the spatial positions of all remote users.
After successfully calling this method, the local user no longer hears any remote users. After leaving the channel, to avoid wasting resources, you can also call this method to delete the spatial positions of all remote users.
1.8.18