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

AudioStreamPlayer.get_stream_playback() returns null #76324

Closed
Tracked by #76797
blackears opened this issue Apr 21, 2023 · 6 comments · Fixed by #81858
Closed
Tracked by #76797

AudioStreamPlayer.get_stream_playback() returns null #76324

blackears opened this issue Apr 21, 2023 · 6 comments · Fixed by #81858

Comments

@blackears
Copy link

Godot version

v4.0.2.stable.official [7a0977c]

System information

Windows 10, Forward+

Issue description

Trying to get this project to run in Godot 4. I imported it and ran the conversion process to upgrade to Godot 4.

https://github.com/godotengine/godot-demo-projects/tree/3.5-9e68af3/audio/generator

When I try to run it, I get the error Attempt to call function 'get_frames_available' in base 'null instance' on a null instance.

Steps to reproduce

Run the attached project. When $Player.get_stream_playback() is called, it will return null which causes the rest of the demo to fail.

Minimal reproduction project

generator.zip

@KoBeWi
Copy link
Member

KoBeWi commented Apr 21, 2023

You need to play the AudioStreamPlayer before getting the playback.

@blackears
Copy link
Author

That worked.

@KoBeWi
Copy link
Member

KoBeWi commented Apr 21, 2023

Reopening, because we should have it documented. I don't see it mentioned anywhere.

@KoBeWi KoBeWi reopened this Apr 21, 2023
@blackears
Copy link
Author

I'm also noticing AudioStreamPlayback's methods aren't documented.

@blackears
Copy link
Author

blackears commented Apr 21, 2023

Would you know why I'm able to access methods on AudioStreamPlayback like get_frames_available() and push_frame(), but not methods like seek() and get_playback_position()? None of these are listen in the documentation or the auto complete, but the first two can none the less be called.

I'm looking at audio_stream_generator.h in the source code to get an idea of what methods ought to be there.

@KoBeWi
Copy link
Member

KoBeWi commented Apr 21, 2023

Methods beginning with _ are virtual. They are supposed to be overriden (to create custom playbacks), not called.
(they have virtual next to their name in the doc, you can hover it for more info)

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

Successfully merging a pull request may close this issue.

3 participants