/[emacs]/emacs/src/sound.c
ViewVC logotype

Diff of /emacs/src/sound.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.15 by gerd, Mon Jul 9 17:15:27 2001 UTC revision 1.15.4.1 by gerd, Sat Oct 27 08:50:24 2001 UTC
# Line 234  static void vox_choose_format P_ ((struc Line 234  static void vox_choose_format P_ ((struc
234  static void vox_init P_ ((struct sound_device *));  static void vox_init P_ ((struct sound_device *));
235  static void vox_write P_ ((struct sound_device *, char *, int));  static void vox_write P_ ((struct sound_device *, char *, int));
236  static void sound_perror P_ ((char *));  static void sound_perror P_ ((char *));
237    static void sound_warning P_ ((char *));
238  static int parse_sound P_ ((Lisp_Object, Lisp_Object *));  static int parse_sound P_ ((Lisp_Object, Lisp_Object *));
239  static void find_sound_type P_ ((struct sound *));  static void find_sound_type P_ ((struct sound *));
240  static u_int32_t le2hl P_ ((u_int32_t));  static u_int32_t le2hl P_ ((u_int32_t));
# Line 260  static void Line 261  static void
261  sound_perror (msg)  sound_perror (msg)
262       char *msg;       char *msg;
263  {  {
264    error ("%s: %s", msg, strerror (errno));    turn_on_atimers (1);
265    #ifdef SIGIO
266      sigunblock (sigmask (SIGIO));
267    #endif
268      if (errno != 0)
269        error ("%s: %s", msg, strerror (errno));
270      else
271        error ("%s", msg);
272    }
273    
274    
275    /* Display a warning message.  */
276    
277    static void
278    sound_warning (msg)
279         char *msg;
280    {
281      message (msg);
282  }  }
283    
284    
# Line 416  a system-dependent default device name i Line 434  a system-dependent default device name i
434        s.fd = openp (Fcons (Vdata_directory, Qnil),        s.fd = openp (Fcons (Vdata_directory, Qnil),
435                      attrs[SOUND_FILE], "", &file, 0);                      attrs[SOUND_FILE], "", &file, 0);
436        if (s.fd < 0)        if (s.fd < 0)
437          sound_perror ("Open sound file");          sound_perror ("Could not open sound file");
438    
439        /* Read the first bytes from the file.  */        /* Read the first bytes from the file.  */
440        s.header_size = emacs_read (s.fd, s.header, MAX_SOUND_HEADER_BYTES);        s.header_size = emacs_read (s.fd, s.header, MAX_SOUND_HEADER_BYTES);
441        if (s.header_size < 0)        if (s.header_size < 0)
442          sound_perror ("Reading sound file header");          sound_perror ("Invalid sound file header");
443      }      }
444    else    else
445      {      {
# Line 632  wav_play (s, sd) Line 650  wav_play (s, sd)
650          sd->write (sd, buffer, nbytes);          sd->write (sd, buffer, nbytes);
651    
652        if (nbytes < 0)        if (nbytes < 0)
653          sound_perror ("Reading sound file");          sound_perror ("Error reading sound file");
654      }      }
655  }  }
656    
# Line 722  au_play (s, sd) Line 740  au_play (s, sd)
740          sd->write (sd, buffer, nbytes);          sd->write (sd, buffer, nbytes);
741                
742        if (nbytes < 0)        if (nbytes < 0)
743          sound_perror ("Reading sound file");          sound_perror ("Error reading sound file");
744      }      }
745  }  }
746    
# Line 778  vox_configure (sd) Line 796  vox_configure (sd)
796    val = sd->format;    val = sd->format;
797    if (ioctl (sd->fd, SNDCTL_DSP_SETFMT, &sd->format) < 0    if (ioctl (sd->fd, SNDCTL_DSP_SETFMT, &sd->format) < 0
798        || val != sd->format)        || val != sd->format)
799      sound_perror ("Set sound format");      sound_perror ("Could not set sound format");
800    
801    val = sd->channels != 1;    val = sd->channels != 1;
802    if (ioctl (sd->fd, SNDCTL_DSP_STEREO, &val) < 0    if (ioctl (sd->fd, SNDCTL_DSP_STEREO, &val) < 0
803        || val != (sd->channels != 1))        || val != (sd->channels != 1))
804      sound_perror ("Set stereo/mono");      sound_perror ("Could not set stereo/mono");
805    
806    /* I think bps and sampling_rate are the same, but who knows.    /* I think bps and sampling_rate are the same, but who knows.
807       Check this. and use SND_DSP_SPEED for both.  */       Check this. and use SND_DSP_SPEED for both.  */
808    if (sd->sample_rate > 0)    if (sd->sample_rate > 0)
809      {      {
810        val = sd->sample_rate;        val = sd->sample_rate;
811        if (ioctl (sd->fd, SNDCTL_DSP_SPEED, &sd->sample_rate) < 0        if (ioctl (sd->fd, SNDCTL_DSP_SPEED, &sd->sample_rate) < 0)
812            || val != sd->sample_rate)          sound_perror ("Could not set sound speed");
813          sound_perror ("Set sound speed");        else if (val != sd->sample_rate)
814            sound_warning ("Could not set sample rate");
815      }      }
816    
817    if (sd->volume > 0)    if (sd->volume > 0)
# Line 911  vox_write (sd, buffer, nbytes) Line 930  vox_write (sd, buffer, nbytes)
930  {  {
931    int nwritten = emacs_write (sd->fd, buffer, nbytes);    int nwritten = emacs_write (sd->fd, buffer, nbytes);
932    if (nwritten < 0)    if (nwritten < 0)
933      sound_perror ("Writing to sound device");      sound_perror ("Error writing to sound device");
934  }  }
935    
936    

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.15.4.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26