Mercurial > emacs
comparison src/sound.c @ 109428:5ba21f4a3d62
Merge from mainline.
author | Katsumi Yamaoka <yamaoka@jpl.org> |
---|---|
date | Thu, 08 Jul 2010 22:47:34 +0000 |
parents | 8cfee7d2955f |
children | d12162869c07 |
comparison
equal
deleted
inserted
replaced
109427:9d1a0d3d72be | 109428:5ba21f4a3d62 |
---|---|
548 wav_init (struct sound *s) | 548 wav_init (struct sound *s) |
549 { | 549 { |
550 struct wav_header *header = (struct wav_header *) s->header; | 550 struct wav_header *header = (struct wav_header *) s->header; |
551 | 551 |
552 if (s->header_size < sizeof *header | 552 if (s->header_size < sizeof *header |
553 || bcmp (s->header, "RIFF", 4) != 0) | 553 || memcmp (s->header, "RIFF", 4) != 0) |
554 return 0; | 554 return 0; |
555 | 555 |
556 /* WAV files are in little-endian order. Convert the header | 556 /* WAV files are in little-endian order. Convert the header |
557 if on a big-endian machine. */ | 557 if on a big-endian machine. */ |
558 header->magic = le2hl (header->magic); | 558 header->magic = le2hl (header->magic); |
656 au_init (struct sound *s) | 656 au_init (struct sound *s) |
657 { | 657 { |
658 struct au_header *header = (struct au_header *) s->header; | 658 struct au_header *header = (struct au_header *) s->header; |
659 | 659 |
660 if (s->header_size < sizeof *header | 660 if (s->header_size < sizeof *header |
661 || bcmp (s->header, ".snd", 4) != 0) | 661 || memcmp (s->header, ".snd", 4) != 0) |
662 return 0; | 662 return 0; |
663 | 663 |
664 header->magic_number = be2hl (header->magic_number); | 664 header->magic_number = be2hl (header->magic_number); |
665 header->data_offset = be2hl (header->data_offset); | 665 header->data_offset = be2hl (header->data_offset); |
666 header->data_size = be2hl (header->data_size); | 666 header->data_size = be2hl (header->data_size); |
1351 | 1351 |
1352 DEFUN ("play-sound-internal", Fplay_sound_internal, Splay_sound_internal, 1, 1, 0, | 1352 DEFUN ("play-sound-internal", Fplay_sound_internal, Splay_sound_internal, 1, 1, 0, |
1353 doc: /* Play sound SOUND. | 1353 doc: /* Play sound SOUND. |
1354 | 1354 |
1355 Internal use only, use `play-sound' instead. */) | 1355 Internal use only, use `play-sound' instead. */) |
1356 (sound) | 1356 (Lisp_Object sound) |
1357 Lisp_Object sound; | |
1358 { | 1357 { |
1359 Lisp_Object attrs[SOUND_ATTR_SENTINEL]; | 1358 Lisp_Object attrs[SOUND_ATTR_SENTINEL]; |
1360 int count = SPECPDL_INDEX (); | 1359 int count = SPECPDL_INDEX (); |
1361 | 1360 |
1362 #ifndef WINDOWSNT | 1361 #ifndef WINDOWSNT |
1378 | 1377 |
1379 #ifndef WINDOWSNT | 1378 #ifndef WINDOWSNT |
1380 file = Qnil; | 1379 file = Qnil; |
1381 GCPRO2 (sound, file); | 1380 GCPRO2 (sound, file); |
1382 current_sound_device = (struct sound_device *) xmalloc (sizeof (struct sound_device)); | 1381 current_sound_device = (struct sound_device *) xmalloc (sizeof (struct sound_device)); |
1383 bzero (current_sound_device, sizeof (struct sound_device)); | 1382 memset (current_sound_device, 0, sizeof (struct sound_device)); |
1384 current_sound = (struct sound *) xmalloc (sizeof (struct sound)); | 1383 current_sound = (struct sound *) xmalloc (sizeof (struct sound)); |
1385 bzero (current_sound, sizeof (struct sound)); | 1384 memset (current_sound, 0, sizeof (struct sound)); |
1386 record_unwind_protect (sound_cleanup, Qnil); | 1385 record_unwind_protect (sound_cleanup, Qnil); |
1387 current_sound->header = (char *) alloca (MAX_SOUND_HEADER_BYTES); | 1386 current_sound->header = (char *) alloca (MAX_SOUND_HEADER_BYTES); |
1388 | 1387 |
1389 if (STRINGP (attrs[SOUND_FILE])) | 1388 if (STRINGP (attrs[SOUND_FILE])) |
1390 { | 1389 { |
1403 } | 1402 } |
1404 else | 1403 else |
1405 { | 1404 { |
1406 current_sound->data = attrs[SOUND_DATA]; | 1405 current_sound->data = attrs[SOUND_DATA]; |
1407 current_sound->header_size = min (MAX_SOUND_HEADER_BYTES, SBYTES (current_sound->data)); | 1406 current_sound->header_size = min (MAX_SOUND_HEADER_BYTES, SBYTES (current_sound->data)); |
1408 bcopy (SDATA (current_sound->data), current_sound->header, current_sound->header_size); | 1407 memcpy (current_sound->header, SDATA (current_sound->data), |
1408 current_sound->header_size); | |
1409 } | 1409 } |
1410 | 1410 |
1411 /* Find out the type of sound. Give up if we can't tell. */ | 1411 /* Find out the type of sound. Give up if we can't tell. */ |
1412 find_sound_type (current_sound); | 1412 find_sound_type (current_sound); |
1413 | 1413 |