Successful but silent audio playback
This code by itself works, and is directly copy pasted out of my program. But it doesn't work within my program. al_play_sample and al_play_sample_instance both return true, but there is no sound in my actual program where there is in this simple test program. It's kind of mysterious. Any ideas why this might be?
Just checked it out.
Failed to play sample instance.
But I can hear the sound file playing.
Just thought I'd let you know.
Well then that's a third behavior. Like I said it works fine by itself but is totally silent within my actual program.
This is with Allegro 5.1.11 and MinGW 4.8.1 on Vista btw.
I tested the given code with Allegro 5.0.10.
May I ask, not to go off topic or anything, but how did you compile 5.1.11 for MinGW, I tried before and failed and I would like to try out some Android Programming with Allegro.
Compiling A5.1.11 with MinGW worked fine for me. I just used CMake, and make like normal. If you need help, post a new thread with your errors, and I'll help you as best I can. The hardest part is getting the dependencies compiled.
Btw, MinGW is for windows, but to compile on Android you use gcc IIRC, which shouldn't be much different.
Still don't know why there is no sound. Ideas?
Nope I have no idea why this could happen, everything seems to appear fine to me, except for the debugging output.
Anybody have any ideas how I might debug this? Could it be another addon interfering somehow? Because I have stripped out all the unnecessary code from my program to make the example (which works).
It's on my TODO list to look into this, sorry it's been a busy week
Hey, no problem. I appreciate all the help I can get. You can download a 7z of my project where the audio is silent from here (includes win32 binary and src) :
Press space to start the experiment and then move the mouse around the inside of the star. Audio is supposed to play when the mouse is idle for more than about 3-5 seconds, but it is quiet. I don't believe I have any memory corruption or overruns, so I don't really know what would explain it.
Thanks for looking into this.
Alright, so the issue was that in your game you called al_restore_default_mixer(). This actually returns a bool, which if you checked it, you'd have seen it returned false. It turns out that there was a bug in Allegro when al_restore_default_mixer() was called twice (it's called the first time when you call al_reserve_samples) which resulted in the default mixer getting destroyed, but not cleared (which let the al_play_sample calls succeed).
It's all fixed now in 5.1 HEAD.
That fixed one issue, and now al_play_sample works correctly, but al_play_sample_instance is still silent, even though it returns true. (Note: I am still using 5.1.11, as I haven't rebuilt A5 from Git yet)
I've uploaded an updated 7z of the source and exe to :
That's just because you haven't attached it to a mixer. I do wonder if maybe it should return false in that case...
Thread #615723. Printed from Allegro.cc
Er. what? I have to attach sample instances to a mixer before they will play?