Skip to content

Latest commit

 

History

History
133 lines (109 loc) · 3.11 KB

sdl_c.c

File metadata and controls

133 lines (109 loc) · 3.11 KB
 
Dec 31, 2011
Dec 31, 2011
1
/*
Oct 21, 1999
Oct 21, 1999
2
3
4
5
TiMidity -- Experimental MIDI to WAVE converter
Copyright (C) 1995 Tuukka Toivonen <toivonen@clinet.fi>
This program is free software; you can redistribute it and/or modify
Dec 31, 2011
Dec 31, 2011
6
7
it under the terms of the Perl Artistic License, available in COPYING.
*/
Oct 21, 1999
Oct 21, 1999
8
9
10
11
12
13
14
15
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include "config.h"
#include "common.h"
#include "output.h"
May 14, 2006
May 14, 2006
16
#include "ctrlmode.h"
Oct 21, 1999
Oct 21, 1999
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include "instrum.h"
#include "playmidi.h"
static void ctl_refresh(void);
static void ctl_total_time(int tt);
static void ctl_master_volume(int mv);
static void ctl_file_name(char *name);
static void ctl_current_time(int ct);
static void ctl_note(int v);
static void ctl_program(int ch, int val);
static void ctl_volume(int channel, int val);
static void ctl_expression(int channel, int val);
static void ctl_panning(int channel, int val);
static void ctl_sustain(int channel, int val);
static void ctl_pitch_bend(int channel, int val);
static void ctl_reset(void);
static int ctl_open(int using_stdin, int using_stdout);
static void ctl_close(void);
static int ctl_read(int32 *valp);
static int cmsg(int type, int verbosity_level, char *fmt, ...);
/**********************************/
/* export the interface functions */
#define ctl sdl_control_mode
ControlMode ctl=
{
"SDL interface", 's',
1,0,0,
ctl_open,NULL, ctl_close, ctl_read, cmsg,
ctl_refresh, ctl_reset, ctl_file_name, ctl_total_time, ctl_current_time,
ctl_note,
ctl_master_volume, ctl_program, ctl_volume,
ctl_expression, ctl_panning, ctl_sustain, ctl_pitch_bend
};
static int ctl_open(int using_stdin, int using_stdout)
{
ctl.opened=1;
return 0;
}
static void ctl_close(void)
{
ctl.opened=0;
}
static int ctl_read(int32 *valp)
{
return RC_NONE;
}
static int cmsg(int type, int verbosity_level, char *fmt, ...)
{
Aug 21, 2004
Aug 21, 2004
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#ifdef GREGS_DEBUG
va_list ap;
int flag_newline = 1;
if ((type==CMSG_TEXT || type==CMSG_INFO || type==CMSG_WARNING) &&
ctl.verbosity<verbosity_level-1)
return 0;
if (*fmt == '~')
{
flag_newline = 0;
fmt++;
}
va_start(ap, fmt);
if (!ctl.opened)
{
vfprintf(stderr, fmt, ap);
if (flag_newline) fprintf(stderr, "\n");
}
else
{
vfprintf(stderr, fmt, ap);
if (flag_newline) fprintf(stderr, "\n");
}
va_end(ap);
if (!flag_newline) fflush(stderr);
return 0;
#else
Oct 21, 1999
Oct 21, 1999
98
99
100
101
102
va_list ap;
if ((type==CMSG_TEXT || type==CMSG_INFO || type==CMSG_WARNING) &&
ctl.verbosity<verbosity_level)
return 0;
va_start(ap, fmt);
Oct 12, 2009
Oct 12, 2009
103
SDL_vsnprintf(timidity_error, TIMIDITY_ERROR_SIZE, fmt, ap);
Oct 21, 1999
Oct 21, 1999
104
105
va_end(ap);
return 0;
Aug 21, 2004
Aug 21, 2004
106
#endif
Oct 21, 1999
Oct 21, 1999
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
}
static void ctl_refresh(void) { }
static void ctl_total_time(int tt) {}
static void ctl_master_volume(int mv) {}
static void ctl_file_name(char *name) {}
static void ctl_current_time(int ct) {}
static void ctl_note(int v) {}
static void ctl_program(int ch, int val) {}
static void ctl_volume(int channel, int val) {}
static void ctl_expression(int channel, int val) {}
static void ctl_panning(int channel, int val) {}
static void ctl_sustain(int channel, int val) {}
static void ctl_pitch_bend(int channel, int val) {}
static void ctl_reset(void) {}