1 /*
2     MidiDecode.h
3 
4     Copyright 2017 - 2020 Will Godfrey
5 
6     This file is part of yoshimi, which is free software: you can redistribute
7     it and/or modify it under the terms of the GNU Library General Public
8     License as published by the Free Software Foundation; either version 2 of
9     the License, or (at your option) any later version.
10 
11     yoshimi is distributed in the hope that it will be useful, but WITHOUT ANY
12     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13     FOR A PARTICULAR PURPOSE.   See the GNU General Public License (version 2 or
14     later) for more details.
15 
16     You should have received a copy of the GNU General Public License along with
17     yoshimi; if not, write to the Free Software Foundation, Inc., 51 Franklin
18     Street, Fifth Floor, Boston, MA  02110-1301, USA.
19 
20 */
21 
22 #ifndef MIDIDECODE_H
23 #define MIDIDECODE_H
24 
25 #include <list>
26 #include <string>
27 
28 #include "Interface/InterChange.h"
29 
30 class SynthEngine;
31 
32 class MidiDecode
33 {
34     public:
35         MidiDecode(SynthEngine *_synth);
36         ~MidiDecode();
37         void midiProcess(unsigned char par0, unsigned char par1, unsigned char par2, bool in_place, bool inSync = false);
38         void setMidiBankOrRootDir(unsigned int bank_or_root_num, bool in_place = false, bool setRootDir = false);
39         void setMidiProgram(unsigned char ch, int prg, bool in_place = false);
40 
41     private:
42         void setMidiController(unsigned char ch, int ctrl, int param, bool in_place = false, bool inSync = false);
43         void sendMidiCC(bool inSync, unsigned char chan, int type, short int par);
44         bool nrpnDecode(unsigned char ch, int ctrl, int param, bool in_place);
45         bool nrpnRunVector(unsigned char ch, int ctrl, int param, bool inSync);
46         void nrpnProcessData(unsigned char chan, int type, int par, bool in_place);
47         bool nrpnProcessHistory(unsigned char nLow, unsigned char dHigh, unsigned char dLow, bool in_place);
48         void nrpnDirectPart(int dHigh, int par);
49         void nrpnSetVector(int dHigh, unsigned char chan,  int par);
50 
51         SynthEngine *synth;
52 };
53 
54 #endif
55