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

When using AudioStreamInteractive, AudioStreamPlayer.get_playback_position() always returns 0 #97791

Closed
mchamby opened this issue Oct 3, 2024 · 4 comments · Fixed by #99200
Closed

Comments

@mchamby
Copy link

mchamby commented Oct 3, 2024

Tested versions

Reproducible in 4.3.stable.official [77dcf97].
Not reproducible before 4.3 as AudioStreamInteractive did not exist.

System information

Godot v4.3.stable - Windows 10.0.22631 - Vulkan (Forward+) - dedicated AMD Radeon RX 6600 (Advanced Micro Devices, Inc.; 32.0.11037.4004) - AMD Ryzen 5 5600X 6-Core Processor (12 Threads)

Issue description

When using AudioStreamInteractive, AudioStreamPlayer.get_playback_position() always returns 0 instead of returning the actual position. This is true for mp3 files and wav files, and probably other formats.

Steps to reproduce

  1. Create new project.
  2. Create AudioStreamPlayer node.
  3. Set AudioStreamPlayer's stream to AudioStreamInteractive
  4. Expand the AudioStreamInteractive in the inspector.
  5. Add clip.
  6. Import any audio file to the project.
  7. Set Clip 0's stream as the new audio file (drag the audio file over Clip 0's stream)
  8. Attach a script to the AudioStreamPlayer node.
  9. Replace function _process() with the following:
    func _process(delta: float) -> void: print(get_playback_position())
  10. Run project and see that the result is always 0.

Minimal reproduction project (MRP)

In my MRP, I have included a 2-second mp3 of my own creation. I've set the mp3 to loop to demonstrate the bug clearly, but the bug also happens if the loop is disabled.
audiostreaminteractive-bug-test.zip

@adamscott
Copy link
Member

I'm wondering if this is actually a bug. If there's multiple tracks, what does the playback position actually mean? Especially if there's long transitions.

@KingTheFifth
Copy link
Contributor

That does sound very reasonable. In that case, is this something to document instead? Neither the documentation of AudioStreamInteractive nor AudioStreamPlayer mentiones that get_playback_position() always returns 0 when using AudioStreamInteractive. I could make a PR that adds this to the documentation if that sounds good.

@adamscott
Copy link
Member

I could make a PR that adds this to the documentation if that sounds good.

Sounds great! Feel free to close this PR and mention it in your documentation one.

@HaydaRinna
Copy link

AudioStreamPlayer.play() with a from_duration argument specified or AudioStreamPlayer.seek() does not work for AudioStreamInteractive either. So I do not really think simply adding this to the documentation is a solution. Half the methods of AudioStreamPlayer not working with interactive streams does not sound like a good idea to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment