Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | piever | |
Old Version | Published before Godot 3 was released. |
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.
Thanks!
why can’t you get the current playback position then re-feed it into the audiostreamplayer
AudioStreamPlayer — Godot Engine (latest) documentation in English
var latest_pos = player.get_playback_position ( )
player.play(last_pos)
??
hungrymonkey | 2017-11-11 20:04
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?
piever | 2017-11-13 11:36
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
hungrymonkey | 2017-11-17 14:58