OSSIA
Open Scenario System for Interactive Application
Loading...
Searching...
No Matches
ossia-qt/time.hpp
1#pragma once
2#include <ossia/editor/scenario/time_signature.hpp>
3
4#include <ossia-qt/time_value.hpp>
5
6#include <verdigris>
7
8namespace ossia
9{
10using musical_sync = double;
11struct bar_time
12{
13 int32_t bars{};
14 int16_t quarters{};
15 int8_t semiquavers{};
16 int8_t cents{};
17
18 friend bool operator==(const bar_time& lhs, const bar_time& rhs) noexcept
19 {
20 return lhs.bars == rhs.bars && lhs.quarters == rhs.quarters
21 && lhs.semiquavers == rhs.semiquavers && lhs.cents == rhs.cents;
22 }
23 friend bool operator!=(const bar_time& lhs, const bar_time& rhs) noexcept
24 {
25 return !(lhs == rhs);
26 }
27};
28}
29
30inline QDataStream& operator<<(QDataStream& i, const ossia::time_signature& sel)
31{
32 return i << sel.upper << sel.lower;
33}
34
35inline QDataStream& operator>>(QDataStream& i, ossia::time_signature& sel)
36{
37 return i >> sel.upper >> sel.lower;
38}
39
40inline QDataStream& operator<<(QDataStream& i, const ossia::bar_time& sel)
41{
42 return i << sel.bars << sel.quarters << sel.semiquavers << sel.cents;
43}
44
45inline QDataStream& operator>>(QDataStream& i, ossia::bar_time& sel)
46{
47 return i >> sel.bars >> sel.quarters >> sel.semiquavers >> sel.cents;
48}
49
50Q_DECLARE_METATYPE(ossia::musical_sync)
51W_REGISTER_ARGTYPE(ossia::musical_sync)
52
53Q_DECLARE_METATYPE(ossia::bar_time)
54W_REGISTER_ARGTYPE(ossia::bar_time)
55
56Q_DECLARE_METATYPE(ossia::time_signature)
57W_REGISTER_ARGTYPE(ossia::time_signature)
Definition git_info.h:7