Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Allegro 4.4.3 sound API on Ubuntu 18.04

This thread is locked; no one can reply to it. rss feed Print
Allegro 4.4.3 sound API on Ubuntu 18.04
Kevin Adrian
Member #7,087
April 2006
avatar

I have detected an issue with the sound API provided by Allegro 4.4.3.

When I try to play a sample (*.wav) with function play_sample there is no sound. The install_sound function called before did not return any errors but no driver name is available. Beside the DIGI_AUTODETECT I already tried platform specific driver IDs such as DIGI_ALSA, DIGI_JACK or DIGI_ESD but with the same result.

The same wave file can be played with other applications like Rythmbox or Audacity without any problems.

Is the sound API of Allegro 4.4.3 just too old for Ubuntu 18.04.2 ??? ? All the other functions for graphics, input, GUI etc. work well.

My mouth will speak words of wisdom; the utterance from my heart will give understanding. (Psalm 49:3)

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Kevin Adrian
Member #7,087
April 2006
avatar

I'll do that. Thanks for your advice.

Plan B would be trying to implement a customized playing routine and register with register_sample_file_type ;D

My mouth will speak words of wisdom; the utterance from my heart will give understanding. (Psalm 49:3)

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Kevin Adrian
Member #7,087
April 2006
avatar

I just feel less heroic when I can't go the hard way, hehe :)

I already used the register function successfully to let Allegro play MP3 and Ogg Vorbis file. It shouldn't be that hard to do the same for WAVE ;)

*Edit*
Allegro does not play any WAVE file. install_sound succeeds with return code 0 but the driver name is always empty.

After a debugging session in the Allegro source code I detected that there seems to be a digi driver available in 'system_driver->digi_drivers()'; its ID seems to be valid but the autodetect flag is -1. The driver object the pointer 'driver' in _DRIVER_INFO is pointing to is identified as 'digi_oss' by the Code::Blocks debugger.

Allegro seems not to be able to load the driver even when I set the Unix specific DIGI_OSS. :-[

*Edit 2*
I think this could be the problem: The DIGI_DRIVER structure referenced by the _DRIVER_INFO's pointer contains the following values:

driver=[1330860868, Open Sound System, voices=0 base=0 def. voices=8 max. voices=64]

The number of voices is zero...

My mouth will speak words of wisdom; the utterance from my heart will give understanding. (Psalm 49:3)

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Kevin, to investigate this further, you'll want to step into detect_digi_driver or install_sound and see what happens.

You can specify one of 5 audio drivers on *NIX using the following constants :
DIGI_OSS - Open Sound System
DIGI_ESD - Enlightened Sound Daemon
DIGI_ARTS - aRts (Analog Real-Time Synthesizer)
DIGI_ALSA - ALSA sound driver
DIGI_JACK - JACK sound driver

Try calling detect_digi_driver before install_sound on each of them.

I can try it on a Ubuntu 18.04 VM I have setup, but that's no guarantee it will or won't work with regular hardware.

EDIT

install_sound will give you back an error if a problem happens :
int install_sound(int digi, int midi, const char *cfg_path);

Initialises the sound module. You should normally pass DIGI_AUTODETECT and MIDI_AUTODETECT as the driver parameters to this function, in which case Allegro will read hardware settings from the current configuration file. This allows the user to select different values with the setup utility: see the config section for details. Alternatively, see the platform specific documentation for a list of the available drivers. The cfg_path parameter is only present for compatibility with previous versions of Allegro, and has no effect on anything.

Return value: Returns zero if the sound is successfully installed, and -1 on failure. If it fails it will store a description of the problem in allegro_error.

I can get a DIGI driver, OSS if I ask for it, and the play_sample function returns a valid voice id, but there is no sound.

EDIT2
I got a trumpet wav file to play, but failed with another french horn sample wav.

Kevin Adrian
Member #7,087
April 2006
avatar

Thank you for the effort :)

I already tried all available DIGI_* drivers but always with the same result. No driver name is available, no sound is played, but a driver info structure is loaded inside the Allegro sound API for the OSS which cannot be loaded.

Using the debugger in Code::Blocks I have analysed both detect_digi_driver and install_sound. I detected an interesting issue in function

static int open_oss_device(int input)

in src/unix/uoss.c: Here certain paths are expected:

ustrzcpy(_oss_driver, sizeof(_oss_driver), get_config_string(uconvert_ascii("sound", tmp1),
                                  uconvert_ascii("oss_driver", tmp2),
                                  uconvert_ascii("/dev/dsp", tmp3)));

   ustrzcpy(_oss_mixer_driver, sizeof(_oss_mixer_driver), get_config_string(uconvert_ascii("sound", tmp1),
                                              uconvert_ascii("oss_mixer_driver", tmp2),
                                              uconvert_ascii("/dev/mixer", tmp3)));

Both paths don't exist on my system so I suppose I should check my sound module installation on my OS.

My mouth will speak words of wisdom; the utterance from my heart will give understanding. (Psalm 49:3)

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

I'm curious, what does detect_digi_driver return for the number of voices for DIGI_OSS?

I don't have /dev/dsp OR /dev/mixer on my VM, but OSS works....

After installing oss4-base and oss4-dkms I have /dev/oss and /dev/mixer, but no /dev/dsp

Kevin Adrian
Member #7,087
April 2006
avatar

Calling detect_digi_driver gives 65.536 for all drivers I have specified in the paramteter. This is also quite strange...

Nevertheless, reinstallation of oss4-base and oss4dkms (or another ones like alsa) on my system sounds like an idea worth trying to me. ;D

My mouth will speak words of wisdom; the utterance from my heart will give understanding. (Psalm 49:3)

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Kevin Adrian
Member #7,087
April 2006
avatar

Now my sound system is completely broken ???

It seems that my hardware doesn't like OSS...

My mouth will speak words of wisdom; the utterance from my heart will give understanding. (Psalm 49:3)

Niunio
Member #1,975
March 2002
avatar

I use Xubuntu 20.04 LTS and sound is broken as well. There's sound but as it were corrupted.

Allegro 5 works as expected.

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

Kevin Adrian
Member #7,087
April 2006
avatar

Allegro 5 would be a solution for future projects. A migration of my current project would be too much effort.

My mouth will speak words of wisdom; the utterance from my heart will give understanding. (Psalm 49:3)

Go to: