summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-11-27 17:57:43 +0100
committerDavid Robillard <d@drobilla.net>2020-11-27 21:42:51 +0100
commit5f5e293345a063ab7b274edcc76d329891503379 (patch)
tree36a346cc4d2bb65d9d2a0e64a0b3270ace37a562
parentf9ff5a5586166ee2f44b43f347726f98c9a966af (diff)
downloadpatchage-5f5e293345a063ab7b274edcc76d329891503379.tar.gz
patchage-5f5e293345a063ab7b274edcc76d329891503379.tar.bz2
patchage-5f5e293345a063ab7b274edcc76d329891503379.zip
Use consistent naming convention for enum classes
-rw-r--r--src/AlsaDriver.cpp24
-rw-r--r--src/Configuration.cpp62
-rw-r--r--src/Configuration.hpp16
-rw-r--r--src/JackDbusDriver.cpp14
-rw-r--r--src/JackDriver.cpp58
-rw-r--r--src/Legend.hpp20
-rw-r--r--src/PatchageCanvas.cpp48
-rw-r--r--src/PatchageEvent.cpp18
-rw-r--r--src/PatchageEvent.hpp18
-rw-r--r--src/PatchageModule.cpp8
-rw-r--r--src/PortID.hpp24
11 files changed, 155 insertions, 155 deletions
diff --git a/src/AlsaDriver.cpp b/src/AlsaDriver.cpp
index b3eed6a..8666137 100644
--- a/src/AlsaDriver.cpp
+++ b/src/AlsaDriver.cpp
@@ -83,7 +83,7 @@ AlsaDriver::detach()
static bool
is_alsa_port(const PatchagePort* port)
{
- return port->type() == PortType::ALSA_MIDI;
+ return port->type() == PortType::alsa_midi;
}
/** Destroy all JACK (canvas) ports.
@@ -199,7 +199,7 @@ AlsaDriver::find_module(uint8_t client_id, ModuleType type)
++j) {
if (j->second->type() == type) {
return j->second;
- } else if (j->second->type() == ModuleType::InputOutput) {
+ } else if (j->second->type() == ModuleType::input_output) {
io_module = j->second;
}
}
@@ -279,14 +279,14 @@ AlsaDriver::create_port_view_internal(Patchage* patchage,
if (!split) {
m = find_or_create_module(
- _app, addr.client, client_name, ModuleType::InputOutput);
+ _app, addr.client, client_name, ModuleType::input_output);
if (!m->get_port(port_name)) {
port = create_port(*m, port_name, is_input, addr);
port->show();
}
} else { // split
- ModuleType type = ((is_input) ? ModuleType::Input : ModuleType::Output);
+ ModuleType type = ((is_input) ? ModuleType::input : ModuleType::output);
m = find_or_create_module(_app, addr.client, client_name, type);
if (!m->get_port(port_name)) {
port = create_port(*m, port_name, is_input, addr);
@@ -294,7 +294,7 @@ AlsaDriver::create_port_view_internal(Patchage* patchage,
}
if (is_duplex) {
- type = ((!is_input) ? ModuleType::Input : ModuleType::Output);
+ type = ((!is_input) ? ModuleType::input : ModuleType::output);
m = find_or_create_module(_app, addr.client, client_name, type);
if (!m->get_port(port_name)) {
port = create_port(*m, port_name, !is_input, addr);
@@ -312,11 +312,11 @@ AlsaDriver::create_port(PatchageModule& parent,
{
auto* ret =
new PatchagePort(parent,
- PortType::ALSA_MIDI,
+ PortType::alsa_midi,
name,
"",
is_input,
- _app->conf()->get_port_color(PortType::ALSA_MIDI),
+ _app->conf()->get_port_color(PortType::alsa_midi),
_app->show_human_names());
dynamic_cast<PatchageCanvas*>(parent.canvas())
@@ -547,7 +547,7 @@ AlsaDriver::_refresh_main()
case SND_SEQ_EVENT_PORT_SUBSCRIBED:
if (!ignore(ev->data.connect.sender) &&
!ignore(ev->data.connect.dest)) {
- _events.push(PatchageEvent(PatchageEvent::Type::CONNECTION,
+ _events.push(PatchageEvent(PatchageEvent::Type::connection,
ev->data.connect.sender,
ev->data.connect.dest));
}
@@ -555,7 +555,7 @@ AlsaDriver::_refresh_main()
case SND_SEQ_EVENT_PORT_UNSUBSCRIBED:
if (!ignore(ev->data.connect.sender) &&
!ignore(ev->data.connect.dest)) {
- _events.push(PatchageEvent(PatchageEvent::Type::DISCONNECTION,
+ _events.push(PatchageEvent(PatchageEvent::Type::disconnection,
ev->data.connect.sender,
ev->data.connect.dest));
}
@@ -568,7 +568,7 @@ AlsaDriver::_refresh_main()
if (!ignore(ev->data.addr)) {
_events.push(PatchageEvent(
- PatchageEvent::Type::PORT_CREATION,
+ PatchageEvent::Type::port_creation,
PortID(ev->data.addr, (caps & SND_SEQ_PORT_CAP_READ))));
}
break;
@@ -577,10 +577,10 @@ AlsaDriver::_refresh_main()
// Note: getting caps at this point does not work
// Delete both inputs and outputs (to handle duplex ports)
_events.push(
- PatchageEvent(PatchageEvent::Type::PORT_DESTRUCTION,
+ PatchageEvent(PatchageEvent::Type::port_destruction,
PortID(ev->data.addr, true)));
_events.push(
- PatchageEvent(PatchageEvent::Type::PORT_DESTRUCTION,
+ PatchageEvent(PatchageEvent::Type::port_destruction,
PortID(ev->data.addr, false)));
_port_addrs.erase(
diff --git a/src/Configuration.cpp b/src/Configuration.cpp
index 29e3f10..36176ec 100644
--- a/src/Configuration.cpp
+++ b/src/Configuration.cpp
@@ -43,44 +43,44 @@ Configuration::Configuration()
, _sort_ports(true)
{
#ifdef PATCHAGE_USE_LIGHT_THEME
- _port_colors[static_cast<unsigned>(PortType::JACK_AUDIO)] =
- _default_port_colors[static_cast<unsigned>(PortType::JACK_AUDIO)] =
+ _port_colors[static_cast<unsigned>(PortType::jack_audio)] =
+ _default_port_colors[static_cast<unsigned>(PortType::jack_audio)] =
0xA4BC8CFF;
- _port_colors[static_cast<unsigned>(PortType::JACK_MIDI)] =
- _default_port_colors[static_cast<unsigned>(PortType::JACK_MIDI)] =
+ _port_colors[static_cast<unsigned>(PortType::jack_midi)] =
+ _default_port_colors[static_cast<unsigned>(PortType::jack_midi)] =
0xC89595FF;
- _port_colors[static_cast<unsigned>(PortType::ALSA_MIDI)] =
- _default_port_colors[static_cast<unsigned>(PortType::ALSA_MIDI)] =
+ _port_colors[static_cast<unsigned>(PortType::alsa_midi)] =
+ _default_port_colors[static_cast<unsigned>(PortType::alsa_midi)] =
0x8F7198FF;
- _port_colors[static_cast<unsigned>(PortType::JACK_OSC)] =
- _default_port_colors[static_cast<unsigned>(PortType::JACK_OSC)] =
+ _port_colors[static_cast<unsigned>(PortType::jack_osc)] =
+ _default_port_colors[static_cast<unsigned>(PortType::jack_osc)] =
0x7E8EAAFF;
- _port_colors[static_cast<unsigned>(PortType::JACK_CV)] =
- _default_port_colors[static_cast<unsigned>(PortType::JACK_CV)] =
+ _port_colors[static_cast<unsigned>(PortType::jack_cv)] =
+ _default_port_colors[static_cast<unsigned>(PortType::jack_cv)] =
0x83AFABFF;
#else
- _port_colors[static_cast<unsigned>(PortType::JACK_AUDIO)] =
- _default_port_colors[static_cast<unsigned>(PortType::JACK_AUDIO)] =
+ _port_colors[static_cast<unsigned>(PortType::jack_audio)] =
+ _default_port_colors[static_cast<unsigned>(PortType::jack_audio)] =
0x3E5E00FF;
- _port_colors[static_cast<unsigned>(PortType::JACK_MIDI)] =
- _default_port_colors[static_cast<unsigned>(PortType::JACK_MIDI)] =
+ _port_colors[static_cast<unsigned>(PortType::jack_midi)] =
+ _default_port_colors[static_cast<unsigned>(PortType::jack_midi)] =
0x650300FF;
- _port_colors[static_cast<unsigned>(PortType::ALSA_MIDI)] =
- _default_port_colors[static_cast<unsigned>(PortType::ALSA_MIDI)] =
+ _port_colors[static_cast<unsigned>(PortType::alsa_midi)] =
+ _default_port_colors[static_cast<unsigned>(PortType::alsa_midi)] =
0x2D0043FF;
- _port_colors[static_cast<unsigned>(PortType::JACK_OSC)] =
- _default_port_colors[static_cast<unsigned>(PortType::JACK_OSC)] =
+ _port_colors[static_cast<unsigned>(PortType::jack_osc)] =
+ _default_port_colors[static_cast<unsigned>(PortType::jack_osc)] =
0x4100FEFF;
- _port_colors[static_cast<unsigned>(PortType::JACK_CV)] =
- _default_port_colors[static_cast<unsigned>(PortType::JACK_CV)] =
+ _port_colors[static_cast<unsigned>(PortType::jack_cv)] =
+ _default_port_colors[static_cast<unsigned>(PortType::jack_cv)] =
0x005E4EFF;
#endif
}
@@ -97,11 +97,11 @@ Configuration::get_module_location(const std::string& name,
}
const ModuleSettings& settings = (*i).second;
- if (type == ModuleType::Input && settings.input_location) {
+ if (type == ModuleType::input && settings.input_location) {
loc = *settings.input_location;
- } else if (type == ModuleType::Output && settings.output_location) {
+ } else if (type == ModuleType::output && settings.output_location) {
loc = *settings.output_location;
- } else if (type == ModuleType::InputOutput && settings.inout_location) {
+ } else if (type == ModuleType::input_output && settings.inout_location) {
loc = *settings.inout_location;
} else {
return false;
@@ -119,19 +119,19 @@ Configuration::set_module_location(const std::string& name,
if (i == _module_settings.end()) {
i = _module_settings
.insert(std::make_pair(
- name, ModuleSettings(type != ModuleType::InputOutput)))
+ name, ModuleSettings(type != ModuleType::input_output)))
.first;
}
ModuleSettings& settings = (*i).second;
switch (type) {
- case ModuleType::Input:
+ case ModuleType::input:
settings.input_location = loc;
break;
- case ModuleType::Output:
+ case ModuleType::output:
settings.output_location = loc;
break;
- case ModuleType::InputOutput:
+ case ModuleType::input_output:
settings.inout_location = loc;
break;
}
@@ -262,15 +262,15 @@ Configuration::load()
file.ignore(1, '\"');
std::getline(file, name, '\"');
- ModuleType type = ModuleType::Input;
+ ModuleType type = ModuleType::input;
std::string type_str;
file >> type_str;
if (type_str == "input") {
- type = ModuleType::Input;
+ type = ModuleType::input;
} else if (type_str == "output") {
- type = ModuleType::Output;
+ type = ModuleType::output;
} else if (type_str == "inputoutput") {
- type = ModuleType::InputOutput;
+ type = ModuleType::input_output;
} else {
std::cerr << "error: bad position type `" << type_str
<< "' for module `" << name << "'" << std::endl;
diff --git a/src/Configuration.hpp b/src/Configuration.hpp
index 3ea564b..e58e170 100644
--- a/src/Configuration.hpp
+++ b/src/Configuration.hpp
@@ -25,18 +25,18 @@
enum class ModuleType
{
- Input,
- Output,
- InputOutput
+ input,
+ output,
+ input_output,
};
enum class PortType
{
- JACK_AUDIO,
- JACK_MIDI,
- ALSA_MIDI,
- JACK_OSC,
- JACK_CV
+ jack_audio,
+ jack_midi,
+ alsa_midi,
+ jack_osc,
+ jack_cv,
};
#define N_PORT_TYPES 5
diff --git a/src/JackDbusDriver.cpp b/src/JackDbusDriver.cpp
index 278c837..9c913c0 100644
--- a/src/JackDbusDriver.cpp
+++ b/src/JackDbusDriver.cpp
@@ -76,8 +76,8 @@ JackDriver::~JackDriver()
static bool
is_jack_port(const PatchagePort* port)
{
- return port->type() == PortType::JACK_AUDIO ||
- port->type() == PortType::JACK_MIDI;
+ return port->type() == PortType::jack_audio ||
+ port->type() == PortType::jack_midi;
}
/** Destroy all JACK (canvas) ports.
@@ -610,23 +610,23 @@ JackDriver::add_port(dbus_uint64_t client_id,
switch (port_type) {
case JACKDBUS_PORT_TYPE_AUDIO:
- local_port_type = PortType::JACK_AUDIO;
+ local_port_type = PortType::jack_audio;
break;
case JACKDBUS_PORT_TYPE_MIDI:
- local_port_type = PortType::JACK_MIDI;
+ local_port_type = PortType::jack_midi;
break;
default:
error_msg("Unknown JACK D-Bus port type");
return;
}
- ModuleType type = ModuleType::InputOutput;
+ ModuleType type = ModuleType::input_output;
if (_app->conf()->get_module_split(
client_name, port_flags & JACKDBUS_PORT_FLAG_TERMINAL)) {
if (port_flags & JACKDBUS_PORT_FLAG_INPUT) {
- type = ModuleType::Input;
+ type = ModuleType::input;
} else {
- type = ModuleType::Output;
+ type = ModuleType::output;
}
}
diff --git a/src/JackDriver.cpp b/src/JackDriver.cpp
index b74dd9c..e916f80 100644
--- a/src/JackDriver.cpp
+++ b/src/JackDriver.cpp
@@ -114,10 +114,10 @@ JackDriver::detach()
static bool
is_jack_port(const PatchagePort* port)
{
- return (port->type() == PortType::JACK_AUDIO ||
- port->type() == PortType::JACK_MIDI ||
- port->type() == PortType::JACK_OSC ||
- port->type() == PortType::JACK_CV);
+ return (port->type() == PortType::jack_audio ||
+ port->type() == PortType::jack_midi ||
+ port->type() == PortType::jack_osc ||
+ port->type() == PortType::jack_cv);
}
/** Destroy all JACK (canvas) ports.
@@ -133,7 +133,7 @@ JackDriver::destroy_all()
PatchagePort*
JackDriver::create_port_view(Patchage* patchage, const PortID& id)
{
- assert(id.type == PortID::Type::JACK_ID);
+ assert(id.type == PortID::Type::jack_id);
jack_port_t* jack_port = jack_port_by_id(_client, id.id.jack_id);
if (!jack_port) {
@@ -148,13 +148,13 @@ JackDriver::create_port_view(Patchage* patchage, const PortID& id)
std::string module_name, port_name;
port_names(id, module_name, port_name);
- ModuleType type = ModuleType::InputOutput;
+ ModuleType type = ModuleType::input_output;
if (_app->conf()->get_module_split(module_name,
(jack_flags & JackPortIsTerminal))) {
if (jack_flags & JackPortIsInput) {
- type = ModuleType::Input;
+ type = ModuleType::input;
} else {
- type = ModuleType::Output;
+ type = ModuleType::output;
}
}
@@ -221,19 +221,19 @@ JackDriver::create_port(PatchageModule& parent, jack_port_t* port, PortID id)
#endif
const char* const type_str = jack_port_type(port);
- PortType port_type = PortType::JACK_AUDIO;
+ PortType port_type = PortType::jack_audio;
if (!strcmp(type_str, JACK_DEFAULT_AUDIO_TYPE)) {
- port_type = PortType::JACK_AUDIO;
+ port_type = PortType::jack_audio;
#ifdef HAVE_JACK_METADATA
if (get_property(uuid, JACKEY_SIGNAL_TYPE) == "CV") {
- port_type = PortType::JACK_CV;
+ port_type = PortType::jack_cv;
}
#endif
} else if (!strcmp(type_str, JACK_DEFAULT_MIDI_TYPE)) {
- port_type = PortType::JACK_MIDI;
+ port_type = PortType::jack_midi;
#ifdef HAVE_JACK_METADATA
if (get_property(uuid, JACKEY_EVENT_TYPES) == "OSC") {
- port_type = PortType::JACK_OSC;
+ port_type = PortType::jack_osc;
}
#endif
} else {
@@ -252,7 +252,7 @@ JackDriver::create_port(PatchageModule& parent, jack_port_t* port, PortID id)
_app->show_human_names(),
order);
- if (id.type != PortID::Type::NULL_PORT_ID) {
+ if (id.type != PortID::Type::nothing) {
dynamic_cast<PatchageCanvas*>(parent.canvas())->index_port(id, ret);
}
@@ -304,13 +304,13 @@ JackDriver::refresh()
client1_name = ports[i];
client1_name = client1_name.substr(0, client1_name.find(":"));
- ModuleType type = ModuleType::InputOutput;
+ ModuleType type = ModuleType::input_output;
if (_app->conf()->get_module_split(
client1_name, (jack_port_flags(port) & JackPortIsTerminal))) {
if (jack_port_flags(port) & JackPortIsInput) {
- type = ModuleType::Input;
+ type = ModuleType::input;
} else {
- type = ModuleType::Output;
+ type = ModuleType::output;
}
}
@@ -339,8 +339,8 @@ JackDriver::refresh()
client1_name = client1_name.substr(0, colon);
const ModuleType port1_type = (jack_port_flags(port) & JackPortIsInput)
- ? ModuleType::Input
- : ModuleType::Output;
+ ? ModuleType::input
+ : ModuleType::output;
PatchageModule* client1_module =
_app->canvas()->find_module(client1_name, port1_type);
@@ -353,9 +353,9 @@ JackDriver::refresh()
port2_name = client2_name.substr(colon + 1);
client2_name = client2_name.substr(0, colon);
- const ModuleType port2_type = (port1_type == ModuleType::Input)
- ? ModuleType::Output
- : ModuleType::Input;
+ const ModuleType port2_type = (port1_type == ModuleType::input)
+ ? ModuleType::output
+ : ModuleType::input;
PatchageModule* client2_module =
_app->canvas()->find_module(client2_name, port2_type);
@@ -397,7 +397,7 @@ JackDriver::port_names(const PortID& id,
{
jack_port_t* jack_port = nullptr;
- if (id.type == PortID::Type::JACK_ID) {
+ if (id.type == PortID::Type::jack_id) {
jack_port = jack_port_by_id(_client, id.id.jack_id);
}
@@ -476,10 +476,10 @@ JackDriver::jack_client_registration_cb(const char* name,
if (registered) {
me->_events.push(
- PatchageEvent(PatchageEvent::Type::CLIENT_CREATION, name));
+ PatchageEvent(PatchageEvent::Type::client_creation, name));
} else {
me->_events.push(
- PatchageEvent(PatchageEvent::Type::CLIENT_DESTRUCTION, name));
+ PatchageEvent(PatchageEvent::Type::client_destruction, name));
}
}
@@ -493,10 +493,10 @@ JackDriver::jack_port_registration_cb(jack_port_id_t port_id,
if (registered) {
me->_events.push(
- PatchageEvent(PatchageEvent::Type::PORT_CREATION, port_id));
+ PatchageEvent(PatchageEvent::Type::port_creation, port_id));
} else {
me->_events.push(
- PatchageEvent(PatchageEvent::Type::PORT_DESTRUCTION, port_id));
+ PatchageEvent(PatchageEvent::Type::port_destruction, port_id));
}
}
@@ -511,10 +511,10 @@ JackDriver::jack_port_connect_cb(jack_port_id_t src,
if (connect) {
me->_events.push(
- PatchageEvent(PatchageEvent::Type::CONNECTION, src, dst));
+ PatchageEvent(PatchageEvent::Type::connection, src, dst));
} else {
me->_events.push(
- PatchageEvent(PatchageEvent::Type::DISCONNECTION, src, dst));
+ PatchageEvent(PatchageEvent::Type::disconnection, src, dst));
}
}
diff --git a/src/Legend.hpp b/src/Legend.hpp
index 6887238..2b3b7f6 100644
--- a/src/Legend.hpp
+++ b/src/Legend.hpp
@@ -28,26 +28,26 @@ class Legend : public Gtk::HBox
public:
Legend(const Configuration& configuration)
{
- add_button(PortType::JACK_AUDIO,
+ add_button(PortType::jack_audio,
"Audio",
- configuration.get_port_color(PortType::JACK_AUDIO));
+ configuration.get_port_color(PortType::jack_audio));
#ifdef HAVE_JACK_METADATA
- add_button(PortType::JACK_CV,
+ add_button(PortType::jack_cv,
"CV",
- configuration.get_port_color(PortType::JACK_CV));
- add_button(PortType::JACK_OSC,
+ configuration.get_port_color(PortType::jack_cv));
+ add_button(PortType::jack_osc,
"OSC",
- configuration.get_port_color(PortType::JACK_OSC));
+ configuration.get_port_color(PortType::jack_osc));
#endif
- add_button(PortType::JACK_MIDI,
+ add_button(PortType::jack_midi,
"MIDI",
- configuration.get_port_color(PortType::JACK_MIDI));
+ configuration.get_port_color(PortType::jack_midi));
- add_button(PortType::ALSA_MIDI,
+ add_button(PortType::alsa_midi,
"ALSA MIDI",
- configuration.get_port_color(PortType::ALSA_MIDI));
+ configuration.get_port_color(PortType::alsa_midi));
show_all_children();
}
diff --git a/src/PatchageCanvas.cpp b/src/PatchageCanvas.cpp
index b701fb2..36a815e 100644
--- a/src/PatchageCanvas.cpp
+++ b/src/PatchageCanvas.cpp
@@ -60,7 +60,7 @@ PatchageCanvas::find_module(const std::string& name, ModuleType type)
++j) {
if (j->second->type() == type) {
return j->second;
- } else if (j->second->type() == ModuleType::InputOutput) {
+ } else if (j->second->type() == ModuleType::input_output) {
io_module = j->second;
}
}
@@ -94,7 +94,7 @@ PatchageCanvas::find_port(const PortID& id)
#ifdef PATCHAGE_LIBJACK
// Alsa ports are always indexed (or don't exist at all)
- if (id.type == PortID::Type::JACK_ID) {
+ if (id.type == PortID::Type::jack_id) {
jack_port_t* jack_port =
jack_port_by_id(_app->jack_driver()->client(), id.id.jack_id);
if (!jack_port) {
@@ -108,8 +108,8 @@ PatchageCanvas::find_port(const PortID& id)
PatchageModule* module =
find_module(module_name,
(jack_port_flags(jack_port) & JackPortIsInput)
- ? ModuleType::Input
- : ModuleType::Output);
+ ? ModuleType::input
+ : ModuleType::output);
if (module) {
pp = module->get_port(port_name);
@@ -227,21 +227,21 @@ PatchageCanvas::connect(Ganv::Node* port1, Ganv::Node* port2)
return;
}
- if ((p1->type() == PortType::JACK_AUDIO &&
- p2->type() == PortType::JACK_AUDIO) ||
- (p1->type() == PortType::JACK_MIDI &&
- p2->type() == PortType::JACK_MIDI) ||
- (p1->type() == PortType::JACK_AUDIO &&
- p2->type() == PortType::JACK_CV) ||
- (p1->type() == PortType::JACK_CV && p2->type() == PortType::JACK_CV) ||
- (p1->type() == PortType::JACK_OSC &&
- p2->type() == PortType::JACK_OSC)) {
+ if ((p1->type() == PortType::jack_audio &&
+ p2->type() == PortType::jack_audio) ||
+ (p1->type() == PortType::jack_midi &&
+ p2->type() == PortType::jack_midi) ||
+ (p1->type() == PortType::jack_audio &&
+ p2->type() == PortType::jack_cv) ||
+ (p1->type() == PortType::jack_cv && p2->type() == PortType::jack_cv) ||
+ (p1->type() == PortType::jack_osc &&
+ p2->type() == PortType::jack_osc)) {
#if defined(PATCHAGE_LIBJACK) || defined(HAVE_JACK_DBUS)
_app->jack_driver()->connect(p1, p2);
#endif
#ifdef HAVE_ALSA
- } else if (p1->type() == PortType::ALSA_MIDI &&
- p2->type() == PortType::ALSA_MIDI) {
+ } else if (p1->type() == PortType::alsa_midi &&
+ p2->type() == PortType::alsa_midi) {
_app->alsa_driver()->connect(p1, p2);
#endif
} else {
@@ -270,15 +270,15 @@ PatchageCanvas::disconnect(Ganv::Node* port1, Ganv::Node* port2)
return;
}
- if (input->type() == PortType::JACK_AUDIO ||
- input->type() == PortType::JACK_MIDI ||
- input->type() == PortType::JACK_CV ||
- input->type() == PortType::JACK_OSC) {
+ if (input->type() == PortType::jack_audio ||
+ input->type() == PortType::jack_midi ||
+ input->type() == PortType::jack_cv ||
+ input->type() == PortType::jack_osc) {
#if defined(PATCHAGE_LIBJACK) || defined(HAVE_JACK_DBUS)
_app->jack_driver()->disconnect(output, input);
#endif
#ifdef HAVE_ALSA
- } else if (input->type() == PortType::ALSA_MIDI) {
+ } else if (input->type() == PortType::alsa_midi) {
_app->alsa_driver()->disconnect(output, input);
#endif
} else {
@@ -294,11 +294,11 @@ PatchageCanvas::add_module(const std::string& name, PatchageModule* module)
// Join partners, if applicable
PatchageModule* in_module = nullptr;
PatchageModule* out_module = nullptr;
- if (module->type() == ModuleType::Input) {
+ if (module->type() == ModuleType::input) {
in_module = module;
- out_module = find_module(name, ModuleType::Output);
- } else if (module->type() == ModuleType::Output) {
- in_module = find_module(name, ModuleType::Output);
+ out_module = find_module(name, ModuleType::output);
+ } else if (module->type() == ModuleType::output) {
+ in_module = find_module(name, ModuleType::output);
out_module = module;
}
diff --git a/src/PatchageEvent.cpp b/src/PatchageEvent.cpp
index d986d5a..bb8e057 100644
--- a/src/PatchageEvent.cpp
+++ b/src/PatchageEvent.cpp
@@ -39,28 +39,28 @@ using boost::format;
void
PatchageEvent::execute(Patchage* patchage)
{
- if (_type == Type::REFRESH) {
+ if (_type == Type::refresh) {
patchage->refresh();
- } else if (_type == Type::CLIENT_CREATION) {
+ } else if (_type == Type::client_creation) {
// No empty modules (for now)
g_free(_str);
_str = nullptr;
- } else if (_type == Type::CLIENT_DESTRUCTION) {
+ } else if (_type == Type::client_destruction) {
patchage->canvas()->remove_module(_str);
g_free(_str);
_str = nullptr;
- } else if (_type == Type::PORT_CREATION) {
+ } else if (_type == Type::port_creation) {
Driver* driver = nullptr;
- if (_port_1.type == PortID::Type::JACK_ID) {
+ if (_port_1.type == PortID::Type::jack_id) {
#if defined(PATCHAGE_LIBJACK) || defined(HAVE_JACK_DBUS)
driver = patchage->jack_driver();
#endif
#ifdef HAVE_ALSA
- } else if (_port_1.type == PortID::Type::ALSA_ADDR) {
+ } else if (_port_1.type == PortID::Type::alsa_addr) {
driver = patchage->alsa_driver();
#endif
}
@@ -77,11 +77,11 @@ PatchageEvent::execute(Patchage* patchage)
(format("Unknown type for port `%1%'") % _port_1).str());
}
- } else if (_type == Type::PORT_DESTRUCTION) {
+ } else if (_type == Type::port_destruction) {
patchage->canvas()->remove_port(_port_1);
- } else if (_type == Type::CONNECTION) {
+ } else if (_type == Type::connection) {
PatchagePort* port_1 = patchage->canvas()->find_port(_port_1);
PatchagePort* port_2 = patchage->canvas()->find_port(_port_2);
@@ -98,7 +98,7 @@ PatchageEvent::execute(Patchage* patchage)
patchage->canvas()->make_connection(port_1, port_2);
}
- } else if (_type == Type::DISCONNECTION) {
+ } else if (_type == Type::disconnection) {
PatchagePort* port_1 = patchage->canvas()->find_port(_port_1);
PatchagePort* port_2 = patchage->canvas()->find_port(_port_2);
diff --git a/src/PatchageEvent.hpp b/src/PatchageEvent.hpp
index 7376915..34cf5fb 100644
--- a/src/PatchageEvent.hpp
+++ b/src/PatchageEvent.hpp
@@ -40,17 +40,17 @@ class PatchageEvent
public:
enum class Type : uint8_t
{
- NULL_EVENT = 0,
- REFRESH,
- CLIENT_CREATION,
- CLIENT_DESTRUCTION,
- PORT_CREATION,
- PORT_DESTRUCTION,
- CONNECTION,
- DISCONNECTION
+ noop,
+ refresh,
+ client_creation,
+ client_destruction,
+ port_creation,
+ port_destruction,
+ connection,
+ disconnection,
};
- explicit PatchageEvent(Type type = Type::NULL_EVENT)
+ explicit PatchageEvent(Type type = Type::noop)
: _str(nullptr)
, _type(type)
{}
diff --git a/src/PatchageModule.cpp b/src/PatchageModule.cpp
index 61728ec..c871036 100644
--- a/src/PatchageModule.cpp
+++ b/src/PatchageModule.cpp
@@ -54,7 +54,7 @@ PatchageModule::update_menu()
return;
}
- if (_type == ModuleType::InputOutput) {
+ if (_type == ModuleType::input_output) {
bool has_in = false;
bool has_out = false;
for (const_iterator p = begin(); p != end(); ++p) {
@@ -77,7 +77,7 @@ PatchageModule::show_menu(GdkEventButton* ev)
{
_menu = new Gtk::Menu();
Gtk::Menu::MenuList& items = _menu->items();
- if (_type == ModuleType::InputOutput) {
+ if (_type == ModuleType::input_output) {
items.push_back(Gtk::Menu_Helpers::MenuElem(
"_Split", sigc::mem_fun(this, &PatchageModule::split)));
update_menu();
@@ -124,7 +124,7 @@ PatchageModule::store_location(double x, double y)
void
PatchageModule::split()
{
- assert(_type == ModuleType::InputOutput);
+ assert(_type == ModuleType::input_output);
_app->conf()->set_module_split(_name, true);
_app->refresh();
}
@@ -132,7 +132,7 @@ PatchageModule::split()
void
PatchageModule::join()
{
- assert(_type != ModuleType::InputOutput);
+ assert(_type != ModuleType::input_output);
_app->conf()->set_module_split(_name, false);
_app->refresh();
}
diff --git a/src/PortID.hpp b/src/PortID.hpp
index 3c253cb..d830c0c 100644
--- a/src/PortID.hpp
+++ b/src/PortID.hpp
@@ -35,13 +35,13 @@ struct PortID
{
enum class Type
{
- NULL_PORT_ID,
- JACK_ID,
- ALSA_ADDR
+ nothing,
+ jack_id,
+ alsa_addr,
};
PortID()
- : type(Type::NULL_PORT_ID)
+ : type(Type::nothing)
{
memset(&id, 0, sizeof(id));
}
@@ -54,7 +54,7 @@ struct PortID
#ifdef PATCHAGE_LIBJACK
PortID(jack_port_id_t jack_id, bool ign = false)
- : type(Type::JACK_ID)
+ : type(Type::jack_id)
{
id.jack_id = jack_id;
}
@@ -62,7 +62,7 @@ struct PortID
#ifdef HAVE_ALSA
PortID(snd_seq_addr_t addr, bool in)
- : type(Type::ALSA_ADDR)
+ : type(Type::alsa_addr)
{
id.alsa_addr = addr;
id.is_input = in;
@@ -90,14 +90,14 @@ static inline std::ostream&
operator<<(std::ostream& os, const PortID& id)
{
switch (id.type) {
- case PortID::Type::NULL_PORT_ID:
+ case PortID::Type::nothing:
return os << "(null)";
- case PortID::Type::JACK_ID:
+ case PortID::Type::jack_id:
#ifdef PATCHAGE_LIBJACK
return os << "jack:" << id.id.jack_id;
#endif
break;
- case PortID::Type::ALSA_ADDR:
+ case PortID::Type::alsa_addr:
#ifdef HAVE_ALSA
return os << "alsa:" << (int)id.id.alsa_addr.client << ":"
<< (int)id.id.alsa_addr.port << ":"
@@ -117,14 +117,14 @@ operator<(const PortID& a, const PortID& b)
}
switch (a.type) {
- case PortID::Type::NULL_PORT_ID:
+ case PortID::Type::nothing:
return true;
- case PortID::Type::JACK_ID:
+ case PortID::Type::jack_id:
#ifdef PATCHAGE_LIBJACK
return a.id.jack_id < b.id.jack_id;
#endif
break;
- case PortID::Type::ALSA_ADDR:
+ case PortID::Type::alsa_addr:
#ifdef HAVE_ALSA
if ((a.id.alsa_addr.client < b.id.alsa_addr.client) ||
((a.id.alsa_addr.client == b.id.alsa_addr.client) &&