From: Shoichi Tamuki Date: Tue, 8 Apr 2008 12:43:23 +0000 (+0000) Subject: timidity/timidity.c: Fix atavism (reversion) and change a bit X-Git-Tag: unkotim211~142 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=1ada8e32ae0c6d2067d4ea5fb9a9419701713d80;p=timidity41%2Ftimidity41.git timidity/timidity.c: Fix atavism (reversion) and change a bit --- diff --git a/ChangeLog b/ChangeLog index 8c26c776..64413ea6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,11 @@ +2008-04-08 TAMUKI Shoichi + + * timidity/timidity.c: Fix atavism (reversion) and change a bit + 2008-04-08 Keishi Suenaga - * timidity/ao_a.c - timidity/portaudio_a.c - timidity/timidity.c - timidity/w32_a.c select audio device only in -o option + * timidity/ao_a.c, timidity/portaudio_a.c, timidity/timidity.c, + timidity/w32_a.c: select audio device only in -o option 2008-04-06 TAMUKI Shoichi diff --git a/timidity/timidity.c b/timidity/timidity.c index 74951031..de0836d3 100644 --- a/timidity/timidity.c +++ b/timidity/timidity.c @@ -1,6 +1,6 @@ /* TiMidity++ -- MIDI to WAVE converter and player - Copyright (C) 1999-2007 Masanao Izumo + Copyright (C) 1999-2008 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen This program is free software; you can redistribute it and/or modify @@ -195,6 +195,7 @@ enum { TIM_OPT_POLY_REDUCE, TIM_OPT_MUTE, TIM_OPT_TEMPER_MUTE, + TIM_OPT_PRESERVE_SILENCE, TIM_OPT_AUDIO_BUFFER, TIM_OPT_CACHE_SIZE, TIM_OPT_SAMPLE_FREQ, @@ -209,7 +210,6 @@ enum { TIM_OPT_FREQ_TABLE, TIM_OPT_PURE_INT, TIM_OPT_MODULE, - TIM_OPT_PRESERVE_SILENCE, /* last entry */ TIM_OPT_LAST = TIM_OPT_PURE_INT }; @@ -345,6 +345,7 @@ static const struct option longopts[] = { { "polyphony-reduction", optional_argument, NULL, TIM_OPT_POLY_REDUCE }, { "mute", required_argument, NULL, TIM_OPT_MUTE }, { "temper-mute", required_argument, NULL, TIM_OPT_TEMPER_MUTE }, + { "preserve-silence", no_argument, NULL, TIM_OPT_PRESERVE_SILENCE }, { "audio-buffer", required_argument, NULL, TIM_OPT_AUDIO_BUFFER }, { "cache-size", required_argument, NULL, TIM_OPT_CACHE_SIZE }, { "sampling-freq", required_argument, NULL, TIM_OPT_SAMPLE_FREQ }, @@ -362,7 +363,6 @@ static const struct option longopts[] = { { "freq-table", required_argument, NULL, TIM_OPT_FREQ_TABLE }, { "pure-intonation", optional_argument, NULL, TIM_OPT_PURE_INT }, { "module", required_argument, NULL, TIM_OPT_MODULE }, - { "preserve-silence", no_argument, NULL, TIM_OPT_PRESERVE_SILENCE }, { NULL, no_argument, NULL, '\0' } }; #define INTERACTIVE_INTERFACE_IDS "kmqagrwAWNP" @@ -494,6 +494,7 @@ static inline int parse_opt_p(const char *); static inline int parse_opt_p1(const char *); static inline int parse_opt_Q(const char *); static inline int parse_opt_Q1(const char *); +static inline int parse_opt_preserve_silence(const char *); static inline int parse_opt_q(const char *); static inline int parse_opt_R(const char *); static inline int parse_opt_S(const char *); @@ -512,7 +513,6 @@ static inline int parse_opt_x(char *); static inline void expand_escape_string(char *); static inline int parse_opt_Z(char *); static inline int parse_opt_Z1(const char *); -static inline int parse_opt_preserve_silence(const char *); static inline int parse_opt_default_module(const char *); __attribute__((noreturn)) static inline int parse_opt_fail(const char *); @@ -600,27 +600,22 @@ CRITICAL_SECTION critSect; static BOOL WINAPI handler(DWORD dw) { #if defined(IA_WINSYN) || defined(IA_PORTMIDISYN) - if( ctl->id_character == 'W' - || ctl->id_character == 'P' ) - { - rtsyn_midiports_close(); - } + if (ctl->id_character == 'W' || ctl->id_character == 'P') + rtsyn_midiports_close(); #endif - - -//#if defined(IA_NPSYN) -// if( ctl->id_character == 'N') -// { -// return FALSE; //why FALSE need? It must close by intr++; -// } -//#endif - printf ("***BREAK" NLS); fflush(stdout); - intr++; - return TRUE; +#if 0 +#if defined(IA_NPSYN) + if (ctl->id_character == 'N') + return FALSE; /* why FALSE need? It must close by intr++; */ +#endif +#endif + printf ("***BREAK" NLS); + fflush(stdout); + intr++; + return TRUE; } #endif - int effect_lr_mode = -1; /* 0: left delay * 1: right delay @@ -2664,6 +2659,7 @@ MAIN_INTERFACE int set_tim_opt_short(int c, char *optarg) } return 0; } + MAIN_INTERFACE int set_tim_opt_short_cfg(int c, char *optarg) { int err = 0; @@ -2874,6 +2870,8 @@ MAIN_INTERFACE int set_tim_opt_long(int c, char *optarg, int index) return parse_opt_Q(arg); case TIM_OPT_TEMPER_MUTE: return parse_opt_Q1(arg); + case TIM_OPT_PRESERVE_SILENCE: + return parse_opt_preserve_silence(arg); case TIM_OPT_AUDIO_BUFFER: return parse_opt_q(arg); case TIM_OPT_CACHE_SIZE: @@ -2904,14 +2902,13 @@ MAIN_INTERFACE int set_tim_opt_long(int c, char *optarg, int index) return parse_opt_Z1(arg); case TIM_OPT_MODULE: return parse_opt_default_module(arg); - case TIM_OPT_PRESERVE_SILENCE: - return parse_opt_preserve_silence(arg); default: ctl->cmsg(CMSG_FATAL, VERB_NORMAL, "[BUG] Inconceivable case branch %d", c); abort(); } } + MAIN_INTERFACE int set_tim_opt_long_cfg(int c, char *optarg, int index) { const struct option *the_option = &(longopts[index]); @@ -2990,7 +2987,8 @@ static inline int parse_opt_C(const char *arg) static inline int parse_opt_c(char *arg) { #ifdef __W32__ - if(got_a_configuration == 1) return 0; + if (got_a_configuration == 1) + return 0; #endif if (read_config_file(arg, 0)) return 1; @@ -3748,20 +3746,22 @@ static int parse_opt_h(const char *arg) " Number of frames per Ogg packet n:[0-10]", #endif " -o file --output-file=file", -" Output to another file (or device No./server) (Use \"-\" for stdout)", -" \"-o -1\" shows available device No. list." +" Output to another file (or device/server) (Use \"-\" for stdout)", +#if defined(AU_PORTAUDIO) || defined(AU_WIN32) +" Set the output device no. (-1 shows available device no. list)", +#endif " -P file --patch-file=file", " Use patch file for all programs", " -p n --polyphony=n", " Allow n-voice polyphony. Optional auto polyphony reduction", " (a) --[no-]polyphony-reduction", " Toggle automatic polyphony reduction. Enabled by default", -" --preserve-silence", -" Do not drop initial silence. Default: drop initial silence", " -Q n[,...] --mute=n[,...]", " Ignore channel n (0: ignore all, -n: resume channel n)", " (t) --temper-mute=n[,...]", " Quiet temperament type n (0..3: preset, 4..7: user-defined)", +" --preserve-silence", +" Do not drop initial silence. Default: drop initial silence", " -q sec/n --audio-buffer=sec/n", " Specify audio buffer in seconds", " sec: Maxmum buffer, n: Filled to start (default is 5.0/100%%)", @@ -3993,11 +3993,6 @@ static int parse_opt_h(const char *arg) " `A' A-Law encoding" NLS " `x' byte-swapped output" NLS, fp); fputs(NLS, fp); -#if defined(AU_PORTAUDIO) || defined(AU_WIN32) - fputs("Output device options (append to -O? option):" NLS -" `d(n)' Output device ID (blank shows available device list)" NLS, fp); - fputs(NLS, fp); -#endif fputs("Alternative output format long options:" NLS " --output-stereo" NLS " --output-mono" NLS @@ -4473,7 +4468,6 @@ static inline int parse_opt_output_swab(const char *arg) return 0; } - #ifdef AU_FLAC extern void flac_set_option_verify(int); extern void flac_set_option_padding(int); @@ -4624,6 +4618,12 @@ static inline int parse_opt_Q1(const char *arg) return 0; } +static inline int parse_opt_preserve_silence(const char *arg) +{ + opt_preserve_silence = 1; + return 0; +} + static inline int parse_opt_q(const char *arg) { char *max_buff = safe_strdup(arg); @@ -4904,12 +4904,6 @@ static inline int parse_opt_default_module(const char *arg) return 0; } -static inline int parse_opt_preserve_silence(const char *arg) -{ - opt_preserve_silence = 1; - return 0; -} - __attribute__((noreturn)) static inline int parse_opt_fail(const char *arg) { @@ -5049,7 +5043,6 @@ static RETSIGTYPE sigterm_exit(int sig) * function. It is possible coredump if the signal is called in printf's. */ - write(2, "Terminated sig=0x", 17); s[0] = "0123456789abcdef"[(sig >> 4) & 0xf]; s[1] = "0123456789abcdef"[sig & 0xf]; @@ -5788,7 +5781,8 @@ int main(int argc, char **argv) files = argv + optind; if (nfiles > 0 && ctl->id_character != 'r' && ctl->id_character != 'A' - && ctl->id_character != 'W' && ctl->id_character != 'N' && ctl->id_character != 'P') + && ctl->id_character != 'W' && ctl->id_character != 'N' + && ctl->id_character != 'P') files = expand_file_archives(files, &nfiles); if (nfiles > 0) files_nbuf = files[0]; @@ -5811,11 +5805,11 @@ int main(int argc, char **argv) w32g_free_doc(); #else #ifdef IA_NPSYN - timeBeginPeriod( 1 ); + timeBeginPeriod(1); #endif main_ret = timidity_play_main(nfiles, files); #ifdef IA_NPSYN - timeEndPeriod( 1 ); + timeEndPeriod(1); #endif #ifdef IA_W32G_SYN if (CoInitializeOK) @@ -5851,7 +5845,8 @@ int main(int argc, char **argv) free(wrdt_open_opts); if (nfiles > 0 && ctl->id_character != 'r' && ctl->id_character != 'A' - && ctl->id_character != 'W' && ctl->id_character != 'N' && ctl->id_character != 'P') { + && ctl->id_character != 'W' && ctl->id_character != 'N' + && ctl->id_character != 'P') { free(files_nbuf); free(files); }