XJ music engine  1.9.6
In-game runtime engine for XJ music.
Segment.h
Go to the documentation of this file.
1 // Copyright (c) XJ Music Inc. (https://xjmusic.com) All Rights Reserved.
2 
3 #ifndef SEGMENT_H
4 #define SEGMENT_H
5 
6 #include <optional>
7 #include <string>
8 
10 
11 namespace XJ {
12 
13  class Segment {
14  public:
15 
16  enum Type {
22  };
23 
24  enum State {
29  };
30 
31  Segment() = default;
32 
33  int id{};
37  long beginAtChainMicros{}; // Segment begin-at time in microseconds since beginning of chain
38  std::optional<long> durationMicros{}; // @Nullable
39  std::string key{};
40  int total{};
41  float intensity{};
42  float tempo{};
43  std::string storageKey{};
44  float waveformPreroll{};
46  int delta{};
49 
55  static Type parseType(const std::string &value);
56 
62  static State parseState(const std::string &value);
63 
69  static std::string toString(const Type &type);
70 
76  static std::string toString(const State &state);
77 
83  [[nodiscard]] bool equals(const Segment &segment) const;
84 
89  [[nodiscard]] unsigned long long hashCode() const;
90 
97  friend bool operator<(const Segment &lhs, const Segment &rhs) {
98  return lhs.id < rhs.id;
99  }
100 
101  };
102 
103 }// namespace XJ
104 
105 #endif//SEGMENT_H
static long long currentTimeMillis()
Definition: EntityUtils.h:62
Definition: Segment.h:13
State
Definition: Segment.h:24
@ Crafting
Definition: Segment.h:26
@ Failed
Definition: Segment.h:28
@ Planned
Definition: Segment.h:25
@ Crafted
Definition: Segment.h:27
static std::string toString(const Type &type)
Definition: Segment.cpp:45
Type
Definition: Segment.h:16
@ Initial
Definition: Segment.h:18
@ Pending
Definition: Segment.h:17
@ Continue
Definition: Segment.h:19
@ NextMain
Definition: Segment.h:20
@ NextMacro
Definition: Segment.h:21
long long createdAt
Definition: Segment.h:47
int delta
Definition: Segment.h:46
friend bool operator<(const Segment &lhs, const Segment &rhs)
Definition: Segment.h:97
float tempo
Definition: Segment.h:42
int id
Definition: Segment.h:33
std::optional< long > durationMicros
Definition: Segment.h:38
float waveformPreroll
Definition: Segment.h:44
static State parseState(const std::string &value)
Definition: Segment.cpp:37
UUID chainId
Definition: Segment.h:34
float intensity
Definition: Segment.h:41
float waveformPostroll
Definition: Segment.h:45
static Type parseType(const std::string &value)
Definition: Segment.cpp:29
Type type
Definition: Segment.h:35
int total
Definition: Segment.h:40
State state
Definition: Segment.h:36
bool equals(const Segment &segment) const
Definition: Segment.cpp:55
std::string storageKey
Definition: Segment.h:43
long beginAtChainMicros
Definition: Segment.h:37
unsigned long long hashCode() const
Definition: Segment.cpp:75
std::string key
Definition: Segment.h:39
Segment()=default
long long updatedAt
Definition: Segment.h:48
Definition: ActiveAudio.h:11
std::string UUID
Definition: EntityUtils.h:28