it's a bad practice to play sounds in the process function , usually sfx plays when an event happens , like when a button or key is pressed or something happens like area entered , you can use signals for that or play the sound in ready when a node entered , if you want to make something happen once in process function you should use an extra member variable of type bool , like sound_whatever_is_playing = false
, and in the process function you should do it like if something happened and not sound_whatever_is_playing
play the sound and set sound_whatever_is_playing = true
and then connect the signal finished from the audio_stream_player2d
and when it emits set sound_whatever_is_playing = false