Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace all hardcoded "midi::" namespace by "MIDI_NAMESPACE::" #321

Open
wants to merge 1 commit into
base: feat/v5.1.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Migration has been made as easy as possible: only the declaration of the MIDI ob
#include <midi_UsbTransport.h>

static const unsigned sUsbTransportBufferSize = 16;
typedef midi::UsbTransport<sUsbTransportBufferSize> UsbTransport;
typedef MIDI_NAMESPACE::UsbTransport<sUsbTransportBufferSize> UsbTransport;

UsbTransport sUsbTransport;

Expand Down
4 changes: 2 additions & 2 deletions doc/sysex-codec.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ static const byte myData[12] = {
};

byte encoded[16];
const unsigned encodedSize = midi::encodeSysEx(myData, encoded, 12);
const unsigned encodedSize = MIDI_NAMESPACE::encodeSysEx(myData, encoded, 12);
// Encoded hex dump: 07 4a 7e 3a 3e 3a 2d 70 07 0d 7a 4a 5e 42

byte decoded[12];
const unsigned decoded = midi::decodeSysEx(encoded, decoded, encodedSize);
const unsigned decoded = MIDI_NAMESPACE::decodeSysEx(encoded, decoded, encodedSize);
```

## Special case for Korg devices
Expand Down
2 changes: 1 addition & 1 deletion examples/Input/Input.ino
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void loop()
{
switch(MIDI.getType()) // Get the type of the message we caught
{
case midi::ProgramChange: // If it is a Program Change,
case MIDI_NAMESPACE::ProgramChange: // If it is a Program Change,
BlinkLed(MIDI.getData1()); // blink the LED a number of times
// correponding to the program number
// (0 to 127, it can last a while..)
Expand Down
24 changes: 12 additions & 12 deletions examples/RPN_NRPN/RPN_NRPN.ino
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ public:
}
break;

case midi::DataIncrement:
case MIDI_NAMESPACE::DataIncrement:
if (mSelected)
{
Value& currentValue = getCurrentValue();
currentValue += inValue;
return true;
}
break;
case midi::DataDecrement:
case MIDI_NAMESPACE::DataDecrement:
if (mSelected)
{
Value& currentValue = getCurrentValue();
Expand All @@ -68,7 +68,7 @@ public:
}
break;

case midi::DataEntryMSB:
case MIDI_NAMESPACE::DataEntryMSB:
if (mSelected)
{
Value& currentValue = getCurrentValue();
Expand All @@ -77,7 +77,7 @@ public:
return true;
}
break;
case midi::DataEntryLSB:
case MIDI_NAMESPACE::DataEntryLSB:
if (mSelected)
{
Value& currentValue = getCurrentValue();
Expand Down Expand Up @@ -113,8 +113,8 @@ public:

typedef State<2> RpnState; // We'll listen to 2 RPN
typedef State<4> NrpnState; // and 4 NRPN
typedef ParameterNumberParser<RpnState, midi::RPNMSB, midi::RPNLSB> RpnParser;
typedef ParameterNumberParser<NrpnState, midi::NRPNMSB, midi::NRPNLSB> NrpnParser;
typedef ParameterNumberParser<RpnState, MIDI_NAMESPACE::RPNMSB, MIDI_NAMESPACE::RPNLSB> RpnParser;
typedef ParameterNumberParser<NrpnState, MIDI_NAMESPACE::NRPNMSB, MIDI_NAMESPACE::NRPNLSB> NrpnParser;

struct ChannelSetup
{
Expand All @@ -131,8 +131,8 @@ struct ChannelSetup
}
inline void setup()
{
mRpnState.enable(midi::RPN::PitchBendSensitivity);
mRpnState.enable(midi::RPN::ModulationDepthRange);
mRpnState.enable(MIDI_NAMESPACE::RPN::PitchBendSensitivity);
mRpnState.enable(MIDI_NAMESPACE::RPN::ModulationDepthRange);

// Enable a few random NRPNs
mNrpnState.enable(12);
Expand Down Expand Up @@ -160,13 +160,13 @@ void handleControlChange(byte inChannel, byte inNumber, byte inValue)
const Value& value = channel.mRpnParser.getCurrentValue();
const unsigned number = channel.mRpnParser.mCurrentNumber.as14bits();

if (number == midi::RPN::PitchBendSensitivity)
if (number == MIDI_NAMESPACE::RPN::PitchBendSensitivity)
{
// Here, we use the LSB and MSB separately as they have different meaning.
const byte semitones = value.mMsb;
const byte cents = value.mLsb;
}
else if (number == midi::RPN::ModulationDepthRange)
else if (number == MIDI_NAMESPACE::RPN::ModulationDepthRange)
{
// But here, we want the full 14 bit value.
const unsigned range = value.as14bits();
Expand Down Expand Up @@ -198,10 +198,10 @@ void loop()

// Send a RPN sequence (Pitch Bend sensitivity) on channel 1
{
const midi::Channel channel = 1;
const MIDI_NAMESPACE::Channel channel = 1;
const byte semitones = 12;
const byte cents = 42;
MIDI.beginRpn(midi::RPN::PitchBendSensitivity, channel);
MIDI.beginRpn(MIDI_NAMESPACE::RPN::PitchBendSensitivity, channel);
MIDI.sendRpnValue(semitones, cents, channel);
MIDI.endRpn(channel);
}
Expand Down
2 changes: 1 addition & 1 deletion src/midi_Message.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ struct Message
, valid(inOther.valid)
, length(inOther.length)
{
if (type == midi::SystemExclusive)
if (type == MIDI_NAMESPACE::SystemExclusive)
{
memcpy(sysexArray, inOther.sysexArray, sSysExMaxSize * sizeof(DataByte));
}
Expand Down
Loading