MCPcopy Create free account
hub / github.com/celtera/libremidi / open

Method open

examples/midi2_interop.cpp:42–73  ·  view source on GitHub ↗

1. Create the connection

Source from the content-addressed store, hash-verified

40
41 // 1. Create the connection
42 void open()
43 {
44 // Opening midi input and output
45 {
46 auto pi = obs.get_input_ports();
47 if (pi.empty())
48 {
49 throw "No MIDI 2 input device found\n";
50 }
51
52 for (const auto& port : pi)
53 {
54 std::cout << "In: " << port.port_name << " | " << port.display_name << std::endl;
55 }
56
57 midiin.open_port(pi[1]);
58 }
59
60 {
61 auto po = obs.get_output_ports();
62 if (po.empty())
63 {
64 throw "No MIDI 2 output device found\n";
65 }
66
67 for (const auto& port : po)
68 {
69 std::cout << "Out: " << port.port_name << " | " << port.display_name << std::endl;
70 }
71 midiout.open_port(po[1]);
72 }
73 }
74
75 // 2. Top-level UMP processing
76 void on_ump(const midi::universal_packet& pkt)

Callers 10

mainFunction · 0.80
init_clientMethod · 0.80
shared_handler.hppFile · 0.80
midi_outMethod · 0.80
midi_inMethod · 0.80
snd_ctl_wrapperMethod · 0.80
connect_portFunction · 0.80
midi_in.hppFile · 0.80
connect_portFunction · 0.80
midi_in.hppFile · 0.80

Calls 4

get_input_portsMethod · 0.45
emptyMethod · 0.45
open_portMethod · 0.45
get_output_portsMethod · 0.45

Tested by

no test coverage detected