~ubuntu-branches/ubuntu/breezy/kdemultimedia/breezy

« back to all changes in this revision

Viewing changes to kmid/player/midimapper.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2005-03-24 04:48:58 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20050324044858-8ff88o9jxej6ii3d
Tags: 4:3.4.0-0ubuntu3
Add kubuntu_02_hide_arts_menu_entries.diff to hide artsbuilder and artscontrol k-menu entries

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*  midimapper.h  - The midi mapper object
2
 
    Copyright (C) 1997  Antonio Larrosa Jimenez
3
 
 
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.
8
 
 
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.
13
 
 
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.
17
 
 
18
 
    Send comments and bug fixes to antlarr@arrakis.es
19
 
    or to Antonio Larrosa, Rio Arnoya, 10 5B, 29006 Malaga, Spain
20
 
 
21
 
***************************************************************************/
22
 
#ifndef _MIDIMAPPER_H
23
 
#define _MIDIMAPPER_H
24
 
 
25
 
#include <stdio.h>
26
 
#include "dattypes.h"
27
 
 
28
 
struct Keymap
29
 
{
30
 
        char name[30];
31
 
        uchar key[128];
32
 
        struct Keymap *next;
33
 
};
34
 
 
35
 
class MidiMapper
36
 
{
37
 
private:
38
 
        int     _ok;
39
 
        uchar   channelmap[16]; 
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
45
 
                                // force in a channel
46
 
 
47
 
        uchar   patchmap[128];
48
 
        Keymap *patchKeymap[128]; // Same as channelKeymap
49
 
   
50
 
        Keymap *keymaps; // Real linked list of keymaps used around the program
51
 
 
52
 
 
53
 
        char *_filename; 
54
 
           // Stores the name of the file from which the map was loaded
55
 
 
56
 
        int mapExpressionToVolumeEvents; 
57
 
                // Simulate expression events with volume events
58
 
 
59
 
        int mapPitchBender;  // Use or not use the next variable
60
 
 
61
 
        int pitchBenderRatio; 
62
 
 
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
67
 
 
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
73
 
 
74
 
 
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);
81
 
 
82
 
        void addKeymap(Keymap *newkm);
83
 
        Keymap *keymap(char *n);
84
 
 
85
 
public:
86
 
        MidiMapper(const char *name);
87
 
        ~MidiMapper();
88
 
 
89
 
        void loadFile(const char *name);        
90
 
        int  ok(void) { return _ok; };
91
 
 
92
 
 
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);
98
 
 
99
 
        char *filename(void);
100
 
 
101
 
};
102
 
 
103
 
#endif