00001 /* 00002 * 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 * 00018 */ 00019 00020 #ifndef _Fund2MIDI_ 00021 #define _Fund2MIDI_ 00022 00023 #include "DataTypes.hxx" 00024 #include "Processing.hxx" 00025 #include "ProcessingConfig.hxx" 00026 #include "InPort.hxx" 00027 #include "OutControl.hxx" 00028 #include "OutControl.hxx" 00029 #include "Fundamental.hxx" 00030 #include "MIDIMessage.hxx" 00031 00032 namespace CLAM 00033 { 00034 00044 class Fund2MIDI : public Processing 00045 { 00046 InPort< Fundamental > mInFund; 00047 FloatOutControl mFreqControlOut; 00048 OutControl< MIDI::Message > mOutputMIDIMessage; 00049 00050 Config mConfig; 00051 00052 TSize _previousNote; 00053 public: 00054 00055 const char *GetClassName() const { return "Fund2MIDI"; } 00056 00057 Fund2MIDI( const ProcessingConfig & cfg = Config() ) 00058 : mInFund("In Fundamental", this) 00059 , mFreqControlOut("Frequency", this) 00060 , mOutputMIDIMessage("MIDI Message Out", this) 00061 , _previousNote(0) 00062 { 00063 Configure( cfg ); 00064 } 00065 00066 bool Do() 00067 { 00068 bool result = Do( mInFund.GetData() ); 00069 mInFund.Consume(); 00070 return result; 00071 } 00072 00073 bool Do( const Fundamental& inFund ); 00074 }; 00075 00076 } 00077 00078 #endif 00079