SDL 1.2.6 and ALSA 1.0.x

Hi SDL users,

I’m trying to compile SDL 1.2.6 against ALSA 1.0.2/1.0.1 and it fails:

SDL_alsa_audio.c: In function ALSA_OpenAudio': SDL_alsa_audio.c:272: too few arguments to functionsnd_pcm_hw_params_get_channels’
SDL_alsa_audio.c:282: warning: passing arg 3 of
snd_pcm_hw_params_set_rate_near' makes pointer from integer without a cast SDL_alsa_audio.c:292: warning: passing arg 3 ofsnd_pcm_hw_params_set_period_size_near’ makes pointer from integer without
a cast
SDL_alsa_audio.c:294: warning: passing arg 3 of
`snd_pcm_hw_params_set_periods_near’ makes pointer from integer without a cast
make[3]: *** [SDL_alsa_audio.lo] Error 1

IIRC, there have been some API changes around snd_pcm_hw_params, maybe since
1.0.x, I can’t really remember when. Obviously the compilation error is a API issue, so
my question is: is SDL’s CVS sync’ed w/ recent ALSA API or is there another way to
compile 1.2.6 against ALSA 1.0.x?

TIA,–
wwp

wwp wrote:

Hi SDL users,

I’m trying to compile SDL 1.2.6 against ALSA 1.0.2/1.0.1 and it fails:

SDL_alsa_audio.c: In function ALSA_OpenAudio': SDL_alsa_audio.c:272: too few arguments to functionsnd_pcm_hw_params_get_channels’
SDL_alsa_audio.c:282: warning: passing arg 3 of
snd_pcm_hw_params_set_rate_near' makes pointer from integer without a cast SDL_alsa_audio.c:292: warning: passing arg 3 ofsnd_pcm_hw_params_set_period_size_near’ makes pointer from integer without
a cast
SDL_alsa_audio.c:294: warning: passing arg 3 of
`snd_pcm_hw_params_set_periods_near’ makes pointer from integer without a cast
make[3]: *** [SDL_alsa_audio.lo] Error 1

IIRC, there have been some API changes around snd_pcm_hw_params, maybe since
1.0.x, I can’t really remember when. Obviously the compilation error is a API issue, so
my question is: is SDL’s CVS sync’ed w/ recent ALSA API or is there another way to
compile 1.2.6 against ALSA 1.0.x?

Yup, SDL cvs fixes this issue.

Stephane

ALSA 1.0 changed to the “new” PCM API by default. SDL never changed over.

The quick and dirty fix is

#define ALSA_PCM_OLD_HW_PARAMS_API
#define ALSA_PCM_OLD_SW_PARAMS_API
before
#include <alsa/asoundlib.h>On Thu, Jan 29, 2004 at 10:25:47PM +0100, wwp wrote:

SDL_alsa_audio.c: In function ALSA_OpenAudio': SDL_alsa_audio.c:272: too few arguments to functionsnd_pcm_hw_params_get_channels’


Glenn Maynard

Hello Glenn Maynard,On Thu, 29 Jan 2004 16:53:08 -0500 Glenn Maynard <g_sdl at zewt.org> wrote:

On Thu, Jan 29, 2004 at 10:25:47PM +0100, wwp wrote:

SDL_alsa_audio.c: In function ALSA_OpenAudio': SDL_alsa_audio.c:272: too few arguments to functionsnd_pcm_hw_params_get_channels’

ALSA 1.0 changed to the “new” PCM API by default. SDL never changed over.

The quick and dirty fix is

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

Thanx for the workaround!

Regards,


wwp

Hello Stephane Marchesin,On Thu, 29 Jan 2004 23:03:03 +0100 Stephane Marchesin <stephane.marchesin at wanadoo.fr> wrote:

wwp wrote:

Hi SDL users,

I’m trying to compile SDL 1.2.6 against ALSA 1.0.2/1.0.1 and it fails:

SDL_alsa_audio.c: In function ALSA_OpenAudio': SDL_alsa_audio.c:272: too few arguments to functionsnd_pcm_hw_params_get_channels’
SDL_alsa_audio.c:282: warning: passing arg 3 of
snd_pcm_hw_params_set_rate_near' makes pointer from integer without a cast SDL_alsa_audio.c:292: warning: passing arg 3 ofsnd_pcm_hw_params_set_period_size_near’ makes pointer from integer without
a cast
SDL_alsa_audio.c:294: warning: passing arg 3 of
`snd_pcm_hw_params_set_periods_near’ makes pointer from integer without a cast
make[3]: *** [SDL_alsa_audio.lo] Error 1

IIRC, there have been some API changes around snd_pcm_hw_params, maybe since
1.0.x, I can’t really remember when. Obviously the compilation error is a API issue, so
my question is: is SDL’s CVS sync’ed w/ recent ALSA API or is there another way to
compile 1.2.6 against ALSA 1.0.x?

Yup, SDL cvs fixes this issue.

And thanx for the info!

Regards,


wwp