Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » Allegro 5 can compile MP3 support but physically cannot play MP3s, on Linux

This thread is locked; no one can reply to it. rss feed Print
Allegro 5 can compile MP3 support but physically cannot play MP3s, on Linux
Chris Katko
Member #1,881
January 2002
avatar

I've got libpulse-dev, libasound-dev, minimp3 from github for Linux audio support for cmake.

[sidenote: OSS (open source sound) support is in by default, but OSS is heavily depreciated and disabled in the kernel on most distros according to some quick googling.]

Cmake-GUI lists MP3 support as YES.

    - Acodec addon: yes
     - FLAC: NO
     - DUMB: NO
     - Ogg/Vorbis: yes
     - Opus: NO
     - MP3: yes

and throws no warnings.

Then, when I try to play a mp3 the allegro.log says

    audio    I              audio.c:378  do_install_audio                 [   0.54679] Using PulseAudio driver

    audio    E           audio_io.c:324  al_load_sample                   [   0.55076] No handler for audio file extension .mp3 - therefore not trying to load ./data/extra/sounds/pixabay/karate-chop-6357.mp3.

[My build process is confirmed to be running (make -> make install) because before I didn't have PulseAudio/ALSA support and the error was regarding that.
So it shouldn't be "You forgot to install Allegro after rebuilding" or something like that]

So unless I'm mistaken and I have to manually register the mp3 file handler, this looks like a bug in the build process.

The following Allegro code looks like it is supposed to auto setup the handler:

addons/acodec/acodec.c-65-
addons/acodec/acodec.c-66-   /* MP3 will mis-identify a lot of mod files, so put its identifier last */
addons/acodec/acodec.c-67-#ifdef ALLEGRO_CFG_ACODEC_MP3
addons/acodec/acodec.c:68:   ret &= al_register_sample_loader(".mp3", _al_load_mp3);
addons/acodec/acodec.c-69-   ret &= al_register_audio_stream_loader(".mp3", _al_load_mp3_audio_stream);
addons/acodec/acodec.c:70:   ret &= al_register_sample_loader_f(".mp3", _al_load_mp3_f);
addons/acodec/acodec.c-71-   ret &= al_register_audio_stream_loader_f(".mp3", _al_load_mp3_audio_stream_f);
addons/acodec/acodec.c-72-   ret &= al_register_sample_identifier(".mp3", _al_identify_mp3);
addons/acodec/acodec.c-73-#endif

[edit] Issue resolved via discord while A.CC was down. I wasn't initializing the Allegro codec. Which exists on a two line separate page of the A5 manual and not mentioned in the entire sound section of the manual. 10/10 esport ready.

https://www.allegro.cc/manual/5/audio.html

This is a separate module... and it has TWO FUNCTIONS.

https://www.allegro.cc/manual/5/acodec.html

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Go to: