Skip to content

Commit

Permalink
Run uncrustify.
Browse files Browse the repository at this point in the history
  • Loading branch information
SolfaMode committed Sep 23, 2024
1 parent d722864 commit 9e077d6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,20 +169,20 @@ void FluidSynth::allNotesOff()
// - We could send all events at once.
// Does i directly relate to midi channels? -> lastChannelIndex, otherwise use 16.
int upperBound = min(lastChannelIdx, 16);
for (int i = 0; i<upperBound; i++) {
for (int i = 0; i < upperBound; i++) {
muse::midi::Event e(muse::midi::Event::Opcode::ControlChange, muse::midi::Event::MessageType::ChannelVoice20);
e.setChannel(i);
e.setIndex(123); // CC#123 = All notes off
port->sendEvent(e);
}
for (int i = 0; i<upperBound; i++) {
for (int i = 0; i < upperBound; i++) {
muse::midi::Event e(muse::midi::Event::Opcode::ControlChange, muse::midi::Event::MessageType::ChannelVoice20);
e.setChannel(i);
e.setIndex(midi::SUSTAIN_PEDAL_CONTROLLER);
e.setData(0);
port->sendEvent(e);
}
for (int i = 0; i<upperBound; i++) {
for (int i = 0; i < upperBound; i++) {
muse::midi::Event e(muse::midi::Event::Opcode::PitchBend, muse::midi::Event::MessageType::ChannelVoice20);
e.setChannel(i);
e.setData(0x80000000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ void CoreMidiInPort::initCore()
for (UInt32 index = 0; index < packetList->numPackets; index++) {
auto len = packet->length;
int pos = 0;
const Byte * pointer = static_cast<const Byte*>(&(packet->data[0]));
const Byte* pointer = static_cast<const Byte*>(&(packet->data[0]));
while (pos < len) {
Byte status = pointer[pos] >> 4;
if (status < 8 || status >= 15) {
Expand Down
21 changes: 11 additions & 10 deletions src/framework/midi/midievent.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,28 +140,28 @@ struct Event {
return 0;
}

static Event fromMIDI10BytePackage(const unsigned char *pointer, int length)
static Event fromMIDI10BytePackage(const unsigned char* pointer, int length)
{
Event e;
uint32_t val = 0;
assert(length <= 3);
for (int i=0; i<length; i++) {
for (int i=0; i < length; i++) {
uint32_t byteVal = static_cast<uint32_t>(pointer[i]);
val |= byteVal << ((2-i)*8);
val |= byteVal << ((2 - i) * 8);
}
e.m_data[0]=val;
e.setMessageType(MessageType::ChannelVoice10);
return e;
}

int to_MIDI10BytesPackage(unsigned char *pointer) const
int to_MIDI10BytesPackage(unsigned char* pointer) const
{
if (messageType() == MessageType::ChannelVoice10) {
auto val = m_data[0];
int c = Event::midi10ByteCountForOpcode(opcode());
assert(c<=3);
for (int i=0; i<c; i++) {
auto byteVal = (val>>((2-i)*8)) & 0xff;
assert(c <= 3);
for (int i=0; i < c; i++) {
auto byteVal = (val >> ((2 - i) * 8)) & 0xff;
pointer[i]=static_cast<unsigned char>(byteVal);
}
return c;
Expand Down Expand Up @@ -1017,7 +1017,8 @@ struct Event {
return static_cast<uint8_t>(val);
}

void setVelocity7(uint8_t value) {
void setVelocity7(uint8_t value)
{
if (isChannelVoice20()) {
uint16_t scaled = scaleUp(value, 7, 16);
setVelocity(scaled);
Expand All @@ -1030,7 +1031,7 @@ struct Event {
{
uint32_t val = data();
if (messageType() == MessageType::ChannelVoice20) {
return scaleDown(val,32,7);
return scaleDown(val, 32, 7);
}
return val;
}
Expand All @@ -1039,7 +1040,7 @@ struct Event {
{
uint32_t val = data();
if (messageType() == MessageType::ChannelVoice20) {
return scaleDown(val,32,14);
return scaleDown(val, 32, 14);
}
return val;
}
Expand Down

0 comments on commit 9e077d6

Please sign in to comment.