comparison src/sound.c @ 70955:d42f132da9a8

* sound.c (alsa_configure): Move get period/buffer_size after setting hwparams.
author Jan Djärv <jan.h.d@swipnet.se>
date Fri, 26 May 2006 06:29:32 +0000
parents f8a3f870d0c4
children 47e6374861d1
comparison
equal deleted inserted replaced
70954:973afe644ddf 70955:d42f132da9a8
1017 1017
1018 val = sd->channels; 1018 val = sd->channels;
1019 if ((err = snd_pcm_hw_params_set_channels (p->handle, p->hwparams, val)) < 0) 1019 if ((err = snd_pcm_hw_params_set_channels (p->handle, p->hwparams, val)) < 0)
1020 alsa_sound_perror ("Could not set channel count", err); 1020 alsa_sound_perror ("Could not set channel count", err);
1021 1021
1022 if ((err = snd_pcm_hw_params (p->handle, p->hwparams)) < 0)
1023 alsa_sound_perror ("Could not set parameters", err);
1024
1022 1025
1023 err = snd_pcm_hw_params_get_period_size (p->hwparams, &p->period_size, &dir); 1026 err = snd_pcm_hw_params_get_period_size (p->hwparams, &p->period_size, &dir);
1024 if (err < 0) 1027 if (err < 0)
1025 alsa_sound_perror ("Unable to get period size for playback", err); 1028 alsa_sound_perror ("Unable to get period size for playback", err);
1026 1029
1027 err = snd_pcm_hw_params_get_buffer_size (p->hwparams, &buffer_size); 1030 err = snd_pcm_hw_params_get_buffer_size (p->hwparams, &buffer_size);
1028 if (err < 0) 1031 if (err < 0)
1029 alsa_sound_perror("Unable to get buffer size for playback", err); 1032 alsa_sound_perror("Unable to get buffer size for playback", err);
1030
1031 if ((err = snd_pcm_hw_params (p->handle, p->hwparams)) < 0)
1032 alsa_sound_perror ("Could not set parameters", err);
1033 1033
1034 err = snd_pcm_sw_params_current (p->handle, p->swparams); 1034 err = snd_pcm_sw_params_current (p->handle, p->swparams);
1035 if (err < 0) 1035 if (err < 0)
1036 alsa_sound_perror ("Unable to determine current swparams for playback", 1036 alsa_sound_perror ("Unable to determine current swparams for playback",
1037 err); 1037 err);