-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathheader.hpp
More file actions
36 lines (31 loc) · 783 Bytes
/
header.hpp
File metadata and controls
36 lines (31 loc) · 783 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#pragma once
#include "chunk.hpp"
#include "error.hpp"
#include <string_view>
#include <variant>
namespace midi
{
enum class Format : uint16_t { zero = 0, one = 1, two = 2 };
using Ticks = uint16_t;
enum class SmpteFormat : uint8_t { f24 = 24, f25 = 25, f29 = 29, f30 = 30 };
struct Smpte
{
SmpteFormat fmt;
Ticks tpf; // ticks per frame
};
class Header : public Chunk
{
public:
Header() = default;
Header(Raw);
auto write(std::ostream &) const -> void;
public:
Format format;
size_t ntrks;
std::variant<Ticks, Smpte> division;
};
auto toStr(Format) -> const char *;
auto toStr(Smpte) -> std::string;
auto toStr(SmpteFormat) -> std::string;
auto toStr(std::variant<Ticks, Smpte>) -> std::string;
} // namespace midi