Skip to content

Polyphonic Audio Resources missing documentationΒ #8172

Open
@nonfinity

Description

Your Godot version: 4.1.1.stable.mono.official [bd6af8e0e]

Issue description:
From the documentation on AudioStreamPolyphonic, it appears I should be able to load multiple different AudioStreams into it somehow and play them. But it is not clear how to make this work. A short sample would be extremely helpful. There appears to be no information available anywhere on the internet that describes to use this functionality (in English at least)

URL to the documentation page (if already existing):
https://docs.godotengine.org/en/stable/classes/class_audiostreampolyphonic.html
https://docs.godotengine.org/en/stable/classes/class_audiostreamplaybackpolyphonic.html

This is what I've pieced together. It doesn't throw any errors, but it also doesn't play any audio:

func _on_button_pressed():
var asset1 = preload("res://assets/audio/sfx/Dash_Reset.wav")
var asset2 = preload("res://assets/audio/sfx/Fox_Hurt.wav")

var player: AudioStreamPlayer = $AudioStreamPlayer
var stream: AudioStreamPolyphonic = player.stream    # set in the Inspector UI to Polyphonic

var pback: AudioStreamPlaybackPolyphonic
if player.has_stream_playback():
	# this never gets called, even hitting the button very very quickly
	pback = stream.get_stream_playback()
else:
	pback = stream.instantiate_playback()

var sound1 = pback.play_stream(asset1)
var sound2 = pback.play_stream(asset2)

print("stream sound1 (", sound1, ") is playing? ", str(pback.is_stream_playing(sound1)) )
print("stream sound2 (", sound2, ") is playing? ", str(pback.is_stream_playing(sound2)) )
# always prints that sound is playing, but play_stream integers never change and not audio is heard

This is similar to #4622 ... but for version 4.x and polyphony specifically.

Metadata

Assignees

No one assigned

    Labels

    area:class referenceIssues and PRs about the class reference, which should be addressed on the Godot engine repositoryarea:manualIssues and PRs related to the Manual/Tutorials section of the documentationcontent:new pageIssues and PRs related to creation of new documentation pages for new or undocumented featuresenhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions