Skip to content

ChiptunePlayer3D

Extends AudioStreamPlayer3D. Read from the plugin's source on every build.

ChiptunePlayer against a AudioStreamPlayer3D, for audio positioned in a 3D scene.

A separate class rather than a shared base because Godot’s three players descend from Node, Node2D and Node3D and share no ancestor that has a stream. The document handling is ChiptuneAudioStream.for_document in both other players too, which is where that logic actually lives.

Properties

document

@export_custom(PROPERTY_HINT_RESOURCE_TYPE, "ChiptuneSfxSpec") var document: Resource

The .sfx.tres to play.

Hinted to ChiptuneSfxSpec alone so the picker and its Quick Load search offer sounds and not every resource in the project. A song belongs on a ChiptuneMusicPlayer, which has the loop. The hint is an editor filter and not the contract: anything answering render() still plays when it is assigned from code or written into a scene by hand, a song included. See ChiptuneAudioStream.

Methods

rerender

func rerender() -> void

Renders document again, so a change made to it from a script is heard on the next AudioStreamPlayer3D.play. The same call ChiptunePlayer has, and the same cost: see the module README.

Constants

DERIVED_PROPERTIES

const DERIVED_PROPERTIES: Array[StringName] = [&"stream"]

Neither shown nor stored. stream is built from document, so showing it would be two properties that can disagree and storing it would put the rendered audio in somebody’s scene file.

JamChip 0.1.0, by GlitterSnack. MIT licence. Built from the source on every merge, artwork and screenshots included, with JamChip.