AudioStreamPlayer
Plays back audio non-positionally.
AudioStreamPlayer.swift:19class AudioStreamPlayer
Plays an audio stream non-positionally.
To play audio positionally, use AudioStreamPlayer2D
or AudioStreamPlayer3D
instead of AudioStreamPlayer
.
This object emits the following signals:
Superclasses
class Node
Base class for all scene objects.
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 autoplay: Bool
If
true
, audio plays when added to scene tree.var bus: StringName
Bus on which this audio is playing.
var finished: SimpleSignal
Emitted when the audio stops playing.
var maxPolyphony: Int32
The maximum number of sounds this node can play at the same time. Playing additional sounds after this value is reached will cut off the oldest sounds.
var mixTarget: AudioStreamPlayer.MixTarget
If the audio configuration has more than two speakers, this sets the target channels. See
MixTarget
constants.var pitchScale: Double
The pitch and the tempo of the audio, as a multiplier of the audio sample’s sample rate.
var stream: AudioStream?
The
AudioStream
object to be played.var streamPaused: Bool
If
true
, the playback is paused. You can resume it by settingstreamPaused
tofalse
.var volumeDb: Double
Volume of sound, in dB.
func getPlaybackPosition(
) -> Double Returns the position in the
AudioStream
in seconds.func getStreamPlayback(
) -> AudioStreamPlayback? Returns the
AudioStreamPlayback
object associated with thisAudioStreamPlayer
.func hasStreamPlayback(
) -> Bool Returns whether the
AudioStreamPlayer
can return theAudioStreamPlayback
object or not.func isPlaying(
) -> Bool func play(fromPosition: Double
) Plays the audio from the given
fromPosition
, in seconds.func seek(toPosition: Double
) Sets the position from which audio will be played, in seconds.
func stop(
) Stops the audio.