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

Segfault loading sounds from unpacked wave files. #25

Open
H-Art-Src opened this issue May 3, 2024 · 5 comments
Open

Segfault loading sounds from unpacked wave files. #25

H-Art-Src opened this issue May 3, 2024 · 5 comments

Comments

@H-Art-Src
Copy link

H-Art-Src commented May 3, 2024

Sound SOUND;
int id = rresGetResourceId(ASSETS_DIR , filename);
if(id)
{
      printf("~Loaded sound from rres~\n");
      rresResourceChunk chunk = rresLoadResourceChunk( "resources/DATA.rres" , id);
      UnpackResourceChunk(&chunk);
          Wave tempWave = LoadWaveFromResource(rresLoadResourceChunk( "resources/DATA.rres" , id));
          SOUND = LoadSoundFromWave(tempWave);
          UnloadWave(tempWave);
      rresUnloadResourceChunk(chunk);
}

If the packaged wav file is too large, approximately > 10 mb, LoadSoundFromWave() segfaults.

@H-Art-Src
Copy link
Author

Possibly related to raysan5/raylib#1423

@raysan5
Copy link
Owner

raysan5 commented May 5, 2024

@H-Art-Src Thanks for reporting! Did you verify the data returned by LoadWaveFromResource() is correct?

@H-Art-Src
Copy link
Author

H-Art-Src commented May 6, 2024

    Sound SOUND;
    int id = rresGetResourceId(ASSETS_DIR , filename);
    if(id)//raysan made this shit bugged for certain wav files I'M GOING TO WORK ON RAYLIB
    {
        printf("~Loaded sound from rres~\n");
        rresResourceChunk chunk = rresLoadResourceChunk( "resources/DATA.rres" , id);
        UnpackResourceChunk(&chunk);
            Wave tempWave = LoadWaveFromResource(chunk);
            SOUND = LoadSoundFromWave(tempWave); // still segfaults here
            UnloadWave(tempWave);
        rresUnloadResourceChunk(chunk);
    }

Realized LoadWaveFromResource() should be passing chunk, but it's still segfaulting from LoadSoundFromWave().

Unpacked sound is reported to be 28,653,396 bytes from FS.

What the log shows when commentating out SOUND = LoadSoundFromWave(tempWave);:

RRES: INFO: Loading resource from file: resources/DATA.rres
RRES: INFO: Found requested resource id: 0x18705889
RRES: WAVE: Id: 0x18705889 | Base size: 28653372 | Packed size: 28653372
RRES: WAVE: WARNING: Data must be decompressed/decrypted

@raysan5
Copy link
Owner

raysan5 commented May 6, 2024

@H-Art-Src Please, could you provide some sample with files for testing?

@H-Art-Src
Copy link
Author

https://mega.nz/folder/eNAjkK5J#3bnJLs4h0I_u5aQANkZl4Q
White noise packed and unpacked

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

No branches or pull requests

2 participants