sumom****@users*****
sumom****@users*****
2009年 3月 18日 (水) 16:05:31 JST
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 <CoreAudio/CoreAudio.h> #include <AudioUnit/AudioUnit.h> @@ -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 <sys/audioio.h> 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 <sent/stddefs.h> #include <sent/adin.h> +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"); +}