/* sound.c -- sound support.
-Copyright (C) 1998-1999, 2001-2013 Free Software Foundation, Inc.
+Copyright (C) 1998-1999, 2001-2014 Free Software Foundation, Inc.
This file is part of GNU Emacs.
/* BEGIN: Non Windows Includes */
#ifndef WINDOWSNT
+#include <byteswap.h>
+
#include <sys/ioctl.h>
/* FreeBSD has machine/soundcard.h. Voxware sound driver docs mention
le2hl (u_int32_t value)
{
#ifdef WORDS_BIGENDIAN
- unsigned char *p = (unsigned char *) &value;
- value = p[0] + (p[1] << 8) + (p[2] << 16) + (p[3] << 24);
+ value = bswap_32 (value);
#endif
return value;
}
le2hs (u_int16_t value)
{
#ifdef WORDS_BIGENDIAN
- unsigned char *p = (unsigned char *) &value;
- value = p[0] + (p[1] << 8);
+ value = bswap_16 (value);
#endif
return value;
}
be2hl (u_int32_t value)
{
#ifndef WORDS_BIGENDIAN
- unsigned char *p = (unsigned char *) &value;
- value = p[3] + (p[2] << 8) + (p[1] << 16) + (p[0] << 24);
+ value = bswap_32 (value);
#endif
return value;
}
-
-#if 0 /* Currently not used. */
-
-/* Convert 16-bit value VALUE which is in big-endian byte-order
- to host byte-order. */
-
-static u_int16_t
-be2hs (u_int16_t value)
-{
-#ifndef WORDS_BIGENDIAN
- unsigned char *p = (unsigned char *) &value;
- value = p[1] + (p[0] << 8);
-#endif
- return value;
-}
-
-#endif /* 0 */
-
/***********************************************************************
RIFF-WAVE (*.wav)
***********************************************************************/
{
int val;
#ifdef USABLE_SIGIO
- sigset_t blocked;
+ sigset_t oldset, blocked;
#endif
eassert (sd->fd >= 0);
#ifdef USABLE_SIGIO
sigemptyset (&blocked);
sigaddset (&blocked, SIGIO);
- pthread_sigmask (SIG_BLOCK, &blocked, 0);
+ pthread_sigmask (SIG_BLOCK, &blocked, &oldset);
#endif
val = sd->format;
turn_on_atimers (1);
#ifdef USABLE_SIGIO
- pthread_sigmask (SIG_UNBLOCK, &blocked, 0);
+ pthread_sigmask (SIG_SETMASK, &oldset, 0);
#endif
}
be interrupted by a signal. Block the ones we know to cause
troubles. */
#ifdef USABLE_SIGIO
- sigset_t blocked;
+ sigset_t blocked, oldset;
sigemptyset (&blocked);
sigaddset (&blocked, SIGIO);
- pthread_sigmask (SIG_BLOCK, &blocked, 0);
+ pthread_sigmask (SIG_BLOCK, &blocked, &oldset);
#endif
turn_on_atimers (0);
turn_on_atimers (1);
#ifdef USABLE_SIGIO
- pthread_sigmask (SIG_UNBLOCK, &blocked, 0);
+ pthread_sigmask (SIG_SETMASK, &oldset, 0);
#endif
/* Close the device. */
(Lisp_Object sound)
{
Lisp_Object attrs[SOUND_ATTR_SENTINEL];
- ptrdiff_t count = SPECPDL_INDEX ();
+ dynwind_begin ();
#ifndef WINDOWSNT
Lisp_Object file;
{
/* Open the sound file. */
current_sound->fd = openp (list1 (Vdata_directory),
- attrs[SOUND_FILE], Qnil, &file, Qnil);
+ attrs[SOUND_FILE], Qnil, &file, Qnil, false);
if (current_sound->fd < 0)
sound_perror ("Could not open sound file");
#endif /* WINDOWSNT */
- unbind_to (count, Qnil);
+ dynwind_end ();
return Qnil;
}
\f
void
syms_of_sound (void)
{
+#include "sound.x"
+
DEFSYM (QCdevice, ":device");
DEFSYM (QCvolume, ":volume");
DEFSYM (Qsound, "sound");
DEFSYM (Qplay_sound_functions, "play-sound-functions");
-
- defsubr (&Splay_sound_internal);
}
#endif /* HAVE_SOUND */