SpatialSoundPool


public final class SpatialSoundPool


Provides spatial audio extensions on the framework SoundPool class.

Summary

Public methods

static final int
getSpatialSourceType(
    @NonNull Session session,
    @NonNull SoundPool soundPool,
    int streamId
)
static final int
play(
    @NonNull Session session,
    @NonNull SoundPool soundPool,
    int soundID,
    @NonNull PointSourceAttributes attributes,
    float volume,
    int priority,
    int loop,
    float rate
)

Plays a spatialized sound effect emitted relative Node in the PointSourceAttributes.

static final int
play(
    @NonNull Session session,
    @NonNull SoundPool soundPool,
    int soundID,
    @NonNull SoundFieldAttributes attributes,
    float volume,
    int priority,
    int loop,
    float rate
)

Plays a spatialized sound effect as a sound field.

Public methods

getSpatialSourceType

Added in 1.0.0-alpha01
public static final int getSpatialSourceType(
    @NonNull Session session,
    @NonNull SoundPool soundPool,
    int streamId
)
Parameters
@NonNull Session session

The current SceneCore Session instance.

@NonNull SoundPool soundPool

The SoundPool to use to get its SourceType.

int streamId

a streamID returned by the play(), playAsPointSource(), or playAsSoundField().

Returns
int

The SpatializerConstants.SourceType for the given streamID.

play

Added in 1.0.0-alpha01
public static final int play(
    @NonNull Session session,
    @NonNull SoundPool soundPool,
    int soundID,
    @NonNull PointSourceAttributes attributes,
    float volume,
    int priority,
    int loop,
    float rate
)

Plays a spatialized sound effect emitted relative Node in the PointSourceAttributes.

Parameters
@NonNull Session session

The current SceneCore Session instance.

@NonNull SoundPool soundPool

The SoundPool to use to the play the sound.

int soundID

a soundId returned by the load() function.

@NonNull PointSourceAttributes attributes

attributes to specify sound source. PointSourceAttributes

float volume

value (range = 0.0 to 1.0)

int priority

stream priority (0 = lowest priority)

int loop

loop mode (0 = no loop, -1 = loop forever, N = loop N times)

float rate

playback rate (1.0 = normal playback, range 0.5 to 2.0)

Returns
int

non-zero streamID if successful, zero if failed

play

Added in 1.0.0-alpha01
public static final int play(
    @NonNull Session session,
    @NonNull SoundPool soundPool,
    int soundID,
    @NonNull SoundFieldAttributes attributes,
    float volume,
    int priority,
    int loop,
    float rate
)

Plays a spatialized sound effect as a sound field.

Parameters
@NonNull Session session

The current SceneCore Session instance.

@NonNull SoundPool soundPool

The SoundPool to use to the play the sound.

int soundID

a soundId returned by the load() function.

@NonNull SoundFieldAttributes attributes

attributes to specify sound source. SoundFieldAttributes

float volume

value (range = 0.0 to 1.0)

int priority

stream priority (0 = lowest priority)

int loop

loop mode (0 = no loop, -1 = loop forever, N = loop N times)

float rate

playback rate (1.0 = normal playback, range 0.5 to 2.0)

Returns
int

non-zero streamID if successful, zero if failed