]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/midi-cc-announcer.hh
Issue 5167/6: Changes: show \markup xxx = ... \etc assignments
[lilypond.git] / lily / include / midi-cc-announcer.hh
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 2016 by Heikki Tauriainen <g034737@welho.com>.
5
6   LilyPond is free software: you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation, either version 3 of the License, or
9   (at your option) any later version.
10
11   LilyPond is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #ifndef MIDI_CC_ANNOUNCER_HH
21 #define MIDI_CC_ANNOUNCER_HH
22
23 #include "input.hh"
24 #include "performer.hh"
25 #include "audio-item.hh"
26
27 /* Base class for announcing MIDI control changes. */
28 class Midi_control_change_announcer
29 {
30 public:
31   /* Constructor.  The optional parameter can be used to specify an Input
32      to use for relativizing warning messages about out-of-range values. */
33   Midi_control_change_announcer (Input *origin = 0);
34   virtual ~Midi_control_change_announcer ();
35
36   void announce_from_context_properties ();
37
38   /* Announces MIDI CC changes by creating new Audio_control_change events
39      from them, and calling 'do_announce' on each event.  Control change
40      events will be created from every supported MIDI context property for
41      which the 'get_property_value' function returns a value that is
42      compatible with the expected type of the context property's value. */
43   void announce_control_changes ();
44
45 private:
46   virtual SCM get_property_value (const char *property_name) = 0;
47   virtual void do_announce (Audio_control_change *item) = 0;
48   void warn (const string &message);
49
50   Input *origin_;
51
52   struct Control_spec
53   {
54     const char *const context_property_name_;
55     const Real range_min_;
56     const Real range_max_;
57     const int msb_control_number_;
58     const int lsb_control_number_;
59   };
60
61   static const Control_spec controls_[];
62 };
63
64 #endif // MIDI_CC_ANNOUNCER_HH