-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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 with compress mode set to RAM always plays from the beginning #18878
Comments
This is still the case in the latest 3.2 RC. Does anyone know if this is by design, or is this something that will get fixed? |
Still valid in 3.2.4 beta4 |
Seems to be by design. I'm not sure how hard it would be to add this feature though. https://github.com/godotengine/godot/blob/master/scene/resources/audio_stream_sample.cpp#L38 Intuitively, looping involves a seek so I was curious how that's done, but it looks like godot does some clever caching to store the state of the decoder at the loop point. In general it seems like a seek involves a linear search for this compression type. |
Out of curiosity, is IMA-ADPCM compression still relevant now that we have MP3 support? MP3 decoding should be cheap enough on the CPU for IMA-ADPCM to be irrelevant today. Of course, we'll have to leave it in 3.2.x but we could consider removing IMA-ADPCM in Godot 4.0. |
I posted a snippet of our sample code. Seeking ADPCM is O(1) because all blocks are fixed in size, except for the last block (all block sizes are power of 2). |
Godot's implementation of IMA ADPCM doesn't use blocks, at least at the moment. |
ADPCM is in blocks. Otherwise it's not ADPCM. You should be able to divide the raw bitstream by bytesPerBlock (accounting that the last block doesn't have the same block size) and start feeding Godot's decoder from the beginning of that block as if it's the beginning of the file and it should work. |
I've looked at the implementation*, there are definitely no blocks. It's doing everything that IMA ADPCM does other than the blocks, though, including the shaping and adaptive quantization, so I feel like calling it "not ADPCM" is a bit of a stretch. (Side note: there's a variable for quantization error tracking but it's not actually used. Seems like a bug?)
EDIT: To make it clear, this function is applied to the entire sample buffer at once, not on a per-block basis. |
Godot version:
47d4a01
Issue description:
I don't know if this is just a limitation or not, but if a audio file has its compress mode set to RAM (Ima-ADPCM), it will ignore the
from_position
argument in theplay
method.The text was updated successfully, but these errors were encountered: