XJ music engine  1.9.6
In-game runtime engine for XJ music.
StickyBun.h
Go to the documentation of this file.
1 // Copyright (c) XJ Music Inc. (https://xjmusic.com) All Rights Reserved.
2 
3 #ifndef XJMUSIC_MUSIC_STICKY_BUN_H
4 #define XJMUSIC_MUSIC_STICKY_BUN_H
5 
6 #include <string>
7 #include <vector>
8 #include <random>
9 
11 #include "Note.h"
12 
13 using namespace XJ;
14 
15 namespace XJ {
16 
20  class StickyBun {
21  private:
22  static std::random_device rd;
23  static std::mt19937 gen;
24  static int MAX_VALUE;
25  static std::uniform_int_distribution<> distrib;
26  static std::string META_KEY_TEMPLATE;
27 
28  public:
29  std::vector<int> values;
31 
35  StickyBun() = default;
36 
43  StickyBun(UUID eventId, int size);
44 
51  StickyBun(UUID eventId, std::vector<int> values);
52 
60  static std::string computeMetaKey(const UUID& id);
61 
69  [[nodiscard]] std::vector<Note> replaceAtonal(std::vector<Note> source, const std::vector<Note>& voicingNotes) const;
70 
78  [[nodiscard]] Note compute(const std::vector<Note> &voicingNotes, int index) const;
79 
84  [[nodiscard]] std::string computeMetaKey() const;
85 
90  std::string serialize();
91 
97  static StickyBun deserializeFrom(const std::string& str);
98  };
99 
100 }// namespace XJ
101 
102 #endif// XJMUSIC_MUSIC_STICKY_BUN_H
Definition: Note.h:19
Definition: StickyBun.h:20
std::string computeMetaKey() const
Definition: StickyBun.cpp:66
static StickyBun deserializeFrom(const std::string &str)
Definition: StickyBun.cpp:79
StickyBun()=default
std::vector< int > values
Definition: StickyBun.h:29
Note compute(const std::vector< Note > &voicingNotes, int index) const
Definition: StickyBun.cpp:54
std::string serialize()
Definition: StickyBun.cpp:71
UUID eventId
Definition: StickyBun.h:30
std::vector< Note > replaceAtonal(std::vector< Note > source, const std::vector< Note > &voicingNotes) const
Definition: StickyBun.cpp:40
Definition: ActiveAudio.h:11
std::string UUID
Definition: EntityUtils.h:28