Zephyr Project API 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
MIDI2 Universal MIDI Packet definitions

Universal MIDI Packet definitions. More...

Modules

 MIDI commands
 
 Message types
 
 System common and System Real Time message status
 

Data Structures

struct  midi_ump
 Universal MIDI Packet container. More...
 

Macros

#define UMP_MT(ump)    ((ump).data[0] >> 28)
 Message Type field of a Universal MIDI Packet.
 
#define UMP_NUM_WORDS_LOOKUP_TABLE
 There are 16 UMP message types, each of which can be 1 to 4 uint32 long.
 
#define UMP_NUM_WORDS(ump)    (1 + ((UMP_NUM_WORDS_LOOKUP_TABLE >> (2 * UMP_MT(ump))) & 3))
 Size of a Universal MIDI Packet, in 32bit words.
 
#define UMP_GROUP(ump)    (((ump).data[0] >> 24) & 0x0f)
 MIDI group field of a Universal MIDI Packet.
 
#define UMP_MIDI_STATUS(ump)    (((ump).data[0] >> 16) & 0xff)
 Status byte of a MIDI channel voice or system message.
 
#define UMP_MIDI_COMMAND(ump)    (UMP_MIDI_STATUS(ump) >> 4)
 Command of a MIDI channel voice message.
 
#define UMP_MIDI_CHANNEL(ump)    (UMP_MIDI_STATUS(ump) & 0x0f)
 Channel of a MIDI channel voice message.
 
#define UMP_MIDI1_P1(ump)    (((ump).data[0] >> 8) & 0x7f)
 First parameter of a MIDI1 channel voice or system message.
 
#define UMP_MIDI1_P2(ump)    ((ump).data[0] & 0x7f)
 Second parameter of a MIDI1 channel voice or system message.
 
#define UMP_MIDI1_CHANNEL_VOICE(group, command, channel, p1, p2)
 Initialize a UMP with a MIDI1 channel voice message.
 
#define UMP_SYS_RT_COMMON(group, status, p1, p2)
 Initialize a UMP with a System Real Time and System Common Message.
 

Detailed Description

Universal MIDI Packet definitions.

Since
4.1
Version
0.1.0
See also
ump112: "Universal MIDI Packet (UMP) Format and MIDI 2.0 Protocol" Document version 1.1.2

Macro Definition Documentation

◆ UMP_GROUP

#define UMP_GROUP (   ump)     (((ump).data[0] >> 24) & 0x0f)

#include <include/zephyr/audio/midi.h>

MIDI group field of a Universal MIDI Packet.

Parameters
[in]umpUniversal MIDI Packet

◆ UMP_MIDI1_CHANNEL_VOICE

#define UMP_MIDI1_CHANNEL_VOICE (   group,
  command,
  channel,
  p1,
  p2 
)

#include <include/zephyr/audio/midi.h>

Value:
(struct midi_ump) {.data = { \
| (((group) & 0x0f) << 24) \
| (((command) & 0x0f) << 20) \
| (((channel) & 0x0f) << 16) \
| (((p1) & 0x7f) << 8) \
| ((p2) & 0x7f) \
}}
#define UMP_MT_MIDI1_CHANNEL_VOICE
MIDI 1.0 Channel Voice Messages.
Definition midi.h:46
Group structure.
Definition grp.h:18
Universal MIDI Packet container.
Definition midi.h:30

Initialize a UMP with a MIDI1 channel voice message.

Remarks
For messages that take a single parameter, p2 is ignored by the receiver.
Parameters
groupThe UMP group
commandThe MIDI1 command
channelThe MIDI1 channel number
p1The 1st MIDI1 parameter
p2The 2nd MIDI1 parameter

◆ UMP_MIDI1_P1

#define UMP_MIDI1_P1 (   ump)     (((ump).data[0] >> 8) & 0x7f)

#include <include/zephyr/audio/midi.h>

First parameter of a MIDI1 channel voice or system message.

Parameters
[in]umpUniversal MIDI Packet (containing a MIDI1 message)

◆ UMP_MIDI1_P2

#define UMP_MIDI1_P2 (   ump)     ((ump).data[0] & 0x7f)

#include <include/zephyr/audio/midi.h>

Second parameter of a MIDI1 channel voice or system message.

Parameters
[in]umpUniversal MIDI Packet (containing a MIDI1 message)

◆ UMP_MIDI_CHANNEL

#define UMP_MIDI_CHANNEL (   ump)     (UMP_MIDI_STATUS(ump) & 0x0f)

#include <include/zephyr/audio/midi.h>

Channel of a MIDI channel voice message.

Parameters
[in]umpUniversal MIDI Packet (containing a MIDI event)

◆ UMP_MIDI_COMMAND

#define UMP_MIDI_COMMAND (   ump)     (UMP_MIDI_STATUS(ump) >> 4)

#include <include/zephyr/audio/midi.h>

Command of a MIDI channel voice message.

Parameters
[in]umpUniversal MIDI Packet (containing a MIDI event)
See also
MIDI commands

◆ UMP_MIDI_STATUS

#define UMP_MIDI_STATUS (   ump)     (((ump).data[0] >> 16) & 0xff)

#include <include/zephyr/audio/midi.h>

Status byte of a MIDI channel voice or system message.

Parameters
[in]umpUniversal MIDI Packet (containing a MIDI1 event)

◆ UMP_MT

#define UMP_MT (   ump)     ((ump).data[0] >> 28)

#include <include/zephyr/audio/midi.h>

Message Type field of a Universal MIDI Packet.

Parameters
[in]umpUniversal MIDI Packet

◆ UMP_NUM_WORDS

#define UMP_NUM_WORDS (   ump)     (1 + ((UMP_NUM_WORDS_LOOKUP_TABLE >> (2 * UMP_MT(ump))) & 3))

#include <include/zephyr/audio/midi.h>

Size of a Universal MIDI Packet, in 32bit words.

Parameters
[in]umpUniversal MIDI Packet
See also
ump112: 2.1.4 Message Type (MT) Allocation

◆ UMP_NUM_WORDS_LOOKUP_TABLE

#define UMP_NUM_WORDS_LOOKUP_TABLE

#include <include/zephyr/audio/midi.h>

Value:
((0U << 0) | (0U << 2) | (0U << 4) | (1U << 6) | \
(1U << 8) | (3U << 10) | (0U << 12) | (0U << 14) | \
(1U << 16) | (1U << 18) | (1U << 20) | (2U << 22) | \
(2U << 24) | (3U << 26) | (3U << 28) | (3U << 30))

There are 16 UMP message types, each of which can be 1 to 4 uint32 long.

Hence this packed representation of 16x2b array as an uint32 lookup table

◆ UMP_SYS_RT_COMMON

#define UMP_SYS_RT_COMMON (   group,
  status,
  p1,
  p2 
)

#include <include/zephyr/audio/midi.h>

Value:
(struct midi_ump) {.data = { \
| (((group) & 0x0f) << 24) \
| ((status) << 16) \
| (((p1) & 0x7f) << 8) \
| ((p2) & 0x7f) \
}}
#define UMP_MT_SYS_RT_COMMON
System Real Time and System Common Messages (except System Exclusive)
Definition midi.h:44

Initialize a UMP with a System Real Time and System Common Message.

Remarks
For messages that take only one (or no) parameter, p2 (and p1) are ignored by the receiver.
Parameters
groupThe UMP group
statusThe status byte
p1The 1st parameter
p2The 2nd parameter