2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 2016 by Heikki Tauriainen <g034737@welho.com>.
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.
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.
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/>.
20 #ifndef MIDI_CC_ANNOUNCER_HH
21 #define MIDI_CC_ANNOUNCER_HH
24 #include "performer.hh"
25 #include "audio-item.hh"
27 /* Base class for announcing MIDI control changes. */
28 class Midi_control_change_announcer
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 ();
36 void announce_from_context_properties ();
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 ();
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);
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_;
61 static const Control_spec controls_[];
64 #endif // MIDI_CC_ANNOUNCER_HH