aboutsummaryrefslogtreecommitdiffstats
path: root/daemon/src/device_connection.h
diff options
context:
space:
mode:
Diffstat (limited to 'daemon/src/device_connection.h')
-rw-r--r--daemon/src/device_connection.h32
1 files changed, 3 insertions, 29 deletions
diff --git a/daemon/src/device_connection.h b/daemon/src/device_connection.h
index 17e354d..a2af8cc 100644
--- a/daemon/src/device_connection.h
+++ b/daemon/src/device_connection.h
@@ -41,39 +41,13 @@ struct Device_Connection : public Sender
}
void
- open()
- {
- if (!open_port(midi_in, device_name))
- {
- std::cerr << "Input port not found for device " << device_name << "\n";
- }
-
- if (!open_port(midi_out, device_name))
- {
- std::cerr << "Output port not found for device " << device_name << "\n";
- }
- }
-
- void
- close()
+ reconnect(std::size_t port)
{
midi_in.closePort();
midi_out.closePort();
- }
-private:
- bool
- open_port(RtMidi & midi, std::string const & name)
- {
- for (std::size_t i = 0; i < midi.getPortCount(); ++i)
- {
- if (midi.getPortName(i).contains(name))
- {
- midi.openPort(i);
- return true;
- }
- }
- return false;
+ midi_in.openPort(port);
+ midi_out.openPort(port);
}
};