Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio is stopped when changing the properties of AudioStream #42673

Open
vetu11 opened this issue Oct 9, 2020 · 4 comments
Open

Audio is stopped when changing the properties of AudioStream #42673

vetu11 opened this issue Oct 9, 2020 · 4 comments

Comments

@vetu11
Copy link

vetu11 commented Oct 9, 2020

Godot version:

3.2.3.stable

OS/device including version:

Manjaro Linux, 5.8.11-1-MANJARO

Issue description:

If an AudioStreamPlayer is playing and you change any of the properties of the stream the audio stops.

Steps to reproduce:

  • Add an AudioStreamPlayer with any sound.
  • Change any of the properties of the AudioStream.
  • The audio stops.

Minimal reproduction project:

AudioStreamPropertiesStopsAudio.zip

@kyleguarco
Copy link

kyleguarco commented Oct 9, 2020

I can't trigger the bug. What property did you change, exactly? What were you doing when changing the properties?

Running Debian Sid, kernel 5.8.0.

Yeah, ran the project and can confirm it.

@DavidSichma
Copy link
Contributor

Can reproduce on master but not really audio bug, GDScript quirk. (see #41319 or one of the many other instances)

This line
$AudioStreamPlayer.stream.loop = false
gets interpreted as

  1. change loop property of stream
  2. because stream is now changed, change the stream property of the stream player
    changing streams stops the the stream as one might put some completely new stream in there.

Current work arounds

  • call setter at the end
  • get stream by getter
  • put stream in a var first

@vetu11
Copy link
Author

vetu11 commented Oct 10, 2020

I can't trigger the bug. What property did you change, exactly? What were you doing when changing the properties?

Running Debian Sid, kernel 5.8.0.

Check the Minimal Reproduction Project. It has a timer that changes the loop property after the sound started

@dalexeev
Copy link
Member

dalexeev commented Feb 16, 2023

I tested, it's really a GDScript bug. This has been fixed in 4.0, probably by #72398.

In 3.5 the bug is still reproducible (I haven't tested in 3.x), the workarounds mentioned by DavidSichma work:

# The bug. It works in 4.0 RC 2.
$AudioStreamPlayer.stream.loop = false

# OK.
$AudioStreamPlayer.get_stream().loop = false

# OK.
$AudioStreamPlayer.stream.set_loop(false)

# OK.
var stream = $AudioStreamPlayer.stream
stream.loop = false

Please add GDScript label and 3.x milestone.

@akien-mga akien-mga added this to the 3.x milestone Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants