PointSourceParams.Builder


@RequiresSpatialApi(value = 4)
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 functions

PointSourceParams

Builds a new PointSourceParams object.

PointSourceParams.Builder
setDirectivity(
    balance: @FloatRange(from = 0.0, to = 1.0) Float,
    sharpness: @FloatRange(from = 1.0) Float
)

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

PointSourceParams.Builder

Sets all parameters related to distance-based attenuation.

PointSourceParams.Builder
setSpread(spread: @FloatRange(from = 0.0, to = 360.0) Float)

Sets the spread of the point source, in degrees.

Public constructors

Builder

Added in 1.1.0-alpha02
Builder()

Builder

Added in 1.1.0-alpha02
Builder(params: PointSourceParams)

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

Public functions

build

Added in 1.1.0-alpha02
fun build(): PointSourceParams

Builds a new PointSourceParams object.

setDirectivity

Added in 1.1.0-alpha02
fun setDirectivity(
    balance: @FloatRange(from = 0.0, to = 1.0) Float,
    sharpness: @FloatRange(from = 1.0) Float
): PointSourceParams.Builder

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

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

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

sharpness: @FloatRange(from = 1.0) Float

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
fun setDistanceAttenuation(distanceAttenuation: DistanceAttenuation): PointSourceParams.Builder

Sets all parameters related to distance-based attenuation.

Parameters
distanceAttenuation: DistanceAttenuation

DistanceAttenuation distance attenuation configuration

setSpread

Added in 1.1.0-alpha02
fun setSpread(spread: @FloatRange(from = 0.0, to = 360.0) Float): PointSourceParams.Builder

Sets the spread of the point source, in degrees.

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

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