aboutsummaryrefslogtreecommitdiffstats
path: root/src/sound.c
diff options
context:
space:
mode:
authorDan Nicolaescu2010-07-04 00:50:25 -0700
committerDan Nicolaescu2010-07-04 00:50:25 -0700
commit971de7fb158335fbda39525feb2d7776a26bc030 (patch)
tree605333d85f16e35bb06baffcb66ac49f4ec0dce9 /src/sound.c
parentb8463cbfbe2c5183cf40772df2746e58b787ddeb (diff)
downloademacs-971de7fb158335fbda39525feb2d7776a26bc030.tar.gz
emacs-971de7fb158335fbda39525feb2d7776a26bc030.zip
Convert (most) functions in src to standard C.
* src/alloc.c: Convert function definitions to standard C. * src/atimer.c: * src/bidi.c: * src/bytecode.c: * src/callint.c: * src/callproc.c: * src/casefiddle.c: * src/casetab.c: * src/category.c: * src/ccl.c: * src/character.c: * src/charset.c: * src/chartab.c: * src/cmds.c: * src/coding.c: * src/composite.c: * src/data.c: * src/dbusbind.c: * src/dired.c: * src/dispnew.c: * src/doc.c: * src/doprnt.c: * src/ecrt0.c: * src/editfns.c: * src/fileio.c: * src/filelock.c: * src/filemode.c: * src/fns.c: * src/font.c: * src/fontset.c: * src/frame.c: * src/fringe.c: * src/ftfont.c: * src/ftxfont.c: * src/gtkutil.c: * src/indent.c: * src/insdel.c: * src/intervals.c: * src/keymap.c: * src/lread.c: * src/macros.c: * src/marker.c: * src/md5.c: * src/menu.c: * src/minibuf.c: * src/prefix-args.c: * src/print.c: * src/ralloc.c: * src/regex.c: * src/region-cache.c: * src/scroll.c: * src/search.c: * src/sound.c: * src/strftime.c: * src/syntax.c: * src/sysdep.c: * src/termcap.c: * src/terminal.c: * src/terminfo.c: * src/textprop.c: * src/tparam.c: * src/undo.c: * src/unexelf.c: * src/window.c: * src/xfaces.c: * src/xfns.c: * src/xfont.c: * src/xftfont.c: * src/xgselect.c: * src/xmenu.c: * src/xrdb.c: * src/xselect.c: * src/xsettings.c: * src/xsmfns.c: * src/xterm.c: Likewise.
Diffstat (limited to 'src/sound.c')
-rw-r--r--src/sound.c99
1 files changed, 29 insertions, 70 deletions
diff --git a/src/sound.c b/src/sound.c
index b362fc8819e..6fa6f548917 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -328,8 +328,7 @@ static int do_play_sound (const char *, unsigned long);
328/* Like perror, but signals an error. */ 328/* Like perror, but signals an error. */
329 329
330static void 330static void
331sound_perror (msg) 331sound_perror (char *msg)
332 char *msg;
333{ 332{
334 int saved_errno = errno; 333 int saved_errno = errno;
335 334
@@ -347,8 +346,7 @@ sound_perror (msg)
347/* Display a warning message. */ 346/* Display a warning message. */
348 347
349static void 348static void
350sound_warning (msg) 349sound_warning (char *msg)
351 char *msg;
352{ 350{
353 message (msg); 351 message (msg);
354} 352}
@@ -381,9 +379,7 @@ sound_warning (msg)
381 range [0, 1]. */ 379 range [0, 1]. */
382 380
383static int 381static int
384parse_sound (sound, attrs) 382parse_sound (Lisp_Object sound, Lisp_Object *attrs)
385 Lisp_Object sound;
386 Lisp_Object *attrs;
387{ 383{
388 /* SOUND must be a list starting with the symbol `sound'. */ 384 /* SOUND must be a list starting with the symbol `sound'. */
389 if (!CONSP (sound) || !EQ (XCAR (sound), Qsound)) 385 if (!CONSP (sound) || !EQ (XCAR (sound), Qsound))
@@ -452,8 +448,7 @@ parse_sound (sound, attrs)
452 S is the sound file structure to fill in. */ 448 S is the sound file structure to fill in. */
453 449
454static void 450static void
455find_sound_type (s) 451find_sound_type (struct sound *s)
456 struct sound *s;
457{ 452{
458 if (!wav_init (s) && !au_init (s)) 453 if (!wav_init (s) && !au_init (s))
459 error ("Unknown sound format"); 454 error ("Unknown sound format");
@@ -463,8 +458,7 @@ find_sound_type (s)
463/* Function installed by play-sound-internal with record_unwind_protect. */ 458/* Function installed by play-sound-internal with record_unwind_protect. */
464 459
465static Lisp_Object 460static Lisp_Object
466sound_cleanup (arg) 461sound_cleanup (Lisp_Object arg)
467 Lisp_Object arg;
468{ 462{
469 if (current_sound_device->close) 463 if (current_sound_device->close)
470 current_sound_device->close (current_sound_device); 464 current_sound_device->close (current_sound_device);
@@ -484,8 +478,7 @@ sound_cleanup (arg)
484 to host byte-order. */ 478 to host byte-order. */
485 479
486static u_int32_t 480static u_int32_t
487le2hl (value) 481le2hl (u_int32_t value)
488 u_int32_t value;
489{ 482{
490#ifdef WORDS_BIG_ENDIAN 483#ifdef WORDS_BIG_ENDIAN
491 unsigned char *p = (unsigned char *) &value; 484 unsigned char *p = (unsigned char *) &value;
@@ -499,8 +492,7 @@ le2hl (value)
499 to host byte-order. */ 492 to host byte-order. */
500 493
501static u_int16_t 494static u_int16_t
502le2hs (value) 495le2hs (u_int16_t value)
503 u_int16_t value;
504{ 496{
505#ifdef WORDS_BIG_ENDIAN 497#ifdef WORDS_BIG_ENDIAN
506 unsigned char *p = (unsigned char *) &value; 498 unsigned char *p = (unsigned char *) &value;
@@ -514,8 +506,7 @@ le2hs (value)
514 to host byte-order. */ 506 to host byte-order. */
515 507
516static u_int32_t 508static u_int32_t
517be2hl (value) 509be2hl (u_int32_t value)
518 u_int32_t value;
519{ 510{
520#ifndef WORDS_BIG_ENDIAN 511#ifndef WORDS_BIG_ENDIAN
521 unsigned char *p = (unsigned char *) &value; 512 unsigned char *p = (unsigned char *) &value;
@@ -554,8 +545,7 @@ be2hs (value)
554 Value is non-zero if the file is a WAV file. */ 545 Value is non-zero if the file is a WAV file. */
555 546
556static int 547static int
557wav_init (s) 548wav_init (struct sound *s)
558 struct sound *s;
559{ 549{
560 struct wav_header *header = (struct wav_header *) s->header; 550 struct wav_header *header = (struct wav_header *) s->header;
561 551
@@ -590,9 +580,7 @@ wav_init (s)
590/* Play RIFF-WAVE audio file S on sound device SD. */ 580/* Play RIFF-WAVE audio file S on sound device SD. */
591 581
592static void 582static void
593wav_play (s, sd) 583wav_play (struct sound *s, struct sound_device *sd)
594 struct sound *s;
595 struct sound_device *sd;
596{ 584{
597 struct wav_header *header = (struct wav_header *) s->header; 585 struct wav_header *header = (struct wav_header *) s->header;
598 586
@@ -665,8 +653,7 @@ enum au_encoding
665 Value is non-zero if the file is an AU file. */ 653 Value is non-zero if the file is an AU file. */
666 654
667static int 655static int
668au_init (s) 656au_init (struct sound *s)
669 struct sound *s;
670{ 657{
671 struct au_header *header = (struct au_header *) s->header; 658 struct au_header *header = (struct au_header *) s->header;
672 659
@@ -692,9 +679,7 @@ au_init (s)
692/* Play Sun audio file S on sound device SD. */ 679/* Play Sun audio file S on sound device SD. */
693 680
694static void 681static void
695au_play (s, sd) 682au_play (struct sound *s, struct sound_device *sd)
696 struct sound *s;
697 struct sound_device *sd;
698{ 683{
699 struct au_header *header = (struct au_header *) s->header; 684 struct au_header *header = (struct au_header *) s->header;
700 685
@@ -740,8 +725,7 @@ au_play (s, sd)
740 otherwise use a default device name. */ 725 otherwise use a default device name. */
741 726
742static void 727static void
743vox_open (sd) 728vox_open (struct sound_device *sd)
744 struct sound_device *sd;
745{ 729{
746 char *file; 730 char *file;
747 731
@@ -760,8 +744,7 @@ vox_open (sd)
760/* Configure device SD from parameters in it. */ 744/* Configure device SD from parameters in it. */
761 745
762static void 746static void
763vox_configure (sd) 747vox_configure (struct sound_device *sd)
764 struct sound_device *sd;
765{ 748{
766 int val; 749 int val;
767 750
@@ -814,8 +797,7 @@ vox_configure (sd)
814/* Close device SD if it is open. */ 797/* Close device SD if it is open. */
815 798
816static void 799static void
817vox_close (sd) 800vox_close (struct sound_device *sd)
818 struct sound_device *sd;
819{ 801{
820 if (sd->fd >= 0) 802 if (sd->fd >= 0)
821 { 803 {
@@ -845,9 +827,7 @@ vox_close (sd)
845/* Choose device-dependent format for device SD from sound file S. */ 827/* Choose device-dependent format for device SD from sound file S. */
846 828
847static void 829static void
848vox_choose_format (sd, s) 830vox_choose_format (struct sound_device *sd, struct sound *s)
849 struct sound_device *sd;
850 struct sound *s;
851{ 831{
852 if (s->type == RIFF) 832 if (s->type == RIFF)
853 { 833 {
@@ -890,8 +870,7 @@ vox_choose_format (sd, s)
890 structure. */ 870 structure. */
891 871
892static int 872static int
893vox_init (sd) 873vox_init (struct sound_device *sd)
894 struct sound_device *sd;
895{ 874{
896 char *file; 875 char *file;
897 int fd; 876 int fd;
@@ -921,10 +900,7 @@ vox_init (sd)
921/* Write NBYTES bytes from BUFFER to device SD. */ 900/* Write NBYTES bytes from BUFFER to device SD. */
922 901
923static void 902static void
924vox_write (sd, buffer, nbytes) 903vox_write (struct sound_device *sd, const char *buffer, int nbytes)
925 struct sound_device *sd;
926 const char *buffer;
927 int nbytes;
928{ 904{
929 int nwritten = emacs_write (sd->fd, buffer, nbytes); 905 int nwritten = emacs_write (sd->fd, buffer, nbytes);
930 if (nwritten < 0) 906 if (nwritten < 0)
@@ -939,9 +915,7 @@ vox_write (sd, buffer, nbytes)
939/* This driver is available on GNU/Linux. */ 915/* This driver is available on GNU/Linux. */
940 916
941static void 917static void
942alsa_sound_perror (msg, err) 918alsa_sound_perror (char *msg, int err)
943 char *msg;
944 int err;
945{ 919{
946 error ("%s: %s", msg, snd_strerror (err)); 920 error ("%s: %s", msg, snd_strerror (err));
947} 921}
@@ -958,8 +932,7 @@ struct alsa_params
958 otherwise use a default device name. */ 932 otherwise use a default device name. */
959 933
960static void 934static void
961alsa_open (sd) 935alsa_open (struct sound_device *sd)
962 struct sound_device *sd;
963{ 936{
964 char *file; 937 char *file;
965 struct alsa_params *p; 938 struct alsa_params *p;
@@ -986,8 +959,7 @@ alsa_open (sd)
986} 959}
987 960
988static int 961static int
989alsa_period_size (sd) 962alsa_period_size (struct sound_device *sd)
990 struct sound_device *sd;
991{ 963{
992 struct alsa_params *p = (struct alsa_params *) sd->data; 964 struct alsa_params *p = (struct alsa_params *) sd->data;
993 int fact = snd_pcm_format_size (sd->format, 1) * sd->channels; 965 int fact = snd_pcm_format_size (sd->format, 1) * sd->channels;
@@ -995,8 +967,7 @@ alsa_period_size (sd)
995} 967}
996 968
997static void 969static void
998alsa_configure (sd) 970alsa_configure (struct sound_device *sd)
999 struct sound_device *sd;
1000{ 971{
1001 int val, err, dir; 972 int val, err, dir;
1002 unsigned uval; 973 unsigned uval;
@@ -1115,8 +1086,7 @@ alsa_configure (sd)
1115/* Close device SD if it is open. */ 1086/* Close device SD if it is open. */
1116 1087
1117static void 1088static void
1118alsa_close (sd) 1089alsa_close (struct sound_device *sd)
1119 struct sound_device *sd;
1120{ 1090{
1121 struct alsa_params *p = (struct alsa_params *) sd->data; 1091 struct alsa_params *p = (struct alsa_params *) sd->data;
1122 if (p) 1092 if (p)
@@ -1137,9 +1107,7 @@ alsa_close (sd)
1137/* Choose device-dependent format for device SD from sound file S. */ 1107/* Choose device-dependent format for device SD from sound file S. */
1138 1108
1139static void 1109static void
1140alsa_choose_format (sd, s) 1110alsa_choose_format (struct sound_device *sd, struct sound *s)
1141 struct sound_device *sd;
1142 struct sound *s;
1143{ 1111{
1144 struct alsa_params *p = (struct alsa_params *) sd->data; 1112 struct alsa_params *p = (struct alsa_params *) sd->data;
1145 if (s->type == RIFF) 1113 if (s->type == RIFF)
@@ -1194,10 +1162,7 @@ alsa_choose_format (sd, s)
1194/* Write NBYTES bytes from BUFFER to device SD. */ 1162/* Write NBYTES bytes from BUFFER to device SD. */
1195 1163
1196static void 1164static void
1197alsa_write (sd, buffer, nbytes) 1165alsa_write (struct sound_device *sd, const char *buffer, int nbytes)
1198 struct sound_device *sd;
1199 const char *buffer;
1200 int nbytes;
1201{ 1166{
1202 struct alsa_params *p = (struct alsa_params *) sd->data; 1167 struct alsa_params *p = (struct alsa_params *) sd->data;
1203 1168
@@ -1244,12 +1209,7 @@ alsa_write (sd, buffer, nbytes)
1244} 1209}
1245 1210
1246static void 1211static void
1247snd_error_quiet (file, line, function, err, fmt) 1212snd_error_quiet (const char *file, int line, const char *function, int err, const char *fmt)
1248 const char *file;
1249 int line;
1250 const char *function;
1251 int err;
1252 const char *fmt;
1253{ 1213{
1254} 1214}
1255 1215
@@ -1257,8 +1217,7 @@ snd_error_quiet (file, line, function, err, fmt)
1257 structure. */ 1217 structure. */
1258 1218
1259static int 1219static int
1260alsa_init (sd) 1220alsa_init (struct sound_device *sd)
1261 struct sound_device *sd;
1262{ 1221{
1263 char *file; 1222 char *file;
1264 snd_pcm_t *handle; 1223 snd_pcm_t *handle;
@@ -1524,7 +1483,7 @@ Internal use only, use `play-sound' instead. */)
1524 ***********************************************************************/ 1483 ***********************************************************************/
1525 1484
1526void 1485void
1527syms_of_sound () 1486syms_of_sound (void)
1528{ 1487{
1529 QCdevice = intern_c_string(":device"); 1488 QCdevice = intern_c_string(":device");
1530 staticpro (&QCdevice); 1489 staticpro (&QCdevice);
@@ -1540,7 +1499,7 @@ syms_of_sound ()
1540 1499
1541 1500
1542void 1501void
1543init_sound () 1502init_sound (void)
1544{ 1503{
1545} 1504}
1546 1505