x11/enlightenment (e16) sndio backend

2012-11-28 Thread Jonathan Armani
Hi,

Diff that implement an sndio backend to e16
Lightly tested and sounds still works, can a daily e16 user confirm it ?

With input from brad@, thanks !


Index: Makefile
===
RCS file: /cvs/ports/x11/enlightenment/Makefile,v
retrieving revision 1.60
diff -u -p -r1.60 Makefile
--- Makefile1 Sep 2012 14:36:58 -   1.60
+++ Makefile28 Nov 2012 09:28:02 -
@@ -7,7 +7,7 @@ DISTNAME=   e16-$V
 PKGNAME=   enlightenment-$V
 DOCS=  e16-docs-0.16.8.0.2
 THEMES=e16-themes-1.0.1
-REVISION=  0
+REVISION=  1
 
 CATEGORIES=x11
 
@@ -22,7 +22,7 @@ PERMIT_DISTFILES_CDROM=   Yes
 PERMIT_DISTFILES_FTP=  Yes
 
 WANTLIB += ICE Imlib2 SM X11 Xcomposite Xdamage Xext Xfixes Xft
-WANTLIB += Xinerama Xrandr Xrender audiofile c esd expat ffi fontconfig
+WANTLIB += Xinerama Xrandr Xrender audiofile c expat ffi fontconfig
 WANTLIB += freetype glib-2.0 gmodule-2.0 gobject-2.0 gthread-2.0
 WANTLIB += m pango-1.0 pangoft2-1.0 pangoxft-1.0 pcre pthread
 WANTLIB += sndio xcb z
@@ -34,10 +34,16 @@ DISTFILES=  ${DISTNAME}.tar.gz \
${THEMES}.tar.gz
 
 MODULES=   devel/gettext
-LIB_DEPENDS=   audio/esound \
-   graphics/imlib2 \
-   devel/glib2 \
-   devel/pango
+
+AUTOCONF_VERSION=  2.65
+AUTOMAKE_VERSION=  1.11
+BUILD_DEPENDS= ${MODGNU_AUTOCONF_DEPENDS} \
+   ${MODGNU_AUTOMAKE_DEPENDS}
+
+LIB_DEPENDS=   devel/glib2 \
+   devel/libaudiofile \
+   devel/pango \
+   graphics/imlib2
 
 RUN_DEPENDS=   devel/desktop-file-utils
 
@@ -47,8 +53,22 @@ USE_GMAKE=   Yes
 USE_LIBTOOL=   Yes
 
 CONFIGURE_STYLE= gnu
+CONFIGURE_ARGS+= --disable-sound_esound
 CONFIGURE_ENV= CPPFLAGS=-I${X11BASE}/include -I${LOCALBASE}/include \
LDFLAGS=-L${X11BASE}/lib -L${LOCALBASE}/lib
+
+post-extract:
+   cp -f ${FILESDIR}/sound_sndio.c ${WRKSRC}/src
+
+pre-configure:
+   cd ${WRKSRC}  env AUTOCONF_VERSION=${AUTOCONF_VERSION} \
+   AUTOMAKE_VERSION=${AUTOMAKE_VERSION} aclocal -I m4
+   cd ${WRKSRC}  env AUTOCONF_VERSION=${AUTOCONF_VERSION} \
+   AUTOMAKE_VERSION=${AUTOMAKE_VERSION} autoconf
+   cd ${WRKSRC}  env AUTOCONF_VERSION=${AUTOCONF_VERSION} \
+   AUTOMAKE_VERSION=${AUTOMAKE_VERSION} autoheader
+   cd ${WRKSRC}  env AUTOCONF_VERSION=${AUTOCONF_VERSION} \
+   AUTOMAKE_VERSION=${AUTOMAKE_VERSION} automake
 
 post-configure:
