namespace Agora.Rtc
{
///
///
/// This class calculates user positions through the SDK to implement the spatial audio effect.
///
///
public abstract class ILocalSpatialAudioEngine
{
///
///
/// Destroys ILocalSpatialAudioEngine .
/// This method releases all resources under ILocalSpatialAudioEngine. When the user does not need to use the spatial audio effect, you can call this method to release resources for other operations.After calling this method, you can no longer use any of the APIs under ILocalSpatialAudioEngine. To use the spatial audio effect again, you need to wait until the Dispose method execution to complete before calling Initialize to create a new ILocalSpatialAudioEngine.Call this method before the Dispose method under IRtcEngine .
///
///
public abstract void Dispose();
///
///
/// Initializes ILocalSpatialAudioEngine .
/// 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.
///
///
///
/// 0: Success.< 0: Failure.
///
///
public abstract int Initialize();
///
///
/// 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. If there are users who belong to the same team as the local user in the room, the local user receives the audio of the teammates first. For example, when maxCount is set to 3, if there are five remote users in the room, two of whom belong to the same team as the local user, and three of whom belong to different teams but are within the audio reception range of the local user, the local user can hear the two teammates and the one user from a different team closest to the local user.
///
///
/// The maximum number of streams that a user can receive within a specified audio reception range.
///
///
/// 0: Success.< 0: Failure.
///
///
public abstract int SetMaxAudioRecvCount(int maxCount);
///
///
/// 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.
///
///
/// The maximum audio reception range. The unit is meters. The value must be greater than 0.
///
///
/// 0: Success.< 0: Failure.
///
///
public abstract int SetAudioRecvRange(float range);
///
///
/// 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.
///
///
/// The number of meters that the game engine distance per unit is equal to. This parameter must be greater than 0.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.
///
///
/// 0: Success.< 0: Failure.
///
///
public abstract int SetDistanceUnit(float unit);
///
///
/// Updates the spatial position of the local user.
/// Under the 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.
///
///
/// 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.
///
/// 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.
///
/// 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.
///
/// 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.
///
///
/// 0: Success.< 0: Failure.
///
///
public abstract int UpdateSelfPosition(float[] position, float[] axisForward, float[] axisRight, float[] axisUp);
///
/// @ignore
///
public abstract int UpdateSelfPositionEx(float[] position, float[] axisForward, float[] axisRight, float[] axisUp, RtcConnection connection);
///
///
/// 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.
///
///
/// The ID of the media player.
///
/// 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.
///
/// 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.
///
///
/// 0: Success.< 0: Failure.
///
///
public abstract int UpdatePlayerPositionInfo(int playerId, float[] position, float[] forward);
///
/// @ignore
///
public abstract int SetParameters(string @params);
///
///
/// Stops or resumes publishing the local audio stream.
/// This method does not affect any ongoing audio recording, because it does not disable the audio capture device.Call this method after JoinChannel [2/2] .When using the spatial audio effect, if you need to set whether to publish the local audio stream, Agora recommends calling this method instead of the MuteLocalAudioStream method under IRtcEngine .
///
///
/// Whether to stop publishing the local audio stream.true: Stop publishing the local audio stream.false: Publish the local audio stream.
///
///
/// 0: Success.< 0: Failure.
///
///
public abstract int MuteLocalAudioStream(bool mute);
///
///
/// 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.Call this method after JoinChannel [2/2] .When using the spatial audio effect, if you need to set whether to stop subscribing to the audio streams of all remote users, Agora recommends calling this method instead of the MuteAllRemoteAudioStreams method under IRtcEngine .
///
///
/// Whether to stop subscribing to the audio streams of all remote users:true: Stop subscribing to the audio streams of all remote users.false: Subscribe to the audio streams of all remote users.
///
///
/// 0: Success.< 0: Failure.
///
///
public abstract int MuteAllRemoteAudioStreams(bool mute);
///
///
/// Updates the spatial position of the specified remote user.
/// After successfully calling this method, the SDK calculates the spatial audio parameters based on the relative position of the local and remote user.Call this method after the JoinChannel [2/2] method.
///
///
/// The user ID. This parameter must be the same as the user ID passed in when the user joined the channel.
///
/// 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.
///
/// 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.
///
///
/// 0: Success.< 0: Failure.
///
///
public abstract int UpdateRemotePosition(uint uid, float[] position, float[] forward);
///
/// @ignore
///
public abstract int UpdateRemotePositionEx(uint uid, float[] position, float[] forward, RtcConnection connection);
///
///
/// Removes the spatial position of the specified remote user.
/// 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.
///
///
/// The user ID. This parameter must be the same as the user ID passed in when the user joined the channel.
///
///
/// 0: Success.< 0: Failure.
///
///
public abstract int RemoveRemotePosition(uint uid);
///
/// @ignore
///
public abstract int RemoveRemotePositionEx(uint uid, RtcConnection connection);
///
///
/// 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.
///
///
///
/// 0: Success.< 0: Failure.
///
///
public abstract int ClearRemotePositions();
///
/// @ignore
///
public abstract int ClearRemotePositionsEx(RtcConnection connection);
}
}