2 Copyright (C) 1998-99 Paul Barton-Davis
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.
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.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #ifndef __qm_midicontrollable_h__
22 #define __qm_midicontrollable_h__
26 #include <sigc++/sigc++.h>
28 #include <midi++/types.h>
36 class Controllable : public sigc::trackable
39 Controllable (Port *, bool bistate = false);
40 virtual ~Controllable ();
42 void midi_rebind (Port *, channel_t channel=-1);
44 void learn_about_external_control ();
45 void stop_learning ();
46 void drop_external_control ();
48 virtual void set_value (float) = 0;
50 sigc::signal<void> learning_started;
51 sigc::signal<void> learning_stopped;
53 bool get_control_info (channel_t&, eventType&, byte&);
54 void set_control_type (channel_t, eventType, byte);
56 bool get_midi_feedback () { return feedback; }
57 void set_midi_feedback (bool val) { feedback = val; }
59 Port * get_port() { return port; }
61 std::string control_description() const { return _control_description; }
63 void send_midi_feedback (float);
67 int midi_msg_id; /* controller ID or note number */
68 sigc::connection midi_sense_connection[2];
69 sigc::connection midi_learn_connection;
72 eventType control_type;
73 byte control_additional;
74 channel_t control_channel;
75 std::string _control_description;
78 void midi_receiver (Parser &p, byte *, size_t);
79 void midi_sense_note (Parser &, EventTwoBytes *, bool is_on);
80 void midi_sense_note_on (Parser &p, EventTwoBytes *tb);
81 void midi_sense_note_off (Parser &p, EventTwoBytes *tb);
82 void midi_sense_controller (Parser &, EventTwoBytes *);
83 void midi_sense_program_change (Parser &, byte);
84 void midi_sense_pitchbend (Parser &, pitchbend_t);
86 void bind_midi (channel_t, eventType, byte);
89 }; /* namespace MIDI */
91 #endif // __qm_midicontrollable_h__