+1 vote

Hi! I'm having some issues with the new audio system (trying to use functionality). Some of it was asked already by someone else but left unanswered (see here):

  • Is there a way to have several audio samples on the same AudioStreamPlayer? Previously one could have many of them in a SamplePlayer and choose which one to play. Is the new recommended workflow to keep one sample per node?

  • Is there an equivalent of the set_paused function to pause a stream? I only found methods to stop the stream, but it loses the information of where I am in the stream and I'm not sure how I could get it to resume playing at the same position in the stream.


in Engine by (26 points)

why can't you get the current playback position then re-feed it into the audiostreamplayer


var latest_pos = player.get_playback_position ( )


That's embarrassing, at the time I couldn't find a method to give me the current position in the stream, get_playback_position is exactly what I was looking for, thanks a lot :)

Do you know if by any chance I'm also missing something obvious about the first question: having several samples in the same node?

you can probably just use a map and set it manually I guess.

I am writing psuedo code

  map = { 0: stream1, 1: stream2: ...  }

  var player = get_node("audiostreamsampleplayer")

 def switch_sample(num):
      player.set_stream( map[num] )

I wonder something like this works.

Note I am using the wrong sytax for gdscript

1 Answer

0 votes

Any news on this?
Is this the only current solution?

sorry for the bump

by (25 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.