📄 readmidi.c
字号:
SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_LSB, p, *body, 0x58); num_events++; break; case 0x41: /* scale tuning */ case 0x42: case 0x43: case 0x44: case 0x45: case 0x46: case 0x47: case 0x48: case 0x49: case 0x4a: case 0x4b: case 0x4c: SETMIDIEVENT(evm[num_events], 0, ME_SCALE_TUNING, p, ent - 0x41, *body - 64); num_events++; ctl->cmsg(CMSG_INFO, VERB_NOISY, "Scale Tuning %s (CH:%d %d cent)", note_name[ent - 0x41], p, *body - 64); break; case 0x4D: /* CAT Pitch Control */ SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_LSB, p, *body, 0x00); num_events++; break; case 0x4E: /* CAT Filter Control */ SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_LSB, p, *body, 0x01); num_events++; break; case 0x4F: /* CAT Amplitude Control */ SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_LSB, p, *body, 0x02); num_events++; break; case 0x50: /* CAT LFO PMod Depth */ SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_LSB, p, *body, 0x04); num_events++; break; case 0x51: /* CAT LFO FMod Depth */ SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_LSB, p, *body, 0x05); num_events++; break; case 0x52: /* CAT LFO AMod Depth */ SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_LSB, p, *body, 0x06); num_events++; break; case 0x53: /* PAT Pitch Control */ SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_LSB, p, *body, 0x0B); num_events++; break; case 0x54: /* PAT Filter Control */ SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_LSB, p, *body, 0x0C); num_events++; break; case 0x55: /* PAT Amplitude Control */ SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_LSB, p, *body, 0x0D); num_events++; break; case 0x56: /* PAT LFO PMod Depth */ SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_LSB, p, *body, 0x0F); num_events++; break; case 0x57: /* PAT LFO FMod Depth */ SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_LSB, p, *body, 0x10); num_events++; break; case 0x58: /* PAT LFO AMod Depth */ SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_LSB, p, *body, 0x11); num_events++; break; case 0x59: /* AC1 Controller Number */ ctl->cmsg(CMSG_INFO, VERB_NOISY, "AC1 Controller Number is not supported. (CH:%d VAL:%d)", p, *body); break; case 0x5A: /* AC1 Pitch Control */ SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_LSB, p, *body, 0x2C); num_events++; break; case 0x5B: /* AC1 Filter Control */ SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_LSB, p, *body, 0x2D); num_events++; break; case 0x5C: /* AC1 Amplitude Control */ SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_LSB, p, *body, 0x2E); num_events++; break; case 0x5D: /* AC1 LFO PMod Depth */ SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_LSB, p, *body, 0x30); num_events++; break; case 0x5E: /* AC1 LFO FMod Depth */ SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_LSB, p, *body, 0x31); num_events++; break; case 0x5F: /* AC1 LFO AMod Depth */ SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_LSB, p, *body, 0x32); num_events++; break; case 0x60: /* AC2 Controller Number */ ctl->cmsg(CMSG_INFO, VERB_NOISY, "AC2 Controller Number is not supported. (CH:%d VAL:%d)", p, *body); break; case 0x61: /* AC2 Pitch Control */ SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_LSB, p, *body, 0x37); num_events++; break; case 0x62: /* AC2 Filter Control */ SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_LSB, p, *body, 0x38); num_events++; break; case 0x63: /* AC2 Amplitude Control */ SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_LSB, p, *body, 0x39); num_events++; break; case 0x64: /* AC2 LFO PMod Depth */ SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_LSB, p, *body, 0x3B); num_events++; break; case 0x65: /* AC2 LFO FMod Depth */ SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_LSB, p, *body, 0x3C); num_events++; break; case 0x66: /* AC2 LFO AMod Depth */ SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_LSB, p, *body, 0x3D); num_events++; break; case 0x67: /* Portamento Switch */ SETMIDIEVENT(evm[num_events], 0, ME_PORTAMENTO, p, *body, SYSEX_TAG); num_events++; case 0x68: /* Portamento Time */ SETMIDIEVENT(evm[num_events], 0, ME_PORTAMENTO_TIME_MSB, p, *body, SYSEX_TAG); num_events++; case 0x69: /* Pitch EG Initial Level */ ctl->cmsg(CMSG_INFO, VERB_NOISY, "Pitch EG Initial Level is not supported. (CH:%d VAL:%d)", p, *body); break; case 0x6A: /* Pitch EG Attack Time */ ctl->cmsg(CMSG_INFO, VERB_NOISY, "Pitch EG Attack Time is not supported. (CH:%d VAL:%d)", p, *body); break; case 0x6B: /* Pitch EG Release Level */ ctl->cmsg(CMSG_INFO, VERB_NOISY, "Pitch EG Release Level is not supported. (CH:%d VAL:%d)", p, *body); break; case 0x6C: /* Pitch EG Release Time */ ctl->cmsg(CMSG_INFO, VERB_NOISY, "Pitch EG Release Time is not supported. (CH:%d VAL:%d)", p, *body); break; case 0x6D: /* Velocity Limit Low */ SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_LSB, p, *body, 0x44); num_events++; break; case 0x6E: /* Velocity Limit High */ SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_LSB, p, *body, 0x45); num_events++; break; case 0x70: /* Bend Pitch Low Control */ ctl->cmsg(CMSG_INFO, VERB_NOISY, "Bend Pitch Low Control is not supported. (CH:%d VAL:%d)", p, *body); break; case 0x71: /* Filter EG Depth */ ctl->cmsg(CMSG_INFO, VERB_NOISY, "Filter EG Depth is not supported. (CH:%d VAL:%d)", p, *body); break; case 0x72: /* EQ BASS */ SETMIDIEVENT(evm[num_events], 0,ME_NRPN_MSB, p, 0x01, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 1], 0,ME_NRPN_LSB, p, 0x30, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 2], 0,ME_DATA_ENTRY_MSB, p, *body, SYSEX_TAG); num_events += 3; break; case 0x73: /* EQ TREBLE */ SETMIDIEVENT(evm[num_events], 0,ME_NRPN_MSB, p, 0x01, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 1], 0,ME_NRPN_LSB, p, 0x31, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 2], 0,ME_DATA_ENTRY_MSB, p, *body, SYSEX_TAG); num_events += 3; break; case 0x76: /* EQ BASS frequency */ SETMIDIEVENT(evm[num_events], 0,ME_NRPN_MSB, p, 0x01, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 1], 0,ME_NRPN_LSB, p, 0x34, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 2], 0,ME_DATA_ENTRY_MSB, p, *body, SYSEX_TAG); num_events += 3; break; case 0x77: /* EQ TREBLE frequency */ SETMIDIEVENT(evm[num_events], 0,ME_NRPN_MSB, p, 0x01, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 1], 0,ME_NRPN_LSB, p, 0x35, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 2], 0,ME_DATA_ENTRY_MSB, p, *body, SYSEX_TAG); num_events += 3; break; default: ctl->cmsg(CMSG_INFO,VERB_NOISY,"Unsupported XG Bulk Dump SysEx. (ADDR:%02X %02X %02X VAL:%02X)",addhigh,addlow,ent,*body); continue; break; } } } /* XG Drum Setup */ else if(len >= 10 && val[0] == 0x43 && /* Yamaha ID */ val[2] == 0x4C && /* XG Model ID */ ((val[1] < 0x10 && (val[5] & 0xF0) == 0x30) || /* Bulk Dump*/ (val[1] >= 0x10 && (val[3] & 0xF0) == 0x30))) /* Parameter Change */ { uint8 addhigh, addmid, addlow; /* Addresses */ uint8 *body; /* SysEx body */ uint8 dp, note; /* Channel part number [0..15] */ int ent; /* Entry # of sub-event */ uint8 *body_end; /* End of SysEx body */ if (val[1] < 0x10) /* Bulk Dump */ { addhigh = val[5]; addmid = val[6]; addlow = val[7]; body = val + 8; body_end = val + len - 3; } else /* Parameter Change */ { addhigh = val[3]; addmid = val[4]; addlow = val[5]; body = val + 6; body_end = val + len - 2; } dp = drum_setup_xg[(addhigh & 0x0F) + 1]; note = addmid; /* set the SYSEX_XG_MSB info */ SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_XG_MSB, dp, addhigh, addmid); num_events++; for (ent = addlow; body <= body_end; body++, ent++) { switch(ent) { case 0x00: /* Pitch Coarse */ SETMIDIEVENT(evm[num_events], 0, ME_NRPN_MSB, dp, 0x18, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 1], 0, ME_NRPN_LSB, dp, note, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 2], 0, ME_DATA_ENTRY_MSB, dp, *body, SYSEX_TAG); num_events += 3; break; case 0x01: /* Pitch Fine */ SETMIDIEVENT(evm[num_events], 0, ME_NRPN_MSB, dp, 0x19, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 1], 0, ME_NRPN_LSB, dp, note, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 2], 0, ME_DATA_ENTRY_MSB, dp, *body, SYSEX_TAG); num_events += 3; break; case 0x02: /* Level */ SETMIDIEVENT(evm[num_events], 0, ME_NRPN_MSB, dp, 0x1A, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 1], 0, ME_NRPN_LSB, dp, note, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 2], 0, ME_DATA_ENTRY_MSB, dp, *body, SYSEX_TAG); num_events += 3; break; case 0x03: /* Alternate Group */ ctl->cmsg(CMSG_INFO, VERB_NOISY, "Alternate Group is not supported. (CH:%d NOTE:%d VAL:%d)", dp, note, *body); break; case 0x04: /* Pan */ SETMIDIEVENT(evm[num_events], 0, ME_NRPN_MSB, dp, 0x1C, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 1], 0, ME_NRPN_LSB, dp, note, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 2], 0, ME_DATA_ENTRY_MSB, dp, *body, SYSEX_TAG); num_events += 3; break; case 0x05: /* Reverb Send */ SETMIDIEVENT(evm[num_events], 0, ME_NRPN_MSB, dp, 0x1D, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 1], 0, ME_NRPN_LSB, dp, note, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 2], 0, ME_DATA_ENTRY_MSB, dp, *body, SYSEX_TAG); num_events += 3; break; case 0x06: /* Chorus Send */ SETMIDIEVENT(evm[num_events], 0, ME_NRPN_MSB, dp, 0x1E, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 1], 0, ME_NRPN_LSB, dp, note, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 2], 0, ME_DATA_ENTRY_MSB, dp, *body, SYSEX_TAG); num_events += 3; break; case 0x07: /* Variation Send */ SETMIDIEVENT(evm[num_events], 0, ME_NRPN_MSB, dp, 0x1F, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 1], 0, ME_NRPN_LSB, dp, note, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 2], 0, ME_DATA_ENTRY_MSB, dp, *body, SYSEX_TAG); num_events += 3; break; case 0x08: /* Key Assign */ ctl->cmsg(CMSG_INFO, VERB_NOISY, "Key Assign is not supported. (CH:%d NOTE:%d VAL:%d)", dp, note, *body); break; case 0x09: /* Rcv Note Off */ SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_MSB, dp, note, 0); SETMIDIEVENT(evm[num_events + 1], 0, ME_SYSEX_LSB, dp, *body, 0x46); num_events += 2; break; case 0x0A: /* Rcv Note On */ SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_MSB, dp, note, 0); SETMIDIEVENT(evm[num_events + 1], 0, ME_SYSEX_LSB, dp, *body, 0x47); num_events += 2; break; case 0x0B: /* Filter Cutoff Frequency */ SETMIDIEVENT(evm[num_events], 0, ME_NRPN_MSB, dp, 0x14, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 1], 0, ME_NRPN_LSB, dp, note, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 2], 0, ME_DATA_ENTRY_MSB, dp, *body, SYSEX_TAG); num_events += 3; break; case 0x0C: /* Filter Resonance */ SETMIDIEVENT(evm[num_events], 0, ME_NRPN_MSB, dp, 0x15, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 1], 0, ME_NRPN_LSB, dp, note, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 2], 0, ME_DATA_ENTRY_MSB, dp, *body, SYSEX_TAG); num_events += 3; break; case 0x0D: /* EG Attack */ SETMIDIEVENT(evm[num_events], 0, ME_NRPN_MSB, dp, 0x16, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 1], 0, ME_NRPN_LSB, dp, note, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 2], 0, ME_DATA_ENTRY_MSB, dp, *body, SYSEX_TAG); num_events += 3; break; case 0x0E: /* EG Decay1 */ SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_XG_LSB, dp, *body, ent); num_events++; break; case 0x0F: /* EG Decay2 */ SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_XG_LSB, dp, *body, ent); num_events++; break; case 0x20: /* EQ BASS */ SETMIDIEVENT(evm[num_events], 0, ME_NRPN_MSB, dp, 0x30, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 1], 0, ME_NRPN_LSB, dp, note, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 2], 0, ME_DATA_ENTRY_MSB, dp, *body, SYSEX_TAG); num_events += 3; break; case 0x21: /* EQ TREBLE */ SETMIDIEVENT(evm[num_events], 0, ME_NRPN_MSB, dp, 0x31, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 1], 0, ME_NRPN_LSB, dp, note, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 2], 0, ME_DATA_ENTRY_MSB, dp, *body, SYSEX_TAG); num_events += 3; break; case 0x24: /* EQ BASS frequency */ SETMIDIEVENT(evm[num_events], 0, ME_NRPN_MSB, dp, 0x34, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 1], 0, ME_NRPN_LSB, dp, note, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 2], 0, ME_DATA_ENTRY_MSB, dp, *body, SYSEX_TAG); num_events += 3; break; case 0x25: /* EQ TREBLE frequency */ SETMIDIEVENT(evm[num_events], 0, ME_NRPN_MSB, dp, 0x35, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 1], 0, ME_NRPN_LSB, dp, note, SYSEX_TAG); SETMIDIEVENT(evm[num_events + 2], 0, ME_DATA_ENTRY_MSB, dp, *body, SYSEX_TAG); num_events += 3; break; case 0x50: /* High Pass Filter Cutoff Frequency */ ctl->cmsg(CMSG_INFO, VERB_NOISY, "High Pass Filter Cutoff Frequency is not supported. (CH:%d NOTE:%d VAL:%d)", dp, note, *body); break; case 0x60: /* Velocity Pitch Sense */ ctl->cmsg(CMSG_INFO, VERB_NOISY, "Velocity Pitch Sense is not supported. (CH:%d NOTE:%d VAL:%d)", dp, note, *body); break; case 0x61: /* Velocity LPF Cutoff Sense */ ctl->cmsg(CMSG_INFO, VERB_NOISY, "Velocity LPF Cutoff Sense is not supported. (CH:%d NOTE:%d VAL:%d)", dp, note, *body); break; default: ctl->cmsg(CMSG_INFO,VERB_NOISY,"Unsupported XG Bulk Dump SysEx. (ADDR:%02X %02X %02X VAL:%02X)",addhigh,addmid,ent,*body); break; } } } /* parsing GS System Exclusive Message... * * val[4] == Parameter Address(High) * val[5] == Parameter Address(Middle) * val[6] == Parameter Address(Low) * val[7]... == Data... * val[last] == Checksum(== 128 - (sum of addresses&data bytes % 128)) */ else if(len >= 9 && val[0] == 0x41 && /* Roland ID */ val[1] == 0x10 && /* Device ID */ val[2] == 0x42 && /* GS Model ID */ val[3] == 0x12) /* Data Set Command */ { uint8 p, dp, udn, gslen, port = 0; int i, addr, addr_h, addr_m, addr_l, checksum; p = block_to_part(val[5], midi_port_number); /* calculate checksum */ checksum = 0; for(gslen = 9; gslen < len; gslen++) if(val[gslen] == 0xF7) break; for(i=4;i<gslen-1;i++) { checksum += val[i]; } if(((128 - (checksum & 0x7F)) & 0x7F) != val[gslen-1]) { ctl->cmsg(CMSG_INFO,VERB_NOISY,"GS SysEx: Checksum Error."); return num_events; } /* drum channel */ dp = rhythm_part[(val[5] & 0xF0) >> 4]; /* calculate user drumset number */ udn = (val[5] & 0xF0) >> 4; addr_h = val[4]; addr_m = val[5]; addr_l = val[6]; if(addr_h == 0x50) { /* for double module mode */ port = 1; p = block_to_part(val[5], port); addr_h = 0x40; } else if(addr_h == 0x51) { port = 1; p = block_to_part(val[5], port);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -