[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: plays-sound hangs Emacs
From: |
Gerd Moellmann |
Subject: |
Re: plays-sound hangs Emacs |
Date: |
27 Oct 2001 10:48:52 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.1.50 |
Jesper Harder <harder@myrealbox.com> writes:
> (play-sound '(sound :file
> "/usr/lib/xemacs/xemacs-packages/etc/sounds/Tuxedomoon.Jingle4.au"))
>
> I get this backtrace:
>
> Debugger entered--Lisp error: (error "Set sound speed: Success")
Thanks, Jesper. I think this will fix it:
*** sound.c 2001/10/27 08:35:02 1.19
--- sound.c 2001/10/27 08:45:11
***************
*** 235,240 ****
--- 235,241 ----
static void vox_init P_ ((struct sound_device *));
static void vox_write P_ ((struct sound_device *, char *, int));
static void sound_perror P_ ((char *));
+ static void sound_warning P_ ((char *));
static int parse_sound P_ ((Lisp_Object, Lisp_Object *));
static void find_sound_type P_ ((struct sound *));
static u_int32_t le2hl P_ ((u_int32_t));
***************
*** 261,267 ****
sound_perror (msg)
char *msg;
{
! error ("%s: %s", msg, strerror (errno));
}
--- 262,285 ----
sound_perror (msg)
char *msg;
{
! turn_on_atimers (1);
! #ifdef SIGIO
! sigunblock (sigmask (SIGIO));
! #endif
! if (errno != 0)
! error ("%s: %s", msg, strerror (errno));
! else
! error ("%s", msg);
! }
!
!
! /* Display a warning message. */
!
! static void
! sound_warning (msg)
! char *msg;
! {
! message (msg);
}
***************
*** 417,428 ****
s.fd = openp (Fcons (Vdata_directory, Qnil),
attrs[SOUND_FILE], Qnil, &file, 0);
if (s.fd < 0)
! sound_perror ("Open sound file");
/* Read the first bytes from the file. */
s.header_size = emacs_read (s.fd, s.header, MAX_SOUND_HEADER_BYTES);
if (s.header_size < 0)
! sound_perror ("Reading sound file header");
}
else
{
--- 435,446 ----
s.fd = openp (Fcons (Vdata_directory, Qnil),
attrs[SOUND_FILE], Qnil, &file, 0);
if (s.fd < 0)
! sound_perror ("Could not open sound file");
/* Read the first bytes from the file. */
s.header_size = emacs_read (s.fd, s.header, MAX_SOUND_HEADER_BYTES);
if (s.header_size < 0)
! sound_perror ("Invalid sound file header");
}
else
{
***************
*** 633,639 ****
sd->write (sd, buffer, nbytes);
if (nbytes < 0)
! sound_perror ("Reading sound file");
}
}
--- 651,657 ----
sd->write (sd, buffer, nbytes);
if (nbytes < 0)
! sound_perror ("Error reading sound file");
}
}
***************
*** 723,729 ****
sd->write (sd, buffer, nbytes);
if (nbytes < 0)
! sound_perror ("Reading sound file");
}
}
--- 741,747 ----
sd->write (sd, buffer, nbytes);
if (nbytes < 0)
! sound_perror ("Error reading sound file");
}
}
***************
*** 779,799 ****
val = sd->format;
if (ioctl (sd->fd, SNDCTL_DSP_SETFMT, &sd->format) < 0
|| val != sd->format)
! sound_perror ("Set sound format");
val = sd->channels != 1;
if (ioctl (sd->fd, SNDCTL_DSP_STEREO, &val) < 0
|| val != (sd->channels != 1))
! sound_perror ("Set stereo/mono");
/* I think bps and sampling_rate are the same, but who knows.
Check this. and use SND_DSP_SPEED for both. */
if (sd->sample_rate > 0)
{
val = sd->sample_rate;
! if (ioctl (sd->fd, SNDCTL_DSP_SPEED, &sd->sample_rate) < 0
! || val != sd->sample_rate)
! sound_perror ("Set sound speed");
}
if (sd->volume > 0)
--- 797,818 ----
val = sd->format;
if (ioctl (sd->fd, SNDCTL_DSP_SETFMT, &sd->format) < 0
|| val != sd->format)
! sound_perror ("Could not set sound format");
val = sd->channels != 1;
if (ioctl (sd->fd, SNDCTL_DSP_STEREO, &val) < 0
|| val != (sd->channels != 1))
! sound_perror ("Could not set stereo/mono");
/* I think bps and sampling_rate are the same, but who knows.
Check this. and use SND_DSP_SPEED for both. */
if (sd->sample_rate > 0)
{
val = sd->sample_rate;
! if (ioctl (sd->fd, SNDCTL_DSP_SPEED, &sd->sample_rate) < 0)
! sound_perror ("Could not set sound speed");
! else if (val != sd->sample_rate)
! sound_warning ("Could not set sample rate");
}
if (sd->volume > 0)
***************
*** 912,918 ****
{
int nwritten = emacs_write (sd->fd, buffer, nbytes);
if (nwritten < 0)
! sound_perror ("Writing to sound device");
}
--- 931,937 ----
{
int nwritten = emacs_write (sd->fd, buffer, nbytes);
if (nwritten < 0)
! sound_perror ("Error writing to sound device");
}