Commit d8ff2e07 authored by claes's avatar claes

Alsa missmatch on Suse Linux

parent 47f66f36
...@@ -549,7 +549,12 @@ int XttAudio::Init_ALSA(char *device, unsigned int samplerate) ...@@ -549,7 +549,12 @@ int XttAudio::Init_ALSA(char *device, unsigned int samplerate)
snd_pcm_close(ALSA_handle); snd_pcm_close(ALSA_handle);
return -1; return -1;
} }
#if defined __GNUC__ && __GNUC__ < 4
// Alsa 0.9...
if ((err = snd_pcm_hw_params_set_rate_near (ALSA_handle, hw_params, samplerate, 0)) < 0)
#else
if ((err = snd_pcm_hw_params_set_rate_near (ALSA_handle, hw_params, &samplerate, 0)) < 0) if ((err = snd_pcm_hw_params_set_rate_near (ALSA_handle, hw_params, &samplerate, 0)) < 0)
#endif
{ {
fprintf (stderr, "cannot set sample rate (%s)\n",snd_strerror (err)); fprintf (stderr, "cannot set sample rate (%s)\n",snd_strerror (err));
snd_pcm_close(ALSA_handle); snd_pcm_close(ALSA_handle);
...@@ -561,8 +566,12 @@ int XttAudio::Init_ALSA(char *device, unsigned int samplerate) ...@@ -561,8 +566,12 @@ int XttAudio::Init_ALSA(char *device, unsigned int samplerate)
snd_pcm_close(ALSA_handle); snd_pcm_close(ALSA_handle);
return -1; return -1;
} }
if((err = snd_pcm_hw_params_set_period_size_near(ALSA_handle, hw_params, &period_size, #if defined __GNUC__ && __GNUC__ < 4
0)) <0) // Alsa 0.9...
if((err = snd_pcm_hw_params_set_period_size_near(ALSA_handle, hw_params, period_size, 0)) <0)
#else
if((err = snd_pcm_hw_params_set_period_size_near(ALSA_handle, hw_params, &period_size, 0)) <0)
#endif
{ {
fprintf(stderr, "could not set period size (%s)\n",snd_strerror (err)); fprintf(stderr, "could not set period size (%s)\n",snd_strerror (err));
snd_pcm_close(ALSA_handle); snd_pcm_close(ALSA_handle);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment