CLAM-Development  1.4.0
Fund2MIDI.hxx
Go to the documentation of this file.
1 /*
2  *
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  */
19 
20 #ifndef _Fund2MIDI_
21 #define _Fund2MIDI_
22 
23 #include "DataTypes.hxx"
24 #include "Processing.hxx"
25 #include "ProcessingConfig.hxx"
26 #include "InPort.hxx"
27 #include "OutControl.hxx"
28 #include "OutControl.hxx"
29 #include "Fundamental.hxx"
30 #include "MIDIMessage.hxx"
31 
32 namespace CLAM
33 {
34 
44  class Fund2MIDI : public Processing
45  {
46  InPort< Fundamental > mInFund;
47  FloatOutControl mFreqControlOut;
48  OutControl< MIDI::Message > mOutputMIDIMessage;
49 
50  Config mConfig;
51 
52  TSize _previousNote;
53  public:
54 
55  const char *GetClassName() const { return "Fund2MIDI"; }
56 
57  Fund2MIDI( const ProcessingConfig & cfg = Config() )
58  : mInFund("In Fundamental", this)
59  , mFreqControlOut("Frequency", this)
60  , mOutputMIDIMessage("MIDI Message Out", this)
61  , _previousNote(0)
62  {
63  Configure( cfg );
64  }
65 
66  bool Do()
67  {
68  bool result = Do( mInFund.GetData() );
69  mInFund.Consume();
70  return result;
71  }
72 
73  bool Do( const Fundamental& inFund );
74 };
75 
76 }
77 
78 #endif
79