switch transport masters to use properties and notify via PropertyChanged
[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 DEFINE_ENUM_CONVERT(ARDOUR::AlignStyle)
68 DEFINE_ENUM_CONVERT(ARDOUR::AlignChoice)
69 DEFINE_ENUM_CONVERT(ARDOUR::RegionEquivalence)
70 DEFINE_ENUM_CONVERT(ARDOUR::WaveformScale)
71 DEFINE_ENUM_CONVERT(ARDOUR::WaveformShape)
72 DEFINE_ENUM_CONVERT(ARDOUR::VUMeterStandard)
73 DEFINE_ENUM_CONVERT(ARDOUR::MeterLineUp)
74 DEFINE_ENUM_CONVERT(ARDOUR::MidiPortFlags)
75 DEFINE_ENUM_CONVERT(ARDOUR::TransportRequestType)
76
77 DEFINE_ENUM_CONVERT(MusicalMode::Type)
78
79 template <>
80 inline bool to_string (ARDOUR::AutoState val, std::string& str)
81 {
82         str = ARDOUR::auto_state_to_string (val);
83         return true;
84 }
85
86 template <>
87 inline bool string_to (const std::string& str, ARDOUR::AutoState& as)
88 {
89         as = ARDOUR::string_to_auto_state (str);
90         return true;
91 }
92
93 template <>
94 inline bool to_string (ARDOUR::DataType val, std::string& str)
95 {
96         str = val.to_string();
97         return true;
98 }
99
100 template <>
101 inline bool string_to (const std::string& str, ARDOUR::DataType& dt)
102 {
103         dt = ARDOUR::DataType(str);
104         return true;
105 }
106
107 } // namespace PBD
108
109 #endif // ARDOUR_TYPES_CONVERT_H