AudioStreamRandomizer

Inherits: AudioStream < Resource < RefCounted < Object

Wraps a pool of audio streams with pitch and volume shifting.

Description

Picks a random AudioStream from the pool, depending on the playback mode, and applies random pitch shifting and volume shifting during playback.

Properties

PlaybackMode

playback_mode

0

float

random_pitch

1.1

float

random_volume_offset_db

5.0

int

streams_count

0

Methods

void

add_stream ( int index )

AudioStream

get_stream ( int index ) const

float

get_stream_probability_weight ( int index ) const

void

move_stream ( int index_from, int index_to )

void

remove_stream ( int index )

void

set_stream ( int index, AudioStream stream )

void

set_stream_probability_weight ( int index, float weight )

Enumerations

enum PlaybackMode:

  • PLAYBACK_RANDOM_NO_REPEATS = 0 --- Pick a stream at random according to the probability weights chosen for each stream, but avoid playing the same stream twice in a row whenever possible.

  • PLAYBACK_RANDOM = 1 --- Pick a stream at random according to the probability weights chosen for each stream.

  • PLAYBACK_SEQUENTIAL = 2 --- Play streams in the order they appear in the stream pool.

Property Descriptions

Default

0

Setter

set_playback_mode(value)

Getter

get_playback_mode()

Controls how this AudioStreamRandomizer picks which AudioStream to play next.


Default

1.1

Setter

set_random_pitch(value)

Getter

get_random_pitch()

The intensity of random pitch variation. A value of 1 means no variation.


  • float random_volume_offset_db

Default

5.0

Setter

set_random_volume_offset_db(value)

Getter

get_random_volume_offset_db()

The intensity of random volume variation. A value of 0 means no variation.


  • int streams_count

Default

0

Setter

set_streams_count(value)

Getter

get_streams_count()

The number of streams in the stream pool.

Method Descriptions

  • void add_stream ( int index )

Insert a stream at the specified index.


Returns the stream at the specified index.


  • float get_stream_probability_weight ( int index ) const

Returns the probability weight associated with the stream at the given index.


  • void move_stream ( int index_from, int index_to )

Move a stream from one index to another.


  • void remove_stream ( int index )

Remove the stream at the specified index.


Set the AudioStream at the specified index.


  • void set_stream_probability_weight ( int index, float weight )

Set the probability weight of the stream at the specified index. The higher this value, the more likely that the randomizer will choose this stream during random playback modes.