X-Git-Url: http://git.chise.org/gitweb/?p=chise%2Fxemacs-chise.git.1;a=blobdiff_plain;f=src%2Fnas.c;h=324921833f7a6ad66fceb1e04455fed7bf4f470f;hp=7fe1295fc48d2765b68143c3e1c1964e7fc76b98;hb=ac7d0619aad74b1d57c4748ebb3ab29d9c32e3d8;hpb=dbf2768f7b146e97e37a27316f70bb313f1acf15 diff --git a/src/nas.c b/src/nas.c index 7fe1295..3249218 100644 --- a/src/nas.c +++ b/src/nas.c @@ -50,6 +50,12 @@ * 4/11/94, rjc Added wait_for_sounds to be called when user wants to * be sure all play has finished. * 1998-10-01 rlt Added support for WAVE files. + * 2002-10-16 Jon Trulson modifed this to work with NAS releases + * 1.5f and higher. We were using the private variable + * SoundFileInfo that doesn't exist anymore. But preserve + * backward compatibility. This will not work for some + * versions of NAS around 1.5b to 1.5f or so. Known to + * work on 1.2p5 and 1.6. */ #ifdef emacs @@ -998,13 +1004,28 @@ SoundOpenDataForReading (unsigned char *data, { Sound s; +#if (AudioLibraryVersionMajor >= 2 ) && (AudioLibraryVersionMinor >= 3) + SoundFileInfoProc toProc; +#endif if (!(s = (Sound) malloc (sizeof (SoundRec)))) return NULL; if ((s->formatInfo = SndOpenDataForReading ((char *) data, length)) != NULL) { +#if (AudioLibraryVersionMajor >= 2 ) && (AudioLibraryVersionMinor >= 3) + if ((toProc = SoundFileGetProc(SoundFileFormatSnd, + SoundFileInfoProcTo)) == NULL) + { + SndCloseFile ((SndInfo *) (s->formatInfo)); + free (s); + + return NULL; + } + if (!((*toProc)(s))) +#else if (!((int(*)(Sound))(SoundFileInfo[SoundFileFormatSnd].toSound)) (s)) +#endif { SndCloseFile ((SndInfo *) (s->formatInfo)); free (s); @@ -1013,7 +1034,19 @@ SoundOpenDataForReading (unsigned char *data, } else if ((s->formatInfo = WaveOpenDataForReading ((char *) data, length)) != NULL) { +#if (AudioLibraryVersionMajor >= 2 ) && (AudioLibraryVersionMinor >= 3) + if ((toProc = SoundFileGetProc(SoundFileFormatWave, + SoundFileInfoProcTo)) == NULL) + { + WaveCloseFile ((WaveInfo *) (s->formatInfo)); + free (s); + + return NULL; + } + if (!((*toProc)(s))) +#else if (!((int(*)(Sound))(SoundFileInfo[SoundFileFormatWave].toSound)) (s)) +#endif { WaveCloseFile ((WaveInfo *) (s->formatInfo)); free (s);