make alsa code more readable

This changes the code to use constants for the parameters to
snd_pcm_set_params.  This makes it easier to read the code and to update
the values if needed.
This commit is contained in:
William Hubbs 2009-10-09 08:56:58 -05:00
commit edb5e50fcd

9
alsa.c
View file

@ -32,6 +32,9 @@
static pthread_mutex_t audio_mutex = PTHREAD_MUTEX_INITIALIZER;
static snd_pcm_t *handle;
static const unsigned int channels = 1;
static const int soft_resample = 1;
static const unsigned int latency = 125000;
static void lock_audio_mutex(void)
{
@ -92,10 +95,10 @@ int init_audio(unsigned int rate)
err = snd_pcm_set_params(handle,
SND_PCM_FORMAT_S16_LE,
SND_PCM_ACCESS_RW_INTERLEAVED,
1,
channels,
rate,
1,
0);
soft_resample,
latency);
if (err < 0) {
fprintf(stderr, "Playback open error: %s\n", snd_strerror(err));
return err;