galat****@lists*****
galat****@lists*****
2009年 2月 13日 (金) 11:02:47 JST
Index: gtalk/Changelog diff -u gtalk/Changelog:1.43 gtalk/Changelog:1.44 --- gtalk/Changelog:1.43 Fri Feb 13 02:43:42 2009 +++ gtalk/Changelog Fri Feb 13 11:02:47 2009 @@ -1,3 +1,7 @@ +変更点 gtalk-070712 -> gtalk-090213 +・出力オーディオデバイスを環境変数・設定ファイルから指定可能に(linuxのみ) +・デバイス初期化手順の誤りを修正 +=============================================================================== 変更点 gtalk-070712 -> gtalk-080731 ・APBのタグに対応 ("Unknown tag ... 'APB'" が表示されるバグをフィックス) ・Windows版で "Tag error ... /W1" が表示されるバグをフィックス Index: gtalk/configure diff -u gtalk/configure:1.6 gtalk/configure:1.7 --- gtalk/configure:1.6 Thu Oct 19 21:47:47 2006 +++ gtalk/configure Fri Feb 13 11:02:47 2009 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for gtalk 1.4. +# Generated by GNU Autoconf 2.59 for gtalk 1.5. # # Report bugs to <galat****@lists*****>. # @@ -269,8 +269,8 @@ # Identity of this package. PACKAGE_NAME='gtalk' PACKAGE_TARNAME='gtalk' -PACKAGE_VERSION='1.4' -PACKAGE_STRING='gtalk 1.4' +PACKAGE_VERSION='1.5' +PACKAGE_STRING='gtalk 1.5' PACKAGE_BUGREPORT='galat****@lists*****' # Factoring default headers for most tests. @@ -779,7 +779,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures gtalk 1.4 to adapt to many kinds of systems. +\`configure' configures gtalk 1.5 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -840,7 +840,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of gtalk 1.4:";; + short | recursive ) echo "Configuration of gtalk 1.5:";; esac cat <<\_ACEOF @@ -977,7 +977,7 @@ test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -gtalk configure 1.4 +gtalk configure 1.5 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -991,7 +991,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by gtalk $as_me 1.4, which was +It was created by gtalk $as_me 1.5, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -5639,7 +5639,7 @@ } >&5 cat >&5 <<_CSEOF -This file was extended by gtalk $as_me 1.4, which was +This file was extended by gtalk $as_me 1.5, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -5694,7 +5694,7 @@ cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -gtalk config.status 1.4 +gtalk config.status 1.5 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" @@ -6167,3 +6167,4 @@ # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi + Index: gtalk/configure.in diff -u gtalk/configure.in:1.5 gtalk/configure.in:1.6 --- gtalk/configure.in:1.5 Thu Oct 19 21:47:47 2006 +++ gtalk/configure.in Fri Feb 13 11:02:47 2009 @@ -1,6 +1,6 @@ -dnl $Id: configure.in,v 1.5 2006/10/19 12:47:47 sako Exp $ +dnl $Id: configure.in,v 1.6 2009/02/13 02:02:47 sako Exp $ dnl Process this file with autoconf to produce a configure script. -AC_INIT(gtalk, 1.4, galat****@lists*****) +AC_INIT(gtalk, 1.5, galat****@lists*****) dnl install-sh will be searched (and found) here AC_CONFIG_AUX_DIR(config) @@ -279,4 +279,4 @@ AC_MSG_ERROR(libexslt not found)) fi -AC_OUTPUT(Makefile) \ No newline at end of file +AC_OUTPUT(Makefile) Index: gtalk/confpara.h diff -u gtalk/confpara.h:1.15 gtalk/confpara.h:1.16 --- gtalk/confpara.h:1.15 Thu Oct 19 12:27:08 2006 +++ gtalk/confpara.h Fri Feb 13 11:02:47 2009 @@ -2,7 +2,7 @@ /* Yamashita Lab., Ritsumeikan University */ /* All rights reserved */ /* */ -/* $Id: confpara.h,v 1.15 2006/10/19 03:27:08 sako Exp $ */ +/* $Id: confpara.h,v 1.16 2009/02/13 02:02:47 sako Exp $ */ /* 音素セット */ @@ -71,6 +71,8 @@ extern int n_speaker; /* 登録された話者数 */ extern int spid; /* 現在の話者ID */ +extern char *conf_audiodev; /* 実行時に指定されるオーディオデバイス */ + #define DEF_ALPHA 0.42 #define DEF_SP_CODE "male01" #define DEF_SP_GENDER MALE Index: gtalk/da.h diff -u gtalk/da.h:1.8 gtalk/da.h:1.9 --- gtalk/da.h:1.8 Thu Oct 19 12:27:08 2006 +++ gtalk/da.h Fri Feb 13 11:02:47 2009 @@ -5,7 +5,7 @@ /* (Nagoya Institute of Technology) */ /* All rights reserved */ /* */ -/* $Id: da.h,v 1.8 2006/10/19 03:27:08 sako Exp $ */ +/* $Id: da.h,v 1.9 2009/02/13 02:02:47 sako Exp $ */ #include <stdio.h> @@ -13,7 +13,8 @@ #include <fcntl.h> #include <sys/ioctl.h> #include <sys/soundcard.h> -#define AUDIO_DEV "/dev/dsp" +#define AUDIO_DEV_DEFAULT "/dev/dsp" +#define AUDIO_DEV_ENVNAME "AUDIODEV_GTALK" #define MIXER_DEV "/dev/mixer" #define MAXAMPGAIN 100 #define DEFAULT_FREQ 16 Index: gtalk/do_output.c diff -u gtalk/do_output.c:1.20 gtalk/do_output.c:1.21 --- gtalk/do_output.c:1.20 Thu Oct 19 12:26:33 2006 +++ gtalk/do_output.c Fri Feb 13 11:02:47 2009 @@ -9,7 +9,7 @@ /* (Nagoya Institute of Technology) */ /* All rights reserved */ /* */ -/* $Id: do_output.c,v 1.20 2006/10/19 03:26:33 sako Exp $ */ +/* $Id: do_output.c,v 1.21 2009/02/13 02:02:47 sako Exp $ */ /* 波形を生成しながらの音声出力処理は pthread を用いて実装されている。 これは AUTO_DA が定義されていれば,組み込まれる。 @@ -54,7 +54,6 @@ #include <pthread.h> #define SIZE 256*400 -size_t abuf_size; #ifdef LINUX int org_vol, org_channels, org_precision, org_freq; @@ -169,15 +168,25 @@ #ifdef LINUX int arg; int channels; - if( (adfp = fopen( AUDIO_DEV, "w")) == NULL){ - ErrMsg("can't open audio device\n"); - restart( 1 ); + char *devname; + + /* 環境変数によって指定された場合 */ + if ((devname = getenv(AUDIO_DEV_ENVNAME)) != NULL) { + adfp = fopen(devname, "w"); + /* 設定ファイルで指定されている場合 */ + } + else if( conf_audiodev != NULL){ + adfp = fopen(conf_audiodev, "w"); + } else { + adfp = fopen(AUDIO_DEV_DEFAULT, "w"); + } + if( adfp == NULL){ + ErrMsg("can't open audio device\n"); + restart( 1 ); } ADFD = adfp->_fileno; ACFD = open( MIXER_DEV, O_RDWR, 0); - ioctl(ADFD, SNDCTL_DSP_GETBLKSIZE, &abuf_size); - /* モノラルの音声出力が可能かどうかのチェック */ forced_stereo = 0; channels = 0; /* 0: monoral */ @@ -196,18 +205,35 @@ arg = data_type[dtype].precision; ioctl(ADFD, SOUND_PCM_WRITE_BITS, &arg); /* arg = data_type[dtype].channel; */ - arg = 0; + if (forced_stereo == 1) { + arg = 2; + } else { + arg = 1; + } ioctl(ADFD, SOUND_PCM_WRITE_CHANNELS, &arg); arg = data_type[dtype].sample; ioctl(ADFD, SOUND_PCM_WRITE_RATE, &arg); #endif /* LINUX */ #ifdef SOLARIS audio_info_t data; + char *devname; ACFD = open(AUDIO_CTLDEV, O_RDWR, 0); - if( (adfp = fopen(AUDIO_DEV, "w")) == NULL){ - ErrMsg( "can't open audio device\n"); - restart(1); + + /* 設定ファイルで指定されている場合 */ + /* 環境変数によって指定された場合 */ + if ((devname = getenv(AUDIO_DEV_ENVNAME)) != NULL) { + adfp = fopen(devname, "w"); + } + else if( conf_audiodev != NULL){ + adfp = fopen(conf_audiodev, "w"); + } + else { + adfp = fopen(AUDIO_DEV_DEFAULT, "w"); + } + if( adfp == NULL){ + ErrMsg("can't open audio device\n"); + restart( 1 ); } ADFD = adfp->_file; @@ -228,10 +254,22 @@ void reset_audiodev() { #ifdef LINUX + char *devname; + ACFD = open( MIXER_DEV, O_RDWR, 0); /* ADFD = open( AUDIO_DEV, O_RDWR, 0); */ - ADFD = open( AUDIO_DEV, O_WRONLY, 0); + /* 環境変数によって指定された場合 */ + if ((devname = getenv(AUDIO_DEV_ENVNAME)) != NULL) { + ADFD = open(devname, O_WRONLY, 0); + } + /* 設定ファイルで指定されている場合 */ + else if( conf_audiodev != NULL){ + adfp = fopen(conf_audiodev, "w"); + } + else { + ADFD = open(AUDIO_DEV_DEFAULT, O_WRONLY, 0); + } ioctl(ADFD, SOUND_PCM_WRITE_BITS, &org_precision); ioctl(ADFD, SOUND_PCM_WRITE_CHANNELS, &org_channels); ioctl(ADFD, SOUND_PCM_WRITE_RATE, &org_freq); Index: gtalk/main.c diff -u gtalk/main.c:1.31 gtalk/main.c:1.32 --- gtalk/main.c:1.31 Fri Feb 13 02:43:42 2009 +++ gtalk/main.c Fri Feb 13 11:02:47 2009 @@ -4,7 +4,7 @@ /* */ /* The code is developed by Yamashita-lab, Ritsumeikan University */ /* */ -/* $Id: main.c,v 1.31 2009/02/12 17:43:42 sako Exp $ */ +/* $Id: main.c,v 1.32 2009/02/13 02:02:47 sako Exp $ */ #include <stdio.h> #include <stdlib.h> @@ -78,6 +78,7 @@ FILE *logfp; SPEAKER speaker[MAX_SPEAKER]; char *dic_file; +char *conf_audiodev = NULL; /* 実行時に指定されるオーディオデバイス */ /* hmmsynth.h グローバル変数定義 */ int nstate; Index: gtalk/read_conf.c diff -u gtalk/read_conf.c:1.17 gtalk/read_conf.c:1.18 --- gtalk/read_conf.c:1.17 Thu Oct 19 12:26:33 2006 +++ gtalk/read_conf.c Fri Feb 13 11:02:47 2009 @@ -2,7 +2,7 @@ /* Yamashita Lab., Ritsumeikan University */ /* All rights reserved */ /* */ -/* $Id: read_conf.c,v 1.17 2006/10/19 03:26:33 sako Exp $ */ +/* $Id: read_conf.c,v 1.18 2009/02/13 02:02:47 sako Exp $ */ #include <stdio.h> #include <stdlib.h> @@ -150,6 +150,8 @@ } else if( strcmp(cpara,"CHAONE-XSL-FILE")==0 ) { chaone_xsl = malloc_char( val, "chaone_xsl" ); #endif + } else if( strcmp(cpara,"AUDIODEV")==0 ) { + conf_audiodev = malloc_char( val, "conf_audiodev" ); } else { ErrMsg( "* Unknown configuration parameter: %s\n", cpara ); } Index: gtalk/server.c diff -u gtalk/server.c:1.3 gtalk/server.c:1.4 --- gtalk/server.c:1.3 Thu Oct 19 12:27:08 2006 +++ gtalk/server.c Fri Feb 13 11:02:47 2009 @@ -1,7 +1,9 @@ /* */ -/* $Id: server.c,v 1.3 2006/10/19 03:27:08 sako Exp $ */ +/* $Id: server.c,v 1.4 2009/02/13 02:02:47 sako Exp $ */ #include <stdio.h> +#include <stdlib.h> +#include <string.h> #if defined(_WIN32) && !defined(__CYGWIN32__) #include <windows.h> #include <winsock.h>