Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-sysex_digitech.c
blob3a89577931ef9236d8cac677cfca373e4b7483cc
1 /* packet-sysex-digitech.c
3 * MIDI SysEx dissector for Digitech devices (DOD Electronics Corp.)
4 * Tomasz Mon 2012
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
9 #include "config.h"
11 #include <epan/packet.h>
12 #include <epan/conversation.h>
13 #include <epan/expert.h>
14 #include <epan/tfs.h>
15 #include <wsutil/array.h>
17 #define SYSEX_MANUFACTURER_DOD 0x000010
19 void proto_register_sysex_digitech(void);
21 /* protocols and header fields */
22 static int proto_sysex_digitech;
23 static int hf_digitech_device_id;
24 static int hf_digitech_family_id;
25 static int hf_digitech_rp_product_id;
26 static int hf_digitech_unknown_product_id;
27 static int hf_digitech_procedure_id;
29 static int hf_digitech_desired_device_id;
30 static int hf_digitech_desired_family_id;
31 static int hf_digitech_desired_product_id;
32 static int hf_digitech_received_device_id;
33 static int hf_digitech_os_mode;
35 static int hf_digitech_preset_bank;
36 static int hf_digitech_preset_index;
37 static int hf_digitech_preset_count;
38 static int hf_digitech_preset_name;
39 static int hf_digitech_preset_modified;
41 static int hf_digitech_message_count;
43 static int hf_digitech_parameter_count;
44 static int hf_digitech_parameter_id;
45 static int hf_digitech_parameter_id_global;
46 static int hf_digitech_parameter_id_pickup;
47 static int hf_digitech_parameter_id_wah;
48 static int hf_digitech_parameter_id_compressor;
49 static int hf_digitech_parameter_id_gnx3k_whammy;
50 static int hf_digitech_parameter_id_distortion;
51 static int hf_digitech_parameter_id_amp_channel;
52 static int hf_digitech_parameter_id_amp;
53 static int hf_digitech_parameter_id_amp_cabinet;
54 static int hf_digitech_parameter_id_amp_b;
55 static int hf_digitech_parameter_id_amp_cabinet_b;
56 static int hf_digitech_parameter_id_noisegate;
57 static int hf_digitech_parameter_id_volume_pre_fx;
58 static int hf_digitech_parameter_id_chorusfx;
59 static int hf_digitech_parameter_id_delay;
60 static int hf_digitech_parameter_id_reverb;
61 static int hf_digitech_parameter_id_volume_post_fx;
62 static int hf_digitech_parameter_id_preset;
63 static int hf_digitech_parameter_id_wah_min_max;
64 static int hf_digitech_parameter_id_equalizer;
65 static int hf_digitech_parameter_id_equalizer_b;
66 static int hf_digitech_parameter_id_amp_loop;
68 static int hf_digitech_parameter_position;
69 static int hf_digitech_parameter_data;
70 static int hf_digitech_parameter_data_count;
71 static int hf_digitech_parameter_data_two_byte_count;
72 static int hf_digitech_parameter_multibyte_data;
74 static int hf_digitech_ack_request_proc_id;
75 static int hf_digitech_nack_request_proc_id;
77 static int hf_digitech_checksum;
78 static int hf_digitech_checksum_status;
80 static int ett_sysex_digitech;
82 static expert_field ei_digitech_checksum_bad;
83 static expert_field ei_digitech_undecoded;
85 typedef struct _digitech_conv_data_t {
86 int protocol_version;
87 } digitech_conv_data_t;
89 static dissector_handle_t sysex_digitech_handle;
91 #define DIGITECH_FAMILY_X_FLOOR 0x5C
92 #define DIGITECH_FAMILY_JAMMAN 0x5D
93 #define DIGITECH_FAMILY_RP 0x5E
94 #define DIGITECH_FAMILY_RACK 0x5F
95 #define DIGITECH_FAMILY_VOCALIST 0x60
97 static const value_string digitech_family_id[] = {
98 {DIGITECH_FAMILY_X_FLOOR, "\"X\" Floor Guitar Processor"},
99 {DIGITECH_FAMILY_JAMMAN, "JamMan"},
100 {DIGITECH_FAMILY_RP, "RP series"},
101 {DIGITECH_FAMILY_RACK, "Rack"},
102 {DIGITECH_FAMILY_VOCALIST, "Vocalist"},
103 {0x7F, "All"},
104 {0, NULL}
107 static const value_string digitech_rp_product_id[] = {
108 {0x01, "RP150"},
109 {0x02, "RP250"},
110 {0x03, "RP350"},
111 {0x04, "RP370"},
112 {0x05, "RP500"},
113 {0x06, "RP1000"},
114 {0x07, "RP155"},
115 {0x08, "RP255"},
116 {0x09, "RP355"},
117 {0, NULL}
120 typedef enum _digitech_procedure_id {
121 DIGITECH_PROCEDURE_REQUEST_WHO_AM_I = 0x01,
122 DIGITECH_PROCEDURE_RECEIVE_WHO_AM_I = 0x02,
124 DIGITECH_PROCEDURE_REQUEST_DEVICE_CONFIGURATION = 0x08,
125 DIGITECH_PROCEDURE_RECEIVE_DEVICE_CONFIGURATION = 0x09,
127 DIGITECH_PROCEDURE_REQUEST_GLOBAL_PARAMETERS = 0x10,
128 DIGITECH_PROCEDURE_RECEIVE_GLOBAL_PARAMETERS = 0x11,
130 DIGITECH_PROCEDURE_REQUEST_BULK_DUMP = 0x18,
131 DIGITECH_PROCEDURE_RECEIVE_BULK_DUMP_START = 0x19,
132 DIGITECH_PROCEDURE_RECEIVE_BULK_DUMP_END = 0x1B,
134 DIGITECH_PROCEDURE_RECEIVE_USER_PRESET_INDEX_TABLE = 0x20,
136 DIGITECH_PROCEDURE_REQUEST_PRESET_NAMES = 0x21,
137 DIGITECH_PROCEDURE_RECEIVE_PRESET_NAMES = 0x22,
139 DIGITECH_PROCEDURE_REQUEST_PRESET_NAME = 0x28,
140 DIGITECH_PROCEDURE_RECEIVE_PRESET_NAME = 0x29,
142 DIGITECH_PROCEDURE_REQUEST_PRESET = 0x2A,
143 DIGITECH_PROCEDURE_RECEIVE_PRESET_START = 0x2B,
144 DIGITECH_PROCEDURE_RECEIVE_PRESET_END = 0x2C,
145 DIGITECH_PROCEDURE_RECEIVE_PRESET_PARAMETERS = 0x2D,
147 DIGITECH_PROCEDURE_LOAD_EDIT_BUFFER_PRESET = 0x38, /* version 0 only
148 use move preset in later versions */
150 DIGITECH_PROCEDURE_MOVE_PRESET = 0x39,
152 DIGITECH_PROCEDURE_REQUEST_MODIFIER_LINKABLE_LIST = 0x3A,
153 DIGITECH_PROCEDURE_RECEIVE_MODIFIER_LINKABLE_LIST = 0x3B,
155 DIGITECH_PROCEDURE_REQUEST_PARAMETER_VALUE = 0x40,
156 DIGITECH_PROCEDURE_RECEIVE_PARAMETER_VALUE = 0x41,
158 /* version 1 and later */
159 DIGITECH_PROCEDURE_REQUEST_OBJECT_NAMES = 0x50,
160 DIGITECH_PROCEDURE_RECEIVE_OBJECT_NAMES = 0x51,
161 DIGITECH_PROCEDURE_REQUEST_OBJECT_NAME = 0x52,
162 DIGITECH_PROCEDURE_RECEIVE_OBJECT_NAME = 0x53,
163 DIGITECH_PROCEDURE_REQUEST_OBJECT = 0x54,
164 DIGITECH_PROCEDURE_RECEIVE_OBJECT = 0x55,
165 DIGITECH_PROCEDURE_MOVE_OBJECT = 0x56,
166 DIGITECH_PROCEDURE_DELETE_OBJECT = 0x57,
167 DIGITECH_PROCEDURE_REQUEST_TABLE = 0x5A,
168 DIGITECH_PROCEDURE_RECEIVE_TABLE = 0x5B,
170 DIGITECH_PROCEDURE_RECEIVE_DEVICE_NOTIFICATION = 0x70,
172 DIGITECH_PROCEDURE_START_OS_DOWNLOAD = 0x71,
173 DIGITECH_PROCEDURE_RESTART_DEVICE = 0x72,
174 DIGITECH_PROCEDURE_REQUEST_DEBUG_DATA = 0x73,
175 DIGITECH_PROCEDURE_RECEIVE_DEBUG_DATA = 0x74,
177 DIGITECH_PROCEDURE_ACK = 0x7E,
178 DIGITECH_PROCEDURE_NACK = 0x7F
179 } digitech_procedure_id;
181 static const value_string digitech_procedures[] = {
182 {DIGITECH_PROCEDURE_REQUEST_WHO_AM_I, "Request WhoAmI"},
183 {DIGITECH_PROCEDURE_RECEIVE_WHO_AM_I, "Receive WhoAmI"},
184 {DIGITECH_PROCEDURE_REQUEST_DEVICE_CONFIGURATION, "Request Device Configuration"},
185 {DIGITECH_PROCEDURE_RECEIVE_DEVICE_CONFIGURATION, "Receive Device Configuration"},
186 {DIGITECH_PROCEDURE_REQUEST_GLOBAL_PARAMETERS, "Request Global Parameters"},
187 {DIGITECH_PROCEDURE_RECEIVE_GLOBAL_PARAMETERS, "Receive Global Parameters"},
188 {DIGITECH_PROCEDURE_REQUEST_BULK_DUMP, "Request Bulk Dump"},
189 {DIGITECH_PROCEDURE_RECEIVE_BULK_DUMP_START, "Receive Bulk Dump Start"},
190 {DIGITECH_PROCEDURE_RECEIVE_BULK_DUMP_END, "Receive Bulk Dump End"},
191 {DIGITECH_PROCEDURE_RECEIVE_USER_PRESET_INDEX_TABLE, "Receive User Preset Index Table"},
192 {DIGITECH_PROCEDURE_REQUEST_PRESET_NAMES, "Request Preset Names"},
193 {DIGITECH_PROCEDURE_RECEIVE_PRESET_NAMES, "Receive Preset Names"},
194 {DIGITECH_PROCEDURE_REQUEST_PRESET_NAME, "Request Preset Name"},
195 {DIGITECH_PROCEDURE_RECEIVE_PRESET_NAME, "Receive Preset Name"},
196 {DIGITECH_PROCEDURE_REQUEST_PRESET, "Request Preset"},
197 {DIGITECH_PROCEDURE_RECEIVE_PRESET_START, "Receive Preset Start"},
198 {DIGITECH_PROCEDURE_RECEIVE_PRESET_END, "Receive Preset End"},
199 {DIGITECH_PROCEDURE_RECEIVE_PRESET_PARAMETERS, "Receive Preset Parameters"},
200 {DIGITECH_PROCEDURE_LOAD_EDIT_BUFFER_PRESET, "Load Edit Buffer Preset"},
201 {DIGITECH_PROCEDURE_MOVE_PRESET, "Move Preset"},
202 {DIGITECH_PROCEDURE_REQUEST_MODIFIER_LINKABLE_LIST, "Request Modifier-Linkable List"},
203 {DIGITECH_PROCEDURE_RECEIVE_MODIFIER_LINKABLE_LIST, "Receive Modifier-Linkable List"},
204 {DIGITECH_PROCEDURE_REQUEST_PARAMETER_VALUE, "Request Parameter Value"},
205 {DIGITECH_PROCEDURE_RECEIVE_PARAMETER_VALUE, "Receive Parameter Value"},
206 {DIGITECH_PROCEDURE_REQUEST_OBJECT_NAMES, "Request Object Names"},
207 {DIGITECH_PROCEDURE_RECEIVE_OBJECT_NAMES, "Receive Object Names"},
208 {DIGITECH_PROCEDURE_REQUEST_OBJECT_NAME, "Request Object Name"},
209 {DIGITECH_PROCEDURE_RECEIVE_OBJECT_NAME, "Receive Object Name"},
210 {DIGITECH_PROCEDURE_REQUEST_OBJECT, "Request Object"},
211 {DIGITECH_PROCEDURE_RECEIVE_OBJECT, "Receive Object"},
212 {DIGITECH_PROCEDURE_MOVE_OBJECT, "Move Object"},
213 {DIGITECH_PROCEDURE_DELETE_OBJECT, "Delete Object"},
214 {DIGITECH_PROCEDURE_REQUEST_TABLE, "Request Table"},
215 {DIGITECH_PROCEDURE_RECEIVE_TABLE, "Receive Table"},
216 {DIGITECH_PROCEDURE_RECEIVE_DEVICE_NOTIFICATION, "Receive Device Notification"},
217 {DIGITECH_PROCEDURE_START_OS_DOWNLOAD, "Start OS Download"},
218 {DIGITECH_PROCEDURE_RESTART_DEVICE, "Restart Device"},
219 {DIGITECH_PROCEDURE_REQUEST_DEBUG_DATA, "Request Debug Data"},
220 {DIGITECH_PROCEDURE_RECEIVE_DEBUG_DATA, "Receive Debug Data"},
221 {DIGITECH_PROCEDURE_ACK, "ACK"},
222 {DIGITECH_PROCEDURE_NACK, "NACK"},
223 {0, NULL}
225 static value_string_ext digitech_procedures_ext =
226 VALUE_STRING_EXT_INIT(digitech_procedures);
228 static const value_string digitech_os_modes[] = {
229 {0, "Normal"},
230 {1, "Flash update"},
231 {0, NULL}
234 static const value_string digitech_preset_banks[] = {
235 {0, "Factory (fixed) bank"},
236 {1, "User bank"},
237 {2, "Artist bank"},
238 {3, "Media card (CF or other)"},
239 {4, "Current preset edit buffer"},
240 {5, "Second factory bank"},
241 {6, "External preset"},
242 {0, NULL}
245 static const value_string digitech_parameter_ids_global[] = {
246 {12361, "Amp/Cab Bypass On/Off"},
247 {12298, "GUI Mode On/Off"},
248 {0, NULL}
251 static const value_string digitech_parameter_ids_pickup[] = {
252 {65, "Pickup On/Off"},
253 {0, NULL}
256 static const value_string digitech_parameter_ids_wah[] = {
257 {129, "Wah On/Off"},
258 {133, "Wah Level"},
259 {0, NULL}
262 static const value_string digitech_parameter_ids_compressor[] = {
263 {193, "Compressor On/Off"},
264 {194, "Compressor Attack"},
265 {195, "Compressor Ratio"},
266 {200, "Compressor Threshold"},
267 {201, "Compressor Gain"},
268 {208, "Compressor Sustain"},
269 {209, "Compressor Tone"},
270 {210, "Compressor Level"},
271 {211, "Compressor Attack"},
272 {212, "Compressor Output"},
273 {213, "Compressor Sensitivity"},
274 {0, NULL}
277 static const value_string digitech_parameter_ids_gnx3k_whammy[] = {
278 {769, "Whammy/IPS On/Off"},
279 {1667, "Whammy/IPS Detune Level"},
280 {1670, "Whammy/IPS Detune Shift Amount"},
281 {1731, "Whammy/IPS Pitch Shift Level"},
282 {1732, "Whammy/IPS Pitch Shift Shift Amount"},
283 {1795, "Whammy/IPS Whammy Pedal"},
284 {1796, "Whammy/IPS Whammy Mix"},
285 {1797, "Whammy/IPS Whammy Shift Amount"},
286 {2754, "Whammy/IPS IPS Shift Amount"},
287 {2755, "Whammy/IPS IPS Scale"},
288 {2756, "Whammy/IPS IPS Key"},
289 {2757, "Whammy/IPS IPS Level"},
290 {2818, "Whammy/IPS Talker Mic Level"},
291 {0, NULL}
293 static value_string_ext digitech_parameter_ids_gnx3k_whammy_ext =
294 VALUE_STRING_EXT_INIT(digitech_parameter_ids_gnx3k_whammy);
296 static const value_string digitech_parameter_ids_distortion[] = {
297 {2433, "Distortion On/Off"},
298 {2434, "Distortion Screamer Drive"},
299 {2435, "Distortion Screamer Tone"},
300 {2436, "Distortion Screamer Level"},
301 {2437, "Distortion Rodent Dist"},
302 {2438, "Distortion Rodent Filter"},
303 {2439, "Distortion Rodent Level"},
304 {2440, "Distortion DS Gain"},
305 {2441, "Distortion DS Tone"},
306 {2442, "Distortion DS Level"},
307 {2443, "Distortion DOD250 Gain"},
308 {2444, "Distortion DOD250 Level"},
309 {2445, "Distortion Big MP Sustain"},
310 {2446, "Distortion Big MP Tone"},
311 {2447, "Distortion Big MP Volume"},
312 {2448, "Distortion GuyOD Drive"},
313 {2449, "Distortion GuyOD Level"},
314 {2450, "Distortion Sparkdrive Gain"},
315 {2451, "Distortion Sparkdrive Tone"},
316 {2452, "Distortion Sparkdrive Clean"},
317 {2453, "Distortion Sparkdrive Volume"},
318 {2454, "Distortion Grunge Grunge"},
319 {2455, "Distortion Grunge Butt"},
320 {2456, "Distortion Grunge Face"},
321 {2457, "Distortion Grunge Loud"},
322 {2458, "Distortion Fuzzy Fuzz"},
323 {2459, "Distortion Fuzzy Volume"},
324 {2460, "Distortion Zone Gain"},
325 {2461, "Distortion Zone Mid freq"},
326 {2462, "Distortion Zone Mid level"},
327 {2463, "Distortion Zone Low"},
328 {2464, "Distortion Zone High"},
329 {2465, "Distortion Zone Level"},
330 {2466, "Distortion 8tavia Drive"},
331 {2467, "Distortion 8tavia Volume"},
332 {2468, "Distortion MX Dist"},
333 {2469, "Distortion MX Output"},
334 {2470, "Distortion Gonk Suck"},
335 {2471, "Distortion Gonk Smear"},
336 {2472, "Distortion Gonk Heave"},
337 {2473, "Distortion 808 Overdrive"},
338 {2474, "Distortion 808 Tone"},
339 {2475, "Distortion 808 Level"},
340 {2476, "Distortion Death Mid"},
341 {2477, "Distortion Death Low"},
342 {2478, "Distortion Death Level"},
343 {2479, "Distortion Death High"},
344 {2480, "Distortion Gonk Gonk"},
345 {2481, "Distortion Fuzzlator Fuzz"},
346 {2482, "Distortion Fuzzlator Tone"},
347 {2483, "Distortion Fuzzlator LooseTight"},
348 {2484, "Distortion Fuzzlator Volume"},
349 {2485, "Distortion Classic Fuzz Fuzz"},
350 {2486, "Distortion Classic Fuzz Tone"},
351 {2487, "Distortion Classic Fuzz Volume"},
352 {2488, "Distortion Redline Gain"},
353 {2489, "Distortion Redline Low"},
354 {2490, "Distortion Redline High"},
355 {2491, "Distortion Redline Level"},
356 {2492, "Distortion OC Drive Drive"},
357 {2493, "Distortion OC Drive HP/LP"},
358 {2494, "Distortion OC Drive Tone"},
359 {2495, "Distortion OC Drive Level"},
360 {2562, "Distortion TS Mod Drive"},
361 {2563, "Distortion TS Mod Level"},
362 {2564, "Distortion TS Mod Tone"},
363 {2565, "Distortion SD Overdrive Drive"},
364 {2566, "Distortion SD Overdrive Tone"},
365 {2567, "Distortion SD Overdrive Level"},
366 {2568, "Distortion OD Overdrive Overdrive"},
367 {2569, "Distortion OD Overdrive Level"},
368 {2570, "Distortion Amp Driver Gain"},
369 {2571, "Distortion Amp Driver Mid Boost"},
370 {2572, "Distortion Amp Driver Level"},
371 {0, NULL}
373 static value_string_ext digitech_parameter_ids_distortion_ext =
374 VALUE_STRING_EXT_INIT(digitech_parameter_ids_distortion);
376 static const value_string digitech_parameter_ids_amp_channel[] = {
377 {260, "Amp Channel Amp Channel"},
378 {261, "Amp Channel Warp"},
379 {262, "Amp Channel Amp Warp"},
380 {263, "Amp Channel Cabinet Warp"},
381 {0, NULL}
384 static const value_string digitech_parameter_ids_amp[] = {
385 {265, "Amplifier On/Off"},
386 {2497, "Amplifier Gain"},
387 {2498, "Amplifier Level"},
388 {2499, "Channel 1 Bass Freq"},
389 {2500, "Channel 1 Bass Level"},
390 {2501, "Channel 1 Mid Freq"},
391 {2502, "Channel 1 Mid Level"},
392 {2503, "Channel 1 Treb Freq"},
393 {2504, "Channel 1 Treb Level"},
394 {2505, "EQ Enable On/Off"},
395 {2506, "Channel 1 Presence"},
396 {2507, "Amplifier Bass"},
397 {2508, "Amplifier Mid"},
398 {2509, "Amplifier Treble"},
399 {0, NULL}
401 static value_string_ext digitech_parameter_ids_amp_ext =
402 VALUE_STRING_EXT_INIT(digitech_parameter_ids_amp);
404 static const value_string digitech_parameter_ids_amp_cabinet[] = {
405 {2561, "Channel 1 Tuning"},
406 {0, NULL}
409 static const value_string digitech_parameter_ids_amp_b[] = {
410 {265, "Amplifier B On/Off"},
411 {2497, "Amplifier B Gain"},
412 {2498, "Amplifier B Level"},
413 {2499, "Channel 2 Bass Freq"},
414 {2500, "Channel 2 Bass Level"},
415 {2501, "Channel 2 Mid Freq"},
416 {2502, "Channel 2 Mid Level"},
417 {2503, "Channel 2 Treb Freq"},
418 {2504, "Channel 2 Treb Level"},
419 {2505, "EQ Enable On/Off"},
420 {2506, "Channel 2 Presence"},
421 {0, NULL}
424 static const value_string digitech_parameter_ids_amp_cabinet_b[] = {
425 {2561, "Channel 2 Tuning"},
426 {0, NULL}
429 static const value_string digitech_parameter_ids_noisegate[] = {
430 {705, "Noisegate On/Off"},
431 {706, "Noisegate Attack"},
432 {710, "Noisegate Threshold"},
433 {711, "Noisegate Sens"},
434 {712, "Noisegate Attack"},
435 {713, "Noisegate Release"},
436 {714, "Noisegate Attn"},
437 {0, NULL}
440 static const value_string digitech_parameter_ids_volume_pre_fx[] = {
441 {2626, "Pickup Volume Pre FX"},
442 {0, NULL}
445 static const value_string digitech_parameter_ids_chorusfx[] = {
446 {769, "Chorus/FX On/Off"},
447 {836, "Chorus/FX Chorus Level"},
448 {837, "Chorus/FX Chorus Speed"},
449 {838, "Chorus/FX CE/Dual/Multi Chorus Depth"},
450 {839, "Chorus/FX Chorus Predelay"},
451 {840, "Chorus/FX Dual/Multi Chorus Wave"},
452 {841, "Chorus/FX Chorus Balance"},
453 {848, "Chorus/FX Chorus Width"},
454 {849, "Chorus/FX Chorus Intensity"},
455 {850, "Chorus/FX Small Clone Rate"},
456 {901, "Chorus/FX Flanger Level/Mix"},
457 {902, "Chorus/FX Flanger Speed"},
458 {903, "Chorus/FX Flanger Depth"},
459 {904, "Chorus/FX Flanger Regen"},
460 {905, "Chorus/FX Flanger Waveform"},
461 {906, "Chorus/FX Flanger Balance"},
462 {914, "Chorus/FX Flanger Width"},
463 {916, "Chorus/FX Flanger Color"},
464 {917, "Chorus/FX Flanger Manual"},
465 {918, "Chorus/FX Flanger Rate"},
466 {919, "Chorus/FX Flanger Range"},
467 {920, "Chorus/FX Flanger Enhance"},
468 {921, "Chorus/FX Flanger Harmonics"},
469 {922, "Chorus/FX Filter Flanger Frequency"},
470 {962, "Chorus/FX Phaser Speed"},
471 {963, "Chorus/FX Phaser Depth"},
472 {965, "Chorus/FX Phaser Level"},
473 {966, "Chorus/FX Phaser Regen"},
474 {967, "Chorus/FX Phaser Waveform"},
475 {968, "Chorus/FX Phaser Balance"},
476 {976, "Chorus/FX MX Phaser Intensity"},
477 {977, "Chorus/FX EH Phaser Color"},
478 {979, "Chorus/FX EH Phaser Rate"},
479 {1028, "Chorus/FX Triggered Flanger Lfo Start"},
480 {1029, "Chorus/FX Triggered Flanger/Phaser Mix"},
481 {1030, "Chorus/FX Triggered Flanger Speed"},
482 {1031, "Chorus/FX Triggered Flanger Sens"},
483 {1032, "Chorus/FX Triggered Flanger Level"},
484 {1092, "Chorus/FX Triggered Phaser Lfo Start"},
485 {1094, "Chorus/FX Triggered Phaser Speed"},
486 {1095, "Chorus/FX Triggered Phaser Sens"},
487 {1096, "Chorus/FX Triggered Phaser Level"},
488 {1155, "Chorus/FX Tremolo Depth"},
489 {1156, "Chorus/FX Tremolo Speed"},
490 {1157, "Chorus/FX Tremolo Wave"},
491 {1219, "Chorus/FX Panner Depth"},
492 {1220, "Chorus/FX Panner Speed"},
493 {1221, "Chorus/FX Panner Wave"},
494 {1284, "Chorus/FX Vibrato Speed"},
495 {1285, "Chorus/FX Vibrato Depth"},
496 {1286, "Chorus/FX Vibrato Waveform"},
497 {1314, "Chorus/FX Vibropan Speed"},
498 {1315, "Chorus/FX Vibropan Depth"},
499 {1316, "Chorus/FX Vibropan Vibra"},
500 {1317, "Chorus/FX Vibropan Wave"},
501 {1346, "Chorus/FX Rotary Speed"},
502 {1348, "Chorus/FX Rotary Intensity"},
503 {1349, "Chorus/FX Rotary Mix"},
504 {1350, "Chorus/FX Rotary Doppler"},
505 {1351, "Chorus/FX Rotary Crossover"},
506 {1352, "Chorus/FX Rotary Balance"},
507 {1410, "Chorus/FX YaYa Pedal"},
508 {1412, "Chorus/FX YaYa Range"},
509 {1413, "Chorus/FX YaYa Mix"},
510 {1414, "Chorus/FX YaYa Depth"},
511 {1416, "Chorus/FX YaYa Balance"},
512 {1417, "Chorus/FX YaYa Intensity"},
513 {1418, "Chorus/FX YaYa Range"},
514 {1476, "Chorus/FX AutoYa Range"},
515 {1477, "Chorus/FX AutoYa Mix"},
516 {1478, "Chorus/FX AutoYa Speed"},
517 {1479, "Chorus/FX AutoYa Depth"},
518 {1481, "Chorus/FX AutoYa Balance"},
519 {1482, "Chorus/FX AutoYa Intensity"},
520 {1483, "Chorus/FX AutoYa Range"},
521 {1540, "Chorus/FX Synthtalk Vox"},
522 {1542, "Chorus/FX Synthtalk Attack"},
523 {1543, "Chorus/FX Synthtalk Release"},
524 {1544, "Chorus/FX Synthtalk Sens"},
525 {1545, "Chorus/FX Synthtalk Balance"},
526 {1604, "Chorus/FX Envelope Mix"},
527 {1605, "Chorus/FX Envelope/FX25 Range"},
528 {1606, "Chorus/FX Envelope/FX25 Sensitivity"},
529 {1607, "Chorus/FX Envelope Balance"},
530 {1608, "Chorus/FX FX25 Blend"},
531 {1667, "Chorus/FX Detune Level"},
532 {1668, "Chorus/FX Detune Amount"},
533 {1669, "Chorus/FX Detune Balance"},
534 {1730, "Chorus/FX Pitch Shift Amount"},
535 {1731, "Chorus/FX Pitch Level"},
536 {1733, "Chorus/FX Pitch Balance"},
537 {1745, "Chorus/FX Pitch Shift Mix"},
538 {1746, "Chorus/FX Octaver Octave 1"},
539 {1747, "Chorus/FX Octaver Octave 2"},
540 {1748, "Chorus/FX Octaver Dry Level"},
541 {1795, "Chorus/FX Whammy Pedal"},
542 {1796, "Chorus/FX Whammy Mix"},
543 {1797, "Chorus/FX Whammy Amount"},
544 {2754, "Chorus/FX IPS/Harmony Pitch Shift"},
545 {2755, "Chorus/FX IPS/Harmony Pitch Scale"},
546 {2756, "Chorus/FX IPS/Harmony Pitch Key"},
547 {2757, "Chorus/FX IPS/Harmony Pitch Level"},
548 {2882, "Chorus/FX Unovibe Chorus/Vibrato"},
549 {2883, "Chorus/FX Unovibe Intensity"},
550 {2884, "Chorus/FX Unovibe Pedal Speed"},
551 {2885, "Chorus/FX Unovibe Volume"},
552 {3010, "Chorus/FX Step Filter Speed"},
553 {3011, "Chorus/FX Step Filter Intensity"},
554 {3012, "Chorus/FX Sample/Hold Speed"},
555 {3013, "Chorus/FX Sample/Hold Intensity"},
556 {0, NULL}
558 static value_string_ext digitech_parameter_ids_chorusfx_ext =
559 VALUE_STRING_EXT_INIT(digitech_parameter_ids_chorusfx);
561 static const value_string digitech_parameter_ids_delay[] = {
562 {1857, "Delay On/Off"},
563 {1860, "Delay Level"},
564 {1862, "Delay Time"},
565 {1863, "Delay Repeats"},
566 {1864, "Delay Thresh"},
567 {1865, "Delay Atten"},
568 {1866, "Delay Balance"},
569 {1867, "Delay Spread"},
570 {1868, "Delay Tap Time"},
571 {1873, "Delay Depth"},
572 {1874, "Delay Repeats"},
573 {1888, "Delay Time"},
574 {1889, "Delay Ducker thresh"},
575 {1890, "Delay Ducker level"},
576 {1891, "Delay Tape Wow"},
577 {1892, "Delay Tape Flutter"},
578 {1893, "Delay Echo Plex Volume"},
579 {1894, "Delay DM Repeat Rate"},
580 {1895, "Delay DM Echo"},
581 {1896, "Delay DM Intensity"},
582 {1897, "Delay Echo Plex Time"},
583 {1898, "Delay DM Delay Repeat Rate"},
584 {1899, "Delay Echo Plex Time"},
585 {1900, "Delay Tap Time"},
586 {1901, "Delay Reverse Time"},
587 {1902, "Delay Reverse Mix"},
588 {1905, "Delay 2-tap Ratio"},
589 {0, NULL}
591 static value_string_ext digitech_parameter_ids_delay_ext =
592 VALUE_STRING_EXT_INIT(digitech_parameter_ids_delay);
594 static const value_string digitech_parameter_ids_reverb[] = {
595 {1921, "Reverb On/Off"},
596 {1922, "Reverb Predelay"},
597 {1924, "Reverb Damping"},
598 {1925, "Reverb Level"},
599 {1927, "Reverb Decay"},
600 {1928, "Reverb Balance"},
601 {1933, "Reverb Liveliness"},
602 {0, NULL}
605 static const value_string digitech_parameter_ids_volume_post_fx[] = {
606 {2626, "Pickup Volume Post FX"},
607 {0, NULL}
610 static const value_string digitech_parameter_ids_preset[] = {
611 {2626, "Pickup Preset Level"},
612 {0, NULL}
615 static const value_string digitech_parameter_ids_wah_min_max[] = {
616 {8195, "Wah Min"},
617 {8196, "Wah Max"},
618 {0, NULL}
621 static const value_string digitech_parameter_ids_equalizer[] = {
622 {3203, "Equalizer Bass"},
623 {3204, "Equalizer Mid"},
624 {3205, "Equalizer Treble"},
625 {3206, "Equalizer Mid Hz"},
626 {3207, "Equalizer Presence"},
627 {3211, "Equalizer Treb Hz"},
628 {3212, "Equalizer On/Off"},
629 {3213, "Equalizer Low Freq"},
630 {3215, "Equalizer High Freq"},
631 {3216, "Equalizer Low Bandwidth"},
632 {3217, "Equalizer Mid Bandwidth"},
633 {3218, "Equalizer High Bandwidth"},
634 {0, NULL}
637 static const value_string digitech_parameter_ids_equalizer_b[] = {
638 {3203, "Equalizer B Bass"},
639 {3204, "Equalizer B Mid"},
640 {3205, "Equalizer B Treble"},
641 {3206, "Equalizer B Mid Hz"},
642 {3207, "Equalizer B Presence"},
643 {3211, "Equalizer B Treb Hz"},
644 {3212, "Equalizer B On/Off"},
645 {0, NULL}
648 static const value_string digitech_parameter_ids_amp_loop[] = {
649 {3649, "Amp Loop On/Off"},
650 {0, NULL}
653 #define DIGITECH_POSITION_GLOBAL 0
654 #define DIGITECH_POSITION_PICKUP 2
655 #define DIGITECH_POSITION_WAH 3
656 #define DIGITECH_POSITION_COMPRESSOR 4
657 #define DIGITECH_POSITION_GNX3K_WHAMMY 5
658 #define DIGITECH_POSITION_DISTORTION 6
659 #define DIGITECH_POSITION_AMP_CHANNEL 7
660 #define DIGITECH_POSITION_AMP 8
661 #define DIGITECH_POSITION_AMP_CABINET 9
662 #define DIGITECH_POSITION_AMP_B 10
663 #define DIGITECH_POSITION_AMP_CABINET_B 11
664 #define DIGITECH_POSITION_NOISEGATE 12
665 #define DIGITECH_POSITION_VOLUME_PRE_FX 13
666 #define DIGITECH_POSITION_CHORUS_FX 14
667 #define DIGITECH_POSITION_DELAY 15
668 #define DIGITECH_POSITION_REVERB 16
669 #define DIGITECH_POSITION_VOLUME_POST_FX 17
670 #define DIGITECH_POSITION_PRESET 18
671 #define DIGITECH_POSITION_EXPRESSION 19
672 #define DIGITECH_POSITION_WAH_MIN_MAX 20
673 #define DIGITECH_POSITION_V_SWITCH_ASSIGN 21
674 #define DIGITECH_POSITION_LFO_1 22
675 #define DIGITECH_POSITION_LFO_2 23
676 #define DIGITECH_POSITION_EQUALIZER 24
677 #define DIGITECH_POSITION_EQUALIZER_B 25
678 #define DIGITECH_POSITION_LIBRARY 26
679 #define DIGITECH_POSITION_AMP_LOOP 33
680 #define DIGITECH_POSITION_WAH_PEDAL 132
682 static const value_string digitech_parameter_positions[] = {
683 {DIGITECH_POSITION_GLOBAL, "Global"},
684 {DIGITECH_POSITION_PICKUP, "Pickup"},
685 {DIGITECH_POSITION_WAH, "Wah"},
686 {DIGITECH_POSITION_COMPRESSOR, "Compressor"},
687 {DIGITECH_POSITION_GNX3K_WHAMMY, "GNX3K Whammy"},
688 {DIGITECH_POSITION_DISTORTION, "Distortion"},
689 {DIGITECH_POSITION_AMP_CHANNEL, "Amp Channel"},
690 {DIGITECH_POSITION_AMP, "Amp"},
691 {DIGITECH_POSITION_AMP_CABINET, "Amp Cabinet"},
692 {DIGITECH_POSITION_AMP_B, "Amp B"},
693 {DIGITECH_POSITION_AMP_CABINET_B, "Amp Cabinet B"},
694 {DIGITECH_POSITION_NOISEGATE, "Noisegate"},
695 {DIGITECH_POSITION_VOLUME_PRE_FX, "Volume Pre Fx"},
696 {DIGITECH_POSITION_CHORUS_FX, "Chorus/FX"},
697 {DIGITECH_POSITION_DELAY, "Delay"},
698 {DIGITECH_POSITION_REVERB, "Reverb"},
699 {DIGITECH_POSITION_VOLUME_POST_FX, "Volume Post Fx"},
700 {DIGITECH_POSITION_PRESET, "Preset"},
701 {DIGITECH_POSITION_EXPRESSION, "Expression"},
702 {DIGITECH_POSITION_WAH_MIN_MAX, "Wah Min-Max"},
703 {DIGITECH_POSITION_V_SWITCH_ASSIGN, "V-Switch Assign"},
704 {DIGITECH_POSITION_LFO_1, "LFO 1"},
705 {DIGITECH_POSITION_LFO_2, "LFO 2"},
706 {DIGITECH_POSITION_EQUALIZER, "Equalizer"},
707 {DIGITECH_POSITION_EQUALIZER_B, "Equalizer B"},
708 {DIGITECH_POSITION_LIBRARY, "Library"},
709 {DIGITECH_POSITION_AMP_LOOP, "Amp Loop"},
710 {DIGITECH_POSITION_WAH_PEDAL, "Wah Pedal"},
711 {0, NULL}
713 static value_string_ext digitech_parameter_positions_ext =
714 VALUE_STRING_EXT_INIT(digitech_parameter_positions);
716 static tvbuff_t *
717 unpack_digitech_message(packet_info *pinfo, tvbuff_t *tvb, int offset)
719 tvbuff_t *next_tvb;
720 int length = tvb_reported_length(tvb);
721 int data_len = length - offset - 1;
722 const uint8_t* data_ptr;
723 int remaining = data_len;
724 unsigned char* unpacked;
725 unsigned char* unpacked_ptr;
726 int unpacked_size;
727 uint8_t msb;
728 int i;
730 unpacked_size = data_len - (data_len / 8);
731 if (data_len % 8)
733 unpacked_size--;
736 data_ptr = tvb_get_ptr(tvb, offset, data_len);
737 unpacked = (unsigned char*)wmem_alloc(pinfo->pool, unpacked_size);
738 unpacked_ptr = unpacked;
740 while (remaining > 0)
742 msb = *data_ptr++;
743 remaining--;
745 for (i = 0; (i < 7) && (remaining > 0); ++i, --remaining)
747 *unpacked_ptr = *data_ptr | ((msb << (i + 1)) & 0x80);
748 unpacked_ptr++;
749 data_ptr++;
753 /* Create new tvb with unpacked data */
754 next_tvb = tvb_new_child_real_data(tvb, unpacked, unpacked_size, unpacked_size);
756 return next_tvb;
759 static int
760 get_digitech_hf_parameter_id_by_position(uint8_t position)
762 int hf_parameter = hf_digitech_parameter_id;
764 switch (position)
766 case DIGITECH_POSITION_GLOBAL:
767 hf_parameter = hf_digitech_parameter_id_global;
768 break;
769 case DIGITECH_POSITION_PICKUP:
770 hf_parameter = hf_digitech_parameter_id_pickup;
771 break;
772 case DIGITECH_POSITION_WAH:
773 hf_parameter = hf_digitech_parameter_id_wah;
774 break;
775 case DIGITECH_POSITION_COMPRESSOR:
776 hf_parameter = hf_digitech_parameter_id_compressor;
777 break;
778 case DIGITECH_POSITION_GNX3K_WHAMMY:
779 hf_parameter = hf_digitech_parameter_id_gnx3k_whammy;
780 break;
781 case DIGITECH_POSITION_DISTORTION:
782 hf_parameter = hf_digitech_parameter_id_distortion;
783 break;
784 case DIGITECH_POSITION_AMP_CHANNEL:
785 hf_parameter = hf_digitech_parameter_id_amp_channel;
786 break;
787 case DIGITECH_POSITION_AMP:
788 hf_parameter = hf_digitech_parameter_id_amp;
789 break;
790 case DIGITECH_POSITION_AMP_CABINET:
791 hf_parameter = hf_digitech_parameter_id_amp_cabinet;
792 break;
793 case DIGITECH_POSITION_AMP_B:
794 hf_parameter = hf_digitech_parameter_id_amp_b;
795 break;
796 case DIGITECH_POSITION_AMP_CABINET_B:
797 hf_parameter = hf_digitech_parameter_id_amp_cabinet_b;
798 break;
799 case DIGITECH_POSITION_NOISEGATE:
800 hf_parameter = hf_digitech_parameter_id_noisegate;
801 break;
802 case DIGITECH_POSITION_VOLUME_PRE_FX:
803 hf_parameter = hf_digitech_parameter_id_volume_pre_fx;
804 break;
805 case DIGITECH_POSITION_CHORUS_FX:
806 hf_parameter = hf_digitech_parameter_id_chorusfx;
807 break;
808 case DIGITECH_POSITION_DELAY:
809 hf_parameter = hf_digitech_parameter_id_delay;
810 break;
811 case DIGITECH_POSITION_REVERB:
812 hf_parameter = hf_digitech_parameter_id_reverb;
813 break;
814 case DIGITECH_POSITION_VOLUME_POST_FX:
815 hf_parameter = hf_digitech_parameter_id_volume_post_fx;
816 break;
817 case DIGITECH_POSITION_PRESET:
818 hf_parameter = hf_digitech_parameter_id_preset;
819 break;
820 case DIGITECH_POSITION_WAH_MIN_MAX:
821 hf_parameter = hf_digitech_parameter_id_wah_min_max;
822 break;
823 case DIGITECH_POSITION_EQUALIZER:
824 hf_parameter = hf_digitech_parameter_id_equalizer;
825 break;
826 case DIGITECH_POSITION_EQUALIZER_B:
827 hf_parameter = hf_digitech_parameter_id_equalizer_b;
828 break;
829 case DIGITECH_POSITION_AMP_LOOP:
830 hf_parameter = hf_digitech_parameter_id_amp_loop;
831 break;
833 case DIGITECH_POSITION_EXPRESSION:
834 case DIGITECH_POSITION_V_SWITCH_ASSIGN:
835 case DIGITECH_POSITION_LFO_1:
836 case DIGITECH_POSITION_LFO_2:
837 case DIGITECH_POSITION_LIBRARY:
838 case DIGITECH_POSITION_WAH_PEDAL:
839 /* TODO */
840 default:
841 break;
844 return hf_parameter;
847 /* Dissects DigiTech parameter starting at data_offset.
848 * Returns new data_offset.
850 static int
851 dissect_digitech_parameter(tvbuff_t *data_tvb, proto_tree *tree,
852 digitech_conv_data_t *conv_data, int data_offset)
854 uint8_t digitech_helper;
855 int hf_parameter = hf_digitech_parameter_id;
857 /* Version 1 and later specify parameter position */
858 if (conv_data->protocol_version >= 1)
860 digitech_helper = tvb_get_uint8(data_tvb, data_offset+2);
861 hf_parameter = get_digitech_hf_parameter_id_by_position(digitech_helper);
864 proto_tree_add_item(tree, hf_parameter, data_tvb, data_offset, 2, ENC_BIG_ENDIAN);
865 data_offset += 2;
867 /* Add (optional) position to tree */
868 if (conv_data->protocol_version >= 1)
870 proto_tree_add_item(tree, hf_digitech_parameter_position, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
871 data_offset++;
874 digitech_helper = tvb_get_uint8(data_tvb, data_offset);
875 /* Values 0-127 fit in one byte */
876 if (digitech_helper < 0x80)
878 proto_tree_add_item(tree, hf_digitech_parameter_data, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
879 data_offset++;
881 else /* digitech_helper >= 0x80 */
883 uint16_t data_count;
885 /* Single byte data count */
886 if (digitech_helper > 0x80)
888 data_count = (uint16_t)(digitech_helper & ~0x80);
889 proto_tree_add_uint(tree, hf_digitech_parameter_data_count, data_tvb,
890 data_offset, 1, (uint32_t)data_count);
891 data_offset++;
893 /* Two-byte data count */
894 else /* digitech_helper == 0x80 */
896 data_count = (uint16_t)tvb_get_ntohs(data_tvb, data_offset+1);
897 proto_tree_add_uint(tree, hf_digitech_parameter_data_two_byte_count, data_tvb,
898 data_offset, 3, (uint32_t)data_count);
899 data_offset += 3;
902 proto_tree_add_item(tree, hf_digitech_parameter_multibyte_data, data_tvb,
903 data_offset, (int)data_count, ENC_NA);
904 data_offset += data_count;
907 return data_offset;
910 static int
911 get_digitech_hf_product_by_family(uint8_t family)
913 int hf_product = hf_digitech_unknown_product_id;
915 switch (family)
917 case DIGITECH_FAMILY_RP:
918 hf_product = hf_digitech_rp_product_id;
919 break;
920 default:
921 break;
924 return hf_product;
927 static void
928 dissect_digitech_procedure(uint8_t procedure, const int offset,
929 tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
931 tvbuff_t *data_tvb;
932 int data_offset;
933 int data_len;
934 uint8_t *tmp_string;
935 unsigned str_size;
936 uint16_t count;
937 uint8_t digitech_helper;
938 conversation_t *conversation;
939 digitech_conv_data_t *conv_data;
941 conversation = find_or_create_conversation(pinfo);
942 conv_data = (digitech_conv_data_t *)conversation_get_proto_data(conversation, proto_sysex_digitech);
944 if (conv_data == NULL)
946 conv_data = wmem_new(wmem_file_scope(), digitech_conv_data_t);
947 conv_data->protocol_version = 1; /* Default to version 1 */
950 /* Procedure data starts at offset and ends one byte before end
951 * of System Exclusive manufacturer payload (last byte is checksum)
953 if (tvb_reported_length(tvb) - offset < 1)
955 /* There is no DigiTech procedure data, do not attempt further
956 * dissection */
957 return;
960 data_tvb = unpack_digitech_message(pinfo, tvb, offset);
961 add_new_data_source(pinfo, data_tvb, "Unpacked Procedure Data");
963 data_offset = 0;
964 data_len = tvb_reported_length(data_tvb);
966 switch (procedure)
968 case DIGITECH_PROCEDURE_REQUEST_WHO_AM_I:
969 proto_tree_add_item(tree, hf_digitech_desired_device_id, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
970 data_offset++;
971 proto_tree_add_item(tree, hf_digitech_desired_family_id, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
972 data_offset++;
973 proto_tree_add_item(tree, hf_digitech_desired_product_id, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
974 data_offset++;
975 break;
976 case DIGITECH_PROCEDURE_RECEIVE_WHO_AM_I:
977 proto_tree_add_item(tree, hf_digitech_received_device_id, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
978 data_offset++;
980 digitech_helper = tvb_get_uint8(data_tvb, data_offset);
981 proto_tree_add_item(tree, hf_digitech_family_id, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
982 data_offset++;
984 proto_tree_add_item(tree, get_digitech_hf_product_by_family(digitech_helper),
985 data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
986 data_offset++;
988 if (data_len == 3)
990 /* Version 0, everything already decoded */
991 conv_data->protocol_version = 0;
993 else if (data_len == 4)
995 /* Version 1 and later */
996 conv_data->protocol_version = 1;
998 proto_tree_add_item(tree, hf_digitech_os_mode, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
999 data_offset++;
1001 break;
1002 case DIGITECH_PROCEDURE_REQUEST_PRESET_NAMES:
1003 proto_tree_add_item(tree, hf_digitech_preset_bank, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
1004 data_offset++;
1006 break;
1007 case DIGITECH_PROCEDURE_RECEIVE_PRESET_NAMES:
1008 proto_tree_add_item(tree, hf_digitech_preset_bank, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
1009 data_offset++;
1011 count = (uint16_t)tvb_get_uint8(data_tvb, data_offset);
1012 proto_tree_add_item(tree, hf_digitech_preset_count, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
1013 data_offset++;
1015 while ((count > 0) && (str_size = tvb_strsize(data_tvb, data_offset)))
1017 tmp_string = tvb_get_string_enc(pinfo->pool, data_tvb, data_offset, str_size - 1, ENC_ASCII);
1018 proto_tree_add_string(tree, hf_digitech_preset_name, data_tvb, data_offset, str_size, tmp_string);
1019 data_offset += (int)str_size;
1020 count--;
1022 break;
1023 case DIGITECH_PROCEDURE_REQUEST_PRESET:
1024 proto_tree_add_item(tree, hf_digitech_preset_bank, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
1025 data_offset++;
1027 proto_tree_add_item(tree, hf_digitech_preset_index, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
1028 data_offset++;
1029 break;
1030 case DIGITECH_PROCEDURE_RECEIVE_PRESET_START:
1031 /* Preset bank */
1032 proto_tree_add_item(tree, hf_digitech_preset_bank, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
1033 data_offset++;
1035 /* Preset index */
1036 proto_tree_add_item(tree, hf_digitech_preset_index, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
1037 data_offset++;
1039 /* Preset name (NULL-terminated) */
1040 str_size = tvb_strsize(data_tvb, data_offset);
1041 tmp_string = tvb_get_string_enc(pinfo->pool, data_tvb, data_offset, str_size - 1, ENC_ASCII);
1042 proto_tree_add_string(tree, hf_digitech_preset_name, data_tvb, data_offset, str_size, tmp_string);
1043 data_offset += (int)str_size;
1045 /* Preset modified (0 = unmodified, !0 = modified) */
1046 proto_tree_add_item(tree, hf_digitech_preset_modified, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
1047 data_offset++;
1049 /* Message Count */
1050 proto_tree_add_item(tree, hf_digitech_message_count, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
1051 data_offset++;
1052 break;
1053 case DIGITECH_PROCEDURE_RECEIVE_PRESET_PARAMETERS:
1054 count = tvb_get_ntohs(data_tvb, data_offset);
1055 proto_tree_add_item(tree, hf_digitech_parameter_count, data_tvb, data_offset, 2, ENC_BIG_ENDIAN);
1056 data_offset += 2;
1057 while (count > 0)
1059 data_offset = dissect_digitech_parameter(data_tvb, tree, conv_data, data_offset);
1060 count--;
1062 break;
1063 case DIGITECH_PROCEDURE_RECEIVE_PARAMETER_VALUE:
1064 data_offset = dissect_digitech_parameter(data_tvb, tree, conv_data, data_offset);
1065 break;
1066 case DIGITECH_PROCEDURE_ACK:
1067 proto_tree_add_item(tree, hf_digitech_ack_request_proc_id, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
1068 data_offset++;
1069 break;
1070 case DIGITECH_PROCEDURE_NACK:
1071 proto_tree_add_item(tree, hf_digitech_nack_request_proc_id, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
1072 data_offset++;
1073 break;
1074 default:
1075 break;
1078 if (data_offset < data_len)
1080 proto_tree_add_expert(tree, pinfo, &ei_digitech_undecoded,
1081 data_tvb, data_offset, data_len - data_offset);
1085 static int
1086 dissect_sysex_digitech_command(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_)
1088 int offset = 0;
1089 uint8_t procedure_id;
1090 uint8_t digitech_helper;
1091 proto_item *ti = NULL;
1092 proto_tree *tree = NULL;
1093 const uint8_t *data_ptr;
1094 int len;
1095 int i;
1097 col_set_str(pinfo->cinfo, COL_PROTOCOL, "X MIDI");
1098 col_set_str(pinfo->cinfo, COL_INFO, "DigiTech X MIDI SysEx");
1100 ti = proto_tree_add_protocol_format(parent_tree, proto_sysex_digitech, tvb, 0, -1, "DigiTech X MIDI SysEx");
1101 tree = proto_item_add_subtree(ti, ett_sysex_digitech);
1103 proto_tree_add_item(tree, hf_digitech_device_id, tvb, offset, 1, ENC_BIG_ENDIAN);
1104 offset++;
1106 digitech_helper = tvb_get_uint8(tvb, offset);
1107 proto_tree_add_item(tree, hf_digitech_family_id, tvb, offset, 1, ENC_BIG_ENDIAN);
1108 offset++;
1110 proto_tree_add_item(tree, get_digitech_hf_product_by_family(digitech_helper),
1111 tvb, offset, 1, ENC_BIG_ENDIAN);
1112 offset++;
1114 procedure_id = tvb_get_uint8(tvb, offset);
1115 proto_tree_add_item(tree, hf_digitech_procedure_id, tvb, offset, 1, ENC_BIG_ENDIAN);
1116 offset++;
1118 dissect_digitech_procedure(procedure_id, offset, tvb, pinfo, tree);
1120 len = tvb_reported_length(tvb) - 1;
1121 offset = len; /* Last byte is checksum */
1122 data_ptr = tvb_get_ptr(tvb, 0, len);
1123 /* Calculate checksum. Start with 0x10 as that's the XOR of DOD Electronics Corp.
1124 * The Extended Manufacturer ID is part of checksum but is not part of payload tvb.
1126 for (i = 0, digitech_helper = 0x10; i < len; ++i)
1128 digitech_helper ^= *data_ptr++;
1131 proto_tree_add_checksum(tree, tvb, offset, hf_digitech_checksum, hf_digitech_checksum_status, &ei_digitech_checksum_bad, pinfo, digitech_helper,
1132 ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
1133 offset++;
1135 return offset;
1138 void
1139 proto_register_sysex_digitech(void)
1141 static hf_register_info hf[] = {
1142 /* DigiTech manufacturer-specific fields */
1143 { &hf_digitech_device_id,
1144 { "Device ID", "sysex_digitech.device_id", FT_UINT8, BASE_HEX,
1145 NULL, 0, NULL, HFILL }},
1146 { &hf_digitech_family_id,
1147 { "Family ID", "sysex_digitech.family_id", FT_UINT8, BASE_HEX,
1148 VALS(digitech_family_id), 0, NULL, HFILL }},
1149 { &hf_digitech_unknown_product_id,
1150 { "Product ID", "sysex_digitech.product_id", FT_UINT8, BASE_HEX,
1151 NULL, 0, NULL, HFILL }},
1152 { &hf_digitech_rp_product_id,
1153 { "Product ID", "sysex_digitech.product_id", FT_UINT8, BASE_HEX,
1154 VALS(digitech_rp_product_id), 0, NULL, HFILL }},
1155 { &hf_digitech_procedure_id,
1156 { "Procedure ID", "sysex_digitech.procedure_id", FT_UINT8, BASE_HEX | BASE_EXT_STRING,
1157 &digitech_procedures_ext, 0, NULL, HFILL }},
1159 { &hf_digitech_desired_device_id,
1160 { "Desired Device ID", "sysex_digitech.desired_device_id", FT_UINT8, BASE_HEX,
1161 NULL, 0, NULL, HFILL }},
1162 { &hf_digitech_desired_family_id,
1163 { "Desired Family ID", "sysex_digitech.desired_family_id", FT_UINT8, BASE_HEX,
1164 NULL, 0, NULL, HFILL }},
1165 { &hf_digitech_desired_product_id,
1166 { "Desired Product ID", "sysex_digitech.desired_product_id", FT_UINT8, BASE_HEX,
1167 NULL, 0, NULL, HFILL }},
1168 { &hf_digitech_received_device_id,
1169 { "Device ID", "sysex_digitech.received_device_id", FT_UINT8, BASE_HEX,
1170 NULL, 0, NULL, HFILL }},
1171 { &hf_digitech_os_mode,
1172 { "OS Mode", "sysex_digitech.os_mode", FT_UINT8, BASE_HEX,
1173 VALS(digitech_os_modes), 0, "DigiTech OS Mode", HFILL }},
1175 { &hf_digitech_preset_bank,
1176 { "Preset Bank", "sysex_digitech.preset_bank", FT_UINT8, BASE_HEX,
1177 VALS(digitech_preset_banks), 0, NULL, HFILL }},
1178 { &hf_digitech_preset_index,
1179 { "Preset Index", "sysex_digitech.preset_index", FT_UINT8, BASE_HEX,
1180 NULL, 0, NULL, HFILL }},
1181 { &hf_digitech_preset_count,
1182 { "Preset Count", "sysex_digitech.preset_count", FT_UINT8, BASE_DEC,
1183 NULL, 0, NULL, HFILL }},
1184 { &hf_digitech_preset_name,
1185 { "Preset Name", "sysex_digitech.preset_name", FT_STRING, BASE_NONE,
1186 NULL, 0, NULL, HFILL }},
1187 { &hf_digitech_preset_modified,
1188 { "Preset Modified", "sysex_digitech.preset_modified", FT_BOOLEAN, BASE_NONE,
1189 TFS(&tfs_yes_no), 0, "Modified flag (0 = unmodified)", HFILL }},
1191 { &hf_digitech_message_count,
1192 { "Messages to follow", "sysex_digitech.message_count", FT_UINT8, BASE_DEC,
1193 NULL, 0, "Number of messages to follow", HFILL }},
1195 { &hf_digitech_parameter_count,
1196 { "Parameter Count", "sysex_digitech.parameter_count", FT_UINT16, BASE_DEC,
1197 NULL, 0, NULL, HFILL }},
1199 { &hf_digitech_parameter_id,
1200 { "Parameter ID", "sysex_digitech.parameter_id", FT_UINT16, BASE_DEC,
1201 NULL, 0, NULL, HFILL }},
1202 { &hf_digitech_parameter_id_global,
1203 { "Parameter ID", "sysex_digitech.parameter_id", FT_UINT16, BASE_DEC,
1204 VALS(digitech_parameter_ids_global), 0, NULL, HFILL }},
1205 { &hf_digitech_parameter_id_pickup,
1206 { "Parameter ID", "sysex_digitech.parameter_id", FT_UINT16, BASE_DEC,
1207 VALS(digitech_parameter_ids_pickup), 0, NULL, HFILL }},
1208 { &hf_digitech_parameter_id_wah,
1209 { "Parameter ID", "sysex_digitech.parameter_id", FT_UINT16, BASE_DEC,
1210 VALS(digitech_parameter_ids_wah), 0, NULL, HFILL }},
1211 { &hf_digitech_parameter_id_compressor,
1212 { "Parameter ID", "sysex_digitech.parameter_id", FT_UINT16, BASE_DEC,
1213 VALS(digitech_parameter_ids_compressor), 0, NULL, HFILL }},
1214 { &hf_digitech_parameter_id_gnx3k_whammy,
1215 { "Parameter ID", "sysex_digitech.parameter_id", FT_UINT16, BASE_DEC | BASE_EXT_STRING,
1216 &digitech_parameter_ids_gnx3k_whammy_ext, 0, NULL, HFILL }},
1217 { &hf_digitech_parameter_id_distortion,
1218 { "Parameter ID", "sysex_digitech.parameter_id", FT_UINT16, BASE_DEC | BASE_EXT_STRING,
1219 &digitech_parameter_ids_distortion_ext, 0, NULL, HFILL }},
1220 { &hf_digitech_parameter_id_amp_channel,
1221 { "Parameter ID", "sysex_digitech.parameter_id", FT_UINT16, BASE_DEC,
1222 VALS(digitech_parameter_ids_amp_channel), 0, NULL, HFILL }},
1223 { &hf_digitech_parameter_id_amp,
1224 { "Parameter ID", "sysex_digitech.parameter_id", FT_UINT16, BASE_DEC | BASE_EXT_STRING,
1225 &digitech_parameter_ids_amp_ext, 0, NULL, HFILL }},
1226 { &hf_digitech_parameter_id_amp_cabinet,
1227 { "Parameter ID", "sysex_digitech.parameter_id", FT_UINT16, BASE_DEC,
1228 VALS(digitech_parameter_ids_amp_cabinet), 0, NULL, HFILL }},
1229 { &hf_digitech_parameter_id_amp_b,
1230 { "Parameter ID", "sysex_digitech.parameter_id", FT_UINT16, BASE_DEC,
1231 VALS(digitech_parameter_ids_amp_b), 0, NULL, HFILL }},
1232 { &hf_digitech_parameter_id_amp_cabinet_b,
1233 { "Parameter ID", "sysex_digitech.parameter_id", FT_UINT16, BASE_DEC,
1234 VALS(digitech_parameter_ids_amp_cabinet_b), 0, NULL, HFILL }},
1235 { &hf_digitech_parameter_id_noisegate,
1236 { "Parameter ID", "sysex_digitech.parameter_id", FT_UINT16, BASE_DEC,
1237 VALS(digitech_parameter_ids_noisegate), 0, NULL, HFILL }},
1238 { &hf_digitech_parameter_id_volume_pre_fx,
1239 { "Parameter ID", "sysex_digitech.parameter_id", FT_UINT16, BASE_DEC,
1240 VALS(digitech_parameter_ids_volume_pre_fx), 0, NULL, HFILL }},
1241 { &hf_digitech_parameter_id_chorusfx,
1242 { "Parameter ID", "sysex_digitech.parameter_id", FT_UINT16, BASE_DEC | BASE_EXT_STRING,
1243 &digitech_parameter_ids_chorusfx_ext, 0, NULL, HFILL }},
1244 { &hf_digitech_parameter_id_delay,
1245 { "Parameter ID", "sysex_digitech.parameter_id", FT_UINT16, BASE_DEC | BASE_EXT_STRING,
1246 &digitech_parameter_ids_delay_ext, 0, NULL, HFILL }},
1247 { &hf_digitech_parameter_id_reverb,
1248 { "Parameter ID", "sysex_digitech.parameter_id", FT_UINT16, BASE_DEC,
1249 VALS(digitech_parameter_ids_reverb), 0, NULL, HFILL }},
1250 { &hf_digitech_parameter_id_volume_post_fx,
1251 { "Parameter ID", "sysex_digitech.parameter_id", FT_UINT16, BASE_DEC,
1252 VALS(digitech_parameter_ids_volume_post_fx), 0, NULL, HFILL }},
1253 { &hf_digitech_parameter_id_preset,
1254 { "Parameter ID", "sysex_digitech.parameter_id", FT_UINT16, BASE_DEC,
1255 VALS(digitech_parameter_ids_preset), 0, NULL, HFILL }},
1256 { &hf_digitech_parameter_id_wah_min_max,
1257 { "Parameter ID", "sysex_digitech.parameter_id", FT_UINT16, BASE_DEC,
1258 VALS(digitech_parameter_ids_wah_min_max), 0, NULL, HFILL }},
1259 { &hf_digitech_parameter_id_equalizer,
1260 { "Parameter ID", "sysex_digitech.parameter_id", FT_UINT16, BASE_DEC,
1261 VALS(digitech_parameter_ids_equalizer), 0, NULL, HFILL }},
1262 { &hf_digitech_parameter_id_equalizer_b,
1263 { "Parameter ID", "sysex_digitech.parameter_id", FT_UINT16, BASE_DEC,
1264 VALS(digitech_parameter_ids_equalizer_b), 0, NULL, HFILL }},
1265 { &hf_digitech_parameter_id_amp_loop,
1266 { "Parameter ID", "sysex_digitech.parameter_id", FT_UINT16, BASE_DEC,
1267 VALS(digitech_parameter_ids_amp_loop), 0, NULL, HFILL }},
1270 { &hf_digitech_parameter_position,
1271 { "Parameter position", "sysex_digitech.parameter_position", FT_UINT8, BASE_DEC | BASE_EXT_STRING,
1272 &digitech_parameter_positions_ext, 0, NULL, HFILL }},
1273 { &hf_digitech_parameter_data,
1274 { "Parameter data", "sysex_digitech.parameter_data", FT_UINT8, BASE_DEC,
1275 NULL, 0, NULL, HFILL }},
1276 { &hf_digitech_parameter_data_count,
1277 { "Parameter value count", "sysex_digitech.parameter_value_count", FT_UINT8, BASE_DEC,
1278 NULL, 0, NULL, HFILL }},
1279 { &hf_digitech_parameter_data_two_byte_count,
1280 { "Parameter data count", "sysex_digitech.parameter_data_count", FT_UINT24, BASE_DEC,
1281 NULL, 0, NULL, HFILL }},
1282 { &hf_digitech_parameter_multibyte_data,
1283 { "Parameter data", "sysex_digitech.parameter_multibyte_data", FT_BYTES, BASE_NONE,
1284 NULL, 0, NULL, HFILL }},
1286 { &hf_digitech_ack_request_proc_id,
1287 { "Requesting Procedure ID", "sysex_digitech.ack.procedure_id", FT_UINT8, BASE_HEX | BASE_EXT_STRING,
1288 &digitech_procedures_ext, 0, "Procedure ID of the request being ACKed", HFILL }},
1289 { &hf_digitech_nack_request_proc_id,
1290 { "Requesting Procedure ID", "sysex_digitech.ack.procedure_id", FT_UINT8, BASE_HEX | BASE_EXT_STRING,
1291 &digitech_procedures_ext, 0, "Procedure ID of the request being NACKed", HFILL }},
1293 { &hf_digitech_checksum,
1294 { "Checksum", "sysex_digitech.checksum", FT_UINT8, BASE_HEX,
1295 NULL, 0, NULL, HFILL }},
1296 { &hf_digitech_checksum_status,
1297 { "Checksum Status", "sysex_digitech.checksum.status", FT_UINT8, BASE_NONE,
1298 VALS(proto_checksum_vals), 0, NULL, HFILL }},
1301 static int *sysex_digitech_subtrees[] = {
1302 &ett_sysex_digitech
1305 static ei_register_info ei[] = {
1306 { &ei_digitech_checksum_bad, { "sysex_digitech.checksum_bad", PI_CHECKSUM, PI_WARN, "Bad checksum", EXPFILL }},
1307 { &ei_digitech_undecoded, { "sysex_digitech.undecoded", PI_UNDECODED, PI_WARN, "Not dissected yet (report to wireshark.org)", EXPFILL }},
1310 expert_module_t* expert_sysex_digitech;
1312 proto_sysex_digitech = proto_register_protocol("MIDI System Exclusive DigiTech", "SYSEX DigiTech", "sysex_digitech");
1313 proto_register_field_array(proto_sysex_digitech, hf, array_length(hf));
1314 proto_register_subtree_array(sysex_digitech_subtrees, array_length(sysex_digitech_subtrees));
1315 expert_sysex_digitech = expert_register_protocol(proto_sysex_digitech);
1316 expert_register_field_array(expert_sysex_digitech, ei, array_length(ei));
1318 sysex_digitech_handle = register_dissector("sysex_digitech", dissect_sysex_digitech_command, proto_sysex_digitech);
1321 void
1322 proto_reg_handoff_sysex_digitech(void)
1324 dissector_add_uint("sysex.manufacturer", SYSEX_MANUFACTURER_DOD, sysex_digitech_handle);
1328 * Editor modelines
1330 * Local Variables:
1331 * c-basic-offset: 4
1332 * tab-width: 8
1333 * indent-tabs-mode: nil
1334 * End:
1336 * ex: set shiftwidth=4 tabstop=8 expandtab:
1337 * :indentSize=4:tabSize=8:noTabs=true: