comparison src/nas.c @ 563:183866b06e0b

[xemacs-hg @ 2001-05-24 07:50:48 by ben] Makefile.in.in, abbrev.c, alloc.c, buffer.c, bytecode.c, callint.c, callproc.c, casetab.c, chartab.c, cmdloop.c, cmds.c, console-msw.c, console-msw.h, console-stream.c, console-tty.c, console-x.c, console.c, data.c, database.c, debug.c, device-gtk.c, device-msw.c, device-tty.c, device-x.c, device.c, dialog-gtk.c, dialog-msw.c, dialog-x.c, dialog.c, dired-msw.c, dired.c, doc.c, doprnt.c, dragdrop.c, editfns.c, eldap.c, eldap.h, elhash.c, emacs-widget-accessors.c, emacs.c, emodules.c, esd.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, events.c, extents.c, faces.c, file-coding.c, fileio.c, filelock.c, floatfns.c, fns.c, font-lock.c, frame-gtk.c, frame-x.c, frame.c, general-slots.h, glade.c, glyphs-gtk.c, glyphs-msw.c, glyphs-widget.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gui-gtk.c, gui-x.c, gui.c, gutter.c, hpplay.c, indent.c, input-method-xlib.c, insdel.c, intl.c, keymap.c, libsst.c, libsst.h, linuxplay.c, lisp.h, lread.c, lstream.c, lstream.h, macros.c, marker.c, md5.c, menubar-gtk.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, miscplay.c, miscplay.h, mule-ccl.c, mule-charset.c, mule-wnnfns.c, mule.c, nas.c, ntplay.c, ntproc.c, objects-gtk.c, objects-msw.c, objects-x.c, objects.c, postgresql.c, print.c, process-nt.c, process-unix.c, process.c, ralloc.c, rangetab.c, redisplay.c, scrollbar.c, search.c, select-gtk.c, select-x.c, select.c, sgiplay.c, sheap.c, sound.c, specifier.c, sunplay.c, symbols.c, symeval.h, symsinit.h, syntax.c, sysdep.c, toolbar-msw.c, toolbar.c, tooltalk.c, ui-byhand.c, ui-gtk.c, undo.c, unexaix.c, unexapollo.c, unexconvex.c, unexec.c, widget.c, win32.c, window.c: -- defsymbol -> DEFSYMBOL. -- add an error type to all errors. -- eliminate the error functions in eval.c that let you just use Qerror as the type. -- redo the error API to be more consistent, sensibly named, and easier to use. -- redo the error hierarchy somewhat. create new errors: structure-formation-error, gui-error, invalid-constant, stack-overflow, out-of-memory, process-error, network-error, sound-error, printing-unreadable-object, base64-conversion- error; coding-system-error renamed to text-conversion error; some others. -- fix Mule problems in error strings in emodules.c, tooltalk.c. -- fix error handling in mswin open-network-stream. -- Mule-ize all sound files and clean up the headers. -- nativesound.h -> sound.h and used for all sound files. -- move some shared stuff into glyphs-shared.c: first attempt at eliminating some of the massive GTK code duplication. xemacs.mak: add glyphs-shared.c. xemacs-faq.texi: document how to debug X errors subr.el: fix doc string to reflect reality
author ben
date Thu, 24 May 2001 07:51:33 +0000
parents abe6d1db359e
children 023b83f4e54b
comparison
equal deleted inserted replaced
562:c775bd016b32 563:183866b06e0b
24 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 24 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
25 */ 25 */
26 26
27 /* Synched up with: Not in FSF. */ 27 /* Synched up with: Not in FSF. */
28 28
29 /* This file Mule-ized by Ben Wing, 5-15-01. */
30
29 /* There are four compile-time options. 31 /* There are four compile-time options.
30 * 32 *
31 * XTOOLKIT This will be part of an Xt program. 33 * XTOOLKIT This will be part of an Xt program.
32 * 34 *
33 * XTEVENTS The playing will be supervised asynchronously by the Xt event 35 * XTEVENTS The playing will be supervised asynchronously by the Xt event
50 * 4/11/94, rjc Added wait_for_sounds to be called when user wants to 52 * 4/11/94, rjc Added wait_for_sounds to be called when user wants to
51 * be sure all play has finished. 53 * be sure all play has finished.
52 * 1998-10-01 rlt Added support for WAVE files. 54 * 1998-10-01 rlt Added support for WAVE files.
53 */ 55 */
54 56
55 #ifdef emacs
56 #include <config.h> 57 #include <config.h>
57 #include "lisp.h" 58 #include "lisp.h"
59
60 #include "sound.h"
61
58 #include "sysdep.h" 62 #include "sysdep.h"
59 #include "syssignal.h" 63 #include "syssignal.h"
60 #endif
61
62 #include <stdlib.h>
63 #include <stdarg.h>
64 #include <string.h>
65 #include <stdio.h>
66
67 #ifdef HAVE_UNISTD_H
68 #include <unistd.h>
69 #endif
70 64
71 /* NAS <= 1.2p5 defines {BIG,LITTLE}_ENDIAN in <audio/fileutil.h>, 65 /* NAS <= 1.2p5 defines {BIG,LITTLE}_ENDIAN in <audio/fileutil.h>,
72 conflicting with GNU libc (at least); newer versions avoid this 66 conflicting with GNU libc (at least); newer versions avoid this
73 name space pollution. 67 name space pollution.
74 68
90 #ifndef NAS_LITTLE_ENDIAN 84 #ifndef NAS_LITTLE_ENDIAN
91 #define NAS_LITTLE_ENDIAN LITTLE_ENDIAN 85 #define NAS_LITTLE_ENDIAN LITTLE_ENDIAN
92 #define NAS_BIG_ENDIAN BIG_ENDIAN 86 #define NAS_BIG_ENDIAN BIG_ENDIAN
93 #endif 87 #endif
94 88
95 #ifdef emacs
96
97 # define XTOOLKIT 89 # define XTOOLKIT
98 # define XTEVENTS 90 # define XTEVENTS
99 # define ROBUST_PLAY 91 # define ROBUST_PLAY
100 # define CACHE_SOUNDS 92 # define CACHE_SOUNDS
101 93
109 # undef XTEVENTS 101 # undef XTEVENTS
110 102
111 # include <setjmp.h> 103 # include <setjmp.h>
112 jmp_buf AuXtErrorJump; 104 jmp_buf AuXtErrorJump;
113 # endif 105 # endif
114
115 /* The GETTEXT is correct. --ben */
116 # define warn(str) warn_when_safe (Qnas, Qwarning, "nas: %s ", GETTEXT (str))
117 106
118 # define play_sound_file nas_play_sound_file 107 # define play_sound_file nas_play_sound_file
119 # define play_sound_data nas_play_sound_data 108 # define play_sound_data nas_play_sound_data
120 # define wait_for_sounds nas_wait_for_sounds 109 # define wait_for_sounds nas_wait_for_sounds
121 # define init_play nas_init_play 110 # define init_play nas_init_play
122 # define close_down_play nas_close_down_play 111 # define close_down_play nas_close_down_play
123 112
124 #else /* !emacs */
125 # define warn(str) fprintf (stderr, "%s\n", (str))
126 #endif /* emacs */
127
128 #ifdef XTOOLKIT 113 #ifdef XTOOLKIT
129 # include <X11/Intrinsic.h> 114 # include <X11/Intrinsic.h>
130 # include <audio/Xtutil.h> 115 # include <audio/Xtutil.h>
131 #endif 116 #endif
132 117
136 SIGTYPE sigpipe_handle (int signo); 121 SIGTYPE sigpipe_handle (int signo);
137 #endif 122 #endif
138 123
139 extern Lisp_Object Vsynchronous_sounds; 124 extern Lisp_Object Vsynchronous_sounds;
140 125
141 static Sound SoundOpenDataForReading (unsigned char *data, int length); 126 static Sound SoundOpenDataForReading (UChar_Binary *data, int length);
142 127
143 static AuServer *aud; 128 static AuServer *aud;
144 129
145 /* count of sounds currently being played. */ 130 /* count of sounds currently being played. */
146 static int sounds_in_play; 131 static int sounds_in_play;
148 133
149 #ifdef XTOOLKIT 134 #ifdef XTOOLKIT
150 static Display *aud_server; 135 static Display *aud_server;
151 static XtInputId input_id; 136 static XtInputId input_id;
152 #else 137 #else
153 static char *aud_server; 138 static Extbyte *aud_server;
154 #endif /* XTOOLKIT */ 139 #endif /* XTOOLKIT */
155 140
156 char * 141 Extbyte *
157 init_play ( 142 init_play (
158 #ifdef XTOOLKIT 143 #ifdef XTOOLKIT
159 Display *display 144 Display *display
160 #else 145 #else
161 char *server 146 Extbyte *server
162 #endif 147 #endif
163 ); 148 );
164 char * 149 Extbyte *
165 init_play ( 150 init_play (
166 #ifdef XTOOLKIT 151 #ifdef XTOOLKIT
167 Display *display 152 Display *display
168 #else 153 #else
169 char *server 154 Extbyte *server
170 #endif 155 #endif
171 ) 156 )
172 { 157 {
173 char *err_message; 158 Extbyte *err_message;
174 SIGTYPE (*old_sigpipe) (int); 159 SIGTYPE (*old_sigpipe) (int);
175 160
176 #ifdef XTOOLKIT 161 #ifdef XTOOLKIT
177 char * server = DisplayString (display); 162 Extbyte * server = DisplayString (display);
178 XtAppContext app_context = XtDisplayToApplicationContext (display); 163 XtAppContext app_context = XtDisplayToApplicationContext (display);
179 164
180 aud_server = display; 165 aud_server = display;
181 #else 166 #else
182 167
248 static void 233 static void
249 close_down_play (void) 234 close_down_play (void)
250 235
251 { 236 {
252 AuCloseServer (aud); 237 AuCloseServer (aud);
253 warn ("disconnected from audio server"); 238 sound_warn ("disconnected from audio server");
254 } 239 }
255 240
256 /********************************************************************\ 241 /********************************************************************\
257 * * 242 * *
258 * Callback which is run when the sound finishes playing. * 243 * Callback which is run when the sound finishes playing. *
280 \********************************************************************/ 265 \********************************************************************/
281 266
282 static void 267 static void
283 do_caching_play (Sound s, 268 do_caching_play (Sound s,
284 int volume, 269 int volume,
285 unsigned char *buf) 270 UChar_Binary *buf)
286 271
287 { 272 {
288 AuBucketAttributes *list, b; 273 AuBucketAttributes *list, b;
289 AuBucketID id; 274 AuBucketID id;
290 int n; 275 int n;
303 if ((my_buf= (AuPointer) malloc (SoundNumBytes (s)))==NULL) 288 if ((my_buf= (AuPointer) malloc (SoundNumBytes (s)))==NULL)
304 { 289 {
305 return; 290 return;
306 } 291 }
307 292
308 if (SoundReadFile ((char *) my_buf, SoundNumBytes (s), s) != SoundNumBytes (s)) 293 if (SoundReadFile ((Extbyte *) my_buf, SoundNumBytes (s), s) != SoundNumBytes (s))
309 { 294 {
310 free (my_buf); 295 free (my_buf);
311 return; 296 return;
312 } 297 }
313 } 298 }
356 AuNextEvent (aud, AuTrue, &ev); 341 AuNextEvent (aud, AuTrue, &ev);
357 AuDispatchEvent (aud, &ev); 342 AuDispatchEvent (aud, &ev);
358 } 343 }
359 } 344 }
360 345
361 int play_sound_file (char *sound_file, int volume); 346 int play_sound_file (Extbyte *sound_file, int volume);
362 int 347 int
363 play_sound_file (char *sound_file, 348 play_sound_file (Extbyte *sound_file,
364 int volume) 349 int volume)
365 { 350 {
366 SIGTYPE (*old_sigpipe) (int); 351 SIGTYPE (*old_sigpipe) (int);
367 352
368 #ifdef ROBUST_PLAY 353 #ifdef ROBUST_PLAY
375 #endif 360 #endif
376 361
377 if (aud==NULL) { 362 if (aud==NULL) {
378 if (aud_server != NULL) 363 if (aud_server != NULL)
379 { 364 {
380 char *m; 365 Extbyte *m;
381 /* attempt to reconect */ 366 /* attempt to reconect */
382 if ((m=init_play (aud_server))!= NULL) 367 if ((m=init_play (aud_server))!= NULL)
383 { 368 {
384 369
385 #ifdef ROBUST_PLAY 370 #ifdef ROBUST_PLAY
388 return 0; 373 return 0;
389 } 374 }
390 } 375 }
391 else 376 else
392 { 377 {
393 warn ("Attempt to play with no audio init\n"); 378 sound_warn ("Attempt to play with no audio init\n");
394 #ifdef ROBUST_PLAY 379 #ifdef ROBUST_PLAY
395 signal (SIGPIPE, old_sigpipe); 380 signal (SIGPIPE, old_sigpipe);
396 #endif 381 #endif
397 return 0; 382 return 0;
398 } 383 }
449 #endif 434 #endif
450 435
451 return 1; 436 return 1;
452 } 437 }
453 438
454 int play_sound_data (unsigned char *data, int length, int volume); 439 int play_sound_data (UChar_Binary *data, int length, int volume);
455 int 440 int
456 play_sound_data (unsigned char *data, 441 play_sound_data (UChar_Binary *data,
457 int length, 442 int length,
458 int volume) 443 int volume)
459 { 444 {
460 Sound s; 445 Sound s;
461 int offset; 446 int offset;
476 461
477 462
478 if (aud == NULL) { 463 if (aud == NULL) {
479 if (aud_server != NULL) 464 if (aud_server != NULL)
480 { 465 {
481 char *m; 466 Extbyte *m;
482 /* attempt to reconect */ 467 /* attempt to reconect */
483 if ((m = init_play (aud_server)) != NULL) 468 if ((m = init_play (aud_server)) != NULL)
484 { 469 {
485 #ifdef ROBUST_PLAY 470 #ifdef ROBUST_PLAY
486 signal (SIGPIPE, old_sigpipe); 471 signal (SIGPIPE, old_sigpipe);
488 return 0; 473 return 0;
489 } 474 }
490 } 475 }
491 else 476 else
492 { 477 {
493 warn ("Attempt to play with no audio init\n"); 478 sound_warn ("Attempt to play with no audio init\n");
494 #ifdef ROBUST_PLAY 479 #ifdef ROBUST_PLAY
495 signal (SIGPIPE, old_sigpipe); 480 signal (SIGPIPE, old_sigpipe);
496 #endif 481 #endif
497 return 0; 482 return 0;
498 } 483 }
499 } 484 }
500 485
501 if ((s=SoundOpenDataForReading (data, length))==NULL) 486 if ((s=SoundOpenDataForReading (data, length))==NULL)
502 { 487 {
503 warn ("unknown sound type"); 488 sound_warn ("unknown sound type");
504 #ifdef ROBUST_PLAY 489 #ifdef ROBUST_PLAY
505 signal (SIGPIPE, old_sigpipe); 490 signal (SIGPIPE, old_sigpipe);
506 #endif 491 #endif
507 return 0; 492 return 0;
508 } 493 }
516 { 501 {
517 offset = ((WaveInfo *) (s->formatInfo))->dataOffset; 502 offset = ((WaveInfo *) (s->formatInfo))->dataOffset;
518 } 503 }
519 else 504 else
520 { 505 {
521 warn ("only understand snd and wave files at the moment"); 506 sound_warn ("only understand snd and wave files at the moment");
522 SoundCloseFile (s); 507 SoundCloseFile (s);
523 #ifdef ROBUST_PLAY 508 #ifdef ROBUST_PLAY
524 signal (SIGPIPE, old_sigpipe); 509 signal (SIGPIPE, old_sigpipe);
525 #endif 510 #endif
526 return 0; 511 return 0;
577 562
578 static AuBool 563 static AuBool
579 CatchIoErrorAndJump (AuServer *old_aud) 564 CatchIoErrorAndJump (AuServer *old_aud)
580 { 565 {
581 if (old_aud) 566 if (old_aud)
582 warn ("Audio Server connection broken"); 567 sound_warn ("Audio Server connection broken");
583 else 568 else
584 warn ("Audio Server connection broken because of signal"); 569 sound_warn ("Audio Server connection broken because of signal");
585 570
586 #ifdef XTEVENTS 571 #ifdef XTEVENTS
587 #ifdef XTOOLKIT 572 #ifdef XTOOLKIT
588 { 573 {
589 AuXtAppRemoveAudioHandler (aud, input_id); 574 AuXtAppRemoveAudioHandler (aud, input_id);
635 * * 620 * *
636 \********************************************************************/ 621 \********************************************************************/
637 622
638 /* Create a name from the sound. */ 623 /* Create a name from the sound. */
639 624
640 static char * 625 static Extbyte *
641 NameFromData (const char *buf, 626 NameFromData (const Char_Binary *buf,
642 int len) 627 int len)
643 628
644 { 629 {
645 char name[9]; 630 Extbyte name[9];
646 int i; 631 int i;
647 char *s; 632 Extbyte *s;
648 633
649 buf+=len/2; 634 buf+=len/2;
650 len -= len/2; 635 len -= len/2;
651 636
652 i=0; 637 i=0;
665 650
666 name[i]='\0'; 651 name[i]='\0';
667 652
668 if (i==8) 653 if (i==8)
669 { 654 {
670 strcpy (s = (char *) malloc (10), name); 655 strcpy (s = (Extbyte *) malloc (10), name);
671 } 656 }
672 else 657 else
673 { 658 {
674 strcpy (s = (char *) malloc (15), "short sound"); 659 strcpy (s = (Extbyte *) malloc (15), "short sound");
675 } 660 }
676 661
677 return s; 662 return s;
678 } 663 }
679 664
680 /* Code to do a pseudo-open on a data buffer. Only for snd files at the 665 /* Code to do a pseudo-open on a data buffer. Only for snd files at the
681 moment. 666 moment.
682 */ 667 */
683 668
684 static SndInfo * 669 static SndInfo *
685 SndOpenDataForReading (const char *data, 670 SndOpenDataForReading (const Char_Binary *data,
686 int length) 671 int length)
687 672
688 { 673 {
689 SndInfo *si; 674 SndInfo *si;
690 int size; 675 int size;
697 682
698 memcpy (&si->h, data, sizeof (SndHeader)); 683 memcpy (&si->h, data, sizeof (SndHeader));
699 684
700 if (NAS_LITTLE_ENDIAN) 685 if (NAS_LITTLE_ENDIAN)
701 { 686 {
702 char n; 687 Char_Binary n;
703 688
704 swapl (&si->h.magic, n); 689 swapl (&si->h.magic, n);
705 swapl (&si->h.dataOffset, n); 690 swapl (&si->h.dataOffset, n);
706 swapl (&si->h.dataSize, n); 691 swapl (&si->h.dataSize, n);
707 swapl (&si->h.format, n); 692 swapl (&si->h.format, n);
717 702
718 size = si->h.dataOffset - sizeof (SndHeader); 703 size = si->h.dataOffset - sizeof (SndHeader);
719 704
720 if (size) 705 if (size)
721 { 706 {
722 if (!(si->comment = (char *) malloc (size + 1))) 707 if (!(si->comment = (Extbyte *) malloc (size + 1)))
723 { 708 {
724 free (si); 709 free (si);
725 return NULL; 710 return NULL;
726 } 711 }
727 712
746 read wave data from memory, so these functions do that for us. */ 731 read wave data from memory, so these functions do that for us. */
747 732
748 #define Err() { return NULL; } 733 #define Err() { return NULL; }
749 #define readFourcc(_f) dread(_f, sizeof(RIFF_FOURCC), 1) 734 #define readFourcc(_f) dread(_f, sizeof(RIFF_FOURCC), 1)
750 #define cmpID(_x, _y) \ 735 #define cmpID(_x, _y) \
751 strncmp((char *) (_x), (char *) (_y), sizeof(RIFF_FOURCC)) 736 strncmp((Char_Binary *) (_x), (Char_Binary *) (_y), sizeof(RIFF_FOURCC))
752 #define PAD2(_x) (((_x) + 1) & ~1) 737 #define PAD2(_x) (((_x) + 1) & ~1)
753 738
754 /* These functions here are for faking file I/O from buffer. */ 739 /* These functions here are for faking file I/O from buffer. */
755 740
756 /* The "file" position */ 741 /* The "file" position */
775 { 760 {
776 size_t nread = size * nitems; 761 size_t nread = size * nitems;
777 762
778 if (file_posn + nread <= file_len) 763 if (file_posn + nread <= file_len)
779 { 764 {
780 memcpy(buf, (char *) file_data + file_posn, size * nitems); 765 memcpy(buf, (Char_Binary *) file_data + file_posn, size * nitems);
781 file_posn += nread; 766 file_posn += nread;
782 return nitems; 767 return nitems;
783 } 768 }
784 else 769 else
785 { 770 {
790 /* Like fgetc, but for a buffer in memory */ 775 /* Like fgetc, but for a buffer in memory */
791 static int 776 static int
792 dgetc (void) 777 dgetc (void)
793 { 778 {
794 if (file_posn < file_len) 779 if (file_posn < file_len)
795 return ((char *)file_data)[file_posn++]; 780 return ((Char_Binary *)file_data)[file_posn++];
796 else 781 else
797 return -1; 782 return -1;
798 } 783 }
799 784
800 /* Like fseek, but for a buffer in memory */ 785 /* Like fseek, but for a buffer in memory */
844 829
845 static int 830 static int
846 readChunk (RiffChunk *c) 831 readChunk (RiffChunk *c)
847 { 832 {
848 int status; 833 int status;
849 char n; 834 Char_Binary n;
850 835
851 if ((status = dread(c, sizeof(RiffChunk), 1))) 836 if ((status = dread(c, sizeof(RiffChunk), 1)))
852 if (NAS_BIG_ENDIAN) 837 if (NAS_BIG_ENDIAN)
853 swapl(&c->ckSize, n); 838 swapl(&c->ckSize, n);
854 839
857 842
858 /* A very straight-forward translation of WaveOpenFileForReading to 843 /* A very straight-forward translation of WaveOpenFileForReading to
859 read the wave data from a buffer in memory. */ 844 read the wave data from a buffer in memory. */
860 845
861 static WaveInfo * 846 static WaveInfo *
862 WaveOpenDataForReading (const char *data, 847 WaveOpenDataForReading (const Char_Binary *data,
863 int length) 848 int length)
864 { 849 {
865 RiffChunk ck; 850 RiffChunk ck;
866 RIFF_FOURCC fourcc; 851 RIFF_FOURCC fourcc;
867 AuInt32 fileSize; 852 AuInt32 fileSize;
910 Err(); 895 Err();
911 896
912 /* ICMT chunk */ 897 /* ICMT chunk */
913 if (!cmpID(&c.ckID, RIFF_InfoIcmtID)) 898 if (!cmpID(&c.ckID, RIFF_InfoIcmtID))
914 { 899 {
915 if (!(wi->comment = (char *) malloc(c.ckSize)) || 900 if (!(wi->comment = (Extbyte *) malloc(c.ckSize)) ||
916 !dread(wi->comment, c.ckSize, 1)) 901 !dread(wi->comment, c.ckSize, 1))
917 Err(); 902 Err();
918 903
919 if (c.ckSize & 1) 904 if (c.ckSize & 1)
920 dgetc(); /* eat the pad byte */ 905 dgetc(); /* eat the pad byte */
991 return wi; 976 return wi;
992 } 977 }
993 978
994 979
995 static Sound 980 static Sound
996 SoundOpenDataForReading (unsigned char *data, 981 SoundOpenDataForReading (UChar_Binary *data,
997 int length) 982 int length)
998 983
999 { 984 {
1000 Sound s; 985 Sound s;
1001 986
1002 if (!(s = (Sound) malloc (sizeof (SoundRec)))) 987 if (!(s = (Sound) malloc (sizeof (SoundRec))))
1003 return NULL; 988 return NULL;
1004 989
1005 if ((s->formatInfo = SndOpenDataForReading ((char *) data, length)) != NULL) 990 if ((s->formatInfo = SndOpenDataForReading ((Char_Binary *) data, length)) != NULL)
1006 { 991 {
1007 if (!((int(*)(Sound))(SoundFileInfo[SoundFileFormatSnd].toSound)) (s)) 992 if (!((int(*)(Sound))(SoundFileInfo[SoundFileFormatSnd].toSound)) (s))
1008 { 993 {
1009 SndCloseFile ((SndInfo *) (s->formatInfo)); 994 SndCloseFile ((SndInfo *) (s->formatInfo));
1010 free (s); 995 free (s);
1011 return NULL; 996 return NULL;
1012 } 997 }
1013 } 998 }
1014 else if ((s->formatInfo = WaveOpenDataForReading ((char *) data, length)) != NULL) 999 else if ((s->formatInfo = WaveOpenDataForReading ((Char_Binary *) data, length)) != NULL)
1015 { 1000 {
1016 if (!((int(*)(Sound))(SoundFileInfo[SoundFileFormatWave].toSound)) (s)) 1001 if (!((int(*)(Sound))(SoundFileInfo[SoundFileFormatWave].toSound)) (s))
1017 { 1002 {
1018 WaveCloseFile ((WaveInfo *) (s->formatInfo)); 1003 WaveCloseFile ((WaveInfo *) (s->formatInfo));
1019 free (s); 1004 free (s);