#include <ProfileManager.h>
◆ SwitchState
Enumerator |
---|
kNone | |
kPrev | |
kNext | |
◆ ProfileManager() [1/3]
35{
36
39}
void AddCallback(_In_ T *const object, _In_ void(T::*const mf)(bool, bool))
Definition LR_IPC_Out.h:51
void AddCallback(_In_ T *const object, _In_ void(T::*const mf)(rsj::MidiMessage))
Definition MIDIReceiver.h:49
ControlsModel & controls_model_
Definition ProfileManager.h:79
LrIpcOut & lr_ipc_out_
Definition ProfileManager.h:82
const Profile & current_profile_
Definition ProfileManager.h:78
void MidiCmdCallback(rsj::MidiMessage mm)
Definition ProfileManager.cpp:141
void ConnectionCallback(bool, bool)
Definition ProfileManager.cpp:160
◆ ~ProfileManager()
ProfileManager::~ProfileManager |
( |
| ) |
|
|
default |
◆ ProfileManager() [2/3]
◆ ProfileManager() [3/3]
◆ AddCallback()
template<class T >
void ProfileManager::AddCallback |
( |
_In_ T *const |
object, |
|
|
_In_ void(T::*)(juce::XmlElement *, const juce::String &) |
mf |
|
) |
| |
|
inline |
51 {
52 if (
object && mf) {
callbacks_.emplace_back(std::bind_front(mf,
object)); }
53 }
std::vector< std::function< void(juce::XmlElement *, const juce::String &)> > callbacks_
Definition ProfileManager.h:84
◆ ConnectionCallback()
void ProfileManager::ConnectionCallback |
( |
bool |
connected, |
|
|
bool |
blocked |
|
) |
| |
|
private |
161{
162 try {
163 if (connected && !blocked) {
165 juce::File::addTrailingSeparator(
profile_location_.getFullPathName()).toStdString()));
166 }
167 }
168 catch (const std::exception& e) {
170 throw;
171 }
172}
void SendCommand(std::string &&command) const
Definition LR_IPC_Out.cpp:67
juce::File profile_location_
Definition ProfileManager.h:81
void ExceptionResponse(gsl::czstring id, gsl::czstring fu, const std::exception &e) noexcept
◆ GetProfileDirectory()
const juce::String & ProfileManager::GetProfileDirectory |
( |
| ) |
const |
|
inlinenoexcept |
◆ handleAsyncUpdate()
void ProfileManager::handleAsyncUpdate |
( |
| ) |
|
|
overrideprivate |
175{
176 try {
181 break;
185 break;
187 break;
188 }
189 }
190 catch (const std::exception& e) {
192 throw;
193 }
194}
void SwitchToNextProfile()
Definition ProfileManager.cpp:93
SwitchState switch_state_
Definition ProfileManager.h:85
void SwitchToPreviousProfile()
Definition ProfileManager.cpp:106
◆ MapCommand()
120{
121 try {
122 using namespace std::string_literals;
124 if (cmd == "PrevPro"s) {
126 triggerAsyncUpdate();
127 }
128 else if (cmd == "NextPro"s) {
130 triggerAsyncUpdate();
131 }
132 else {
133 }
134 }
135 catch (const std::exception& e) {
137 throw;
138 }
139}
const std::string & GetCommandForMessage(rsj::MidiMessageId message) const
Definition Profile.h:89
◆ MidiCmdCallback()
142{
143 try {
145
146
149 return;
150 }
152 }
153 catch (const std::exception& e) {
155 throw;
156 }
157}
double ControllerToPlugin(rsj::MidiMessage mm, bool wrap)
Definition ControlsModel.h:225
bool MessageExistsInMap(rsj::MidiMessageId message) const
Definition Profile.h:124
void MapCommand(rsj::MidiMessageId msg)
Definition ProfileManager.cpp:119
Definition MidiUtilities.h:145
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ SetProfileDirectory()
void ProfileManager::SetProfileDirectory |
( |
const juce::File & |
directory | ) |
|
42{
43 try {
45 auto file_array {directory.findChildFiles(juce::File::findFiles, false, "*.xml")};
46 file_array.sort();
48 std::ranges::transform(file_array,
profiles_.begin(),
49 [](const auto& file) { return file.getFileName(); });
50 }
51 catch (const std::exception& e) {
53 throw;
54 }
55}
std::vector< juce::String > profiles_
Definition ProfileManager.h:83
◆ SwitchToNextProfile()
void ProfileManager::SwitchToNextProfile |
( |
| ) |
|
|
private |
94{
95 try {
96 const auto profiles_size {gsl::narrow_cast<int>(
profiles_.size())};
99 }
100 catch (const std::exception& e) {
102 throw;
103 }
104}
void SwitchToProfile(int profile_index)
Definition ProfileManager.cpp:57
int current_profile_index_
Definition ProfileManager.h:80
◆ SwitchToPreviousProfile()
void ProfileManager::SwitchToPreviousProfile |
( |
| ) |
|
|
private |
107{
108 try {
109 const auto profiles_size {gsl::narrow_cast<int>(
profiles_.size())};
112 }
113 catch (const std::exception& e) {
115 throw;
116 }
117}
◆ SwitchToProfile() [1/2]
void ProfileManager::SwitchToProfile |
( |
const juce::String & |
profile | ) |
|
73{
74 try {
76 if (profile_file.exists()) {
77 if (const auto parsed {juce::parseXML(profile_file)}) {
78 for (
const auto& cb :
callbacks_) { cb(parsed.get(), profile); }
81 .toStdString()));
83 profile.toStdString()));
84 }
85 }
86 }
87 catch (const std::exception& e) {
89 throw;
90 }
91}
◆ SwitchToProfile() [2/2]
void ProfileManager::SwitchToProfile |
( |
int |
profile_index | ) |
|
58{
59 try {
60 if (profile_index >= 0 && std::cmp_less(profile_index,
profiles_.size())) {
63 }
64 }
65 catch (const std::exception& e) {
67 throw;
68 }
69}
◆ callbacks_
std::vector<std::function<void(juce::XmlElement*, const juce::String&)> > ProfileManager::callbacks_ |
|
private |
◆ controls_model_
◆ current_profile_
const Profile& ProfileManager::current_profile_ |
|
private |
◆ current_profile_index_
int ProfileManager::current_profile_index_ {0} |
|
private |
◆ lr_ipc_out_
◆ profile_location_
juce::File ProfileManager::profile_location_ |
|
private |
◆ profiles_
std::vector<juce::String> ProfileManager::profiles_ |
|
private |
◆ switch_state_
The documentation for this class was generated from the following files:
- C:/Users/rsjaf/source/repos/MIDI2LR/src/application/ProfileManager.h
- C:/Users/rsjaf/source/repos/MIDI2LR/src/application/ProfileManager.cpp