3
TiMidity -- Experimental MIDI to WAVE converter
4
Copyright (C) 1995 Tuukka Toivonen <toivonen@clinet.fi>
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2 of the License, or
9
(at your option) any later version.
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with this program; if not, write to the Free Software
18
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21
Minimal control mode -- no interaction, just prints out messages.
35
static void ctl_refresh(void);
36
static void ctl_total_time(uint32 tt);
37
static void ctl_master_volume(int mv);
38
static void ctl_file_name(char *name);
39
static void ctl_current_time(uint32 ct);
40
static void ctl_note(int v);
41
static void ctl_program(int ch, int val, const char *name);
42
static void ctl_volume(int ch, int val);
43
static void ctl_expression(int ch, int val);
44
static void ctl_panning(int ch, int val);
45
static void ctl_sustain(int ch, int val);
46
static void ctl_pitch_bend(int ch, int val);
47
static void ctl_reset(void);
48
static int ctl_open(int using_stdin, int using_stdout);
49
static void ctl_close(void);
50
static int ctl_read(int32 *valp);
51
static int cmsg(int type, int verbosity_level, const char *fmt, ...);
53
/**********************************/
54
/* export the interface functions */
56
#define ctl dumb_control_mode
60
"dumb interface", 'd',
62
ctl_open,dumb_pass_playing_list, ctl_close, ctl_read, cmsg,
63
ctl_refresh, ctl_reset, ctl_file_name, ctl_total_time, ctl_current_time,
65
ctl_master_volume, ctl_program, ctl_volume,
66
ctl_expression, ctl_panning, ctl_sustain, ctl_pitch_bend
69
static FILE *infp; /* infp isn't actually used yet */
72
static int ctl_open(int using_stdin, int using_stdout)
74
infp = stdin; outfp = stdout;
75
if (using_stdin && using_stdout)
77
else if (using_stdout)
86
static void ctl_close(void)
92
static int ctl_read(int32 *valp)
97
static int cmsg(int type, int verbosity_level, const char *fmt, ...)
100
int flag_newline = 1;
102
if (interactive) return 0;
104
if ((type==CMSG_TEXT || type==CMSG_INFO || type==CMSG_WARNING) &&
105
ctl.verbosity<verbosity_level)
115
vfprintf(stderr, fmt, ap);
116
if (flag_newline) fprintf(stderr, "\n");
120
vfprintf(outfp, fmt, ap);
121
if (flag_newline) fprintf(outfp, "\n");
124
if (!flag_newline) fflush(outfp);
128
static void ctl_refresh(void) { }
130
static void ctl_total_time(uint32 tt)
133
if (ctl.trace_playing)
135
secs=tt/play_mode->rate;
138
fprintf(outfp, "Total playing time: %3ld min %02ld s\n", mins, secs);
142
static void ctl_master_volume(int mv) { mv = 0; }
144
static void ctl_file_name(char *name)
146
if (ctl.verbosity>=0 || ctl.trace_playing)
147
fprintf(outfp, "Playing %s\n", name);
150
static void ctl_current_time(uint32 ct)
153
if (ctl.trace_playing)
155
secs=ct/play_mode->rate;
158
fprintf(outfp, "\r%3ld:%02ld", mins, secs);
163
static void ctl_note(int v) { v = 0; }
165
static void ctl_program(int ch, int val, const char *name) { ch = val = 0; name = 0; }
167
static void ctl_volume(int ch, int val) { ch = val = 0; }
169
static void ctl_expression(int ch, int val) { ch = val = 0; }
171
static void ctl_panning(int ch, int val) { ch = val = 0; }
173
static void ctl_sustain(int ch, int val) { ch = val = 0; }
175
static void ctl_pitch_bend(int ch, int val) { ch = val = 0; }
177
static void ctl_reset(void) {}