>>>> "Ray" == Raymond Toy
<toy(a)rtp.ericsson.se> writes:
>>>> "Martin" == Martin Buchholz
<martin(a)xemacs.org> writes:
>>>> "Jan" == Jan Vroonhof <vroonhof(a)math.ethz.ch> writes:
Jan> Raymond Toy <toy(a)rtp.ericsson.se> writes:
>>> >> Why can't we reliably detect NAS? Isn't
the existence of a few
>>> >> include files and libaudio enough?
Jan> I now remember another reason why this is probably not autodetected at
Jan> the moment (but which is no longer valid). It used to be that NAS
Jan> always was a thing you had to install yourself and thus was never in
Jan> any obvious location. However on modern Free Unix'es that is no longer
Jan> the case.
>>> Why would you have to do that? Wouldn't configure
just try to compile
>>> something like
Jan> You are right...
Martin> I put in some brief work to get NAS working, but...
Martin> - it's no longer maintained.
Ray> There's nas 1.3 out now. Someone did pick up nas, but the mailing
Ray> list has been relatively quiet.
It's very well hidden. I couldn't find it.
The mailing list archives have nothing from 1999.
Martin> - it seems like there's a new wave of Sound support coming with ESD.
Ray> Any web pointers to ESD? I hope they're not just reinventing the
Ray> wheel.
Any web pointers to the new NAS?
I don't do sound.
I try to maintain a list of pointers at
ftp://ftp.xemacs.org/pub/xemacs/aux/README.aux.
ftp://ftp.x.org/contrib/audio/nas/
http://www.tux.org/~ricdude/EsounD.html
Martin> So I'm not going to do any more work on NAS configure support.
Martin> Someone who cares can do it.
Ray> Is there anyone else using NAS besides me? If not, I guess NAS and
Ray> xemacs is basically dead. Too bad.
Well, `configure --with-nas' works, right?
Raymond, because you *really* care, I did some more work on NAS.
I succeeded in building it on Solaris, but not on Linux. It basically
requires a guru to build and install the software.
- I had to remove the #defines of bcmp and bzero, etc... to avoid a
compile error after #including strings.h.
- I had to fix a basic compile error (incompatible pointer types) in
one of the source files.
- Building with GNU make doesn't seem to work, although more and more,
it is the free software standard. I had to use Sun make.
This is actually also an indictment of X11 in general.
autoconf/configure is really ugly, but it does work.
Note that the NAS header files are not C++-compatible, since they
don't use full prototypes, which is a no-no for modern libraries.
NAS needs a maintainer.
But just to prove that I do occasionally listen to my users, here is a
new NAS patch with autodetecting configure support and warning fixes:
(Oh, and Raymond, I expect you to actually use this...)
ChangeLog:
1999-12-13 Martin Buchholz <martin(a)xemacs.org>
* configure.in:
* configure.usage:
- Autodetect NAS. Change Docs accordingly.
* configure.in: Warn if configure --with-xpm --without-x11.
src/ChangeLog:
1999-12-13 Martin Buchholz <martin(a)xemacs.org>
* nas.c: Fix compiler warnings. Ansify. C++ compilation support.
Index: configure.usage
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/configure.usage,v
retrieving revision 1.17.2.12
diff -u -w -r1.17.2.12 configure.usage
--- configure.usage 1999/11/20 19:45:45 1.17.2.12
+++ configure.usage 1999/12/14 00:58:31
@@ -124,8 +124,10 @@
--with-sound=TYPE,[TYPE],... Compile with native sound support.
Valid types are `native', `nas' and `esd'.
Prefix a type with 'no' to disable.
- The first option can be `none' or `all' to change
- the default which is: native,esd
+ The first option can be `none' or `all'.
+ `none' is a synonym for `nonative,nonas,noesd'.
+ `all' is a synonym for native,nas,esd or `all'.
+ The default is to autodetect all sound support.
--native-sound-lib=LIB Native sound support library. Needed on Suns
with --with-sound=both because both sound libraries
are called libaudio.
Index: configure.in
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/configure.in,v
retrieving revision 1.111.2.54
diff -u -w -r1.111.2.54 configure.in
--- configure.in 1999/12/11 00:26:34 1.111.2.54
+++ configure.in 1999/12/14 00:58:35
@@ -627,7 +627,7 @@
types="\`all', \`none', \`(no)native', \`no(nas)',
\`(no)esd'."
USAGE_ERROR(["Valid types for the \`--$optname' option are:
$types.
-The default is native,esd."])
+The default is to autodetect all sound support."])
elif test -n "$new_sdefault" ; then
with_native_sound=$new_sdefault
with_nas_sound=$new_sdefault
@@ -2568,7 +2568,7 @@
dnl if test "$with_tty" = "no" ; then
dnl AC_MSG_ERROR([No window system support and no TTY support - Unable to proceed.])
dnl fi
- for feature in tooltalk cde offix wmcommand xim xmu
+ for feature in tooltalk cde offix wmcommand xim xmu xpm nas_sound
do
if eval "test -n \"\$with_${feature}\" -a
\"\$with_${feature}\" != no" ; then
AC_MSG_WARN([--with-$feature ignored: Not valid without X support])
@@ -3008,12 +3008,6 @@
test "$with_dialogs" != "no" &&
XE_ADD_OBJS(dialog-x.o)
test "$with_toolbars" != "no" &&
XE_ADD_OBJS(toolbar-x.o)
test "$all_widgets" != "no no no no no" &&
XE_ADD_OBJS(gui-x.o)
-else
- if test "$with_nas_sound" = "nas"; then
- echo "Attempt to Build NAS sound without X"
- echo "Please remove NAS configuration or build with X"
- exit 1
- fi
fi
dnl ----------------------
@@ -3470,13 +3464,23 @@
test -n "$native_sound_lib" && XE_PREPEND($native_sound_lib, LIBS)
fi
-if test "$with_nas_sound" = "yes"; then
+dnl NAS Sound support
+if test "$with_nas_sound" != "no"; then
+ AC_CHECK_HEADER(audio/audiolib.h, [
+ AC_CHECK_LIB(audio, AuOpenServer, have_nas_sound=yes)])
+ if test "$have_nas_sound" = "yes"; then
+ with_nas_sound=yes
AC_DEFINE(HAVE_NAS_SOUND)
XE_ADD_OBJS(nas.o)
XE_PREPEND(-laudio, libs_x)
dnl If the nas library does not contain the error jump point,
dnl then we force safer behavior.
AC_EGREP_HEADER(AuXtErrorJump,audio/Xtutil.h,,[old_nas=yes;
AC_DEFINE(NAS_NO_ERROR_JUMP)])
+ else
+ test "$with_nas_sound" = "yes" && \
+ XE_DIE("Required NAS sound support cannot be provided.")
+ with_nas_sound=no
+ fi
fi
dnl ESD Sound support
Index: src/nas.c
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/src/nas.c,v
retrieving revision 1.4.2.2
diff -u -w -r1.4.2.2 nas.c
--- nas.c 1998/12/05 16:56:10 1.4.2.2
+++ nas.c 1999/12/14 00:58:39
@@ -146,10 +146,18 @@
#else
char *server
#endif
+ );
+char *
+init_play (
+#ifdef XTOOLKIT
+ Display *display
+#else
+ char *server
+#endif
)
{
char *err_message;
- SIGTYPE (*old_sigpipe) ();
+ SIGTYPE (*old_sigpipe) (int);
#ifdef XTOOLKIT
char * server = DisplayString (display);
@@ -223,7 +231,7 @@
return NULL;
}
-void
+static void
close_down_play (void)
{
@@ -238,7 +246,7 @@
\********************************************************************/
static void
-doneCB (AuServer *aud,
+doneCB (AuServer *auserver,
AuEventHandlerRec *handler,
AuEvent *ev,
AuPointer data)
@@ -274,23 +282,23 @@
if (list == NULL)
{
- unsigned char *my_buf;
+ AuPointer my_buf;
if (buf==NULL)
{
- if ((my_buf=malloc (SoundNumBytes (s)))==NULL)
+ if ((my_buf= (AuPointer) malloc (SoundNumBytes (s)))==NULL)
{
return;
}
- if (SoundReadFile (my_buf, SoundNumBytes (s), s) != SoundNumBytes (s))
+ if (SoundReadFile ((char *) my_buf, SoundNumBytes (s), s) != SoundNumBytes (s))
{
free (my_buf);
return;
}
}
else
- my_buf=buf;
+ my_buf = (AuPointer) buf;
id = AuSoundCreateBucketFromData (aud,
s,
@@ -322,6 +330,7 @@
#endif /* CACHE_SOUNDS */
+void wait_for_sounds (void);
void
wait_for_sounds (void)
@@ -335,11 +344,12 @@
}
}
+int play_sound_file (char *sound_file, int volume);
int
play_sound_file (char *sound_file,
int volume)
{
- SIGTYPE (*old_sigpipe) ();
+ SIGTYPE (*old_sigpipe) (int);
#ifdef ROBUST_PLAY
old_sigpipe=signal (SIGPIPE, sigpipe_handle);
@@ -427,6 +437,7 @@
return 1;
}
+int play_sound_data (unsigned char *data, int length, int volume);
int
play_sound_data (unsigned char *data,
int length,
@@ -434,7 +445,7 @@
{
Sound s;
int offset;
- SIGTYPE (*old_sigpipe) ();
+ SIGTYPE (*old_sigpipe) (int);
#if !defined (XTEVENTS)
AuEvent ev;
@@ -613,11 +624,11 @@
/* Create a name from the sound. */
static char *
-NameFromData (CONST unsigned char *buf,
+NameFromData (CONST char *buf,
int len)
{
- unsigned char name[9];
+ char name[9];
int i;
char *s;
@@ -642,11 +653,11 @@
if (i==8)
{
- strcpy (s=malloc (10), name);
+ strcpy (s = (char *) malloc (10), name);
}
else
{
- strcpy (s=malloc (15), "short sound");
+ strcpy (s = (char *) malloc (15), "short sound");
}
return s;
@@ -729,15 +740,15 @@
/* These functions here are for faking file I/O from buffer. */
/* The "file" position */
-static int file_posn;
+static size_t file_posn;
/* The length of the "file" */
-static int file_len;
+static size_t file_len;
/* The actual "file" data. */
-CONST static char* file_data;
+static CONST void* file_data;
/* Like fopen, but for a buffer in memory */
static void
-dopen(CONST char* data, int length)
+dopen (CONST void* data, size_t length)
{
file_data = data;
file_len = length;
@@ -746,15 +757,13 @@
/* Like fread, but for a buffer in memory */
static int
-dread(char* buf, int size, int nitems)
+dread (void* buf, size_t size, size_t nitems)
{
- int nread;
+ size_t nread = size * nitems;
- nread = size * nitems;
-
if (file_posn + nread <= file_len)
{
- memcpy(buf, file_data + file_posn, size * nitems);
+ memcpy(buf, (char *) file_data + file_posn, size * nitems);
file_posn += nread;
return nitems;
}
@@ -766,12 +775,10 @@
/* Like fgetc, but for a buffer in memory */
static int
-dgetc()
+dgetc (void)
{
- int ch;
-
if (file_posn < file_len)
- return file_data[file_posn++];
+ return ((char *)file_data)[file_posn++];
else
return -1;
}
@@ -791,7 +798,7 @@
}
/* Like ftell, but for a buffer in memory */
-static int
+static long
dtell()
{
return file_posn;
@@ -981,20 +988,20 @@
if (!(s = (Sound) malloc (sizeof (SoundRec))))
return NULL;
- if ((s->formatInfo = SndOpenDataForReading (data, length)) != NULL)
+ if ((s->formatInfo = SndOpenDataForReading ((char *) data, length)) != NULL)
{
- if (!(SoundFileInfo[SoundFileFormatSnd].toSound) (s))
+ if (!((int(*)(Sound))(SoundFileInfo[SoundFileFormatSnd].toSound)) (s))
{
- SndCloseFile (s->formatInfo);
+ SndCloseFile ((SndInfo *) (s->formatInfo));
free (s);
return NULL;
}
}
- else if ((s->formatInfo = WaveOpenDataForReading (data, length)) != NULL)
+ else if ((s->formatInfo = WaveOpenDataForReading ((char *) data, length)) != NULL)
{
- if (!(SoundFileInfo[SoundFileFormatWave].toSound) (s))
+ if (!((int(*)(Sound))(SoundFileInfo[SoundFileFormatWave].toSound)) (s))
{
- WaveCloseFile (s->formatInfo);
+ WaveCloseFile ((WaveInfo *) (s->formatInfo));
free (s);
return NULL;
}
@@ -1002,4 +1009,3 @@
return s;
}
-