/*
TiMidity++ -- MIDI to WAVE converter and player
- Copyright (C) 1999-2008 Masanao Izumo <iz@onicos.co.jp>
+ Copyright (C) 1999-2007 Masanao Izumo <iz@onicos.co.jp>
Copyright (C) 1995 Tuukka Toivonen <tt@cgs.fi>
This program is free software; you can redistribute it and/or modify
TIM_OPT_OUTPUT_BITWIDTH,
TIM_OPT_OUTPUT_FORMAT,
TIM_OPT_OUTPUT_SWAB,
- TIM_OPT_OUTPUT_DEVICE,
TIM_OPT_FLAC_VERIFY,
TIM_OPT_FLAC_PADDING,
TIM_OPT_FLAC_COMPLEVEL,
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,
TIM_OPT_FREQ_TABLE,
TIM_OPT_PURE_INT,
TIM_OPT_MODULE,
+ TIM_OPT_PRESERVE_SILENCE,
/* last entry */
TIM_OPT_LAST = TIM_OPT_PURE_INT
};
{ "output-alaw", no_argument, NULL, TIM_OPT_OUTPUT_FORMAT },
{ "no-output-swab", no_argument, NULL, TIM_OPT_OUTPUT_SWAB },
{ "output-swab", optional_argument, NULL, TIM_OPT_OUTPUT_SWAB },
-#if defined(AU_PORTAUDIO) || defined(AU_WIN32)
- { "output-device", required_argument, NULL, TIM_OPT_OUTPUT_DEVICE },
-#endif
#ifdef AU_FLAC
{ "flac-verify", no_argument, NULL, TIM_OPT_FLAC_VERIFY },
{ "flac-padding", required_argument, NULL, TIM_OPT_FLAC_PADDING },
{ "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 },
{ "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"
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 *);
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 *);
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();
-#endif
-#if 0
-#if defined(IA_NPSYN)
- if (ctl->id_character == 'N')
- return FALSE; /* why FALSE need? It must close by intr++; */
-#endif
+ if( ctl->id_character == 'W'
+ || ctl->id_character == 'P' )
+ {
+ rtsyn_midiports_close();
+ }
#endif
- printf ("***BREAK" NLS);
- fflush(stdout);
- intr++;
- return TRUE;
+
+
+//#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;
}
#endif
+
int effect_lr_mode = -1;
/* 0: left delay
* 1: right delay
}
return 0;
}
-
MAIN_INTERFACE int set_tim_opt_short_cfg(int c, char *optarg)
{
int err = 0;
return parse_opt_output_format(arg);
case TIM_OPT_OUTPUT_SWAB:
return parse_opt_output_swab(arg);
-#if defined(AU_PORTAUDIO) || defined(AU_WIN32)
- case TIM_OPT_OUTPUT_DEVICE:
- return parse_opt_output_device(arg);
-#endif
#ifdef AU_FLAC
case TIM_OPT_FLAC_VERIFY:
return parse_opt_flac_verify(arg);
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:
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]);
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;
" n+1 point Gauss-like interpolation, n=1-34 (default 25)",
" -O mode --output-mode=mode",
" Select output mode and format (see below for list)",
-#if defined(AU_PORTAUDIO) || defined(AU_WIN32)
-" d n --output-device=n (for portaudio only)",
-" Set the output device ID (n=-1 shows available device list)",
-#endif
#ifdef AU_FLAC
" --flac-verify (for Ogg FLAC only)",
" Verify a correct encoding",
" Number of frames per Ogg packet n:[0-10]",
#endif
" -o file --output-file=file",
-" Output to another file (or device/server) (Use \"-\" for stdout)",
+" Output to another file (or device No./server) (Use \"-\" for stdout)",
+" \"-o -1\" shows available device No. list."
" -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%%)",
for (pmpp = play_mode_list; (pmp = *pmpp) != NULL; pmpp++)
fprintf(fp, " -O%c %s" NLS,
pmp->id_character, pmp->id_name);
-#ifdef AU_AO
- show_ao_device_info(fp);
-#endif /* AU_AO */
fputs(NLS, fp);
fputs("Output format options (append to -O? option):" NLS
" `S' stereo" NLS
" `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
/* output mode */
PlayMode *pmp, **pmpp;
int found = 0;
-#if defined(AU_PORTAUDIO) || defined(AU_W32)
- int ret;
-#endif
for (pmpp = play_mode_list; (pmp = *pmpp) != NULL; pmpp++)
if (pmp->id_character == *arg) {
pmp->encoding ^= PE_BYTESWAP; /* toggle */
pmp->encoding &= ~(PE_ULAW | PE_ALAW);
break;
-#ifdef AU_PORTAUDIO
- case 'd':
- if (play_mode->id_character == 'p'
- || play_mode->id_character == 'P'
- || play_mode->id_character == 'o') {
- ret = sscanf(arg + 1, "%d", &opt_pa_device_id);
- if (ret != 0 && ret != EOF)
- while (*(arg + 1) >= '0' && *(arg + 1) <= '9')
- arg++;
- else {
- opt_pa_device_id = -2;
- play_mode->open_output();
- return 1;
- }
- }
- break;
-#endif
-#ifdef AU_W32
- case 'd':
- if (play_mode->id_character == 'd') {
- ret = sscanf(arg + 1, "%d", &opt_wmme_device_id);
- if (ret != 0 && ret != EOF)
- while (*(arg + 1) >= '0' && *(arg + 1) <= '9')
- arg++;
- else {
- opt_wmme_device_id = -2;
- play_mode->open_output();
- return 1;
- }
- }
- break;
-#endif
default:
ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
"Unknown format modifier `%c'", *arg);
return 0;
}
-#if defined(AU_PORTAUDIO)
-static inline int parse_opt_output_device(const char *arg)
-{
- int ret;
-
- if (arg == NULL)
- return 1;
- if (play_mode->id_character == 'p'
- || play_mode->id_character == 'P'
- || play_mode->id_character == 'o') {
- ret = sscanf(arg, "%d", &opt_pa_device_id);
- if (ret == 0 || ret == EOF)
- return 1;
- if (opt_pa_device_id == -1) {
- opt_pa_device_id = -2;
- play_mode->open_output();
- return 1;
- }
- }
- return 0;
-}
-#endif
-#if defined(AU_W32)
-static inline int parse_opt_output_device(const char *arg)
-{
- int ret;
-
- if (arg == NULL)
- return 1;
- if (play_mode->id_character == 'd') {
- ret = sscanf(arg, "%d", &opt_wmme_device_id);
- if (ret == 0 || ret == EOF)
- return 1;
- if (opt_wmme_device_id == -1) {
- opt_wmme_device_id = -2;
- play_mode->open_output();
- return 1;
- }
- }
- return 0;
-}
-#endif
#ifdef AU_FLAC
extern void flac_set_option_verify(int);
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);
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)
{
* 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];
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];
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)
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);
}