emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/sound.c


From: Pavel Janík
Subject: [Emacs-diffs] Changes to emacs/src/sound.c
Date: Mon, 14 Jan 2002 09:37:17 -0500

Index: emacs/src/sound.c
diff -c emacs/src/sound.c:1.22 emacs/src/sound.c:1.23
*** emacs/src/sound.c:1.22      Fri Jan  4 16:35:15 2002
--- emacs/src/sound.c   Mon Jan 14 09:37:17 2002
***************
*** 90,99 ****
  {
    /* ASCII ".snd" */
    u_int32_t magic_number;
!   
    /* Offset of data part from start of file. Minimum value is 24.  */
    u_int32_t data_offset;
!   
    /* Size of data part, 0xffffffff if unknown.  */
    u_int32_t data_size;
  
--- 90,99 ----
  {
    /* ASCII ".snd" */
    u_int32_t magic_number;
! 
    /* Offset of data part from start of file. Minimum value is 24.  */
    u_int32_t data_offset;
! 
    /* Size of data part, 0xffffffff if unknown.  */
    u_int32_t data_size;
  
***************
*** 148,154 ****
  
    /* 1 = mono, 2 = stereo, 0 = don't set.  */
    int channels;
!   
    /* Open device SD.  */
    void (* open) P_ ((struct sound_device *sd));
  
--- 148,154 ----
  
    /* 1 = mono, 2 = stereo, 0 = don't set.  */
    int channels;
! 
    /* Open device SD.  */
    void (* open) P_ ((struct sound_device *sd));
  
***************
*** 157,163 ****
  
    /* Configure SD accoring to device-dependent parameters.  */
    void (* configure) P_ ((struct sound_device *device));
!   
    /* Choose a device-dependent format for outputting sound S.  */
    void (* choose_format) P_ ((struct sound_device *sd,
                              struct sound *s));
--- 157,163 ----
  
    /* Configure SD accoring to device-dependent parameters.  */
    void (* configure) P_ ((struct sound_device *device));
! 
    /* Choose a device-dependent format for outputting sound S.  */
    void (* choose_format) P_ ((struct sound_device *sd,
                              struct sound *s));
***************
*** 199,205 ****
    Lisp_Object data;
  
    /* Play sound file S on device SD.  */
!   void (* play) P_ ((struct sound *s, struct sound_device *sd)); 
  };
  
  /* Indices of attributes in a sound attributes vector.  */
--- 199,205 ----
    Lisp_Object data;
  
    /* Play sound file S on device SD.  */
!   void (* play) P_ ((struct sound *s, struct sound_device *sd));
  };
  
  /* Indices of attributes in a sound attributes vector.  */
***************
*** 447,454 ****
    else
      {
        s.data = attrs[SOUND_DATA];
!       bcopy (XSTRING (s.data)->data, s.header,
!            min (MAX_SOUND_HEADER_BYTES, STRING_BYTES (XSTRING (s.data))));
      }
  
    /* Find out the type of sound.  Give up if we can't tell.  */
--- 447,454 ----
    else
      {
        s.data = attrs[SOUND_DATA];
!       s.header_size = min (MAX_SOUND_HEADER_BYTES, STRING_BYTES (XSTRING 
(s.data)));
!       bcopy (XSTRING (s.data)->data, s.header, s.header_size);
      }
  
    /* Find out the type of sound.  Give up if we can't tell.  */
***************
*** 461,467 ****
        sd.file = (char *) alloca (len + 1);
        strcpy (sd.file, XSTRING (attrs[SOUND_DEVICE])->data);
      }
!   
    if (INTEGERP (attrs[SOUND_VOLUME]))
      sd.volume = XFASTINT (attrs[SOUND_VOLUME]);
    else if (FLOATP (attrs[SOUND_VOLUME]))
--- 461,467 ----
        sd.file = (char *) alloca (len + 1);
        strcpy (sd.file, XSTRING (attrs[SOUND_DEVICE])->data);
      }
! 
    if (INTEGERP (attrs[SOUND_VOLUME]))
      sd.volume = XFASTINT (attrs[SOUND_VOLUME]);
    else if (FLOATP (attrs[SOUND_VOLUME]))
***************
*** 610,616 ****
    s->play = wav_play;
  
    return 1;
! }  
  
  
  /* Play RIFF-WAVE audio file S on sound device SD.  */
--- 610,616 ----
    s->play = wav_play;
  
    return 1;
! }
  
  
  /* Play RIFF-WAVE audio file S on sound device SD.  */
***************
*** 625,631 ****
    /* Let the device choose a suitable device-dependent format
       for the file.  */
    sd->choose_format (sd, s);
!   
    /* Configure the device.  */
    sd->sample_size = header->sample_size;
    sd->sample_rate = header->sample_rate;
--- 625,631 ----
    /* Let the device choose a suitable device-dependent format
       for the file.  */
    sd->choose_format (sd, s);
! 
    /* Configure the device.  */
    sd->sample_size = header->sample_size;
    sd->sample_rate = header->sample_rate;
***************
*** 645,654 ****
        char *buffer;
        int nbytes;
        int blksize = 2048;
!       
        buffer = (char *) alloca (blksize);
        lseek (s->fd, sizeof *header, SEEK_SET);
!   
        while ((nbytes = emacs_read (s->fd, buffer, blksize)) > 0)
        sd->write (sd, buffer, nbytes);
  
--- 645,654 ----
        char *buffer;
        int nbytes;
        int blksize = 2048;
! 
        buffer = (char *) alloca (blksize);
        lseek (s->fd, sizeof *header, SEEK_SET);
! 
        while ((nbytes = emacs_read (s->fd, buffer, blksize)) > 0)
        sd->write (sd, buffer, nbytes);
  
