HACK: pinfo->private_data points to smb_info again
[wireshark-wip.git] / epan / dissectors / packet-sysex.c
blob4c94723b4ad70f11ae295a99dada079bdd05175b
1 /* packet-sysex.c
3 * $Id$
5 * MIDI SysEx dissector
6 * Tomasz Mon 2012
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 #include "config.h"
26 #include <glib.h>
27 #include <epan/conversation.h>
28 #include <epan/wmem/wmem.h>
29 #include <epan/expert.h>
30 #include <epan/packet.h>
31 #include <epan/reassemble.h>
32 #include <epan/tfs.h>
34 /* protocols and header fields */
35 static int proto_sysex = -1;
36 static int hf_sysex_message_start = -1;
37 static int hf_sysex_manufacturer_id = -1;
38 static int hf_sysex_three_byte_manufacturer_id = -1;
39 static int hf_sysex_device_id = -1;
40 static int hf_sysex_message_eox = -1;
42 static int hf_digitech_family_id = -1;
43 static int hf_digitech_rp_product_id = -1;
44 static int hf_digitech_unknown_product_id = -1;
45 static int hf_digitech_procedure_id = -1;
47 static int hf_digitech_desired_device_id = -1;
48 static int hf_digitech_desired_family_id = -1;
49 static int hf_digitech_desired_product_id = -1;
50 static int hf_digitech_device_id = -1;
51 static int hf_digitech_os_mode = -1;
53 static int hf_digitech_preset_bank = -1;
54 static int hf_digitech_preset_index = -1;
55 static int hf_digitech_preset_count = -1;
56 static int hf_digitech_preset_name = -1;
57 static int hf_digitech_preset_modified = -1;
59 static int hf_digitech_message_count = -1;
61 static int hf_digitech_parameter_count = -1;
62 static int hf_digitech_parameter_id = -1;
63 static int hf_digitech_parameter_id_global = -1;
64 static int hf_digitech_parameter_id_pickup = -1;
65 static int hf_digitech_parameter_id_wah = -1;
66 static int hf_digitech_parameter_id_compressor = -1;
67 static int hf_digitech_parameter_id_gnx3k_whammy = -1;
68 static int hf_digitech_parameter_id_distortion = -1;
69 static int hf_digitech_parameter_id_amp_channel = -1;
70 static int hf_digitech_parameter_id_amp = -1;
71 static int hf_digitech_parameter_id_amp_cabinet = -1;
72 static int hf_digitech_parameter_id_amp_b = -1;
73 static int hf_digitech_parameter_id_amp_cabinet_b = -1;
74 static int hf_digitech_parameter_id_noisegate = -1;
75 static int hf_digitech_parameter_id_volume_pre_fx = -1;
76 static int hf_digitech_parameter_id_chorusfx = -1;
77 static int hf_digitech_parameter_id_delay = -1;
78 static int hf_digitech_parameter_id_reverb = -1;
79 static int hf_digitech_parameter_id_volume_post_fx = -1;
80 static int hf_digitech_parameter_id_preset = -1;
81 static int hf_digitech_parameter_id_wah_min_max = -1;
82 static int hf_digitech_parameter_id_equalizer = -1;
83 static int hf_digitech_parameter_id_equalizer_b = -1;
84 static int hf_digitech_parameter_id_amp_loop = -1;
86 static int hf_digitech_parameter_position = -1;
87 static int hf_digitech_parameter_data = -1;
88 static int hf_digitech_parameter_data_count = -1;
89 static int hf_digitech_parameter_data_two_byte_count = -1;
90 static int hf_digitech_parameter_multibyte_data = -1;
92 static int hf_digitech_ack_request_proc_id = -1;
93 static int hf_digitech_nack_request_proc_id = -1;
95 static int hf_digitech_checksum = -1;
97 static gint ett_sysex = -1;
99 static expert_field ei_sysex_message_start_byte = EI_INIT;
100 static expert_field ei_digitech_checksum_bad = EI_INIT;
101 static expert_field ei_sysex_message_end_byte = EI_INIT;
102 static expert_field ei_sysex_undecoded = EI_INIT;
104 #define SYSEX_MANUFACTURER_DOD 0x000010
106 static const value_string sysex_three_byte_manufacturer_id[] = {
107 {SYSEX_MANUFACTURER_DOD, "DOD Electronics Corp."},
108 {0, NULL}
111 typedef struct _digitech_conv_data_t {
112 gint protocol_version;
113 } digitech_conv_data_t;
115 #define DIGITECH_FAMILY_X_FLOOR 0x5C
116 #define DIGITECH_FAMILY_JAMMAN 0x5D
117 #define DIGITECH_FAMILY_RP 0x5E
118 #define DIGITECH_FAMILY_RACK 0x5F
119 #define DIGITECH_FAMILY_VOCALIST 0x60
121 static const value_string digitech_family_id[] = {
122 {DIGITECH_FAMILY_X_FLOOR, "\"X\" Floor Guitar Processor"},
123 {DIGITECH_FAMILY_JAMMAN, "JamMan"},
124 {DIGITECH_FAMILY_RP, "RP series"},
125 {DIGITECH_FAMILY_RACK, "Rack"},
126 {DIGITECH_FAMILY_VOCALIST, "Vocalist"},
127 {0x7F, "All"},
128 {0, NULL}
131 static const value_string digitech_rp_product_id[] = {
132 {0x01, "RP150"},
133 {0x02, "RP250"},
134 {0x03, "RP350"},
135 {0x04, "RP370"},
136 {0x05, "RP500"},
137 {0x06, "RP1000"},
138 {0x07, "RP155"},
139 {0x08, "RP255"},
140 {0x09, "RP355"},
141 {0, NULL}
144 typedef enum _digitech_procedure_id {
145 DIGITECH_PROCEDURE_REQUEST_WHO_AM_I = 0x01,
146 DIGITECH_PROCEDURE_RECEIVE_WHO_AM_I = 0x02,
148 DIGITECH_PROCEDURE_REQUEST_DEVICE_CONFIGURATION = 0x08,
149 DIGITECH_PROCEDURE_RECEIVE_DEVICE_CONFIGURATION = 0x09,
151 DIGITECH_PROCEDURE_REQUEST_GLOBAL_PARAMETERS = 0x10,
152 DIGITECH_PROCEDURE_RECEIVE_GLOBAL_PARAMETERS = 0x11,
154 DIGITECH_PROCEDURE_REQUEST_BULK_DUMP = 0x18,
155 DIGITECH_PROCEDURE_RECEIVE_BULK_DUMP_START = 0x19,
156 DIGITECH_PROCEDURE_RECEIVE_BULK_DUMP_END = 0x1B,
158 DIGITECH_PROCEDURE_RECEIVE_USER_PRESET_INDEX_TABLE = 0x20,
160 DIGITECH_PROCEDURE_REQUEST_PRESET_NAMES = 0x21,
161 DIGITECH_PROCEDURE_RECEIVE_PRESET_NAMES = 0x22,
163 DIGITECH_PROCEDURE_REQUEST_PRESET_NAME = 0x28,
164 DIGITECH_PROCEDURE_RECEIVE_PRESET_NAME = 0x29,
166 DIGITECH_PROCEDURE_REQUEST_PRESET = 0x2A,
167 DIGITECH_PROCEDURE_RECEIVE_PRESET_START = 0x2B,
168 DIGITECH_PROCEDURE_RECEIVE_PRESET_END = 0x2C,
169 DIGITECH_PROCEDURE_RECEIVE_PRESET_PARAMETERS = 0x2D,
171 DIGITECH_PROCEDURE_LOAD_EDIT_BUFFER_PRESET = 0x38, /* version 0 only
172 use move preset in later versions */
174 DIGITECH_PROCEDURE_MOVE_PRESET = 0x39,
176 DIGITECH_PROCEDURE_REQUEST_MODIFIER_LINKABLE_LIST = 0x3A,
177 DIGITECH_PROCEDURE_RECEIVE_MODIFIER_LINKABLE_LIST = 0x3B,
179 DIGITECH_PROCEDURE_REQUEST_PARAMETER_VALUE = 0x40,
180 DIGITECH_PROCEDURE_RECEIVE_PARAMETER_VALUE = 0x41,
182 /* version 1 and later */
183 DIGITECH_PROCEDURE_REQUEST_OBJECT_NAMES = 0x50,
184 DIGITECH_PROCEDURE_RECEIVE_OBJECT_NAMES = 0x51,
185 DIGITECH_PROCEDURE_REQUEST_OBJECT_NAME = 0x52,
186 DIGITECH_PROCEDURE_RECEIVE_OBJECT_NAME = 0x53,
187 DIGITECH_PROCEDURE_REQUEST_OBJECT = 0x54,
188 DIGITECH_PROCEDURE_RECEIVE_OBJECT = 0x55,
189 DIGITECH_PROCEDURE_MOVE_OBJECT = 0x56,
190 DIGITECH_PROCEDURE_DELETE_OBJECT = 0x57,
191 DIGITECH_PROCEDURE_REQUEST_TABLE = 0x5A,
192 DIGITECH_PROCEDURE_RECEIVE_TABLE = 0x5B,
194 DIGITECH_PROCEDURE_RECEIVE_DEVICE_NOTIFICATION = 0x70,
196 DIGITECH_PROCEDURE_START_OS_DOWNLOAD = 0x71,
197 DIGITECH_PROCEDURE_RESTART_DEVICE = 0x72,
198 DIGITECH_PROCEDURE_REQUEST_DEBUG_DATA = 0x73,
199 DIGITECH_PROCEDURE_RECEIVE_DEBUG_DATA = 0x74,
201 DIGITECH_PROCEDURE_ACK = 0x7E,
202 DIGITECH_PROCEDURE_NACK = 0x7F
203 } digitech_procedure_id;
205 static const value_string digitech_procedures[] = {
206 {DIGITECH_PROCEDURE_REQUEST_WHO_AM_I, "Request WhoAmI"},
207 {DIGITECH_PROCEDURE_RECEIVE_WHO_AM_I, "Receive WhoAmI"},
208 {DIGITECH_PROCEDURE_REQUEST_DEVICE_CONFIGURATION, "Request Device Configuration"},
209 {DIGITECH_PROCEDURE_RECEIVE_DEVICE_CONFIGURATION, "Receive Device Configuration"},
210 {DIGITECH_PROCEDURE_REQUEST_GLOBAL_PARAMETERS, "Request Global Parameters"},
211 {DIGITECH_PROCEDURE_RECEIVE_GLOBAL_PARAMETERS, "Receive Global Parameters"},
212 {DIGITECH_PROCEDURE_REQUEST_BULK_DUMP, "Request Bulk Dump"},
213 {DIGITECH_PROCEDURE_RECEIVE_BULK_DUMP_START, "Receive Bulk Dump Start"},
214 {DIGITECH_PROCEDURE_RECEIVE_BULK_DUMP_END, "Receive Bulk Dump End"},
215 {DIGITECH_PROCEDURE_RECEIVE_USER_PRESET_INDEX_TABLE, "Receive User Preset Index Table"},
216 {DIGITECH_PROCEDURE_REQUEST_PRESET_NAMES, "Request Preset Names"},
217 {DIGITECH_PROCEDURE_RECEIVE_PRESET_NAMES, "Receive Preset Names"},
218 {DIGITECH_PROCEDURE_REQUEST_PRESET_NAME, "Request Preset Name"},
219 {DIGITECH_PROCEDURE_RECEIVE_PRESET_NAME, "Receive Preset Name"},
220 {DIGITECH_PROCEDURE_REQUEST_PRESET, "Request Preset"},
221 {DIGITECH_PROCEDURE_RECEIVE_PRESET_START, "Receive Preset Start"},
222 {DIGITECH_PROCEDURE_RECEIVE_PRESET_END, "Receive Preset End"},
223 {DIGITECH_PROCEDURE_RECEIVE_PRESET_PARAMETERS, "Receive Preset Parameters"},
224 {DIGITECH_PROCEDURE_LOAD_EDIT_BUFFER_PRESET, "Load Edit Buffer Preset"},
225 {DIGITECH_PROCEDURE_MOVE_PRESET, "Move Preset"},
226 {DIGITECH_PROCEDURE_REQUEST_MODIFIER_LINKABLE_LIST, "Request Modifier-Linkable List"},
227 {DIGITECH_PROCEDURE_RECEIVE_MODIFIER_LINKABLE_LIST, "Receive Modifier-Linkable List"},
228 {DIGITECH_PROCEDURE_REQUEST_PARAMETER_VALUE, "Request Parameter Value"},
229 {DIGITECH_PROCEDURE_RECEIVE_PARAMETER_VALUE, "Receive Parameter Value"},
230 {DIGITECH_PROCEDURE_REQUEST_OBJECT_NAMES, "Request Object Names"},
231 {DIGITECH_PROCEDURE_RECEIVE_OBJECT_NAMES, "Receive Object Names"},
232 {DIGITECH_PROCEDURE_REQUEST_OBJECT_NAME, "Request Object Name"},
233 {DIGITECH_PROCEDURE_RECEIVE_OBJECT_NAME, "Receive Object Name"},
234 {DIGITECH_PROCEDURE_REQUEST_OBJECT, "Request Object"},
235 {DIGITECH_PROCEDURE_RECEIVE_OBJECT, "Receive Object"},
236 {DIGITECH_PROCEDURE_MOVE_OBJECT, "Move Object"},
237 {DIGITECH_PROCEDURE_DELETE_OBJECT, "Delete Object"},
238 {DIGITECH_PROCEDURE_REQUEST_TABLE, "Request Table"},
239 {DIGITECH_PROCEDURE_RECEIVE_TABLE, "Receive Table"},
240 {DIGITECH_PROCEDURE_RECEIVE_DEVICE_NOTIFICATION, "Receive Device Notification"},
241 {DIGITECH_PROCEDURE_START_OS_DOWNLOAD, "Start OS Download"},
242 {DIGITECH_PROCEDURE_RESTART_DEVICE, "Restart Device"},
243 {DIGITECH_PROCEDURE_REQUEST_DEBUG_DATA, "Request Debug Data"},
244 {DIGITECH_PROCEDURE_RECEIVE_DEBUG_DATA, "Receive Debug Data"},
245 {DIGITECH_PROCEDURE_ACK, "ACK"},
246 {DIGITECH_PROCEDURE_NACK, "NACK"},
247 {0, NULL}
250 static const value_string digitech_os_modes[] = {
251 {0, "Normal"},
252 {1, "Flash update"},
253 {0, NULL}
256 static const value_string digitech_preset_banks[] = {
257 {0, "Factory (fixed) bank"},
258 {1, "User bank"},
259 {2, "Artist bank"},
260 {3, "Media card (CF or other)"},
261 {4, "Current preset edit buffer"},
262 {5, "Second factory bank"},
263 {6, "External preset"},
264 {0, NULL}
267 static const value_string digitech_parameter_ids_global[] = {
268 {12361, "Amp/Cab Bypass On/Off"},
269 {12298, "GUI Mode On/Off"},
270 {0, NULL}
273 static const value_string digitech_parameter_ids_pickup[] = {
274 {65, "Pickup On/Off"},
275 {0, NULL}
278 static const value_string digitech_parameter_ids_wah[] = {
279 {129, "Wah On/Off"},
280 {133, "Wah Level"},
281 {0, NULL}
284 static const value_string digitech_parameter_ids_compressor[] = {
285 {193, "Compressor On/Off"},
286 {194, "Compressor Attack"},
287 {195, "Compressor Ratio"},
288 {200, "Compressor Threshold"},
289 {201, "Compressor Gain"},
290 {208, "Compressor Sustain"},
291 {209, "Compressor Tone"},
292 {210, "Compressor Level"},
293 {211, "Compressor Attack"},
294 {212, "Compressor Output"},
295 {213, "Compressor Sensitivity"},
296 {0, NULL}
299 static const value_string digitech_parameter_ids_gnx3k_whammy[] = {
300 {769, "Whammy/IPS On/Off"},
301 {1667, "Whammy/IPS Detune Level"},
302 {1670, "Whammy/IPS Detune Shift Amount"},
303 {1731, "Whammy/IPS Pitch Shift Level"},
304 {1732, "Whammy/IPS Pitch Shift Shift Amount"},
305 {1795, "Whammy/IPS Whammy Pedal"},
306 {1796, "Whammy/IPS Whammy Mix"},
307 {1797, "Whammy/IPS Whammy Shift Amount"},
308 {2754, "Whammy/IPS IPS Shift Amount"},
309 {2755, "Whammy/IPS IPS Scale"},
310 {2756, "Whammy/IPS IPS Key"},
311 {2757, "Whammy/IPS IPS Level"},
312 {2818, "Whammy/IPS Talker Mic Level"},
313 {0, NULL}
316 static const value_string digitech_parameter_ids_distortion[] = {
317 {2433, "Distortion On/Off"},
318 {2434, "Distortion Screamer Drive"},
319 {2435, "Distortion Screamer Tone"},
320 {2436, "Distortion Screamer Level"},
321 {2437, "Distortion Rodent Dist"},
322 {2438, "Distortion Rodent Filter"},
323 {2439, "Distortion Rodent Level"},
324 {2440, "Distortion DS Gain"},
325 {2441, "Distortion DS Tone"},
326 {2442, "Distortion DS Level"},
327 {2443, "Distortion DOD250 Gain"},
328 {2444, "Distortion DOD250 Level"},
329 {2445, "Distortion Big MP Sustain"},
330 {2446, "Distortion Big MP Tone"},
331 {2447, "Distortion Big MP Volume"},
332 {2448, "Distortion GuyOD Drive"},
333 {2449, "Distortion GuyOD Level"},
334 {2450, "Distortion Sparkdrive Gain"},
335 {2451, "Distortion Sparkdrive Tone"},
336 {2452, "Distortion Sparkdrive Clean"},
337 {2453, "Distortion Sparkdrive Volume"},
338 {2454, "Distortion Grunge Grunge"},
339 {2455, "Distortion Grunge Butt"},
340 {2456, "Distortion Grunge Face"},
341 {2457, "Distortion Grunge Loud"},
342 {2458, "Distortion Fuzzy Fuzz"},
343 {2459, "Distortion Fuzzy Volume"},
344 {2460, "Distortion Zone Gain"},
345 {2461, "Distortion Zone Mid freq"},
346 {2462, "Distortion Zone Mid level"},
347 {2463, "Distortion Zone Low"},
348 {2464, "Distortion Zone High"},
349 {2465, "Distortion Zone Level"},
350 {2466, "Distortion 8tavia Drive"},
351 {2467, "Distortion 8tavia Volume"},
352 {2468, "Distortion MX Dist"},
353 {2469, "Distortion MX Output"},
354 {2470, "Distortion Gonk Suck"},
355 {2471, "Distortion Gonk Smear"},
356 {2472, "Distortion Gonk Heave"},
357 {2473, "Distortion 808 Overdrive"},
358 {2474, "Distortion 808 Tone"},
359 {2475, "Distortion 808 Level"},
360 {2476, "Distortion Death Mid"},
361 {2477, "Distortion Death Low"},
362 {2478, "Distortion Death Level"},
363 {2479, "Distortion Death High"},
364 {2480, "Distortion Gonk Gonk"},
365 {2481, "Distortion Fuzzlator Fuzz"},
366 {2482, "Distortion Fuzzlator Tone"},
367 {2483, "Distortion Fuzzlator LooseTight"},
368 {2484, "Distortion Fuzzlator Volume"},
369 {2485, "Distortion Classic Fuzz Fuzz"},
370 {2486, "Distortion Classic Fuzz Tone"},
371 {2487, "Distortion Classic Fuzz Volume"},
372 {2488, "Distortion Redline Gain"},
373 {2489, "Distortion Redline Low"},
374 {2490, "Distortion Redline High"},
375 {2491, "Distortion Redline Level"},
376 {2492, "Distortion OC Drive Drive"},
377 {2493, "Distortion OC Drive HP/LP"},
378 {2494, "Distortion OC Drive Tone"},
379 {2495, "Distortion OC Drive Level"},
380 {2562, "Distortion TS Mod Drive"},
381 {2563, "Distortion TS Mod Level"},
382 {2564, "Distortion TS Mod Tone"},
383 {2565, "Distortion SD Overdrive Drive"},
384 {2566, "Distortion SD Overdrive Tone"},
385 {2567, "Distortion SD Overdrive Level"},
386 {2568, "Distortion OD Overdrive Overdrive"},
387 {2569, "Distortion OD Overdrive Level"},
388 {2570, "Distortion Amp Driver Gain"},
389 {2571, "Distortion Amp Driver Mid Boost"},
390 {2572, "Distortion Amp Driver Level"},
391 {0, NULL}
394 static const value_string digitech_parameter_ids_amp_channel[] = {
395 {260, "Amp Channel Amp Channel"},
396 {261, "Amp Channel Warp"},
397 {262, "Amp Channel Amp Warp"},
398 {263, "Amp Channel Cabinet Warp"},
399 {0, NULL}
402 static const value_string digitech_parameter_ids_amp[] = {
403 {265, "Amplifier On/Off"},
404 {2497, "Amplifier Gain"},
405 {2498, "Amplifier Level"},
406 {2499, "Channel 1 Bass Freq"},
407 {2500, "Channel 1 Bass Level"},
408 {2501, "Channel 1 Mid Freq"},
409 {2502, "Channel 1 Mid Level"},
410 {2503, "Channel 1 Treb Freq"},
411 {2504, "Channel 1 Treb Level"},
412 {2505, "EQ Enable On/Off"},
413 {2506, "Channel 1 Presence"},
414 {2507, "Amplifier Bass"},
415 {2508, "Amplifier Mid"},
416 {2509, "Amplifier Treble"},
417 {0, NULL}
420 static const value_string digitech_parameter_ids_amp_cabinet[] = {
421 {2561, "Channel 1 Tuning"},
422 {0, NULL}
425 static const value_string digitech_parameter_ids_amp_b[] = {
426 {265, "Amplifier B On/Off"},
427 {2497, "Amplifier B Gain"},
428 {2498, "Amplifier B Level"},
429 {2499, "Channel 2 Bass Freq"},
430 {2500, "Channel 2 Bass Level"},
431 {2501, "Channel 2 Mid Freq"},
432 {2502, "Channel 2 Mid Level"},
433 {2503, "Channel 2 Treb Freq"},
434 {2504, "Channel 2 Treb Level"},
435 {2505, "EQ Enable On/Off"},
436 {2506, "Channel 2 Presence"},
437 {0, NULL}
440 static const value_string digitech_parameter_ids_amp_cabinet_b[] = {
441 {2561, "Channel 2 Tuning"},
442 {0, NULL}
445 static const value_string digitech_parameter_ids_noisegate[] = {
446 {705, "Noisegate On/Off"},
447 {706, "Noisegate Attack"},
448 {710, "Noisegate Threshold"},
449 {711, "Noisegate Sens"},
450 {712, "Noisegate Attack"},
451 {713, "Noisegate Release"},
452 {714, "Noisegate Attn"},
453 {0, NULL}
456 static const value_string digitech_parameter_ids_volume_pre_fx[] = {
457 {2626, "Pickup Volume Pre FX"},
458 {0, NULL}
461 static const value_string digitech_parameter_ids_chorusfx[] = {
462 {769, "Chorus/FX On/Off"},
463 {836, "Chorus/FX Chorus Level"},
464 {837, "Chorus/FX Chorus Speed"},
465 {838, "Chorus/FX CE/Dual/Multi Chorus Depth"},
466 {839, "Chorus/FX Chorus Predelay"},
467 {840, "Chorus/FX Dual/Multi Chorus Wave"},
468 {841, "Chorus/FX Chorus Balance"},
469 {848, "Chorus/FX Chorus Width"},
470 {849, "Chorus/FX Chorus Intensity"},
471 {850, "Chorus/FX Small Clone Rate"},
472 {901, "Chorus/FX Flanger Level/Mix"},
473 {902, "Chorus/FX Flanger Speed"},
474 {903, "Chorus/FX Flanger Depth"},
475 {904, "Chorus/FX Flanger Regen"},
476 {905, "Chorus/FX Flanger Waveform"},
477 {906, "Chorus/FX Flanger Balance"},
478 {914, "Chorus/FX Flanger Width"},
479 {916, "Chorus/FX Flanger Color"},
480 {917, "Chorus/FX Flanger Manual"},
481 {918, "Chorus/FX Flanger Rate"},
482 {919, "Chorus/FX Flanger Range"},
483 {920, "Chorus/FX Flanger Enhance"},
484 {921, "Chorus/FX Flanger Harmonics"},
485 {922, "Chorus/FX Filter Flanger Frequency"},
486 {962, "Chorus/FX Phaser Speed"},
487 {963, "Chorus/FX Phaser Depth"},
488 {965, "Chorus/FX Phaser Level"},
489 {966, "Chorus/FX Phaser Regen"},
490 {967, "Chorus/FX Phaser Waveform"},
491 {968, "Chorus/FX Phaser Balance"},
492 {976, "Chorus/FX MX Phaser Intensity"},
493 {977, "Chorus/FX EH Phaser Color"},
494 {979, "Chorus/FX EH Phaser Rate"},
495 {1028, "Chorus/FX Triggered Flanger Lfo Start"},
496 {1029, "Chorus/FX Triggered Flanger/Phaser Mix"},
497 {1030, "Chorus/FX Triggered Flanger Speed"},
498 {1031, "Chorus/FX Triggered Flanger Sens"},
499 {1032, "Chorus/FX Triggered Flanger Level"},
500 {1092, "Chorus/FX Triggered Phaser Lfo Start"},
501 {1094, "Chorus/FX Triggered Phaser Speed"},
502 {1095, "Chorus/FX Triggered Phaser Sens"},
503 {1096, "Chorus/FX Triggered Phaser Level"},
504 {1155, "Chorus/FX Tremolo Depth"},
505 {1156, "Chorus/FX Tremolo Speed"},
506 {1157, "Chorus/FX Tremolo Wave"},
507 {1219, "Chorus/FX Panner Depth"},
508 {1220, "Chorus/FX Panner Speed"},
509 {1221, "Chorus/FX Panner Wave"},
510 {1284, "Chorus/FX Vibrato Speed"},
511 {1285, "Chorus/FX Vibrato Depth"},
512 {1286, "Chorus/FX Vibrato Waveform"},
513 {1314, "Chorus/FX Vibropan Speed"},
514 {1315, "Chorus/FX Vibropan Depth"},
515 {1316, "Chorus/FX Vibropan Vibra"},
516 {1317, "Chorus/FX Vibropan Wave"},
517 {1346, "Chorus/FX Rotary Speed"},
518 {1348, "Chorus/FX Rotary Intensity"},
519 {1349, "Chorus/FX Rotary Mix"},
520 {1350, "Chorus/FX Rotary Doppler"},
521 {1351, "Chorus/FX Rotary Crossover"},
522 {1352, "Chorus/FX Rotary Balance"},
523 {1410, "Chorus/FX YaYa Pedal"},
524 {1412, "Chorus/FX YaYa Range"},
525 {1413, "Chorus/FX YaYa Mix"},
526 {1414, "Chorus/FX YaYa Depth"},
527 {1416, "Chorus/FX YaYa Balance"},
528 {1417, "Chorus/FX YaYa Intensity"},
529 {1418, "Chorus/FX YaYa Range"},
530 {1476, "Chorus/FX AutoYa Range"},
531 {1477, "Chorus/FX AutoYa Mix"},
532 {1478, "Chorus/FX AutoYa Speed"},
533 {1479, "Chorus/FX AutoYa Depth"},
534 {1481, "Chorus/FX AutoYa Balance"},
535 {1482, "Chorus/FX AutoYa Intensity"},
536 {1483, "Chorus/FX AutoYa Range"},
537 {1540, "Chorus/FX Synthtalk Vox"},
538 {1542, "Chorus/FX Synthtalk Attack"},
539 {1543, "Chorus/FX Synthtalk Release"},
540 {1544, "Chorus/FX Synthtalk Sens"},
541 {1545, "Chorus/FX Synthtalk Balance"},
542 {1604, "Chorus/FX Envelope Mix"},
543 {1605, "Chorus/FX Envelope/FX25 Range"},
544 {1606, "Chorus/FX Envelope/FX25 Sensitivity"},
545 {1607, "Chorus/FX Envelope Balance"},
546 {1608, "Chorus/FX FX25 Blend"},
547 {1667, "Chorus/FX Detune Level"},
548 {1668, "Chorus/FX Detune Amount"},
549 {1669, "Chorus/FX Detune Balance"},
550 {1730, "Chorus/FX Pitch Shift Amount"},
551 {1731, "Chorus/FX Pitch Level"},
552 {1733, "Chorus/FX Pitch Balance"},
553 {1745, "Chorus/FX Pitch Shift Mix"},
554 {1746, "Chorus/FX Octaver Octave 1"},
555 {1747, "Chorus/FX Octaver Octave 2"},
556 {1748, "Chorus/FX Octaver Dry Level"},
557 {1795, "Chorus/FX Whammy Pedal"},
558 {1796, "Chorus/FX Whammy Mix"},
559 {1797, "Chorus/FX Whammy Amount"},
560 {2754, "Chorus/FX IPS/Harmony Pitch Shift"},
561 {2755, "Chorus/FX IPS/Harmony Pitch Scale"},
562 {2756, "Chorus/FX IPS/Harmony Pitch Key"},
563 {2757, "Chorus/FX IPS/Harmony Pitch Level"},
564 {2882, "Chorus/FX Unovibe Chorus/Vibrato"},
565 {2883, "Chorus/FX Unovibe Intensity"},
566 {2884, "Chorus/FX Unovibe Pedal Speed"},
567 {2885, "Chorus/FX Unovibe Volume"},
568 {3010, "Chorus/FX Step Filter Speed"},
569 {3011, "Chorus/FX Step Filter Intensity"},
570 {3012, "Chorus/FX Sample/Hold Speed"},
571 {3013, "Chorus/FX Sample/Hold Intensity"},
572 {0, NULL}
575 static const value_string digitech_parameter_ids_delay[] = {
576 {1857, "Delay On/Off"},
577 {1860, "Delay Level"},
578 {1862, "Delay Time"},
579 {1863, "Delay Repeats"},
580 {1864, "Delay Thresh"},
581 {1865, "Delay Atten"},
582 {1866, "Delay Balance"},
583 {1867, "Delay Spread"},
584 {1868, "Delay Tap Time"},
585 {1873, "Delay Depth"},
586 {1874, "Delay Repeats"},
587 {1888, "Delay Time"},
588 {1889, "Delay Ducker thresh"},
589 {1890, "Delay Ducker level"},
590 {1891, "Delay Tape Wow"},
591 {1892, "Delay Tape Flutter"},
592 {1893, "Delay Echo Plex Volume"},
593 {1894, "Delay DM Repeat Rate"},
594 {1895, "Delay DM Echo"},
595 {1896, "Delay DM Intensity"},
596 {1897, "Delay Echo Plex Time"},
597 {1898, "Delay DM Delay Repeat Rate"},
598 {1899, "Delay Echo Plex Time"},
599 {1900, "Delay Tap Time"},
600 {1901, "Delay Reverse Time"},
601 {1902, "Delay Reverse Mix"},
602 {1905, "Delay 2-tap Ratio"},
603 {0, NULL}
606 static const value_string digitech_parameter_ids_reverb[] = {
607 {1921, "Reverb On/Off"},
608 {1922, "Reverb Predelay"},
609 {1924, "Reverb Damping"},
610 {1925, "Reverb Level"},
611 {1927, "Reverb Decay"},
612 {1928, "Reverb Balance"},
613 {1933, "Reverb Liveliness"},
614 {9, NULL}
617 static const value_string digitech_parameter_ids_volume_post_fx[] = {
618 {2626, "Pickup Volume Post FX"},
619 {0, NULL}
622 static const value_string digitech_parameter_ids_preset[] = {
623 {2626, "Pickup Preset Level"},
624 {0, NULL}
627 static const value_string digitech_parameter_ids_wah_min_max[] = {
628 {8195, "Wah Min"},
629 {8196, "Wah Max"},
630 {0, NULL}
633 static const value_string digitech_parameter_ids_equalizer[] = {
634 {3203, "Equalizer Bass"},
635 {3204, "Equalizer Mid"},
636 {3205, "Equalizer Treble"},
637 {3206, "Equalizer Mid Hz"},
638 {3207, "Equalizer Presence"},
639 {3211, "Equalizer Treb Hz"},
640 {3212, "Equalizer On/Off"},
641 {3213, "Equalizer Low Freq"},
642 {3215, "Equalizer High Freq"},
643 {3216, "Equalizer Low Bandwidth"},
644 {3217, "Equalizer Mid Bandwidth"},
645 {3218, "Equalizer High Bandwidth"},
646 {0, NULL}
649 static const value_string digitech_parameter_ids_equalizer_b[] = {
650 {3203, "Equalizer B Bass"},
651 {3204, "Equalizer B Mid"},
652 {3205, "Equalizer B Treble"},
653 {3206, "Equalizer B Mid Hz"},
654 {3207, "Equalizer B Presence"},
655 {3211, "Equalizer B Treb Hz"},
656 {3212, "Equalizer B On/Off"},
657 {0, NULL}
660 static const value_string digitech_parameter_ids_amp_loop[] = {
661 {3649, "Amp Loop On/Off"},
662 {0, NULL}
665 #define DIGITECH_POSITION_GLOBAL 0
666 #define DIGITECH_POSITION_PICKUP 2
667 #define DIGITECH_POSITION_WAH 3
668 #define DIGITECH_POSITION_COMPRESSOR 4
669 #define DIGITECH_POSITION_GNX3K_WHAMMY 5
670 #define DIGITECH_POSITION_DISTORTION 6
671 #define DIGITECH_POSITION_AMP_CHANNEL 7
672 #define DIGITECH_POSITION_AMP 8
673 #define DIGITECH_POSITION_AMP_CABINET 9
674 #define DIGITECH_POSITION_AMP_B 10
675 #define DIGITECH_POSITION_AMP_CABINET_B 11
676 #define DIGITECH_POSITION_NOISEGATE 12
677 #define DIGITECH_POSITION_VOLUME_PRE_FX 13
678 #define DIGITECH_POSITION_CHORUS_FX 14
679 #define DIGITECH_POSITION_DELAY 15
680 #define DIGITECH_POSITION_REVERB 16
681 #define DIGITECH_POSITION_VOLUME_POST_FX 17
682 #define DIGITECH_POSITION_PRESET 18
683 #define DIGITECH_POSITION_EXPRESSION 19
684 #define DIGITECH_POSITION_WAH_MIN_MAX 20
685 #define DIGITECH_POSITION_V_SWITCH_ASSIGN 21
686 #define DIGITECH_POSITION_LFO_1 22
687 #define DIGITECH_POSITION_LFO_2 23
688 #define DIGITECH_POSITION_EQUALIZER 24
689 #define DIGITECH_POSITION_EQUALIZER_B 25
690 #define DIGITECH_POSITION_LIBRARY 26
691 #define DIGITECH_POSITION_AMP_LOOP 33
692 #define DIGITECH_POSITION_WAH_PEDAL 132
694 static const value_string digitech_parameter_positions[] = {
695 {DIGITECH_POSITION_GLOBAL, "Global"},
696 {DIGITECH_POSITION_PICKUP, "Pickup"},
697 {DIGITECH_POSITION_WAH, "Wah"},
698 {DIGITECH_POSITION_COMPRESSOR, "Compressor"},
699 {DIGITECH_POSITION_GNX3K_WHAMMY, "GNX3K Whammy"},
700 {DIGITECH_POSITION_DISTORTION, "Distortion"},
701 {DIGITECH_POSITION_AMP_CHANNEL, "Amp Channel"},
702 {DIGITECH_POSITION_AMP, "Amp"},
703 {DIGITECH_POSITION_AMP_CABINET, "Amp Cabinet"},
704 {DIGITECH_POSITION_AMP_B, "Amp B"},
705 {DIGITECH_POSITION_AMP_CABINET_B, "Amp Cabinet B"},
706 {DIGITECH_POSITION_NOISEGATE, "Noisegate"},
707 {DIGITECH_POSITION_VOLUME_PRE_FX, "Volume Pre Fx"},
708 {DIGITECH_POSITION_CHORUS_FX, "Chorus/FX"},
709 {DIGITECH_POSITION_DELAY, "Delay"},
710 {DIGITECH_POSITION_REVERB, "Reverb"},
711 {DIGITECH_POSITION_VOLUME_POST_FX, "Volume Post Fx"},
712 {DIGITECH_POSITION_PRESET, "Preset"},
713 {DIGITECH_POSITION_EXPRESSION, "Expression"},
714 {DIGITECH_POSITION_WAH_MIN_MAX, "Wah Min-Max"},
715 {DIGITECH_POSITION_V_SWITCH_ASSIGN, "V-Switch Assign"},
716 {DIGITECH_POSITION_LFO_1, "LFO 1"},
717 {DIGITECH_POSITION_LFO_2, "LFO 2"},
718 {DIGITECH_POSITION_EQUALIZER, "Equalizer"},
719 {DIGITECH_POSITION_EQUALIZER_B, "Equalizer B"},
720 {DIGITECH_POSITION_LIBRARY, "Library"},
721 {DIGITECH_POSITION_AMP_LOOP, "Amp Loop"},
722 {DIGITECH_POSITION_WAH_PEDAL, "Wah Pedal"},
723 {0, NULL}
726 static tvbuff_t *
727 unpack_digitech_message(tvbuff_t *tvb, gint offset)
729 tvbuff_t *next_tvb;
730 gint length = tvb_length(tvb);
731 gint data_len = length - offset - 2;
732 const guint8* data_ptr;
733 gint remaining = data_len;
734 guchar* unpacked;
735 guchar* unpacked_ptr;
736 gint unpacked_size;
737 guint8 msb;
738 gint i;
740 unpacked_size = data_len - (data_len / 8);
741 if (data_len % 8)
743 unpacked_size--;
746 data_ptr = tvb_get_ptr(tvb, offset, data_len);
747 unpacked = (guchar*)g_malloc(unpacked_size);
748 unpacked_ptr = unpacked;
750 while (remaining > 0)
752 msb = *data_ptr++;
753 remaining--;
755 for (i = 0; (i < 7) && (remaining > 0); ++i, --remaining)
757 *unpacked_ptr = *data_ptr | ((msb << (i + 1)) & 0x80);
758 unpacked_ptr++;
759 data_ptr++;
763 /* Create new tvb with unpacked data */
764 next_tvb = tvb_new_child_real_data(tvb, unpacked, unpacked_size, unpacked_size);
765 tvb_set_free_cb(next_tvb, g_free);
767 return next_tvb;
770 static int
771 get_digitech_hf_parameter_id_by_position(guint8 position)
773 int hf_parameter = hf_digitech_parameter_id;
775 switch (position)
777 case DIGITECH_POSITION_GLOBAL:
778 hf_parameter = hf_digitech_parameter_id_global;
779 break;
780 case DIGITECH_POSITION_PICKUP:
781 hf_parameter = hf_digitech_parameter_id_pickup;
782 break;
783 case DIGITECH_POSITION_WAH:
784 hf_parameter = hf_digitech_parameter_id_wah;
785 break;
786 case DIGITECH_POSITION_COMPRESSOR:
787 hf_parameter = hf_digitech_parameter_id_compressor;
788 break;
789 case DIGITECH_POSITION_GNX3K_WHAMMY:
790 hf_parameter = hf_digitech_parameter_id_gnx3k_whammy;
791 break;
792 case DIGITECH_POSITION_DISTORTION:
793 hf_parameter = hf_digitech_parameter_id_distortion;
794 break;
795 case DIGITECH_POSITION_AMP_CHANNEL:
796 hf_parameter = hf_digitech_parameter_id_amp_channel;
797 break;
798 case DIGITECH_POSITION_AMP:
799 hf_parameter = hf_digitech_parameter_id_amp;
800 break;
801 case DIGITECH_POSITION_AMP_CABINET:
802 hf_parameter = hf_digitech_parameter_id_amp_cabinet;
803 break;
804 case DIGITECH_POSITION_AMP_B:
805 hf_parameter = hf_digitech_parameter_id_amp_b;
806 break;
807 case DIGITECH_POSITION_AMP_CABINET_B:
808 hf_parameter = hf_digitech_parameter_id_amp_cabinet_b;
809 break;
810 case DIGITECH_POSITION_NOISEGATE:
811 hf_parameter = hf_digitech_parameter_id_noisegate;
812 break;
813 case DIGITECH_POSITION_VOLUME_PRE_FX:
814 hf_parameter = hf_digitech_parameter_id_volume_pre_fx;
815 break;
816 case DIGITECH_POSITION_CHORUS_FX:
817 hf_parameter = hf_digitech_parameter_id_chorusfx;
818 break;
819 case DIGITECH_POSITION_DELAY:
820 hf_parameter = hf_digitech_parameter_id_delay;
821 break;
822 case DIGITECH_POSITION_REVERB:
823 hf_parameter = hf_digitech_parameter_id_reverb;
824 break;
825 case DIGITECH_POSITION_VOLUME_POST_FX:
826 hf_parameter = hf_digitech_parameter_id_volume_post_fx;
827 break;
828 case DIGITECH_POSITION_PRESET:
829 hf_parameter = hf_digitech_parameter_id_preset;
830 break;
831 case DIGITECH_POSITION_WAH_MIN_MAX:
832 hf_parameter = hf_digitech_parameter_id_wah_min_max;
833 break;
834 case DIGITECH_POSITION_EQUALIZER:
835 hf_parameter = hf_digitech_parameter_id_equalizer;
836 break;
837 case DIGITECH_POSITION_EQUALIZER_B:
838 hf_parameter = hf_digitech_parameter_id_equalizer_b;
839 break;
840 case DIGITECH_POSITION_AMP_LOOP:
841 hf_parameter = hf_digitech_parameter_id_amp_loop;
842 break;
844 case DIGITECH_POSITION_EXPRESSION:
845 case DIGITECH_POSITION_V_SWITCH_ASSIGN:
846 case DIGITECH_POSITION_LFO_1:
847 case DIGITECH_POSITION_LFO_2:
848 case DIGITECH_POSITION_LIBRARY:
849 case DIGITECH_POSITION_WAH_PEDAL:
850 /* TODO */
851 default:
852 break;
855 return hf_parameter;
858 /* Dissects DigiTech parameter starting at data_offset.
859 * Returns new data_offset.
861 static gint
862 dissect_digitech_parameter(tvbuff_t *data_tvb, proto_tree *tree,
863 digitech_conv_data_t *conv_data, gint data_offset)
865 guint8 digitech_helper;
866 int hf_parameter = hf_digitech_parameter_id;
868 /* Version 1 and later specify parameter position */
869 if (conv_data->protocol_version >= 1)
871 digitech_helper = tvb_get_guint8(data_tvb, data_offset+2);
872 hf_parameter = get_digitech_hf_parameter_id_by_position(digitech_helper);
875 proto_tree_add_item(tree, hf_parameter, data_tvb, data_offset, 2, ENC_BIG_ENDIAN);
876 data_offset += 2;
878 /* Add (optional) position to tree */
879 if (conv_data->protocol_version >= 1)
881 proto_tree_add_item(tree, hf_digitech_parameter_position, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
882 data_offset++;
885 digitech_helper = tvb_get_guint8(data_tvb, data_offset);
886 /* Values 0-127 fit in one byte */
887 if (digitech_helper < 0x80)
889 proto_tree_add_item(tree, hf_digitech_parameter_data, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
890 data_offset++;
892 else /* digitech_helper >= 0x80 */
894 guint16 data_count;
896 /* Single byte data count */
897 if (digitech_helper > 0x80)
899 data_count = (guint16)(digitech_helper & ~0x80);
900 proto_tree_add_uint(tree, hf_digitech_parameter_data_count, data_tvb,
901 data_offset, 1, (guint32)data_count);
902 data_offset++;
904 /* Two-byte data count */
905 else /* digitech_helper == 0x80 */
907 data_count = (guint16)tvb_get_ntohs(data_tvb, data_offset+1);
908 proto_tree_add_uint(tree, hf_digitech_parameter_data_two_byte_count, data_tvb,
909 data_offset, 3, (guint32)data_count);
910 data_offset += 3;
913 proto_tree_add_item(tree, hf_digitech_parameter_multibyte_data, data_tvb,
914 data_offset, (gint)data_count, ENC_NA);
915 data_offset += data_count;
918 return data_offset;
921 static int
922 get_digitech_hf_product_by_family(guint8 family)
924 int hf_product = hf_digitech_unknown_product_id;
926 switch (family)
928 case DIGITECH_FAMILY_RP:
929 hf_product = hf_digitech_rp_product_id;
930 break;
931 default:
932 break;
935 return hf_product;
938 static void
939 dissect_digitech_procedure(guint8 procedure, const gint offset,
940 tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
942 tvbuff_t *data_tvb;
943 gint data_offset;
944 gint data_len;
945 guint8 *tmp_string;
946 guint str_size;
947 guint16 count;
948 guint8 digitech_helper;
949 conversation_t *conversation;
950 digitech_conv_data_t *conv_data;
952 conversation = find_or_create_conversation(pinfo);
953 conv_data = (digitech_conv_data_t *)conversation_get_proto_data(conversation, proto_sysex);
955 if (conv_data == NULL)
957 conv_data = wmem_new(wmem_file_scope(), digitech_conv_data_t);
958 conv_data->protocol_version = 1; /* Default to version 1 */
961 /* Procedure data starts at offset and ends two bytes before end
962 * of System Exclusive packet (one byte is checksum, the other one
963 * is EOX)
965 if (tvb_length(tvb) - offset < 2)
967 /* There is no DigiTech procedure data, do not attempt further
968 * dissection */
969 return;
972 data_tvb = unpack_digitech_message(tvb, offset);
973 add_new_data_source(pinfo, data_tvb, "Unpacked Procedure Data");
975 data_offset = 0;
976 data_len = tvb_length(data_tvb);
978 switch (procedure)
980 case DIGITECH_PROCEDURE_REQUEST_WHO_AM_I:
981 proto_tree_add_item(tree, hf_digitech_desired_device_id, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
982 data_offset++;
983 proto_tree_add_item(tree, hf_digitech_desired_family_id, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
984 data_offset++;
985 proto_tree_add_item(tree, hf_digitech_desired_product_id, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
986 data_offset++;
987 break;
988 case DIGITECH_PROCEDURE_RECEIVE_WHO_AM_I:
989 proto_tree_add_item(tree, hf_digitech_device_id, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
990 data_offset++;
992 digitech_helper = tvb_get_guint8(data_tvb, data_offset);
993 proto_tree_add_item(tree, hf_digitech_family_id, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
994 data_offset++;
996 proto_tree_add_item(tree, get_digitech_hf_product_by_family(digitech_helper),
997 data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
998 data_offset++;
1000 if (data_len == 3)
1002 /* Version 0, everything already decoded */
1003 conv_data->protocol_version = 0;
1005 else if (data_len == 4)
1007 /* Version 1 and later */
1008 conv_data->protocol_version = 1;
1010 proto_tree_add_item(tree, hf_digitech_os_mode, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
1011 data_offset++;
1013 break;
1014 case DIGITECH_PROCEDURE_REQUEST_PRESET_NAMES:
1015 proto_tree_add_item(tree, hf_digitech_preset_bank, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
1016 data_offset++;
1018 break;
1019 case DIGITECH_PROCEDURE_RECEIVE_PRESET_NAMES:
1020 proto_tree_add_item(tree, hf_digitech_preset_bank, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
1021 data_offset++;
1023 count = (guint16)tvb_get_guint8(data_tvb, data_offset);
1024 proto_tree_add_item(tree, hf_digitech_preset_count, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
1025 data_offset++;
1027 while ((count > 0) && (str_size = tvb_strsize(data_tvb, data_offset)))
1029 tmp_string = tvb_get_string(wmem_packet_scope(), data_tvb, data_offset, str_size - 1);
1030 proto_tree_add_string(tree, hf_digitech_preset_name, data_tvb, data_offset, str_size, tmp_string);
1031 data_offset += (gint)str_size;
1032 count--;
1034 break;
1035 case DIGITECH_PROCEDURE_REQUEST_PRESET:
1036 proto_tree_add_item(tree, hf_digitech_preset_bank, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
1037 data_offset++;
1039 proto_tree_add_item(tree, hf_digitech_preset_index, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
1040 data_offset++;
1041 break;
1042 case DIGITECH_PROCEDURE_RECEIVE_PRESET_START:
1043 /* Preset bank */
1044 proto_tree_add_item(tree, hf_digitech_preset_bank, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
1045 data_offset++;
1047 /* Preset index */
1048 proto_tree_add_item(tree, hf_digitech_preset_index, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
1049 data_offset++;
1051 /* Preset name (NULL-terminated) */
1052 str_size = tvb_strsize(data_tvb, data_offset);
1053 tmp_string = tvb_get_string(wmem_packet_scope(), data_tvb, data_offset, str_size - 1);
1054 proto_tree_add_string(tree, hf_digitech_preset_name, data_tvb, data_offset, str_size, tmp_string);
1055 data_offset += (gint)str_size;
1057 /* Preset modified (0 = unmodified, !0 = modified) */
1058 proto_tree_add_item(tree, hf_digitech_preset_modified, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
1059 data_offset++;
1061 /* Message Count */
1062 proto_tree_add_item(tree, hf_digitech_message_count, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
1063 data_offset++;
1064 break;
1065 case DIGITECH_PROCEDURE_RECEIVE_PRESET_PARAMETERS:
1066 count = tvb_get_ntohs(data_tvb, data_offset);
1067 proto_tree_add_item(tree, hf_digitech_parameter_count, data_tvb, data_offset, 2, ENC_BIG_ENDIAN);
1068 data_offset += 2;
1069 while (count > 0)
1071 data_offset = dissect_digitech_parameter(data_tvb, tree, conv_data, data_offset);
1072 count--;
1074 break;
1075 case DIGITECH_PROCEDURE_RECEIVE_PARAMETER_VALUE:
1076 data_offset = dissect_digitech_parameter(data_tvb, tree, conv_data, data_offset);
1077 break;
1078 case DIGITECH_PROCEDURE_ACK:
1079 proto_tree_add_item(tree, hf_digitech_ack_request_proc_id, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
1080 data_offset++;
1081 break;
1082 case DIGITECH_PROCEDURE_NACK:
1083 proto_tree_add_item(tree, hf_digitech_nack_request_proc_id, data_tvb, data_offset, 1, ENC_BIG_ENDIAN);
1084 data_offset++;
1085 break;
1086 default:
1087 break;
1090 if (data_offset < data_len)
1092 proto_tree_add_expert(tree, pinfo, &ei_sysex_undecoded,
1093 data_tvb, data_offset, data_len - data_offset);
1097 /* dissector for System Exclusive MIDI data */
1098 static void
1099 dissect_sysex_command(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
1101 guint8 sysex_helper;
1102 gint data_len;
1103 proto_item *item;
1105 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SYSEX");
1106 col_set_str(pinfo->cinfo, COL_INFO, "MIDI System Exclusive Command");
1108 data_len = tvb_length(tvb);
1110 if (parent_tree)
1112 proto_item *ti = NULL;
1113 proto_tree *tree = NULL;
1114 gint offset = 0;
1115 guint8 manufacturer_id;
1116 guint32 three_byte_manufacturer_id = 0xFFFFFF;
1117 guint8 procedure_id;
1119 ti = proto_tree_add_protocol_format(parent_tree, proto_sysex, tvb, 0, -1, "MIDI System Exclusive Command");
1120 tree = proto_item_add_subtree(ti, ett_sysex);
1122 /* Check start byte (System Exclusive - 0xF0) */
1123 sysex_helper = tvb_get_guint8(tvb, 0);
1124 item = proto_tree_add_item(tree, hf_sysex_message_start, tvb, offset, 1, ENC_BIG_ENDIAN);
1125 if (sysex_helper != 0xF0)
1127 expert_add_info(pinfo, item, &ei_sysex_message_start_byte);
1130 offset++;
1132 manufacturer_id = tvb_get_guint8(tvb, offset);
1133 /* Three-byte manufacturer ID starts with 00 */
1134 if (manufacturer_id == 0)
1136 three_byte_manufacturer_id = tvb_get_ntoh24(tvb, offset);
1137 proto_tree_add_item(tree, hf_sysex_three_byte_manufacturer_id, tvb, offset, 3, ENC_BIG_ENDIAN);
1138 offset += 3;
1140 /* One-byte manufacturer ID */
1141 else
1143 proto_tree_add_item(tree, hf_sysex_manufacturer_id, tvb, offset, 1, ENC_BIG_ENDIAN);
1144 offset++;
1147 proto_tree_add_item(tree, hf_sysex_device_id, tvb, offset, 1, ENC_BIG_ENDIAN);
1148 offset++;
1150 /* Following data is menufacturer-specific */
1151 switch (three_byte_manufacturer_id)
1153 case SYSEX_MANUFACTURER_DOD:
1155 guint8 digitech_helper;
1156 const guint8 *data_ptr;
1157 int len;
1158 int i;
1160 digitech_helper = tvb_get_guint8(tvb, offset);
1161 proto_tree_add_item(tree, hf_digitech_family_id, tvb, offset, 1, ENC_BIG_ENDIAN);
1162 offset++;
1164 proto_tree_add_item(tree, get_digitech_hf_product_by_family(digitech_helper),
1165 tvb, offset, 1, ENC_BIG_ENDIAN);
1166 offset++;
1168 procedure_id = tvb_get_guint8(tvb, offset);
1169 proto_tree_add_item(tree, hf_digitech_procedure_id, tvb, offset, 1, ENC_BIG_ENDIAN);
1170 offset++;
1172 dissect_digitech_procedure(procedure_id, offset, tvb, pinfo, tree);
1174 len = tvb_length(tvb) - 2;
1175 offset = len; /* Penultimate byte is checksum */
1176 data_ptr = tvb_get_ptr(tvb, 1, len);
1177 /* Calculate checksum */
1178 for (i = 0, digitech_helper = 0; i < len; ++i)
1180 digitech_helper ^= *data_ptr++;
1183 item = proto_tree_add_item(tree, hf_digitech_checksum, tvb, offset, 1, ENC_BIG_ENDIAN);
1184 if (digitech_helper == 0)
1186 proto_item_append_text(item, " (correct)");
1188 else
1190 proto_item_append_text(item, " (NOT correct)");
1191 expert_add_info(pinfo, item, &ei_digitech_checksum_bad);
1193 offset++;
1194 break;
1196 default:
1197 break;
1200 if (offset < data_len - 1)
1202 proto_tree_add_expert(tree, pinfo, &ei_sysex_undecoded,
1203 tvb, offset, data_len - offset - 1);
1206 /* Check end byte (EOX - 0xF7) */
1207 sysex_helper = tvb_get_guint8(tvb, data_len - 1);
1208 item = proto_tree_add_item(tree, hf_sysex_message_eox, tvb, data_len - 1, 1, ENC_BIG_ENDIAN);
1209 if (sysex_helper != 0xF7)
1211 expert_add_info(pinfo, item, &ei_sysex_message_end_byte);
1216 void
1217 proto_register_sysex(void)
1219 static hf_register_info hf[] = {
1220 { &hf_sysex_message_start,
1221 { "SysEx message start", "sysex.start", FT_UINT8, BASE_HEX,
1222 NULL, 0, "System Exclusive Message start (0xF0)", HFILL }},
1223 { &hf_sysex_manufacturer_id,
1224 { "Manufacturer ID", "sysex.manufacturer_id", FT_UINT8, BASE_HEX,
1225 NULL, 0, NULL, HFILL }},
1226 { &hf_sysex_three_byte_manufacturer_id,
1227 { "Manufacturer ID", "sysex.manufacturer_id", FT_UINT24, BASE_HEX,
1228 VALS(sysex_three_byte_manufacturer_id), 0, NULL, HFILL }},
1229 { &hf_sysex_device_id,
1230 { "Device ID", "sysex.device_id", FT_UINT8, BASE_HEX,
1231 NULL, 0, NULL, HFILL }},
1232 { &hf_sysex_message_eox,
1233 { "EOX", "sysex.eox", FT_UINT8, BASE_HEX,
1234 NULL, 0, "System Exclusive Message end (0xF7)", HFILL}},
1236 /* DigiTech manufacturer-specific fields */
1237 { &hf_digitech_family_id,
1238 { "Family ID", "sysex.digitech.family_id", FT_UINT8, BASE_HEX,
1239 VALS(digitech_family_id), 0, NULL, HFILL }},
1240 { &hf_digitech_unknown_product_id,
1241 { "Product ID", "sysex.digitech.product_id", FT_UINT8, BASE_HEX,
1242 NULL, 0, NULL, HFILL }},
1243 { &hf_digitech_rp_product_id,
1244 { "Product ID", "sysex.digitech.product_id", FT_UINT8, BASE_HEX,
1245 VALS(digitech_rp_product_id), 0, NULL, HFILL }},
1246 { &hf_digitech_procedure_id,
1247 { "Procedure ID", "sysex.digitech.procedure_id", FT_UINT8, BASE_HEX,
1248 VALS(digitech_procedures), 0, NULL, HFILL }},
1250 { &hf_digitech_desired_device_id,
1251 { "Desired Device ID", "sysex.digitech.desired_device_id", FT_UINT8, BASE_HEX,
1252 NULL, 0, NULL, HFILL }},
1253 { &hf_digitech_desired_family_id,
1254 { "Desired Family ID", "sysex.digitech.desired_family_id", FT_UINT8, BASE_HEX,
1255 NULL, 0, NULL, HFILL }},
1256 { &hf_digitech_desired_product_id,
1257 { "Desired Product ID", "sysex.digitech.desired_product_id", FT_UINT8, BASE_HEX,
1258 NULL, 0, NULL, HFILL }},
1259 { &hf_digitech_device_id,
1260 { "Device ID", "sysex.digitech.device_id", FT_UINT8, BASE_HEX,
1261 NULL, 0, NULL, HFILL }},
1262 { &hf_digitech_os_mode,
1263 { "OS Mode", "sysex.digitech.os_mode", FT_UINT8, BASE_HEX,
1264 VALS(digitech_os_modes), 0, "DigiTech OS Mode", HFILL }},
1266 { &hf_digitech_preset_bank,
1267 { "Preset Bank", "sysex.digitech.preset_bank", FT_UINT8, BASE_HEX,
1268 VALS(digitech_preset_banks), 0, NULL, HFILL }},
1269 { &hf_digitech_preset_index,
1270 { "Preset Index", "sysex.digitech.preset_index", FT_UINT8, BASE_HEX,
1271 NULL, 0, NULL, HFILL }},
1272 { &hf_digitech_preset_count,
1273 { "Preset Count", "sysex.digitech.preset_count", FT_UINT8, BASE_DEC,
1274 NULL, 0, NULL, HFILL }},
1275 { &hf_digitech_preset_name,
1276 { "Preset Name", "sysex.digitech.preset_name", FT_STRING, BASE_NONE,
1277 NULL, 0, NULL, HFILL }},
1278 { &hf_digitech_preset_modified,
1279 { "Preset Modified", "sysex.digitech.preset_modified", FT_BOOLEAN, BASE_NONE,
1280 TFS(&tfs_yes_no), 0, "Modified flag (0 = unmodified)", HFILL }},
1282 { &hf_digitech_message_count,
1283 { "Messages to follow", "sysex.digitech.message_count", FT_UINT8, BASE_DEC,
1284 NULL, 0, "Number of messages to follow", HFILL }},
1286 { &hf_digitech_parameter_count,
1287 { "Parameter Count", "sysex.digitech.parameter_count", FT_UINT16, BASE_DEC,
1288 NULL, 0, NULL, HFILL }},
1290 { &hf_digitech_parameter_id,
1291 { "Parameter ID", "sysex.digitech.parameter_id", FT_UINT16, BASE_DEC,
1292 NULL, 0, NULL, HFILL }},
1293 { &hf_digitech_parameter_id_global,
1294 { "Parameter ID", "sysex.digitech.parameter_id", FT_UINT16, BASE_DEC,
1295 VALS(digitech_parameter_ids_global), 0, NULL, HFILL }},
1296 { &hf_digitech_parameter_id_pickup,
1297 { "Parameter ID", "sysex.digitech.parameter_id", FT_UINT16, BASE_DEC,
1298 VALS(digitech_parameter_ids_pickup), 0, NULL, HFILL }},
1299 { &hf_digitech_parameter_id_wah,
1300 { "Parameter ID", "sysex.digitech.parameter_id", FT_UINT16, BASE_DEC,
1301 VALS(digitech_parameter_ids_wah), 0, NULL, HFILL }},
1302 { &hf_digitech_parameter_id_compressor,
1303 { "Parameter ID", "sysex.digitech.parameter_id", FT_UINT16, BASE_DEC,
1304 VALS(digitech_parameter_ids_compressor), 0, NULL, HFILL }},
1305 { &hf_digitech_parameter_id_gnx3k_whammy,
1306 { "Parameter ID", "sysex.digitech.parameter_id", FT_UINT16, BASE_DEC,
1307 VALS(digitech_parameter_ids_gnx3k_whammy), 0, NULL, HFILL }},
1308 { &hf_digitech_parameter_id_distortion,
1309 { "Parameter ID", "sysex.digitech.parameter_id", FT_UINT16, BASE_DEC,
1310 VALS(digitech_parameter_ids_distortion), 0, NULL, HFILL }},
1311 { &hf_digitech_parameter_id_amp_channel,
1312 { "Parameter ID", "sysex.digitech.parameter_id", FT_UINT16, BASE_DEC,
1313 VALS(digitech_parameter_ids_amp_channel), 0, NULL, HFILL }},
1314 { &hf_digitech_parameter_id_amp,
1315 { "Parameter ID", "sysex.digitech.parameter_id", FT_UINT16, BASE_DEC,
1316 VALS(digitech_parameter_ids_amp), 0, NULL, HFILL }},
1317 { &hf_digitech_parameter_id_amp_cabinet,
1318 { "Parameter ID", "sysex.digitech.parameter_id", FT_UINT16, BASE_DEC,
1319 VALS(digitech_parameter_ids_amp_cabinet), 0, NULL, HFILL }},
1320 { &hf_digitech_parameter_id_amp_b,
1321 { "Parameter ID", "sysex.digitech.parameter_id", FT_UINT16, BASE_DEC,
1322 VALS(digitech_parameter_ids_amp_b), 0, NULL, HFILL }},
1323 { &hf_digitech_parameter_id_amp_cabinet_b,
1324 { "Parameter ID", "sysex.digitech.parameter_id", FT_UINT16, BASE_DEC,
1325 VALS(digitech_parameter_ids_amp_cabinet_b), 0, NULL, HFILL }},
1326 { &hf_digitech_parameter_id_noisegate,
1327 { "Parameter ID", "sysex.digitech.parameter_id", FT_UINT16, BASE_DEC,
1328 VALS(digitech_parameter_ids_noisegate), 0, NULL, HFILL }},
1329 { &hf_digitech_parameter_id_volume_pre_fx,
1330 { "Parameter ID", "sysex.digitech.parameter_id", FT_UINT16, BASE_DEC,
1331 VALS(digitech_parameter_ids_volume_pre_fx), 0, NULL, HFILL }},
1332 { &hf_digitech_parameter_id_chorusfx,
1333 { "Parameter ID", "sysex.digitech.parameter_id", FT_UINT16, BASE_DEC,
1334 VALS(digitech_parameter_ids_chorusfx), 0, NULL, HFILL }},
1335 { &hf_digitech_parameter_id_delay,
1336 { "Parameter ID", "sysex.digitech.parameter_id", FT_UINT16, BASE_DEC,
1337 VALS(digitech_parameter_ids_delay), 0, NULL, HFILL }},
1338 { &hf_digitech_parameter_id_reverb,
1339 { "Parameter ID", "sysex.digitech.parameter_id", FT_UINT16, BASE_DEC,
1340 VALS(digitech_parameter_ids_reverb), 0, NULL, HFILL }},
1341 { &hf_digitech_parameter_id_volume_post_fx,
1342 { "Parameter ID", "sysex.digitech.parameter_id", FT_UINT16, BASE_DEC,
1343 VALS(digitech_parameter_ids_volume_post_fx), 0, NULL, HFILL }},
1344 { &hf_digitech_parameter_id_preset,
1345 { "Parameter ID", "sysex.digitech.parameter_id", FT_UINT16, BASE_DEC,
1346 VALS(digitech_parameter_ids_preset), 0, NULL, HFILL }},
1347 { &hf_digitech_parameter_id_wah_min_max,
1348 { "Parameter ID", "sysex.digitech.parameter_id", FT_UINT16, BASE_DEC,
1349 VALS(digitech_parameter_ids_wah_min_max), 0, NULL, HFILL }},
1350 { &hf_digitech_parameter_id_equalizer,
1351 { "Parameter ID", "sysex.digitech.parameter_id", FT_UINT16, BASE_DEC,
1352 VALS(digitech_parameter_ids_equalizer), 0, NULL, HFILL }},
1353 { &hf_digitech_parameter_id_equalizer_b,
1354 { "Parameter ID", "sysex.digitech.parameter_id", FT_UINT16, BASE_DEC,
1355 VALS(digitech_parameter_ids_equalizer_b), 0, NULL, HFILL }},
1356 { &hf_digitech_parameter_id_amp_loop,
1357 { "Parameter ID", "sysex.digitech.parameter_id", FT_UINT16, BASE_DEC,
1358 VALS(digitech_parameter_ids_amp_loop), 0, NULL, HFILL }},
1361 { &hf_digitech_parameter_position,
1362 { "Parameter position", "sysex.digitech.parameter_position", FT_UINT8, BASE_DEC,
1363 VALS(digitech_parameter_positions), 0, NULL, HFILL }},
1364 { &hf_digitech_parameter_data,
1365 { "Parameter data", "sysex.digitech.parameter_data", FT_UINT8, BASE_DEC,
1366 NULL, 0, NULL, HFILL }},
1367 { &hf_digitech_parameter_data_count,
1368 { "Parameter value count", "sysex.digitech.parameter_data_count", FT_UINT8, BASE_DEC,
1369 NULL, 0, NULL, HFILL }},
1370 { &hf_digitech_parameter_data_two_byte_count,
1371 { "Parameter data count", "sysex.digitech.parameter_data_count", FT_UINT24, BASE_DEC,
1372 NULL, 0, NULL, HFILL }},
1373 { &hf_digitech_parameter_multibyte_data,
1374 { "Parameter data", "sysex.digitech.parameter_data", FT_BYTES, BASE_NONE,
1375 NULL, 0, NULL, HFILL }},
1377 { &hf_digitech_ack_request_proc_id,
1378 { "Requesting Procedure ID", "sysex.digitech.ack.procedure_id", FT_UINT8, BASE_HEX,
1379 VALS(digitech_procedures), 0, "Procedure ID of the request being ACKed", HFILL }},
1380 { &hf_digitech_nack_request_proc_id,
1381 { "Requesting Procedure ID", "sysex.digitech.ack.procedure_id", FT_UINT8, BASE_HEX,
1382 VALS(digitech_procedures), 0, "Procedure ID of the request being NACKed", HFILL }},
1384 { &hf_digitech_checksum,
1385 { "Checksum", "sysex.digitech.checksum", FT_UINT8, BASE_HEX,
1386 NULL, 0, NULL, HFILL }},
1389 static gint *sysex_subtrees[] = {
1390 &ett_sysex
1393 static ei_register_info ei[] = {
1394 { &ei_sysex_message_start_byte, { "sysex.message_start_byte", PI_PROTOCOL, PI_WARN, "SYSEX Error: Wrong start byte", EXPFILL }},
1395 { &ei_digitech_checksum_bad, { "sysex.digitech.checksum_bad", PI_CHECKSUM, PI_WARN, "ARP packet storm detected", EXPFILL }},
1396 { &ei_sysex_message_end_byte, { "sysex.message_end_byte", PI_PROTOCOL, PI_WARN, "SYSEX Error: Wrong end byte", EXPFILL }},
1397 { &ei_sysex_undecoded, { "sysex.undecoded", PI_UNDECODED, PI_WARN, "Not dissected yet (report to wireshark.org)", EXPFILL }},
1400 expert_module_t* expert_sysex;
1402 proto_sysex = proto_register_protocol("MIDI System Exclusive", "SYSEX", "sysex");
1403 proto_register_field_array(proto_sysex, hf, array_length(hf));
1404 proto_register_subtree_array(sysex_subtrees, array_length(sysex_subtrees));
1405 expert_sysex = expert_register_protocol(proto_sysex);
1406 expert_register_field_array(expert_sysex, ei, array_length(ei));
1408 register_dissector("sysex", dissect_sysex_command, proto_sysex);
1411 void
1412 proto_reg_handoff_sysex(void)
1417 * Editor modelines
1419 * Local Variables:
1420 * c-basic-offset: 4
1421 * tab-width: 8
1422 * indent-tabs-mode: nil
1423 * End:
1425 * ex: set shiftwidth=4 tabstop=8 expandtab:
1426 * :indentSize=4:tabSize=8:noTabs=true: