midimapper.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _MIDIMAPPER_H
00025 #define _MIDIMAPPER_H
00026
00027 #include <stdio.h>
00028 #include <libkmid/dattypes.h>
00029 #include <kdelibs_export.h>
00030
00031 #define KM_NAME_SIZE 30
00032
00059 class KMID_EXPORT MidiMapper
00060 {
00061 private:
00062 class MidiMapperPrivate;
00063 MidiMapperPrivate *d;
00064
00069 struct Keymap
00070 {
00071 char name[KM_NAME_SIZE];
00072 uchar key[128];
00073 struct Keymap *next;
00074 };
00075
00076 int _ok;
00077
00078 uchar channelmap[16];
00085 Keymap *channelKeymap[16];
00086
00092 int channelPatchForced[16];
00093
00094 uchar patchmap[128];
00095
00100 Keymap *patchKeymap[128];
00101
00106 Keymap *keymaps;
00107
00112 char *_filename;
00113
00118 int mapExpressionToVolumeEvents;
00119
00124 int mapPitchBender;
00125
00133 int pitchBenderRatio;
00134
00135 void getValue(char *s,char *v);
00136 void removeSpaces(char *s);
00137 int countWords(char *s);
00138 void getWord(char *t,char *s,int w);
00139
00140
00141 void deallocateMaps(void);
00142 Keymap *createKeymap(char *name,uchar use_same_note=0,uchar note=0);
00143 void readPatchmap(FILE *fh);
00144 void readKeymap(FILE *fh,char *first_line);
00145 void readChannelmap(FILE *fh);
00146 void readOptions(FILE *fh);
00147
00148 void addKeymap(Keymap *newkm);
00149 Keymap *keymap(char *n);
00150
00151 public:
00156 MidiMapper(const char *name);
00157
00161 ~MidiMapper();
00162
00167 void loadFile(const char *name);
00168
00172 int ok(void) { return _ok; };
00173
00177 uchar channel(uchar chn) { return channelmap[chn];};
00178
00182 uchar patch(uchar chn,uchar pgm);
00183
00188 uchar key(uchar chn,uchar pgm, uchar note);
00189
00194 void pitchBender(uchar chn,uchar &lsb,uchar &msb);
00195
00200 void controller(uchar chn,uchar &ctl,uchar &v);
00201
00206 const char *filename(void);
00207
00208 };
00209
00210 #endif
|