CLAM-Development  1.4.0
MIDIOutControl.hxx
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2004 MUSIC TECHNOLOGY GROUP (MTG)
3  * UNIVERSITAT POMPEU FABRA
4  *
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  */
21 
22 #ifndef __MIDIOUTCONTROL__
23 #define __MIDIOUTCONTROL__
24 
25 #include "MIDIEnums.hxx"
26 #include "Array.hxx"
27 #include "MIDIOut.hxx"
28 #include "MIDIIOConfig.hxx"
29 
30 namespace CLAM {
31 
32 class MIDIOutControl:public MIDIOut
33 {
34  private:
35  Array<FloatInControl*> mMyInControls;
36 
37  /* keep a unique id for each message we are constructing,
38  * to make sure we have each controlled byte only once
39  */
40  unsigned char mUniqId;
41 
42  /* buffer to store the message */
43  unsigned char* mMessage;
44  unsigned char mStatusByte;
45 
46  /* buffer to store the uniq id for each controlled byte */
47  unsigned char* mReceivedUniqId;
48 
49  /* table to map InControl ID to byte-in-message index */
50  unsigned char* mControlIdToMsgByteId;
51 
52  /* size of the midi message in bytes */
53  unsigned char mMessageSize;
54 
55  /* number of bytes in the message that are controlled, and the
56  * number of of those that have been received for the current
57  * message construction (current unique ID)
58  * (when these are equal the message has been constructed fully)
59  */
60  unsigned char mControlledBytes;
61  unsigned char mControlsReceived;
62 
63  void InitMembers(void);
64 
65  void Handle(unsigned char* msg,int size);
66 
67  /* callback function for each received control value */
68  void DoControl(unsigned id,TControlData val);
69  public:
71  MIDIOutControl(const MIDIIOConfig &c);
72 
73  const char * GetClassName() const {return "MIDIOutControl";}
74 
75  bool ConcreteConfigure(const ProcessingConfig& c)
76  throw(ErrProcessingObj);
77 };
78 
79 } // namespace CLAM
80 
81 #endif // MIDIOutControl.hxx
82