midimapper.h
00001
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
00030 #define KM_NAME_SIZE 30
00031
00058 class MidiMapper
00059 {
00060 private:
00061 class MidiMapperPrivate;
00062 MidiMapperPrivate *d;
00063
00068 struct Keymap
00069 {
00070 char name[KM_NAME_SIZE];
00071 uchar key[128];
00072 struct Keymap *next;
00073 };
00074
00075 int _ok;
00076
00077 uchar channelmap[16];
00084 Keymap *channelKeymap[16];
00085
00091 int channelPatchForced[16];
00092
00093 uchar patchmap[128];
00094
00099 Keymap *patchKeymap[128];
00100
00105 Keymap *keymaps;
00106
00111 char *_filename;
00112
00117 int mapExpressionToVolumeEvents;
00118
00123 int mapPitchBender;
00124
00132 int pitchBenderRatio;
00133
00134 void getValue(char *s,char *v);
00135 void removeSpaces(char *s);
00136 int countWords(char *s);
00137 void getWord(char *t,char *s,int w);
00138
00139
00140 void deallocateMaps(void);
00141 Keymap *createKeymap(char *name,uchar use_same_note=0,uchar note=0);
00142 void readPatchmap(FILE *fh);
00143 void readKeymap(FILE *fh,char *first_line);
00144 void readChannelmap(FILE *fh);
00145 void readOptions(FILE *fh);
00146
00147 void addKeymap(Keymap *newkm);
00148 Keymap *keymap(char *n);
00149
00150 public:
00155 MidiMapper(const char *name);
00156
00160 ~MidiMapper();
00161
00166 void loadFile(const char *name);
00167
00171 int ok(void) { return _ok; };
00172
00176 uchar channel(uchar chn) { return channelmap[chn];};
00177
00181 uchar patch(uchar chn,uchar pgm);
00182
00187 uchar key(uchar chn,uchar pgm, uchar note);
00188
00193 void pitchBender(uchar chn,uchar &lsb,uchar &msb);
00194
00199 void controller(uchar chn,uchar &ctl,uchar &v);
00200
00205 const char *filename(void);
00206
00207 };
00208
00209 #endif
This file is part of the documentation for kdelibs Version 3.1.5.