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

Handle clicking on AudioStream change in AudioStreamPlayer2D/3D #30827

Closed
akien-mga opened this issue Jul 25, 2019 · 18 comments
Closed

Handle clicking on AudioStream change in AudioStreamPlayer2D/3D #30827

akien-mga opened this issue Jul 25, 2019 · 18 comments

Comments

@akien-mga
Copy link
Member

Godot version:
3.2 master (3a68b24)

OS/device including version:
All

Issue description:
#25974 aimed at fixing a clicking noise when changing AudioStreams as reported in #25087, but it introduced bugs and was reverted by #28469.

Then @reduz implemented a proper fix for AudioStreamPlayer in 040b59c, but did not do it for AudioStreamPlayer2D and AudioStreamPlayer3D. The code from this commit should be ported over to those two classes.

@fahlmant
Copy link

I'd be interested in giving this a try

@alokranjan1234
Copy link

is this issue still open? I would like to work on it.

@Calinou
Copy link
Member

Calinou commented Aug 5, 2019

@alokranjan1234 It seems like nobody has submitted a pull request yet, so go ahead 🙂

@fahlmant
Copy link

fahlmant commented Aug 5, 2019

Haven't had time yet, so go ahead

@samsindt
Copy link
Contributor

Anyone still working on this?

@Calinou
Copy link
Member

Calinou commented Aug 29, 2019

@samsindt It doesn't seem like anyone is working on it currently, so you could give it a try.

@hbina
Copy link
Contributor

hbina commented Sep 5, 2019

@samsindt are you working on this still?

I was reading the code and have a few questions.
Why are certain variables volatile?
I don't think the usage --- the only one, where you are dealing with specialised hardware that writes to memory --- applies here.

@samsindt
Copy link
Contributor

samsindt commented Sep 5, 2019

@hbina I am still working on it but am having trouble replicating the bug on MacOS. Feel free to give it a try.

@hbina
Copy link
Contributor

hbina commented Sep 5, 2019

Kewl, I don't quite understand how to apply the changes from reduz's patch because there are lots of different functions from there and here...

@Calinou
Copy link
Member

Calinou commented Sep 5, 2019

Removing the junior job label, as it doesn't seem easy to implement.

@akien-mga akien-mga modified the milestones: 3.2, 4.0 Jan 19, 2020
@gdesecrate
Copy link

I am having this issue in my game. But reading your comments ... gave me and idea. Spawn new StreamPlayer3D node every time new sound is played. And delete it when sound ends. I love you guys!

@SoapSpangledGames
Copy link

I am having this problem (and other audio problems which don't belong with this issue) on 3.2 stable with AudioStreamPlayer on Linux. It doesn't matter if the audio is wav or ogg. The audio is flawless if played with automatic looping, but has painfully obvious clicks/static when played by changing streams. (AudioStreamPlayer.stream=x).

@Calinou
Copy link
Member

Calinou commented Jun 5, 2020

@SoapSpangledGames As a workaround, try creating a new AudioStreamPlayer after freeing the previous one.

@SoapSpangledGames
Copy link

The problem persists when I change my code to create a new AudioStreamPlayer after freeing the previous one.

Initially, I created the AudioStreamPlayer as part of the scene design, and just changed the stream as each sound finished playing.

After your suggestion, I removed it from the scene design in the IDE, and created it in code, queue_free()'ing it and recreating it in my finished() event handler. Either way, the clicking is still present.

@Calinou
Copy link
Member

Calinou commented Jun 5, 2020

@SoapSpangledGames How long is the sound? If the workaround doesn't work, then this could be a different problem (#22016).

@SoapSpangledGames
Copy link

SoapSpangledGames commented Jun 5, 2020

The sounds are 0.1 seconds to 0.7 seconds (the 0.7 second sound is silence), played in rapid succession. After reading through (#22016), I think that is my issue.

@ellenhp
Copy link
Contributor

ellenhp commented Sep 23, 2021

This should be fixed in 4.0. @akien-mga Do we want to keep this issue open for 3.x?

@akien-mga
Copy link
Member Author

Let's closed as fixed in 4.0 then. If anyone wants to work on a non-intrusive fix for this issue in 3.x though, feel free to.

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

9 participants