Class ILocalSpatialAudioEngineAbstract

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.

Hierarchy

  • ILocalSpatialAudioEngine

Constructors

Methods

  • 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.

    Returns

    0: Success. < 0: Failure.

    Returns number

  • 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.

    Returns

    0: Success. < 0: Failure.

    Returns number

  • 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 computing resources, call this method to delete the spatial position information of the specified remote user. Otherwise, the user's spatial position information will be saved continuously. When the number of remote users exceeds the number of audio streams that can be received as set in setMaxAudioRecvCount, the system automatically unsubscribes from the audio stream of the user who is furthest away based on relative distance.

    Returns

    0: Success. < 0: Failure.

    Parameters

    • uid: number

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

    Returns number

  • Sets the sound attenuation effect for the specified user.

    Returns

    0: Success. < 0: Failure.

    Parameters

    • uid: number

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

    • attenuation: number

      For the user's sound attenuation coefficient, the value range is [0,1]. The values are as follows: 0: Broadcast mode, where the volume and timbre are not attenuated with distance, and the volume and timbre heard by local users do not change regardless of distance. (0,0.5): Weak attenuation mode, that is, the volume and timbre are only weakly attenuated during the propagation process, and the sound can travel farther than the real environment. 0.5: (Default) simulates the attenuation of the volume in the real environment; the effect is equivalent to not setting the speaker_attenuation parameter. (0.5,1]: Strong attenuation mode, that is, the volume and timbre attenuate rapidly during the propagation process.

    • forceSet: boolean

      Whether to force the user's sound attenuation effect: true : Force attenuation to set the sound attenuation of the user. At this time, the attenuation coefficient of the sound insulation area set in the audioAttenuation of the SpatialAudioZone does not take effect for the user. If the sound source and listener are inside and outside the sound isolation area, the sound attenuation effect is determined by the audioAttenuation in SpatialAudioZone. If the sound source and the listener are in the same sound insulation area or outside the same sound insulation area, the sound attenuation effect is determined by attenuation in this method. false : Do not force attenuation to set the user's sound attenuation effect, as shown in the following two cases.

    Returns number

  • 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 or joinChannel method.

    Returns

    0: Success. < 0: Failure.

    Parameters

    • uid: number

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

    • posInfo: RemoteVoicePositionInfo

      The spatial position of the remote user. See RemoteVoicePositionInfo.

    Returns number

Generated using TypeDoc