| 111 | } |
| 112 | |
| 113 | void Cartridge::unpackProgram(uint8_t *unpackPgm, int idx) { |
| 114 | // TODO put this in uint8_t :D |
| 115 | char *bulk = (char *)voiceData + 6 + (idx * 128); |
| 116 | |
| 117 | for (int op = 0; op < 6; op++) { |
| 118 | // eg rate and level, brk pt, depth, scaling |
| 119 | |
| 120 | for(int i=0; i<11; i++) { |
| 121 | uint8_t currparm = bulk[op * 17 + i] & 0x7F; // mask BIT7 (don't care per sysex spec) |
| 122 | unpackPgm[op * 21 + i] = normparm(currparm, 99, i); |
| 123 | } |
| 124 | |
| 125 | memcpy(unpackPgm + op * 21, bulk + op * 17, 11); |
| 126 | char leftrightcurves = bulk[op * 17 + 11]&0xF; // bits 4-7 don't care per sysex spec |
| 127 | unpackPgm[op * 21 + 11] = leftrightcurves & 3; |
| 128 | unpackPgm[op * 21 + 12] = (leftrightcurves >> 2) & 3; |
| 129 | char detune_rs = bulk[op * 17 + 12]&0x7F; |
| 130 | unpackPgm[op * 21 + 13] = detune_rs & 7; |
| 131 | char kvs_ams = bulk[op * 17 + 13]&0x1F; // bits 5-7 don't care per sysex spec |
| 132 | unpackPgm[op * 21 + 14] = kvs_ams & 3; |
| 133 | unpackPgm[op * 21 + 15] = (kvs_ams >> 2) & 7; |
| 134 | unpackPgm[op * 21 + 16] = bulk[op * 17 + 14]&0x7F; // output level |
| 135 | char fcoarse_mode = bulk[op * 17 + 15]&0x3F; //bits 6-7 don't care per sysex spec |
| 136 | unpackPgm[op * 21 + 17] = fcoarse_mode & 1; |
| 137 | unpackPgm[op * 21 + 18] = (fcoarse_mode >> 1)&0x1F; |
| 138 | unpackPgm[op * 21 + 19] = bulk[op * 17 + 16]&0x7F; // fine freq |
| 139 | unpackPgm[op * 21 + 20] = (detune_rs >> 3) &0x7F; |
| 140 | } |
| 141 | |
| 142 | for (int i=0; i<8; i++) { |
| 143 | uint8_t currparm = bulk[102 + i] & 0x7F; // mask BIT7 (don't care per sysex spec) |
| 144 | unpackPgm[126+i] = normparm(currparm, 99, 126+i); |
| 145 | } |
| 146 | unpackPgm[134] = normparm(bulk[110]&0x1F, 31, 134); // bits 5-7 are don't care per sysex spec |
| 147 | |
| 148 | char oks_fb = bulk[111]&0xF;//bits 4-7 are don't care per spec |
| 149 | unpackPgm[135] = oks_fb & 7; |
| 150 | unpackPgm[136] = oks_fb >> 3; |
| 151 | unpackPgm[137] = bulk[112] & 0x7F; // lfs |
| 152 | unpackPgm[138] = bulk[113] & 0x7F; // lfd |
| 153 | unpackPgm[139] = bulk[114] & 0x7F; // lpmd |
| 154 | unpackPgm[140] = bulk[115] & 0x7F; // lamd |
| 155 | char lpms_lfw_lks = bulk[116] & 0x7F; |
| 156 | unpackPgm[141] = lpms_lfw_lks & 1; |
| 157 | unpackPgm[142] = (lpms_lfw_lks >> 1) & 7; |
| 158 | unpackPgm[143] = lpms_lfw_lks >> 4; |
| 159 | unpackPgm[144] = bulk[117] & 0x7F; |
| 160 | for (int name_idx = 0; name_idx < 10; name_idx++) { |
| 161 | unpackPgm[145 + name_idx] = bulk[118 + name_idx] & 0x7F; |
| 162 | } //name_idx |
| 163 | // memcpy(unpackPgm + 144, bulk + 117, 11); // transpose, name |
| 164 | } |
| 165 | |
| 166 | void DexedAudioProcessor::loadCartridge(Cartridge &sysex) { |
| 167 | currentCart = sysex; |
no test coverage detected