XJ music engine  1.9.6
In-game runtime engine for XJ music.
SegmentUtils.h
Go to the documentation of this file.
1 // Copyright (c) XJ Music Inc. (https://xjmusic.com) All Rights Reserved.
2 
3 #ifndef XJMUSIC_FABRICATOR_SEGMENT_UTILS_H
4 #define XJMUSIC_FABRICATOR_SEGMENT_UTILS_H
5 
6 #include <optional>
7 #include <set>
8 #include <string>
9 #include <vector>
10 
15 
16 
20 namespace XJ {
21 
22  class SegmentUtils {
23 
24  public:
25 
33  static std::optional<const SegmentChoice *>
34  findFirstOfType(const std::set<const SegmentChoice *> &segmentChoices, Program::Type type);
35 
43  static std::optional<const SegmentChoice *>
44  findFirstOfType(const std::set<const SegmentChoice *> &segmentChoices, Instrument::Type type);
45 
52  static std::string getIdentifier(const Segment *segment);
53 
60  static std::optional<const Segment *> getLastCrafted(const std::vector<const Segment *> &segments);
61 
68  static std::optional<const Segment *> getLast(const std::vector<const Segment *> &segments);
69 
76  static std::vector<const Segment *> getCrafted(const std::vector<const Segment *> &segments);
77 
84  static bool containsAnyValidNotes(const SegmentChordVoicing *voicing);
85 
95  static bool isSpanning(const Segment *segment,
96  unsigned long long fromChainMicros,
97  unsigned long long toChainMicros);
98 
110  static bool isIntersecting(const Segment *segment,
111  unsigned long long atChainMicros,
112  unsigned long long thresholdMicros);
113 
121  static std::string getStorageFilename(const Segment *segment, const std::string &extension);
122 
129  static std::string getStorageFilename(const Segment *segment);
130 
135  static std::string describe(const SegmentChoice &choice);
136 
142  static long getEndAtChainMicros(const Segment *segment);
143 
150  static bool isSameButUpdated(const Segment *s1, const Segment *s2);
151 
157  static long getDurationMinMicros(std::vector<Segment> &segments);
158 
159  };
160 
161 } // namespace XJ
162 
163 #endif //XJMUSIC_FABRICATOR_SEGMENT_UTILS_H
Type
Definition: Instrument.h:16
Type
Definition: Program.h:16
Definition: SegmentChoice.h:15
Definition: SegmentChordVoicing.h:16
Definition: SegmentUtils.h:22
static std::vector< const Segment * > getCrafted(const std::vector< const Segment * > &segments)
Definition: SegmentUtils.cpp:59
static std::string describe(const SegmentChoice &choice)
Definition: SegmentUtils.cpp:101
static std::optional< const SegmentChoice * > findFirstOfType(const std::set< const SegmentChoice * > &segmentChoices, Program::Type type)
Definition: SegmentUtils.cpp:9
static long getEndAtChainMicros(const Segment *segment)
Definition: SegmentUtils.cpp:120
static std::string getStorageFilename(const Segment *segment, const std::string &extension)
Definition: SegmentUtils.cpp:91
static std::string getIdentifier(const Segment *segment)
Definition: SegmentUtils.cpp:32
static long getDurationMinMicros(std::vector< Segment > &segments)
Definition: SegmentUtils.cpp:139
static std::optional< const Segment * > getLast(const std::vector< const Segment * > &segments)
Definition: SegmentUtils.cpp:49
static bool isSameButUpdated(const Segment *s1, const Segment *s2)
Definition: SegmentUtils.cpp:126
static std::optional< const Segment * > getLastCrafted(const std::vector< const Segment * > &segments)
Definition: SegmentUtils.cpp:40
static bool containsAnyValidNotes(const SegmentChordVoicing *voicing)
Definition: SegmentUtils.cpp:68
static bool isSpanning(const Segment *segment, unsigned long long fromChainMicros, unsigned long long toChainMicros)
Definition: SegmentUtils.cpp:73
static bool isIntersecting(const Segment *segment, unsigned long long atChainMicros, unsigned long long thresholdMicros)
Definition: SegmentUtils.cpp:82
Definition: Segment.h:13
Definition: ActiveAudio.h:11