Problem loading audio stream from tracker music file
mm2dog

Hello, I'm a newcomer to Allegro and I'm trying to play an .xm music file with the following code:

#SelectExpand
1ALLEGRO_AUDIO_STREAM *stream = al_load_audio_stream("path/to/file.xm", 4, 2048); 2if (stream) { 3 al_set_audio_stream_playmode(stream, ALLEGRO_PLAYMODE_LOOP); 4 al_set_audio_stream_playing(stream, true); 5} 6else { 7 // panic! 8}

The problem is, al_load_audio_stream is returning NULL. I know the file path is correct and I know the audio and acodec Allegro addons are both working because I am able to load and play .wav samples. I understand Allegro 5 uses DUMB to play module files like .xm, and I have the DUMB library installed. Do I need to #include anything or link anything beyond the audio and acodec libraries in order to load and play .xm files? I haven't been able to find any full code examples with this specific format so I'm a little bit lost.

Additionally, I'm not really sure what the second and third parameters of al_load_audio_stream are supposed to be (number of buffers and number of samples, respectively), so I just used values I saw other people using in posts online. Could this be the source of the issue, and if so, how do I determine which values to use with the music file I want?

SiegeLord

What OS is this?

mm2dog

Sorry, I forgot to mention. I am on Arch linux

SiegeLord

The Arch package doesn't build Allegro with the DUMB dependency (see https://github.com/liballeg/allegro5/issues/670#issuecomment-251003473 for the explanation). You'll have to build Allegro yourself. Just install these dependencies manually (https://git.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/allegro#n14), in addition to dumb, and then follow the usual build instructions (see further below in that PKGBUILD file).

mm2dog

I'm a little ashamed I didn't find that issue on github with my googling. Thanks for your help!

Thread #616738. Printed from Allegro.cc