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

Unable to load/play tracker files (.it/.xm/etc) #670

Closed
Eggbertx opened this issue Aug 27, 2016 · 21 comments
Closed

Unable to load/play tracker files (.it/.xm/etc) #670

Eggbertx opened this issue Aug 27, 2016 · 21 comments

Comments

@Eggbertx
Copy link

Using the tutorial here, Allegro seems to be unable to play tracker modules. I've tried installing dumb and using -ldumb, but while it compiles without errors, it can't load the audio sample.

@ghost
Copy link

ghost commented Aug 27, 2016

This is a limitation of the library. Modules can't be loaded as samples, only streamed.

@Eggbertx
Copy link
Author

So would I have to load the module through dumb while using Allegro for everything else?

@SiegeLord
Copy link
Member

SiegeLord commented Aug 28, 2016

No, the idea is that those files currently need to be played using al_load_audio_stream:

al_reserve_samples(1);
ALLEGRO_AUDIO_STREAM* stream = al_load_audio_stream("your_stream.it", 4, 2048);
al_attach_audio_stream_to_mixer(al_get_default_mixer());

Note that this used to be a limitation of DUMB, but since then we figured out how to use it so that it can play for a fixed duration. Still, since these tracker files are typically for pretty long musical pieces anyway, this isn't a very common issue.

@Eggbertx
Copy link
Author

That still doesn't work. And al_attach_audio_stream_to_mixer requires two arguments, the first one being the stream.

@SiegeLord
Copy link
Member

This code works for me:

#include <allegro5/allegro.h>
#include <allegro5/allegro_audio.h>
#include <allegro5/allegro_acodec.h>

int main(int argc, const char** argv)
{
    al_init();
    al_install_audio();
    al_init_acodec_addon();
    al_reserve_samples(1);

    ALLEGRO_AUDIO_STREAM* stream = al_load_audio_stream(argv[1], 4, 2048);
    al_attach_audio_stream_to_mixer(stream, al_get_default_mixer());

    while(al_get_audio_stream_playing(stream)) {
        al_rest(0.5);
    }
}

If that still doesn't work for you, perhaps you need to recompile Allegro as it needs to be configured with DUMB support.

@Eggbertx
Copy link
Author

Using that code and compiling with gcc main.c -o audioTest -L/usr/local/lib -lallegro -lallegro_main -lallegro_audio -lallegro_acodec as in the tutorial I linked and with -ldumb after I installed the dumb package, it works fine when I load a regular sound but segfaults when I try to load an it module (and likely other modules as well).

After I build it myself and can get it to work, I'd like to distribute it via an Arch Linux package and while I haven't set the dumb package as a dependency yet, wouldn't having my package recompile Allegro just so it can work be a bit unreasonable?

@ghost
Copy link

ghost commented Aug 28, 2016

If the Allegro Arch packages don't work you'll need to find the Arch maintainer and talk to him/her about it. As far as I know that person is not working directly on Allegro.

@Eggbertx
Copy link
Author

Alright, I guess I should have thought of that at first, but I'll contact them. If I ask and it turns out to be an issue with the package, I'll close this issue.

@Eggbertx
Copy link
Author

Eggbertx commented Sep 25, 2016

According to the Arch package maintainer, nothing is changed from upstream. I just checked, and if I install the necessary liballegro packages in Ubuntu, it works fine. And if I install allegro5-git, which uses an outdated version of allegro, it works there too.

@SiegeLord
Copy link
Member

SiegeLord commented Sep 26, 2016

Looking at the PGKBUILD file for the Allegro package, I note it doesn't seem to mark the dumb package as a dependency. Perhaps that's the issue?

@SiegeLord
Copy link
Member

So I checked in with our local Arch experts and the issue is as follows. Indeed, the PKGBUILD doesn't specify dumb as a dependency, so Allegro gets built without the ability to load these files. Adding dumb as a dependency won't be easy, however, as dumb package depends on Allegro 4 (this isn't a limitation of dumb, but rather of the package). The solution would be to have a dumb package that doesn't include the Allegro 4 dependency, and then modify the allegro package to depend on it.

@SimonN
Copy link
Contributor

SimonN commented Aug 28, 2017

I'm on Arch 64-bit, have run into this exact issue, and the situation is still like a year ago:

  • Arch's A5 doesn't depend on DUMB, not even optionally.
  • Arch's DUMB has no maintainer, and binaries are from 2014.
  • Arch's DUMB package points to 0.9.3, even though kode54's DUMB fork has reached version 1. This fork is recommended on the DUMB homepage.
  • Arch's DUMB package depends on Arch's A4 package. We know that DUMB was written mainly with Allegro in mind, but this looks like a bad dependency inversion.

Apparently nobody else has this issue. It's certainly more a problem with the packaging than with A5 itself. I'll talk with the Arch folks, and report back here in case something happens.

@Eggbertx
Copy link
Author

I'm glad I'm not the only one. Also, this might be related, but I'm trying to port a game engine that uses allegro to Android, and I ran into the same issue.

@SiegeLord
Copy link
Member

A comment about the DUMB fork. The primary reason we don't support it is because for the longest time it reported the same version (0.9.3) as the original, while making some breaking changes. Now that they changed it (I guess 2 years ago, haha), there's no technical reason not to support it. Of course it won't help if there's no Arch package for DUMB 1.0.

@SimonN
Copy link
Contributor

SimonN commented Aug 29, 2017

I've emailed Alexander Rødseth who maintains the A5 Arch package, and flagged the DUMB package out of date. Results:

  • Alexander would like to support tracked music, and will see what he can do.
  • In Arch's testing repository, DUMB 1.0 popped up, without A4 as a dependency anymore. This is not yet in Arch community.

Awesome progress, I'm really looking forward!

@SimonN
Copy link
Contributor

SimonN commented Sep 13, 2017

DUMB 1.0 has passed testing, it's now available in community.

Today's progress is in pull request #823. Beware, I merely got A5 to build with DUMB 1.0 on Arch, I haven't played back a module successfully yet, only got a crash at runtime.

@SimonN
Copy link
Contributor

SimonN commented Oct 30, 2017

@Eggbertx, are you still on Arch? The 'allegro' package depends on DUMB 2.0 now.

If you'd like to test, update your system, make sure that installs allegro 5.2.3-2 or newer. Then build from scratch SiegeLord's example program and see if it plays music.

I'd love to have your final word on this issue!

@SimonN
Copy link
Contributor

SimonN commented Dec 28, 2017

@Eggbertx, @SiegeLord: this issue should have been fixed with the DUMB 2.0 support in October 2017. Both I and our Arch maintainer have tested that helios.xm, the file posted in this github issue #670, play well with A5.

I suggest that this issue be closed. :-)

@SiegeLord
Copy link
Member

Okey dokey! Thanks @SimonN

@Eggbertx
Copy link
Author

Oh I'm sorry, I actually meant to close this (can issue openers close their issues if they aren't package maintainers?) issue since everything works now, but I forgot about it. Thank you for resolving it.

@SimonN
Copy link
Contributor

SimonN commented Dec 29, 2017

No problem -- thanks for your confirmation that everything works!

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

No branches or pull requests

3 participants