Cannot load sample.

Hey, i have a problem when i try to load sample, I'm doing exactly like I should, after al_load_sample function uses, my sample pointer is null...
Maybe someone had this issue too and know how to solve it? :-/

Edgar Reynaldo

There are several possible causes for al_load_sample to fail.

1. You didn't initialize allegro, the audio or the acodec addons.
See al_init() , al_install_audio() , al_init_acodec_addon() for details.

2. You didn't build support for your particular sound file type into allegro.
Where did you get allegro from? Did you build it yourself?

3. Your path or your current working directory is wrong.
Try testing loading the file with an absolute path. If a relative path fails, your working directory is not what you expect it to be. See al_change_directory() , al_get_standard_path() , al_path_cstr() for details.

4. Your sound file is a type not recognized by Allegro. Try saving it in a different format, or re-saving it with an audio editor.


Hey, thanks for quick response.
I've done init, audio and acodec_addon.
There is a site u meant
I tried to set a full path too, same issue.
I have ".wav" file.
Strange situation. ::)

Edgar Reynaldo


Your options are :

1. Update Allegro. Latest version is 5.2.1. Your problem may have been fixed. There are NUGET packages for MSVC now.

2. Try a different .wav file or an .ogg file and see if others work.

3. Try re-saving your .wav file.

Post your code, and post your .wav file as an attachment if it is not too large (>10 MB).


If u want to run it, i've added my stickman too.

Edgar Reynaldo

Okay. I have binaries of 5.2.0 and ex_audio_simple won't play it. Says it failed to load.

VLC Media Player can play it though, and here's what it says about the media :

Try re-saving it in your favorite audio editor. The codec must not be one recognized by Allegro, or maybe there is a bug. Don't know.


OK, thank you for help.
The problem was with sound file, I used another wav and there is how it should be.

Thread #616427. Printed from