aboutsummaryrefslogtreecommitdiffstats
path: root/daemon/src/message.h
blob: 4668e0cea9b1a245dc8a800c9a467c499608c8cf (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
#pragma once

#include "types.h"

#include <string>
#include <cstdint>
#include <array>

namespace midi_router
{

struct Message
{
    Device_Id const * source_id;
    std::array<std::uint8_t, 3> bytes;

    Message_Type
    type() const
    {
        if (bytes[0] & 0xF0 == 0xF0) return static_cast<Message_Type>(bytes[0]);
        else return static_cast<Message_Type>(bytes[0] >> 4);
    }
};

} // namespace midi_router