1 /* 2 * Copyright (C) 2009-2015 Paul Davis <paul@linuxaudiosystems.com> 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 along 15 * with this program; if not, write to the Free Software Foundation, Inc., 16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 */ 18 19 #ifndef __gm_midifunction_h__ 20 #define __gm_midifunction_h__ 21 22 #include <string> 23 24 #include "midi++/types.h" 25 26 #include "pbd/signals.h" 27 #include "pbd/stateful.h" 28 29 #include "ardour/types.h" 30 31 #include "midiinvokable.h" 32 33 namespace MIDI { 34 class Channel; 35 class Parser; 36 } 37 38 class GenericMidiControlProtocol; 39 40 class MIDIFunction : public MIDIInvokable 41 { 42 public: 43 enum Function { 44 NextBank, 45 PrevBank, 46 TransportRoll, 47 TransportStop, 48 TransportZero, 49 TransportStart, 50 TransportEnd, 51 TransportLoopToggle, 52 TransportRecordToggle, 53 TransportRecordEnable, 54 TransportRecordDisable, 55 /* 1 argument functions: RID */ 56 Select, 57 SetBank, 58 /* 2 argument functions: RID, value */ 59 TrackSetSolo, 60 TrackSetMute, 61 TrackSetGain, 62 TrackSetRecordEnable, 63 TrackSetSoloIsolate, 64 }; 65 66 MIDIFunction (MIDI::Parser&); 67 virtual ~MIDIFunction (); 68 69 int setup (GenericMidiControlProtocol&, const std::string& function_name, const std::string& argument, MIDI::byte* sysex = 0, size_t ssize = 0); 70 function_name()71 const std::string& function_name() const { return _invokable_name; } 72 73 XMLNode& get_state (void); 74 int set_state (const XMLNode&, int version); 75 76 private: 77 Function _function; 78 std::string _argument; 79 void execute (); 80 }; 81 82 #endif // __gm_midicontrollable_h__ 83 84