comparison src/sound.c @ 46370:40db0673e6f0

Most uses of XSTRING combined with STRING_BYTES or indirection changed to SCHARS, SBYTES, STRING_INTERVALS, SREF, SDATA; explicit size_byte references left unchanged for now.
author Ken Raeburn <raeburn@raeburn.org>
date Mon, 15 Jul 2002 00:00:41 +0000
parents 1fb8f75062c6
children fb13fafbd279
comparison
equal deleted inserted replaced
46369:dd1d3b1d0053 46370:40db0673e6f0
431 sound_perror ("Invalid sound file header"); 431 sound_perror ("Invalid sound file header");
432 } 432 }
433 else 433 else
434 { 434 {
435 s.data = attrs[SOUND_DATA]; 435 s.data = attrs[SOUND_DATA];
436 s.header_size = min (MAX_SOUND_HEADER_BYTES, STRING_BYTES (XSTRING (s.data))); 436 s.header_size = min (MAX_SOUND_HEADER_BYTES, SBYTES (s.data));
437 bcopy (XSTRING (s.data)->data, s.header, s.header_size); 437 bcopy (SDATA (s.data), s.header, s.header_size);
438 } 438 }
439 439
440 /* Find out the type of sound. Give up if we can't tell. */ 440 /* Find out the type of sound. Give up if we can't tell. */
441 find_sound_type (&s); 441 find_sound_type (&s);
442 442
443 /* Set up a device. */ 443 /* Set up a device. */
444 if (STRINGP (attrs[SOUND_DEVICE])) 444 if (STRINGP (attrs[SOUND_DEVICE]))
445 { 445 {
446 int len = XSTRING (attrs[SOUND_DEVICE])->size; 446 int len = SCHARS (attrs[SOUND_DEVICE]);
447 sd.file = (char *) alloca (len + 1); 447 sd.file = (char *) alloca (len + 1);
448 strcpy (sd.file, XSTRING (attrs[SOUND_DEVICE])->data); 448 strcpy (sd.file, SDATA (attrs[SOUND_DEVICE]));
449 } 449 }
450 450
451 if (INTEGERP (attrs[SOUND_VOLUME])) 451 if (INTEGERP (attrs[SOUND_VOLUME]))
452 sd.volume = XFASTINT (attrs[SOUND_VOLUME]); 452 sd.volume = XFASTINT (attrs[SOUND_VOLUME]);
453 else if (FLOATP (attrs[SOUND_VOLUME])) 453 else if (FLOATP (attrs[SOUND_VOLUME]))
622 /* Copy sound data to the device. The WAV file specification is 622 /* Copy sound data to the device. The WAV file specification is
623 actually more complex. This simple scheme worked with all WAV 623 actually more complex. This simple scheme worked with all WAV
624 files I found so far. If someone feels inclined to implement the 624 files I found so far. If someone feels inclined to implement the
625 whole RIFF-WAVE spec, please do. */ 625 whole RIFF-WAVE spec, please do. */
626 if (STRINGP (s->data)) 626 if (STRINGP (s->data))
627 sd->write (sd, XSTRING (s->data)->data + sizeof *header, 627 sd->write (sd, SDATA (s->data) + sizeof *header,
628 STRING_BYTES (XSTRING (s->data)) - sizeof *header); 628 SBYTES (s->data) - sizeof *header);
629 else 629 else
630 { 630 {
631 char *buffer; 631 char *buffer;
632 int nbytes; 632 int nbytes;
633 int blksize = 2048; 633 int blksize = 2048;
710 sd->channels = header->channels; 710 sd->channels = header->channels;
711 sd->choose_format (sd, s); 711 sd->choose_format (sd, s);
712 sd->configure (sd); 712 sd->configure (sd);
713 713
714 if (STRINGP (s->data)) 714 if (STRINGP (s->data))
715 sd->write (sd, XSTRING (s->data)->data + header->data_offset, 715 sd->write (sd, SDATA (s->data) + header->data_offset,
716 STRING_BYTES (XSTRING (s->data)) - header->data_offset); 716 SBYTES (s->data) - header->data_offset);
717 else 717 else
718 { 718 {
719 int blksize = 2048; 719 int blksize = 2048;
720 char *buffer; 720 char *buffer;
721 int nbytes; 721 int nbytes;