AudioStreamRandomizer
Wraps a pool of audio streams with pitch and volume shifting.
AudioStreamRandomizer.swift:17class AudioStreamRandomizer
Picks a random AudioStream from the pool, depending on the playback mode, and applies random pitch shifting and volume shifting during playback.
Superclasses
class AudioStream
Base class for audio streams.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Types
Type members
Instance members
var playbackMode: AudioStreamRandomizer.PlaybackMode
Controls how this AudioStreamRandomizer picks which AudioStream to play next.
var randomPitch: Double
The intensity of random pitch variation. A value of 1 means no variation.
var randomVolumeOffsetDb: Double
The intensity of random volume variation. A value of 0 means no variation.
var streamsCount: Int32
The number of streams in the stream pool.
func addStream(index: Int32, stream: AudioStream?, weight: Double
) Insert a stream at the specified index. If the index is less than zero, the insertion occurs at the end of the underlying pool.
func getStream(index: Int32
) -> AudioStream? Returns the stream at the specified index.
func getStreamProbabilityWeight(index: Int32
) -> Double Returns the probability weight associated with the stream at the given index.
func moveStream(indexFrom: Int32, indexTo: Int32
) Move a stream from one index to another.
func removeStream(index: Int32
) Remove the stream at the specified index.
func setStream(index: Int32, stream: AudioStream?
) Set the AudioStream at the specified index.
func setStreamProbabilityWeight(index: Int32, weight: Double
) 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.