Thanks Frank.  I've committed this, along with a modification to only conditionally apply the MIC/line-in patch, based on a top-level config setting.

C

On Jun 25, 2006, at 10:38 AM, Frank Leipold wrote:

Hi,

I have the application CVoiceControl ready for the gumstix. Maybe others
are also interested in it.I have attached the required files to the mail.

It is a simple speech recognition software. You first record a number of
samples and assign a command with it. When the sample is "heard" on the
microphone, the corresponding command is executed.
See: http://www.kiecza.net/daniel/linux/

(The cvoicecontrol-mixer.patch is only for switching from MIC to LINE
IN, as my gumstix does not work with the MIC channel.)

Cheers,
 Frank


config BR2_PACKAGE_CVC
        bool "cvoicecontrol"
        default n
        help
    Install cVoiceControl.

#############################################################
#
# cvoicecontrol
#
#############################################################

CVC_NAME=cvoicecontrol
CVC_VERSION=0.9alpha


# Don't alter below this line unless you (think) you know
# what you are doing! Danger, Danger!

CVC_SITE=http://www.kiecza.net/daniel/linux/
CVC_SOURCE=$(CVC_NAME)-$(CVC_VERSION).tar.gz
CVC_DIR=$(BUILD_DIR)/${shell basename $(CVC_SOURCE) .tar.gz}

$(DL_DIR)/$(CVC_SOURCE):
$(WGET) -P $(DL_DIR) $(CVC_SITE)/$(CVC_SOURCE)

$(CVC_DIR)/.unpacked: $(DL_DIR)/$(CVC_SOURCE)
gzip -d -c $(DL_DIR)/$(CVC_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
toolchain/patch-kernel.sh $(CVC_DIR) package/cvoicecontrol cvoicecontrol*.patch
touch $(CVC_DIR)/.unpacked

$(CVC_DIR)/Makefile: $(CVC_DIR)/.unpacked
(cd $(CVC_DIR); rm -rf config.cache; \
$(TARGET_CONFIGURE_OPTS) \
CFLAGS="$(TARGET_CFLAGS)" \
ac_cv_c_const=yes \
./configure \
--target=$(GNU_TARGET_NAME) \
--host=$(GNU_TARGET_NAME) \
--build=$(GNU_HOST_NAME) \
--prefix=$(CVC_DIR)/build \
--sysconfdir=$(STAGING_DIR)/etc \
--disable-shared \
$(DISABLE_NLS) \
);

$(CVC_DIR)/cvoicecontrol/cvoicecontrol: $(CVC_DIR)/Makefile
$(MAKE) -C $(CVC_DIR)

$(TARGET_DIR)/usr/bin/cvoicecontrol: $(CVC_DIR)/cvoicecontrol/cvoicecontrol
install -D -m 0755 $(CVC_DIR)/cvoicecontrol/cvoicecontrol $(TARGET_DIR)/usr/bin/cvoicecontrol
install -D -m 0755 $(CVC_DIR)/cvoicecontrol/microphone_config $(TARGET_DIR)/usr/bin/microphone_config
install -D -m 0755 $(CVC_DIR)/cvoicecontrol/model_editor $(TARGET_DIR)/usr/bin/model_editor
$(STRIP) $(TARGET_DIR)/usr/bin/cvoicecontrol
$(STRIP) $(TARGET_DIR)/usr/bin/microphone_config
$(STRIP) $(TARGET_DIR)/usr/bin/model_editor

$(CVC_NAME): uclibc ncurses $(TARGET_DIR)/usr/bin/cvoicecontrol

$(CVC_NAME)-source: $(DL_DIR)/$(CVC_SOURCE)

$(CVC_NAME)-clean:
@if [ -d $(LINPHONE_DIR)/Makefile ] ; then \
$(MAKE) -C $(CVC_DIR) clean ; \
fi;

$(CVC_NAME)-dirclean:
rm -rf $(CVC_DIR) 

#############################################################
#
# Toplevel Makefile options
#
#############################################################
ifeq ($(strip $(BR2_PACKAGE_CVC)),y)
TARGETS+=cvoicecontrol
endif

--- cvoicecontrol-0.9alpha/cvoicecontrol/keypressed.c 2006-05-14 17:52:38.000000000 +0200
+++ cvoicecontrol-0.9alpha/cvoicecontrol/keypressed.c 2006-05-14 17:52:48.000000000 +0200
@@ -77,7 +77,9 @@

 

   set_keypress();

 

-  if ((fd_stdin = open("/dev/stdin", O_RDONLY, 0)) == -1)
+  // FRANK patch - /dev/stdin does not exist on the gumstix
+  //if ((fd_stdin = open("/dev/stdin", O_RDONLY, 0)) == -1)
+  if ((fd_stdin = fileno(stdin)) == -1)
     return 0;

 

   FD_SET(fd_stdin, &reads_keypressed);

--- cvoicecontrol-0.9alpha/cvoicecontrol/microphone_config.c 2006-05-10 17:46:17.000000000 +0200
+++ cvoicecontrol-0.9alpha/cvoicecontrol/microphone_config.c 2006-05-10 17:46:50.000000000 +0200
@@ -1100,7 +1100,8 @@
     }
     fclose(f);

 

