diff options
author | David Robillard <d@drobilla.net> | 2020-02-09 14:34:20 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-02-09 14:34:20 +0100 |
commit | af5ec4bdda21e9a2f76f22050216a0b1cbbed575 (patch) | |
tree | f93ddc033b70297abb472f7e28a06f9e936cf0ee /src/PortID.hpp | |
parent | c321c02a6b9c67b4b106e36a77167ee279b9ef78 (diff) | |
download | patchage-af5ec4bdda21e9a2f76f22050216a0b1cbbed575.tar.gz patchage-af5ec4bdda21e9a2f76f22050216a0b1cbbed575.tar.bz2 patchage-af5ec4bdda21e9a2f76f22050216a0b1cbbed575.zip |
Format all code with clang-format
This configuration tries to get as close to the previous style as possible so
the changes aren't too dramatic. It's still far from ideal and the code could
use some adaptation, but this makes things much easier to work on.
Diffstat (limited to 'src/PortID.hpp')
-rw-r--r-- | src/PortID.hpp | 58 |
1 files changed, 40 insertions, 18 deletions
diff --git a/src/PortID.hpp b/src/PortID.hpp index f8e530f..01a8ec4 100644 --- a/src/PortID.hpp +++ b/src/PortID.hpp @@ -22,39 +22,60 @@ #include "PatchagePort.hpp" #ifdef PATCHAGE_LIBJACK - #include <jack/jack.h> +# include <jack/jack.h> #endif #ifdef HAVE_ALSA - #include <alsa/asoundlib.h> +# include <alsa/asoundlib.h> #endif #include <cstring> #include <iostream> -struct PortID { - PortID() : type(NULL_PORT_ID) { memset(&id, 0, sizeof(id)); } - PortID(const PortID& copy) : type(copy.type) { +struct PortID +{ + PortID() + : type(NULL_PORT_ID) + { + memset(&id, 0, sizeof(id)); + } + PortID(const PortID& copy) + : type(copy.type) + { memcpy(&id, ©.id, sizeof(id)); } - enum { NULL_PORT_ID, JACK_ID, ALSA_ADDR } type; + enum + { + NULL_PORT_ID, + JACK_ID, + ALSA_ADDR + } type; #ifdef PATCHAGE_LIBJACK - PortID(jack_port_id_t jack_id, bool ign=false) - : type(JACK_ID) { id.jack_id = jack_id; } + PortID(jack_port_id_t jack_id, bool ign = false) + : type(JACK_ID) + { + id.jack_id = jack_id; + } #endif #ifdef HAVE_ALSA PortID(snd_seq_addr_t addr, bool in) - : type(ALSA_ADDR) { id.alsa_addr = addr; id.is_input = in; } + : type(ALSA_ADDR) + { + id.alsa_addr = addr; + id.is_input = in; + } #endif - union { + union + { #ifdef PATCHAGE_LIBJACK jack_port_id_t jack_id; #endif #ifdef HAVE_ALSA - struct { + struct + { snd_seq_addr_t alsa_addr; bool is_input : 1; }; @@ -75,8 +96,9 @@ operator<<(std::ostream& os, const PortID& id) break; case PortID::ALSA_ADDR: #ifdef HAVE_ALSA - return os << "alsa:" << (int)id.id.alsa_addr.client << ":" << (int)id.id.alsa_addr.port - << ":" << (id.id.is_input ? "in" : "out"); + return os << "alsa:" << (int)id.id.alsa_addr.client << ":" + << (int)id.id.alsa_addr.port << ":" + << (id.id.is_input ? "in" : "out"); #endif break; } @@ -100,12 +122,12 @@ operator<(const PortID& a, const PortID& b) break; case PortID::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) - && a.id.alsa_addr.port < b.id.alsa_addr.port)) { + if ((a.id.alsa_addr.client < b.id.alsa_addr.client) || + ((a.id.alsa_addr.client == b.id.alsa_addr.client) && + a.id.alsa_addr.port < b.id.alsa_addr.port)) { return true; - } else if (a.id.alsa_addr.client == b.id.alsa_addr.client - && a.id.alsa_addr.port == b.id.alsa_addr.port) { + } else if (a.id.alsa_addr.client == b.id.alsa_addr.client && + a.id.alsa_addr.port == b.id.alsa_addr.port) { return (a.id.is_input < b.id.is_input); } else { return false; |