aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann2001-10-27 08:49:39 +0000
committerGerd Moellmann2001-10-27 08:49:39 +0000
commit62725a9205c155f6fbbaf6f3758e4a2b50072ccc (patch)
treeab30b46a859776ae47c17daa7951a8efb013e663 /src
parentb9c6ab68476385d018e5b9eaf5278dce91840af1 (diff)
downloademacs-62725a9205c155f6fbbaf6f3758e4a2b50072ccc.tar.gz
emacs-62725a9205c155f6fbbaf6f3758e4a2b50072ccc.zip
(sound_perror): Unblock SIGIO, turn on atimers.
Display errno only if non-zero. (sound_warning): New function. (vox_configure): Don't treat failing to set sample rate as error. (various places): Improve error messages.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog8
-rw-r--r--src/sound.c41
2 files changed, 38 insertions, 11 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index dbc5ccf4041..23ceb1509ca 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
12001-10-27 Gerd Moellmann <gerd@gnu.org>
2
3 * sound.c (sound_perror): Unblock SIGIO, turn on atimers.
4 Display errno only if non-zero.
5 (sound_warning): New function.
6 (vox_configure): Don't treat failing to set sample rate as error.
7 (various places): Improve error messages.
8
12001-10-26 Eli Zaretskii <eliz@is.elta.co.il> 92001-10-26 Eli Zaretskii <eliz@is.elta.co.il>
2 10
3 * fileio.c (Faccess_file): Run the argument filename through 11 * fileio.c (Faccess_file): Run the argument filename through
diff --git a/src/sound.c b/src/sound.c
index a5b9e77bc17..b3c075ba831 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -235,6 +235,7 @@ static void vox_choose_format P_ ((struct sound_device *, struct sound *));
235static void vox_init P_ ((struct sound_device *)); 235static void vox_init P_ ((struct sound_device *));
236static void vox_write P_ ((struct sound_device *, char *, int)); 236static void vox_write P_ ((struct sound_device *, char *, int));
237static void sound_perror P_ ((char *)); 237static void sound_perror P_ ((char *));
238static void sound_warning P_ ((char *));
238static int parse_sound P_ ((Lisp_Object, Lisp_Object *)); 239static int parse_sound P_ ((Lisp_Object, Lisp_Object *));
239static void find_sound_type P_ ((struct sound *)); 240static void find_sound_type P_ ((struct sound *));
240static u_int32_t le2hl P_ ((u_int32_t)); 241static u_int32_t le2hl P_ ((u_int32_t));
@@ -261,7 +262,24 @@ static void
261sound_perror (msg) 262sound_perror (msg)
262 char *msg; 263 char *msg;
263{ 264{
264 error ("%s: %s", msg, strerror (errno)); 265 turn_on_atimers (1);
266#ifdef SIGIO
267 sigunblock (sigmask (SIGIO));
268#endif
269 if (errno != 0)
270 error ("%s: %s", msg, strerror (errno));
271 else
272 error ("%s", msg);
273}
274
275
276/* Display a warning message. */
277
278static void
279sound_warning (msg)
280 char *msg;
281{
282 message (msg);
265} 283}
266 284
267 285
@@ -417,12 +435,12 @@ a system-dependent default device name is used. */)
417 s.fd = openp (Fcons (Vdata_directory, Qnil), 435 s.fd = openp (Fcons (Vdata_directory, Qnil),
418 attrs[SOUND_FILE], Qnil, &file, 0); 436 attrs[SOUND_FILE], Qnil, &file, 0);
419 if (s.fd < 0) 437 if (s.fd < 0)
420 sound_perror ("Open sound file"); 438 sound_perror ("Could not open sound file");
421 439
422 /* Read the first bytes from the file. */ 440 /* Read the first bytes from the file. */
423 s.header_size = emacs_read (s.fd, s.header, MAX_SOUND_HEADER_BYTES); 441 s.header_size = emacs_read (s.fd, s.header, MAX_SOUND_HEADER_BYTES);
424 if (s.header_size < 0) 442 if (s.header_size < 0)
425 sound_perror ("Reading sound file header"); 443 sound_perror ("Invalid sound file header");
426 } 444 }
427 else 445 else
428 { 446 {
@@ -633,7 +651,7 @@ wav_play (s, sd)
633 sd->write (sd, buffer, nbytes); 651 sd->write (sd, buffer, nbytes);
634 652
635 if (nbytes < 0) 653 if (nbytes < 0)
636 sound_perror ("Reading sound file"); 654 sound_perror ("Error reading sound file");
637 } 655 }
638} 656}
639 657
@@ -723,7 +741,7 @@ au_play (s, sd)
723 sd->write (sd, buffer, nbytes); 741 sd->write (sd, buffer, nbytes);
724 742
725 if (nbytes < 0) 743 if (nbytes < 0)
726 sound_perror ("Reading sound file"); 744 sound_perror ("Error reading sound file");
727 } 745 }
728} 746}
729 747
@@ -779,21 +797,22 @@ vox_configure (sd)
779 val = sd->format; 797 val = sd->format;
780 if (ioctl (sd->fd, SNDCTL_DSP_SETFMT, &sd->format) < 0 798 if (ioctl (sd->fd, SNDCTL_DSP_SETFMT, &sd->format) < 0
781 || val != sd->format) 799 || val != sd->format)
782 sound_perror ("Set sound format"); 800 sound_perror ("Could not set sound format");
783 801
784 val = sd->channels != 1; 802 val = sd->channels != 1;
785 if (ioctl (sd->fd, SNDCTL_DSP_STEREO, &val) < 0 803 if (ioctl (sd->fd, SNDCTL_DSP_STEREO, &val) < 0
786 || val != (sd->channels != 1)) 804 || val != (sd->channels != 1))
787 sound_perror ("Set stereo/mono"); 805 sound_perror ("Could not set stereo/mono");
788 806
789 /* I think bps and sampling_rate are the same, but who knows. 807 /* I think bps and sampling_rate are the same, but who knows.
790 Check this. and use SND_DSP_SPEED for both. */ 808 Check this. and use SND_DSP_SPEED for both. */
791 if (sd->sample_rate > 0) 809 if (sd->sample_rate > 0)
792 { 810 {
793 val = sd->sample_rate; 811 val = sd->sample_rate;
794 if (ioctl (sd->fd, SNDCTL_DSP_SPEED, &sd->sample_rate) < 0 812 if (ioctl (sd->fd, SNDCTL_DSP_SPEED, &sd->sample_rate) < 0)
795 || val != sd->sample_rate) 813 sound_perror ("Could not set sound speed");
796 sound_perror ("Set sound speed"); 814 else if (val != sd->sample_rate)
815 sound_warning ("Could not set sample rate");
797 } 816 }
798 817
799 if (sd->volume > 0) 818 if (sd->volume > 0)
@@ -912,7 +931,7 @@ vox_write (sd, buffer, nbytes)
912{ 931{
913 int nwritten = emacs_write (sd->fd, buffer, nbytes); 932 int nwritten = emacs_write (sd->fd, buffer, nbytes);
914 if (nwritten < 0) 933 if (nwritten < 0)
915 sound_perror ("Writing to sound device"); 934 sound_perror ("Error writing to sound device");
916} 935}
917 936
918 937