***************
*** 663,669 ****
                           Sun Audio (*.au)
   ***********************************************************************/
  
! /* Sun audio file encodings.  */ 
  
  enum au_encoding
  {
--- 663,669 ----
                           Sun Audio (*.au)
   ***********************************************************************/
  
! /* Sun audio file encodings.  */
  
  enum au_encoding
  {
***************
*** 689,706 ****
       struct sound *s;
  {
    struct au_header *header = (struct au_header *) s->header;
!   
    if (s->header_size < sizeof *header
        || bcmp (s->header, ".snd", 4) != 0)
      return 0;
!   
    header->magic_number = be2hl (header->magic_number);
    header->data_offset = be2hl (header->data_offset);
    header->data_size = be2hl (header->data_size);
    header->encoding = be2hl (header->encoding);
    header->sample_rate = be2hl (header->sample_rate);
    header->channels = be2hl (header->channels);
!   
    /* Set up the interface functions for AU.  */
    s->type = SUN_AUDIO;
    s->play = au_play;
--- 689,706 ----
       struct sound *s;
  {
    struct au_header *header = (struct au_header *) s->header;
! 
    if (s->header_size < sizeof *header
        || bcmp (s->header, ".snd", 4) != 0)
      return 0;
! 
    header->magic_number = be2hl (header->magic_number);
    header->data_offset = be2hl (header->data_offset);
    header->data_size = be2hl (header->data_size);
    header->encoding = be2hl (header->encoding);
    header->sample_rate = be2hl (header->sample_rate);
    header->channels = be2hl (header->channels);
! 
    /* Set up the interface functions for AU.  */
    s->type = SUN_AUDIO;
    s->play = au_play;
***************
*** 733,747 ****
        int blksize = 2048;
        char *buffer;
        int nbytes;
!       
        /* Seek */
        lseek (s->fd, header->data_offset, SEEK_SET);
!   
        /* Copy sound data to the device.  */
        buffer = (char *) alloca (blksize);
        while ((nbytes = emacs_read (s->fd, buffer, blksize)) > 0)
        sd->write (sd, buffer, nbytes);
!       
        if (nbytes < 0)
        sound_perror ("Error reading sound file");
      }
--- 733,747 ----
        int blksize = 2048;
        char *buffer;
        int nbytes;
! 
        /* Seek */
        lseek (s->fd, header->data_offset, SEEK_SET);
! 
        /* Copy sound data to the device.  */
        buffer = (char *) alloca (blksize);
        while ((nbytes = emacs_read (s->fd, buffer, blksize)) > 0)
        sd->write (sd, buffer, nbytes);
! 
        if (nbytes < 0)
        sound_perror ("Error reading sound file");
      }
***************
*** 765,777 ****
       struct sound_device *sd;
  {
    char *file;
!   
    /* Open the sound device.  Default is /dev/dsp.  */
    if (sd->file)
      file = sd->file;
    else
      file = DEFAULT_SOUND_DEVICE;
!   
    sd->fd = emacs_open (file, O_WRONLY, 0);
    if (sd->fd < 0)
      sound_perror (file);
--- 765,777 ----
       struct sound_device *sd;
  {
    char *file;
! 
    /* Open the sound device.  Default is /dev/dsp.  */
    if (sd->file)
      file = sd->file;
    else
      file = DEFAULT_SOUND_DEVICE;
! 
    sd->fd = emacs_open (file, O_WRONLY, 0);
    if (sd->fd < 0)
      sound_perror (file);
***************
*** 785,791 ****
       struct sound_device *sd;
  {
    int val;
!   
    xassert (sd->fd >= 0);
  
    /* On GNU/Linux, it seems that the device driver doesn't like to be
--- 785,791 ----
       struct sound_device *sd;
  {
    int val;
! 
    xassert (sd->fd >= 0);
  
    /* On GNU/Linux, it seems that the device driver doesn't like to be
***************
*** 824,830 ****
        /* This may fail if there is no mixer.  Ignore the failure.  */
        ioctl (sd->fd, SOUND_MIXER_WRITE_PCM, &volume);
      }
!   
    turn_on_atimers (1);
  #ifdef SIGIO
    sigunblock (sigmask (SIGIO));
--- 824,830 ----
        /* This may fail if there is no mixer.  Ignore the failure.  */
        ioctl (sd->fd, SOUND_MIXER_WRITE_PCM, &volume);
      }
! 
    turn_on_atimers (1);
  #ifdef SIGIO
    sigunblock (sigmask (SIGIO));
***************
*** 847,856 ****
        sigblock (sigmask (SIGIO));
  #endif
        turn_on_atimers (0);
!       
        /* Flush sound data, and reset the device.  */
        ioctl (sd->fd, SNDCTL_DSP_SYNC, NULL);
!       
        turn_on_atimers (1);
  #ifdef SIGIO
        sigunblock (sigmask (SIGIO));
--- 847,856 ----
        sigblock (sigmask (SIGIO));
  #endif
        turn_on_atimers (0);
! 
        /* Flush sound data, and reset the device.  */
        ioctl (sd->fd, SNDCTL_DSP_SYNC, NULL);
! 
        turn_on_atimers (1);
  #ifdef SIGIO
        sigunblock (sigmask (SIGIO));
***************
*** 890,896 ****
        case AU_ENCODING_IEEE64:
          sd->format = AFMT_MU_LAW;
          break;
!         
        case AU_ENCODING_8:
        case AU_ENCODING_16:
        case AU_ENCODING_24:
--- 890,896 ----
        case AU_ENCODING_IEEE64:
          sd->format = AFMT_MU_LAW;
          break;
! 
        case AU_ENCODING_8:
        case AU_ENCODING_16:
        case AU_ENCODING_24:



reply via email to

[Prev in Thread] Current Thread [Next in Thread]