@cd ${WRKDIR}/${DOCS}  ${SETENV} ${CONFIGURE_ENV} \
Index: files/sound_sndio.c
===
RCS file: files/sound_sndio.c
diff -N files/sound_sndio.c
--- /dev/null   1 Jan 1970 00:00:00 -
+++ files/sound_sndio.c 28 Nov 2012 09:28:02 -
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2012 Jonathan Armani arm...@openbsd.org
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include E.h
+#if defined(HAVE_SOUND)  defined(HAVE_SOUND_SNDIO)
+#include sound.h
+#include sndio.h
+
+#ifdef USE_MODULES
+#define Estrdup strdup
+#endif
+
+struct _sample {
+   SoundSampleData ssd;
+};
+
+static struct sio_hdl * hdl;
+
+static Sample  *
+_sound_sndio_Load(const char *file)
+{
+   Sample *s;
+   int err;
+
+   if (hdl == NULL)
+  return NULL;
+
+   s = ECALLOC(Sample, 1);
+   if (!s)
+  return NULL;
+
+   err = SoundSampleGetData(file, s-ssd);
+   if (err)
+ {
+   Efree(s);
+   return NULL;
+ }
+
+   return s;
+}
+
+static void
+_sound_sndio_Destroy(Sample * s)
+{
+   if (!s)
+  return;
+
+   _EFREE(s-ssd.data);
+   Efree(s);
+}
+
+static void
+_sound_sndio_Play(Sample * s)
+{
+   struct sio_par params;
+   if (hdl == NULL || !s)
+  return;
+
+   sio_initpar(params); 
+   params.bits = s-ssd.bit_per_sample;
+   params.pchan = s-ssd.channels;
+   params.rate = s-ssd.rate;
+
+   if (!sio_setpar(hdl, params))
+  return;
+   if (!sio_getpar(hdl, params))
+  return;
+   if (params.bits != s-ssd.bit_per_sample ||
+ params.pchan != s-ssd.channels ||
+params.rate != s-ssd.rate)
+  return;
+
+   if (!sio_start(hdl))
+  return;
+
+   sio_write(hdl, s-ssd.data, s-ssd.size);
+   sio_stop(hdl);
+}
+
+static int

Re: x11/enlightenment (e16) sndio backend

2012-11-28 Thread Amit Kulkarni
On Wed, Nov 28, 2012 at 6:15 AM, Jonathan Armani d...@asystant.net wrote:
 Hi,

 Diff that implement an sndio backend to e16
 Lightly tested and sounds still works, can a daily e16 user confirm it ?

 With input from brad@, thanks !

I will differ to ratchov@ for the diff. I haven't dived yet in the
setup of sound on the OpenBSD machine.

thanks


 Index: Makefile
 ===
 RCS file: /cvs/ports/x11/enlightenment/Makefile,v
 retrieving revision 1.60
 diff -u -p -r1.60 Makefile
 --- Makefile1 Sep 2012 14:36:58 -   1.60
 +++ Makefile28 Nov 2012 09:28:02 -
 @@ -7,7 +7,7 @@ DISTNAME=   e16-$V
  PKGNAME=   enlightenment-$V
  DOCS=  e16-docs-0.16.8.0.2
  THEMES=e16-themes-1.0.1
 -REVISION=  0
 +REVISION=  1

  CATEGORIES=x11

 @@ -22,7 +22,7 @@ PERMIT_DISTFILES_CDROM=   Yes
  PERMIT_DISTFILES_FTP=  Yes

  WANTLIB += ICE Imlib2 SM X11 Xcomposite Xdamage Xext Xfixes Xft
 -WANTLIB += Xinerama Xrandr Xrender audiofile c esd expat ffi fontconfig
 +WANTLIB += Xinerama Xrandr Xrender audiofile c expat ffi fontconfig
  WANTLIB += freetype glib-2.0 gmodule-2.0 gobject-2.0 gthread-2.0
  WANTLIB += m pango-1.0 pangoft2-1.0 pangoxft-1.0 pcre pthread
  WANTLIB += sndio xcb z
 @@ -34,10 +34,16 @@ DISTFILES=  ${DISTNAME}.tar.gz \
 ${THEMES}.tar.gz

  MODULES=   devel/gettext
 -LIB_DEPENDS=   audio/esound \
 -   graphics/imlib2 \
 -   devel/glib2 \
 -   devel/pango
 +
 +AUTOCONF_VERSION=  2.65
 +AUTOMAKE_VERSION=  1.11
 +BUILD_DEPENDS= ${MODGNU_AUTOCONF_DEPENDS} \
 +   ${MODGNU_AUTOMAKE_DEPENDS}
 +
 +LIB_DEPENDS=   devel/glib2 \
 +   devel/libaudiofile \
 +   devel/pango \
 +   graphics/imlib2

  RUN_DEPENDS=   devel/desktop-file-utils

 @@ -47,8 +53,22 @@ USE_GMAKE=   Yes
  USE_LIBTOOL=   Yes

  CONFIGURE_STYLE= gnu
 +CONFIGURE_ARGS+= --disable-sound_esound
  CONFIGURE_ENV= CPPFLAGS=-I${X11BASE}/include -I${LOCALBASE}/include \
 LDFLAGS=-L${X11BASE}/lib -L${LOCALBASE}/lib
 +
 +post-extract:
 +   cp -f ${FILESDIR}/sound_sndio.c ${WRKSRC}/src
 +
 +pre-configure:
 +   cd ${WRKSRC}  env AUTOCONF_VERSION=${AUTOCONF_VERSION} \
 +   AUTOMAKE_VERSION=${AUTOMAKE_VERSION} aclocal -I m4
 +   cd ${WRKSRC}  env AUTOCONF_VERSION=${AUTOCONF_VERSION} \
 +   AUTOMAKE_VERSION=${AUTOMAKE_VERSION} autoconf
 +   cd ${WRKSRC}  env AUTOCONF_VERSION=${AUTOCONF_VERSION} \
 +   AUTOMAKE_VERSION=${AUTOMAKE_VERSION} autoheader
 +   cd ${WRKSRC}  env AUTOCONF_VERSION=${AUTOCONF_VERSION} \
 +   AUTOMAKE_VERSION=${AUTOMAKE_VERSION} automake

  post-configure:
 @cd ${WRKDIR}/${DOCS}  ${SETENV} ${CONFIGURE_ENV} \
 Index: files/sound_sndio.c
 ===
 RCS file: files/sound_sndio.c
 diff -N files/sound_sndio.c
 --- /dev/null   1 Jan 1970 00:00:00 -
 +++ files/sound_sndio.c 28 Nov 2012 09:28:02 -
 @@ -0,0 +1,121 @@
 +/*
 + * Copyright (c) 2012 Jonathan Armani arm...@openbsd.org
 + *
 + * Permission to use, copy, modify, and distribute this software for any
 + * purpose with or without fee is hereby granted, provided that the above
 + * copyright notice and this permission notice appear in all copies.
 + *
 + * THE SOFTWARE IS PROVIDED AS IS AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 + */
 +
 +#include E.h
 +#if defined(HAVE_SOUND)  defined(HAVE_SOUND_SNDIO)
 +#include sound.h
 +#include sndio.h
 +
 +#ifdef USE_MODULES
 +#define Estrdup strdup
 +#endif
 +
 +struct _sample {
 +   SoundSampleData ssd;
 +};
 +
 +static struct sio_hdl * hdl;
 +
 +static Sample  *
 +_sound_sndio_Load(const char *file)
 +{
 +   Sample *s;
 +   int err;
 +
 +   if (hdl == NULL)
 +  return NULL;
 +
 +   s = ECALLOC(Sample, 1);
 +   if (!s)
 +  return NULL;
 +
 +   err = SoundSampleGetData(file, s-ssd);
 +   if (err)
 + {
 +   Efree(s);
 +   return NULL;
 + }
 +
 +   return s;
 +}
 +
 +static void
 +_sound_sndio_Destroy(Sample * s)
 +{
 +   if (!s)
 +  return;
 +
 +   _EFREE(s-ssd.data);
 +   Efree(s);
 +}
 +
 +static void
 +_sound_sndio_Play(Sample * s)
 +{
 +   struct sio_par params;
 +   if (hdl == NULL || !s)
 +  return;
 +
 +   sio_initpar(params);
 +   params.bits = s-ssd.bit_per_sample;
 +   params.pchan = s-ssd.channels;
 +   params.rate = s-ssd.rate;
 +
 +   if (!sio_setpar(hdl, params))
 

Re: x11/enlightenment (e16) sndio backend

2012-11-28 Thread Amit Kulkarni
On Wed, 28 Nov 2012 13:15:41 +0100
Jonathan Armani d...@asystant.net wrote:

 Hi,
 
 Diff that implement an sndio backend to e16
 Lightly tested and sounds still works, can a daily e16 user confirm it ?
 
 With input from brad@, thanks !

just adding some WANTLIB and distinfo on top of your diff. no problems 
otherwise.

thanks

? enlight.diff
Index: Makefile
===
RCS file: /cvs/ports/x11/enlightenment/Makefile,v
retrieving revision 1.60
diff -u -p -r1.60 Makefile
--- Makefile1 Sep 2012 14:36:58 -   1.60
+++ Makefile28 Nov 2012 20:14:05 -
@@ -7,7 +7,7 @@ DISTNAME=   e16-$V
 PKGNAME=   enlightenment-$V
 DOCS=  e16-docs-0.16.8.0.2
 THEMES=e16-themes-1.0.1
-REVISION=  0
+REVISION=  1
 
 CATEGORIES=x11
 
@@ -22,10 +22,10 @@ PERMIT_DISTFILES_CDROM= Yes
 PERMIT_DISTFILES_FTP=  Yes
 
 WANTLIB += ICE Imlib2 SM X11 Xcomposite Xdamage Xext Xfixes Xft
-WANTLIB += Xinerama Xrandr Xrender audiofile c esd expat ffi fontconfig
+WANTLIB += Xinerama Xrandr Xrender audiofile c expat ffi fontconfig
 WANTLIB += freetype glib-2.0 gmodule-2.0 gobject-2.0 gthread-2.0
-WANTLIB += m pango-1.0 pangoft2-1.0 pangoxft-1.0 pcre pthread
-WANTLIB += sndio xcb z
+WANTLIB += harfbuzz icudata icule icuuc m pango-1.0 pangoft2-1.0
+WANTLIB += pangoxft-1.0 pcre pthread sndio xcb z
 
 MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=enlightenment/}
 
@@ -34,10 +34,16 @@ DISTFILES=  ${DISTNAME}.tar.gz \
${THEMES}.tar.gz
 
 MODULES=   devel/gettext
-LIB_DEPENDS=   audio/esound \
-   graphics/imlib2 \
-   devel/glib2 \
-   devel/pango
+
+AUTOCONF_VERSION=  2.65
+AUTOMAKE_VERSION=  1.11
+BUILD_DEPENDS= ${MODGNU_AUTOCONF_DEPENDS} \
+   ${MODGNU_AUTOMAKE_DEPENDS}
+
+LIB_DEPENDS=   devel/glib2 \
+   devel/libaudiofile \
+   devel/pango \
+   graphics/imlib2
 
 RUN_DEPENDS=   devel/desktop-file-utils
 
@@ -47,8 +53,22 @@ USE_GMAKE=   Yes
 USE_LIBTOOL=   Yes
 
 CONFIGURE_STYLE= gnu
+CONFIGURE_ARGS+= --disable-sound_esound
 CONFIGURE_ENV= CPPFLAGS=-I${X11BASE}/include -I${LOCALBASE}/include \
LDFLAGS=-L${X11BASE}/lib -L${LOCALBASE}/lib
+
+post-extract:
+   cp -f ${FILESDIR}/sound_sndio.c ${WRKSRC}/src
+
+pre-configure:
+   cd ${WRKSRC}  env AUTOCONF_VERSION=${AUTOCONF_VERSION} \
+   AUTOMAKE_VERSION=${AUTOMAKE_VERSION} aclocal -I m4
+   cd ${WRKSRC}  env AUTOCONF_VERSION=${AUTOCONF_VERSION} \
+   AUTOMAKE_VERSION=${AUTOMAKE_VERSION} autoconf
+   cd ${WRKSRC}  env AUTOCONF_VERSION=${AUTOCONF_VERSION} \
+   AUTOMAKE_VERSION=${AUTOMAKE_VERSION} autoheader
+   cd ${WRKSRC}  env AUTOCONF_VERSION=${AUTOCONF_VERSION} \
+   AUTOMAKE_VERSION=${AUTOMAKE_VERSION} automake
 
 post-configure:
@cd ${WRKDIR}/${DOCS}  ${SETENV} ${CONFIGURE_ENV} \
Index: distinfo
===
RCS file: /cvs/ports/x11/enlightenment/distinfo,v
retrieving revision 1.9
diff -u -p -r1.9 distinfo
--- distinfo29 Sep 2011 20:04:44 -  1.9
+++ distinfo28 Nov 2012 20:14:05 -
@@ -1,12 +1,3 @@
-MD5 (e16-1.0.9.tar.gz) = rYUEQ2bv5ky2f0qOSaN/hA==
-MD5 (e16-docs-0.16.8.0.2.tar.gz) = Rrzcxc2tdhWZI2cc/OqT+Q==
-MD5 (e16-themes-1.0.1.tar.gz) = u9nP2WlhDCnHYnwroc4wlA==
-RMD160 (e16-1.0.9.tar.gz) = fArKZHFdlTH+nEqn5mOjxGR0a3M=
-RMD160 (e16-docs-0.16.8.0.2.tar.gz) = JG+fxW/WnNFItRj2sxdlVC5ig6c=
-RMD160 (e16-themes-1.0.1.tar.gz) = GcWaZ5wFt4+8/zQllnIOSWV+Puo=
-SHA1 (e16-1.0.9.tar.gz) = l5KQkLXWb6KAZ7IbF/SM7eofgbs=
-SHA1 (e16-docs-0.16.8.0.2.tar.gz) = dznXT6yb88j1/jhYyJdFBImSCi4=
-SHA1 (e16-themes-1.0.1.tar.gz) = rjTi3xKUGYeVc2v5U79pWrqTtxA=
 SHA256 (e16-1.0.9.tar.gz) = 1DWECkpCnLIvJB14iegoJwYfbvXM2bvIcgr1He4FPSc=
 SHA256 (e16-docs-0.16.8.0.2.tar.gz) = 
uNjgyvRZMc5nL6UIipY2hVM6Zamoz+7hUjnZbzuRWT8=
 SHA256 (e16-themes-1.0.1.tar.gz) = M85IxdVlGuOl1WdD9od1zLdj661wMG669+FiWHlAyGU=
Index: files/sound_sndio.c
===
RCS file: files/sound_sndio.c
diff -N files/sound_sndio.c
--- /dev/null   1 Jan 1970 00:00:00 -
+++ files/sound_sndio.c 28 Nov 2012 20:14:05 -
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2012 Jonathan Armani arm...@openbsd.org
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE 

Re: x11/enlightenment (e16) sndio backend

2012-11-28 Thread Alexandre Ratchov
On Wed, Nov 28, 2012 at 01:15:41PM +0100, Jonathan Armani wrote:
 Hi,
 
 Diff that implement an sndio backend to e16
 Lightly tested and sounds still works, can a daily e16 user confirm it ?
 
 With input from brad@, thanks !

fwiw sndio specific bits look ok and a quick e16 test proves it
manages to plays sounds.

ok ratchov@

-- Alexandre