JUCE
Loading...
Searching...
No Matches
universal_midi_packets::Conversion Struct Reference

Functions to assist conversion of UMP messages to/from other formats, especially older 'bytestream' formatted MidiMessages. More...

#include <juce_UMPConversion.h>

Static Public Member Functions

template<typename PacketCallbackFunction >
static void toMidi1 (const MidiMessage &m, PacketCallbackFunction &&callback)
 Converts from a MIDI 1 bytestream to MIDI 1 on Universal MIDI Packets.
 
static void toMidi1 (const MidiMessage &m, Packets &packets)
 Converts a MidiMessage to one or more messages in UMP format, using the MIDI 1.0 Protocol.
 
static uint8_t scaleTo8 (uint8_t word7Bit)
 Widens a 7-bit MIDI 1.0 value to a 8-bit MIDI 2.0 value.
 
static uint16_t scaleTo16 (uint8_t word7Bit)
 Widens a 7-bit MIDI 1.0 value to a 16-bit MIDI 2.0 value.
 
static uint16_t scaleTo16 (uint16_t word14Bit)
 Widens a 14-bit MIDI 1.0 value to a 16-bit MIDI 2.0 value.
 
static uint32_t scaleTo32 (uint8_t word7Bit)
 Widens a 7-bit MIDI 1.0 value to a 32-bit MIDI 2.0 value.
 
static uint32_t scaleTo32 (uint16_t word14Bit)
 Widens a 14-bit MIDI 1.0 value to a 32-bit MIDI 2.0 value.
 
static uint8_t scaleTo7 (uint8_t word8Bit)
 Narrows a 16-bit MIDI 2.0 value to a 7-bit MIDI 1.0 value.
 
static uint8_t scaleTo7 (uint16_t word16Bit)
 Narrows a 16-bit MIDI 2.0 value to a 7-bit MIDI 1.0 value.
 
static uint8_t scaleTo7 (uint32_t word32Bit)
 Narrows a 32-bit MIDI 2.0 value to a 7-bit MIDI 1.0 value.
 
static uint16_t scaleTo14 (uint16_t word16Bit)
 Narrows a 32-bit MIDI 2.0 value to a 14-bit MIDI 1.0 value.
 
static uint16_t scaleTo14 (uint32_t word32Bit)
 Narrows a 32-bit MIDI 2.0 value to a 14-bit MIDI 1.0 value.
 
template<typename Callback >
static void midi2ToMidi1DefaultTranslation (const View &v, Callback &&callback)
 Converts UMP messages which may include MIDI 2.0 channel voice messages into equivalent MIDI 1.0 messages (still in UMP format).
 

Detailed Description

Functions to assist conversion of UMP messages to/from other formats, especially older 'bytestream' formatted MidiMessages.

Member Function Documentation

◆ toMidi1() [1/2]

◆ toMidi1() [2/2]

static void universal_midi_packets::Conversion::toMidi1 ( const MidiMessage & m,
Packets & packets )
static

Converts a MidiMessage to one or more messages in UMP format, using the MIDI 1.0 Protocol.

packets is an out-param to allow the caller to control allocation/deallocation. Returning a new Packets object would require every call to toMidi1 to allocate. With this version, no allocations will occur, provided that packets has adequate reserved space.

References universal_midi_packets::Packets::add(), and toMidi1().

◆ scaleTo8()

static uint8_t universal_midi_packets::Conversion::scaleTo8 ( uint8_t word7Bit)
static

Widens a 7-bit MIDI 1.0 value to a 8-bit MIDI 2.0 value.

◆ scaleTo16() [1/2]

static uint16_t universal_midi_packets::Conversion::scaleTo16 ( uint8_t word7Bit)
static

Widens a 7-bit MIDI 1.0 value to a 16-bit MIDI 2.0 value.

◆ scaleTo16() [2/2]

static uint16_t universal_midi_packets::Conversion::scaleTo16 ( uint16_t word14Bit)
static

Widens a 14-bit MIDI 1.0 value to a 16-bit MIDI 2.0 value.

◆ scaleTo32() [1/2]

static uint32_t universal_midi_packets::Conversion::scaleTo32 ( uint8_t word7Bit)
static

Widens a 7-bit MIDI 1.0 value to a 32-bit MIDI 2.0 value.

◆ scaleTo32() [2/2]

static uint32_t universal_midi_packets::Conversion::scaleTo32 ( uint16_t word14Bit)
static

Widens a 14-bit MIDI 1.0 value to a 32-bit MIDI 2.0 value.

◆ scaleTo7() [1/3]

static uint8_t universal_midi_packets::Conversion::scaleTo7 ( uint8_t word8Bit)
static

Narrows a 16-bit MIDI 2.0 value to a 7-bit MIDI 1.0 value.

Referenced by midi2ToMidi1DefaultTranslation().

◆ scaleTo7() [2/3]

static uint8_t universal_midi_packets::Conversion::scaleTo7 ( uint16_t word16Bit)
static

Narrows a 16-bit MIDI 2.0 value to a 7-bit MIDI 1.0 value.

◆ scaleTo7() [3/3]

static uint8_t universal_midi_packets::Conversion::scaleTo7 ( uint32_t word32Bit)
static

Narrows a 32-bit MIDI 2.0 value to a 7-bit MIDI 1.0 value.

◆ scaleTo14() [1/2]

static uint16_t universal_midi_packets::Conversion::scaleTo14 ( uint16_t word16Bit)
static

Narrows a 32-bit MIDI 2.0 value to a 14-bit MIDI 1.0 value.

Referenced by midi2ToMidi1DefaultTranslation().

◆ scaleTo14() [2/2]

static uint16_t universal_midi_packets::Conversion::scaleTo14 ( uint32_t word32Bit)
static

Narrows a 32-bit MIDI 2.0 value to a 14-bit MIDI 1.0 value.

◆ midi2ToMidi1DefaultTranslation()

template<typename Callback >
static void universal_midi_packets::Conversion::midi2ToMidi1DefaultTranslation ( const View & v,
Callback && callback )
static

Converts UMP messages which may include MIDI 2.0 channel voice messages into equivalent MIDI 1.0 messages (still in UMP format).

callback is a function that accepts a single View argument and will be called with each converted packet.

Note that not all MIDI 2.0 messages have MIDI 1.0 equivalents, so such messages will be ignored.

References universal_midi_packets::Utils::bytesToWord(), universal_midi_packets::Utils::getChannel(), universal_midi_packets::Utils::getGroup(), universal_midi_packets::Utils::getMessageType(), universal_midi_packets::Utils::getStatus(), scaleTo14(), and scaleTo7().

Referenced by universal_midi_packets::ToBytestreamConverter::convert(), and universal_midi_packets::ToUMP1Converter::convert().


The documentation for this struct was generated from the following file: