mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
Midi1ToMidi2DefaultTranslator: Use std::byte in implementation
This commit is contained in:
parent
dd3d555bb9
commit
2dd69dd0ad
2 changed files with 12 additions and 12 deletions
|
|
@ -98,11 +98,11 @@ bool Midi1ToMidi2DefaultTranslator::processControlChange (const HelperValues hel
|
|||
|
||||
const auto value = uint16_t ((uint16_t (msb & std::byte { 0x7f }) << 7) | uint16_t (lsb & std::byte { 0x7f }));
|
||||
|
||||
const auto newStatus = (uint8_t) (accumulator.getKind() == PnKind::nrpn ? 0x3 : 0x2);
|
||||
const auto newStatus = accumulator.getKind() == PnKind::nrpn ? std::byte { 0x3 } : std::byte { 0x2 };
|
||||
|
||||
packet = PacketX2
|
||||
{
|
||||
Utils::bytesToWord (helpers.typeAndGroup, std::byte ((newStatus << 0x4) | channel), bank, index),
|
||||
Utils::bytesToWord (helpers.typeAndGroup, std::byte ((newStatus << 0x4) | std::byte { channel }), bank, index),
|
||||
Conversion::scaleTo32 (value)
|
||||
};
|
||||
return true;
|
||||
|
|
@ -113,13 +113,13 @@ bool Midi1ToMidi2DefaultTranslator::processControlChange (const HelperValues hel
|
|||
|
||||
if (cc == 0)
|
||||
{
|
||||
groupBanks[group][channel].setMsb (uint8_t (byte));
|
||||
groupBanks[group][channel].setMsb (byte);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (cc == 32)
|
||||
{
|
||||
groupBanks[group][channel].setLsb (uint8_t (byte));
|
||||
groupBanks[group][channel].setLsb (byte);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public:
|
|||
|
||||
const HelperValues helperValues
|
||||
{
|
||||
std::byte ((0x4 << 0x4) | Utils::getGroup (firstWord)),
|
||||
std::byte (0x40 | Utils::getGroup (firstWord)),
|
||||
std::byte ((firstWord >> 0x10) & 0xff),
|
||||
std::byte ((firstWord >> 0x08) & 0x7f),
|
||||
std::byte ((firstWord >> 0x00) & 0x7f),
|
||||
|
|
@ -170,21 +170,21 @@ private:
|
|||
class Bank
|
||||
{
|
||||
public:
|
||||
bool isValid() const noexcept { return ! (msb & 0x80); }
|
||||
bool isValid() const noexcept { return (msb & std::byte { 0x80 }) == std::byte { 0 }; }
|
||||
|
||||
uint8_t getMsb() const noexcept { return msb & 0x7f; }
|
||||
uint8_t getLsb() const noexcept { return lsb & 0x7f; }
|
||||
std::byte getMsb() const noexcept { return msb & std::byte (0x7f); }
|
||||
std::byte getLsb() const noexcept { return lsb & std::byte (0x7f); }
|
||||
|
||||
void setMsb (uint8_t i) noexcept { msb = i & 0x7f; }
|
||||
void setLsb (uint8_t i) noexcept { msb &= 0x7f; lsb = i & 0x7f; }
|
||||
void setMsb (std::byte i) noexcept { msb = i & std::byte (0x7f); }
|
||||
void setLsb (std::byte i) noexcept { msb &= std::byte (0x7f); lsb = i & std::byte (0x7f); }
|
||||
|
||||
private:
|
||||
// We use the top bit to indicate whether this bank is valid.
|
||||
// After reading the spec, it's not clear how we should determine whether
|
||||
// there are valid values, so we'll just assume that the bank is valid
|
||||
// once either the lsb or msb have been written.
|
||||
uint8_t msb = 0x80;
|
||||
uint8_t lsb = 0x00;
|
||||
std::byte msb { 0x80 };
|
||||
std::byte lsb { 0x00 };
|
||||
};
|
||||
|
||||
using ChannelAccumulators = std::array<PnAccumulator, 16>;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue