Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
midi.h File Reference

MIDI utils. More...

#include <cassert>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <limits>
#include <optional>
#include <span>
#include <string>
Include dependency graph for midi.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  zrythm::utils
 String utilities.

Typedefs

using midi_byte_t = std::uint8_t
 MIDI byte.

Functions

constexpr size_t zrythm::utils::midi::midi_max_sysex_size ()
std::string_view zrythm::utils::midi::midi_get_controller_name (midi_byte_t cc)
 Return the name of the given cc (0-127).
void zrythm::utils::midi::midi_get_bytes_from_combined (uint32_t val, midi_byte_t *lsb, midi_byte_t *msb)
 Used for MIDI controls whose values are split between MSB/LSB.
std::optional< std::string > zrythm::utils::midi::midi_ctrl_change_get_description (std::span< const midi_byte_t > ctrl_change)
 Returns a string representation of the given control change event, if control change.
std::optional< int > zrythm::utils::midi::midi_ctrl_change_get_channel (std::span< const midi_byte_t > ctrl_change)
 Returns the MIDI channel of the given control change event, if control change.
int zrythm::utils::midi::midi_get_msg_length (const uint8_t status_byte)
 Returns the length of the MIDI message based on the status byte.
std::string_view zrythm::utils::midi::midi_get_note_name (midi_byte_t note)
 Returns the note name (eg, "C") for a value between 0 and 127.
std::string zrythm::utils::midi::midi_get_note_name_with_octave (std::span< const midi_byte_t > short_msg)
std::string zrythm::utils::midi::midi_get_hex_str (std::span< const midi_byte_t > msg)
std::string zrythm::utils::midi::midi_print_to_str (std::span< const midi_byte_t > msg)
void zrythm::utils::midi::midi_print (std::span< const midi_byte_t > msg)
std::string zrythm::utils::midi::midi_get_meta_event_type_name (midi_byte_t type)

Detailed Description

MIDI utils.

Definition in file midi.h.

Typedef Documentation

◆ midi_byte_t

using midi_byte_t = std::uint8_t

MIDI byte.

Definition at line 43 of file midi.h.

Function Documentation

◆ midi_ctrl_change_get_channel()

std::optional< int > zrythm::utils::midi::midi_ctrl_change_get_channel ( std::span< const midi_byte_t > ctrl_change)

Returns the MIDI channel of the given control change event, if control change.

Parameters
ctrl_change
Returns
int

◆ midi_get_bytes_from_combined()

void zrythm::utils::midi::midi_get_bytes_from_combined ( uint32_t val,
midi_byte_t * lsb,
midi_byte_t * msb )

Used for MIDI controls whose values are split between MSB/LSB.

Parameters
lsbFirst byte (pos 1).
msbSecond byte (pos 2).

◆ midi_max_sysex_size()

size_t zrythm::utils::midi::midi_max_sysex_size ( )
constexpr

Definition at line 68 of file midi.h.