1 /* Copyright 2017, Ableton AG, Berlin. All rights reserved.
2  *
3  *  This program is free software: you can redistribute it and/or modify
4  *  it under the terms of the GNU General Public License as published by
5  *  the Free Software Foundation, either version 2 of the License, or
6  *  (at your option) any later version.
7  *
8  *  This program is distributed in the hope that it will be useful,
9  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  *  GNU General Public License for more details.
12  *
13  *  You should have received a copy of the GNU General Public License
14  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
15  *
16  *  If you would like to incorporate Link into a proprietary software application,
17  *  please contact <link-devs@ableton.com>.
18  */
19 
20 #pragma once
21 
22 #include <ableton/link/Optional.hpp>
23 #include <ableton/link/StartStopState.hpp>
24 #include <ableton/link/Timeline.hpp>
25 
26 namespace ableton
27 {
28 namespace link
29 {
30 
31 using OptionalTimeline = Optional<Timeline>;
32 using OptionalStartStopState = Optional<StartStopState>;
33 
34 struct SessionState
35 {
36   Timeline timeline;
37   StartStopState startStopState;
38   GhostXForm ghostXForm;
39 };
40 
41 struct ClientState
42 {
operator ==(const ClientState & lhs,const ClientState & rhs)43   friend bool operator==(const ClientState& lhs, const ClientState& rhs)
44   {
45     return std::tie(lhs.timeline, lhs.startStopState)
46            == std::tie(rhs.timeline, rhs.startStopState);
47   }
48 
operator !=(const ClientState & lhs,const ClientState & rhs)49   friend bool operator!=(const ClientState& lhs, const ClientState& rhs)
50   {
51     return !(lhs == rhs);
52   }
53 
54   Timeline timeline;
55   StartStopState startStopState;
56 };
57 
58 struct RtClientState
59 {
60   Timeline timeline;
61   StartStopState startStopState;
62   std::chrono::microseconds timelineTimestamp;
63   std::chrono::microseconds startStopStateTimestamp;
64 };
65 
66 struct IncomingClientState
67 {
68   OptionalTimeline timeline;
69   OptionalStartStopState startStopState;
70   std::chrono::microseconds timelineTimestamp;
71 };
72 
73 struct ApiState
74 {
75   Timeline timeline;
76   ApiStartStopState startStopState;
77 };
78 
79 } // namespace link
80 } // namespace ableton
81