godot-proposals icon indicating copy to clipboard operation
godot-proposals copied to clipboard

Add a way to get the current Stream at a playing AudioStreamRandomizer

Open Suero152 opened this issue 2 years ago • 4 comments

Describe the project you are working on

A 2D game with background randomized soundtrack, I was trying to display the current playing music on UI.

Describe the problem or limitation you are having in your project

I don't see Any way I could get the current Stream playing at AudioStreamRandomizer?

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Add any way to get the current stream resource playing when the AudioStreamPlayer is using a AudioStreamRandomizer

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Could be a property of the AudioStreamRandomizer resource.

If this enhancement will not be used often, can it be worked around with a few lines of script?

I couldn't find any other solution beside not using the actual AudioStreamRandomizer and coding the random logic yourself.

Is there a reason why this should be core and not an add-on in the asset library?

Not having it makes AudioStreamRandomizer very limited to an scalable use.

Suero152 avatar Feb 12 '24 06:02 Suero152

  • Related to https://github.com/godotengine/godot-proposals/issues/3307 (as knowing the current random song can be useful to display attribution).

Calinou avatar Feb 12 '24 19:02 Calinou

I think the same logic should extend to other similar meta streams like AudioStreamPlaylist. It's good to know what's playing to allow displaying information regarding what's playing to a player, etc. If I'd want to show an audio player UI in a game I think currently I'd have to recreate/replicate AudioStreamRandomizer/AudioStreamPlaylist more or less completely just to add getting the current sub-stream index.

KesKim avatar Nov 11 '24 18:11 KesKim

I was hoping I'd find a solution but alas I found this issue. Would love to see this, as it makes debugging sounds quite difficult.

AlexKalopsia avatar Nov 17 '25 22:11 AlexKalopsia

Little addition: Would be nice if you could also dictate a specific sound to play again.

In my project i am saving the currently playing sound and it's timestamp dynamically, so it would be great to not only get the current playing stream, but also to play a specific stream again, when i load my savefile for example.

Drakon74 avatar Jan 13 '26 14:01 Drakon74