diff options
author | David Robillard <d@drobilla.net> | 2020-11-28 19:31:44 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-11-28 22:49:10 +0100 |
commit | f53a94419853b63a0f97deab1cf4ccedd4088f3b (patch) | |
tree | ef456e407e7ab41a02558cb82c6109d4cacbd3b2 /src | |
parent | 1c5decf5f85b7808a70885c820596fac013cf644 (diff) | |
download | patchage-f53a94419853b63a0f97deab1cf4ccedd4088f3b.tar.gz patchage-f53a94419853b63a0f97deab1cf4ccedd4088f3b.tar.bz2 patchage-f53a94419853b63a0f97deab1cf4ccedd4088f3b.zip |
Print metadata about creation events
Diffstat (limited to 'src')
-rw-r--r-- | src/event_to_string.cpp | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/src/event_to_string.cpp b/src/event_to_string.cpp index e351c28..83455bf 100644 --- a/src/event_to_string.cpp +++ b/src/event_to_string.cpp @@ -36,7 +36,8 @@ struct EventPrinter std::string operator()(const ClientCreationEvent& event) { - return fmt::format("Add client \"{}\"", event.id); + return fmt::format( + "Add client \"{}\" (\"{}\")", event.id, event.info.label); } std::string operator()(const ClientDestructionEvent& event) @@ -44,9 +45,48 @@ struct EventPrinter return fmt::format("Remove client \"{}\"", event.id); } + std::string operator()(const PortType port_type) + { + switch (port_type) { + case PortType::jack_audio: + return "JACK audio"; + case PortType::jack_midi: + return "JACK MIDI"; + case PortType::alsa_midi: + return "ALSA MIDI"; + case PortType::jack_osc: + return "JACK OSC"; + case PortType::jack_cv: + return "JACK CV"; + } + } + + std::string operator()(const SignalDirection direction) + { + switch (direction) { + case SignalDirection::input: + return "input"; + case SignalDirection::output: + return "output"; + case SignalDirection::duplex: + return "duplex"; + } + } + std::string operator()(const PortCreationEvent& event) { - return fmt::format("Add port \"{}\"", event.id); + auto result = fmt::format("Add{} {} {} port \"{}\" (\"{}\")", + event.info.is_terminal ? " terminal" : "", + (*this)(event.info.type), + (*this)(event.info.direction), + event.id, + event.info.label); + + if (event.info.order.has_value()) { + result += fmt::format(" order: {}", *event.info.order); + } + + return result; } std::string operator()(const PortDestructionEvent& event) |