diff options
Diffstat (limited to 'speech/sharika/src')
-rwxr-xr-x | speech/sharika/src/Makefile.am | 10 | ||||
-rw-r--r-- | speech/sharika/src/Makefile.in | 472 | ||||
-rwxr-xr-x | speech/sharika/src/main.c | 308 |
3 files changed, 790 insertions, 0 deletions
diff --git a/speech/sharika/src/Makefile.am b/speech/sharika/src/Makefile.am new file mode 100755 index 0000000..71a111c --- /dev/null +++ b/speech/sharika/src/Makefile.am @@ -0,0 +1,10 @@ +bin_PROGRAMS =sharika +sharika_SOURCES = main.c +AM_CPPFLAGS = \ + -DGNOMEDATADIR=\"$(datadir)\" \ + $(Libwnck_CFLAGS) \ + $(GTK_CFLAGS) \ + $(SPHINX_CFLAGS) +sharika_LDADD= -lm $(SPHINX_LIBS) -lwnck-1 + + diff --git a/speech/sharika/src/Makefile.in b/speech/sharika/src/Makefile.in new file mode 100644 index 0000000..d8ba94f --- /dev/null +++ b/speech/sharika/src/Makefile.in @@ -0,0 +1,472 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +bin_PROGRAMS = sharika$(EXEEXT) +subdir = src +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) +am_sharika_OBJECTS = main.$(OBJEXT) +sharika_OBJECTS = $(am_sharika_OBJECTS) +am__DEPENDENCIES_1 = +sharika_DEPENDENCIES = $(am__DEPENDENCIES_1) +DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(sharika_SOURCES) +DIST_SOURCES = $(sharika_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GREP = @GREP@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +Libwnck_CFLAGS = @Libwnck_CFLAGS@ +Libwnck_LIBS = @Libwnck_LIBS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SPHINX_CFLAGS = @SPHINX_CFLAGS@ +SPHINX_LIBS = @SPHINX_LIBS@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +hmmdata = @hmmdata@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +sharika_SOURCES = main.c +AM_CPPFLAGS = \ + -DGNOMEDATADIR=\"$(datadir)\" \ + $(Libwnck_CFLAGS) \ + $(GTK_CFLAGS) \ + $(SPHINX_CFLAGS) + +sharika_LDADD = -lm $(SPHINX_LIBS) -lwnck-1 +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +sharika$(EXEEXT): $(sharika_OBJECTS) $(sharika_DEPENDENCIES) + @rm -f sharika$(EXEEXT) + $(LINK) $(sharika_OBJECTS) $(sharika_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool ctags distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-binPROGRAMS install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-binPROGRAMS + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/speech/sharika/src/main.c b/speech/sharika/src/main.c new file mode 100755 index 0000000..db435ab --- /dev/null +++ b/speech/sharika/src/main.c @@ -0,0 +1,308 @@ +/* This file is a part of gnome-voice-control + * + * Copyright (C) 2007 Shyam Karanattu <aeshyamae@gmail.com> + * + * main.c: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + * + */ + #define WNCK_I_KNOW_THIS_IS_UNSTABLE + #include <libwnck/libwnck.h> + #include <gtk/gtk.h> + #include <X11/Xlib.h> +#include <sys/types.h> +#include <sys/time.h> +#include <stdio.h> +#include <signal.h> +WnckScreen *scr; +WnckWindow *win; +GList *tmp,*head; +#define DHVANISCRIPT GNOMEDATADIR"/sharika/parser.sh" + +#include <setjmp.h> +#include <string.h> + +#include "s2types.h" +#include "err.h" +#include "ad.h" +#include "cont_ad.h" +#include "fbs.h" + +#define SAMPLE_RATE 16000 + +static ad_rec_t *ad; + +/* Sleep for specified msec */ +static void sleep_msec (int32 ms) +{ + struct timeval tmo; + + tmo.tv_sec = 0; + tmo.tv_usec = ms*1000; + + select(0, NULL, NULL, NULL, &tmo); +} + +static void utterance_loop(int argc,char *argv[]) +{ + int16 adbuf[4096]; + int32 k, fr, ts, rem; + char *hyp; + cont_ad_t *cont; + int count=0,i=1,flag; + char word[256]; + /* Initialize continuous listening module */ + if ((cont = cont_ad_init (ad, ad_read)) == NULL) + E_FATAL("cont_ad_init failed\n"); + if (ad_start_rec (ad) < 0) + E_FATAL("ad_start_rec failed\n"); + if (cont_ad_calib (cont) < 0) + E_FATAL("cont_ad_calib failed\n"); + + for (;;) + { + /* Indicate listening for next utterance */ + printf ("READY....\n"); + fflush (stdout); fflush (stderr); + + /* Await data for next utterance */ + while ((k = cont_ad_read (cont, adbuf, 4096)) == 0) + sleep_msec(200); + + if (k < 0) + E_FATAL("cont_ad_read failed\n"); + + /* + * Non-zero amount of data received; start recognition of new utterance. + * NULL argument to uttproc_begin_utt => automatic generation of utterance-id. + */ + if (uttproc_begin_utt (NULL) < 0) + E_FATAL("uttproc_begin_utt() failed\n"); + uttproc_rawdata (adbuf, k, 0); + printf ("Listening...\n"); fflush (stdout); + + /* Note timestamp for this first block of data */ + ts = cont->read_ts; + + /* Decode utterance until end (marked by a "long" silence, >1sec) */ + for (;;) { + /* Read non-silence audio data, if any, from continuous listening module */ + if ((k = cont_ad_read (cont, adbuf, 4096)) < 0) + E_FATAL("cont_ad_read failed\n"); + if (k == 0) { + /* + * No speech data available; check current timestamp with most recent + * speech to see if more than 1 sec elapsed. If so, end of utterance. + */ + if ((cont->read_ts - ts) > DEFAULT_SAMPLES_PER_SEC) + break; + } else { + /* New speech data received; note current timestamp */ + ts = cont->read_ts; + } + + /* + * Decode whatever data was read above. NOTE: Non-blocking mode!! + * rem = #frames remaining to be decoded upon return from the function. + */ + rem = uttproc_rawdata (adbuf, k, 0); + + /* If no work to be done, sleep a bit */ + if ((rem == 0) && (k == 0)) + sleep_msec (20); + } + + /* + * Utterance ended; flush any accumulated, unprocessed A/D data and stop + * listening until current utterance completely decoded + */ + ad_stop_rec (ad); + while (ad_read (ad, adbuf, 4096) >= 0); + cont_ad_reset (cont); + + printf ("Stopped listening, please wait...\n"); fflush (stdout); +#if 0 + /* Power histogram dump (FYI) */ + cont_ad_powhist_dump (stdout, cont); +#endif + /* Finish decoding, obtain and print result */ + uttproc_end_utt (); + if (uttproc_result (&fr, &hyp, 1) < 0) + E_FATAL("uttproc_result failed\n"); + + + /*obtaining the results*/ + sscanf (hyp, "%s", word); + printf ("%d: %s\n", fr,word); fflush (stdout); + win=wnck_screen_get_active_window(scr); + tmp=wnck_screen_get_windows(wnck_window_get_screen(win)); + + i=g_list_index(tmp,win);/*the place value of window in the list*/ + printf("<<<<<<<<<<<<<<>>>>>>>>>>>>>>i:%d,%s\n\n\n",i,wnck_window_get_name(win)); + count=0; + while(tmp!=NULL) + { + printf("%d:%s\n\n",count,wnck_window_get_name(tmp->data)); + tmp=tmp->next;count++; + } + /*comparison and action for DAKKU */ + if(strcmp(word,"PADU")==0) + g_spawn_command_line_async("totem --play",NULL); + if(strcmp(word,"EMACS")==0) + g_spawn_command_line_async("emacs",NULL); + if(strcmp(word,"SAMAYAM")==0) + g_spawn_command_line_async(DHVANISCRIPT,NULL); + if(strcmp(word,"VALAPARATHU")==0) + g_spawn_command_line_async("epiphany",NULL); + if(strcmp(word,"EAZHUTHIDAM")==0) + g_spawn_command_line_async("gedit",NULL); + /*Minimizing current active window*/ + if (strcmp (word, "CHURUKKU") == 0) + wnck_window_minimize(win); + /*Moving focus(active window)towards the left of the panel.The active window is changed to + the next normal window on the left.effect of alt+tab key press*/ + if(strcmp(word,"ADUTHATHU")==0) + { + win=wnck_screen_get_active_window(scr); + tmp=wnck_screen_get_windows(wnck_window_get_screen(win)); + + while(tmp!=NULL)/*while traces the current active window through the list*/ + { + printf("tracing:current:%s\n\ntmp:%s\n\n",wnck_window_get_name(win),wnck_window_get_name(tmp->data)); + if(tmp->data==win) + { + printf("BREAKED with tmp:%s\n",wnck_window_get_name(tmp->data)); + break; + } + + tmp=tmp->next; + + } + if(tmp==NULL){printf("BULL SHIT GIVE A WINDOW IN THE LIST\n\n");}//exit(1);} + if(tmp->next==NULL)/*shifting back to the first window by refreshing the list*/ + tmp=wnck_screen_get_windows(wnck_window_get_screen(win)); + else + tmp=tmp->next; + printf("cuow:%s\n\n",wnck_window_get_name(tmp->data)); + + + + while(tmp!=NULL) + { + printf("tmp in while:%s\n\n",wnck_window_get_name(tmp->data)); + if(wnck_window_get_window_type(tmp->data)==WNCK_WINDOW_NORMAL) + { + wnck_window_activate(tmp->data,0); + flag=1; + break; + } + else + tmp=tmp->next; + } + + if(flag==0) + { + printf("FLAG==0 DETECTED:\n"); + tmp=wnck_screen_get_windows(wnck_window_get_screen(win)); + while(tmp!=NULL) + { + printf("tmp in last while:%s\n",wnck_window_get_name(tmp->data)); + if(wnck_window_get_window_type(tmp->data)==WNCK_WINDOW_NORMAL) + { + wnck_window_activate(tmp->data,0); + break; + } + else + tmp=tmp->next; + } + } + + + } + if(strcmp(word,"VALUTHAKKU")==0) + { + if(wnck_window_get_window_type(win)!= WNCK_WINDOW_NORMAL) + { + if(wnck_window_get_window_type(wnck_screen_get_previously_active_window(scr))==WNCK_WINDOW_NORMAL) + win=wnck_screen_get_previously_active_window(scr); + } + wnck_window_unminimize(win,0); + + } + + while(gtk_events_pending())/*gtk probing and refreshing the win and tmp*/ + { + gtk_main_iteration(); + win=wnck_screen_get_active_window(scr); + tmp=wnck_screen_get_windows(wnck_window_get_screen(win)); + + } + + /* Resume A/D recording for next utterance */ + if (ad_start_rec (ad) < 0) + E_FATAL("ad_start_rec failed\n"); + } + + cont_ad_close (cont); +} + +static char *sphinx_command = + "sharika " + "-bestpath yes " + "-fsgfn " GNOMEDATADIR "/sharika/sharika.fsg " + "-dictfn " GNOMEDATADIR "/sharika/sharika.dic " + "-hmmdirlist " GNOMEDATADIR "/sharika/model " + "-hmmext chmm " + "-mdeffn "GNOMEDATADIR "/sharika/mdef " + "-meanfn " GNOMEDATADIR "/sharika/means " + "-varfn " GNOMEDATADIR "/sharika/variances " + "-mixwfn " GNOMEDATADIR "/sharika/mixture_weights "; + +static jmp_buf jbuf; +static void sighandler(int signo) +{ + longjmp(jbuf, 1); +} + +int main (int argc, char *argv[]) +{ + /* Make sure we exit cleanly (needed for profiling among other things) */ + g_shell_parse_argv(sphinx_command,&argc,&argv,NULL); + gtk_init(&argc, &argv); + + scr = wnck_screen_get_default(); + while(gtk_events_pending()) gtk_main_iteration(); + win = wnck_screen_get_active_window(scr); + tmp=wnck_screen_get_windows(wnck_window_get_screen(win)); + signal(SIGINT, &sighandler); + + fbs_init (argc, argv); + + if ((ad = ad_open_sps (SAMPLE_RATE)) == NULL) + E_FATAL("ad_open_sps failed\n"); + + // E_INFO("%s COMPILED ON: %s, AT: %s\n\n", argv[0], __DATE__, __TIME__); + + if (setjmp(jbuf) == 0) { + utterance_loop (argc,argv); + } + + fbs_end (); + ad_close (ad); + + return 0; +} |