Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » [A4.4.2] No sound at all (continue)

This thread is locked; no one can reply to it. rss feed Print
[A4.4.2] No sound at all (continue)
Niunio
Member #1,975
March 2002
avatar

So, continues from this thread.

[edit]
I have access to an older Ubuntu (8.04 LTS) so I tried it and it has sound using Allegro 4.4.2, so may be it's a problem about Ubuntu and/or sound drivers.

In this forum they say it's a problem with Pulseaudio, but I've tried some of these solutions but it doesn't fix it and or they're not compatible (I'm using Ubuntu 11.10 and they're talking about 8.10).

I've found also this thread where Thomas Fjellstrom says:

Quote:

Because pulseaudio developers thought it was a good idea to take over the default ALSA devices. It completely breaks many valid ALSA programs.

[/edit]

Edgar Reynaldo suggested to do a diff between 4.4.1.1 and 4.4.2, since 4.4.1.1 does work. I did it and I've found some interesting changes mostly in CMakeList.txt:

$ diff allegro-4.4.1.1/CMakeLists.txt allegro-4.4.2/CMakeLists.txt 

  (...)
381a403
> set(PLATFORM_LIBS_MODULES)      # only link with these if modules enabled
384a407,411
> option(WANT_OSS "Build OSS support" on)
> option(WANT_ALSA "Build ALSA support" on)
> option(WANT_JACK "Build JACK support" on)
> option(WANT_SGIAUDIO "Build SGI audio support" on)
> 
394,419c421,462
<     include(AllegroFindOSS)
<     if(OSS_FOUND)
<         set(ALLEGRO_WITH_OSSDIGI 1)
<         set(ALLEGRO_WITH_OSSMIDI 1)
<         include_directories(SYSTEM ${OSS_INCLUDE_DIR})
<     endif(OSS_FOUND)
< 
<     pkg_check_modules(ALSA alsa)
<     if(ALSA_FOUND)
<         # ALSA 0.5 is beyond obsolete.
<         set(ALLEGRO_ALSA_VERSION 9)
<         set(ALLEGRO_WITH_ALSADIGI 1)
<         set(ALLEGRO_WITH_ALSAMIDI 1)
<         include_directories(SYSTEM ${ALSA_INCLUDE_DIRS})
<         list(APPEND PLATFORM_LIBS_NON_MODULES ${ALSA_LIBRARIES})
<         add_our_module(alleg-alsadigi src/unix/alsa9.c ${ALSA_LIBRARIES})
<         add_our_module(alleg-alsamidi src/unix/alsamidi.c ${ALSA_LIBRARIES})
<     endif(ALSA_FOUND)
< 
<     pkg_check_modules(JACK jack)
<     if(JACK_FOUND)
<         set(ALLEGRO_WITH_JACKDIGI 1)
<         include_directories(SYSTEM ${JACK_INCLUDE_DIRS})
<         list(APPEND PLATFORM_LIBS_NON_MODULES ${JACK_LIBRARIES})
<         add_our_module(alleg-jack src/unix/jack.c ${JACK_LIBRARIES})
<     endif(JACK_FOUND)
---
>     find_library(DLOPEN_LIBRARY dl)
>     mark_as_advanced(DLOPEN_LIBRARY)
>     if(DLOPEN_LIBRARY)
>         list(APPEND PLATFORM_LIBS_MODULES ${DLOPEN_LIBRARY})
>     endif()
> 
>     if(ALLEGRO_HAVE_POSIX_MONOTONIC_CLOCK)
>         list(APPEND PLATFORM_LIBS ${RT_LIBRARY})
>     endif(ALLEGRO_HAVE_POSIX_MONOTONIC_CLOCK)
> 
>     if(WANT_OSS)
>         include(AllegroFindOSS)
>         if(OSS_FOUND)
>             set(ALLEGRO_WITH_OSSDIGI 1)
>             set(ALLEGRO_WITH_OSSMIDI 1)
>             include_directories(SYSTEM ${OSS_INCLUDE_DIR})
>         endif(OSS_FOUND)
>     endif(WANT_OSS)
> 
>     if(WANT_ALSA)
>         pkg_check_modules(ALSA alsa)
>         if(ALSA_FOUND)
>             # ALSA 0.5 is beyond obsolete.
>             set(ALLEGRO_ALSA_VERSION 9)
>             set(ALLEGRO_WITH_ALSADIGI 1)
>             set(ALLEGRO_WITH_ALSAMIDI 1)
>             include_directories(SYSTEM ${ALSA_INCLUDE_DIRS})
>             list(APPEND PLATFORM_LIBS_NON_MODULES ${ALSA_LIBRARIES})
>             add_our_module(alleg-alsadigi src/unix/alsa9.c ${ALSA_LIBRARIES})
>             add_our_module(alleg-alsamidi src/unix/alsamidi.c ${ALSA_LIBRARIES})
>         endif(ALSA_FOUND)
>     endif(WANT_ALSA)
> 
>     if(WANT_JACK)
>         pkg_check_modules(JACK jack)
>         if(JACK_FOUND)
>             set(ALLEGRO_WITH_JACKDIGI 1)
>             include_directories(SYSTEM ${JACK_INCLUDE_DIRS})
>             list(APPEND PLATFORM_LIBS_NON_MODULES ${JACK_LIBRARIES})
>             add_our_module(alleg-jack src/unix/jack.c ${JACK_LIBRARIES})
>         endif(JACK_FOUND)
>     endif(WANT_JACK)
422,427c465,472
<     check_library_exists(audio alOpenPort "" SGIAUDIO_FOUND)
<     if(SGIAUDIO_FOUND)
<         set(ALLEGRO_WITH_SGIALDIGI 1)
<         list(APPEND PLATFORM_LIBS_NON_MODULES audio)
<         add_our_module(alleg-sgialdigi src/unix/sgial.c audio)
<     endif(SGIAUDIO_FOUND)
---
>     if(WANT_SGIAUDIO)
>         check_library_exists(audio alOpenPort "" SGIAUDIO_FOUND)
>         if(SGIAUDIO_FOUND)
>             set(ALLEGRO_WITH_SGIALDIGI 1)
>             list(APPEND PLATFORM_LIBS_NON_MODULES audio)
>             add_our_module(alleg-sgialdigi src/unix/sgial.c audio)
>         endif(SGIAUDIO_FOUND)
>     endif(WANT_SGIAUDIO)


  (...)

