godot icon indicating copy to clipboard operation
godot copied to clipboard

Adds `load_from_file()` to `AudioStreamMP3`

Open MaxIsJoe opened this issue 1 year ago • 7 comments

I noticed in the docs while working on my own project that AudioStreamMP3 was missing load_from_file(), which ogg already has. This PR adds that missing function so that it matches ogg.

I wanted to add it to WAV as well, but I can do it in a later PR.

MaxIsJoe avatar Oct 05 '24 18:10 MaxIsJoe

seems like I'm doing indentation wrong for the docs, what's the correct way to do it? and is there a way to test that locally so I don't spam the PR?

MaxIsJoe avatar Oct 05 '24 19:10 MaxIsJoe

I think it is strange that ResourceImporterOggVorbis has load_from_buffer and load_from_file methods while ResourceImporterMP3 has only import_mp3 method which by function signature looks like load_from_file...

dustdfg avatar Oct 05 '24 19:10 dustdfg

seems like I'm doing indentation wrong for the docs, what's the correct way to do it? and is there a way to test that locally so I don't spam the PR?

Try to install pre-commit

dustdfg avatar Oct 05 '24 19:10 dustdfg

seems like I'm doing indentation wrong for the docs, what's the correct way to do it? and is there a way to test that locally so I don't spam the PR?

Try to install pre-commit

image

MaxIsJoe avatar Oct 05 '24 19:10 MaxIsJoe

It usually runs before you made a commit. When you manually run it there is no unstaged/modified files so it doesn't have what to check...

dustdfg avatar Oct 05 '24 19:10 dustdfg

ah, got it.

MaxIsJoe avatar Oct 05 '24 19:10 MaxIsJoe

There in the docs which you mentioned a bit lower is placed note screen-1728196807

But I am glad you didn't notice it, it forced godot to support runtime loading of mp3 and I hope wav (if you are still going to do the same with wav otherwise I think can do it).

This comment is also something like TODO because after merging these pr's that note in docs will become outdated

dustdfg avatar Oct 06 '24 06:10 dustdfg

A potentially empty new line with only whitespace is making the static checks fail.

Mickeon avatar Nov 12 '24 17:11 Mickeon

Will need to be rebased before this can be merged

Repiteo avatar Dec 05 '24 19:12 Repiteo

Will need to be rebased before this can be merged

Done 👍

MaxIsJoe avatar Dec 05 '24 21:12 MaxIsJoe

I squashed the commits and fixed remaining style issues, this should now be ready.

akien-mga avatar Dec 12 '24 10:12 akien-mga

I think it is strange that ResourceImporterOggVorbis has load_from_buffer and load_from_file methods while ResourceImporterMP3 has only import_mp3 method which by function signature looks like load_from_file...

You're right, ResourceImporterMP3 should also have load_from_buffer and not just load_from_file. I'll fix that.

akien-mga avatar Dec 12 '24 10:12 akien-mga

I think it is strange that ResourceImporterOggVorbis has load_from_buffer and load_from_file methods while ResourceImporterMP3 has only import_mp3 method which by function signature looks like load_from_file...

You're right, ResourceImporterMP3 should also have load_from_buffer and not just load_from_file. I'll fix that.

Superseded by #100307 which implements the missing load_from_buffer, and further harmonizes all the WAV/Ogg Vorbis/MP3 runtime loading code to follow the same structure based on #93831.

Thanks for the contribution! I added you as co-author to #100307.

akien-mga avatar Dec 12 '24 11:12 akien-mga