![]() |
|
Allegro Crashes With USB Audio Attached and Set as Default... |
Matt Dralle
Member #21,717
November 2021
|
Hi, I've been using Allegro 5 successfully on my Raspberry PI 4 (now Odroid C4) in a pure C project. However, I recently added a USB sound bar, which is otherwise working fine on the system. It shows up as "Card 1" with an "aplay -l": Odroid Root [AllegroTest] ==> aplay -l In /etc/asound.config I changed "card 0" to "card1" to to force the USB to be default sound source with: pcm.!default { amixer works fine with this setup: amixer -c 1 cset numid=3 100 mplayer also works fine with this setup: mplayer -ao alsa:device=default "http://prem1.di.fm:80/vocaltrance_hi However Allegro always crashes hard with this setup. Here is the function I am calling, gdb indicates the crash is happening at the line: "al_attach_sample_instance_to_mixer(sampleInstance, al_get_default_mixer() );" This is my function to setup and play my sounds (Sounds[ SoundsIndex ].SoundObject): void PlaySound( unsigned int SoundsIndex ) I tried the latest version of the Allegro distribution. I'm really at a loss as what to try next to fix this. I've tried four different USB speakers, all behave the same. If I set "hw card 1" to "hw card 0" in /etc/asound.conf, no allegro crashes, sound works through HDMI/SPDIF. Please help, I'm stumped... Thank you, Matt Dralle |
Peter Hull
Member #1,136
March 2001
|
Can you get a full back-trace from GDB?
|
Matt Dralle
Member #21,717
November 2021
|
Here's the full gdb output at the crash including a "where"... [New Thread 0x7faeffcd80 (LWP 61726)] (leopard:61698): GLib-GIO-CRITICAL **: 11:12:52.009: g_dbus_proxy_new: assertion 'G_IS_DBUS_CONNECTION (connection)' failed Thread 6 "leopard" received signal SIGSEGV, Segmentation fault. |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
If you look in the backtrace you can see that the pointer is null for the mixer you're attaching it to. Look at the mixer creation it is returning null. Perhaps you passed it bad parameters. al get default mixer will only return true if you've created a hardware voice. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Matt Dralle
Member #21,717
November 2021
|
Is the another call to init the mixer? I'm calling the following to setup Allegro up: al_init(); In my "al_attach_sample_instance_to_mixer(sampleInstance, al_get_default_mixer() );": Why does the call to "al_get_default_mixer()" return NULL on the USB audio? Card 1 vs Card0 Thanks, Matt |
Peter Hull
Member #1,136
March 2001
|
I would start with the simplest possible program #include <allegro5/allegro.h> #include <allegro5/allegro_audio.h> #include <stdio.h> int main() { al_init(); al_install_audio(); al_reserve_samples(1); printf("Default mixer: %p\n", al_get_default_mixer()); return 0; } and also create an allegro5.cfg in the same directory as the executable [trace] level=debug channels=all Can you confirm this reproduces the problem, default mixer is NULL for hw card 1 and not NULL for hw card 0? If you look at the file allegro.log in both cases does it print anything helpful?
|
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
Check the return value of al_reserve_samples(...) . Step into the function and see where the voices and mixers are created. Did you ever learn how to debug? Now is the time, my young padawan. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
|