ILocalSpatialAudioEngine

This class calculates user positions through the SDK to implement the spatial audio effect.

This class inherits from IBaseSpatialAudioEngine. Before calling other APIs in this class, you need to call the Initialize method to initialize this class.

ClearRemotePositions

Removes the spatial positions of all remote users.

UFUNCTION(BlueprintCallable, Category = "Agora|ILocalSpatialAudioEngine")
	int ClearRemotePositions();

Details

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.

Returns

  • 0: Success.
  • < 0: Failure.

Initialize

Initializes ILocalSpatialAudioEngine.

UFUNCTION(BlueprintCallable, Category = "Agora|ILocalSpatialAudioEngine")
	int Initialize(FLocalSpatialAudioConfig& config);

Details

Note:
  • Call this method after calling QueryInterface(AGORA_IID_LOCAL_SPATIAL_AUDIO).
  • Before calling other methods of the ILocalSpatialAudioEngine class, you need to call this method to initialize ILocalSpatialAudioEngine.
  • The SDK supports creating only one ILocalSpatialAudioEngine instance for an app.

Parameters

config
The configuration of ILocalSpatialAudioEngine. See FLocalSpatialAudioConfig.

Returns

  • 0: Success.
  • < 0: Failure.

RemoveRemotePosition

Removes the spatial position of the specified remote user.

UFUNCTION(BlueprintCallable, Category = "Agora|ILocalSpatialAudioEngine")
	int RemoveRemotePosition(int64 uid);

Details

After successfully calling this method, the local user no longer hears the specified remote user.

After leaving the channel, to avoid wasting resources, you can also call this method to delete the spatial position of the specified remote user.

Parameters

uid
The user ID. This parameter must be the same as the user ID passed in when the user joined the channel.

Returns

  • 0: Success.
  • < 0: Failure.

UpdateRemotePosition

Updates the spatial position of the specified remote user.

UFUNCTION(BlueprintCallable, Category = "Agora|ILocalSpatialAudioEngine")
	int UpdateRemotePosition(int64 uid, FRemoteVoicePositionInfo& posInfo);

Details

After successfully calling this method, the SDK calculates the spatial audio parameters based on the relative position of the local and remote user.

Note: Call this method after JoinChannel.

Parameters

uid
The user ID. This parameter must be the same as the user ID passed in when the user joined the channel.
posInfo
The spatial position of the remote user. See FRemoteVoicePositionInfo.

Returns

  • 0: Success.
  • < 0: Failure.

FLocalSpatialAudioConfig

The configuration of ILocalSpatialAudioEngine.

USTRUCT(BlueprintType)
struct FLocalSpatialAudioConfig
{
	GENERATED_BODY()

	UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalSpatialAudioConfig")
	UAgoraRtcEngine* rtcEngine;
};

rtcEngine
IRtcEngine.