+/*
+ Copyright (C) 2006 Paul Davis
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
#ifndef ardour_generic_midi_control_protocol_h
#define ardour_generic_midi_control_protocol_h
-#include <set>
+#include <list>
#include <glibmm/thread.h>
-#include <ardour/types.h>
+#include "ardour/types.h"
-#include <control_protocol/control_protocol.h>
+#include "control_protocol/control_protocol.h"
namespace MIDI {
class Port;
}
class MIDIControllable;
+class MIDIFunction;
+class MIDIAction;
class GenericMidiControlProtocol : public ARDOUR::ControlProtocol {
public:
int set_feedback (bool yn);
bool get_feedback () const;
- bool supports_feedback () const { return true; }
XMLNode& get_state ();
- int set_state (const XMLNode&);
+ int set_state (const XMLNode&, int version);
+
+ bool has_editor () const { return true; }
+ void* get_gui () const;
+ void tear_down_gui ();
+
+ int load_bindings (const std::string&);
+ void drop_bindings ();
+
+ std::string current_binding() const { return _current_binding; }
+
+ struct MapInfo {
+ std::string name;
+ std::string path;
+ };
+
+ std::list<MapInfo> map_info;
+ void reload_maps ();
+
+ void set_current_bank (uint32_t);
+ void next_bank ();
+ void prev_bank ();
private:
MIDI::Port* _port;
void _send_feedback ();
void send_feedback ();
- typedef std::set<MIDIControllable*> MIDIControllables;
+ typedef std::list<MIDIControllable*> MIDIControllables;
MIDIControllables controllables;
- MIDIControllables pending_controllables;
+
+ typedef std::list<MIDIFunction*> MIDIFunctions;
+ MIDIFunctions functions;
+
+ typedef std::list<MIDIAction*> MIDIActions;
+ MIDIActions actions;
+
+ typedef std::pair<MIDIControllable*,PBD::ScopedConnection> MIDIPendingControllable;
+ typedef std::list<MIDIPendingControllable* > MIDIPendingControllables;
+ MIDIPendingControllables pending_controllables;
Glib::Mutex controllables_lock;
Glib::Mutex pending_lock;
void stop_learning (PBD::Controllable*);
void learning_stopped (MIDIControllable*);
+
+ void create_binding (PBD::Controllable*, int, int);
+ void delete_binding (PBD::Controllable*);
+
+ MIDIControllable* create_binding (const XMLNode&);
+ MIDIFunction* create_function (const XMLNode&);
+ MIDIAction* create_action (const XMLNode&);
+
+ void reset_controllables ();
+ void drop_all ();
+
+ std::string _current_binding;
+ uint32_t _bank_size;
+ uint32_t _current_bank;
+
+ mutable void *gui;
+ void build_gui ();
};
#endif /* ardour_generic_midi_control_protocol_h */