MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / midiMessagePattern

Function midiMessagePattern

Source/Core/CtrlrUtilities.cpp:778–833  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

776}
777
778const MemoryBlock midiMessagePattern(const CtrlrMidiMessageEx &mEx, const Array<CtrlrSysexToken> tokens, const Array <int, CriticalSection> &globalVariables)
779{
780 if (mEx.m.isNoteOff() || mEx.m.isNoteOn())
781 {
782 MemoryBlock bl(mEx.m.getRawData(), mEx.m.getRawDataSize());
783 bl[2] = midiByteMask;
784 return (bl);
785 }
786 else if (mEx.m.isController())
787 {
788 MemoryBlock bl(mEx.m.getRawData(), mEx.m.getRawDataSize());
789 bl[2] = midiByteMask;
790 return (bl);
791 }
792 else if (mEx.m.isChannelPressure())
793 {
794 MemoryBlock bl(mEx.m.getRawData(), mEx.m.getRawDataSize());
795 bl[1] = midiByteMask;
796 return (bl);
797 }
798 else if (mEx.m.isAftertouch())
799 {
800 MemoryBlock bl(mEx.m.getRawData(), mEx.m.getRawDataSize());
801 bl[2] = midiByteMask;
802 return (bl);
803 }
804 else if (mEx.m.isProgramChange())
805 {
806 MemoryBlock bl(mEx.m.getRawData(), mEx.m.getRawDataSize());
807 bl[1] = midiByteMask;
808 return (bl);
809 }
810 else if (mEx.m.isSysEx())
811 {
812 MemoryBlock bl(mEx.m.getRawData(), mEx.m.getRawDataSize());
813
814 for (int i = 0; i<tokens.size(); i++)
815 {
816 if (tokens[i].getType() == GlobalVariable)
817 {
818 if (globalVariables[tokens[i].getAdditionalData()] >= 0)
819 bl[i] = (uint8)globalVariables[tokens[i].getAdditionalData()];
820 }
821 else if (tokens[i].getType() != NoToken
822 || tokens[i].getType() == Ignore
823 || tokens[i].getType() == ChecksumRolandJP8080
824 || tokens[i].getType() == ChecksumWaldorfRackAttack)
825 {
826 bl[i] = midiByteMask;
827 }
828 }
829
830 return (bl);
831 }
832 return (MemoryBlock());
833}
834
835bool compareMemory(const MemoryBlock &haystack, const MemoryBlock &needle)

Callers 1

patternChangedMethod · 0.85

Calls 12

isNoteOffMethod · 0.80
isControllerMethod · 0.80
isChannelPressureMethod · 0.80
isAftertouchMethod · 0.80
isProgramChangeMethod · 0.80
isSysExMethod · 0.80
getAdditionalDataMethod · 0.80
MemoryBlockClass · 0.50
isNoteOnMethod · 0.45
getRawDataMethod · 0.45
sizeMethod · 0.45
getTypeMethod · 0.45

Tested by

no test coverage detected