Skip to content

Commit

Permalink
[midi] Various improvements in particular to naming of ports
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Aug 31, 2024
1 parent c43ce26 commit b7276fa
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion 3rdparty/libremidi
3 changes: 2 additions & 1 deletion src/ossia/protocols/midi/midi_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

namespace ossia::net::midi
{
midi_device::midi_device(std::unique_ptr<protocol_base> prot)
midi_device::midi_device(std::string name, std::unique_ptr<protocol_base> prot)
: ossia::net::device_base{std::move(prot)}
, midi_node{*this}
{
m_name = name;
m_capabilities.change_tree = true;
m_protocol->set_device(*this);
m_parameter = std::make_unique<midi_parameter>(
Expand Down
2 changes: 1 addition & 1 deletion src/ossia/protocols/midi/midi_device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class OSSIA_EXPORT midi_device final
, public midi_node
{
public:
midi_device(std::unique_ptr<ossia::net::protocol_base> prot);
midi_device(std::string name, std::unique_ptr<ossia::net::protocol_base> prot);
~midi_device();

//! Create a default MIDI tree with all the nodes available
Expand Down
9 changes: 4 additions & 5 deletions src/ossia/protocols/midi/midi_protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,15 @@ std::string
midi_protocol::get_midi_port_name(ossia::net::device_base* dev, const midi_info& info)
{
std::string name{};
const bool input = info.type == midi_info::Type::Input;
if(dev)
name = dev->get_name();
name = (input ? "i " : "o ") + dev->get_name();
else
{
if(info.is_virtual)
name = info.type == midi_info::Type::Input ? "libossia MIDI virtual input"
: "libossia MIDI virtual output";
name = input ? "i libossia virtual" : "o libossia virtual";
else
name = info.type == midi_info::Type::Input ? "libossia MIDI input"
: "libossia MIDI output";
name = input ? "i libossia" : "o libossia";
}
return name;
}
Expand Down

0 comments on commit b7276fa

Please sign in to comment.