lmms
Cross-platform music production software
Loading...
Searching...
No Matches
MidiPatch.h
Go to the documentation of this file.
1/*
2 * MidiPatch.h
3 *
4 * Copyright (c) 2026 Dalton Messmer <messmer.dalton/at/gmail.com>
5 *
6 * This file is part of LMMS - https://lmms.io
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program (see COPYING); if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301 USA.
22 *
23 */
24
25#ifndef LMMS_MIDI_PATCH_H
26#define LMMS_MIDI_PATCH_H
27
28#include <cstdint>
29
30namespace lmms
31{
32
34{
36 std::uint16_t bank = 0;
37
39 std::uint8_t program = 0;
40
41 constexpr auto bankMSB() const noexcept -> std::uint8_t { return (bank >> 7) & 0x7F; }
42 constexpr auto bankLSB() const noexcept -> std::uint8_t { return bank & 0x7F; }
43
44 constexpr void setBankMSB(std::uint8_t value) noexcept
45 {
46 bank = ((static_cast<std::uint16_t>(value) & 0x7F) << 7) | (bank & 0x7F);
47 }
48
49 constexpr void setBankLSB(std::uint8_t value) noexcept
50 {
51 bank = (bank & 0x3F80) | (value & 0x7F);
52 }
53};
54
55} // namespace lmms
56
57#endif // LMMS_MIDI_PATCH_H
Definition RemotePluginBase.cpp:34
Definition MidiPatch.h:34
std::uint8_t program
7-bit program
Definition MidiPatch.h:39
constexpr void setBankLSB(std::uint8_t value) noexcept
Definition MidiPatch.h:49
constexpr void setBankMSB(std::uint8_t value) noexcept
Definition MidiPatch.h:44
constexpr auto bankLSB() const noexcept -> std::uint8_t
Definition MidiPatch.h:42
std::uint16_t bank
14-bit bank
Definition MidiPatch.h:36
constexpr auto bankMSB() const noexcept -> std::uint8_t
Definition MidiPatch.h:41