1 /* 2 * Copyright (C) 2009-2015 Paul Davis <paul@linuxaudiosystems.com> 3 * Copyright (C) 2011 David Robillard <d@drobilla.net> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License along 16 * with this program; if not, write to the Free Software Foundation, Inc., 17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 */ 19 20 #ifndef __libardour_midi_ui_h__ 21 #define __libardour_midi_ui_h__ 22 23 #include <list> 24 25 #define ABSTRACT_UI_EXPORTS 26 #include "pbd/abstract_ui.h" 27 #include "pbd/signals.h" 28 29 namespace ARDOUR { 30 31 class Session; 32 class AsyncMIDIPort; 33 34 /* this is mostly a placeholder because I suspect that at some 35 point we will want to add more members to accomodate 36 certain types of requests to the MIDI UI 37 */ 38 39 struct LIBARDOUR_API MidiUIRequest : public BaseUI::BaseRequestObject { 40 public: MidiUIRequestMidiUIRequest41 MidiUIRequest () { } ~MidiUIRequestMidiUIRequest42 ~MidiUIRequest() { } 43 }; 44 45 class LIBARDOUR_API MidiControlUI : public AbstractUI<MidiUIRequest> 46 { 47 public: 48 MidiControlUI (Session& s); 49 ~MidiControlUI (); 50 instance()51 static MidiControlUI* instance() { return _instance; } 52 static void* request_factory (uint32_t num_requests); 53 54 void change_midi_ports (); 55 56 protected: 57 void thread_init (); 58 void do_request (MidiUIRequest*); 59 60 private: 61 ARDOUR::Session& _session; 62 63 bool midi_input_handler (Glib::IOCondition, boost::weak_ptr<AsyncMIDIPort>); 64 void reset_ports (); 65 void clear_ports (); 66 67 static MidiControlUI* _instance; 68 }; 69 70 } 71 72 #endif /* __libardour_midi_ui_h__ */ 73