Skip to content

Commit

Permalink
[ump] Avoid warnings by defining message types inline
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Sep 16, 2023
1 parent 56c8cfe commit 7c3d307
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
1 change: 1 addition & 0 deletions include/libremidi/detail/midi_out.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once
#include <libremidi/cmidi2.hpp>
#include <libremidi/detail/midi_api.hpp>
#include <libremidi/output_configuration.hpp>

Expand Down
25 changes: 18 additions & 7 deletions include/libremidi/ump.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once
#include <libremidi/config.hpp>
#include <libremidi/cmidi2.hpp>

#include <span>

Expand Down Expand Up @@ -35,16 +34,28 @@ struct ump

constexpr std::size_t size() const noexcept
{
// Imported from cmidi2
enum midi2_message_type
{
// MIDI 2.0 UMP Section 3.
UTILITY = 0,
SYSTEM = 1,
MIDI_1_CHANNEL = 2,
SYSEX7 = 3,
MIDI_2_CHANNEL = 4,
SYSEX8_MDS = 5,
};

switch (((bytes[0] & 0xF0000000) >> 28) & 0xF)
{
case CMIDI2_MESSAGE_TYPE_UTILITY:
case CMIDI2_MESSAGE_TYPE_SYSTEM:
case CMIDI2_MESSAGE_TYPE_MIDI_1_CHANNEL:
case UTILITY:
case SYSTEM:
case MIDI_1_CHANNEL:
return 1;
case CMIDI2_MESSAGE_TYPE_MIDI_2_CHANNEL:
case CMIDI2_MESSAGE_TYPE_SYSEX7:
case MIDI_2_CHANNEL:
case SYSEX7:
return 2;
case CMIDI2_MESSAGE_TYPE_SYSEX8_MDS:
case SYSEX8_MDS:
return 4;
default:
return 0;
Expand Down

0 comments on commit 7c3d307

Please sign in to comment.