You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you try to load WAV file with size more then INT_MAX (2147483647) you'll get frames < 0, and after some lines of code
you will get a not clear message
Or, if workstation have small amout of RAM (8Gb) - Godot also crash
As a partial solution you can add check like this after this line
if (chunksize > INT_MAX) {
ERR_FAIL_V_MSG(ERR_INVALID_DATA, "File too big.");
}
but it not well IMO. May be better to constraint file size with understandable message for Godot user.
WAV file can be 4Gb as chunksize is unsigned 32bit int wiki , but in Godot data also stored in Vector<float>, and it require big amount of memory and mine 32Gb not enougth(I try to rebuild Godot changing frames type to uint32_t and got exception with stosb assembler instruction )
Steps to reproduce
Try to import big WAV file, more then 2147483647 bytes
Minimal reproduction project (MRP)
N/A
The text was updated successfully, but these errors were encountered:
I created a pull request with a nicer error message for the condition you indicated.
I've also had a look at the code to see if there's a feasible way to support larger WAV files, but I don't think that's possible. It's not just the WAV importer. Neither the WAV stream nor the resource saver support more than 2 GiB of data in a single object, so if the importer were to support larger WAV files, these would just fail a bit further down the line. Wanting to keep a multi-hour long sound effect in memory is a rather uncommon requirement, so I don't think there's much chance for fundamental changes to Godot in order to support that.
I created a pull request with a nicer error message for the condition you indicated.
I've also had a look at the code to see if there's a feasible way to support larger WAV files, but I don't think that's possible. It's not just the WAV importer. Neither the WAV stream nor the resource saver support more than 2 GiB of data in a single object, so if the importer were to support larger WAV files, these would just fail a bit further down the line. Wanting to keep a multi-hour long sound effect in memory is a rather uncommon requirement, so I don't think there's much chance for fundamental changes to Godot in order to support that.
Thank you. I looked in source to understand how AudioStreamPlayer works and why this error happens. I assumed thаt it load data from file by blocks and play it, (like in foobar2000 for ex.), it was wrong.
Tested versions
4.2.1
4.3.dev5
System information
Windows 10 x64
Issue description
There is(link) unsafe cast from
uint32_t
toint
If you try to load WAV file with size more then INT_MAX (2147483647) you'll get
frames < 0
, and after some lines of codeyou will get a not clear message
Or, if workstation have small amout of RAM (8Gb) - Godot also crash
As a partial solution you can add check like this after this line
but it not well IMO. May be better to constraint file size with understandable message for Godot user.
WAV file can be 4Gb as
chunksize
is unsigned 32bit int wiki , but in Godot data also stored inVector<float>
, and it require big amount of memory and mine 32Gb not enougth(I try to rebuild Godot changingframes
type touint32_t
and got exception withstosb
assembler instruction )Steps to reproduce
Try to import big WAV file, more then 2147483647 bytes
Minimal reproduction project (MRP)
N/A
The text was updated successfully, but these errors were encountered: