f69d20b773e6b0ec0a2009b119ec3d7c9f186316
[ardour.git] / libs / ardour / ardour / event_type_map.h
1 /*
2     Copyright (C) 2000-2007 Paul Davis
3     Author: David Robillard
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
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19 */
20
21 #ifndef __ardour_event_type_map_h__
22 #define __ardour_event_type_map_h__
23
24 #include <string>
25 #include "evoral/TypeMap.hpp"
26 #include "evoral/ControlList.hpp"
27
28 #include "ardour/libardour_visibility.h"
29
30 namespace ARDOUR {
31
32 class URIMap;
33
34 /** This is the interface Ardour provides to Evoral about what
35  * parameter and event types/ranges/names etc. to use.
36  */
37 class LIBARDOUR_API EventTypeMap : public Evoral::TypeMap {
38 public:
39         static EventTypeMap& instance();
40
41         bool     type_is_midi(uint32_t type) const;
42         uint8_t  parameter_midi_type(const Evoral::Parameter& param) const;
43         uint32_t midi_event_type(uint8_t status) const;
44         Evoral::ControlList::InterpolationStyle interpolation_of(const Evoral::Parameter& param);
45
46         bool                 is_integer(const Evoral::Parameter& param) const;
47         Evoral::Parameter    new_parameter(uint32_t type, uint8_t channel=0, uint32_t id=0) const;
48         Evoral::Parameter    new_parameter(const std::string& str) const;
49         std::string          to_symbol(const Evoral::Parameter& param) const;
50
51         bool                 is_midi_parameter(const Evoral::Parameter& param);
52
53         URIMap& uri_map() { return _uri_map; }
54
55 private:
56         EventTypeMap(URIMap& uri_map) : _uri_map(uri_map) {}
57
58         URIMap& _uri_map;
59
60         static EventTypeMap* event_type_map;
61 };
62
63 } // namespace ARDOUR
64
65 #endif /* __ardour_event_type_map_h__ */
66