-Amit Kumar Singh <ak.singh7@samsung.com>
+Prince Kumar Dubey <prince.dubey@samsung.com>
+Govindaraju SM <govi.sm@samsung.com>
\r
-MAINTAINERCLEANFILES = Makefile.in\r
-\r
-AM_CPPFLAGS = \\r
--I. \\r
--I$(top_builddir) \\r
--DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \\r
--DPACKAGE_LIB_DIR=\"$(libdir)\" \\r
-@MULTISENSE_PLUGIN_CFLAGS@ \r
-\r
-\r
-pkgdir = $(libdir)/edje/modules/slp_sound_haptic/$(MODULE_ARCH)\r
-pkg_LTLIBRARIES = module.la\r
-\r
-module_la_SOURCES = sound_haptic.c\r
-module_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -module -avoid-version @MULTISENSE_PLUGIN_LIBS@ \r
-module_la_LIBTOOLFLAGS = --tag=disable-static\r
+SUBDIRS = src
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
-AC_INIT([edje-multisense-plugin], [v_ver], [Amit Kumar Singh <ak.singh7@samsung.com>])
+AC_INIT([edje-multisense-plugin], [v_ver])
AC_PREREQ([2.52])
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_MACRO_DIR([m4])
### Checks for programs
AC_PROG_CC
-# python
-
-#AM_PATH_PYTHON([2.5], , [:])
-#AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != : ])
-
# pkg-config
-
PKG_PROG_PKG_CONFIG
# Check whether pkg-config supports Requires.private
fi
AC_SUBST(pkgconfig_requires_private)
+AC_ARG_ENABLE(gcc-werror,
+ AC_HELP_STRING([--enable-gcc-werror], [enable -Werror in all Makefiles]))
-# Dependencies for the library
+dnl Use -Wall if we have gcc.
+if test "x$ac_cv_prog_gcc" = xyes ; then
+ CFLAGS="$CFLAGS -Wall"
+
+ if test x$enable_gcc_werror = "xyes" ; then
+ CFLAGS="$CFLAGS -Werror"
+ fi
+fi
+
+# Dependencies for the library
+PKG_CHECK_MODULES([MINIMAL],
+ [
+ eina >= 1.0.0
+ eet >= 1.4.0
+ ])
PKG_CHECK_MODULES([MULTISENSE_PLUGIN],
[
edje >= 1.0.0
mm-sound >= 1.0
- vconf >= 0.2.12
- devman >= 0.1
- devman_haptic >= 0.1
+ remix >= 0.2.4
])
-MULTISENSE_PLUGIN_LIBS="${MULTISENSE_PLUGIN_LIBS}"
+requirement_edje_multisense_plugin="edje >= 1.0.0 mm-sound >= 1.0 ${requirement_edje_multisense_plugin}"
+
+AC_DEFINE(EAPI, __attribute__ ((visibility("default"))), "Public API Visibility")
+
+##libremix library
+PKG_CHECK_MODULES(LIBREMIX, remix >= 0.2.4,
+ HAVE_LIB_REMIX="yes", HAVE_LIB_REMIX="no")
+
+if test "$HAVE_LIB_REMIX" = "yes" ; then
+ AC_DEFINE([HAVE_LIB_REMIX], [], [Define if libremix version found])
+ requirement_edje_multisense_plugin="remix >= 0.2.4 ${requirement_edje_multisense_plugin}"
+ PACKAGE_PLUGIN_DIR=`pkg-config --variable=libdir remix`"/remix"
+ AC_SUBST(PACKAGE_PLUGIN_DIR)
+ AC_DEFINE_UNQUOTED(PACKAGE_PLUGIN_DIR, "$PACKAGE_PLUGIN_DIR", [Set the plugin directory for remix])
+ AC_DEFINE(__REMIX_PLUGIN__, 1, "Set to REMIX Plugin type")
+else
+ PACKAGE_PLUGIN_DIR=""
+ fi
+AM_CONDITIONAL(HAVE_LIB_REMIX, test "x${HAVE_LIB_REMIX}" = xyes)
+
MULTISENSE_PLUGIN_CFLAGS="${MULTISENSE_PLUGIN_CFLAGS}"
+MULTISENSE_PLUGIN_LIBS="${MULTISENSE_PLUGIN_LIBS}"
+
+PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0.21,
+ HAVE_LIBSNDFILE1="yes", HAVE_LIBSNDFILE1="no")
-requirement_edje_multisense_plugin="edje >= 1.0.0 mm-sound >= 1.0 vconf >= 0.2.12 devman >= 0.1 devman_haptic >= 0.1 ${requirement_edje}"
+if test "$HAVE_LIBSNDFILE1" = "yes" ; then
+ AC_DEFINE([HAVE_LIBSNDFILE1], [], [Define if libsndfile version 1 found])
+ AC_SUBST(SNDFILE_LIBS)
+ AC_SUBST(SNDFILE_CFLAGS)
+else
+ AC_CHECK_LIB(sndfile, sf_open, HAVE_LIBSNDFILE1="maybe")
+ if test "$HAVE_LIBSNDFILE1" = "maybe" ; then
+ AC_MSG_ERROR([
+***
+*** libsndfile-1.0.21 or greater seems to exist on your system, however
+*** the pkg-config tool cannot find its build information.
+***
+*** Please set your PKG_CONFIG_PATH environment variable to include the
+*** directory in which sndfile.pc was installed. For example, sndfile.pc
+*** is installed in /usr/local/lib/pkgconfig by default; if that is the
+*** case do:
+***
+*** export PKG_CONFIG_PATH="\$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig"
+***
+*** then run this ./configure again. If you configured libsndfile with a
+*** different --prefix option, replace /usr/local above with that prefix.
+***
+])
+ fi
+fi
+AM_CONDITIONAL(HAVE_LIBSNDFILE1, test "x${HAVE_LIBSNDFILE1}" = xyes)
### Checks for header files
AC_CHECK_HEADERS([locale.h])
AC_C_CONST
AC_PROG_CC_STDC
AC_HEADER_STDC
-AC_C___ATTRIBUTE__
case "$host_os" in
mingw32ce*)
### Checks for linker characteristics
-
lt_enable_auto_import=""
case "$host_os" in
mingw* | cegcc*)
;;
esac
-
AC_SUBST(requirement_edje_multisense_plugin)
-
AC_OUTPUT([
Makefile
+src/Makefile
+src/tizen_sound_player/Makefile
])
-
#####################################################################
## Info
echo
-echo
-echo
echo "------------------------------------------------------------------------"
echo "$PACKAGE $VERSION"
echo "------------------------------------------------------------------------"
+edje-multisense-plugin (0.1.0-3) unstable; urgency=low
+
+ * Refactored Version.
+ * Sound Player, Eet Sound Reader and Sound Factory modules are added.
+ * Git: 165.213.149.219:29418/slp/pkgs/e/edje_multisense_plugin
+ * Tag: edje-multisense-plugin_0.1.0-3
+
+ -- Prince Kumar Dubey <prince.dubey@samsung.com> Thu, 19 Jan 2012 19:33:26 +0530
+
edje-multisense-plugin (0.1.0-2) unstable; urgency=low
* Initial Version.
Source: edje-multisense-plugin
Section: libs
Priority: optional
-Maintainer: Amit Kumar Singh<ak.singh7@samsung.com>, WooHyun Jung <wh0705.jung@samsung.com>
-Build-Depends: libedje-dev, libmm-sound-dev, libdevman-dev, libdevman-haptic-dev, pkg-config, libtool
+Maintainer: Prince Kumar Dubey <prince.dubey@samsung.com>
+Build-Depends: libedje-dev, libmm-sound-dev, libremix-dev, libsndfile1-dev, pkg-config, libtool
Package: edje-multisense-plugin
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: EDJE Plugin for sound/haptic support.
-
-
-
-
+Description: EDJE & libremix Plugins for TIZEN sound/tone play
-
-debian/edje-multisense-plugin/usr/lib/edje/modules/*
+debian/edje-multisense-plugin/usr/lib/remix/*.so.*
+++ /dev/null
-#include <sys/stat.h>\r
-#include <Edje_Multisense_Ui_Module.h>\r
-#include <mmf/mm_sound.h>\r
-#include <vconf.h>\r
-#include <mmf/mm_sound_private.h>\r
-#include <devman_haptic.h>\r
-\r
-int dev_handle = -1 ;\r
-Eina_Bool aui_haptic_play(char* filename,int iteration)\r
-{\r
- int ret_val=0 ;\r
- int mode=0;\r
- if(dev_handle!=-1)device_haptic_close(dev_handle) ;\r
- dev_handle= device_haptic_open(1,mode);\r
- if(dev_handle < 0)return EINA_FALSE ;\r
- ret_val = device_haptic_play_file(dev_handle,filename,iteration,3);\r
- if(ret_val<0)\r
- return EINA_FALSE ;\r
- return EINA_TRUE ;\r
-} \r
- \r
-EAPI Eina_Bool ems_ui_sound_play(Edje_Sound_Info* sinfo, Edje_Sound_Data* sdata, unsigned int it)\r
- { \r
- int volume_level = 0 ;\r
- int sound_profile;\r
- FILE *f ;\r
- char buf[256] ;\r
- struct stat st; \r
- /*Checking for silent profile */\r
- if(vconf_get_int(VCONFKEY_SETAPPL_CUR_PROFILE_INT,&sound_profile ) ) ;\r
- if( sound_profile==1 )return EINA_FALSE; \r
- if( vconf_get_int(VCONFKEY_SETAPPL_PROFILE_NORMAL_CALL_VOLUME_INT,&volume_level)==-1)return EINA_FALSE ;\r
- if( sinfo==NULL )return EINA_FALSE ;\r
- snprintf(buf,sizeof(buf),"/tmp/%s",sinfo->name) ;\r
- /* Sound File already present in the /tmp directory */\r
- if (stat(buf,&st) == 0)\r
- goto PLAY ;\r
- f = fopen(buf,"wb") ;\r
- if (f != NULL)\r
- { \r
- if (fwrite(sdata->sound_data, sdata->sound_size, 1, f) != 1)\r
- return EINA_FALSE ;\r
- fclose(f);\r
- } \r
- else \r
- return EINA_FALSE ;\r
- PLAY:\r
- mm_sound_play_keysound(buf,volume_level) ;\r
- return EINA_TRUE ;\r
- }\r
-\r
-int HexToDec(const char* strHex)\r
-{ \r
- int nFactor = 1;\r
- int nRetVal = 0;\r
- char* p;\r
- for(p = (strHex + strlen(strHex)); p >= strHex; --p)\r
- {\r
- if( p[0] == ' ' || p[0] == 0) continue ; \r
- if(p[0] < 'A') nRetVal += nFactor * (p[0] - '0');\r
- else if(p[0] < 'a') nRetVal += nFactor * (p[0] - 'A' + 10); \r
- else nRetVal += nFactor * (p[0] - 'a' + 10); \r
- nFactor *= 16; \r
- }\r
- \r
- return nRetVal;\r
-}\r
-\r
-EAPI Eina_Bool ems_ui_haptic_play(Edje_Haptic_Info *haptic, unsigned int iterations)\r
- {\r
- char *pattern =NULL ;\r
- pattern=(char*)malloc(strlen(haptic->pattern)) ;\r
- strcpy(pattern, haptic->pattern);\r
- char *s =pattern ;\r
- int a = 0;\r
- char buf[256] ;\r
- char test[3] ;\r
- test[2]=0 ;\r
- int i=0 ;\r
-\r
- int counter = 0;\r
- char data ;\r
- snprintf(buf,sizeof(buf),"/tmp/%s.ivt",haptic->name) ;\r
- FILE *f=fopen(buf,"w") ;\r
- \r
- while (*s != '\0')\r
- {\r
- if (*s == ',')\r
- counter++;\r
- s++;\r
- }\r
- \r
- while (a <= counter)\r
- {\r
- test[0]= pattern[i] ;\r
- test[1]=pattern[i+1] ;\r
- i = i + 3 ;\r
- data=HexToDec(test) ;\r
- fputc(data,f) ;\r
- a++ ;\r
- }\r
- \r
- fclose(f) ;\r
- if(aui_haptic_play(buf,iterations)==EINA_TRUE) ;\r
- return EINA_TRUE ;\r
- }\r
--- /dev/null
+\r
+if HAVE_LIB_REMIX\r
+SND_PLAYER = tizen_sound_player\r
+endif\r
+SUBDIRS = $(SND_PLAYER)\r
--- /dev/null
+## Process this file with automake to produce Makefile.in
+
+AM_CPPFLAGS = \
+-I. \
+-I$(top_builddir) \
+-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
+@MULTISENSE_PLUGIN_CFLAGS@
+
+libdir = $(PACKAGE_PLUGIN_DIR)
+
+REMIXDIR = $(libdir)/../
+REMIX_LIBS = $(REMIXDIR)/libremix.la
+
+lib_LTLIBRARIES = libtizen_sound_player.la
+
+libtizen_sound_player_la_SOURCES = tizen_sound_player.c
+libtizen_sound_player_la_LDFLAGS = -module -version-info 1:0:0
+libtizen_sound_player_la_LIBADD = $(REMIX_LIBS) -lmmfsound -lsndfile
--- /dev/null
+/*
+ * Remix Stream Player: TIZEN device output
+ *
+ * Govindaraju SM <govi.sm@samsung.com>, August 2011
+ * Prince Kumar Dubey <prince.dubey@samsung.com>, August 2011
+ */
+
+#include "config.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <mm_sound.h>
+#include <remix/remix.h>
+#include <Eina.h>
+#ifdef HAVE_LIBSNDFILE
+#include <sndfile.h>
+#endif
+
+int _edje_multisense_default_log_dom = -1;
+
+#ifdef ERR
+# undef ERR
+#endif
+#define ERR(...) EINA_LOG_DOM_ERR(_edje_multisense_default_log_dom, __VA_ARGS__)
+
+#define STREAM_PLAYER_BUFFERLEN 4096
+#define DEFAULT_FORMAT MMSOUND_PCM_S16_LE
+
+typedef struct _RemixPlayerData RemixPlayerData;
+typedef short PLAYER_PCM;
+
+struct _RemixPlayerData {
+ RemixPCM databuffer[STREAM_PLAYER_BUFFERLEN];
+ PLAYER_PCM *playbuffer;
+ MMSoundPcmHandle_t handle;
+ MMSoundPcmChannel_t channel;
+ unsigned int buffer_size;
+ int stereo;
+ int frequency;
+};
+
+/* Optimisation dependencies: none */
+static RemixBase * remix_player_optimise (RemixEnv * env, RemixBase * base);
+
+static RemixBase *
+remix_player_reset_device (RemixEnv *env, RemixBase *base)
+{
+ int old_buffer_size;
+ RemixPlayerData * player_data = remix_base_get_instance_data(env, base);
+
+ if (player_data->handle)
+ {
+ mm_sound_pcm_play_close(player_data->handle);
+ player_data->handle = NULL;
+ }
+ old_buffer_size = player_data->buffer_size;
+ player_data->buffer_size = mm_sound_pcm_play_open(&player_data->handle,
+ player_data->frequency,
+ player_data->channel,
+ DEFAULT_FORMAT,
+ VOLUME_TYPE_SYSTEM);
+ if(player_data->buffer_size < 0)
+ {
+ remix_set_error (env, REMIX_ERROR_SYSTEM);
+ return RemixNone;
+ }
+
+ if( old_buffer_size < player_data->buffer_size)
+ {
+ if( player_data->playbuffer ) free(player_data->playbuffer);
+ player_data->playbuffer = calloc(sizeof(PLAYER_PCM), player_data->buffer_size);
+ if(!player_data->playbuffer)
+ {
+ remix_set_error (env, REMIX_ERROR_SYSTEM);
+ return RemixNone;
+ }
+ }
+ return base;
+}
+
+static RemixBase *
+remix_player_init (RemixEnv * env, RemixBase * base, CDSet * parameters)
+ {
+ RemixCount nr_channels;
+ CDSet * channels;
+ RemixPlayerData *player_data = calloc(1, sizeof (RemixPlayerData));
+
+ if (!player_data)
+ {
+ remix_set_error(env, REMIX_ERROR_SYSTEM);
+ return RemixNone;
+ }
+
+ remix_base_set_instance_data(env, base, player_data);
+ remix_set_channels(env, REMIX_STEREO);
+ channels = remix_get_channels (env);
+
+ nr_channels = cd_set_size (env, channels);
+ if (nr_channels == 1)
+ {
+ player_data->stereo = 0;
+ player_data->channel = MMSOUND_PCM_MONO;
+ }
+ else if (nr_channels == 2)
+ {
+ player_data->stereo = 1;
+ player_data->channel = MMSOUND_PCM_STEREO;
+ }
+
+ player_data->frequency = remix_get_samplerate(env);
+ player_data->buffer_size = 0;
+
+ remix_player_reset_device (env, (RemixBase *)base);
+
+ base = remix_player_optimise (env, base);
+
+ return base;
+}
+
+
+static RemixBase *
+remix_player_clone (RemixEnv * env, RemixBase * base)
+{
+ RemixBase * new_player = remix_base_new (env);
+
+ remix_player_init( env, new_player, NULL);
+ return new_player;
+}
+
+static int
+remix_player_destroy (RemixEnv * env, RemixBase * base)
+{
+ RemixPlayerData * player_data = remix_base_get_instance_data(env, base);
+
+ if(player_data->handle)
+ mm_sound_pcm_play_close(player_data->handle);
+ if(player_data->playbuffer) free(player_data->playbuffer);
+ free (player_data);
+ return 0;
+}
+
+static int
+remix_player_ready (RemixEnv * env, RemixBase * base)
+{
+ RemixPlayerData * player_data = remix_base_get_instance_data(env, base);
+ RemixCount nr_channels;
+ CDSet * channels;
+ int samplerate;
+
+ channels = remix_get_channels (env);
+ samplerate = (int) remix_get_samplerate (env);
+
+ nr_channels = cd_set_size (env, channels);
+
+ return (samplerate == player_data->frequency &&
+ ((nr_channels == 1 && player_data->stereo == 0) ||
+ (nr_channels > 1 && player_data->stereo == 1)));
+}
+
+static RemixBase *
+remix_player_prepare (RemixEnv * env, RemixBase * base)
+{
+ remix_player_reset_device (env, base);
+ return base;
+}
+
+static RemixCount
+remix_player_playbuffer (RemixEnv * env, RemixPlayerData * player, RemixPCM * data,
+ RemixCount count)
+{
+ RemixCount i;
+ RemixPCM value;
+ int ret = count;
+ const RemixPCM max_value = (RemixPCM) (SHRT_MAX);
+
+ for (i = 0; i < count; i++)
+ {
+ value = *data++ * max_value;
+ *(player->playbuffer + i) = (PLAYER_PCM) value;
+ }
+
+ ret = mm_sound_pcm_play_write(player->handle,
+ player->playbuffer,
+ 2 * count);
+ if(ret < 0)
+ ERR("Write Fail\n");
+
+ return ret;
+}
+
+/* An RemixChunkFunc for making noise */
+static RemixCount
+remix_player_chunk (RemixEnv * env, RemixChunk * chunk, RemixCount offset,
+ RemixCount count, int channelname, void * data)
+{
+ RemixPlayerData * player = (RemixPlayerData *)data;
+ RemixCount remaining = count, written = 0, n, playcount;
+ RemixPCM * d;
+
+ while (remaining > 0)
+ {
+ playcount = MIN (remaining, player->buffer_size);
+
+ d = &chunk->data[offset];
+ n = remix_player_playbuffer (env, player, d, playcount);
+
+ if (n == -1)
+ return -1;
+ else
+ n /= sizeof (PLAYER_PCM);
+
+ offset += n;
+ written += n;
+ remaining -= n;
+ }
+
+ return written;
+}
+
+static RemixCount
+remix_player_process (RemixEnv * env, RemixBase * base, RemixCount count,
+ RemixStream * input, RemixStream * output)
+{
+ RemixPlayerData * player_data = remix_base_get_instance_data(env, base);
+ RemixCount nr_channels = remix_stream_nr_channels (env, input);
+ RemixCount remaining = count, processed = 0, n, nn;
+
+ if (nr_channels == 1 && player_data->stereo == 0)
+ { /* MONO */
+ return remix_stream_chunkfuncify (env, input, count,
+ remix_player_chunk, player_data);
+ }
+ else if (nr_channels == 2 && player_data->stereo == 1)
+ { /* STEREO */
+ while (remaining > 0)
+ {
+ n = MIN (remaining, (player_data->buffer_size/2) );
+ n = remix_stream_interleave_2 (env, input,
+ REMIX_CHANNEL_LEFT, REMIX_CHANNEL_RIGHT,
+ player_data->databuffer, n);
+ nn = 2 * n;
+ nn = remix_player_playbuffer (env, player_data,
+ player_data->databuffer, nn);
+
+ processed += n;
+ remaining -= n;
+ }
+ return processed;
+ }
+ else
+ {
+ ERR("[remix_player_process] unsupported stream/output channel\n");
+ ERR ("combination %ld / %d\n", nr_channels, player_data->stereo ? 2 : 1);
+ return -1;
+ }
+}
+
+static RemixCount
+remix_player_length (RemixEnv * env, RemixBase * base)
+{
+ return REMIX_COUNT_INFINITE;
+}
+
+static RemixCount
+remix_player_seek (RemixEnv * env, RemixBase * base, RemixCount count)
+{
+ return count;
+}
+
+static int
+remix_player_flush (RemixEnv * env, RemixBase * base)
+{
+ RemixPlayerData * player_data = remix_base_get_instance_data(env, base);
+ remix_player_reset_device (env, base);
+ return 0;
+}
+
+static struct _RemixMethods _remix_player_methods = {
+ remix_player_clone,
+ remix_player_destroy,
+ remix_player_ready,
+ remix_player_prepare,
+ remix_player_process,
+ remix_player_length,
+ remix_player_seek,
+ remix_player_flush,
+};
+
+static RemixBase *
+remix_player_optimise (RemixEnv * env, RemixBase * base)
+{
+ remix_base_set_methods (env, base, &_remix_player_methods);
+ return base;
+}
+
+static struct _RemixMetaText tizen_player_metatext = {
+ "tizen_snd_player",
+ "TIZEN Sound Player",
+ "Output the stream into TIZEN System",
+ "Copyright (C) 2011, Samsung Electronics Co., Ltd.",
+ "http://www.samsung.com",
+ REMIX_ONE_AUTHOR ("govi.sm@samsung.com", "prince.dubey@samsung.com"),
+};
+
+static struct _RemixPlugin tizen_player_plugin = {
+ &tizen_player_metatext,
+ REMIX_FLAGS_NONE,
+ CD_EMPTY_SET, /* init scheme */
+ remix_player_init,
+ CD_EMPTY_SET, /* process scheme */
+ NULL, /* suggests */
+ NULL, /* plugin data */
+ NULL /* destroy */
+};
+
+EAPI CDList *
+remix_load (RemixEnv * env)
+{
+ CDList * plugins = cd_list_new (env);
+ plugins = cd_list_prepend (env, plugins,
+ CD_POINTER(&tizen_player_plugin));
+ return plugins;
+}