mirror of
https://github.com/linux-speakup/espeakup.git
synced 2026-08-18 05:49:11 +02:00
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:
parent
dec561324d
commit
edb5e50fcd
1 changed files with 6 additions and 3 deletions
9
alsa.c
9
alsa.c
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue