[PlanetCCRMA] warning: new alsa drivers... new API (and how to use the old one)

Fernando Pablo Lopez-Lezcano nando@ccrma.Stanford.EDU
Thu Dec 11 11:42:01 2003


I forgot to remind potential ALSA users that the new (1.0.0rc2) packages
for the ALSA library use the new API. There were some changes Jaroslav
and Takashi did for better and more consistent error handling. Old
programs that do not take this into account will fail to compile cleanly
or at all, or if you ignore all warnings and errors may crash when
running (because the arguments for some of the calls will be wrong). 

All Planet CCRMA packages take that into account (except for the RedHat
versions of the CM/CLM/CMN world - fix is in the works). 

Old binaries are backwards compatible (ie: they will run fine with the
new libraries). 

But if you are rebuilding from source a package that uses ALSA, and if
it is an old version that does not autodetect the new API you will need
to add a couple of defines before including asoundlib.h:

#define ALSA_PCM_OLD_HW_PARAMS_API
#define ALSA_PCM_OLD_SW_PARAMS_API
#include <alsa/asoundlib.h>

This will ensure that the ALSA library will use the old API, your
program will build fine and everyone will be happy. 

I'm wondering if it would have been better to force globally the old API
but the choice was pain now or pain later. Should as well bite the
bullet and do it now. Sorry for any inconvenience this may have caused. 

-- Fernando