reverse velocity display related commits
[ardour.git] / libs / ardour / ardour / types_convert.h
1 /*
2     Copyright (C) 2015 Tim Mayberry
3
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.
8
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.
13
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.
17
18 */
19
20 #ifndef ARDOUR_TYPES_CONVERT_H
21 #define ARDOUR_TYPES_CONVERT_H
22
23 #ifdef COMPILER_MSVC
24 #pragma warning(disable:4101)
25 #endif
26
27 #include "pbd/enum_convert.h"
28
29 #include "ardour/types.h"
30 #include "ardour/data_type.h"
31 #include "ardour/mode.h"
32
33 namespace PBD {
34
35 DEFINE_ENUM_CONVERT(Timecode::TimecodeFormat)
36
37 DEFINE_ENUM_CONVERT(ARDOUR::AnyTime::Type)
38 DEFINE_ENUM_CONVERT(ARDOUR::SampleFormat)
39 DEFINE_ENUM_CONVERT(ARDOUR::HeaderFormat)
40 DEFINE_ENUM_CONVERT(ARDOUR::AutoConnectOption)
41 DEFINE_ENUM_CONVERT(ARDOUR::TracksAutoNamingRule)
42 DEFINE_ENUM_CONVERT(ARDOUR::TrackMode)
43 DEFINE_ENUM_CONVERT(ARDOUR::EditMode)
44 DEFINE_ENUM_CONVERT(ARDOUR::MonitorModel)
45 DEFINE_ENUM_CONVERT(ARDOUR::AFLPosition)
46 DEFINE_ENUM_CONVERT(ARDOUR::PFLPosition)
47 DEFINE_ENUM_CONVERT(ARDOUR::ListenPosition)
48 DEFINE_ENUM_CONVERT(ARDOUR::LayerModel)
49 DEFINE_ENUM_CONVERT(ARDOUR::InsertMergePolicy)
50 DEFINE_ENUM_CONVERT(ARDOUR::SyncSource)
51 DEFINE_ENUM_CONVERT(ARDOUR::ShuttleBehaviour)
52 DEFINE_ENUM_CONVERT(ARDOUR::ShuttleUnits)
53 DEFINE_ENUM_CONVERT(ARDOUR::ClockDeltaMode)
54 DEFINE_ENUM_CONVERT(ARDOUR::DenormalModel)
55 DEFINE_ENUM_CONVERT(ARDOUR::PositionLockStyle)
56 DEFINE_ENUM_CONVERT(ARDOUR::FadeShape)
57 DEFINE_ENUM_CONVERT(ARDOUR::RegionSelectionAfterSplit)
58 DEFINE_ENUM_CONVERT(ARDOUR::BufferingPreset)
59 DEFINE_ENUM_CONVERT(ARDOUR::AutoReturnTarget)
60 DEFINE_ENUM_CONVERT(ARDOUR::MeterType)
61 DEFINE_ENUM_CONVERT(ARDOUR::MeterPoint)
62 DEFINE_ENUM_CONVERT(ARDOUR::DiskIOPoint)
63 DEFINE_ENUM_CONVERT(ARDOUR::NoteMode)
64 DEFINE_ENUM_CONVERT(ARDOUR::ChannelMode)
65 DEFINE_ENUM_CONVERT(ARDOUR::MonitorChoice)
66 DEFINE_ENUM_CONVERT(ARDOUR::PluginType)
67
68 DEFINE_ENUM_CONVERT(ARDOUR::AlignStyle)
69 DEFINE_ENUM_CONVERT(ARDOUR::AlignChoice)
70
71 DEFINE_ENUM_CONVERT(ARDOUR::WaveformScale)
72 DEFINE_ENUM_CONVERT(ARDOUR::WaveformShape)
73 DEFINE_ENUM_CONVERT(ARDOUR::VUMeterStandard)
74 DEFINE_ENUM_CONVERT(ARDOUR::MeterLineUp)
75
76 DEFINE_ENUM_CONVERT(ARDOUR::MidiPortFlags)
77
78 DEFINE_ENUM_CONVERT(MusicalMode::Type)
79
80 template <>
81 inline bool to_string (ARDOUR::AutoState val, std::string& str)
82 {
83         str = ARDOUR::auto_state_to_string (val);
84         return true;
85 }
86
87 template <>
88 inline bool string_to (const std::string& str, ARDOUR::AutoState& as)
89 {
90         as = ARDOUR::string_to_auto_state (str);
91         return true;
92 }
93
94 template <>
95 inline bool to_string (ARDOUR::DataType val, std::string& str)
96 {
97         str = val.to_string();
98         return true;
99 }
100
101 template <>
102 inline bool string_to (const std::string& str, ARDOUR::DataType& dt)
103 {
104         dt = ARDOUR::DataType(str);
105         return true;
106 }
107
108 } // namespace PBD
109
110 #endif // ARDOUR_TYPES_CONVERT_H