From sumomo @ users.sourceforge.jp Wed Mar 18 16:05:30 2009 From: sumomo @ users.sourceforge.jp (sumomo @ users.sourceforge.jp) Date: Wed, 18 Mar 2009 16:05:30 +0900 Subject: [Julius-cvs 399] CVS update: julius4/julius Message-ID: <1237359930.678380.26129.nullmailer@users.sourceforge.jp> Index: julius4/julius/recogloop.c diff -u julius4/julius/recogloop.c:1.2 julius4/julius/recogloop.c:1.3 --- julius4/julius/recogloop.c:1.2 Tue Dec 18 17:45:48 2007 +++ julius4/julius/recogloop.c Wed Mar 18 16:05:30 2009 @@ -12,7 +12,7 @@ * @author Akinobu Lee * @date Sun Sep 02 21:12:52 2007 * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * */ /* @@ -145,7 +145,7 @@ return; } if (outfile_enabled) { - outfile_set_fname(j_get_current_filename()); + outfile_set_fname(j_get_current_filename(recog)); } /* start recognizing the stream */ ret = j_recognize_stream(recog); From sumomo @ users.sourceforge.jp Wed Mar 18 16:05:31 2009 From: sumomo @ users.sourceforge.jp (sumomo @ users.sourceforge.jp) Date: Wed, 18 Mar 2009 16:05:31 +0900 Subject: [Julius-cvs 400] CVS update: julius4/plugin Message-ID: <1237359931.204943.26208.nullmailer@users.sourceforge.jp> Index: julius4/plugin/Makefile diff -u julius4/plugin/Makefile:1.1 julius4/plugin/Makefile:1.2 --- julius4/plugin/Makefile:1.1 Thu Sep 25 14:00:08 2008 +++ julius4/plugin/Makefile Wed Mar 18 16:05:31 2009 @@ -11,7 +11,7 @@ J_CFLAGS=-I../libsent/include -I../libjulius/include `../libsent/libsent-config --cflags` `../libjulius/libjulius-config --cflags` J_LDFLAGS=-L../libjulius `../libjulius/libjulius-config --libs` -L../libsent `../libsent/libsent-config --libs` -all: adin_oss.jpi audio_postprocess.jpi fvin.jpi feature_postprocess.jpi calcmix.jpi generic_callback.jpi result.jpi +all: adin_oss.jpi audio_postprocess.jpi fvin.jpi feature_postprocess.jpi calcmix.jpi generic_callback.jpi result.jpi htkout.jpi calcmix.jpi: calcmix.c $(CC) $(CFLAGS) $(J_CFLAGS) -o calcmix.jpi $(LDFLAGS) $(J_LDFLAGS) calcmix.c @@ -19,5 +19,8 @@ generic_callback.jpi: generic_callback.c $(CC) $(CFLAGS) $(J_CFLAGS) -o generic_callback.jpi generic_callback.c $(LDFLAGS) $(J_LDFLAGS) +htkout.jpi: htkout.c + $(CC) $(CFLAGS) $(J_CFLAGS) -o htkout.jpi htkout.c $(LDFLAGS) $(J_LDFLAGS) + clean: rm *.jpi Index: julius4/plugin/adin_oss.c diff -u julius4/plugin/adin_oss.c:1.1 julius4/plugin/adin_oss.c:1.2 --- julius4/plugin/adin_oss.c:1.1 Thu Sep 25 14:00:08 2008 +++ julius4/plugin/adin_oss.c Wed Mar 18 16:05:31 2009 @@ -47,12 +47,13 @@ * - adin_terminate() * - adin_pause() * - adin_resume() + * - adin_input_name() * * * @author Akinobu Lee * @date Thu Aug 7 14:28:37 2008 * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * */ @@ -802,4 +803,27 @@ return TRUE; } +/** + * + * @brief A function to return current device name for information (optional) + * + * This function is totally optional. + * + * @return pointer to the device name string + * + * + * @brief 入力ファイル・デバイス名を返す関数(任意) + * + * @return 入力ファイルあるいはデバイス名の文字列へのポインタ + * + * + */ +char * +adin_input_name() +{ + printf("input name function was called\n"); + return("default"); +} + + /* end of file */ Index: julius4/plugin/fvin.c diff -u julius4/plugin/fvin.c:1.1 julius4/plugin/fvin.c:1.2 --- julius4/plugin/fvin.c:1.1 Thu Sep 25 14:00:08 2008 +++ julius4/plugin/fvin.c Wed Mar 18 16:05:31 2009 @@ -12,7 +12,7 @@ * @author Akinobu Lee * @date Mon Aug 11 17:05:17 2008 * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * */ @@ -40,6 +40,7 @@ * - fvin_terminate() * - fvin_pause() * - fvin_resume() + * - fvin_input_name() * */ @@ -549,4 +550,25 @@ return TRUE; } +/** + * + * @brief A function to return current device name for information (optional) + * + * This function is totally optional. + * + * @return pointer to the device name string + * + * + * @brief 入力ファイル・デバイス名を返す関数(任意) + * + * @return 入力ファイルあるいはデバイス名の文字列へのポインタ + * + * + */ +char * +fvin_input_name() +{ + printf("input name function was called\n"); + return("default"); +} /* end of file */ From sumomo @ users.sourceforge.jp Wed Mar 18 16:05:30 2009 From: sumomo @ users.sourceforge.jp (sumomo @ users.sourceforge.jp) Date: Wed, 18 Mar 2009 16:05:30 +0900 Subject: [Julius-cvs 401] CVS update: julius4/libjulius/include/julius Message-ID: <1237359930.776443.26141.nullmailer@users.sourceforge.jp> Index: julius4/libjulius/include/julius/extern.h diff -u julius4/libjulius/include/julius/extern.h:1.12 julius4/libjulius/include/julius/extern.h:1.13 --- julius4/libjulius/include/julius/extern.h:1.12 Sat Jan 17 16:53:48 2009 +++ julius4/libjulius/include/julius/extern.h Wed Mar 18 16:05:30 2009 @@ -12,7 +12,7 @@ * @author Akinobu LEE * @date Mon Mar 7 23:19:14 2005 * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * */ /* @@ -318,3 +318,4 @@ boolean mfc_module_begin(MFCCCalc *mfcc); boolean mfc_module_end(MFCCCalc *mfcc); int mfc_module_read(MFCCCalc *mfcc, int *new_t); +char *mfc_module_input_name(MFCCCalc *mfcc); Index: julius4/libjulius/include/julius/jfunc.h diff -u julius4/libjulius/include/julius/jfunc.h:1.5 julius4/libjulius/include/julius/jfunc.h:1.6 --- julius4/libjulius/include/julius/jfunc.h:1.5 Sat Jan 17 16:53:48 2009 +++ julius4/libjulius/include/julius/jfunc.h Wed Mar 18 16:05:30 2009 @@ -12,7 +12,7 @@ * @author Akinobu Lee * @date Tue Nov 6 22:41:00 2007 * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * */ /* @@ -52,7 +52,7 @@ Jconf *j_config_load_args_new(int argc, char *argv[]); Jconf *j_config_load_file_new(char *filename); boolean j_adin_init(Recog *recog); -char *j_get_current_filename(); +char *j_get_current_filename(Recog *recog); void j_recog_info(Recog *recog); Recog *j_create_instance_from_jconf(Jconf *jconf); Index: julius4/libjulius/include/julius/recog.h diff -u julius4/libjulius/include/julius/recog.h:1.7 julius4/libjulius/include/julius/recog.h:1.8 --- julius4/libjulius/include/julius/recog.h:1.7 Sat Jan 17 16:53:48 2009 +++ julius4/libjulius/include/julius/recog.h Wed Mar 18 16:05:30 2009 @@ -70,7 +70,7 @@ * @author Akinobu Lee * @date Fri Feb 16 13:42:28 2007 * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * */ /* @@ -347,6 +347,8 @@ boolean (*ad_terminate)(); /// Pointer to function to read samples int (*ad_read)(SP16 *, int); + /// Pointer to function to return current input source name (filename, devname, etc.) + char * (*ad_input_name)(); /* configuration parameters */ int thres; ///< Input Level threshold (0-32767) @@ -423,6 +425,8 @@ unsigned int total_captured_len; unsigned int last_trigger_sample; + char current_input_name[MAXPATHLEN]; + } ADIn; /** @@ -685,6 +689,8 @@ boolean (*fv_pause)(); /// Pointer to function to terminate current recording immediately boolean (*fv_terminate)(); + /// Pointer to function to return current input name + char * (*fv_input_name)(); } func; #ifdef POWER_REJECT From sumomo @ users.sourceforge.jp Wed Mar 18 16:05:30 2009 From: sumomo @ users.sourceforge.jp (sumomo @ users.sourceforge.jp) Date: Wed, 18 Mar 2009 16:05:30 +0900 Subject: [Julius-cvs 402] CVS update: julius4/libsent/include/sent Message-ID: <1237359930.967606.26161.nullmailer@users.sourceforge.jp> Index: julius4/libsent/include/sent/adin.h diff -u julius4/libsent/include/sent/adin.h:1.4 julius4/libsent/include/sent/adin.h:1.5 --- julius4/libsent/include/sent/adin.h:1.4 Thu Sep 25 14:00:07 2008 +++ julius4/libsent/include/sent/adin.h Wed Mar 18 16:05:30 2009 @@ -19,7 +19,7 @@ * @author Akinobu LEE * @date Thu Feb 10 17:22:36 2005 * - * $Revision: 1.4 $ + * $Revision: 1.5 $ */ /* * Copyright (c) 1991-2007 Kawahara Lab., Kyoto University @@ -149,26 +149,31 @@ boolean adin_mic_begin(); boolean adin_mic_end(); int adin_mic_read(SP16 *buf, int sampnum); +char *adin_mic_input_name(); /* adin/adin_mic_linux_alsa.c */ boolean adin_alsa_standby(int freq, void *arg); boolean adin_alsa_begin(); boolean adin_alsa_end(); int adin_alsa_read(SP16 *buf, int sampnum); +char *adin_alsa_input_name(); /* adin/adin_mic_linux_oss.c */ boolean adin_oss_standby(int freq, void *arg); boolean adin_oss_begin(); boolean adin_oss_end(); int adin_oss_read(SP16 *buf, int sampnum); +char *adin_oss_input_name(); /* adin/adin_esd.c */ boolean adin_esd_standby(int freq, void *arg); boolean adin_esd_begin(); boolean adin_esd_end(); int adin_esd_read(SP16 *buf, int sampnum); +char *adin_esd_input_name(); /* adin/adin_netaudio.c and adin/adin_na.c */ boolean adin_netaudio_standby(int freq, void *arg); boolean adin_netaudio_begin(); boolean adin_netaudio_end(); int adin_netaudio_read(SP16 *buf, int sampnum); +char *adin_netaudio_input_name(); int NA_standby(int, char *); void NA_start(); void NA_stop(); @@ -183,6 +188,7 @@ boolean adin_stdin_begin(); int adin_stdin_read(SP16 *buf, int sampnum); char *adin_file_get_current_filename(); +char *adin_stdin_input_name(); /* adin/adin_sndfile.c */ #ifdef HAVE_LIBSNDFILE @@ -201,6 +207,7 @@ boolean adin_tcpip_send_pause(); boolean adin_tcpip_send_terminate(); boolean adin_tcpip_send_resume(); +char *adin_tcpip_input_name(); /* adin/zc-e.c */ void init_count_zc_e(ZEROCROSS *zc, int length); From sumomo @ users.sourceforge.jp Wed Mar 18 16:05:31 2009 From: sumomo @ users.sourceforge.jp (sumomo @ users.sourceforge.jp) Date: Wed, 18 Mar 2009 16:05:31 +0900 Subject: [Julius-cvs 403] CVS update: julius4/libsent/src/adin Message-ID: <1237359931.117774.26197.nullmailer@users.sourceforge.jp> Index: julius4/libsent/src/adin/adin_esd.c diff -u julius4/libsent/src/adin/adin_esd.c:1.3 julius4/libsent/src/adin/adin_esd.c:1.4 --- julius4/libsent/src/adin/adin_esd.c:1.3 Tue Jul 1 13:29:46 2008 +++ julius4/libsent/src/adin/adin_esd.c Wed Mar 18 16:05:30 2009 @@ -21,7 +21,7 @@ * @author Akinobu LEE * @date Sun Feb 13 16:18:26 2005 * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * */ /* @@ -131,3 +131,20 @@ return(cnt); #endif } + +/** + * + * Function to return current input source device name + * + * @return string of current input device name. + * + */ +char * +adin_esd_input_name() +{ +#ifndef HAS_ESD + return NULL; +#else + return(name_buf); +#endif +} Index: julius4/libsent/src/adin/adin_file.c diff -u julius4/libsent/src/adin/adin_file.c:1.5 julius4/libsent/src/adin/adin_file.c:1.6 --- julius4/libsent/src/adin/adin_file.c:1.5 Thu Feb 12 23:22:27 2009 +++ julius4/libsent/src/adin/adin_file.c Wed Mar 18 16:05:30 2009 @@ -56,7 +56,7 @@ * @author Akinobu LEE * @date Sun Feb 13 13:31:20 2005 * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * */ /* @@ -571,3 +571,15 @@ { return(speechfilename); } +/** + * + * A tiny function to get current input raw speech file name. + * + * @return string of current input speech file. + * + */ +char * +adin_stdin_input_name() +{ + return("stdin"); +} Index: julius4/libsent/src/adin/adin_mic_darwin_coreaudio.c diff -u julius4/libsent/src/adin/adin_mic_darwin_coreaudio.c:1.2 julius4/libsent/src/adin/adin_mic_darwin_coreaudio.c:1.3 --- julius4/libsent/src/adin/adin_mic_darwin_coreaudio.c:1.2 Tue Dec 18 17:45:50 2007 +++ julius4/libsent/src/adin/adin_mic_darwin_coreaudio.c Wed Mar 18 16:05:30 2009 @@ -29,7 +29,7 @@ * @author Masatomo Hashimoto * @date Wed Oct 12 11:31:27 2005 * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * */ @@ -44,7 +44,7 @@ * */ -/* $Id: adin_mic_darwin_coreaudio.c,v 1.2 2007/12/18 08:45:50 sumomo Exp $ */ +/* $Id: adin_mic_darwin_coreaudio.c,v 1.3 2009/03/18 07:05:30 sumomo Exp $ */ #include #include @@ -88,6 +88,8 @@ static AudioBufferList BufListBackup; static AudioBufferList* BufListConverted; +static char deviceName[DEVICE_NAME_LEN]; + #ifndef boolean typedef unsigned char boolean; #endif @@ -285,7 +287,6 @@ boolean adin_mic_standby(int sfreq, void* dummy) { OSStatus status; UInt32 propertySize; - char deviceName[DEVICE_NAME_LEN]; struct AudioStreamBasicDescription inDesc; int err; @@ -656,3 +657,16 @@ } return; } + +/** + * + * Function to return current input source device name + * + * @return string of current input device name. + * + */ +char * +adin_mic_input_name() +{ + return(deviceName); +} Index: julius4/libsent/src/adin/adin_mic_freebsd.c diff -u julius4/libsent/src/adin/adin_mic_freebsd.c:1.4 julius4/libsent/src/adin/adin_mic_freebsd.c:1.5 --- julius4/libsent/src/adin/adin_mic_freebsd.c:1.4 Thu Jul 24 18:18:09 2008 +++ julius4/libsent/src/adin/adin_mic_freebsd.c Wed Mar 18 16:05:30 2009 @@ -39,7 +39,7 @@ * @author Akinobu LEE * @date Sun Feb 13 16:18:26 2005 * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * */ /* @@ -78,6 +78,9 @@ #define FREQALLOWRANGE 200 ///< Acceptable width of sampling frequency #define POLLINTERVAL 200 ///< Polling interval in miliseconds +static char *defaultdev = DEFAULT_DEVICE; ///< Default device name +static char devname[MAXPATHLEN]; ///< Current device name + /** * Device initialization: check device capability and open for recording. * @@ -92,17 +95,18 @@ int fmt, fmt_can, fmt1, fmt2, rfmt; /* sampling format */ int samplerate; /* actual sampling rate */ int stereo; /* mono */ - char *defaultdev = DEFAULT_DEVICE; /* default device */ - char *devname; + char *p; /* set device name */ - if ((devname = getenv("AUDIODEV")) == NULL) { - devname = defaultdev; + if ((p = getenv("AUDIODEV")) == NULL) { + strncpy(devname, defaultdev, MAXPATHLEN); jlog("Stat: adin_freebsd: device name = %s\n", devname); } else { - jlog("Stat: adin_freebsd: device name obtained from AUDIODEV: %s\n", devname); + jlog("Stat: adin_freebsd: device name obtained from AUDIODEV: %s\n", p); + } else { + strncpy(devname, p, MAXPATHLEN); } - + /* open device */ if ((audio_fd = open(devname, O_RDONLY)) == -1) { jlog("Error: adin_freebsd: failed to open %s\n", devname); @@ -256,3 +260,16 @@ if (need_swap) swap_sample_bytes(buf, cnt); return(cnt); } + +/** + * + * Function to return current input source device name + * + * @return string of current input device name. + * + */ +char * +adin_mic_input_name() +{ + return(devname); +} Index: julius4/libsent/src/adin/adin_mic_linux.c diff -u julius4/libsent/src/adin/adin_mic_linux.c:1.2 julius4/libsent/src/adin/adin_mic_linux.c:1.3 --- julius4/libsent/src/adin/adin_mic_linux.c:1.2 Thu Jul 24 18:18:09 2008 +++ julius4/libsent/src/adin/adin_mic_linux.c Wed Mar 18 16:05:30 2009 @@ -20,7 +20,7 @@ * @author Akinobu LEE * @date Sun Feb 13 16:18:26 2005 * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * */ /* @@ -122,3 +122,24 @@ return -2; #endif } + +/** + * + * Function to return current input source device name + * + * @return string of current input device name. + * + */ +char * +adin_mic_input_name() +{ +#if defined(HAS_ALSA) + return(adin_alsa_input_name()); +#elif defined(HAS_OSS) + return(adin_oss_input_name()); +#elif defined(HAS_ESD) + return(adin_esd_input_name()); +#else /* other than Linux */ + return("Error: neither of alsa/oss/esd device is available\n"); +#endif +} Index: julius4/libsent/src/adin/adin_mic_linux_alsa.c diff -u julius4/libsent/src/adin/adin_mic_linux_alsa.c:1.9 julius4/libsent/src/adin/adin_mic_linux_alsa.c:1.10 --- julius4/libsent/src/adin/adin_mic_linux_alsa.c:1.9 Fri Jan 9 14:54:10 2009 +++ julius4/libsent/src/adin/adin_mic_linux_alsa.c Wed Mar 18 16:05:30 2009 @@ -44,7 +44,7 @@ * @author Akinobu LEE * @date Sun Feb 13 16:18:26 2005 * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * */ /* @@ -70,7 +70,7 @@ #endif static snd_pcm_t *handle; ///< Audio handler -static char *pcm_name = "default"; ///< Name of the PCM device, can be overridden by env ALSADEV +static char pcm_name[MAXPATHLEN]; ///< Name of the PCM device static int latency = 32; ///< Lantency time in msec. You can override this value by specifying environment valuable "LATENCY_MSEC". static boolean need_swap; ///< Whether samples need byte swap @@ -178,8 +178,10 @@ /* check $ALSADEV for device name */ if ((p = getenv("ALSADEV")) != NULL) { - pcm_name = p; + strncpy(pcm_name, p, MAXPATHLEN); jlog("Stat: adin_alsa: device name from ALSADEV: \"%s\"\n", pcm_name); + } else { + strcpy(pcm_name, "default"); } /* open device in non-block mode) */ @@ -562,4 +564,21 @@ #endif /* HAS_ALSA */ } +/** + * + * Function to return current input source device name + * + * @return string of current input device name. + * + */ +char * +adin_alsa_input_name() +{ +#ifndef HAS_ALSA + return NULL; +#else + return(pcm_name); +#endif +} + /* end of file */ Index: julius4/libsent/src/adin/adin_mic_linux_oss.c diff -u julius4/libsent/src/adin/adin_mic_linux_oss.c:1.5 julius4/libsent/src/adin/adin_mic_linux_oss.c:1.6 --- julius4/libsent/src/adin/adin_mic_linux_oss.c:1.5 Thu Jul 24 18:18:09 2008 +++ julius4/libsent/src/adin/adin_mic_linux_oss.c Wed Mar 18 16:05:30 2009 @@ -51,7 +51,7 @@ * @author Akinobu LEE * @date Sun Feb 13 16:18:26 2005 * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * */ /* @@ -102,6 +102,8 @@ static boolean need_swap; ///< Whether samples need byte swap static int frag_size; ///< Actual data fragment size static boolean stereo_rec; ///< TRUE if stereo recording (use left only) +static char *defaultdev = DEFAULT_DEVICE; ///< Default device name +static char devname[MAXPATHLEN]; ///< Current device name /** * Device initialization: check device capability and open for recording. @@ -120,17 +122,16 @@ #else int fmt, fmt_can, fmt1, fmt2, rfmt; /* sampling format */ int samplerate; /* 16kHz */ - char *defaultdev = DEFAULT_DEVICE; /* default device */ - char *devname; int frag; int frag_msec; - char *env; + char *env, *p; /* set device name */ - if ((devname = getenv("AUDIODEV")) == NULL) { - devname = defaultdev; + if ((p = getenv("AUDIODEV")) == NULL) { + strncpy(devname, defaultdev, MAXPATHLEN); jlog("Stat: adin_oss: device name = %s\n", devname); } else { + strncpy(devname, p, MAXPATHLEN); jlog("Stat: adin_oss: device name obtained from AUDIODEV: %s\n", devname); } @@ -452,3 +453,19 @@ #endif /* HAS_OSS */ } +/** + * + * Function to return current input source device name + * + * @return string of current input device name. + * + */ +char * +adin_oss_input_name() +{ +#ifndef HAS_OSS + return NULL; +#else + return(devname); +#endif +} Index: julius4/libsent/src/adin/adin_mic_o2.c diff -u julius4/libsent/src/adin/adin_mic_o2.c:1.2 julius4/libsent/src/adin/adin_mic_o2.c:1.3 --- julius4/libsent/src/adin/adin_mic_o2.c:1.2 Tue Dec 18 17:45:50 2007 +++ julius4/libsent/src/adin/adin_mic_o2.c Wed Mar 18 16:05:30 2009 @@ -29,7 +29,7 @@ * @author Akinobu LEE * @date Sun Feb 13 18:42:22 2005 * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * */ /* @@ -167,3 +167,18 @@ } return cnt; } + +/** + * + * Function to return current input source device name + * + * @return string of current input device name. + * + */ +char * +adin_mic_input_name() +{ + return("Microphone"); +} + +/* end of file */ Index: julius4/libsent/src/adin/adin_mic_sol2.c diff -u julius4/libsent/src/adin/adin_mic_sol2.c:1.2 julius4/libsent/src/adin/adin_mic_sol2.c:1.3 --- julius4/libsent/src/adin/adin_mic_sol2.c:1.2 Tue Dec 18 17:45:50 2007 +++ julius4/libsent/src/adin/adin_mic_sol2.c Wed Mar 18 16:05:30 2009 @@ -38,7 +38,7 @@ * @author Akinobu LEE * @date Sun Feb 13 19:06:46 2005 * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * */ /* @@ -61,10 +61,13 @@ #include static int afd; ///< Audio file descriptor static struct audio_info ainfo; ///< Audio format information +static char *defaultdev = DEFAULT_DEVICE; +static char devname[MAXPATHLEN]; /// Default device name, can be overridden by AUDIODEV environment variable #define DEFAULT_DEVICE "/dev/audio" + /** * Device initialization: check device capability and open for recording. * @@ -76,14 +79,13 @@ boolean adin_mic_standby(int sfreq, void *arg) { - char *defaultdev = DEFAULT_DEVICE; - char *devname; - + char *p; /* get device name if specified in $AUDIODEV */ - if ((devname = getenv("AUDIODEV")) == NULL) { - devname = defaultdev; + if ((p = getenv("AUDIODEV")) == NULL) { + strncpy(devname, defaultdev, MAXPATHLEN); jlog("Stat: adin_sol2: device name = %s\n", devname); } else { + strncpy(devname, p, MAXPATHLEN); jlog("Stat: adin_sol2: device name obtained from AUDIODEV: %s\n", devname); } @@ -207,3 +209,18 @@ } return(cnt); } + +/** + * + * Function to return current input source device name + * + * @return string of current input device name. + * + */ +char * +adin_mic_input_name() +{ + return(devname); +} + +/* end of file */ Index: julius4/libsent/src/adin/adin_mic_sp.c diff -u julius4/libsent/src/adin/adin_mic_sp.c:1.2 julius4/libsent/src/adin/adin_mic_sp.c:1.3 --- julius4/libsent/src/adin/adin_mic_sp.c:1.2 Tue Dec 18 17:45:50 2007 +++ julius4/libsent/src/adin/adin_mic_sp.c Wed Mar 18 16:05:30 2009 @@ -35,7 +35,7 @@ * @author Akinobu LEE * @date Sun Feb 13 19:16:43 2005 * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * */ /* adin_mic_sp.c --- adin microphone library for spAudio @@ -136,3 +136,16 @@ return nread; } + +/** + * + * Function to return current input source device name + * + * @return string of current input device name. + * + */ +char * +adin_mic_input_name() +{ + return("SP default device"); +} Index: julius4/libsent/src/adin/adin_mic_sun4.c diff -u julius4/libsent/src/adin/adin_mic_sun4.c:1.2 julius4/libsent/src/adin/adin_mic_sun4.c:1.3 --- julius4/libsent/src/adin/adin_mic_sun4.c:1.2 Tue Dec 18 17:45:50 2007 +++ julius4/libsent/src/adin/adin_mic_sun4.c Wed Mar 18 16:05:30 2009 @@ -34,7 +34,7 @@ * @author Akinobu LEE * @date Sun Feb 13 18:56:13 2005 * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * */ /* @@ -67,6 +67,8 @@ static int afd; ///< Audio file descriptor static struct pollfd pfd; ///< File descriptor for polling static audio_info_t ainfo; ///< Audio info +static char *defaultdev = DEFAULT_DEVICE; +static char devname[MAXPATHLEN]; /** * Device initialization: check device capability and open for recording. @@ -79,16 +81,16 @@ boolean adin_mic_standby(int sfreq, void *dummy) { - char *defaultdev = DEFAULT_DEVICE; - char *devname; Audio_hdr Dev_hdr, old_hdr; double vol; + char *p; /* get device name if specified in $AUDIODEV */ - if ((devname = getenv("AUDIODEV")) == NULL) { - devname = defaultdev; + if ((p = getenv("AUDIODEV")) == NULL) { + strncpy(devname, defaultdev, MAXPATHLEN); jlog("Stat: adin_sun4: device name = %s\n", devname); } else { + strncpy(devname, p, MAXPATHLEN); jlog("Stat: adin_sun4: device name obtained from AUDIODEV: %s\n", devname); } @@ -220,3 +222,18 @@ } return(bytes / sizeof(SP16)); /* success */ } + +/** + * + * Function to return current input source device name + * + * @return string of current input device name. + * + */ +char * +adin_mic_input_name() +{ + return(devname); +} + +/* end of file */ Index: julius4/libsent/src/adin/adin_netaudio.c diff -u julius4/libsent/src/adin/adin_netaudio.c:1.2 julius4/libsent/src/adin/adin_netaudio.c:1.3 --- julius4/libsent/src/adin/adin_netaudio.c:1.2 Tue Dec 18 17:45:50 2007 +++ julius4/libsent/src/adin/adin_netaudio.c Wed Mar 18 16:05:30 2009 @@ -26,7 +26,7 @@ * @author Akinobu LEE * @date Sun Feb 13 19:50:55 2005 * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * */ /* @@ -46,6 +46,8 @@ #include #include +static char server_devname[MAXPATHLEN]; ///< Device name + /** * Connection initialization: check connectivity and open for recording. * @@ -57,8 +59,7 @@ boolean adin_netaudio_standby(int sfreq, void *arg) { - char *server_devname; - server_devname = arg; + strncpy(server_devname, arg, MAXPATHLEN); if (NA_standby(sfreq, server_devname) == 0) return(FALSE); /* error */ return(TRUE); } @@ -110,3 +111,16 @@ } return(cnt); } + +/** + * + * Function to return current input source device name + * + * @return string of current input device name. + * + */ +char * +adin_netaudio_input_name() +{ + return(server_devname); +} Index: julius4/libsent/src/adin/adin_portaudio.c diff -u julius4/libsent/src/adin/adin_portaudio.c:1.2 julius4/libsent/src/adin/adin_portaudio.c:1.3 --- julius4/libsent/src/adin/adin_portaudio.c:1.2 Tue Dec 18 17:45:50 2007 +++ julius4/libsent/src/adin/adin_portaudio.c Wed Mar 18 16:05:30 2009 @@ -44,7 +44,7 @@ * @author Akinobu LEE * @date Mon Feb 14 12:03:48 2005 * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * */ /* @@ -334,3 +334,15 @@ return len; } +/** + * + * Function to return current input source device name + * + * @return string of current input device name. + * + */ +char * +adin_mic_input_name() +{ + return("Portaudio default device"); +} Index: julius4/libsent/src/adin/adin_tcpip.c diff -u julius4/libsent/src/adin/adin_tcpip.c:1.3 julius4/libsent/src/adin/adin_tcpip.c:1.4 --- julius4/libsent/src/adin/adin_tcpip.c:1.3 Thu Sep 25 14:00:07 2008 +++ julius4/libsent/src/adin/adin_tcpip.c Wed Mar 18 16:05:30 2009 @@ -45,7 +45,7 @@ * @author Akinobu LEE * @date Mon Feb 14 14:55:03 2005 * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * */ /* @@ -299,3 +299,15 @@ return TRUE; } +/** + * + * Function to return current input source device name + * + * @return string of current input device name. + * + */ +char * +adin_tcpip_input_name() +{ + return("network socket"); +} From sumomo @ users.sourceforge.jp Wed Mar 18 16:05:30 2009 From: sumomo @ users.sourceforge.jp (sumomo @ users.sourceforge.jp) Date: Wed, 18 Mar 2009 16:05:30 +0900 Subject: [Julius-cvs 404] CVS update: julius4/libjulius/src Message-ID: <1237359930.879467.26154.nullmailer@users.sourceforge.jp> Index: julius4/libjulius/src/jfunc.c diff -u julius4/libjulius/src/jfunc.c:1.5 julius4/libjulius/src/jfunc.c:1.6 --- julius4/libjulius/src/jfunc.c:1.5 Fri Dec 12 16:14:57 2008 +++ julius4/libjulius/src/jfunc.c Wed Mar 18 16:05:30 2009 @@ -19,7 +19,7 @@ * @author Akinobu Lee * @date Wed Aug 8 15:04:28 2007 * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * */ /* @@ -561,28 +561,45 @@ /** * - * Return current input speech file name. - * Invalid when MFCC input. + * Return current input speech file name. return NULL if the current + * input device does not support this function. * * - * 現在の入力ファイル名を返す. - * MFCC入力時は使えない. + * 現在の入力ファイル名を返す.現在の入力デバイスがこの機能をサポート + * していない場合は NULL を返す. * * - * @return the file name. + * @param recog [in] engine instance + * + * @return the file name, or NULL when this function is not available on + * the current input device. * * @callgraph * @callergraph * @ingroup engine */ char * -j_get_current_filename() +j_get_current_filename(Recog *recog) { -#ifdef HAVE_LIBSNDFILE - return(adin_sndfile_get_current_filename()); -#else - return(adin_file_get_current_filename()); -#endif + char *p; + p = NULL; + if (recog->jconf->input.type == INPUT_WAVEFORM) { + /* adin function input */ + if (recog->adin->ad_input_name != NULL) { + p = recog->adin->ad_input_name(); + } + } else { + switch(recog->jconf->input.speech_input) { + case SP_MFCMODULE: + p = mfc_module_input_name(recog->mfcclist); + break; + case SP_MFCFILE: + /* already assigned */ + p = recog->adin->current_input_name; + break; + } + } + return p; } Index: julius4/libjulius/src/m_adin.c diff -u julius4/libjulius/src/m_adin.c:1.7 julius4/libjulius/src/m_adin.c:1.8 --- julius4/libjulius/src/m_adin.c:1.7 Thu Sep 25 14:00:06 2008 +++ julius4/libjulius/src/m_adin.c Wed Mar 18 16:05:30 2009 @@ -12,7 +12,7 @@ * @author Akinobu LEE * @date Fri Mar 18 16:17:23 2005 * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * */ /* @@ -47,6 +47,7 @@ a->ad_pause = NULL; a->ad_terminate = NULL; a->ad_read = adin_sndfile_read; + a->ad_input_name = adin_sndfile_get_current_filename; a->silence_cut_default = FALSE; a->enable_thread = FALSE; #else /* ~HAVE_LIBSNDFILE */ @@ -58,6 +59,7 @@ a->ad_pause = NULL; a->ad_terminate = NULL; a->ad_read = adin_file_read; + a->ad_input_name = adin_file_get_current_filename; a->silence_cut_default = FALSE; a->enable_thread = FALSE; #endif @@ -76,6 +78,7 @@ a->ad_begin = adin_mic_begin; a->ad_end = adin_mic_end; a->ad_read = adin_mic_read; + a->ad_input_name = adin_mic_input_name; break; #ifdef HAS_ALSA case SP_INPUT_ALSA: @@ -83,6 +86,7 @@ a->ad_begin = adin_alsa_begin; a->ad_end = adin_alsa_end; a->ad_read = adin_alsa_read; + a->ad_input_name = adin_alsa_input_name; break; #endif #ifdef HAS_OSS @@ -91,6 +95,7 @@ a->ad_begin = adin_oss_begin; a->ad_end = adin_oss_end; a->ad_read = adin_oss_read; + a->ad_input_name = adin_oss_input_name; break; #endif #ifdef HAS_ESD @@ -99,6 +104,7 @@ a->ad_begin = adin_esd_begin; a->ad_end = adin_esd_end; a->ad_read = adin_esd_read; + a->ad_input_name = adin_esd_input_name; break; #endif default: @@ -116,6 +122,7 @@ a->ad_pause = NULL; a->ad_terminate = NULL; a->ad_read = adin_netaudio_read; + a->ad_input_name = adin_netaudio_input_name; a->silence_cut_default = TRUE; a->enable_thread = TRUE; break; @@ -129,6 +136,7 @@ a->ad_pause = adin_tcpip_send_pause; a->ad_terminate = adin_tcpip_send_terminate; a->ad_read = adin_tcpip_read; + a->ad_input_name = adin_tcpip_input_name; a->silence_cut_default = FALSE; a->enable_thread = FALSE; break; @@ -141,6 +149,7 @@ a->ad_pause = NULL; a->ad_terminate = NULL; a->ad_read = adin_stdin_read; + a->ad_input_name = adin_stdin_input_name; a->silence_cut_default = FALSE; a->enable_thread = FALSE; break; @@ -260,6 +269,7 @@ adin->ad_pause = (boolean (*)()) plugin_get_func(sid, "adin_pause"); adin->ad_terminate = (boolean (*)()) plugin_get_func(sid, "adin_terminate"); adin->ad_read = (int (*)(SP16 *, int)) plugin_get_func(sid, "adin_read"); + adin->ad_input_name = (char (*)()) plugin_get_func(sid, "adin_input_name"); if (adin->ad_read == NULL) { jlog("ERROR: m_adin: selected plugin has no function adin_read()\n"); return FALSE; Index: julius4/libjulius/src/plugin.c diff -u julius4/libjulius/src/plugin.c:1.1 julius4/libjulius/src/plugin.c:1.2 --- julius4/libjulius/src/plugin.c:1.1 Thu Sep 25 14:00:06 2008 +++ julius4/libjulius/src/plugin.c Wed Mar 18 16:05:30 2009 @@ -12,7 +12,7 @@ * @author Akinobu Lee * @date Sat Aug 2 09:46:09 2008 * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * */ /* @@ -492,6 +492,7 @@ mfcc->func.fv_resume = (boolean (*)()) plugin_get_func(mfcc->plugin_source, "fvin_resume"); mfcc->func.fv_pause = (boolean (*)()) plugin_get_func(mfcc->plugin_source, "fvin_pause"); mfcc->func.fv_terminate= (boolean (*)()) plugin_get_func(mfcc->plugin_source, "fvin_terminate"); + mfcc->func.fv_input_name= (char * (*)()) plugin_get_func(mfcc->plugin_source, "fvin_input_name"); if (mfcc->func.fv_read == NULL) { jlog("ERROR: FEATURE_INPUT plugin: fvin_read() not found!\n"); @@ -602,6 +603,15 @@ return 0; } +char * +mfc_module_input_name(MFCCCalc *mfcc) +{ + int ret; + + if (mfcc->func.fv_input_name) return(mfcc->func.fv_input_name()); + return NULL; +} + #endif /* ENABLE_PLUGIN */ /* end of file */ Index: julius4/libjulius/src/recogmain.c diff -u julius4/libjulius/src/recogmain.c:1.11 julius4/libjulius/src/recogmain.c:1.12 --- julius4/libjulius/src/recogmain.c:1.11 Sat Jan 17 16:53:47 2009 +++ julius4/libjulius/src/recogmain.c Wed Mar 18 16:05:30 2009 @@ -12,7 +12,7 @@ * @author Akinobu Lee * @date Wed Aug 8 14:53:53 2007 * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * */ @@ -493,6 +493,7 @@ j_open_stream(Recog *recog, char *file_or_dev_name) { Jconf *jconf; + char *p; jconf = recog->jconf; @@ -509,11 +510,13 @@ } } #endif + /* when using adin func, input name should be obtained when called */ } else { switch(jconf->input.speech_input) { case SP_MFCMODULE: param_init_content(recog->mfcclist->param); if (mfc_module_begin(recog->mfcclist) == FALSE) return -2; + /* when using mfc module func, input name should be obtained when called */ break; case SP_MFCFILE: /* read parameter file */ @@ -528,12 +531,24 @@ } /* output frame length */ callback_exec(CALLBACK_STATUS_PARAM, recog); + /* store the input filename here */ + strncpy(recog->adin->current_input_name, file_or_dev_name, MAXPATHLEN); break; default: jlog("ERROR: j_open_stream: none of SP_MFC_*??\n"); return -1; } } + + if (jconf->input.speech_input != SP_MFCFILE) { + /* store current input name using input source specific function */ + p = j_get_current_filename(recog); + if (p) { + strncpy(recog->adin->current_input_name, p, MAXPATHLEN); + } else { + recog->adin->current_input_name[0] = '\0'; + } + } return 0; From sumomo @ users.sourceforge.jp Thu Mar 19 20:02:23 2009 From: sumomo @ users.sourceforge.jp (sumomo @ users.sourceforge.jp) Date: Thu, 19 Mar 2009 20:02:23 +0900 Subject: [Julius-cvs 405] CVS update: julius4/libjulius/src Message-ID: <1237460543.531885.14372.nullmailer@users.sourceforge.jp> Index: julius4/libjulius/src/m_adin.c diff -u julius4/libjulius/src/m_adin.c:1.8 julius4/libjulius/src/m_adin.c:1.9 --- julius4/libjulius/src/m_adin.c:1.8 Wed Mar 18 16:05:30 2009 +++ julius4/libjulius/src/m_adin.c Thu Mar 19 20:02:23 2009 @@ -12,7 +12,7 @@ * @author Akinobu LEE * @date Fri Mar 18 16:17:23 2005 * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * */ /* @@ -269,7 +269,7 @@ adin->ad_pause = (boolean (*)()) plugin_get_func(sid, "adin_pause"); adin->ad_terminate = (boolean (*)()) plugin_get_func(sid, "adin_terminate"); adin->ad_read = (int (*)(SP16 *, int)) plugin_get_func(sid, "adin_read"); - adin->ad_input_name = (char (*)()) plugin_get_func(sid, "adin_input_name"); + adin->ad_input_name = (char * (*)()) plugin_get_func(sid, "adin_input_name"); if (adin->ad_read == NULL) { jlog("ERROR: m_adin: selected plugin has no function adin_read()\n"); return FALSE;