PointSourceParams.Builder


@RequiresSpatialApi(value = 4)
public final class PointSourceParams.Builder


Builder for creating customized PointSourceParams instances.

Summary

Public constructors

Creates a new Builder initialized with the values from an existing PointSourceParams object.

Public methods

final @NonNull PointSourceParams

Builds a new PointSourceParams object.

final @NonNull PointSourceParams.Builder
setDirectivity(
    @FloatRange(from = 0.0, to = 1.0) float balance,
    @FloatRange(from = 1.0) float sharpness
)

Sets all parameters related to the emission directivity of the sound source.

final @NonNull PointSourceParams.Builder

Sets all parameters related to distance-based attenuation.

final @NonNull PointSourceParams.Builder
setSpread(@FloatRange(from = 0.0, to = 360.0) float spread)

Sets the spread of the point source, in degrees.

Public constructors

Builder

Added in 1.1.0-alpha02
public Builder()

Builder

Added in 1.1.0-alpha02
public Builder(@NonNull PointSourceParams params)

Creates a new Builder initialized with the values from an existing PointSourceParams object.

Public methods

build

Added in 1.1.0-alpha02
public final @NonNull PointSourceParams build()

Builds a new PointSourceParams object.

setDirectivity

Added in 1.1.0-alpha02
public final @NonNull PointSourceParams.Builder setDirectivity(
    @FloatRange(from = 0.0, to = 1.0) float balance,
    @FloatRange(from = 1.0) float sharpness
)

Sets all parameters related to the emission directivity of the sound source.

Parameters
@FloatRange(from = 0.0, to = 1.0) float balance

The balance between an omnidirectional (0.0f) and a fully directional (1.0f) sound.

@FloatRange(from = 1.0) float sharpness

Controls the sharpness of the directional sound cone. Higher values result in a more focused sound beam. Must be >= 1.0.

Throws
IllegalArgumentException

if balance is not between 0.0 and 1.0 or sharpness is less than 1.0

setDistanceAttenuation

Added in 1.1.0-alpha02
public final @NonNull PointSourceParams.Builder setDistanceAttenuation(@NonNull DistanceAttenuation distanceAttenuation)

Sets all parameters related to distance-based attenuation.

Parameters
@NonNull DistanceAttenuation distanceAttenuation

DistanceAttenuation distance attenuation configuration

setSpread

Added in 1.1.0-alpha02
public final @NonNull PointSourceParams.Builder setSpread(@FloatRange(from = 0.0, to = 360.0) float spread)

Sets the spread of the point source, in degrees.

Parameters
@FloatRange(from = 0.0, to = 360.0) float spread

The spread angle value in degrees between 0.0 and 360.0

Throws
IllegalArgumentException

if spread angle is less than 0 or greater than 360