aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Djärv2006-05-29 07:25:01 +0000
committerJan Djärv2006-05-29 07:25:01 +0000
commit3fc7a865c4399c2ae64b10d5c0a35d6fe08d7de5 (patch)
tree4af25041444529bbf2373566511f48864c6b2334 /src
parente380957ec2e24b8e6ad1a10aa40a95aa96b20ff2 (diff)
downloademacs-3fc7a865c4399c2ae64b10d5c0a35d6fe08d7de5.tar.gz
emacs-3fc7a865c4399c2ae64b10d5c0a35d6fe08d7de5.zip
* sound.c (alsa_open, alsa_configure, alsa_write): Move
assignment to err out of if-statement.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog3
-rw-r--r--src/sound.c41
2 files changed, 28 insertions, 16 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 56f68edd091..49d3355f201 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,8 @@
12006-05-29 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> 12006-05-29 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
2 2
3 * sound.c (alsa_open, alsa_configure, alsa_write): Move
4 assignment to err out of if-statement.
5
3 * gtkutil.c (menu_nav_ended): New function. 6 * gtkutil.c (menu_nav_ended): New function.
4 (create_menus): Connect menu_nav_ended to "selection-done" to fix 7 (create_menus): Connect menu_nav_ended to "selection-done" to fix
5 grabs. 8 grabs.
diff --git a/src/sound.c b/src/sound.c
index 6317b6c6279..c512ca45864 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -971,7 +971,8 @@ alsa_open (sd)
971 sd->data = p; 971 sd->data = p;
972 972
973 973
974 if ((err = snd_pcm_open (&p->handle, file, SND_PCM_STREAM_PLAYBACK, 0)) < 0) 974 err = snd_pcm_open (&p->handle, file, SND_PCM_STREAM_PLAYBACK, 0);
975 if (err < 0)
975 alsa_sound_perror (file, err); 976 alsa_sound_perror (file, err);
976} 977}
977 978
@@ -993,33 +994,40 @@ alsa_configure (sd)
993 994
994 xassert (p->handle != 0); 995 xassert (p->handle != 0);
995 996
996 if ((err = snd_pcm_hw_params_malloc (&p->hwparams)) < 0) 997 err = snd_pcm_hw_params_malloc (&p->hwparams);
998 if (err < 0)
997 alsa_sound_perror ("Could not allocate hardware parameter structure", err); 999 alsa_sound_perror ("Could not allocate hardware parameter structure", err);
998 1000
999 if ((err = snd_pcm_sw_params_malloc (&p->swparams)) < 0) 1001 err = snd_pcm_sw_params_malloc (&p->swparams);
1002 if (err < 0)
1000 alsa_sound_perror ("Could not allocate software parameter structure", err); 1003 alsa_sound_perror ("Could not allocate software parameter structure", err);
1001 1004
1002 if ((err = snd_pcm_hw_params_any (p->handle, p->hwparams)) < 0) 1005 err = snd_pcm_hw_params_any (p->handle, p->hwparams);
1006 if (err < 0)
1003 alsa_sound_perror ("Could not initialize hardware parameter structure", err); 1007 alsa_sound_perror ("Could not initialize hardware parameter structure", err);
1004 1008
1005 if ((err = snd_pcm_hw_params_set_access (p->handle, p->hwparams, 1009 err = snd_pcm_hw_params_set_access (p->handle, p->hwparams,
1006 SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) 1010 SND_PCM_ACCESS_RW_INTERLEAVED);
1011 if (err < 0)
1007 alsa_sound_perror ("Could not set access type", err); 1012 alsa_sound_perror ("Could not set access type", err);
1008 1013
1009 val = sd->format; 1014 val = sd->format;
1010 if ((err = snd_pcm_hw_params_set_format (p->handle, p->hwparams, val)) < 0) 1015 err = snd_pcm_hw_params_set_format (p->handle, p->hwparams, val);
1016 if (err < 0)
1011 alsa_sound_perror ("Could not set sound format", err); 1017 alsa_sound_perror ("Could not set sound format", err);
1012 1018
1013 val = sd->sample_rate; 1019 val = sd->sample_rate;
1014 if ((err = snd_pcm_hw_params_set_rate_near (p->handle, p->hwparams, &val, 0)) 1020 err = snd_pcm_hw_params_set_rate_near (p->handle, p->hwparams, &val, 0);
1015 < 0) 1021 if (err < 0)
1016 alsa_sound_perror ("Could not set sample rate", err); 1022 alsa_sound_perror ("Could not set sample rate", err);
1017 1023
1018 val = sd->channels; 1024 val = sd->channels;
1019 if ((err = snd_pcm_hw_params_set_channels (p->handle, p->hwparams, val)) < 0) 1025 err = snd_pcm_hw_params_set_channels (p->handle, p->hwparams, val);
1026 if (err < 0)
1020 alsa_sound_perror ("Could not set channel count", err); 1027 alsa_sound_perror ("Could not set channel count", err);
1021 1028
1022 if ((err = snd_pcm_hw_params (p->handle, p->hwparams)) < 0) 1029 err = snd_pcm_hw_params (p->handle, p->hwparams);
1030 if (err < 0)
1023 alsa_sound_perror ("Could not set parameters", err); 1031 alsa_sound_perror ("Could not set parameters", err);
1024 1032
1025 1033
@@ -1063,7 +1071,8 @@ alsa_configure (sd)
1063 snd_pcm_sw_params_free (p->swparams); 1071 snd_pcm_sw_params_free (p->swparams);
1064 p->swparams = NULL; 1072 p->swparams = NULL;
1065 1073
1066 if ((err = snd_pcm_prepare (p->handle)) < 0) 1074 err = snd_pcm_prepare (p->handle);
1075 if (err < 0)
1067 alsa_sound_perror ("Could not prepare audio interface for use", err); 1076 alsa_sound_perror ("Could not prepare audio interface for use", err);
1068 1077
1069 if (sd->volume > 0) 1078 if (sd->volume > 0)
@@ -1194,11 +1203,11 @@ alsa_write (sd, buffer, nbytes)
1194 1203
1195 while (nwritten < nbytes) 1204 while (nwritten < nbytes)
1196 { 1205 {
1197 if ((err = snd_pcm_writei (p->handle, 1206 err = snd_pcm_writei (p->handle,
1198 buffer + nwritten, 1207 buffer + nwritten,
1199 (nbytes - nwritten)/fact)) < 0) 1208 (nbytes - nwritten)/fact);
1209 if (err < 0)
1200 { 1210 {
1201 fprintf(stderr, "Err %d/%s\n", err, snd_strerror(err));
1202 if (err == -EPIPE) 1211 if (err == -EPIPE)
1203 { /* under-run */ 1212 { /* under-run */
1204 err = snd_pcm_prepare (p->handle); 1213 err = snd_pcm_prepare (p->handle);