-    free(home);
+    //FRA DBG - i don't know why, but now it works
+    //free(home);
   }
   else /***** couldn't retrieve home directory -> store results in /tmp/ */
   {

--- cvoicecontrol-0.9alpha/cvoicecontrol/mixer.c 2006-05-10 19:49:22.000000000 +0200
+++ cvoicecontrol-0.9alpha/cvoicecontrol/mixer.c 2006-05-10 19:49:50.000000000 +0200
@@ -136,7 +136,7 @@
   if (ioctl(fd, SOUND_MIXER_READ_DEVMASK, &mask_mixer) == -1)
     return(MIXER_ERR);

 

-  if (!(mask_mixer & SOUND_MASK_MIC))
+  if (!(mask_mixer & SOUND_MASK_LINE))
     return(MIXER_ERR);

 

   /*
@@ -149,7 +149,7 @@
   if (ioctl(fd, SOUND_MIXER_READ_RECMASK, &mask_mixer) == -1)
     return(MIXER_ERR);

 

-  if (!(mask_mixer & SOUND_MASK_MIC))
+  if (!(mask_mixer & SOUND_MASK_LINE))
     return(MIXER_ERR);

 

   /***** set microphone as active recording channel */
@@ -157,14 +157,14 @@
   if (ioctl(fd, SOUND_MIXER_READ_RECSRC, &mask_mixer) == -1)
     return(MIXER_ERR);

 

-  if (!(mask_mixer & SOUND_MASK_MIC))
+  if (!(mask_mixer & SOUND_MASK_LINE))
   {
-    mask_mixer = SOUND_MASK_MIC;
+    mask_mixer = SOUND_MASK_LINE;
     if (ioctl(fd, SOUND_MIXER_WRITE_RECSRC, &mask_mixer) == -1)
       return(MIXER_ERR);
     if (ioctl(fd, SOUND_MIXER_READ_RECSRC, &mask_mixer) == -1)
       return(MIXER_ERR);
-    if (!(mask_mixer & SOUND_MASK_MIC))
+    if (!(mask_mixer & SOUND_MASK_LINE))
       return(MIXER_ERR);
   }

 

@@ -207,10 +207,10 @@

 

     if ((fd = open(result.gl_pathv[i], O_RDWR, 0)) != -1       &&
  ioctl(fd, SOUND_MIXER_READ_DEVMASK, &mask_mixer) != -1 &&
- (mask_mixer & SOUND_MASK_MIC)   &&
+ (mask_mixer & SOUND_MASK_LINE)   &&
  /* (mask_mixer & SOUND_MASK_IGAIN) && */
  ioctl(fd, SOUND_MIXER_READ_RECMASK, &mask_mixer) != -1 &&
- (mask_mixer & SOUND_MASK_MIC))
+ (mask_mixer & SOUND_MASK_LINE))
     {
       /***** if mixer device looks ok add it to the list */

 

@@ -247,7 +247,7 @@

 

   mask = (level<<8)|level; /***** set left and right channel to the same value */

 

-  if (ioctl(fd, SOUND_MIXER_WRITE_MIC, &mask) == -1)
+  if (ioctl(fd, SOUND_MIXER_WRITE_LINE, &mask) == -1)
     return(MIXER_ERR);

 

   close(fd);

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642_______________________________________________
gumstix-users mailing list
gumstix-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gumstix-users