There are more differences but I've put here only sound related.

About other code, I've found only ALSA-MIDI related changes:

$ diff allegro-4.4.1.1/src/unix/alsamidi.c allegro-4.4.2/src/unix/alsamidi.c 
147c147
<    int ret = -1, err;
---
>    int ret, err;
184,185c184,186
< 
<       ret = 0;
---
>       else {
>          ret = 0;
>       }

There are more changes but I'm not sure if they affect to sound.

-----------------
Current projects: Allegro.pas | MinGRo

Necrolin
Member #14,143
March 2012

I'm using Allegro 4.4.2 in Ubuntu 11.10 and sound works just fine. Here's the thing. The first time I compiled Allegro I had the same problem (no Sound). The problem was I was missing the "optional" library related to sound. Go through the optional libraries they list on the page about compiling allegro, install everything, and try again.

Niunio
Member #1,975
March 2002
avatar

What "optional" library is it? ???

-----------------
Current projects: Allegro.pas | MinGRo

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

alemart
Member #10,658
February 2009

Niunio,

I think we're just out of luck. Wherever PulseAudio is available, Allegro 4 games may simply not play any sounds at all. One can try using wrappers such as aoss or padsp, but these may not work either. It's far too complicated for the end users.

I simply gave up on this issue and rewrote my audio routines using OpenAL and ALURE instead. If anyone is still struggling with this, please feel free to take a look at my code (attached). No need to use any wrappers anymore. It just works. :)

Go to: