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 > --- Makefile 1 Sep 2012 14:36:58 -0000 1.60 > +++ Makefile 28 Nov 2012 09:28:02 -0000 > @@ -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 -0000 > +++ files/sound_sndio.c 28 Nov 2012 09:28:02 -0000 > @@ -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(¶ms); > + params.bits = s->ssd.bit_per_sample; > + params.pchan = s->ssd.channels; > + params.rate = s->ssd.rate; > + > + if (!sio_setpar(hdl, ¶ms)) > + return; > + if (!sio_getpar(hdl, ¶ms)) > + 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 > +_sound_sndio_Init(void) > +{ > + if (hdl != NULL) > + return 0; > + > + hdl = sio_open(SIO_DEVANY, SIO_PLAY, 0); > + > + return (hdl == NULL); > +} > + > +static void > +_sound_sndio_Exit(void) > +{ > + if (hdl == NULL) > + return; > + > + sio_close(hdl); > + hdl = NULL; > +} > + > +__EXPORT__ extern const SoundOps SoundOps_sndio; > + > +const SoundOps SoundOps_sndio = { > + _sound_sndio_Init, _sound_sndio_Exit, _sound_sndio_Load, > + _sound_sndio_Destroy, _sound_sndio_Play, > +}; > + > +#endif /* HAVE_SOUND && HAVE_SOUND_SNDIO */ > Index: patches/patch-configure_ac > =================================================================== > RCS file: patches/patch-configure_ac > diff -N patches/patch-configure_ac > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-configure_ac 28 Nov 2012 09:28:02 -0000 > @@ -0,0 +1,35 @@ > +$OpenBSD$ > +--- configure.ac.orig Sun Jul 31 13:33:50 2011 > ++++ configure.ac Thu Nov 15 21:38:44 2012 > +@@ -93,6 +93,10 @@ if test "x$enable_sound" = "xyes"; then > + AC_ARG_ENABLE(sound_esound, > + [ --enable-sound-esound compile with EsounD sound support > @<:@default=yes@:>@],, > + enable_sound_esound=yes) > ++ AC_ARG_ENABLE(sound_sndio, > ++ [ --enable-sound-sndio compile with sndio sound support > @<:@default=yes@:>@],, > ++ enable_sound_sndio=yes) > ++ > + fi > + enable_sound=no > + > +@@ -124,6 +128,20 @@ if test "x$enable_sound_esound" = "xyes"; then > + enable_sound=esound > + fi > + AM_CONDITIONAL(USE_LIBESD, test "x$enable_sound_esound" = "xyes") > ++ > ++if test "x$enable_sound_sndio" = "xyes"; then > ++ AC_CHECK_HEADERS(sndio.h,, enable_sound_sndio=no) > ++ AC_CHECK_LIB(sndio, sio_open, SNDIO_LIBS="-lsndio", enable_sound_sndio=no) > ++ AC_SUBST(SNDIO_LIBS) > ++fi > ++if test "x$enable_sound_sndio" = "xyes"; then > ++ AC_DEFINE(HAVE_SOUND, 1, [Sound support]) > ++ AC_DEFINE(HAVE_SOUND_SNDIO, 1, [Sndio sound support]) > ++ AC_DEFINE(USE_SOUND_LOADER_AUDIOFILE, 1, [Use audiofile sound loader]) > ++ PKG_CHECK_MODULES(AUDIOFILE, audiofile,,) > ++ enable_sound=sndio > ++fi > ++AM_CONDITIONAL(USE_LIBSNDIO, test "x$enable_sound_sndio" = "xyes") > + > + # Save CPPFLAGS/LDFLAGS and add X_... to each > + SAVE_CPPFLAGS="$CPPFLAGS" > Index: patches/patch-src_Makefile_am > =================================================================== > RCS file: patches/patch-src_Makefile_am > diff -N patches/patch-src_Makefile_am > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-src_Makefile_am 28 Nov 2012 09:28:02 -0000 > @@ -0,0 +1,40 @@ > +$OpenBSD$ > +--- src/Makefile.am.orig Sun Jul 31 10:02:54 2011 > ++++ src/Makefile.am Thu Nov 15 21:58:47 2012 > +@@ -161,7 +161,7 @@ MODULE_LIBS = $(DLOPEN_LIBS) > + > + libe16dir = $(pkglibdir) > + > +-libe16_LTLIBRARIES = $(LIBSND_ESD) $(LIBSND_PA) $(LIBFNT_IFT) $(LIBFNT_XFT) > $(LIBFNT_PANGO) > ++libe16_LTLIBRARIES = $(LIBSND_ESD) $(LIBSND_PA) $(LIBSND_SNDIO) > $(LIBFNT_IFT) $(LIBFNT_XFT) $(LIBFNT_PANGO) > + > + if USE_LIBESD > + LIBSND_ESD = libsound_esd.la > +@@ -179,6 +179,14 @@ libsound_pa_la_LIBADD = $(PA_LIBS) $(AUDIOFILE_LIBS > + libsound_pa_la_LDFLAGS = -module -avoid-version > + endif > + > ++if USE_LIBSNDIO > ++LIBSND_SNDIO = libsound_sndio.la > ++libsound_sndio_la_SOURCES = sound_sndio.c sound_load.c > ++libsound_sndio_la_CFLAGS = $(SNDIO_CFLAGS) $(AUDIOFILE_CFLAGS) > $(CWARNFLAGS) > ++libsound_sndio_la_LIBADD = $(SNDIO_LIBS) $(AUDIOFILE_LIBS) > ++libsound_sndio_la_LDFLAGS = -module -avoid-version > ++endif > ++ > + LIBFNT_IFT = libfont_ift.la > + libfont_ift_la_SOURCES = ttfont.c > + libfont_ift_la_CFLAGS = $(IMLIB2_CFLAGS) $(CWARNFLAGS) > +@@ -203,9 +211,9 @@ endif > + > + else > + > +-MODULE_SRCS = sound_esd.c sound_pa.c sound_load.c ttfont.c text_xft.c > text_pango.c > +-MODULE_LIBS = $(ESD_LIBS) $(PA_LIBS) $(AUDIOFILE_LIBS) $(PANGO_LIBS) > $(XFT_LIBS) > +-MODULE_CFLAGS = $(ESD_CFLAGS) $(PA_CFLAGS) $(AUDIOFILE_CFLAGS) > $(PANGO_CFLAGS) $(XFT_CFLAGS) > ++MODULE_SRCS = sound_esd.c sound_pa.c sound_sndio.c sound_load.c ttfont.c > text_xft.c text_pango.c > ++MODULE_LIBS = $(ESD_LIBS) $(PA_LIBS) $(SNDIO_LIBS) $(AUDIOFILE_LIBS) > $(PANGO_LIBS) $(XFT_LIBS) > ++MODULE_CFLAGS = $(ESD_CFLAGS) $(PA_CFLAGS) $(SNDIO_CFLAGS) > $(AUDIOFILE_CFLAGS) $(PANGO_CFLAGS) $(XFT_CFLAGS) > + > + endif > + > Index: patches/patch-src_sound_c > =================================================================== > RCS file: patches/patch-src_sound_c > diff -N patches/patch-src_sound_c > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-src_sound_c 28 Nov 2012 09:28:02 -0000 > @@ -0,0 +1,22 @@ > +$OpenBSD$ > +--- src/sound.c.orig Sun Jul 31 16:02:52 2011 > ++++ src/sound.c Sun Nov 11 14:48:28 2012 > +@@ -34,6 +34,8 @@ > + #define SOUND_SERVER_NAME "esd" > + #elif HAVE_SOUND_PA > + #define SOUND_SERVER_NAME "pulseaudio" > ++#elif HAVE_SOUND_SNDIO > ++#define SOUND_SERVER_NAME "sndio" > + #else > + #error Invalid sound configuration > + #endif > +@@ -72,6 +74,9 @@ static const SoundOps *ops = &SoundOps_esd; > + #elif HAVE_SOUND_PA > + extern const SoundOps SoundOps_pa; > + static const SoundOps *ops = &SoundOps_pa; > ++#elif HAVE_SOUND_SNDIO > ++extern const SoundOps SoundOps_sndio; > ++static const SoundOps *ops = &SoundOps_sndio; > + #endif > + #endif > + >