| # libkmid Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# midimapper.h

    00001 /*  midimapper.h  - The midi mapper object
    00002     This file is part of LibKMid 0.9.5
    00003     Copyright (C) 1997,98,99,2000  Antonio Larrosa Jimenez
    00004     LibKMid's homepage : http://www.arrakis.es/~rlarrosa/libkmid.html
    00005
    00006     This library is free software; you can redistribute it and/or
    00007     modify it under the terms of the GNU Library General Public
    00008     License as published by the Free Software Foundation; either
    00009     version 2 of the License, or (at your option) any later version.
    00010
    00011     This library is distributed in the hope that it will be useful,
    00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00014     Library General Public License for more details.
    00015
    00016     You should have received a copy of the GNU Library General Public License
    00017     along with this library; see the file COPYING.LIB.  If not, write to
    00018     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00019     Boston, MA 02111-1307, USA.
    00020
    00021     Send comments and bug fixes to Antonio Larrosa <larrosa@kde.org>
    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     // get from s the word in position  w and store it in t
    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.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:28:29 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001