
godot.gen.godot.AudioStreamPlayer.kt Maven / Gradle / Ivy
// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY!
@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier",
"UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST",
"RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT",
"RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate")
package godot
import godot.`annotation`.GodotBaseType
import godot.core.StringName
import godot.core.VariantType.BOOL
import godot.core.VariantType.DOUBLE
import godot.core.VariantType.LONG
import godot.core.VariantType.NIL
import godot.core.VariantType.OBJECT
import godot.core.VariantType.STRING_NAME
import godot.core.memory.TransferContext
import godot.signals.Signal0
import godot.signals.signal
import kotlin.Boolean
import kotlin.Double
import kotlin.Float
import kotlin.Int
import kotlin.Long
import kotlin.Suppress
import kotlin.Unit
import kotlin.jvm.JvmOverloads
/**
* Plays back audio non-positionally.
*
* Tutorials:
* [https://godotengine.org/asset-library/asset/528](https://godotengine.org/asset-library/asset/528)
*
* Plays an audio stream non-positionally.
*
* To play audio positionally, use [godot.AudioStreamPlayer2D] or [godot.AudioStreamPlayer3D] instead of [godot.AudioStreamPlayer].
*/
@GodotBaseType
public open class AudioStreamPlayer : Node() {
/**
* Emitted when the audio stops playing.
*/
public val finished: Signal0 by signal()
/**
* The [godot.AudioStream] object to be played.
*/
public var stream: AudioStream?
get() {
TransferContext.writeArguments()
TransferContext.callMethod(rawPtr, ENGINEMETHOD_ENGINECLASS_AUDIOSTREAMPLAYER_GET_STREAM,
OBJECT)
return (TransferContext.readReturnValue(OBJECT, true) as AudioStream?)
}
set(`value`) {
TransferContext.writeArguments(OBJECT to value)
TransferContext.callMethod(rawPtr, ENGINEMETHOD_ENGINECLASS_AUDIOSTREAMPLAYER_SET_STREAM, NIL)
}
/**
* Volume of sound, in dB.
*/
public var volumeDb: Float
get() {
TransferContext.writeArguments()
TransferContext.callMethod(rawPtr, ENGINEMETHOD_ENGINECLASS_AUDIOSTREAMPLAYER_GET_VOLUME_DB,
DOUBLE)
return (TransferContext.readReturnValue(DOUBLE, false) as Double).toFloat()
}
set(`value`) {
TransferContext.writeArguments(DOUBLE to value.toDouble())
TransferContext.callMethod(rawPtr, ENGINEMETHOD_ENGINECLASS_AUDIOSTREAMPLAYER_SET_VOLUME_DB,
NIL)
}
/**
* The pitch and the tempo of the audio, as a multiplier of the audio sample's sample rate.
*/
public var pitchScale: Float
get() {
TransferContext.writeArguments()
TransferContext.callMethod(rawPtr, ENGINEMETHOD_ENGINECLASS_AUDIOSTREAMPLAYER_GET_PITCH_SCALE,
DOUBLE)
return (TransferContext.readReturnValue(DOUBLE, false) as Double).toFloat()
}
set(`value`) {
TransferContext.writeArguments(DOUBLE to value.toDouble())
TransferContext.callMethod(rawPtr, ENGINEMETHOD_ENGINECLASS_AUDIOSTREAMPLAYER_SET_PITCH_SCALE,
NIL)
}
/**
* If `true`, audio is playing.
*/
public val playing: Boolean
get() {
TransferContext.writeArguments()
TransferContext.callMethod(rawPtr, ENGINEMETHOD_ENGINECLASS_AUDIOSTREAMPLAYER_IS_PLAYING,
BOOL)
return (TransferContext.readReturnValue(BOOL, false) as Boolean)
}
/**
* If `true`, audio plays when added to scene tree.
*/
public var autoplay: Boolean
get() {
TransferContext.writeArguments()
TransferContext.callMethod(rawPtr,
ENGINEMETHOD_ENGINECLASS_AUDIOSTREAMPLAYER_IS_AUTOPLAY_ENABLED, BOOL)
return (TransferContext.readReturnValue(BOOL, false) as Boolean)
}
set(`value`) {
TransferContext.writeArguments(BOOL to value)
TransferContext.callMethod(rawPtr, ENGINEMETHOD_ENGINECLASS_AUDIOSTREAMPLAYER_SET_AUTOPLAY,
NIL)
}
/**
* If `true`, the playback is paused. You can resume it by setting `stream_paused` to `false`.
*/
public var streamPaused: Boolean
get() {
TransferContext.writeArguments()
TransferContext.callMethod(rawPtr,
ENGINEMETHOD_ENGINECLASS_AUDIOSTREAMPLAYER_GET_STREAM_PAUSED, BOOL)
return (TransferContext.readReturnValue(BOOL, false) as Boolean)
}
set(`value`) {
TransferContext.writeArguments(BOOL to value)
TransferContext.callMethod(rawPtr,
ENGINEMETHOD_ENGINECLASS_AUDIOSTREAMPLAYER_SET_STREAM_PAUSED, NIL)
}
/**
* If the audio configuration has more than two speakers, this sets the target channels. See [enum MixTarget] constants.
*/
public var mixTarget: MixTarget
get() {
TransferContext.writeArguments()
TransferContext.callMethod(rawPtr, ENGINEMETHOD_ENGINECLASS_AUDIOSTREAMPLAYER_GET_MIX_TARGET,
LONG)
return AudioStreamPlayer.MixTarget.from(TransferContext.readReturnValue(LONG) as Long)
}
set(`value`) {
TransferContext.writeArguments(LONG to value.id)
TransferContext.callMethod(rawPtr, ENGINEMETHOD_ENGINECLASS_AUDIOSTREAMPLAYER_SET_MIX_TARGET,
NIL)
}
/**
* 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.
*/
public var maxPolyphony: Int
get() {
TransferContext.writeArguments()
TransferContext.callMethod(rawPtr,
ENGINEMETHOD_ENGINECLASS_AUDIOSTREAMPLAYER_GET_MAX_POLYPHONY, LONG)
return (TransferContext.readReturnValue(LONG, false) as Long).toInt()
}
set(`value`) {
TransferContext.writeArguments(LONG to value.toLong())
TransferContext.callMethod(rawPtr,
ENGINEMETHOD_ENGINECLASS_AUDIOSTREAMPLAYER_SET_MAX_POLYPHONY, NIL)
}
/**
* Bus on which this audio is playing.
*
* **Note:** When setting this property, keep in mind that no validation is performed to see if the given name matches an existing bus. This is because audio bus layouts might be loaded after this property is set. If this given name can't be resolved at runtime, it will fall back to `"Master"`.
*/
public var bus: StringName
get() {
TransferContext.writeArguments()
TransferContext.callMethod(rawPtr, ENGINEMETHOD_ENGINECLASS_AUDIOSTREAMPLAYER_GET_BUS,
STRING_NAME)
return (TransferContext.readReturnValue(STRING_NAME, false) as StringName)
}
set(`value`) {
TransferContext.writeArguments(STRING_NAME to value)
TransferContext.callMethod(rawPtr, ENGINEMETHOD_ENGINECLASS_AUDIOSTREAMPLAYER_SET_BUS, NIL)
}
public override fun new(scriptIndex: Int): Boolean {
callConstructor(ENGINECLASS_AUDIOSTREAMPLAYER, scriptIndex)
return true
}
/**
* Plays the audio from the given [fromPosition], in seconds.
*/
@JvmOverloads
public fun play(fromPosition: Float = 0.0f): Unit {
TransferContext.writeArguments(DOUBLE to fromPosition.toDouble())
TransferContext.callMethod(rawPtr, ENGINEMETHOD_ENGINECLASS_AUDIOSTREAMPLAYER_PLAY, NIL)
}
/**
* Sets the position from which audio will be played, in seconds.
*/
public fun seek(toPosition: Float): Unit {
TransferContext.writeArguments(DOUBLE to toPosition.toDouble())
TransferContext.callMethod(rawPtr, ENGINEMETHOD_ENGINECLASS_AUDIOSTREAMPLAYER_SEEK, NIL)
}
/**
* Stops the audio.
*/
public fun stop(): Unit {
TransferContext.writeArguments()
TransferContext.callMethod(rawPtr, ENGINEMETHOD_ENGINECLASS_AUDIOSTREAMPLAYER_STOP, NIL)
}
/**
* Returns the position in the [godot.AudioStream] in seconds.
*/
public fun getPlaybackPosition(): Float {
TransferContext.writeArguments()
TransferContext.callMethod(rawPtr,
ENGINEMETHOD_ENGINECLASS_AUDIOSTREAMPLAYER_GET_PLAYBACK_POSITION, DOUBLE)
return (TransferContext.readReturnValue(DOUBLE, false) as Double).toFloat()
}
/**
* Returns whether the [godot.AudioStreamPlayer] can return the [godot.AudioStreamPlayback] object or not.
*/
public fun hasStreamPlayback(): Boolean {
TransferContext.writeArguments()
TransferContext.callMethod(rawPtr,
ENGINEMETHOD_ENGINECLASS_AUDIOSTREAMPLAYER_HAS_STREAM_PLAYBACK, BOOL)
return (TransferContext.readReturnValue(BOOL, false) as Boolean)
}
/**
* Returns the [godot.AudioStreamPlayback] object associated with this [godot.AudioStreamPlayer].
*/
public fun getStreamPlayback(): AudioStreamPlayback? {
TransferContext.writeArguments()
TransferContext.callMethod(rawPtr,
ENGINEMETHOD_ENGINECLASS_AUDIOSTREAMPLAYER_GET_STREAM_PLAYBACK, OBJECT)
return (TransferContext.readReturnValue(OBJECT, true) as AudioStreamPlayback?)
}
public enum class MixTarget(
id: Long,
) {
/**
* The audio will be played only on the first channel.
*/
MIX_TARGET_STEREO(0),
/**
* The audio will be played on all surround channels.
*/
MIX_TARGET_SURROUND(1),
/**
* The audio will be played on the second channel, which is usually the center.
*/
MIX_TARGET_CENTER(2),
;
public val id: Long
init {
this.id = id
}
public companion object {
public fun from(`value`: Long) = entries.single { it.id == `value` }
}
}
public companion object
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy