aboutsummaryrefslogtreecommitdiffstats
path: root/daemon/src/connection_manager.h
blob: e15eaaa7a01e2d6a3af7a3345207556660e919ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once

#include "types.h"
#include "submitter.h"
#include "sender.h"

#include <string>
#include <memory>
#include <map>

class RtMidi;

namespace midi_router
{

struct Device_Connection;

class Connection_Manager
{
public:
    Connection_Manager(Device_Map const & device_map, Submitter & submitter);

    ~Connection_Manager();

    Sender &
    get_sender(Device_Id const & device) const;

private:
    static bool 
    open_port(RtMidi* const midi, std::string const & name);

    Device_Map const & m_device_map;
    Submitter & m_submitter;
    std::map<Device_Id, std::unique_ptr<Device_Connection>> m_connections;
};

} // namespace midi_router