#include <Devices.h>
◆ Devices() [1/3]
94{
98}
void LoadDeviceXml()
Definition Devices.cpp:40
void ProcessDataList()
Definition Devices.cpp:74
void CreateDefaultDeviceXml()
Definition Devices.cpp:59
std::unique_ptr< juce::XmlElement > device_xml_
Definition Devices.h:107
◆ ~Devices()
101{
102 try {
103
104 const auto source {GetSource(MIDI2LR_UC_LITERAL("Controllers.xml"))};
105
107 }
108 catch (const std::exception& e) {
110 }
111 catch (...) {
113 }
114}
void ExceptionResponse(gsl::czstring id, gsl::czstring fu, const std::exception &e) noexcept
void LogAndAlertError(const juce::String &error_text, const std::source_location &location=std::source_location::current()) noexcept
Definition Misc.cpp:160
◆ Devices() [2/3]
Devices::Devices |
( |
const Devices & |
other | ) |
|
|
delete |
◆ Devices() [3/3]
Devices::Devices |
( |
Devices && |
other | ) |
|
|
defaultnoexcept |
◆ Add()
bool Devices::Add |
( |
const juce::MidiDeviceInfo & |
info, |
|
|
const juce::String & |
io |
|
) |
| |
117{
118 try {
119 const auto [it, success] {
device_listing_.try_emplace({info, io},
true)};
120 if (success) {
121 if (
const auto new_element {
data_list_->createNewChildElement(
"item")}) {
122 new_element->setAttribute("devicename", info.name);
123 new_element->setAttribute("systemid", info.identifier);
124 new_element->setAttribute("inputoutput", io);
125 new_element->setAttribute("active", "1");
126 }
127 else {
128 rsj::Log(
"Failed to create new element in Devices::Add");
129 }
130 }
131 return success;
132 }
133 catch (const std::exception& e) {
135 throw;
136 }
137}
juce::XmlElement * data_list_
Definition Devices.h:109
std::map< DevInfo, bool > device_listing_
Definition Devices.h:106
void Log(const juce::String &info, const std::source_location &location=std::source_location::current()) noexcept
Definition Misc.cpp:131
◆ CreateDefaultDeviceXml()
void Devices::CreateDefaultDeviceXml |
( |
| ) |
|
|
private |
60{
61 device_xml_ = juce::parseXML(R
"===(<?xml version="1.0" encoding="UTF-8"?>
62 <table_data>
63 <heading>
64 <column columnId="1" name="devicename" label="device name" width="200"/>
65 <column columnId="2" name="systemid" label="system id" width="200"/>
66 <column columnId="3" name="inputoutput" label="input/output" width="50"/>
67 <column columnId="9" name="active" label="active" width="50"/>
68 </heading>
69 <data>
70 </data>
71 </table_data>)===");
72}
◆ Enabled()
bool Devices::Enabled |
( |
const juce::MidiDeviceInfo & |
info, |
|
|
juce::String |
io |
|
) |
| const |
140{
141 try {
144 return it->second;
145 }
146 catch (const std::exception& e) {
148 throw;
149 }
150}
◆ EnabledOrNew()
bool Devices::EnabledOrNew |
( |
const juce::MidiDeviceInfo & |
info, |
|
|
const juce::String & |
io |
|
) |
| |
153{
154 try {
155 if (
Add(info, io)) {
return true; }
157 }
158 catch (const std::exception& e) {
160 throw;
161 }
162}
bool Add(const juce::MidiDeviceInfo &info, const juce::String &io)
Definition Devices.cpp:116
bool Enabled(const juce::MidiDeviceInfo &info, juce::String io) const
Definition Devices.cpp:139
◆ LoadDeviceXml()
void Devices::LoadDeviceXml |
( |
| ) |
|
|
private |
41{
42 try {
43 auto deviceXmlSource {GetSource(MIDI2LR_UC_LITERAL("Controllers.xml"))};
44 if (deviceXmlSource.existsAsFile()) {
device_xml_ = juce::parseXML(deviceXmlSource); }
45 else {
46 deviceXmlSource = GetSource(MIDI2LR_UC_LITERAL("DisabledControllers.xml"));
47 if (deviceXmlSource.existsAsFile()) {
49 std::ignore = deviceXmlSource.deleteFile();
50 }
51 }
52 }
53 catch (const std::exception& e) {
56 }
57}
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ ProcessDataList()
void Devices::ProcessDataList |
( |
| ) |
|
|
private |
75{
80 for (const gsl::not_null<const juce::XmlElement*> dataElement :
82 device_listing_.emplace(DevInfo {dataElement->getStringAttribute(
"devicename"),
83 dataElement->getStringAttribute("systemid"),
84 dataElement->getStringAttribute("inputoutput")},
85 dataElement->getIntAttribute("active"));
86 }
87 }
88 else {
90 }
91}
int num_rows_
Definition Devices.h:110
juce::XmlElement * column_list_
Definition Devices.h:108
◆ column_list_
juce::XmlElement* Devices::column_list_ {nullptr} |
|
private |
◆ data_list_
juce::XmlElement* Devices::data_list_ {nullptr} |
|
private |
◆ device_listing_
std::map<DevInfo, bool> Devices::device_listing_ |
|
private |
◆ device_xml_
std::unique_ptr<juce::XmlElement> Devices::device_xml_ |
|
private |
◆ num_rows_
int Devices::num_rows_ {0} |
|
private |
The documentation for this class was generated from the following files:
- C:/Users/rsjaf/source/repos/MIDI2LR/src/application/Devices.h
- C:/Users/rsjaf/source/repos/MIDI2LR/src/application/Devices.cpp