1
/* midimapper.h - The midi mapper object
2
Copyright (C) 1997 Antonio Larrosa Jimenez
4
This program is free software; you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation; either version 2 of the License, or
7
(at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public License
15
along with this program; if not, write to the Free Software
16
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
Send comments and bug fixes to antlarr@arrakis.es
19
or to Antonio Larrosa, Rio Arnoya, 10 5B, 29006 Malaga, Spain
21
***************************************************************************/
40
Keymap *channelKeymap[16]; // pointer to the keymap to use for a channel
41
// this is to make it faster
42
// The index is with the real channel (already mapped)
43
int channelPatchForced[16]; // if -1 the channel doesn't have
44
// a forced patch, else indicates the patch to
48
Keymap *patchKeymap[128]; // Same as channelKeymap
50
Keymap *keymaps; // Real linked list of keymaps used around the program
54
// Stores the name of the file from which the map was loaded
56
int mapExpressionToVolumeEvents;
57
// Simulate expression events with volume events
59
int mapPitchBender; // Use or not use the next variable
63
// Indicates the ratio between the standard and the synth's pitch
64
// bender engine. The number sent to the synth is multiplied by this
65
// and dividied by 4096. Thus if PitchBenderRatio is 4096, the synth's
66
// pitch bender works as the standard one
68
void getValue(char *s,char *v);
69
void removeSpaces(char *s);
70
int countWords(char *s);
71
void getWord(char *t,char *s,int w);
72
// get from s the word in position w and store it in t
75
void deallocateMaps(void);
76
Keymap *createKeymap(char *name,uchar use_same_note=0,uchar note=0);
77
void readPatchmap(FILE *fh);
78
void readKeymap(FILE *fh,char *first_line);
79
void readChannelmap(FILE *fh);
80
void readOptions(FILE *fh);
82
void addKeymap(Keymap *newkm);
83
Keymap *keymap(char *n);
86
MidiMapper(const char *name);
89
void loadFile(const char *name);
90
int ok(void) { return _ok; };
93
uchar channel(uchar chn) { return channelmap[chn];};
94
uchar patch(uchar chn,uchar pgm);
95
uchar key(uchar chn,uchar pgm, uchar note);
96
void pitchBender(uchar chn,uchar &lsb,uchar &msb);
97
void controller(uchar chn,uchar &ctl,uchar &v);