/* sound.c -- sound support.
- Copyright (C) 1998 Free Software Foundation.
+ Copyright (C) 1998, 1999 Free Software Foundation.
This file is part of GNU Emacs.
static u_int32_t le2hl P_ ((u_int32_t));
static u_int16_t le2hs P_ ((u_int16_t));
static u_int32_t be2hl P_ ((u_int32_t));
-static u_int16_t be2hs P_ ((u_int16_t));
static int wav_init P_ ((struct sound_file *));
static void wav_play P_ ((struct sound_file *, struct sound_device *));
static int au_init P_ ((struct sound_file *));
static void au_play P_ ((struct sound_file *, struct sound_device *));
+#if 0 /* Currently not used. */
+static u_int16_t be2hs P_ ((u_int16_t));
+#endif
+
\f
/***********************************************************************
{
sound_device->close (sound_device);
if (sound_file->fd > 0)
- close (sound_file->fd);
+ emacs_close (sound_file->fd);
}
}
Lisp_Object sound;
{
Lisp_Object attrs[SOUND_ATTR_SENTINEL];
- char *header;
Lisp_Object file;
struct gcpro gcpro1, gcpro2;
int nbytes;
- char *msg;
struct sound_device sd;
struct sound_file sf;
Lisp_Object args[2];
sound_perror ("Open sound file");
/* Read the first bytes from the file. */
- nbytes = read (sf.fd, sf.header, MAX_SOUND_HEADER_BYTES);
+ nbytes = emacs_read (sf.fd, sf.header, MAX_SOUND_HEADER_BYTES);
if (nbytes < 0)
sound_perror ("Reading sound file header");
sd.open (&sd);
sf.play (&sf, &sd);
- close (sf.fd);
+ emacs_close (sf.fd);
sf.fd = -1;
sd.close (&sd);
sound_device = NULL;
}
+#if 0 /* Currently not used. */
+
/* Convert 16-bit value VALUE which is in big-endian byte-order
to host byte-order. */
return value;
}
+#endif /* 0 */
\f
/***********************************************************************
buffer = (char *) alloca (blksize);
lseek (sf->fd, sizeof *header, SEEK_SET);
- while ((nbytes = read (sf->fd, buffer, blksize)) > 0)
+ while ((nbytes = emacs_read (sf->fd, buffer, blksize)) > 0)
sd->write (sd, buffer, nbytes);
if (nbytes < 0)
/* Copy sound data to the device. */
buffer = (char *) alloca (blksize);
- while ((nbytes = read (sf->fd, buffer, blksize)) > 0)
+ while ((nbytes = emacs_read (sf->fd, buffer, blksize)) > 0)
sd->write (sd, buffer, nbytes);
if (nbytes < 0)
else
file = "/dev/dsp";
- sd->fd = open (file, O_WRONLY);
+ sd->fd = emacs_open (file, O_WRONLY, 0);
if (sd->fd < 0)
sound_perror (file);
}
ioctl (sd->fd, SNDCTL_DSP_RESET, NULL);
/* Close the device. */
- close (sd->fd);
+ emacs_close (sd->fd);
sd->fd = -1;
}
}
char *buffer;
int nbytes;
{
- int nwritten = write (sd->fd, buffer, nbytes);
+ int nwritten = emacs_write (sd->fd, buffer, nbytes);
if (nwritten < 0)
sound_perror ("Writing to sound device");
}