415aea797ccc02c629c8e92cc1517641570d28a2
[obnox/wireshark/wip.git] / epan / dissectors / packet-rtp-midi.c
1 /* packet-rtpmidi.c
2  *
3  * Routines for RFC 4695/6295 RTP-MIDI dissection
4  * Copyright 2006-2012, Tobias Erichsen <t.erichsen@gmx.de>
5  *
6  * $Id$
7  *
8  * Wireshark - Network traffic analyzer
9  * By Gerald Combs <gerald@wireshark.org>'
10  * Copyright 1998 Gerald Combs
11  *
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version 2
15  * of the License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25  *
26  * RTP-MIDI ( RFC 4695/6295 ) is a payload type for transmitting MIDI-data over
27  * RTP-packets.  This payload type can be used on an RTP-conversation that has been
28  * established either by means of a session establishment-protocol like SIP or
29  * something more lightweight like the Apple network-midi session establishment.
30  *
31  * This dissector is built based on the RTP-MIDI-specification RFC 4695 from
32  * August 13, 2008, the superseding version RFC 6295 and the MIDI-specification 96.1
33  *
34  * Here are some links:
35  *
36  * http://www.cs.berkeley.edu/~lazzaro/rtpmidi/
37  * http://www.faqs.org/rfcs/rfc4695.html
38  * http://www.faqs.org/rfcs/rfc6295.html
39  * http://www.midi.org/
40  *
41  * 2012-02-24
42  * - Initial version of dissector
43  *
44  * Open topics:
45  * - reassembly of large sysex-fields going over multiple RTP-packets - this would be a major task, though!
46  * - MIDI Show-Control
47  * - MIDI Machine-Control
48  *
49  */
50
51 #ifdef HAVE_CONFIG_H
52 #include "config.h"
53 #endif
54
55 #include <glib.h>
56 #include <epan/packet.h>
57 #include <epan/prefs.h>
58
59 #include <stdio.h>
60 #include <string.h>
61 #include <epan/conversation.h>
62 #include <epan/tap.h>
63
64 /* Definitions for protocol name during dissector-register */
65 #define RTP_MIDI_DISSECTOR_NAME                                         "RFC 4695/6295 RTP-MIDI"
66 #define RTP_MIDI_DISSECTOR_SHORTNAME                                    "RTP-MIDI"
67 #define RTP_MIDI_DISSECTOR_ABBREVIATION                                 "rtpmidi"
68
69 #define RTP_MIDI_NO_RUNNING_STATUS                                      0xffff
70
71 /*
72  * MIDI Controller Numbers
73  */
74 #define RTP_MIDI_CTRL_BANK_SELECT_MSB                                   0
75 #define RTP_MIDI_CTRL_MODULATION_WHEEL_OR_LEVER_MSB                     1
76 #define RTP_MIDI_CTRL_BREATH_CONTROLLER_MSB                             2
77 /* #define RTP_MIDI_CTRL                                                3 */
78 #define RTP_MIDI_CTRL_FOOT_CONTROLLER_MSB                               4
79 #define RTP_MIDI_CTRL_PORTAMENTO_TIME_MSB                               5
80 #define RTP_MIDI_CTRL_DATA_ENTRY_MSB                                    6
81 #define RTP_MIDI_CTRL_CHANNEL_VOLUME_MSB                                7
82 #define RTP_MIDI_CTRL_BALANCE_MSB                                       8
83 /* #define RTP_MIDI_CTRL                                                9 */
84 #define RTP_MIDI_CTRL_PAN_MSB                                           10
85 #define RTP_MIDI_CTRL_EXPRESSION_CONTROLLER_MSB                         11
86 #define RTP_MIDI_CTRL_EFFECT_CONTROL_1_MSB                              12
87 #define RTP_MIDI_CTRL_EFFECT_CONTROL_2_MSB                              13
88 /* #define RTP_MIDI_CTRL_                                               14
89 #define RTP_MIDI_CTRL_                                                  15 */
90 #define RTP_MIDI_CTRL_GENERAL_PURPOSE_CONTROLLER_1_MSB                  16
91 #define RTP_MIDI_CTRL_GENERAL_PURPOSE_CONTROLLER_2_MSB                  17
92 #define RTP_MIDI_CTRL_GENERAL_PURPOSE_CONTROLLER_3_MSB                  18
93 #define RTP_MIDI_CTRL_GENERAL_PURPOSE_CONTROLLER_4_MSB                  19
94 /* #define RTP_MIDI_CTRL_                                               20
95 #define RTP_MIDI_CTRL_                                                  21
96 #define RTP_MIDI_CTRL_                                                  22
97 #define RTP_MIDI_CTRL_                                                  23
98 #define RTP_MIDI_CTRL_                                                  24
99 #define RTP_MIDI_CTRL_                                                  25
100 #define RTP_MIDI_CTRL_                                                  26
101 #define RTP_MIDI_CTRL_                                                  27
102 #define RTP_MIDI_CTRL_                                                  28
103 #define RTP_MIDI_CTRL_                                                  29
104 #define RTP_MIDI_CTRL_                                                  30
105 #define RTP_MIDI_CTRL_                                                  31 */
106 #define RTP_MIDI_CTRL_BANK_SELECT_LSB                                   32
107 #define RTP_MIDI_CTRL_MODULATION_WHEEL_OR_LEVER_LSB                     33
108 #define RTP_MIDI_CTRL_BREATH_CONTROLLER_LSB                             34
109 /* #define RTP_MIDI_CTRL_                                               35 */
110 #define RTP_MIDI_CTRL_FOOT_CONTROLLER_LSB                               36
111 #define RTP_MIDI_CTRL_PORTAMENTO_TIME_LSB                               37
112 #define RTP_MIDI_CTRL_DATA_ENTRY_LSB                                    38
113 #define RTP_MIDI_CTRL_CHANNEL_VOLUME_LSB                                39
114 #define RTP_MIDI_CTRL_BALANCE_LSB                                       40
115 /* #define RTP_MIDI_CTRL_                                               41 */
116 #define RTP_MIDI_CTRL_PAN_LSB                                           42
117 #define RTP_MIDI_CTRL_EXPRESSION_CONTROLLER_LSB                         43
118 #define RTP_MIDI_CTRL_EFFECT_CONTROL_1_LSB                              44
119 #define RTP_MIDI_CTRL_EFFECT_CONTROL_2_LSB                              45
120 /* #define RTP_MIDI_CTRL_                                               46
121 #define RTP_MIDI_CTRL_                                                  47 */
122 #define RTP_MIDI_CTRL_GENERAL_PURPOSE_CONTROLLER_1_LSB                  48
123 #define RTP_MIDI_CTRL_GENERAL_PURPOSE_CONTROLLER_2_LSB                  49
124 #define RTP_MIDI_CTRL_GENERAL_PURPOSE_CONTROLLER_3_LSB                  50
125 #define RTP_MIDI_CTRL_GENERAL_PURPOSE_CONTROLLER_4_LSB                  51
126 /* #define RTP_MIDI_CTRL_                                               52
127 #define RTP_MIDI_CTRL_                                                  53
128 #define RTP_MIDI_CTRL_                                                  54
129 #define RTP_MIDI_CTRL_                                                  55
130 #define RTP_MIDI_CTRL_                                                  56
131 #define RTP_MIDI_CTRL_                                                  57
132 #define RTP_MIDI_CTRL_                                                  58
133 #define RTP_MIDI_CTRL_                                                  59
134 #define RTP_MIDI_CTRL_                                                  60
135 #define RTP_MIDI_CTRL_                                                  61
136 #define RTP_MIDI_CTRL_                                                  62
137 #define RTP_MIDI_CTRL_                                                  63 */
138 #define RTP_MIDI_CTRL_DAMPER_PEDAL                                      64
139 #define RTP_MIDI_CTRL_PORTAMENTO_ON_OFF                                 65
140 #define RTP_MIDI_CTRL_SUSTENUTO                                         66
141 #define RTP_MIDI_CTRL_SOFT_PEDAL                                        67
142 #define RTP_MIDI_CTRL_LEGATO_FOOTSWITCH                                 68
143 #define RTP_MIDI_CTRL_HOLD_2                                            69
144 #define RTP_MIDI_CTRL_SOUND_CONTROLLER_1                                70
145 #define RTP_MIDI_CTRL_SOUND_CONTROLLER_2                                71
146 #define RTP_MIDI_CTRL_SOUND_CONTROLLER_3                                72
147 #define RTP_MIDI_CTRL_SOUND_CONTROLLER_4                                73
148 #define RTP_MIDI_CTRL_SOUND_CONTROLLER_5                                74
149 #define RTP_MIDI_CTRL_SOUND_CONTROLLER_6                                75
150 #define RTP_MIDI_CTRL_SOUND_CONTROLLER_7                                76
151 #define RTP_MIDI_CTRL_SOUND_CONTROLLER_8                                77
152 #define RTP_MIDI_CTRL_SOUND_CONTROLLER_9                                78
153 #define RTP_MIDI_CTRL_SOUND_CONTROLLER_10                               79
154 #define RTP_MIDI_CTRL_GENERAL_PURPOSE_CONTROLLER_5                      80
155 #define RTP_MIDI_CTRL_GENERAL_PURPOSE_CONTROLLER_6                      81
156 #define RTP_MIDI_CTRL_GENERAL_PURPOSE_CONTROLLER_7                      82
157 #define RTP_MIDI_CTRL_GENERAL_PURPOSE_CONTROLLER_8                      83
158 #define RTP_MIDI_CTRL_PORTAMENTO_CONTROL                                84
159 /* #define RTP_MIDI_CTRL_                                               85
160 #define RTP_MIDI_CTRL_                                                  86
161 #define RTP_MIDI_CTRL_                                                  87
162 #define RTP_MIDI_CTRL_                                                  88
163 #define RTP_MIDI_CTRL_                                                  89
164 #define RTP_MIDI_CTRL_                                                  90 */
165 #define RTP_MIDI_CTRL_EFFECTS_1_DEPTH                                   91
166 #define RTP_MIDI_CTRL_EFFECTS_2_DEPTH                                   92
167 #define RTP_MIDI_CTRL_EFFECTS_3_DEPTH                                   93
168 #define RTP_MIDI_CTRL_EFFECTS_4_DEPTH                                   94
169 #define RTP_MIDI_CTRL_EFFECTS_5_DEPTH                                   95
170 #define RTP_MIDI_CTRL_DATA_INCREMENT                                    96
171 #define RTP_MIDI_CTRL_DATA_DECREMENT                                    97
172 #define RTP_MIDI_CTRL_NON_REGISTERED_PARAM_LSB                          98
173 #define RTP_MIDI_CTRL_NON_REGISTERED_PARAM_MSB                          99
174 #define RTP_MIDI_CTRL_REGISTERED_PARAM_LSB                              100
175 #define RTP_MIDI_CTRL_REGISTERED_PARAM_MSB                              101
176 /* #define RTP_MIDI_CTRL_                                               102
177 #define RTP_MIDI_CTRL_                                                  103
178 #define RTP_MIDI_CTRL_                                                  104
179 #define RTP_MIDI_CTRL_                                                  105
180 #define RTP_MIDI_CTRL_                                                  106
181 #define RTP_MIDI_CTRL_                                                  107
182 #define RTP_MIDI_CTRL_                                                  108
183 #define RTP_MIDI_CTRL_                                                  109
184 #define RTP_MIDI_CTRL_                                                  110
185 #define RTP_MIDI_CTRL_                                                  111
186 #define RTP_MIDI_CTRL_                                                  112
187 #define RTP_MIDI_CTRL_                                                  113
188 #define RTP_MIDI_CTRL_                                                  114
189 #define RTP_MIDI_CTRL_                                                  115
190 #define RTP_MIDI_CTRL_                                                  116
191 #define RTP_MIDI_CTRL_                                                  117
192 #define RTP_MIDI_CTRL_                                                  118
193 #define RTP_MIDI_CTRL_                                                  119 */
194 /* MIDI Channel Mode Messages */
195 #define RTP_MIDI_CTRL_ALL_SOUND_OFF                                     120
196 #define RTP_MIDI_CTRL_RESET_ALL_CONTROLLERS                             121
197 #define RTP_MIDI_CTRL_LOCAL_CONTROL_ON_OFF                              122
198 #define RTP_MIDI_CTRL_ALL_NOTES_OFF                                     123
199 #define RTP_MIDI_CTRL_OMNI_MODE_OFF                                     124
200 #define RTP_MIDI_CTRL_OMNI_MODE_ON                                      125
201 #define RTP_MIDI_CTRL_MONO_MODE_ON                                      126
202 #define RTP_MIDI_CTRL_POLY_MODE_ON                                      127
203
204
205 /*
206  * MIDI Status Bytes (Channel Voice Messages)
207  */
208 #define RTP_MIDI_STATUS_CHANNEL_NOTE_OFF                                0x08            /* 0x8n         n->channel */
209 #define RTP_MIDI_STATUS_CHANNEL_NOTE_ON                                 0x09            /* 0x9n         n->channel */
210 #define RTP_MIDI_STATUS_CHANNEL_POLYPHONIC_KEY_PRESSURE                 0x0a            /* 0xan         n->channel */
211 #define RTP_MIDI_STATUS_CHANNEL_CONTROL_CHANGE                          0x0b            /* 0xbn         n->channel */
212 #define RTP_MIDI_STATUS_CHANNEL_PROGRAM_CHANGE                          0x0c            /* 0xcn         n->channel */
213 #define RTP_MIDI_STATUS_CHANNEL_CHANNEL_PRESSURE                        0x0d            /* 0xdn         n->channel */
214 #define RTP_MIDI_STATUS_CHANNEL_PITCH_BEND_CHANGE                       0x0e            /* 0xen         n->channel */
215
216 /*
217  * MIDI-Channels
218  */
219 #define RTP_MIDI_CHANNEL_1                                              0x00
220 #define RTP_MIDI_CHANNEL_2                                              0x01
221 #define RTP_MIDI_CHANNEL_3                                              0x02
222 #define RTP_MIDI_CHANNEL_4                                              0x03
223 #define RTP_MIDI_CHANNEL_5                                              0x04
224 #define RTP_MIDI_CHANNEL_6                                              0x05
225 #define RTP_MIDI_CHANNEL_7                                              0x06
226 #define RTP_MIDI_CHANNEL_8                                              0x07
227 #define RTP_MIDI_CHANNEL_9                                              0x08
228 #define RTP_MIDI_CHANNEL_10                                             0x09
229 #define RTP_MIDI_CHANNEL_11                                             0x0a
230 #define RTP_MIDI_CHANNEL_12                                             0x0b
231 #define RTP_MIDI_CHANNEL_13                                             0x0c
232 #define RTP_MIDI_CHANNEL_14                                             0x0d
233 #define RTP_MIDI_CHANNEL_15                                             0x0e
234 #define RTP_MIDI_CHANNEL_16                                             0x0f
235 #define RTP_MIDI_CHANNEL_MASK                                           0x0f
236
237
238 /*
239  * MIDI Status Bytes (System Exclusive Messages, System Common Messages, System Realtime Messages )
240  */
241 #define RTP_MIDI_STATUS_COMMON_SYSEX_START                              0xf0
242 #define RTP_MIDI_STATUS_COMMON_MTC_QUARTER_FRAME                        0xf1
243 #define RTP_MIDI_STATUS_COMMON_SONG_POSITION_POINTER                    0xf2
244 #define RTP_MIDI_STATUS_COMMON_SONG_SELECT                              0xf3
245 #define RTP_MIDI_STATUS_COMMON_UNDEFINED_F4                             0xf4
246 #define RTP_MIDI_STATUS_COMMON_UNDEFINED_F5                             0xf5
247 #define RTP_MIDI_STATUS_COMMON_TUNE_REQUEST                             0xf6
248 #define RTP_MIDI_STATUS_COMMON_SYSEX_END                                0xf7
249 #define RTP_MIDI_STATUS_COMMON_REALTIME_TIMING_CLOCK                    0xf8
250 #define RTP_MIDI_STATUS_COMMON_REALTIME_MIDI_TICK                       0xf9            /* Spec says undefined */
251 #define RTP_MIDI_STATUS_COMMON_REALTIME_START                           0xfa
252 #define RTP_MIDI_STATUS_COMMON_REALTIME_CONTINUE                        0xfb
253 #define RTP_MIDI_STATUS_COMMON_REALTIME_STOP                            0xfc
254 #define RTP_MIDI_STATUS_COMMON_REALTIME_UNDEFINED_FD                    0xfd
255 #define RTP_MIDI_STATUS_COMMON_REALTIME_ACTIVE_SENSING                  0xfe
256 #define RTP_MIDI_STATUS_COMMON_REALTIME_SYSTEM_RESET                    0xff
257
258
259 /*
260  * MIDI Universal Non-Realtime System Exclusive Messages (sysex-manu-id=0x7e)
261  */
262 #define RTP_MIDI_SYSEX_COMMON_NRT_SAMPLE_DUMP_HEADER                    0x01
263 #define RTP_MIDI_SYSEX_COMMON_NRT_SAMPLE_DATA_PACKET                    0x02
264 #define RTP_MIDI_SYSEX_COMMON_NRT_SAMPLE_DUMP_REQUEST                   0x03
265 #define RTP_MIDI_SYSEX_COMMON_NRT_MTC                                   0x04
266 #define RTP_MIDI_SYSEX_COMMON_NRT_SAMPLE_DUMP_EXTENSIONS                0x05
267 #define RTP_MIDI_SYSEX_COMMON_NRT_GENERAL_INFORMATION                   0x06
268 #define RTP_MIDI_SYSEX_COMMON_NRT_FILE_DUMP                             0x07
269 #define RTP_MIDI_SYSEX_COMMON_NRT_MIDI_TUNING_STANDARD                  0x08
270 #define RTP_MIDI_SYSEX_COMMON_NRT_GENERAL_MIDI                          0x09
271 #define RTP_MIDI_SYSEX_COMMON_NRT_DOWNLOADABLE_SOUNDS                   0x0a
272 #define RTP_MIDI_SYSEX_COMMON_NRT_END_OF_FILE                           0x7b
273 #define RTP_MIDI_SYSEX_COMMON_NRT_WAIT                                  0x7c
274 #define RTP_MIDI_SYSEX_COMMON_NRT_CANCEL                                0x7d
275 #define RTP_MIDI_SYSEX_COMMON_NRT_NAK                                   0x7e
276 #define RTP_MIDI_SYSEX_COMMON_NRT_ACK                                   0x7f
277
278
279 /*
280  * MIDI Universal Realtime System Exclusive Messages (sysex-manu-id=0x7f)
281  */
282 #define RTP_MIDI_SYSEX_COMMON_RT_MIDI_TIME_CODE                         0x01
283 #define RTP_MIDI_SYSEX_COMMON_RT_MIDI_SHOW_CONTROL                      0x02
284 #define RTP_MIDI_SYSEX_COMMON_RT_NOTATION_INFORMATION                   0x03
285 #define RTP_MIDI_SYSEX_COMMON_RT_DEVICE_CONTROL                         0x04
286 #define RTP_MIDI_SYSEX_COMMON_RT_MTC_CUEING                             0x05
287 #define RTP_MIDI_SYSEX_COMMON_RT_MIDI_MACHINE_CONTROL_COMMAND           0x06
288 #define RTP_MIDI_SYSEX_COMMON_RT_MIDI_MACHINE_CONTROL_RESPONSE          0x07
289 #define RTP_MIDI_SYSEX_COMMON_RT_MIDI_TUNING_STANDARD                   0x08
290
291
292 /* List of short MIDI-manufacturer-IDs - needs to be completed! */
293 #define RTP_MIDI_MANU_SHORT_ISLONG                                      0x00
294 #define RTP_MIDI_MANU_SHORT_SEQUENTIAL_CIRCUITS                         0x01
295 #define RTP_MIDI_MANU_SHORT_BIG_BRIAR_IDP                               0x02
296 #define RTP_MIDI_MANU_SHORT_OCTAVE_PLATEAU_VOYETRA                      0x03
297 #define RTP_MIDI_MANU_SHORT_MOOG                                        0x04
298 #define RTP_MIDI_MANU_SHORT_PASSPORT_DESIGNS                            0x05
299 #define RTP_MIDI_MANU_SHORT_LEXICON                                     0x06
300 #define RTP_MIDI_MANU_SHORT_KURZWEIL                                    0x07
301 #define RTP_MIDI_MANU_SHORT_FENDER                                      0x08
302 #define RTP_MIDI_MANU_SHORT_GULBRANSEN                                  0x09
303 #define RTP_MIDI_MANU_SHORT_AKG_ACOUSTICS                               0x0a
304 #define RTP_MIDI_MANU_SHORT_VOYCE_MUSIC                                 0x0b
305 #define RTP_MIDI_MANU_SHORT_WAVEFRAME                                   0x0c
306 #define RTP_MIDI_MANU_SHORT_ADA_SIGNAL_PROCESSORS                       0x0d
307 #define RTP_MIDI_MANU_SHORT_GARFIELD_ELECTRONICS                        0x0e
308 #define RTP_MIDI_MANU_SHORT_ENSONIQ                                     0x0f
309 #define RTP_MIDI_MANU_SHORT_OBERHEIM_GIBSON_LABS                        0x10
310 #define RTP_MIDI_MANU_SHORT_APPLE_COMPUTERS                             0x11
311 #define RTP_MIDI_MANU_SHORT_GREY_MATTER_RESPONSE                        0x12
312 #define RTP_MIDI_MANU_SHORT_DIGIDESIGN                                  0x13
313 #define RTP_MIDI_MANU_SHORT_PALMTREE_INSTRUMENTS                        0x14
314 #define RTP_MIDI_MANU_SHORT_JL_COOPER                                   0x15
315 #define RTP_MIDI_MANU_SHORT_LOWREY                                      0x16
316 #define RTP_MIDI_MANU_SHORT_LINN_ADAMS_SMITH                            0x17
317 #define RTP_MIDI_MANU_SHORT_EMU_SYSTEMS                                 0x18
318 #define RTP_MIDI_MANU_SHORT_HARMONY_SYSTEMS                             0x19
319 #define RTP_MIDI_MANU_SHORT_ART                                         0x1a
320 #define RTP_MIDI_MANU_SHORT_BALDWIN                                     0x1b
321 #define RTP_MIDI_MANU_SHORT_EVENTIDE                                    0x1c
322 #define RTP_MIDI_MANU_SHORT_INVENTRONICS                                0x1d
323 #define RTP_MIDI_MANU_SHORT_KEY_CONCEPTS                                0x1e
324 #define RTP_MIDI_MANU_SHORT_CLARITY                                     0x1f
325 #define RTP_MIDI_MANU_SHORT_PASSAC                                      0x20
326 #define RTP_MIDI_MANU_SHORT_SIEL                                        0x21
327 #define RTP_MIDI_MANU_SHORT_SYNTHE_AXE                                  0x22
328 #define RTP_MIDI_MANU_SHORT_STEPP                                       0x23
329 #define RTP_MIDI_MANU_SHORT_HOHNER                                      0x24
330 #define RTP_MIDI_MANU_SHORT_CRUMAR_TWISTER                              0x25
331 #define RTP_MIDI_MANU_SHORT_SOLTON                                      0x26
332 #define RTP_MIDI_MANU_SHORT_JELLINGHAUS_MS                              0x27
333 #define RTP_MIDI_MANU_SHORT_SOUTHWORK_MUSIC_SYSTEMS                     0x28
334 #define RTP_MIDI_MANU_SHORT_PPG                                         0x29
335 #define RTP_MIDI_MANU_SHORT_JEN                                         0x2a
336 #define RTP_MIDI_MANU_SHORT_SSL                                         0x2b
337 #define RTP_MIDI_MANU_SHORT_AUDIO_VERITRIEB                             0x2c
338 #define RTP_MIDI_MANU_SHORT_NEVE_HINTON_INSTRUMENTS                     0x2d
339 #define RTP_MIDI_MANU_SHORT_SOUNDTRACS                                  0x2e
340 #define RTP_MIDI_MANU_SHORT_ELKA_GENERAL_MUSIC                          0x2f
341 #define RTP_MIDI_MANU_SHORT_DYNACORD                                    0x30
342 #define RTP_MIDI_MANU_SHORT_VISCOUNT                                    0x31
343 #define RTP_MIDI_MANU_SHORT_DRAWMER                                     0x32
344 #define RTP_MIDI_MANU_SHORT_CLAVIA_DIGITAL_INSTRUMENTS                  0x33
345 #define RTP_MIDI_MANU_SHORT_AUDIO_ARCHITECTURE                          0x34
346 #define RTP_MIDI_MANU_SHORT_GENERAL_MUSIC_CORP                          0x35
347 #define RTP_MIDI_MANU_SHORT_CHEETAH                                     0x36
348 #define RTP_MIDI_MANU_SHORT_CTM                                         0x37
349 #define RTP_MIDI_MANU_SHORT_SIMMONS_UK                                  0x38
350 #define RTP_MIDI_MANU_SHORT_SOUNDCRAFT_ELECTRONICS                      0x39
351 #define RTP_MIDI_MANU_SHORT_STEINBERG_GMBH                              0x3a
352 #define RTP_MIDI_MANU_SHORT_WERSI                                       0x3b
353 #define RTP_MIDI_MANU_SHORT_AVAB_ELEKTRONIK_AB                          0x3c
354 #define RTP_MIDI_MANU_SHORT_DIGIGRAM                                    0x3d
355 #define RTP_MIDI_MANU_SHORT_WALDORF                                     0x3e
356 #define RTP_MIDI_MANU_SHORT_QUASIMIDI                                   0x3f
357 #define RTP_MIDI_MANU_SHORT_KAWAI                                       0x40
358 #define RTP_MIDI_MANU_SHORT_ROLAND                                      0x41
359 #define RTP_MIDI_MANU_SHORT_KORG                                        0x42
360 #define RTP_MIDI_MANU_SHORT_YAMAHA                                      0x43
361 #define RTP_MIDI_MANU_SHORT_CASIO                                       0x44
362 #define RTP_MIDI_MANU_SHORT_MORIDAIRA                                   0x45
363 #define RTP_MIDI_MANU_SHORT_KAMIYA_STUDIO                               0x46
364 #define RTP_MIDI_MANU_SHORT_AKAI                                        0x47
365 #define RTP_MIDI_MANU_SHORT_JAPAN_VICTOR                                0x48
366 #define RTP_MIDI_MANU_SHORT_MEISOSHA                                    0x49
367 #define RTP_MIDI_MANU_SHORT_HOSHINO_GAKKI                               0x4a
368 #define RTP_MIDI_MANU_SHORT_FUJITSU                                     0x4b
369 #define RTP_MIDI_MANU_SHORT_SONY                                        0x4c
370 #define RTP_MIDI_MANU_SHORT_NISSHIN_ONPA                                0x4d
371 #define RTP_MIDI_MANU_SHORT_TEAC                                        0x4e
372 /* #define RTP_MIDI_MANU_SHORT_                                         0x4f */
373 #define RTP_MIDI_MANU_SHORT_MATSUSHITA_ELECTRIC                         0x50
374 #define RTP_MIDI_MANU_SHORT_FOSTEX                                      0x51
375 #define RTP_MIDI_MANU_SHORT_ZOOM                                        0x52
376 #define RTP_MIDI_MANU_SHORT_MIDORI_ELECTRONICS                          0x53
377 #define RTP_MIDI_MANU_SHORT_MATSUSHITA_COMMUNICATION                    0x54
378 #define RTP_MIDI_MANU_SHORT_SUZUKI                                      0x55
379 #define RTP_MIDI_MANU_SHORT_FUJI                                        0x56
380 #define RTP_MIDI_MANU_SHORT_ACOUSTIC_TECHNICAL_LAB                      0x57
381 /* #define RTP_MIDI_MANU_SHORT_                                         0x58 */
382 #define RTP_MIDI_MANU_SHORT_FAITH                                       0x59
383 #define RTP_MIDI_MANU_SHORT_INTERNET_CORPORATION                        0x5a
384 /* #define RTP_MIDI_MANU_SHORT_                                         0x5b */
385 #define RTP_MIDI_MANU_SHORT_SEEKERS_CO                                  0x5c
386 /* #define RTP_MIDI_MANU_SHORT_                                         0x5d */
387 /* #define RTP_MIDI_MANU_SHORT_                                         0x5e */
388 #define RTP_MIDI_MANU_SHORT_SD_CARD_ASSOCIATION                         0x5f
389 /* #define RTP_MIDI_MANU_SHORT_                                         0x60
390 #define RTP_MIDI_MANU_SHORT_                                            0x61
391 #define RTP_MIDI_MANU_SHORT_                                            0x62
392 #define RTP_MIDI_MANU_SHORT_                                            0x63
393 #define RTP_MIDI_MANU_SHORT_                                            0x64
394 #define RTP_MIDI_MANU_SHORT_                                            0x65
395 #define RTP_MIDI_MANU_SHORT_                                            0x66
396 #define RTP_MIDI_MANU_SHORT_                                            0x67
397 #define RTP_MIDI_MANU_SHORT_                                            0x68
398 #define RTP_MIDI_MANU_SHORT_                                            0x69
399 #define RTP_MIDI_MANU_SHORT_                                            0x6a
400 #define RTP_MIDI_MANU_SHORT_                                            0x6b
401 #define RTP_MIDI_MANU_SHORT_                                            0x6c
402 #define RTP_MIDI_MANU_SHORT_                                            0x6d
403 #define RTP_MIDI_MANU_SHORT_                                            0x6e
404 #define RTP_MIDI_MANU_SHORT_                                            0x6f
405 #define RTP_MIDI_MANU_SHORT_                                            0x70
406 #define RTP_MIDI_MANU_SHORT_                                            0x71
407 #define RTP_MIDI_MANU_SHORT_                                            0x72
408 #define RTP_MIDI_MANU_SHORT_                                            0x73
409 #define RTP_MIDI_MANU_SHORT_                                            0x74
410 #define RTP_MIDI_MANU_SHORT_                                            0x75
411 #define RTP_MIDI_MANU_SHORT_                                            0x76
412 #define RTP_MIDI_MANU_SHORT_                                            0x77
413 #define RTP_MIDI_MANU_SHORT_                                            0x78
414 #define RTP_MIDI_MANU_SHORT_                                            0x79
415 #define RTP_MIDI_MANU_SHORT_                                            0x7a
416 #define RTP_MIDI_MANU_SHORT_                                            0x7b
417 #define RTP_MIDI_MANU_SHORT_                                            0x7c */
418 #define RTP_MIDI_MANU_SHORT_EDUCATIONAL_USE                             0x7d
419 #define RTP_MIDI_MANU_SHORT_NON_REALTIME_UNIVERSAL                      0x7e
420 #define RTP_MIDI_MANU_SHORT_REALTIME_UNIVERSAL                          0x7f
421
422
423 /* List of long MIDI-manufacturer-IDs - needs to be completed! */
424 /* North American Manufacturers */
425 /* #define RTP_MIDI_MANU_LONG_TIME_                                     0x0000 */
426 #define RTP_MIDI_MANU_LONG_TIME_WARNER_INTERACTIVE                      0x0001
427 #define RTP_MIDI_MANU_LONG_ADVANCED_GRAVIS_COMP                         0x0002
428 #define RTP_MIDI_MANU_LONG_MEDIA_VISION                                 0x0003
429 #define RTP_MIDI_MANU_LONG_DORNES_RESEARCH_GROUP                        0x0004
430 #define RTP_MIDI_MANU_LONG_KMUSE                                        0x0005
431 #define RTP_MIDI_MANU_LONG_STYPHER                                      0x0006
432 #define RTP_MIDI_MANU_LONG_DIGITAL_MUSIC_CORPORATION                    0x0007
433 #define RTP_MIDI_MANU_LONG_IOTA_SYSTEMS                                 0x0008
434 #define RTP_MIDI_MANU_LONG_NEW_ENGLAND_DIGITAL                          0x0009
435 #define RTP_MIDI_MANU_LONG_ARTISYN                                      0x000a
436 #define RTP_MIDI_MANU_LONG_IVL_TECHNOLOGIES                             0x000b
437 #define RTP_MIDI_MANU_LONG_SOUTHERN_MUSIC_SYSTEMS                       0x000c
438 #define RTP_MIDI_MANU_LONG_LAKE_BUTLER_SOUND_COMPANY                    0x000d
439 #define RTP_MIDI_MANU_LONG_ALESIS                                       0x000e
440 #define RTP_MIDI_MANU_LONG_SOUND_CREATION                               0x000f
441 #define RTP_MIDI_MANU_LONG_DOD_ELECTRONICS                              0x0010
442 #define RTP_MIDI_MANU_LONG_STUDER_EDITECH                               0x0011
443 #define RTP_MIDI_MANU_LONG_SONUS                                        0x0012
444 #define RTP_MIDI_MANU_LONG_TEMPORAL_ACUITY_PRODUCTS                     0x0013
445 #define RTP_MIDI_MANU_LONG_PERFECT_FRETWORKS                            0x0014
446 #define RTP_MIDI_MANU_LONG_KAT                                          0x0015
447 #define RTP_MIDI_MANU_LONG_OPCODE                                       0x0016
448 #define RTP_MIDI_MANU_LONG_RANE_CORP                                    0x0017
449 #define RTP_MIDI_MANU_LONG_SPATIAL_SOUND_ANADI_INC                      0x0018
450 #define RTP_MIDI_MANU_LONG_KMX                                          0x0019
451 #define RTP_MIDI_MANU_LONG_ALLEN_AND_HEATH_BRENNEL                      0x001a
452 #define RTP_MIDI_MANU_LONG_PEAVEY                                       0x001b
453 #define RTP_MIDI_MANU_LONG_360_SYSTEMS                                  0x001c
454 #define RTP_MIDI_MANU_LONG_SPECTRUM_DESIGN_DEVELOPMENT                  0x001d
455 #define RTP_MIDI_MANU_LONG_MARQUIS_MUSIC                                0x001e
456 #define RTP_MIDI_MANU_LONG_ZETA_SYSTEMS                                 0x001f
457 #define RTP_MIDI_MANU_LONG_AXXES                                        0x0020
458 #define RTP_MIDI_MANU_LONG_ORBAN                                        0x0021
459 #define RTP_MIDI_MANU_LONG_INDIAN_VALLEY                                0x0022
460 #define RTP_MIDI_MANU_LONG_TRITON                                       0x0023
461 #define RTP_MIDI_MANU_LONG_KTI                                          0x0024
462 #define RTP_MIDI_MANU_LONG_BREAKAWAY_TECHNOLOGIES                       0x0025
463 #define RTP_MIDI_MANU_LONG_CAE                                          0x0026
464 #define RTP_MIDI_MANU_LONG_HARRISON_SYSTEMS_INC                         0x0027
465 #define RTP_MIDI_MANU_LONG_FUTURE_LAB_MARK_KUO                          0x0028
466 #define RTP_MIDI_MANU_LONG_ROCKTRON_CORP                                0x0029
467 #define RTP_MIDI_MANU_LONG_PIANODISC                                    0x002a
468 #define RTP_MIDI_MANU_LONG_CANNON_RESEARCH_GROUP                        0x002b
469 /* #define RTP_MIDI_MANU_LONG_                                          0x002c */
470 #define RTP_MIDI_MANU_LONG_RODGERS_INSTRUMENTS_CORP                     0x002d
471 #define RTP_MIDI_MANU_LONG_BLUE_SKY_LOGIC                               0x002e
472 #define RTP_MIDI_MANU_LONG_ENCORE_ELECTRONICS                           0x002f
473 #define RTP_MIDI_MANU_LONG_UPTOWN                                       0x0030
474 #define RTP_MIDI_MANU_LONG_VOCE                                         0x0031
475 #define RTP_MIDI_MANU_LONG_CTI_AUDIO_INC                                0x0032
476 #define RTP_MIDI_MANU_LONG_SS_RESEARCH                                  0x0033
477 #define RTP_MIDI_MANU_LONG_BRODERBUND_SOFTWARE                          0x0034
478 #define RTP_MIDI_MANU_LONG_ALLEN_ORGAN_CO                               0x0035
479 /* #define RTP_MIDI_MANU_LONG_                                          0x0036 */
480 #define RTP_MIDI_MANU_LONG_MUSIC_QUEST                                  0x0037
481 #define RTP_MIDI_MANU_LONG_APHEX                                        0x0038
482 #define RTP_MIDI_MANU_LONG_GALLIEN_KRUEGER                              0x0039
483 #define RTP_MIDI_MANU_LONG_IBM                                          0x003a
484 #define RTP_MIDI_MANU_LONG_MARK_OF_THE_UNICORN                          0x003b
485 #define RTP_MIDI_MANU_LONG_HOTZ_INSTRUMENTS_TECH                        0x003c
486 #define RTP_MIDI_MANU_LONG_ETA_LIGHTING                                 0x003d
487 #define RTP_MIDI_MANU_LONG_NSI_CORPORATION                              0x003e
488 #define RTP_MIDI_MANU_LONG_ADLIB_INC                                    0x003f
489 #define RTP_MIDI_MANU_LONG_RICHMOND_SOUND_DESIGN                        0x0040
490 #define RTP_MIDI_MANU_LONG_MICROSOFT                                    0x0041
491 #define RTP_MIDI_MANU_LONG_THE_SOFTWARE_TOOLWORKS                       0x0042
492 #define RTP_MIDI_MANU_LONG_RJMG_NICHE                                   0x0043
493 #define RTP_MIDI_MANU_LONG_INTONE                                       0x0044
494 #define RTP_MIDI_MANU_LONG_ADVANCED_REMOTE_TECH                         0x0045
495 /* #define RTP_MIDI_MANU_LONG_                                          0x0046 */
496 #define RTP_MIDI_MANU_LONG_GT_ELECTRONICS_GROOVE_TUBES                  0x0047
497 #define RTP_MIDI_MANU_LONG_INTERMIDI                                    0x0048
498 #define RTP_MIDI_MANU_LONG_TIMELINE_VISTA                               0x0049
499 #define RTP_MIDI_MANU_LONG_MESA_BOOGIE                                  0x004a
500 /* #define RTP_MIDI_MANU_LONG_                                          0x004b */
501 #define RTP_MIDI_MANU_LONG_SEQUOIA_DEVELOPMENT                          0x004c
502 #define RTP_MIDI_MANU_LONG_STUDIO_ELECTRONICS                           0x004d
503 #define RTP_MIDI_MANU_LONG_EUPHONIX                                     0x004e
504 #define RTP_MIDI_MANU_LONG_INTERMIDI2                                   0x004f
505 #define RTP_MIDI_MANU_LONG_MIDI_SOLUTIONS                               0x0050
506 #define RTP_MIDI_MANU_LONG_3DO_COMPANY                                  0x0051
507 #define RTP_MIDI_MANU_LONG_LIGHTWAVE_RESEARCH                           0x0052
508 #define RTP_MIDI_MANU_LONG_MICROW                                       0x0053
509 #define RTP_MIDI_MANU_LONG_SPECTRAL_SYNTHESIS                           0x0054
510 #define RTP_MIDI_MANU_LONG_LONE_WOLF                                    0x0055
511 #define RTP_MIDI_MANU_LONG_STUDIO_TECHNOLOGIES                          0x0056
512 #define RTP_MIDI_MANU_LONG_PETERSON_EMP                                 0x0057
513 #define RTP_MIDI_MANU_LONG_ATARI                                        0x0058
514 #define RTP_MIDI_MANU_LONG_MARION_SYSTEMS                               0x0059
515 #define RTP_MIDI_MANU_LONG_DESIGN_EVENT                                 0x005a
516 #define RTP_MIDI_MANU_LONG_WINJAMMER_SOFTWARE                           0x005b
517 #define RTP_MIDI_MANU_LONG_ATT_BELL_LABS                                0x005c
518 /*# define RTP_MIDI_MANU_LONG_                                          0x005d */
519 #define RTP_MIDI_MANU_LONG_SYMETRIX                                     0x005e
520 #define RTP_MIDI_MANU_LONG_MIDI_THE_WORLD                               0x005f
521 #define RTP_MIDI_MANU_LONG_DESPER_PRODUCTS                              0x0060
522 #define RTP_MIDI_MANU_LONG_MICROS_N_MIDI                                0x0061
523 #define RTP_MIDI_MANU_LONG_ACCORDIANS_INTL                              0x0062
524 #define RTP_MIDI_MANU_LONG_EUPHONICS                                    0x0063
525 #define RTP_MIDI_MANU_LONG_MUSONIX                                      0x0064
526 #define RTP_MIDI_MANU_LONG_TURTLE_BEACH_SYSTEMS                         0x0065
527 #define RTP_MIDI_MANU_LONG_MACKIE_DESIGNS                               0x0066
528 #define RTP_MIDI_MANU_LONG_COMPUSERVE                                   0x0067
529 #define RTP_MIDI_MANU_LONG_BES_TECHNOLOGIES                             0x0068
530 #define RTP_MIDI_MANU_LONG_QRS_MUSIC_ROLLS                              0x0069
531 #define RTP_MIDI_MANU_LONG_P_G_MUSIC                                    0x006a
532 #define RTP_MIDI_MANU_LONG_SIERRA_SEMICONDUCTOR                         0x006b
533 #define RTP_MIDI_MANU_LONG_EPIGRAF_AUDIO_VISUAL                         0x006c
534 #define RTP_MIDI_MANU_LONG_ELECTRONICS_DIVERSIFIED                      0x006d
535 #define RTP_MIDI_MANU_LONG_TUNE_1000                                    0x006e
536 #define RTP_MIDI_MANU_LONG_ADVANCED_MICRO_DEVICES                       0x006f
537 #define RTP_MIDI_MANU_LONG_MEDIAMATION                                  0x0070
538 #define RTP_MIDI_MANU_LONG_SABINE_MUSIC                                 0x0071
539 #define RTP_MIDI_MANU_LONG_WOOG_LABS                                    0x0072
540 #define RTP_MIDI_MANU_LONG_MIRCOPOLIS                                   0x0073
541 #define RTP_MIDI_MANU_LONG_TA_HORNG_MUSICAL_INSTRUMENT                  0x0074
542 #define RTP_MIDI_MANU_LONG_ETEK_LABS_FORTE_TECH                         0x0075
543 #define RTP_MIDI_MANU_LONG_ELECTRO_VOICE                                0x0076
544 #define RTP_MIDI_MANU_LONG_MIDISOFT_CORPORATION                         0x0077
545 #define RTP_MIDI_MANU_LONG_QSOUND_LABS                                  0x0078
546 #define RTP_MIDI_MANU_LONG_WESTREX                                      0x0079
547 #define RTP_MIDI_MANU_LONG_NVIDIA                                       0x007a
548 #define RTP_MIDI_MANU_LONG_ESS_TECHNOLOGY                               0x007b
549 #define RTP_MIDI_MANU_LONG_MEDIATRIX_PERIPHERALS                        0x007c
550 #define RTP_MIDI_MANU_LONG_BROOKTREE_CORP                               0x007d
551 #define RTP_MIDI_MANU_LONG_OTARI_CORP                                   0x007e
552 #define RTP_MIDI_MANU_LONG_KEY_ELECTRONICS                              0x007f
553 /* ---break--- */
554 #define RTP_MIDI_MANU_LONG_SHURE_INCORPORATED                           0x0100
555 #define RTP_MIDI_MANU_LONG_AURA_SOUND                                   0x0101
556 #define RTP_MIDI_MANU_LONG_CRYSTAL_SEMICONDUCTOR                        0x0102
557 #define RTP_MIDI_MANU_LONG_CONEXANT_ROCKWELL                            0x0103
558 #define RTP_MIDI_MANU_LONG_SILICON_GRAPHICS                             0x0104
559 #define RTP_MIDI_MANU_LONG_MAUDIO_MIDIMAN                               0x0105
560 #define RTP_MIDI_MANU_LONG_PRESONUS                                     0x0106
561 /* #define RTP_MIDI_MANU_LONG_                                          0x0107 */
562 #define RTP_MIDI_MANU_LONG_TOPAZ_ENTERPRISES                            0x0108
563 #define RTP_MIDI_MANU_LONG_CAST_LIGHTING                                0x0109
564 #define RTP_MIDI_MANU_LONG_MICROSOFT_CONSUMER_DIVISION                  0x010a
565 #define RTP_MIDI_MANU_LONG_SONIC_FOUNDRY                                0x010b
566 #define RTP_MIDI_MANU_LONG_LINE6_FAST_FORWARD                           0x010c
567 #define RTP_MIDI_MANU_LONG_BEATNIK_INC                                  0x010d
568 #define RTP_MIDI_MANU_LONG_VAN_KOEVERING_COMPANY                        0x010e
569 #define RTP_MIDI_MANU_LONG_ALTECH_SYSTEMS                               0x010f
570 #define RTP_MIDI_MANU_LONG_S_S_RESEARCH                                 0x0110
571 #define RTP_MIDI_MANU_LONG_VLSI_TECHNOLOGY                              0x0111
572 #define RTP_MIDI_MANU_LONG_CHROMATIC_RESEARCH                           0x0112
573 #define RTP_MIDI_MANU_LONG_SAPPHIRE                                     0x0113
574 #define RTP_MIDI_MANU_LONG_IDRC                                         0x0114
575 #define RTP_MIDI_MANU_LONG_JUSTONIC_TUNING                              0x0115
576 #define RTP_MIDI_MANU_LONG_TORCOMP_RESEARCH_INC                         0x0116
577 #define RTP_MIDI_MANU_LONG_NEWTEK_INC                                   0x0117
578 #define RTP_MIDI_MANU_LONG_SOUND_SCULPTURE                              0x0118
579 #define RTP_MIDI_MANU_LONG_WALKER_TECHNICAL                             0x0119
580 #define RTP_MIDI_MANU_LONG_DIGITAL_HARMONY                              0x011a
581 #define RTP_MIDI_MANU_LONG_INVISION_INTERACTIVE                         0x011b
582 #define RTP_MIDI_MANU_LONG_TSQUARE_DESIGN                               0x011c
583 #define RTP_MIDI_MANU_LONG_NEMESYS_MUSIC_TECHNOLOGY                     0x011d
584 #define RTP_MIDI_MANU_LONG_DBX_PROFESSIONAL_HARMAN_INTL                 0x011e
585 #define RTP_MIDI_MANU_LONG_SYNDYNE_CORPORATION                          0x011f
586 #define RTP_MIDI_MANU_LONG_BITHEADZ                                     0x0120
587 #define RTP_MIDI_MANU_LONG_CAKEWALK_MUSIC_SOFTWARE                      0x0121
588 #define RTP_MIDI_MANU_LONG_ANALOG_DEVICES                               0x0122
589 #define RTP_MIDI_MANU_LONG_NATIONAL_SEMICONDUCTOR                       0x0123
590 #define RTP_MIDI_MANU_LONG_BOOM_THEORY                                  0x0124
591 #define RTP_MIDI_MANU_LONG_VIRTUAL_DSP_CORPORATION                      0x0125
592 #define RTP_MIDI_MANU_LONG_ANTARES_SYSTEMS                              0x0126
593 #define RTP_MIDI_MANU_LONG_ANGEL_SOFTWARE                               0x0127
594 #define RTP_MIDI_MANU_LONG_ST_LOUIS_MUSIC                               0x0128
595 #define RTP_MIDI_MANU_LONG_LYRRUS_DBA_GVOX                              0x0129
596 #define RTP_MIDI_MANU_LONG_ASHLEY_AUDIO_INC                             0x012a
597 #define RTP_MIDI_MANU_LONG_VARILITE_INC                                 0x012b
598 #define RTP_MIDI_MANU_LONG_SUMMIT_AUDIO_INC                             0x012c
599 #define RTP_MIDI_MANU_LONG_AUREAL_SEMICONDUCTOR_INC                     0x012d
600 #define RTP_MIDI_MANU_LONG_SEASOUND_LLC                                 0x012e
601 #define RTP_MIDI_MANU_LONG_US_ROBOTICS                                  0x012f
602 #define RTP_MIDI_MANU_LONG_AURISIS_RESEARCH                             0x0130
603 #define RTP_MIDI_MANU_LONG_NEARFIELD_MULTIMEDIA                         0x0131
604 #define RTP_MIDI_MANU_LONG_FM7_INC                                      0x0132
605 #define RTP_MIDI_MANU_LONG_SWIVEL_SYSTEMS                               0x0133
606 #define RTP_MIDI_MANU_LONG_HYPERACTIVE_AUDIO_SYSTEMS                    0x0134
607 #define RTP_MIDI_MANU_LONG_MIDILITE_CASTE_STUDIO_PROD                   0x0135
608 #define RTP_MIDI_MANU_LONG_RADIKAL_TECHNOLOGIES                         0x0136
609 #define RTP_MIDI_MANU_LONG_ROGER_LINN_DESIGN                            0x0137
610 #define RTP_MIDI_MANU_LONG_TCHELION_VOCAL_TECHNOLOGIES                  0x0138
611 #define RTP_MIDI_MANU_LONG_EVENT_ELECTRONICS                            0x0139
612 #define RTP_MIDI_MANU_LONG_SONIC_NETWORK_INC                            0x013a
613 #define RTP_MIDI_MANU_LONG_REALTIME_MUSIC_SOLUTIONS                     0x013b
614 #define RTP_MIDI_MANU_LONG_APOGEE_DIGITAL                               0x013c
615 #define RTP_MIDI_MANU_LONG_CLASSICAL_ORGANS_INC                         0x013d
616 #define RTP_MIDI_MANU_LONG_MICROTOOLS_INC                               0x013e
617 #define RTP_MIDI_MANU_LONG_NUMARK_INDUSTRIES                            0x013f
618 #define RTP_MIDI_MANU_LONG_FRONTIER_DESIGN_GROUP_LLC                    0x0140
619 #define RTP_MIDI_MANU_LONG_RECORDARE_LLC                                0x0141
620 #define RTP_MIDI_MANU_LONG_STARR_LABS                                   0x0142
621 #define RTP_MIDI_MANU_LONG_VOYAGER_SOUND_INC                            0x0143
622 #define RTP_MIDI_MANU_LONG_MANIFOLD_LABS                                0x0144
623 #define RTP_MIDI_MANU_LONG_AVIOM_INC                                    0x0145
624 #define RTP_MIDI_MANU_LONG_MIXMEISTER_TECHNOLOGY                        0x0146
625 #define RTP_MIDI_MANU_LONG_NOTATION_SOFTWARE                            0x0147
626 #define RTP_MIDI_MANU_LONG_MERCURIAL_COMMUNICATIONS                     0x0148
627 #define RTP_MIDI_MANU_LONG_WAVE_ARTS                                    0x0149
628 #define RTP_MIDI_MANU_LONG_LOGIC_SEQUENCING_DEVICES                     0x014a
629 #define RTP_MIDI_MANU_LONG_AXESS_ELECTRONICS                            0x014b
630 #define RTP_MIDI_MANU_LONG_MUSE_RESEARCH                                0x014c
631 #define RTP_MIDI_MANU_LONG_OPEN_LABS                                    0x014d
632 #define RTP_MIDI_MANU_LONG_GUILLEMOT_RD_INC                             0x014e
633 #define RTP_MIDI_MANU_LONG_SAMSON_TECHNOLOGIES                          0x014f
634 #define RTP_MIDI_MANU_LONG_ELECTRONIC_THEATRE_CONTROLS                  0x0150
635 #define RTP_MIDI_MANU_LONG_RESEARCH_IN_MOTION                           0x0151
636 #define RTP_MIDI_MANU_LONG_MOBILEER                                     0x0152
637 #define RTP_MIDI_MANU_LONG_SYNTHOGY                                     0x0153
638 #define RTP_MIDI_MANU_LONG_LYNX_STUDIO_TECHNOLOGY_INC                   0x0154
639 #define RTP_MIDI_MANU_LONG_DAMAGE_CONTROL_ENGINEERING                   0x0155
640 #define RTP_MIDI_MANU_LONG_YOST_ENGINEERING_INC                         0x0156
641 #define RTP_MIDI_MANU_LONG_BROOKS_FORSMAN_DESIGNS_LLC                   0x0157
642 #define RTP_MIDI_MANU_LONG_MAGNEKEY                                     0x0158
643 #define RTP_MIDI_MANU_LONG_GARRITAN_CORP                                0x0159
644 #define RTP_MIDI_MANU_LONG_PLOQUE_ART_ET_TECHNOLOGIE                    0x015a
645 #define RTP_MIDI_MANU_LONG_RJM_MUSIC_TECHNOLOGY                         0x015b
646 #define RTP_MIDI_MANU_LONG_CUSTOM_SOLUTIONS_SOFTWARE                    0x015c
647 #define RTP_MIDI_MANU_LONG_SONARCANA_LLC                                0x015d
648 #define RTP_MIDI_MANU_LONG_CENTRANCE                                    0x015e
649 #define RTP_MIDI_MANU_LONG_KESUMO_LLC                                   0x015f
650 #define RTP_MIDI_MANU_LONG_STANTON                                      0x0160
651 #define RTP_MIDI_MANU_LONG_LIVID_INSTRUMENTS                            0x0161
652 #define RTP_MIDI_MANU_LONG_FIRST_ACT_745_MEDIA                          0x0162
653 #define RTP_MIDI_MANU_LONG_PYGRAPHICS_INC                               0x0163
654 #define RTP_MIDI_MANU_LONG_PANADIGM_INNOVATIONS_LTD                     0x0164
655 #define RTP_MIDI_MANU_LONG_AVEDIS_ZILDJIAN_CO                           0x0165
656 #define RTP_MIDI_MANU_LONG_AUVITAL_MUSIC_CORP                           0x0166
657 #define RTP_MIDI_MANU_LONG_INSPIRED_INSTRUMENTS_INC                     0x0167
658 #define RTP_MIDI_MANU_LONG_CHRIS_GRIGG_DESIGNS                          0x0168
659 #define RTP_MIDI_MANU_LONG_SLATE_DIGITAL_LLC                            0x0169
660 #define RTP_MIDI_MANU_LONG_MIXWARE                                      0x016a
661 #define RTP_MIDI_MANU_LONG_SOCIAL_ENTROPY                               0x016b
662 #define RTP_MIDI_MANU_LONG_SOURCE_AUDIO_LLC                             0x016c
663 #define RTP_MIDI_MANU_LONG_RESERVED_016d                                0x016d
664 #define RTP_MIDI_MANU_LONG_RESERVED_016e                                0x016e
665 #define RTP_MIDI_MANU_LONG_RESERVED_016f                                0x016f
666 #define RTP_MIDI_MANU_LONG_AMERICAN_AUDIO_DJ                            0x0170
667 #define RTP_MIDI_MANU_LONG_MEGA_CONTROL_SYSTEMS                         0x0171
668 #define RTP_MIDI_MANU_LONG_KILPATRICK_AUDIO                             0x0172
669 #define RTP_MIDI_MANU_LONG_IKINGDOM_CORP                                0x0173
670 #define RTP_MIDI_MANU_LONG_FRACTAL_AUDIO                                0x0174
671 #define RTP_MIDI_MANU_LONG_NETLOGIC_MICROSYSTEMS                        0x0175
672 #define RTP_MIDI_MANU_LONG_MUSIC_COMPUTING                              0x0176
673 #define RTP_MIDI_MANU_LONG_NEKTAR_TECHNOLOGY_INC                        0x0177
674 #define RTP_MIDI_MANU_LONG_ZENPH_SOUND_INNOVATIONS                      0x0178
675 #define RTP_MIDI_MANU_LONG_DJTECHTOOLS_COM                              0x0179
676 #define RTP_MIDI_MANU_LONG_RESERVED_017a                                0x017a
677
678 /* European manufacturers */
679 #define RTP_MIDI_MANU_LONG_DREAM                                        0x2000
680 #define RTP_MIDI_MANU_LONG_STRAND_LIGHTING                              0x2001
681 #define RTP_MIDI_MANU_LONG_AMEK_SYSTEMS                                 0x2002
682 #define RTP_MIDI_MANU_LONG_CASA_DI_RISPARMIO_DI_LORETO                  0x2003
683 #define RTP_MIDI_MANU_LONG_BOHM_ELECTRONIC                              0x2004
684 #define RTP_MIDI_MANU_LONG_SYNTEC_DIGITAL_AUDIO                         0x2005
685 #define RTP_MIDI_MANU_LONG_TRIDENT_AUDIO                                0x2006
686 #define RTP_MIDI_MANU_LONG_REAL_WORLD_STUDIO                            0x2007
687 #define RTP_MIDI_MANU_LONG_EVOLUTION_SYNTHESIS                          0x2008
688 #define RTP_MIDI_MANU_LONG_YES_TECHNOLOGY                               0x2009
689 #define RTP_MIDI_MANU_LONG_AUDIOMATICA                                  0x200a
690 #define RTP_MIDI_MANU_LONG_BONTEMPI_FARFISA                             0x200b
691 #define RTP_MIDI_MANU_LONG_FBT_ELETTRONICA                              0x200c
692 #define RTP_MIDI_MANU_LONG_MIDITEMP                                     0x200d
693 #define RTP_MIDI_MANU_LONG_LA_AUDIO_LARKING_AUDIO                       0x200e
694 #define RTP_MIDI_MANU_LONG_ZERO_88_LIGHTING_LIMITED                     0x200f
695 #define RTP_MIDI_MANU_LONG_MICON_AUDIO_ELECTRONICS_GMBH                 0x2010
696 #define RTP_MIDI_MANU_LONG_FOREFRONT_TECHNOLOGY                         0x2011
697 #define RTP_MIDI_MANU_LONG_STUDIO_AUDIO_AND_VIDEO_LTD                   0x2012
698 #define RTP_MIDI_MANU_LONG_KENTON_ELECTRONICS                           0x2013
699 #define RTP_MIDI_MANU_LONG_CELCO_DIVISON_OF_ELECTRONICS                 0x2014
700 #define RTP_MIDI_MANU_LONG_ADB                                          0x2015
701 #define RTP_MIDI_MANU_LONG_MARSHALL_PRODUCTS                            0x2016
702 #define RTP_MIDI_MANU_LONG_DDA                                          0x2017
703 #define RTP_MIDI_MANU_LONG_BBS                                          0x2018
704 #define RTP_MIDI_MANU_LONG_MA_LIGHTING_TECHNOLOGY                       0x2019
705 #define RTP_MIDI_MANU_LONG_FATAR                                        0x201a
706 #define RTP_MIDI_MANU_LONG_QSC_AUDIO                                    0x201b
707 #define RTP_MIDI_MANU_LONG_ARTISAN_CLASSIC_ORGAN                        0x201c
708 #define RTP_MIDI_MANU_LONG_ORLA_SPA                                     0x201d
709 #define RTP_MIDI_MANU_LONG_PINNACLE_AUDIO                               0x201e
710 #define RTP_MIDI_MANU_LONG_TC_ELECTRONICS                               0x201f
711 #define RTP_MIDI_MANU_LONG_DOEPFER_MUSIKELEKTRONIK                      0x2020
712 #define RTP_MIDI_MANU_LONG_CREATIVE_TECHNOLOGY_PTE                      0x2021
713 #define RTP_MIDI_MANU_LONG_MINAMI_SEIYDDO                               0x2022
714 #define RTP_MIDI_MANU_LONG_GOLDSTAR                                     0x2023
715 #define RTP_MIDI_MANU_LONG_MIDISOFT_SAS_DI_M_CIMA                       0x2024
716 #define RTP_MIDI_MANU_LONG_SAMICK                                       0x2025
717 #define RTP_MIDI_MANU_LONG_PENNY_AND_GILES                              0x2026
718 #define RTP_MIDI_MANU_LONG_ACORN_COMPUTER                               0x2027
719 #define RTP_MIDI_MANU_LONG_LSC_ELECTRONICS                              0x2028
720 #define RTP_MIDI_MANU_LONG_NOVATION_EMS                                 0x2029
721 #define RTP_MIDI_MANU_LONG_SAMKYUNG_MECHATRONICS                        0x202a
722 #define RTP_MIDI_MANU_LONG_MEDELI_ELECTRONICS_CO                        0x202b
723 #define RTP_MIDI_MANU_LONG_CHARLIE_LAB_SRL                              0x202c
724 #define RTP_MIDI_MANU_LONG_BLUE_CHIP_MUSIC_TECHNOLOGY                   0x202d
725 #define RTP_MIDI_MANU_LONG_BEE_OH_CORP                                  0x202e
726 #define RTP_MIDI_MANU_LONG_LG_SEMICON_AMERICA                           0x202f
727 #define RTP_MIDI_MANU_LONG_TESI                                         0x2030
728 #define RTP_MIDI_MANU_LONG_EMAGIC                                       0x2031
729 #define RTP_MIDI_MANU_LONG_BEHRINGER_GMBH                               0x2032
730 #define RTP_MIDI_MANU_LONG_ACCESS_MUSIC_ELECTRONICS                     0x2033
731 #define RTP_MIDI_MANU_LONG_SYNOPTIC                                     0x2034
732 #define RTP_MIDI_MANU_LONG_HANMESOFT_CORP                               0x2035
733 #define RTP_MIDI_MANU_LONG_TERRATEC_ELECTRONIC_GMBH                     0x2036
734 #define RTP_MIDI_MANU_LONG_PROEL_SPA                                    0x2037
735 #define RTP_MIDI_MANU_LONG_IBK_MIDI                                     0x2038
736 #define RTP_MIDI_MANU_LONG_IRCAM                                        0x2039
737 #define RTP_MIDI_MANU_LONG_PROPELLERHEAD_SOFTWARE                       0x203a
738 #define RTP_MIDI_MANU_LONG_RED_SOUND_SYSTEMS_LTD                        0x203b
739 #define RTP_MIDI_MANU_LONG_ELEKTRON_ESI_AB                              0x203c
740 #define RTP_MIDI_MANU_LONG_SINTEFEX_AUDIO                               0x203d
741 #define RTP_MIDI_MANU_LONG_MAM_MUSIC_AND_MORE                           0x203e
742 #define RTP_MIDI_MANU_LONG_AMSARO_GMBH                                  0x203f
743 #define RTP_MIDI_MANU_LONG_CDS_ADVANCED_TECHNOLOGY_BV                   0x2040
744 #define RTP_MIDI_MANU_LONG_TOUCHED_BY_SOUND_GMBH                        0x2041
745 #define RTP_MIDI_MANU_LONG_DSP_ARTS                                     0x2042
746 #define RTP_MIDI_MANU_LONG_PHIL_REES_MUSIC_TECH                         0x2043
747 #define RTP_MIDI_MANU_LONG_STAMER_MUSIKANLAGEN_GMBH                     0x2044
748 #define RTP_MIDI_MANU_LONG_MUSICAL_MUNTANER_SA_DBA                      0x2045
749 #define RTP_MIDI_MANU_LONG_CMEXX_SOFTWARE                               0x2046
750 #define RTP_MIDI_MANU_LONG_KLAVIS_TECHNOLOGIES                          0x2047
751 #define RTP_MIDI_MANU_LONG_NOTEHEADS_AB                                 0x2048
752 #define RTP_MIDI_MANU_LONG_ALGORITHMIX                                  0x2049
753 #define RTP_MIDI_MANU_LONG_SKRYDSTRUP_RD                                0x204a
754 #define RTP_MIDI_MANU_LONG_PROFRESSIONAL_AUDIO_COMPANY                  0x204b
755 #define RTP_MIDI_MANU_LONG_DBTECH_MADWAVES                              0x204c
756 #define RTP_MIDI_MANU_LONG_VERMONA                                      0x204d
757 #define RTP_MIDI_MANU_LONG_NOKIA                                        0x204e
758 #define RTP_MIDI_MANU_LONG_WAVE_IDEA                                    0x204f
759 #define RTP_MIDI_MANU_LONG_HARTMANN_GMBH                                0x2050
760 #define RTP_MIDI_MANU_LONG_LIONS_TRACK                                  0x2051
761 #define RTP_MIDI_MANU_LONG_ANALOGUE_SYSTEMS                             0x2052
762 #define RTP_MIDI_MANU_LONG_FOCAL_JMLAB                                  0x2053
763 #define RTP_MIDI_MANU_LONG_RINGWAY_ELECTRONICS                          0x2054
764 #define RTP_MIDI_MANU_LONG_FAITH_TECHNOLOGIES_DIGIPLUG                  0x2055
765 #define RTP_MIDI_MANU_LONG_SHOWWORKS                                    0x2056
766 #define RTP_MIDI_MANU_LONG_MANIKIN_ELECTRONIC                           0x2057
767 #define RTP_MIDI_MANU_LONG_1_COME_TECH                                  0x2058
768 #define RTP_MIDI_MANU_LONG_PHONIC_CORP                                  0x2059
769 #define RTP_MIDI_MANU_LONG_LAKE_TECHNOLOGY                              0x205a
770 #define RTP_MIDI_MANU_LONG_SILANSYS_TECHNOLOGIES                        0x205b
771 #define RTP_MIDI_MANU_LONG_WINBOND_ELECTRONICS                          0x205c
772 #define RTP_MIDI_MANU_LONG_CINETIX_MEDIEN_UND_INTERFACE                 0x205d
773 #define RTP_MIDI_MANU_LONG_AG_SOLUTIONI_DIGITALI                        0x205e
774 #define RTP_MIDI_MANU_LONG_SEQUENTIX_MUSIC_SYSTEMS                      0x205f
775 #define RTP_MIDI_MANU_LONG_ORAM_PRO_AUDIO                               0x2060
776 #define RTP_MIDI_MANU_LONG_BE4_LTD                                      0x2061
777 #define RTP_MIDI_MANU_LONG_INFECTION_MUSIC                              0x2062
778 #define RTP_MIDI_MANU_LONG_CENTRAL_MUSIC_CO_CME                         0x2063
779 #define RTP_MIDI_MANU_LONG_GENOQS_MACHINES                              0x2064
780 #define RTP_MIDI_MANU_LONG_MEDIALON                                     0x2065
781 #define RTP_MIDI_MANU_LONG_WAVES_AUDIO_LTD                              0x2066
782 #define RTP_MIDI_MANU_LONG_JERASH_LABS                                  0x2067
783 #define RTP_MIDI_MANU_LONG_DA_FACT                                      0x2068
784 #define RTP_MIDI_MANU_LONG_ELBY_DESIGNS                                 0x2069
785 #define RTP_MIDI_MANU_LONG_SPECTRAL_AUDIO                               0x206a
786 #define RTP_MIDI_MANU_LONG_ARTURIA                                      0x206b
787 #define RTP_MIDI_MANU_LONG_VIXID                                        0x206c
788 #define RTP_MIDI_MANU_LONG_C_THRU_MUSIC                                 0x206d
789 #define RTP_MIDI_MANU_LONG_YA_HORNG_ELECTRONIC_CO_LTD                   0x206e
790 #define RTP_MIDI_MANU_LONG_SM_PRO_AUDIO                                 0x206f
791 #define RTP_MIDI_MANU_LONG_OTO_MACHINES                                 0x2070
792 #define RTP_MIDI_MANU_LONG_ELZAB_SA_G_LAB                               0x2071
793 #define RTP_MIDI_MANU_LONG_BLACKSTAR_AMPLIFICATION_LTD                  0x2072
794 #define RTP_MIDI_MANU_LONG_M3I_TECHNOLOGIES_GMBH                        0x2073
795 #define RTP_MIDI_MANU_LONG_GEMALTO                                      0x2074
796 #define RTP_MIDI_MANU_LONG_PROSTAGE_SL                                  0x2075
797 #define RTP_MIDI_MANU_LONG_TEENAGE_ENGINEERING                          0x2076
798 #define RTP_MIDI_MANU_LONG_TOBIAS_ERICHSEN                              0x2077
799 #define RTP_MIDI_MANU_LONG_NIXER_LTD                                    0x2078
800 #define RTP_MIDI_MANU_LONG_HANPIN_ELECTRON_CO_LTD                       0x2079
801 #define RTP_MIDI_MANU_LONG_MIDI_HARDWARE_R_SOWA                         0x207a
802
803 #define RTP_MIDI_MANU_LONG_BEYOND_MUSIC_INDUSTRIAL_LTD                  0x207b
804 #define RTP_MIDI_MANU_LONG_KISS_BOX_BV                                  0x207c
805 #define RTP_MIDI_MANU_LONG_MISA_DIGITAL_TECHNOLOGIES_LTD                0x207d
806 #define RTP_MIDI_MANU_LONG_AI_MUSICS_TECHNOLOGY_INC                     0x207e
807 #define RTP_MIDI_MANU_LONG_SERATO_INC_LP                                0x207f
808 #define RTP_MIDI_MANU_LONG_LIMEX_MUSIC_HANDLES_GMBH                     0x2100
809 #define RTP_MIDI_MANU_LONG_KYODDAY_TOKAI                                0x2101
810 #define RTP_MIDI_MANU_LONG_MUTABLE_INSTRUMENTS                          0x2102
811 #define RTP_MIDI_MANU_LONG_PRESONUS_SOFTWARE_LTD                        0x2103
812 #define RTP_MIDI_MANU_LONG_XIRING                                       0x2104
813 #define RTP_MIDI_MANU_LONG_FAIRLIGHT_INTRUMENTS_PTY_LTD                 0x2105
814 #define RTP_MIDI_MANU_LONG_MUSICOM_LAB                                  0x2106
815 #define RTP_MIDI_MANU_LONG_VACO_LOCO                                    0x2107
816 #define RTP_MIDI_MANU_LONG_RWA_HONG_KONG_LIMITED                        0x2108
817
818 /* Japanese Manufacturers */
819 #define RTP_MIDI_MANU_LONG_CRIMSON_TECHNOLOGY_INC                       0x4000
820 #define RTP_MIDI_MANU_LONG_SOFTBANK_MOBILE_CORP                         0x4001
821 /*#define RTP_MIDI_MANU_LONG_*/
822 #define RTP_MIDI_MANU_LONG_DM_HOLDINGS_INC                              0x4003
823
824
825 #define RTP_MIDI_SYSEX_COMMON_NRT_DLS_LEVEL1_ON                         0x01
826 #define RTP_MIDI_SYSEX_COMMON_NRT_DLS_LEVEL1_OFF                        0x02
827 #define RTP_MIDI_SYSEX_COMMON_NRT_DLS_LEVEL1_VOICE_ALLOCATION_OFF       0x03
828 #define RTP_MIDI_SYSEX_COMMON_NRT_DLS_LEVEL1_VOICE_ALLOCATION_ON        0x04
829
830
831 #define RTP_MIDI_SYSEX_COMMON_NRT_MTC_SPECIAL                           0x00
832 #define RTP_MIDI_SYSEX_COMMON_NRT_MTC_PUNCH_IN_POINTS                   0x01
833 #define RTP_MIDI_SYSEX_COMMON_NRT_MTC_PUNGH_OUT_POINTS                  0x02
834 #define RTP_MIDI_SYSEX_COMMON_NRT_MTC_DELETE_PUNCH_IN_POINTS            0x03
835 #define RTP_MIDI_SYSEX_COMMON_NRT_MTC_DELETE_PUNCH_OUT_POINTS           0x04
836 #define RTP_MIDI_SYSEX_COMMON_NRT_MTC_EVENT_START_POINT                 0x05
837 #define RTP_MIDI_SYSEX_COMMON_NRT_MTC_EVENT_STOP_POINT                  0x06
838 #define RTP_MIDI_SYSEX_COMMON_NRT_MTC_EVENT_START_POINT_ADD             0x07
839 #define RTP_MIDI_SYSEX_COMMON_NRT_MTC_EVENT_STOP_POINT_ADD              0x08
840 #define RTP_MIDI_SYSEX_COMMON_NRT_MTC_DELETE_EVENT_START_POINT          0x09
841 #define RTP_MIDI_SYSEX_COMMON_NRT_MTC_DELETE_EVENT_STOP_POINT           0x0a
842 #define RTP_MIDI_SYSEX_COMMON_NRT_MTC_CUE_POINTS                        0x0b
843 #define RTP_MIDI_SYSEX_COMMON_NRT_MTC_CUE_POINTS_ADD                    0x0c
844 #define RTP_MIDI_SYSEX_COMMON_NRT_MTC_DELETE_CUE_POINT                  0x0d
845 #define RTP_MIDI_SYSEX_COMMON_NRT_MTC_EVENT_NAME_IN_ADD                 0x0e
846
847 #define RTP_MIDI_SYSEX_COMMON_NRT_SD_EXT_LOOP_POINT_TRANSMISSION        0x01
848 #define RTP_MIDI_SYSEX_COMMON_NRT_SD_EXT_LOOP_POINTS_REQUEST            0x02
849
850 #define RTP_MIDI_SYSEX_COMMON_NRT_SD_EXT_LP_UNI                         0x00
851 #define RTP_MIDI_SYSEX_COMMON_NRT_SD_EXT_LP_BI                          0x01
852 #define RTP_MIDI_SYSEX_COMMON_NRT_SD_EXT_LP_OFF                         0x7f
853
854 #define RTP_MIDI_SYSEX_COMMON_NRT_GI_IDENTITY_REQUEST                   0x01
855 #define RTP_MIDI_SYSEX_COMMON_NRT_GI_IDENTITY_REPLY                     0x02
856
857 #define RTP_MIDI_SYSEX_COMMON_NRT_FD_HEADER                             0x01
858 #define RTP_MIDI_SYSEX_COMMON_NRT_FD_DATA_PACKET                        0x02
859 #define RTP_MIDI_SYSEX_COMMON_NRT_FD_REQUEST                            0x03
860
861 #define RTP_MIDI_SYSEX_COMMON_TUNING_BULK_DUMP_REQUEST                  0x00
862 #define RTP_MIDI_SYSEX_COMMON_TUNING_BULK_DUMP_REPLY                    0x01
863 #define RTP_MIDI_SYSEX_COMMON_TUNING_NOTE_CHANGE                        0x02
864
865 #define RTP_MIDI_SYSEX_COMMON_NRT_GM_ON                                 0x01
866 #define RTP_MIDI_SYSEX_COMMON_NRT_GM_OFF                                0x02
867
868 #define RTP_MIDI_SYSEX_COMMON_RT_MTC_FULL_MESSAGE                       0x01
869 #define RTP_MIDI_SYSEX_COMMON_RT_MTC_USER_BITS                          0x02
870
871 #define RTP_MIDI_SYSEX_COMMON_RT_SCL_EXTENSIONS                         0x00
872 #define RTP_MIDI_SYSEX_COMMON_RT_SC_LIGHTING                            0x01
873 #define RTP_MIDI_SYSEX_COMMON_RT_SC_MOVING_LIGHTS                       0x02
874 #define RTP_MIDI_SYSEX_COMMON_RT_SC_COLOR_CHANGERS                      0x03
875 #define RTP_MIDI_SYSEX_COMMON_RT_SC_STROBES                             0x04
876 #define RTP_MIDI_SYSEX_COMMON_RT_SCL_LASERS                             0x05
877 #define RTP_MIDI_SYSEX_COMMON_RT_SCL_CHASERS                            0x06
878 #define RTP_MIDI_SYSEX_COMMON_RT_SC_SOUND                               0x10
879 #define RTP_MIDI_SYSEX_COMMON_RT_SC_MUSIC                               0x11
880 #define RTP_MIDI_SYSEX_COMMON_RT_SC_CD_PLAYERS                          0x12
881 #define RTP_MIDI_SYSEX_COMMON_RT_SC_EPROM_PLAYBACK                      0x13
882 #define RTP_MIDI_SYSEX_COMMON_RT_SCL_AUDIO_TAPE_MACHINE                 0x14
883 #define RTP_MIDI_SYSEX_COMMON_RT_SC_INTERCOMS                           0x15
884 #define RTP_MIDI_SYSEX_COMMON_RT_SC_AMPLIFIERS                          0x16
885 #define RTP_MIDI_SYSEX_COMMON_RT_SC_AUDIO_EFFECTS                       0x17
886 #define RTP_MIDI_SYSEX_COMMON_RT_SC_EQUALIZERS                          0x18
887 #define RTP_MIDI_SYSEX_COMMON_RT_SC_MACHINERY                           0x20
888 #define RTP_MIDI_SYSEX_COMMON_RT_SC_RIGGING                             0x21
889 #define RTP_MIDI_SYSEX_COMMON_RT_SC_FLYS                                0x22
890 #define RTP_MIDI_SYSEX_COMMON_RT_SC_LIFTS                               0x23
891 #define RTP_MIDI_SYSEX_COMMON_RT_SC_TURNTABLES                          0x24
892 #define RTP_MIDI_SYSEX_COMMON_RT_SC_TRUSSES                             0x25
893 #define RTP_MIDI_SYSEX_COMMON_RT_SC_ROBOTS                              0x26
894 #define RTP_MIDI_SYSEX_COMMON_RT_SC_ANIMATION                           0x27
895 #define RTP_MIDI_SYSEX_COMMON_RT_SC_FLOATS                              0x28
896 #define RTP_MIDI_SYSEX_COMMON_RT_SC_BREAKAWAYS                          0x29
897 #define RTP_MIDI_SYSEX_COMMON_RT_SC_BARGES                              0x2a
898 #define RTP_MIDI_SYSEX_COMMON_RT_SC_VIDEO                               0x30
899 #define RTP_MIDI_SYSEX_COMMON_RT_SC_VIDEO_TAPE_MACHINES                 0x31
900 #define RTP_MIDI_SYSEX_COMMON_RT_SC_VIDEO_CASSETTE_MACHINES             0x32
901 #define RTP_MIDI_SYSEX_COMMON_RT_SC_VIDEO_DISC_PLAYERS                  0x33
902 #define RTP_MIDI_SYSEX_COMMON_RT_SC_VIDEO_SWITCHERS                     0x34
903 #define RTP_MIDI_SYSEX_COMMON_RT_SC_VIDEO_EFFECT                        0x35
904 #define RTP_MIDI_SYSEX_COMMON_RT_SC_VIDEO_CHARACTER_GENERATORS          0x36
905 #define RTP_MIDI_SYSEX_COMMON_RT_SC_VIDEO_STIL_STORES                   0x37
906 #define RTP_MIDI_SYSEX_COMMON_RT_SC_VIDEO_MONITORS                      0x38
907 #define RTP_MIDI_SYSEX_COMMON_RT_SC_PROJECTION                          0x40
908 #define RTP_MIDI_SYSEX_COMMON_RT_SC_FILM_PROJECTORS                     0x41
909 #define RTP_MIDI_SYSEX_COMMON_RT_SC_SLIDE_PROJECTORS                    0x42
910 #define RTP_MIDI_SYSEX_COMMON_RT_SC_VIDEO_PROJECTORS                    0x43
911 #define RTP_MIDI_SYSEX_COMMON_RT_SC_DISSOLVERS                          0x44
912 #define RTP_MIDI_SYSEX_COMMON_RT_SC_SHUTTER_CONTROLS                    0x45
913 #define RTP_MIDI_SYSEX_COMMON_RT_SC_PROCESS_CONTROL                     0x50
914 #define RTP_MIDI_SYSEX_COMMON_RT_SC_HYDRAULIC_OIL                       0x51
915 #define RTP_MIDI_SYSEX_COMMON_RT_SC_H2O                                 0x52
916 #define RTP_MIDI_SYSEX_COMMON_RT_SC_CO2                                 0x53
917 #define RTP_MIDI_SYSEX_COMMON_RT_SC_COMPRESSED_AIR                      0x54
918 #define RTP_MIDI_SYSEX_COMMON_RT_SC_NATURAL_GAS                         0x55
919 #define RTP_MIDI_SYSEX_COMMON_RT_SC_FOG                                 0x56
920 #define RTP_MIDI_SYSEX_COMMON_RT_SC_SMOKE                               0x57
921 #define RTP_MIDI_SYSEX_COMMON_RT_SC_CRACKED_HAZE                        0x58
922 #define RTP_MIDI_SYSEX_COMMON_RT_SC_PYRO                                0x60
923 #define RTP_MIDI_SYSEX_COMMON_RT_SC_FIREWORKS                           0x61
924 #define RTP_MIDI_SYSEX_COMMON_RT_SC_EXPLOSIONS                          0x62
925 #define RTP_MIDI_SYSEX_COMMON_RT_SC_FLAME                               0x63
926 #define RTP_MIDI_SYSEX_COMMON_RT_SC_SMOKE_POTS                          0x64
927 #define RTP_MIDI_SYSEX_COMMON_RT_SC_ALL_TYPES                           0x7f
928
929 #define RTP_MIDI_SYSEX_COMMON_RT_NT_BAR_NUMBER                          0x01
930 #define RTP_MIDI_SYSEX_COMMON_RT_NT_TIME_SIGNATURE_IMMEDIATE            0x02
931 #define RTP_MIDI_SYSEX_COMMON_RT_NT_TIME_SIGNATURE_DELAYED              0x42
932
933 #define RTP_MIDI_SYSEX_COMMON_RT_DC_MASTER_VOLUME                       0x01
934 #define RTP_MIDI_SYSEX_COMMON_RT_DC_MASTER_BALANCE                      0x02
935
936 #define RTP_MIDI_SYSEX_COMMON_RT_MTC_CUE_SPECIAL                        0x00
937 #define RTP_MIDI_SYSEX_COMMON_RT_MTC_CUE_PUNCH_IN_POINTS                0x01
938 #define RTP_MIDI_SYSEX_COMMON_RT_MTC_CUE_PUNCH_OUT_POINTS               0x02
939 #define RTP_MIDI_SYSEX_COMMON_RT_MTC_CUE_RESERVED_03                    0x03
940 #define RTP_MIDI_SYSEX_COMMON_RT_MTC_CUE_RESERVED_04                    0x04
941 #define RTP_MIDI_SYSEX_COMMON_RT_MTC_CUE_EVENT_START_POINTS             0x05
942 #define RTP_MIDI_SYSEX_COMMON_RT_MTC_CUE_EVENT_STOP_POINTS              0x06
943 #define RTP_MIDI_SYSEX_COMMON_RT_MTC_CUE_EVENT_START_POINTS_ADD         0x07
944 #define RTP_MIDI_SYSEX_COMMON_RT_MTC_CUE_EVENT_STOP_POINTS_ADD          0x08
945 #define RTP_MIDI_SYSEX_COMMON_RT_MTC_CUE_RESERVED_09                    0x09
946 #define RTP_MIDI_SYSEX_COMMON_RT_MTC_CUE_RESERVED_0A                    0x0a
947 #define RTP_MIDI_SYSEX_COMMON_RT_MTC_CUE_CUE_POINTS                     0x0b
948 #define RTP_MIDI_SYSEX_COMMON_RT_MTC_CUE_CUE_POINTS_ADD                 0x0c
949 #define RTP_MIDI_SYSEX_COMMON_RT_MTC_CUE_RESERVED_0D                    0x0d
950 #define RTP_MIDI_SYSEX_COMMON_RT_MTC_CUE_EVENT_NAME_ADD                 0x0e
951
952 /* TODO: Add MMC Commands */
953
954 /* TODO: Add MMC Responses */
955
956
957
958 #define RTP_MIDI_COMMON_MTC_QF_FRAME_LS_NIBBLE                          0x00
959 #define RTP_MIDI_COMMON_MTC_QF_FRAME_MS_NIBBLE                          0x01
960 #define RTP_MIDI_COMMON_MTC_QF_SECONDS_LS_NIBBLE                        0x02
961 #define RTP_MIDI_COMMON_MTC_QF_SECONDS_MS_NIBBLE                        0x03
962 #define RTP_MIDI_COMMON_MTC_QF_MINUTES_LS_NIBBLE                        0x04
963 #define RTP_MIDI_COMMON_MTC_QF_MINUTES_MS_NIBBLE                        0x05
964 #define RTP_MIDI_COMMON_MTC_QF_HOURS_LS_NIBBLE                          0x06
965 #define RTP_MIDI_COMMON_MTC_QF_HOURS_MS_NIBBLE                          0x07
966
967
968
969
970
971
972
973
974 #define RTP_MIDI_TREE_NAME_COMMAND                                      "Command Section"
975 #define RTP_MIDI_TREE_NAME_COMMAND_SYSEX_MANU                           "Manufacturer specific data"
976 #define RTP_MIDI_TREE_NAME_COMMAND_SYSEX_EDU                            "Educational data"
977 #define RTP_MIDI_TREE_NAME_JOURNAL                                      "Journal Section"
978 #define RTP_MIDI_TREE_NAME_SYSTEM_JOURNAL                               "System-Journal"
979 #define RTP_MIDI_TREE_NAME_SYSTEM_CHAPTERS                              "System-Chapters"
980 #define RTP_MIDI_TREE_NAME_SJ_CHAPTER_D                                 "Simple System Commands"
981 #define RTP_MIDI_TREE_NAME_SJ_CHAPTER_D_FIELD_B                         "Reset Field"
982 #define RTP_MIDI_TREE_NAME_SJ_CHAPTER_D_FIELD_G                         "Tune Request Field"
983 #define RTP_MIDI_TREE_NAME_SJ_CHAPTER_D_FIELD_H                         "Song Select Field"
984 #define RTP_MIDI_TREE_NAME_SJ_CHAPTER_D_FIELD_J                         "System Common 0xF4"
985 #define RTP_MIDI_TREE_NAME_SJ_CHAPTER_D_FIELD_K                         "System Common 0xF5"
986 #define RTP_MIDI_TREE_NAME_SJ_CHAPTER_D_FIELD_Y                         "System Common 0xF9"
987 #define RTP_MIDI_TREE_NAME_SJ_CHAPTER_D_FIELD_Z                         "System Common 0xFD"
988 #define RTP_MIDI_TREE_NAME_SJ_CHAPTER_V                                 "Active Sensing"
989 #define RTP_MIDI_TREE_NAME_SJ_CHAPTER_Q                                 "Sequencer State Commands"
990 #define RTP_MIDI_TREE_NAME_SJ_CHAPTER_F                                 "MIDI Time Code Tape Position"
991 #define RTP_MIDI_TREE_NAME_SJ_CHAPTER_F_COMPLETE                        "Complete field"
992 #define RTP_MIDI_TREE_NAME_SJ_CHAPTER_F_PARTIAL                         "Partial field"
993 #define RTP_MIDI_TREE_NAME_SJ_CHAPTER_X                                 "System Exclusive"
994 #define RTP_MIDI_TREE_NAME_SJ_CHAPTER_X_DATA                            "Data field (sysex commands)"
995 #define RTP_MIDI_TREE_NAME_SJ_CHAPTER_X_INVALID_DATA                    "Data field (invalid sysex commands)"
996 #define RTP_MIDI_TREE_NAME_CHANNEL_JOURNAL                              "Channel-Journal"
997 #define RTP_MIDI_TREE_NAME_CHANNEL_CHAPTERS                             "Channel-Chapters"
998 #define RTP_MIDI_TREE_NAME_CJ_CHAPTER_P                                 "Program Change"
999 #define RTP_MIDI_TREE_NAME_CJ_CHAPTER_C                                 "Control Change"
1000 #define RTP_MIDI_TREE_NAME_CJ_CHAPTER_C_LOGLIST                         "Log List"
1001 #define RTP_MIDI_TREE_NAME_CJ_CHAPTER_C_LOGITEM                         "Log Item"
1002 #define RTP_MIDI_TREE_NAME_CJ_CHAPTER_M                                 "Parameter System"
1003 #define RTP_MIDI_TREE_NAME_CJ_CHAPTER_M_LOGLIST                         "Log List"
1004 #define RTP_MIDI_TREE_NAME_CJ_CHAPTER_M_LOGITEM                         "Log Item"
1005 #define RTP_MIDI_TREE_NAME_CJ_CHAPTER_M_LOG_MSB                         "Entry MSB"
1006 #define RTP_MIDI_TREE_NAME_CJ_CHAPTER_M_LOG_LSB                         "Entry LSB"
1007 #define RTP_MIDI_TREE_NAME_CJ_CHAPTER_M_LOG_A_BUTTON                    "A-Button"
1008 #define RTP_MIDI_TREE_NAME_CJ_CHAPTER_M_LOG_C_BUTTON                    "C-Button"
1009 #define RTP_MIDI_TREE_NAME_CJ_CHAPTER_M_LOG_COUNT                       "Count"
1010 #define RTP_MIDI_TREE_NAME_CJ_CHAPTER_W                                 "Pitch Wheel"
1011 #define RTP_MIDI_TREE_NAME_CJ_CHAPTER_N                                 "Note on/off"
1012 #define RTP_MIDI_TREE_NAME_CJ_CHAPTER_N_LOGLIST                         "Log List"
1013 #define RTP_MIDI_TREE_NAME_CJ_CHAPTER_N_LOGITEM                         "Note On"
1014 #define RTP_MIDI_TREE_NAME_CJ_CHAPTER_N_OCTETS                          "Offbit Octets"
1015 #define RTP_MIDI_TREE_NAME_CJ_CHAPTER_E                                 "Note Command Extras"
1016 #define RTP_MIDI_TREE_NAME_CJ_CHAPTER_E_LOGLIST                         "Log List"
1017 #define RTP_MIDI_TREE_NAME_CJ_CHAPTER_E_LOGITEM1                        "Note Off"
1018 #define RTP_MIDI_TREE_NAME_CJ_CHAPTER_E_LOGITEM2                        "Note On/Off"
1019 #define RTP_MIDI_TREE_NAME_CJ_CHAPTER_T                                 "Channel Aftertouch"
1020 #define RTP_MIDI_TREE_NAME_CJ_CHAPTER_A                                 "Poly Aftertouch"
1021 #define RTP_MIDI_TREE_NAME_CJ_CHAPTER_A_LOGLIST                         "Log List"
1022 #define RTP_MIDI_TREE_NAME_CJ_CHAPTER_A_LOGITEM                         "Pressure"
1023
1024 /* used to mask the most significant bit, which flags the start of a new midi-command! */
1025 #define RTP_MIDI_COMMAND_STATUS_FLAG                                    0x80
1026
1027 /* used to mask the lower 7 bits of the single octets that make up the delta-time */
1028 #define RTP_MIDI_DELTA_TIME_OCTET_MASK                                  0x7f
1029 /* used to mask the most significant bit, which flags the extension of the delta-time */
1030 #define RTP_MIDI_DELTA_TIME_EXTENSION                                   0x80
1031
1032 #define RTP_MIDI_CS_FLAG_B                                              0x80
1033 #define RTP_MIDI_CS_FLAG_J                                              0x40
1034 #define RTP_MIDI_CS_FLAG_Z                                              0x20
1035 #define RTP_MIDI_CS_FLAG_P                                              0x10
1036 #define RTP_MIDI_CS_MASK_SHORTLEN                                       0x0f
1037 #define RTP_MIDI_CS_MASK_LONGLEN                                        0x0fff
1038
1039 #define RTP_MIDI_CJ_CHAPTER_M_FLAG_J                                    0x80
1040 #define RTP_MIDI_CJ_CHAPTER_M_FLAG_K                                    0x40
1041 #define RTP_MIDI_CJ_CHAPTER_M_FLAG_L                                    0x20
1042 #define RTP_MIDI_CJ_CHAPTER_M_FLAG_M                                    0x10
1043 #define RTP_MIDI_CJ_CHAPTER_M_FLAG_N                                    0x08
1044 #define RTP_MIDI_CJ_CHAPTER_M_FLAG_T                                    0x04
1045 #define RTP_MIDI_CJ_CHAPTER_M_FLAG_V                                    0x02
1046 #define RTP_MIDI_CJ_CHAPTER_M_FLAG_R                                    0x01
1047
1048 #define RTP_MIDI_JS_FLAG_S                              0x80
1049 #define RTP_MIDI_JS_FLAG_Y                              0x40
1050 #define RTP_MIDI_JS_FLAG_A                              0x20
1051 #define RTP_MIDI_JS_FLAG_H                              0x10
1052 #define RTP_MIDI_JS_MASK_TOTALCHANNELS                  0x0f
1053
1054 #define RTP_MIDI_SJ_FLAG_S                              0x8000
1055 #define RTP_MIDI_SJ_FLAG_D                              0x4000
1056 #define RTP_MIDI_SJ_FLAG_V                              0x2000
1057 #define RTP_MIDI_SJ_FLAG_Q                              0x1000
1058 #define RTP_MIDI_SJ_FLAG_F                              0x0800
1059 #define RTP_MIDI_SJ_FLAG_X                              0x0400
1060 #define RTP_MIDI_SJ_MASK_LENGTH                         0x03ff
1061
1062 #define RTP_MIDI_SJ_CHAPTER_D_FLAG_S                    0x80
1063 #define RTP_MIDI_SJ_CHAPTER_D_FLAG_B                    0x40
1064 #define RTP_MIDI_SJ_CHAPTER_D_FLAG_G                    0x20
1065 #define RTP_MIDI_SJ_CHAPTER_D_FLAG_H                    0x10
1066 #define RTP_MIDI_SJ_CHAPTER_D_FLAG_J                    0x08
1067 #define RTP_MIDI_SJ_CHAPTER_D_FLAG_K                    0x04
1068 #define RTP_MIDI_SJ_CHAPTER_D_FLAG_Y                    0x02
1069 #define RTP_MIDI_SJ_CHAPTER_D_FLAG_Z                    0x01
1070
1071 #define RTP_MIDI_SJ_CHAPTER_D_RESET_FLAG_S              0x80
1072 #define RTP_MIDI_SJ_CHAPTER_D_RESET_COUNT               0x7f
1073 #define RTP_MIDI_SJ_CHAPTER_D_TUNE_FLAG_S               0x80
1074 #define RTP_MIDI_SJ_CHAPTER_D_TUNE_COUNT                0x7f
1075 #define RTP_MIDI_SJ_CHAPTER_D_SONG_SEL_FLAG_S           0x80
1076 #define RTP_MIDI_SJ_CHAPTER_D_SONG_SEL_VALUE            0x7f
1077
1078 #define RTP_MIDI_SJ_CHAPTER_D_SYSCOM_FLAG_S             0x8000
1079 #define RTP_MIDI_SJ_CHAPTER_D_SYSCOM_FLAG_C             0x4000
1080 #define RTP_MIDI_SJ_CHAPTER_D_SYSCOM_FLAG_V             0x2000
1081 #define RTP_MIDI_SJ_CHAPTER_D_SYSCOM_FLAG_L             0x1000
1082 #define RTP_MIDI_SJ_CHAPTER_D_SYSCOM_MASK_DSZ           0x0c00
1083 #define RTP_MIDI_SJ_CHAPTER_D_SYSCOM_MASK_LENGTH        0x03ff
1084 #define RTP_MIDI_SJ_CHAPTER_D_SYSCOM_MASK_COUNT         0xff
1085
1086 #define RTP_MIDI_SJ_CHAPTER_D_SYSREAL_FLAG_S            0x80
1087 #define RTP_MIDI_SJ_CHAPTER_D_SYSREAL_FLAG_C            0x40
1088 #define RTP_MIDI_SJ_CHAPTER_D_SYSREAL_FLAG_L            0x20
1089 #define RTP_MIDI_SJ_CHAPTER_D_SYSREAL_MASK_LENGTH       0x1f
1090 #define RTP_MIDI_SJ_CHAPTER_D_SYSREAL_MASK_COUNT        0xff
1091
1092 #define RTP_MIDI_SJ_CHAPTER_Q_FLAG_S                    0x80
1093 #define RTP_MIDI_SJ_CHAPTER_Q_FLAG_N                    0x40
1094 #define RTP_MIDI_SJ_CHAPTER_Q_FLAG_D                    0x20
1095 #define RTP_MIDI_SJ_CHAPTER_Q_FLAG_C                    0x10
1096 #define RTP_MIDI_SJ_CHAPTER_Q_FLAG_T                    0x80
1097 #define RTP_MIDI_SJ_CHAPTER_Q_MASK_TOP                  0x07
1098 #define RTP_MIDI_SJ_CHAPTER_Q_MASK_CLOCK                0x07ffff
1099 #define RTP_MIDI_SJ_CHAPTER_Q_MASK_TIMETOOLS            0xffffff
1100
1101 #define RTP_MIDI_SJ_CHAPTER_F_FLAG_S                    0x80
1102 #define RTP_MIDI_SJ_CHAPTER_F_FLAG_C                    0x40
1103 #define RTP_MIDI_SJ_CHAPTER_F_FLAG_P                    0x20
1104 #define RTP_MIDI_SJ_CHAPTER_F_FLAG_Q                    0x10
1105 #define RTP_MIDI_SJ_CHAPTER_F_FLAG_D                    0x08
1106 #define RTP_MIDI_SJ_CHAPTER_F_MASK_POINT                0x07
1107 #define RTP_MIDI_SJ_CHAPTER_F_MASK_MT0                  0xf0000000
1108 #define RTP_MIDI_SJ_CHAPTER_F_MASK_MT1                  0x0f000000
1109 #define RTP_MIDI_SJ_CHAPTER_F_MASK_MT2                  0x00f00000
1110 #define RTP_MIDI_SJ_CHAPTER_F_MASK_MT3                  0x000f0000
1111 #define RTP_MIDI_SJ_CHAPTER_F_MASK_MT4                  0x0000f000
1112 #define RTP_MIDI_SJ_CHAPTER_F_MASK_MT5                  0x00000f00
1113 #define RTP_MIDI_SJ_CHAPTER_F_MASK_MT6                  0x000000f0
1114 #define RTP_MIDI_SJ_CHAPTER_F_MASK_MT7                  0x0000000f
1115 #define RTP_MIDI_SJ_CHAPTER_F_MASK_HR                   0xff000000
1116 #define RTP_MIDI_SJ_CHAPTER_F_MASK_MN                   0x00ff0000
1117 #define RTP_MIDI_SJ_CHAPTER_F_MASK_SC                   0x0000ff00
1118 #define RTP_MIDI_SJ_CHAPTER_F_MASK_FR                   0x000000ff
1119
1120 #define RTP_MIDI_SJ_CHAPTER_X_FLAG_S                    0x80
1121 #define RTP_MIDI_SJ_CHAPTER_X_FLAG_T                    0x40
1122 #define RTP_MIDI_SJ_CHAPTER_X_FLAG_C                    0x20
1123 #define RTP_MIDI_SJ_CHAPTER_X_FLAG_F                    0x10
1124 #define RTP_MIDI_SJ_CHAPTER_X_FLAG_D                    0x08
1125 #define RTP_MIDI_SJ_CHAPTER_X_FLAG_L                    0x04
1126 #define RTP_MIDI_SJ_CHAPTER_X_MASK_STA                  0x03
1127 #define RTP_MIDI_SJ_CHAPTER_X_MASK_TCOUNT               0xff
1128 #define RTP_MIDI_SJ_CHAPTER_X_MASK_COUNT                0xff
1129
1130 #define RTP_MIDI_CJ_FLAG_S                              0x800000
1131 #define RTP_MIDI_CJ_FLAG_H                              0x040000
1132 #define RTP_MIDI_CJ_FLAG_P                              0x000080
1133 #define RTP_MIDI_CJ_FLAG_C                              0x000040
1134 #define RTP_MIDI_CJ_FLAG_M                              0x000020
1135 #define RTP_MIDI_CJ_FLAG_W                              0x000010
1136 #define RTP_MIDI_CJ_FLAG_N                              0x000008
1137 #define RTP_MIDI_CJ_FLAG_E                              0x000004
1138 #define RTP_MIDI_CJ_FLAG_T                              0x000002
1139 #define RTP_MIDI_CJ_FLAG_A                              0x000001
1140 #define RTP_MIDI_CJ_MASK_LENGTH                         0x03ff00
1141 #define RTP_MIDI_CJ_MASK_CHANNEL                        0x780000
1142 #define RTP_MIDI_CJ_CHANNEL_SHIFT                       19
1143
1144 #define RTP_MIDI_CJ_CHAPTER_M_MASK_LENGTH               0x3f
1145
1146 #define RTP_MIDI_CJ_CHAPTER_N_MASK_LENGTH               0x7f00
1147 #define RTP_MIDI_CJ_CHAPTER_N_MASK_LOW                  0x00f0
1148 #define RTP_MIDI_CJ_CHAPTER_N_MASK_HIGH                 0x000f
1149
1150 #define RTP_MIDI_CJ_CHAPTER_E_MASK_LENGTH               0x7f
1151 #define RTP_MIDI_CJ_CHAPTER_A_MASK_LENGTH               0x7f
1152
1153
1154
1155
1156
1157 static const char rtp_midi_unknown_value_dec[] =                        "unknown value: %d";
1158 static const char rtp_midi_unknown_value_hex[] =                        "unknown value: 0x%x";
1159
1160 static const value_string rtp_midi_note_values[] = {
1161         { 0,                                                            "C-1" },
1162         { 1,                                                            "C#-1" },
1163         { 2,                                                            "D-1" },
1164         { 3,                                                            "D#-1" },
1165         { 4,                                                            "E-1" },
1166         { 5,                                                            "F-1" },
1167         { 6,                                                            "F#-1" },
1168         { 7,                                                            "G-1" },
1169         { 8,                                                            "G#-1" },
1170         { 9,                                                            "A-1" },
1171         { 10,                                                           "A#-1" },
1172         { 11,                                                           "B-1" },
1173         { 12,                                                           "C0" },
1174         { 13,                                                           "C#0" },
1175         { 14,                                                           "D0" },
1176         { 15,                                                           "D#0" },
1177         { 16,                                                           "E0" },
1178         { 17,                                                           "F0" },
1179         { 18,                                                           "F#0" },
1180         { 19,                                                           "G0" },
1181         { 20,                                                           "G#0" },
1182         { 21,                                                           "A0" },
1183         { 22,                                                           "A#0" },
1184         { 23,                                                           "B0" },
1185         { 24,                                                           "C1" },
1186         { 25,                                                           "C#1" },
1187         { 26,                                                           "D1" },
1188         { 27,                                                           "D#1" },
1189         { 28,                                                           "E1" },
1190         { 29,                                                           "F1" },
1191         { 30,                                                           "F#1" },
1192         { 31,                                                           "G1" },
1193         { 32,                                                           "G#1" },
1194         { 33,                                                           "A1" },
1195         { 34,                                                           "A#1" },
1196         { 35,                                                           "B1" },
1197         { 36,                                                           "C2" },
1198         { 37,                                                           "C#2" },
1199         { 38,                                                           "D2" },
1200         { 39,                                                           "D#2" },
1201         { 40,                                                           "E2" },
1202         { 41,                                                           "F2" },
1203         { 42,                                                           "F#2" },
1204         { 43,                                                           "G2" },
1205         { 44,                                                           "G#2" },
1206         { 45,                                                           "A2" },
1207         { 46,                                                           "A#2" },
1208         { 47,                                                           "B2" },
1209         { 48,                                                           "C3" },
1210         { 49,                                                           "C#3" },
1211         { 50,                                                           "D3" },
1212         { 51,                                                           "D#3" },
1213         { 52,                                                           "E3" },
1214         { 53,                                                           "F3" },
1215         { 54,                                                           "F#3" },
1216         { 55,                                                           "G3" },
1217         { 56,                                                           "G#3" },
1218         { 57,                                                           "A3" },
1219         { 58,                                                           "A#3" },
1220         { 59,                                                           "B3" },
1221         { 60,                                                           "C4" },
1222         { 61,                                                           "C#4" },
1223         { 62,                                                           "D4" },
1224         { 63,                                                           "D#4" },
1225         { 64,                                                           "E4" },
1226         { 65,                                                           "F4" },
1227         { 66,                                                           "F#4" },
1228         { 67,                                                           "G4" },
1229         { 68,                                                           "G#4" },
1230         { 69,                                                           "A4" },
1231         { 70,                                                           "A#4" },
1232         { 71,                                                           "B4" },
1233         { 72,                                                           "C5" },
1234         { 73,                                                           "C#5" },
1235         { 74,                                                           "D5" },
1236         { 75,                                                           "D#5" },
1237         { 76,                                                           "E5" },
1238         { 77,                                                           "F5" },
1239         { 78,                                                           "F#5" },
1240         { 79,                                                           "G5" },
1241         { 80,                                                           "G#5" },
1242         { 81,                                                           "A5" },
1243         { 82,                                                           "A#5" },
1244         { 83,                                                           "B5" },
1245         { 84,                                                           "C6" },
1246         { 85,                                                           "C#6" },
1247         { 86,                                                           "D6" },
1248         { 87,                                                           "D#6" },
1249         { 88,                                                           "E6" },
1250         { 89,                                                           "F6" },
1251         { 90,                                                           "F#6" },
1252         { 91,                                                           "G6" },
1253         { 92,                                                           "G#6" },
1254         { 93,                                                           "A6" },
1255         { 94,                                                           "A#6" },
1256         { 95,                                                           "B6" },
1257         { 96,                                                           "C7" },
1258         { 97,                                                           "C#7" },
1259         { 98,                                                           "D7" },
1260         { 99,                                                           "D#7" },
1261         { 100,                                                          "E7" },
1262         { 101,                                                          "F7" },
1263         { 102,                                                          "F#7" },
1264         { 103,                                                          "G7" },
1265         { 104,                                                          "G#7" },
1266         { 105,                                                          "A7" },
1267         { 106,                                                          "A#7" },
1268         { 107,                                                          "B7" },
1269         { 108,                                                          "C8" },
1270         { 109,                                                          "C#8" },
1271         { 110,                                                          "D8" },
1272         { 111,                                                          "D#8" },
1273         { 112,                                                          "E8" },
1274         { 113,                                                          "F8" },
1275         { 114,                                                          "F#8" },
1276         { 115,                                                          "G8" },
1277         { 116,                                                          "G#8" },
1278         { 117,                                                          "A8" },
1279         { 118,                                                          "A#8" },
1280         { 119,                                                          "B8" },
1281         { 120,                                                          "C9" },
1282         { 121,                                                          "C#9" },
1283         { 122,                                                          "D9" },
1284         { 123,                                                          "D#9" },
1285         { 124,                                                          "E9" },
1286         { 125,                                                          "F9" },
1287         { 126,                                                          "F#9" },
1288         { 127,                                                          "G9" },
1289         { 0,                                                            NULL }
1290 };
1291
1292
1293
1294
1295 static const value_string rtp_midi_controller_values[] = {
1296         { RTP_MIDI_CTRL_BANK_SELECT_MSB,                                "Bank Select (msb)" },
1297         { RTP_MIDI_CTRL_MODULATION_WHEEL_OR_LEVER_MSB,                  "Modulation Wheel Or Lever (msb)" },
1298         { RTP_MIDI_CTRL_BREATH_CONTROLLER_MSB,                          "Breath Controller (msb)" },
1299         { RTP_MIDI_CTRL_FOOT_CONTROLLER_MSB,                            "Foot Controller (msb)" },
1300         { RTP_MIDI_CTRL_PORTAMENTO_TIME_MSB,                            "Portamento Time (msb)" },
1301         { RTP_MIDI_CTRL_DATA_ENTRY_MSB,                                 "Data Entry (msb)" },
1302         { RTP_MIDI_CTRL_CHANNEL_VOLUME_MSB,                             "Channel Volume (msb)" },
1303         { RTP_MIDI_CTRL_BALANCE_MSB,                                    "Balance (msb)" },
1304         { RTP_MIDI_CTRL_PAN_MSB,                                        "Pan (msb)" },
1305         { RTP_MIDI_CTRL_EXPRESSION_CONTROLLER_MSB,                      "Expression Controller (msb)" },
1306         { RTP_MIDI_CTRL_EFFECT_CONTROL_1_MSB,                           "Effect Control 1 (msb)" },
1307         { RTP_MIDI_CTRL_EFFECT_CONTROL_2_MSB,                           "Effect Control 2 (msb)" },
1308         { RTP_MIDI_CTRL_GENERAL_PURPOSE_CONTROLLER_1_MSB,               "General Purpose Controller 1 (msb)" },
1309         { RTP_MIDI_CTRL_GENERAL_PURPOSE_CONTROLLER_2_MSB,               "General Purpose Controller 2 (msb)" },
1310         { RTP_MIDI_CTRL_GENERAL_PURPOSE_CONTROLLER_3_MSB,               "General Purpose Controller 3 (msb)" },
1311         { RTP_MIDI_CTRL_GENERAL_PURPOSE_CONTROLLER_4_MSB,               "General Purpose Controller 4 (msb)" },
1312         { RTP_MIDI_CTRL_BANK_SELECT_LSB,                                "Bank Select (lsb)" },
1313         { RTP_MIDI_CTRL_MODULATION_WHEEL_OR_LEVER_LSB,                  "Modulation Wheel Or Lever (lsb)" },
1314         { RTP_MIDI_CTRL_BREATH_CONTROLLER_LSB,                          "Breath Controller (lsb)" },
1315         { RTP_MIDI_CTRL_FOOT_CONTROLLER_LSB,                            "Foot Controller (lsb)" },
1316         { RTP_MIDI_CTRL_PORTAMENTO_TIME_LSB,                            "Portamento Time (lsb)" },
1317         { RTP_MIDI_CTRL_DATA_ENTRY_LSB,                                 "Data Entry (lsb)" },
1318         { RTP_MIDI_CTRL_CHANNEL_VOLUME_LSB,                             "Volume (lsb)" },
1319         { RTP_MIDI_CTRL_BALANCE_LSB,                                    "Balance (lsb)" },
1320         { RTP_MIDI_CTRL_PAN_LSB,                                        "Pan (lsb)" },
1321         { RTP_MIDI_CTRL_EXPRESSION_CONTROLLER_LSB,                      "Expression Controller (lsb)" },
1322         { RTP_MIDI_CTRL_EFFECT_CONTROL_1_LSB,                           "Effect Control 1 (lsb)" },
1323         { RTP_MIDI_CTRL_EFFECT_CONTROL_2_LSB,                           "Effect Control 2 (lsb)" },
1324         { RTP_MIDI_CTRL_DAMPER_PEDAL,                                   "Damper Pedal" },
1325         { RTP_MIDI_CTRL_PORTAMENTO_ON_OFF,                              "Portamento On/Off" },
1326         { RTP_MIDI_CTRL_SUSTENUTO,                                      "Sustenuto" },
1327         { RTP_MIDI_CTRL_SOFT_PEDAL,                                     "Soft Pedal" },
1328         { RTP_MIDI_CTRL_LEGATO_FOOTSWITCH,                              "Legato Footswitch" },
1329         { RTP_MIDI_CTRL_HOLD_2,                                         "Hold 2" },
1330         { RTP_MIDI_CTRL_SOUND_CONTROLLER_1,                             "Sound Controller 1 (default: Sound Variation)" },
1331         { RTP_MIDI_CTRL_SOUND_CONTROLLER_2,                             "Sound Controller 2 (default: Timbre/Harmonic Intensity)" },
1332         { RTP_MIDI_CTRL_SOUND_CONTROLLER_3,                             "Sound Controller 3 (default: Release Time)" },
1333         { RTP_MIDI_CTRL_SOUND_CONTROLLER_4,                             "Sound Controller 4 (default: Attack Time)" },
1334         { RTP_MIDI_CTRL_SOUND_CONTROLLER_5,                             "Sound Controller 5 (default: Brightness)" },
1335         { RTP_MIDI_CTRL_SOUND_CONTROLLER_6,                             "Sound Controller 6" },
1336         { RTP_MIDI_CTRL_SOUND_CONTROLLER_7,                             "Sound Controller 7" },
1337         { RTP_MIDI_CTRL_SOUND_CONTROLLER_8,                             "Sound Controller 8" },
1338         { RTP_MIDI_CTRL_SOUND_CONTROLLER_9,                             "Sound Controller 9" },
1339         { RTP_MIDI_CTRL_SOUND_CONTROLLER_10,                            "Sound Controller 10" },
1340         { RTP_MIDI_CTRL_GENERAL_PURPOSE_CONTROLLER_5,                   "General Purpose Controller 5" },
1341         { RTP_MIDI_CTRL_GENERAL_PURPOSE_CONTROLLER_6,                   "General Purpose Controller 6" },
1342         { RTP_MIDI_CTRL_GENERAL_PURPOSE_CONTROLLER_7,                   "General Purpose Controller 7" },
1343         { RTP_MIDI_CTRL_GENERAL_PURPOSE_CONTROLLER_8,                   "General Purpose Controller 8" },
1344         { RTP_MIDI_CTRL_PORTAMENTO_CONTROL,                             "Portamento Control" },
1345         { RTP_MIDI_CTRL_EFFECTS_1_DEPTH,                                "Effects 1 Depth (formerly: External Effects Depth)" },
1346         { RTP_MIDI_CTRL_EFFECTS_2_DEPTH,                                "Effects 2 Depth (formerly: Tremolo Depth)" },
1347         { RTP_MIDI_CTRL_EFFECTS_3_DEPTH,                                "Effects 3 Depth (formerly: Chorus Depth)" },
1348         { RTP_MIDI_CTRL_EFFECTS_4_DEPTH,                                "Effects 4 Depth (formerly: Celeste (Detune) Depth)" },
1349         { RTP_MIDI_CTRL_EFFECTS_5_DEPTH,                                "Effects 5 Depth (formerly: Phaser Deptch)" },
1350         { RTP_MIDI_CTRL_DATA_INCREMENT,                                 "Data Increment" },
1351         { RTP_MIDI_CTRL_DATA_DECREMENT,                                 "Data Decrement" },
1352         { RTP_MIDI_CTRL_NON_REGISTERED_PARAM_LSB,                       "Non-Registered Parameter (lsb)" },
1353         { RTP_MIDI_CTRL_NON_REGISTERED_PARAM_MSB,                       "Non-Registered Parameter (msb)" },
1354         { RTP_MIDI_CTRL_REGISTERED_PARAM_LSB,                           "Registered Parameter (lsb)" },
1355         { RTP_MIDI_CTRL_REGISTERED_PARAM_MSB,                           "Registered Parameter (msb)" },
1356         { RTP_MIDI_CTRL_ALL_SOUND_OFF,                                  "All Sound Off" },
1357         { RTP_MIDI_CTRL_RESET_ALL_CONTROLLERS,                          "Reset All Controllers" },
1358         { RTP_MIDI_CTRL_LOCAL_CONTROL_ON_OFF,                           "Local Control" },
1359         { RTP_MIDI_CTRL_ALL_NOTES_OFF,                                  "All Notes Off" },
1360         { RTP_MIDI_CTRL_OMNI_MODE_OFF,                                  "Omni Mode Off" },
1361         { RTP_MIDI_CTRL_OMNI_MODE_ON,                                   "Omni Mode On" },
1362         { RTP_MIDI_CTRL_MONO_MODE_ON,                                   "Mono Mode On" },
1363         { RTP_MIDI_CTRL_POLY_MODE_ON,                                   "Poly Mode On" },
1364         { 0,                                                            NULL }
1365 };
1366
1367
1368
1369 static const value_string rtp_midi_manu_short_values[] = {
1370         { RTP_MIDI_MANU_SHORT_ISLONG,                                   "< long id >" },
1371         { RTP_MIDI_MANU_SHORT_SEQUENTIAL_CIRCUITS,                      "Sequential Circuits" },
1372         { RTP_MIDI_MANU_SHORT_BIG_BRIAR_IDP,                            "Big Briar / IDP" },
1373         { RTP_MIDI_MANU_SHORT_OCTAVE_PLATEAU_VOYETRA,                   "Voyetra / Octave-Plateau" },
1374         { RTP_MIDI_MANU_SHORT_MOOG,                                     "Moog" },
1375         { RTP_MIDI_MANU_SHORT_PASSPORT_DESIGNS,                         "Passport Designs" },
1376         { RTP_MIDI_MANU_SHORT_LEXICON,                                  "Lexicon" },
1377         { RTP_MIDI_MANU_SHORT_KURZWEIL,                                 "Kurzweil" },
1378         { RTP_MIDI_MANU_SHORT_FENDER,                                   "Fender" },
1379         { RTP_MIDI_MANU_SHORT_GULBRANSEN,                               "Gulbransen" },
1380         { RTP_MIDI_MANU_SHORT_AKG_ACOUSTICS,                            "AKG Acoustics" },
1381         { RTP_MIDI_MANU_SHORT_VOYCE_MUSIC,                              "Voyce Music" },
1382         { RTP_MIDI_MANU_SHORT_WAVEFRAME,                                "Waveframe Corp" },
1383         { RTP_MIDI_MANU_SHORT_ADA_SIGNAL_PROCESSORS,                    "ADA Signal Processors" },
1384         { RTP_MIDI_MANU_SHORT_GARFIELD_ELECTRONICS,                     "Garfield Electronics" },
1385         { RTP_MIDI_MANU_SHORT_ENSONIQ,                                  "Ensoniq" },
1386         { RTP_MIDI_MANU_SHORT_OBERHEIM_GIBSON_LABS,                     "Oberheim / Gibson Labs" },
1387         { RTP_MIDI_MANU_SHORT_APPLE_COMPUTERS,                          "Apple Computer" },
1388         { RTP_MIDI_MANU_SHORT_GREY_MATTER_RESPONSE,                     "Grey Matter Response / Simmons" },
1389         { RTP_MIDI_MANU_SHORT_DIGIDESIGN,                               "DigiDesign" },
1390         { RTP_MIDI_MANU_SHORT_PALMTREE_INSTRUMENTS,                     "Fairlight / Palmtree Instruments" },
1391         { RTP_MIDI_MANU_SHORT_JL_COOPER,                                "JL Cooper" },
1392         { RTP_MIDI_MANU_SHORT_LOWREY,                                   "Lowrey" },
1393         { RTP_MIDI_MANU_SHORT_LINN_ADAMS_SMITH,                         "Linn / Adams-Smith" },
1394         { RTP_MIDI_MANU_SHORT_EMU_SYSTEMS,                              "Emu Systems" },
1395         { RTP_MIDI_MANU_SHORT_HARMONY_SYSTEMS,                          "Harmony Systems" },
1396         { RTP_MIDI_MANU_SHORT_ART,                                      "ART" },
1397         { RTP_MIDI_MANU_SHORT_BALDWIN,                                  "Baldwin" },
1398         { RTP_MIDI_MANU_SHORT_EVENTIDE,                                 "Eventide" },
1399         { RTP_MIDI_MANU_SHORT_INVENTRONICS,                             "Inventronics" },
1400         { RTP_MIDI_MANU_SHORT_CLARITY,                                  "Clarity" },
1401         { RTP_MIDI_MANU_SHORT_PASSAC,                                   "Passac" },
1402         { RTP_MIDI_MANU_SHORT_SIEL,                                     "S.I.E.L." },
1403         { RTP_MIDI_MANU_SHORT_SYNTHE_AXE,                               "SyntheAxe" },
1404         { RTP_MIDI_MANU_SHORT_STEPP,                                    "Stepp" },
1405         { RTP_MIDI_MANU_SHORT_HOHNER,                                   "Hohner" },
1406         { RTP_MIDI_MANU_SHORT_CRUMAR_TWISTER,                           "Crumar / Twister" },
1407         { RTP_MIDI_MANU_SHORT_SOLTON,                                   "Solton" },
1408         { RTP_MIDI_MANU_SHORT_JELLINGHAUS_MS,                           "Jellinghaus MS" },
1409         { RTP_MIDI_MANU_SHORT_SOUTHWORK_MUSIC_SYSTEMS,                  "Southworks Music Systems" },
1410         { RTP_MIDI_MANU_SHORT_JEN,                                      "JEN" },
1411         { RTP_MIDI_MANU_SHORT_PPG,                                      "PPG" },
1412         { RTP_MIDI_MANU_SHORT_SSL,                                      "SSL (Solid States Logic)" },
1413         { RTP_MIDI_MANU_SHORT_AUDIO_VERITRIEB,                          "Audio Veritrieb" },
1414         { RTP_MIDI_MANU_SHORT_NEVE_HINTON_INSTRUMENTS,                  "Neve / Hinton Instruments" },
1415         { RTP_MIDI_MANU_SHORT_SOUNDTRACS,                               "Soundtracs Ltd" },
1416         { RTP_MIDI_MANU_SHORT_ELKA_GENERAL_MUSIC,                       "Elka / General Music" },
1417         { RTP_MIDI_MANU_SHORT_DYNACORD,                                 "Dynacord" },
1418         { RTP_MIDI_MANU_SHORT_VISCOUNT,                                 "Viscount" },
1419         { RTP_MIDI_MANU_SHORT_DRAWMER,                                  "Drawmer" },
1420         { RTP_MIDI_MANU_SHORT_CLAVIA_DIGITAL_INSTRUMENTS,               "Clavia Digital Instruments" },
1421         { RTP_MIDI_MANU_SHORT_AUDIO_ARCHITECTURE,                       "Audio Architecture" },
1422         { RTP_MIDI_MANU_SHORT_GENERAL_MUSIC_CORP,                       "General Music Corp" },
1423         { RTP_MIDI_MANU_SHORT_CHEETAH,                                  "Cheetah Marketing" },
1424         { RTP_MIDI_MANU_SHORT_CTM,                                      "C.T.M" },
1425         { RTP_MIDI_MANU_SHORT_SIMMONS_UK,                               "Simmons UK" },
1426         { RTP_MIDI_MANU_SHORT_SOUNDCRAFT_ELECTRONICS,                   "Soundcraft Electronics" },
1427         { RTP_MIDI_MANU_SHORT_STEINBERG_GMBH,                           "Steinberg GmbH" },
1428         { RTP_MIDI_MANU_SHORT_WERSI,                                    "Wersi" },
1429         { RTP_MIDI_MANU_SHORT_AVAB_ELEKTRONIK_AB,                       "Avab Electronik Ab" },
1430         { RTP_MIDI_MANU_SHORT_DIGIGRAM,                                 "Digigram" },
1431         { RTP_MIDI_MANU_SHORT_WALDORF,                                  "Waldorf Electronics" },
1432         { RTP_MIDI_MANU_SHORT_QUASIMIDI,                                "Quasimidi" },
1433         { RTP_MIDI_MANU_SHORT_KAWAI,                                    "Kawai" },
1434         { RTP_MIDI_MANU_SHORT_ROLAND,                                   "Roland" },
1435         { RTP_MIDI_MANU_SHORT_KORG,                                     "Korg" },
1436         { RTP_MIDI_MANU_SHORT_YAMAHA,                                   "Yamaha" },
1437         { RTP_MIDI_MANU_SHORT_CASIO,                                    "Casio" },
1438         { RTP_MIDI_MANU_SHORT_MORIDAIRA,                                "Moridaira" },
1439         { RTP_MIDI_MANU_SHORT_KAMIYA_STUDIO,                            "Kamiya Studio" },
1440         { RTP_MIDI_MANU_SHORT_AKAI,                                     "Akai" },
1441         { RTP_MIDI_MANU_SHORT_JAPAN_VICTOR,                             "Japan Victor" },
1442         { RTP_MIDI_MANU_SHORT_MEISOSHA,                                 "Meisosha" },
1443         { RTP_MIDI_MANU_SHORT_HOSHINO_GAKKI,                            "Hoshino Gakki" },
1444         { RTP_MIDI_MANU_SHORT_FUJITSU,                                  "Fujitsu" },
1445         { RTP_MIDI_MANU_SHORT_SONY,                                     "Sony" },
1446         { RTP_MIDI_MANU_SHORT_NISSHIN_ONPA,                             "Nisshin Onpa" },
1447         { RTP_MIDI_MANU_SHORT_TEAC,                                     "TEAC" },
1448         { RTP_MIDI_MANU_SHORT_MATSUSHITA_ELECTRIC,                      "Matsushita Electric" },
1449         { RTP_MIDI_MANU_SHORT_FOSTEX,                                   "Fostex" },
1450         { RTP_MIDI_MANU_SHORT_ZOOM,                                     "Zoom" },
1451         { RTP_MIDI_MANU_SHORT_MIDORI_ELECTRONICS,                       "Midori Electronics" },
1452         { RTP_MIDI_MANU_SHORT_MATSUSHITA_COMMUNICATION,                 "Matsushita Communication" },
1453         { RTP_MIDI_MANU_SHORT_SUZUKI,                                   "Suzuki" },
1454         { RTP_MIDI_MANU_SHORT_FUJI,                                     "Fuji" },
1455         { RTP_MIDI_MANU_SHORT_ACOUSTIC_TECHNICAL_LAB,                   "Acoustic Technical Lab" },
1456         { RTP_MIDI_MANU_SHORT_FAITH,                                    "Faith" },
1457         { RTP_MIDI_MANU_SHORT_INTERNET_CORPORATION,                     "Internet Corporation" },
1458         { RTP_MIDI_MANU_SHORT_SEEKERS_CO,                               "Seekers Co" },
1459         { RTP_MIDI_MANU_SHORT_SD_CARD_ASSOCIATION,                      "SD Card Assoc" },
1460         { RTP_MIDI_MANU_SHORT_EDUCATIONAL_USE,                          "Educational Use" },
1461         { RTP_MIDI_MANU_SHORT_NON_REALTIME_UNIVERSAL,                   "Non-Realtime Universal" },
1462         { RTP_MIDI_MANU_SHORT_REALTIME_UNIVERSAL,                       "Realtime Universal" },
1463         { 0,                                                            NULL }
1464 };
1465
1466 static const value_string rtp_midi_manu_long_values[] = {
1467         /* North American Manufacturers */
1468         { RTP_MIDI_MANU_LONG_TIME_WARNER_INTERACTIVE,                   "Time Warner Interactive" },
1469         { RTP_MIDI_MANU_LONG_ADVANCED_GRAVIS_COMP,                      "Advanced Gravis Comp" },
1470         { RTP_MIDI_MANU_LONG_MEDIA_VISION,                              "Media Vision" },
1471         { RTP_MIDI_MANU_LONG_DORNES_RESEARCH_GROUP,                     "Dornes Research Group" },
1472         { RTP_MIDI_MANU_LONG_KMUSE,                                     "K-Muse" },
1473         { RTP_MIDI_MANU_LONG_STYPHER,                                   "Stypher" },
1474         { RTP_MIDI_MANU_LONG_DIGITAL_MUSIC_CORPORATION,                 "Digital Music Corporation" },
1475         { RTP_MIDI_MANU_LONG_IOTA_SYSTEMS,                              "IOTA Systems" },
1476         { RTP_MIDI_MANU_LONG_NEW_ENGLAND_DIGITAL,                       "New England Digital" },
1477         { RTP_MIDI_MANU_LONG_ARTISYN,                                   "Artisyn" },
1478         { RTP_MIDI_MANU_LONG_IVL_TECHNOLOGIES,                          "IVL Technologies" },
1479         { RTP_MIDI_MANU_LONG_SOUTHERN_MUSIC_SYSTEMS,                    "Southern Music Systems" },
1480         { RTP_MIDI_MANU_LONG_LAKE_BUTLER_SOUND_COMPANY,                 "Lake Butler Sound Company" },
1481         { RTP_MIDI_MANU_LONG_ALESIS,                                    "Alesis" },
1482         { RTP_MIDI_MANU_LONG_SOUND_CREATION,                            "Sound Creation" },
1483         { RTP_MIDI_MANU_LONG_DOD_ELECTRONICS,                           "DOD Electronics" },
1484         { RTP_MIDI_MANU_LONG_STUDER_EDITECH,                            "Studer-Editech" },
1485         { RTP_MIDI_MANU_LONG_SONUS,                                     "Sonus" },
1486         { RTP_MIDI_MANU_LONG_TEMPORAL_ACUITY_PRODUCTS,                  "Temporal Acuity Products" },
1487         { RTP_MIDI_MANU_LONG_PERFECT_FRETWORKS,                         "Perfect Fretworks" },
1488         { RTP_MIDI_MANU_LONG_KAT,                                       "KAT" },
1489         { RTP_MIDI_MANU_LONG_OPCODE,                                    "Opcode" },
1490         { RTP_MIDI_MANU_LONG_RANE_CORP,                                 "Rane Corp" },
1491         { RTP_MIDI_MANU_LONG_SPATIAL_SOUND_ANADI_INC,                   "Spatial Sound / Anadi Inc" },
1492         { RTP_MIDI_MANU_LONG_KMX,                                       "KMX" },
1493         { RTP_MIDI_MANU_LONG_ALLEN_AND_HEATH_BRENNEL,                   "Allen & Heath Brenell" },
1494         { RTP_MIDI_MANU_LONG_PEAVEY,                                    "Peavey" },
1495         { RTP_MIDI_MANU_LONG_360_SYSTEMS,                               "360 Systems" },
1496         { RTP_MIDI_MANU_LONG_SPECTRUM_DESIGN_DEVELOPMENT,               "Spectrum Design and Development" },
1497         { RTP_MIDI_MANU_LONG_MARQUIS_MUSIC,                             "Marquis Music" },
1498         { RTP_MIDI_MANU_LONG_ZETA_SYSTEMS,                              "Zeta Systems" },
1499         { RTP_MIDI_MANU_LONG_AXXES,                                     "Axxes" },
1500         { RTP_MIDI_MANU_LONG_ORBAN,                                     "Orban" },
1501         { RTP_MIDI_MANU_LONG_INDIAN_VALLEY,                             "Indian Valley Mfg" },
1502         { RTP_MIDI_MANU_LONG_TRITON,                                    "Triton" },
1503         { RTP_MIDI_MANU_LONG_KTI,                                       "KTI" },
1504         { RTP_MIDI_MANU_LONG_BREAKAWAY_TECHNOLOGIES,                    "Breakaway Technologies" },
1505         { RTP_MIDI_MANU_LONG_CAE,                                       "CAE" },
1506         { RTP_MIDI_MANU_LONG_HARRISON_SYSTEMS_INC,                      "Harrison Systems Inc" },
1507         { RTP_MIDI_MANU_LONG_FUTURE_LAB_MARK_KUO,                       "Future Lab / Mark Kuo" },
1508         { RTP_MIDI_MANU_LONG_ROCKTRON_CORP,                             "Rocktron Corp" },
1509         { RTP_MIDI_MANU_LONG_PIANODISC,                                 "PianoDisc" },
1510         { RTP_MIDI_MANU_LONG_CANNON_RESEARCH_GROUP,                     "Cannon Research Group" },
1511         { RTP_MIDI_MANU_LONG_RODGERS_INSTRUMENTS_CORP,                  "Rodgers Instrument Corp" },
1512         { RTP_MIDI_MANU_LONG_BLUE_SKY_LOGIC,                            "Blue Sky Logic" },
1513         { RTP_MIDI_MANU_LONG_ENCORE_ELECTRONICS,                        "Encore Electronics" },
1514         { RTP_MIDI_MANU_LONG_UPTOWN,                                    "Uptown" },
1515         { RTP_MIDI_MANU_LONG_VOCE,                                      "Voce" },
1516         { RTP_MIDI_MANU_LONG_CTI_AUDIO_INC,                             "CTI Audio, Inc / Music Intel Dev" },
1517         { RTP_MIDI_MANU_LONG_SS_RESEARCH,                               "S&S Research" },
1518         { RTP_MIDI_MANU_LONG_BRODERBUND_SOFTWARE,                       "Broderbund Software Inc" },
1519         { RTP_MIDI_MANU_LONG_ALLEN_ORGAN_CO,                            "Allen Organ Co" },
1520         { RTP_MIDI_MANU_LONG_MUSIC_QUEST,                               "Music Quest" },
1521         { RTP_MIDI_MANU_LONG_APHEX,                                     "APHEX" },
1522         { RTP_MIDI_MANU_LONG_GALLIEN_KRUEGER,                           "Gallien Krueger" },
1523         { RTP_MIDI_MANU_LONG_IBM,                                       "IBM" },
1524         { RTP_MIDI_MANU_LONG_MARK_OF_THE_UNICORN,                       "Mark of the Unicorn" },
1525         { RTP_MIDI_MANU_LONG_HOTZ_INSTRUMENTS_TECH,                     "Hotz Instruments Technologies" },
1526         { RTP_MIDI_MANU_LONG_ETA_LIGHTING,                              "ETA Lighting" },
1527         { RTP_MIDI_MANU_LONG_NSI_CORPORATION,                           "NSI Corporation" },
1528         { RTP_MIDI_MANU_LONG_ADLIB_INC,                                 "PAd Lib, Inc" },
1529         { RTP_MIDI_MANU_LONG_RICHMOND_SOUND_DESIGN,                     "Richmond Sound Design" },
1530         { RTP_MIDI_MANU_LONG_MICROSOFT,                                 "Microsoft" },
1531         { RTP_MIDI_MANU_LONG_THE_SOFTWARE_TOOLWORKS,                    "The Software Toolworks" },
1532         { RTP_MIDI_MANU_LONG_RJMG_NICHE,                                "RJMG / Niche" },
1533         { RTP_MIDI_MANU_LONG_INTONE,                                    "Intone" },
1534         { RTP_MIDI_MANU_LONG_ADVANCED_REMOTE_TECH,                      "Advanced Remote Tech" },
1535         { RTP_MIDI_MANU_LONG_GT_ELECTRONICS_GROOVE_TUBES,               "GT Electronics / Groove Tubes" },
1536         { RTP_MIDI_MANU_LONG_INTERMIDI,                                 "InterMIDI" },
1537         { RTP_MIDI_MANU_LONG_TIMELINE_VISTA,                            "Timeline Vista" },
1538         { RTP_MIDI_MANU_LONG_MESA_BOOGIE,                               "Mesa Boogie" },
1539         { RTP_MIDI_MANU_LONG_SEQUOIA_DEVELOPMENT,                       "Sequoia Development" },
1540         { RTP_MIDI_MANU_LONG_STUDIO_ELECTRONICS,                        "Studio Electronics" },
1541         { RTP_MIDI_MANU_LONG_EUPHONIX,                                  "Euphonix" },
1542         { RTP_MIDI_MANU_LONG_INTERMIDI2,                                "InterMIDI" },
1543         { RTP_MIDI_MANU_LONG_MIDI_SOLUTIONS,                            "MIDI Solutions" },
1544         { RTP_MIDI_MANU_LONG_3DO_COMPANY,                               "3DO Company" },
1545         { RTP_MIDI_MANU_LONG_LIGHTWAVE_RESEARCH,                        "Lightwave Research" },
1546         { RTP_MIDI_MANU_LONG_MICROW,                                    "Micro-W" },
1547         { RTP_MIDI_MANU_LONG_SPECTRAL_SYNTHESIS,                        "Spectral Synthesis" },
1548         { RTP_MIDI_MANU_LONG_LONE_WOLF,                                 "Lone Wolf" },
1549         { RTP_MIDI_MANU_LONG_STUDIO_TECHNOLOGIES,                       "Studio Technologies" },
1550         { RTP_MIDI_MANU_LONG_PETERSON_EMP,                              "Peterson EMP" },
1551         { RTP_MIDI_MANU_LONG_ATARI,                                     "Atari" },
1552         { RTP_MIDI_MANU_LONG_MARION_SYSTEMS,                            "Marion Systems" },
1553         { RTP_MIDI_MANU_LONG_DESIGN_EVENT,                              "Design Event" },
1554         { RTP_MIDI_MANU_LONG_WINJAMMER_SOFTWARE,                        "Winjammer Software" },
1555         { RTP_MIDI_MANU_LONG_ATT_BELL_LABS,                             "AT&T Bell Labs" },
1556         { RTP_MIDI_MANU_LONG_SYMETRIX,                                  "Symetrix" },
1557         { RTP_MIDI_MANU_LONG_MIDI_THE_WORLD,                            "MIDI the world" },
1558         { RTP_MIDI_MANU_LONG_DESPER_PRODUCTS,                           "Desper Products" },
1559         { RTP_MIDI_MANU_LONG_MICROS_N_MIDI,                             "Micros 'n MIDI" },
1560         { RTP_MIDI_MANU_LONG_ACCORDIANS_INTL,                           "Accodians Intl" },
1561         { RTP_MIDI_MANU_LONG_EUPHONICS,                                 "EuPhonics" },
1562         { RTP_MIDI_MANU_LONG_MUSONIX,                                   "Musonix" },
1563         { RTP_MIDI_MANU_LONG_TURTLE_BEACH_SYSTEMS,                      "Turtle Beach Systems" },
1564         { RTP_MIDI_MANU_LONG_MACKIE_DESIGNS,                            "Mackie Designs" },
1565         { RTP_MIDI_MANU_LONG_COMPUSERVE,                                "Compuserve" },
1566         { RTP_MIDI_MANU_LONG_BES_TECHNOLOGIES,                          "BES Technologies" },
1567         { RTP_MIDI_MANU_LONG_QRS_MUSIC_ROLLS,                           "QRS Music Rolls" },
1568         { RTP_MIDI_MANU_LONG_P_G_MUSIC,                                 "P G Music" },
1569         { RTP_MIDI_MANU_LONG_SIERRA_SEMICONDUCTOR,                      "Sierra Semiconductor" },
1570         { RTP_MIDI_MANU_LONG_EPIGRAF_AUDIO_VISUAL,                      "EpiGraf Audio Visual" },
1571         { RTP_MIDI_MANU_LONG_ELECTRONICS_DIVERSIFIED,                   "Electronics Diversified" },
1572         { RTP_MIDI_MANU_LONG_TUNE_1000,                                 "Tune 1000" },
1573         { RTP_MIDI_MANU_LONG_ADVANCED_MICRO_DEVICES,                    "Advanced Micro Devices" },
1574         { RTP_MIDI_MANU_LONG_MEDIAMATION,                               "Mediamation" },
1575         { RTP_MIDI_MANU_LONG_SABINE_MUSIC,                              "Sabine Music" },
1576         { RTP_MIDI_MANU_LONG_WOOG_LABS,                                 "Woog Labs" },
1577         { RTP_MIDI_MANU_LONG_MIRCOPOLIS,                                "Micropolis" },
1578         { RTP_MIDI_MANU_LONG_TA_HORNG_MUSICAL_INSTRUMENT,               "Ta Horng Musical Instrument" },
1579         { RTP_MIDI_MANU_LONG_ETEK_LABS_FORTE_TECH,                      "e-Tek Labs (Forte Tech)" },
1580         { RTP_MIDI_MANU_LONG_ELECTRO_VOICE,                             "Electro-Voice" },
1581         { RTP_MIDI_MANU_LONG_MIDISOFT_CORPORATION,                      "Midisoft Corporation" },
1582         { RTP_MIDI_MANU_LONG_QSOUND_LABS,                               "Q-Sound Labs" },
1583         { RTP_MIDI_MANU_LONG_WESTREX,                                   "Westrex" },
1584         { RTP_MIDI_MANU_LONG_NVIDIA,                                    "NVidia" },
1585         { RTP_MIDI_MANU_LONG_ESS_TECHNOLOGY,                            "ESS Technology" },
1586         { RTP_MIDI_MANU_LONG_MEDIATRIX_PERIPHERALS,                     "MediaTrix Peripherals" },
1587         { RTP_MIDI_MANU_LONG_BROOKTREE_CORP,                            "Brooktree Corp" },
1588         { RTP_MIDI_MANU_LONG_OTARI_CORP,                                "Otari Corp" },
1589         { RTP_MIDI_MANU_LONG_KEY_ELECTRONICS,                           "Key Electronics" },
1590         { RTP_MIDI_MANU_LONG_SHURE_INCORPORATED,                        "Shure Incorporated" },
1591         { RTP_MIDI_MANU_LONG_AURA_SOUND,                                "Aura Sound" },
1592         { RTP_MIDI_MANU_LONG_CRYSTAL_SEMICONDUCTOR,                     "Crystal Semiconductor" },
1593         { RTP_MIDI_MANU_LONG_CONEXANT_ROCKWELL,                         "Conexant (Rockwell)" },
1594         { RTP_MIDI_MANU_LONG_SILICON_GRAPHICS,                          "Silicon Graphics" },
1595         { RTP_MIDI_MANU_LONG_MAUDIO_MIDIMAN,                            "M-Audio (Midiman)" },
1596         { RTP_MIDI_MANU_LONG_PRESONUS,                                  "PreSonus" },
1597         { RTP_MIDI_MANU_LONG_TOPAZ_ENTERPRISES,                         "Topaz Enterprises" },
1598         { RTP_MIDI_MANU_LONG_CAST_LIGHTING,                             "Cast Lighting" },
1599         { RTP_MIDI_MANU_LONG_MICROSOFT_CONSUMER_DIVISION,               "Microsoft (Consumer Division)" },
1600         { RTP_MIDI_MANU_LONG_SONIC_FOUNDRY,                             "Sonic Foundry" },
1601         { RTP_MIDI_MANU_LONG_LINE6_FAST_FORWARD,                        "Line 6 (Fast Forward)" },
1602         { RTP_MIDI_MANU_LONG_BEATNIK_INC,                               "Beatnik Inc" },
1603         { RTP_MIDI_MANU_LONG_VAN_KOEVERING_COMPANY,                     "Van Koevering Company" },
1604         { RTP_MIDI_MANU_LONG_ALTECH_SYSTEMS,                            "DiAltech Systemsgit" },
1605         { RTP_MIDI_MANU_LONG_S_S_RESEARCH,                              "S&S Research" },
1606         { RTP_MIDI_MANU_LONG_VLSI_TECHNOLOGY,                           "VLSI Technology" },
1607         { RTP_MIDI_MANU_LONG_CHROMATIC_RESEARCH,                        "Chromatic Research" },
1608         { RTP_MIDI_MANU_LONG_SAPPHIRE,                                  "Sapphire" },
1609         { RTP_MIDI_MANU_LONG_IDRC,                                      "IDRC" },
1610         { RTP_MIDI_MANU_LONG_JUSTONIC_TUNING,                           "Justonic Tuning" },
1611         { RTP_MIDI_MANU_LONG_TORCOMP_RESEARCH_INC,                      "TorComp Research Inc" },
1612         { RTP_MIDI_MANU_LONG_NEWTEK_INC,                                "NewTek Inc" },
1613         { RTP_MIDI_MANU_LONG_SOUND_SCULPTURE,                           "Sound Sculpture" },
1614         { RTP_MIDI_MANU_LONG_WALKER_TECHNICAL,                          "Walker Technical" },
1615         { RTP_MIDI_MANU_LONG_DIGITAL_HARMONY,                           "Digital Harmony" },
1616         { RTP_MIDI_MANU_LONG_INVISION_INTERACTIVE,                      "InVision Interactive" },
1617         { RTP_MIDI_MANU_LONG_TSQUARE_DESIGN,                            "T-Square Design" },
1618         { RTP_MIDI_MANU_LONG_NEMESYS_MUSIC_TECHNOLOGY,                  "Nemesys Music Technology" },
1619         { RTP_MIDI_MANU_LONG_DBX_PROFESSIONAL_HARMAN_INTL,              "DBX Professional (Harman Intl)" },
1620         { RTP_MIDI_MANU_LONG_SYNDYNE_CORPORATION,                       "Syndyne Corporation" },
1621         { RTP_MIDI_MANU_LONG_BITHEADZ,                                  "Bitheadz" },
1622         { RTP_MIDI_MANU_LONG_CAKEWALK_MUSIC_SOFTWARE,                   "Cakewalk Music Software" },
1623         { RTP_MIDI_MANU_LONG_ANALOG_DEVICES,                            "Analog Devices" },
1624         { RTP_MIDI_MANU_LONG_NATIONAL_SEMICONDUCTOR,                    "National Semiconductor" },
1625         { RTP_MIDI_MANU_LONG_BOOM_THEORY,                               "Boom Theory" },
1626         { RTP_MIDI_MANU_LONG_VIRTUAL_DSP_CORPORATION,                   "Virtual DSP Corporation" },
1627         { RTP_MIDI_MANU_LONG_ANTARES_SYSTEMS,                           "Antares Systems" },
1628         { RTP_MIDI_MANU_LONG_ANGEL_SOFTWARE,                            "Angel Software" },
1629         { RTP_MIDI_MANU_LONG_ST_LOUIS_MUSIC,                            "St Louis Music" },
1630         { RTP_MIDI_MANU_LONG_LYRRUS_DBA_GVOX,                           "Lyrrus dba G-VOX" },
1631         { RTP_MIDI_MANU_LONG_ASHLEY_AUDIO_INC,                          "Ashley Audio Inc" },
1632         { RTP_MIDI_MANU_LONG_VARILITE_INC,                              "Vari-Lite Inc" },
1633         { RTP_MIDI_MANU_LONG_SUMMIT_AUDIO_INC,                          "Summit Audio Inc" },
1634         { RTP_MIDI_MANU_LONG_AUREAL_SEMICONDUCTOR_INC,                  "Aureal Semiconductor Inc" },
1635         { RTP_MIDI_MANU_LONG_SEASOUND_LLC,                              "SeaSound LLC" },
1636         { RTP_MIDI_MANU_LONG_US_ROBOTICS,                               "U.S. Robotics" },
1637         { RTP_MIDI_MANU_LONG_AURISIS_RESEARCH,                          "Aurisis Research" },
1638         { RTP_MIDI_MANU_LONG_NEARFIELD_MULTIMEDIA,                      "Nearfield Multimedia" },
1639         { RTP_MIDI_MANU_LONG_FM7_INC,                                   "FM7 Inc" },
1640         { RTP_MIDI_MANU_LONG_SWIVEL_SYSTEMS,                            "Swivel Systems" },
1641         { RTP_MIDI_MANU_LONG_HYPERACTIVE_AUDIO_SYSTEMS,                 "Hyperactive Audio Systems" },
1642         { RTP_MIDI_MANU_LONG_MIDILITE_CASTE_STUDIO_PROD,                "MidiLite (Castle Studios Productions)" },
1643         { RTP_MIDI_MANU_LONG_RADIKAL_TECHNOLOGIES,                      "Radikal Technologies" },
1644         { RTP_MIDI_MANU_LONG_ROGER_LINN_DESIGN,                         "Roger Linn Design" },
1645         { RTP_MIDI_MANU_LONG_TCHELION_VOCAL_TECHNOLOGIES,               "TC-Helicon Vocal Technologies" },
1646         { RTP_MIDI_MANU_LONG_EVENT_ELECTRONICS,                         "Event Electronics" },
1647         { RTP_MIDI_MANU_LONG_SONIC_NETWORK_INC,                         "Sonic Network Inc" },
1648         { RTP_MIDI_MANU_LONG_REALTIME_MUSIC_SOLUTIONS,                  "Realtime Music Solutions" },
1649         { RTP_MIDI_MANU_LONG_APOGEE_DIGITAL,                            "Apogee Digital" },
1650         { RTP_MIDI_MANU_LONG_CLASSICAL_ORGANS_INC,                      "Classical Organs, Inc" },
1651         { RTP_MIDI_MANU_LONG_MICROTOOLS_INC,                            "Microtools Inc" },
1652         { RTP_MIDI_MANU_LONG_NUMARK_INDUSTRIES,                         "Numark Industries" },
1653         { RTP_MIDI_MANU_LONG_FRONTIER_DESIGN_GROUP_LLC,                 "Frontier Design Group LLC" },
1654         { RTP_MIDI_MANU_LONG_RECORDARE_LLC,                             "Recordare LLC" },
1655         { RTP_MIDI_MANU_LONG_STARR_LABS,                                "Starr Labs" },
1656         { RTP_MIDI_MANU_LONG_VOYAGER_SOUND_INC,                         "Voyager Sound Inc" },
1657         { RTP_MIDI_MANU_LONG_MANIFOLD_LABS,                             "Manifold Labs" },
1658         { RTP_MIDI_MANU_LONG_AVIOM_INC,                                 "Aviom Inc" },
1659         { RTP_MIDI_MANU_LONG_MIXMEISTER_TECHNOLOGY,                     "Mixmeister Technology" },
1660         { RTP_MIDI_MANU_LONG_NOTATION_SOFTWARE,                         "Notation Software" },
1661         { RTP_MIDI_MANU_LONG_MERCURIAL_COMMUNICATIONS,                  "Mercurial Communications" },
1662         { RTP_MIDI_MANU_LONG_WAVE_ARTS,                                 "Wave Arts" },
1663         { RTP_MIDI_MANU_LONG_LOGIC_SEQUENCING_DEVICES,                  "Logic Sequencing Devices" },
1664         { RTP_MIDI_MANU_LONG_AXESS_ELECTRONICS,                         "Axess Electronics" },
1665         { RTP_MIDI_MANU_LONG_MUSE_RESEARCH,                             "Muse Research" },
1666         { RTP_MIDI_MANU_LONG_OPEN_LABS,                                 "Open Labs" },
1667         { RTP_MIDI_MANU_LONG_GUILLEMOT_RD_INC,                          "Guillemot R&D Inc" },
1668         { RTP_MIDI_MANU_LONG_SAMSON_TECHNOLOGIES,                       "Samson Technologies" },
1669         { RTP_MIDI_MANU_LONG_ELECTRONIC_THEATRE_CONTROLS,               "Electronic Theatre Controls" },
1670         { RTP_MIDI_MANU_LONG_RESEARCH_IN_MOTION,                        "Research In Motion" },
1671         { RTP_MIDI_MANU_LONG_MOBILEER,                                  "Mobileer" },
1672         { RTP_MIDI_MANU_LONG_SYNTHOGY,                                  "Synthogy" },
1673         { RTP_MIDI_MANU_LONG_LYNX_STUDIO_TECHNOLOGY_INC,                "Lynx Studio Technology Inc" },
1674         { RTP_MIDI_MANU_LONG_DAMAGE_CONTROL_ENGINEERING,                "Damage Control Engineering LLC" },
1675         { RTP_MIDI_MANU_LONG_YOST_ENGINEERING_INC,                      "Yost Engineering Inc" },
1676         { RTP_MIDI_MANU_LONG_BROOKS_FORSMAN_DESIGNS_LLC,                "Brooks & Forsman Designs LLC" },
1677         { RTP_MIDI_MANU_LONG_MAGNEKEY,                                  "Magnekey" },
1678         { RTP_MIDI_MANU_LONG_GARRITAN_CORP,                             "Garritan Corp" },
1679         { RTP_MIDI_MANU_LONG_PLOQUE_ART_ET_TECHNOLOGIE,                 "Ploque Art et Technologie, Inc" },
1680         { RTP_MIDI_MANU_LONG_RJM_MUSIC_TECHNOLOGY,                      "RJM Music Technology" },
1681         { RTP_MIDI_MANU_LONG_CUSTOM_SOLUTIONS_SOFTWARE,                 "Custom Solutions Software" },
1682         { RTP_MIDI_MANU_LONG_SONARCANA_LLC,                             "Sonarcana LLC" },
1683         { RTP_MIDI_MANU_LONG_CENTRANCE,                                 "Centrance" },
1684         { RTP_MIDI_MANU_LONG_KESUMO_LLC,                                "Kesumo LLC" },
1685         { RTP_MIDI_MANU_LONG_STANTON,                                   "Stanton" },
1686         { RTP_MIDI_MANU_LONG_LIVID_INSTRUMENTS,                         "Livid Instruments" },
1687         { RTP_MIDI_MANU_LONG_FIRST_ACT_745_MEDIA,                       "First Act / 745 Media" },
1688         { RTP_MIDI_MANU_LONG_PYGRAPHICS_INC,                            "Pygraphics, Inc" },
1689         { RTP_MIDI_MANU_LONG_PANADIGM_INNOVATIONS_LTD,                  "Panadigm Innovations Ltd" },
1690         { RTP_MIDI_MANU_LONG_AVEDIS_ZILDJIAN_CO,                        "Avedis Zildjian Co" },
1691         { RTP_MIDI_MANU_LONG_AUVITAL_MUSIC_CORP,                        "Auvital Music Corp" },
1692         { RTP_MIDI_MANU_LONG_INSPIRED_INSTRUMENTS_INC,                  "Inspired Instruments Inc" },
1693         { RTP_MIDI_MANU_LONG_CHRIS_GRIGG_DESIGNS,                       "Chris Grigg Designs" },
1694         { RTP_MIDI_MANU_LONG_SLATE_DIGITAL_LLC,                         "Slate Digital LLC" },
1695         { RTP_MIDI_MANU_LONG_MIXWARE,                                   "Mixware" },
1696         { RTP_MIDI_MANU_LONG_SOCIAL_ENTROPY,                            "Social Entropy" },
1697         { RTP_MIDI_MANU_LONG_SOURCE_AUDIO_LLC,                          "Source Audio LLC" },
1698         { RTP_MIDI_MANU_LONG_RESERVED_016d,                             "reserved" },
1699         { RTP_MIDI_MANU_LONG_RESERVED_016e,                             "reserved" },
1700         { RTP_MIDI_MANU_LONG_RESERVED_016f,                             "reserved" },
1701         { RTP_MIDI_MANU_LONG_AMERICAN_AUDIO_DJ,                         "American Audio/DJ" },
1702         { RTP_MIDI_MANU_LONG_MEGA_CONTROL_SYSTEMS,                      "Mega Control Systems" },
1703         { RTP_MIDI_MANU_LONG_KILPATRICK_AUDIO,                          "Kilpatrick Audio" },
1704         { RTP_MIDI_MANU_LONG_IKINGDOM_CORP,                             "iKingdom Corp" },
1705         { RTP_MIDI_MANU_LONG_FRACTAL_AUDIO,                             "Fractal Audio" },
1706         { RTP_MIDI_MANU_LONG_NETLOGIC_MICROSYSTEMS,                     "NetLogic Microsystems" },
1707         { RTP_MIDI_MANU_LONG_MUSIC_COMPUTING,                           "Music Computing" },
1708         { RTP_MIDI_MANU_LONG_NEKTAR_TECHNOLOGY_INC,                     "Nektar Technology Inc" },
1709         { RTP_MIDI_MANU_LONG_ZENPH_SOUND_INNOVATIONS,                   "Zenph Sound Innovations" },
1710         { RTP_MIDI_MANU_LONG_DJTECHTOOLS_COM,                           "DJTechTools.com" },
1711         { RTP_MIDI_MANU_LONG_RESERVED_017a,                             "reserved" },
1712
1713         /* European Manufacturers */
1714         { RTP_MIDI_MANU_LONG_DREAM,                                     "Dream" },
1715         { RTP_MIDI_MANU_LONG_STRAND_LIGHTING,                           "Strand Lighting" },
1716         { RTP_MIDI_MANU_LONG_AMEK_SYSTEMS,                              "Amek Systems" },
1717         { RTP_MIDI_MANU_LONG_CASA_DI_RISPARMIO_DI_LORETO,               "Cas Di Risparmio Di Loreto" },
1718         { RTP_MIDI_MANU_LONG_BOHM_ELECTRONIC,                           "Bohm electronic" },
1719         { RTP_MIDI_MANU_LONG_SYNTEC_DIGITAL_AUDIO,                      "Syntec Digital Audio" },
1720         { RTP_MIDI_MANU_LONG_TRIDENT_AUDIO,                             "Trident Audio" },
1721         { RTP_MIDI_MANU_LONG_REAL_WORLD_STUDIO,                         "Real World Studio" },
1722         { RTP_MIDI_MANU_LONG_EVOLUTION_SYNTHESIS,                       "Evolution Synthesis" },
1723         { RTP_MIDI_MANU_LONG_YES_TECHNOLOGY,                            "Yes Technology" },
1724         { RTP_MIDI_MANU_LONG_AUDIOMATICA,                               "Audiomatica" },
1725         { RTP_MIDI_MANU_LONG_BONTEMPI_FARFISA,                          "Bontempi / Farfisa" },
1726         { RTP_MIDI_MANU_LONG_FBT_ELETTRONICA,                           "F.B.T. Elettronica" },
1727         { RTP_MIDI_MANU_LONG_MIDITEMP,                                  "Miditemp" },
1728         { RTP_MIDI_MANU_LONG_LA_AUDIO_LARKING_AUDIO,                    "LA Audio (Larking Audio)" },
1729         { RTP_MIDI_MANU_LONG_ZERO_88_LIGHTING_LIMITED,                  "Zero 88 Lighting Limited" },
1730         { RTP_MIDI_MANU_LONG_MICON_AUDIO_ELECTRONICS_GMBH,              "Micon Audio Electronics GmbH" },
1731         { RTP_MIDI_MANU_LONG_FOREFRONT_TECHNOLOGY,                      "Forefront Technology" },
1732         { RTP_MIDI_MANU_LONG_STUDIO_AUDIO_AND_VIDEO_LTD,                "Stduio Audio and Video Ltd" },
1733         { RTP_MIDI_MANU_LONG_KENTON_ELECTRONICS,                        "Kenton Electroncs" },
1734         { RTP_MIDI_MANU_LONG_CELCO_DIVISON_OF_ELECTRONICS,              "Celco Division of Electrosonic" },
1735         { RTP_MIDI_MANU_LONG_ADB,                                       "ADB" },
1736         { RTP_MIDI_MANU_LONG_MARSHALL_PRODUCTS,                         "Marshall Products" },
1737         { RTP_MIDI_MANU_LONG_DDA,                                       "DDA" },
1738         { RTP_MIDI_MANU_LONG_BBS,                                       "BSS" },
1739         { RTP_MIDI_MANU_LONG_MA_LIGHTING_TECHNOLOGY,                    "MA Lighting Technology" },
1740         { RTP_MIDI_MANU_LONG_FATAR,                                     "Fatar" },
1741         { RTP_MIDI_MANU_LONG_QSC_AUDIO,                                 "QSC Audio" },
1742         { RTP_MIDI_MANU_LONG_ARTISAN_CLASSIC_ORGAN,                     "Artisan Classic Organ" },
1743         { RTP_MIDI_MANU_LONG_ORLA_SPA,                                  "Rola Spa" },
1744         { RTP_MIDI_MANU_LONG_PINNACLE_AUDIO,                            "Pinnacle Audio" },
1745         { RTP_MIDI_MANU_LONG_TC_ELECTRONICS,                            "TC Electronics" },
1746         { RTP_MIDI_MANU_LONG_DOEPFER_MUSIKELEKTRONIK,                   "Doepfer Musikelektronik" },
1747         { RTP_MIDI_MANU_LONG_CREATIVE_TECHNOLOGY_PTE,                   "Creative Technology Pte" },
1748         { RTP_MIDI_MANU_LONG_MINAMI_SEIYDDO,                            "Minami / Seiyddo" },
1749         { RTP_MIDI_MANU_LONG_MIDISOFT_SAS_DI_M_CIMA,                    "Goldstar" },
1750         { RTP_MIDI_MANU_LONG_SAMICK,                                    "Samick" },
1751         { RTP_MIDI_MANU_LONG_PENNY_AND_GILES,                           "Penny and Giles" },
1752         { RTP_MIDI_MANU_LONG_ACORN_COMPUTER,                            "Acorn Computer" },
1753         { RTP_MIDI_MANU_LONG_LSC_ELECTRONICS,                           "LSC Electronics" },
1754         { RTP_MIDI_MANU_LONG_NOVATION_EMS,                              "Novation EMS" },
1755         { RTP_MIDI_MANU_LONG_SAMKYUNG_MECHATRONICS,                     "Samkyung Mechatronics" },
1756         { RTP_MIDI_MANU_LONG_MEDELI_ELECTRONICS_CO,                     "Medeli Electronics Co" },
1757         { RTP_MIDI_MANU_LONG_CHARLIE_LAB_SRL,                           "Charlie Lab SRL" },
1758         { RTP_MIDI_MANU_LONG_BLUE_CHIP_MUSIC_TECHNOLOGY,                "Blue Chip Music Technology" },
1759         { RTP_MIDI_MANU_LONG_BEE_OH_CORP,                               "BEE OH Corp" },
1760         { RTP_MIDI_MANU_LONG_LG_SEMICON_AMERICA,                        "LG Semicon America" },
1761         { RTP_MIDI_MANU_LONG_TESI,                                      "TESI" },
1762         { RTP_MIDI_MANU_LONG_EMAGIC,                                    "EMAGIC" },
1763         { RTP_MIDI_MANU_LONG_BEHRINGER_GMBH,                            "Behringer GmbH" },
1764         { RTP_MIDI_MANU_LONG_ACCESS_MUSIC_ELECTRONICS,                  "Access Music Electronics" },
1765         { RTP_MIDI_MANU_LONG_SYNOPTIC,                                  "Synoptic" },
1766         { RTP_MIDI_MANU_LONG_HANMESOFT_CORP,                            "Hanmesoft Corp" },
1767         { RTP_MIDI_MANU_LONG_TERRATEC_ELECTRONIC_GMBH,                  "Terratec Electronic GmbH" },
1768         { RTP_MIDI_MANU_LONG_PROEL_SPA,                                 "Proel SpA" },
1769         { RTP_MIDI_MANU_LONG_IBK_MIDI,                                  "IBK MIDI" },
1770         { RTP_MIDI_MANU_LONG_IRCAM,                                     "IRCAM" },
1771         { RTP_MIDI_MANU_LONG_PROPELLERHEAD_SOFTWARE,                    "Propellerhead Software" },
1772         { RTP_MIDI_MANU_LONG_RED_SOUND_SYSTEMS_LTD,                     "Red Sound Systems Ltd" },
1773         { RTP_MIDI_MANU_LONG_ELEKTRON_ESI_AB,                           "Elektron ESI AB" },
1774         { RTP_MIDI_MANU_LONG_SINTEFEX_AUDIO,                            "Sintefex Audio" },
1775         { RTP_MIDI_MANU_LONG_MAM_MUSIC_AND_MORE,                        "MAM (Music and More)" },
1776         { RTP_MIDI_MANU_LONG_AMSARO_GMBH,                               "Amsaro GmbH" },
1777         { RTP_MIDI_MANU_LONG_CDS_ADVANCED_TECHNOLOGY_BV,                "CDS Advanced Technology BV" },
1778         { RTP_MIDI_MANU_LONG_TOUCHED_BY_SOUND_GMBH,                     "Touched By Sound GmbH" },
1779         { RTP_MIDI_MANU_LONG_DSP_ARTS,                                  "DSP Arts" },
1780         { RTP_MIDI_MANU_LONG_PHIL_REES_MUSIC_TECH,                      "Phil Rees Music Tech" },
1781         { RTP_MIDI_MANU_LONG_STAMER_MUSIKANLAGEN_GMBH,                  "Stamer Musikanlagen GmbH" },
1782         { RTP_MIDI_MANU_LONG_MUSICAL_MUNTANER_SA_DBA,                   "Musical Muntaner S.A. dba Soundart" },
1783         { RTP_MIDI_MANU_LONG_CMEXX_SOFTWARE,                            "C-Mexx Software" },
1784         { RTP_MIDI_MANU_LONG_KLAVIS_TECHNOLOGIES,                       "Klavis Technologies" },
1785         { RTP_MIDI_MANU_LONG_NOTEHEADS_AB,                              "Noteheads AB" },
1786         { RTP_MIDI_MANU_LONG_ALGORITHMIX,                               "Algorithmix" },
1787         { RTP_MIDI_MANU_LONG_SKRYDSTRUP_RD,                             "Skrydstrup R&D" },
1788         { RTP_MIDI_MANU_LONG_PROFRESSIONAL_AUDIO_COMPANY,               "Professional Audio Company" },
1789         { RTP_MIDI_MANU_LONG_DBTECH_MADWAVES,                           "DBTECH/MadWaves" },
1790         { RTP_MIDI_MANU_LONG_VERMONA,                                   "Vermona" },
1791         { RTP_MIDI_MANU_LONG_NOKIA,                                     "Nokia" },
1792         { RTP_MIDI_MANU_LONG_WAVE_IDEA,                                 "Wave Idea" },
1793         { RTP_MIDI_MANU_LONG_HARTMANN_GMBH,                             "Hartmann GmbH" },
1794         { RTP_MIDI_MANU_LONG_LIONS_TRACK,                               "Lion's Track" },
1795         { RTP_MIDI_MANU_LONG_ANALOGUE_SYSTEMS,                          "Analogue Systems" },
1796         { RTP_MIDI_MANU_LONG_FOCAL_JMLAB,                               "Focal-JMlab" },
1797         { RTP_MIDI_MANU_LONG_RINGWAY_ELECTRONICS,                       "Ringway Electronics" },
1798         { RTP_MIDI_MANU_LONG_FAITH_TECHNOLOGIES_DIGIPLUG,               "Faith Technologies (Digiplug)" },
1799         { RTP_MIDI_MANU_LONG_SHOWWORKS,                                 "Showworks" },
1800         { RTP_MIDI_MANU_LONG_MANIKIN_ELECTRONIC,                        "Manikin Electronic" },
1801         { RTP_MIDI_MANU_LONG_1_COME_TECH,                               "1 Come Tech" },
1802         { RTP_MIDI_MANU_LONG_PHONIC_CORP,                               "Phonic Corp" },
1803         { RTP_MIDI_MANU_LONG_LAKE_TECHNOLOGY,                           "Lake Technology" },
1804         { RTP_MIDI_MANU_LONG_SILANSYS_TECHNOLOGIES,                     "Silansys Technologies" },
1805         { RTP_MIDI_MANU_LONG_WINBOND_ELECTRONICS,                       "Winbond Electronics" },
1806         { RTP_MIDI_MANU_LONG_CINETIX_MEDIEN_UND_INTERFACE,              "Cinetix Medien und Interface GmbH" },
1807         { RTP_MIDI_MANU_LONG_AG_SOLUTIONI_DIGITALI,                     "A&G Soluzioni Digitali" },
1808         { RTP_MIDI_MANU_LONG_SEQUENTIX_MUSIC_SYSTEMS,                   "Sequentix Music Systems" },
1809         { RTP_MIDI_MANU_LONG_ORAM_PRO_AUDIO,                            "Oram Pro Audio" },
1810         { RTP_MIDI_MANU_LONG_BE4_LTD,                                   "Be4 Ltd" },
1811         { RTP_MIDI_MANU_LONG_INFECTION_MUSIC,                           "Infection Music" },
1812         { RTP_MIDI_MANU_LONG_CENTRAL_MUSIC_CO_CME,                      "Central Music Co. (CME)" },
1813         { RTP_MIDI_MANU_LONG_GENOQS_MACHINES,                           "GenoQs Machines" },
1814         { RTP_MIDI_MANU_LONG_MEDIALON,                                  "Medialon" },
1815         { RTP_MIDI_MANU_LONG_WAVES_AUDIO_LTD,                           "Waves Audio Ltd" },
1816         { RTP_MIDI_MANU_LONG_JERASH_LABS,                               "Jerash Labs" },
1817         { RTP_MIDI_MANU_LONG_DA_FACT,                                   "Da Fact" },
1818         { RTP_MIDI_MANU_LONG_ELBY_DESIGNS,                              "Elby Designs" },
1819         { RTP_MIDI_MANU_LONG_SPECTRAL_AUDIO,                            "Spectral Audio" },
1820         { RTP_MIDI_MANU_LONG_ARTURIA,                                   "Arturia" },
1821         { RTP_MIDI_MANU_LONG_VIXID,                                     "Vixid" },
1822         { RTP_MIDI_MANU_LONG_C_THRU_MUSIC,                              "C-Thru Music" },
1823         { RTP_MIDI_MANU_LONG_YA_HORNG_ELECTRONIC_CO_LTD,                "Ya Horng Electronic Co LTD" },
1824         { RTP_MIDI_MANU_LONG_SM_PRO_AUDIO,                              "SM Pro Audio" },
1825         { RTP_MIDI_MANU_LONG_OTO_MACHINES,                              "OTO MACHINES" },
1826         { RTP_MIDI_MANU_LONG_ELZAB_SA_G_LAB,                            "ELZAB S.A., G LAB" },
1827         { RTP_MIDI_MANU_LONG_BLACKSTAR_AMPLIFICATION_LTD,               "Blackstar Amplification Ltd" },
1828         { RTP_MIDI_MANU_LONG_M3I_TECHNOLOGIES_GMBH,                     "M3i Technologies GmbH" },
1829         { RTP_MIDI_MANU_LONG_GEMALTO,                                   "Gemalto" },
1830         { RTP_MIDI_MANU_LONG_PROSTAGE_SL,                               "Prostage SL" },
1831         { RTP_MIDI_MANU_LONG_TEENAGE_ENGINEERING,                       "Teenage Engineering" },
1832         { RTP_MIDI_MANU_LONG_TOBIAS_ERICHSEN,                           "Tobias Erichsen" },
1833         { RTP_MIDI_MANU_LONG_NIXER_LTD,                                 "Nixer Ltd" },
1834         { RTP_MIDI_MANU_LONG_HANPIN_ELECTRON_CO_LTD,                    "Hanpin Electron Co Ltd" },
1835         { RTP_MIDI_MANU_LONG_MIDI_HARDWARE_R_SOWA,                      "MIDI-hardware R.Sowa" },
1836         { RTP_MIDI_MANU_LONG_BEYOND_MUSIC_INDUSTRIAL_LTD,               "Beyond Music Industrial Ltd" },
1837         { RTP_MIDI_MANU_LONG_KISS_BOX_BV,                               "Kiss Box B.V." },
1838         { RTP_MIDI_MANU_LONG_MISA_DIGITAL_TECHNOLOGIES_LTD,             "Misa Digital Technologies Ltd" },
1839         { RTP_MIDI_MANU_LONG_AI_MUSICS_TECHNOLOGY_INC,                  "AI Musics Technology Inc" },
1840         { RTP_MIDI_MANU_LONG_SERATO_INC_LP,                             "Serato Inc LP" },
1841         { RTP_MIDI_MANU_LONG_LIMEX_MUSIC_HANDLES_GMBH,                  "Limex Music Handles GmbH" },
1842         { RTP_MIDI_MANU_LONG_KYODDAY_TOKAI,                             "Kyodday/Tokai" },
1843         { RTP_MIDI_MANU_LONG_MUTABLE_INSTRUMENTS,                       "Mutable Instruments" },
1844         { RTP_MIDI_MANU_LONG_PRESONUS_SOFTWARE_LTD,                     "PreSonus Software Ltd" },
1845         { RTP_MIDI_MANU_LONG_XIRING,                                    "Xiring" },
1846         { RTP_MIDI_MANU_LONG_FAIRLIGHT_INTRUMENTS_PTY_LTD,              "Fairlight Instruments Pty Ltd" },
1847         { RTP_MIDI_MANU_LONG_MUSICOM_LAB,                               "Musicom Lab" },
1848         { RTP_MIDI_MANU_LONG_VACO_LOCO,                                 "VacoLoco" },
1849         { RTP_MIDI_MANU_LONG_RWA_HONG_KONG_LIMITED,                     "RWA (Hong Kong) Limited" },
1850
1851
1852         /* Japanese Manufacturers */
1853         { RTP_MIDI_MANU_LONG_CRIMSON_TECHNOLOGY_INC,                    "Crimson Technology Inc" },
1854         { RTP_MIDI_MANU_LONG_SOFTBANK_MOBILE_CORP,                      "Softbank Mobile Corp" },
1855         { RTP_MIDI_MANU_LONG_DM_HOLDINGS_INC,                           "D&M Holdings Inc." },
1856         { 0,                                                            NULL }
1857 };
1858
1859 static const value_string rtp_midi_channels[] = {
1860         { RTP_MIDI_CHANNEL_1,                                           "Channel 1" },
1861         { RTP_MIDI_CHANNEL_2,                                           "Channel 2" },
1862         { RTP_MIDI_CHANNEL_3,                                           "Channel 3" },
1863         { RTP_MIDI_CHANNEL_4,                                           "Channel 4" },
1864         { RTP_MIDI_CHANNEL_5,                                           "Channel 5" },
1865         { RTP_MIDI_CHANNEL_6,                                           "Channel 6" },
1866         { RTP_MIDI_CHANNEL_7,                                           "Channel 7" },
1867         { RTP_MIDI_CHANNEL_8,                                           "Channel 8" },
1868         { RTP_MIDI_CHANNEL_9,                                           "Channel 9" },
1869         { RTP_MIDI_CHANNEL_10,                                          "Channel 10" },
1870         { RTP_MIDI_CHANNEL_11,                                          "Channel 11" },
1871         { RTP_MIDI_CHANNEL_12,                                          "Channel 12" },
1872         { RTP_MIDI_CHANNEL_13,                                          "Channel 13" },
1873         { RTP_MIDI_CHANNEL_14,                                          "Channel 14" },
1874         { RTP_MIDI_CHANNEL_15,                                          "Channel 15" },
1875         { RTP_MIDI_CHANNEL_16,                                          "Channel 16" },
1876         { 0,                                                            NULL }
1877 };
1878
1879
1880
1881 static const char rtp_midi_channel_status_special_off[] =               "Note Off*";
1882 static const char rtp_midi_common_status_sysex_segment_end[] =          "End of Sysex-Segment";
1883 static const char rtp_midi_common_status_sysex_segment_start[] =        "Start of Sysex-Segment";
1884 static const char rtp_midi_common_status_sysex_segment[] =              "Middle Sysex-Segment";
1885 static const char rtp_midi_common_status_sysex_segment_complete[] =     "Full Sysex-Command";
1886 static const char rtp_midi_common_status_sysex_cancel[] =               "Sysex-Cancel";
1887
1888 static const value_string rtp_midi_channel_status[] = {
1889         /* Channel */
1890         { RTP_MIDI_STATUS_CHANNEL_NOTE_OFF,                             "Note Off" },
1891         { RTP_MIDI_STATUS_CHANNEL_NOTE_ON,                              "Note On" },
1892         { RTP_MIDI_STATUS_CHANNEL_POLYPHONIC_KEY_PRESSURE,              "Polyphonic Key Pressure" },
1893         { RTP_MIDI_STATUS_CHANNEL_CONTROL_CHANGE,                       "Control Change" },
1894         { RTP_MIDI_STATUS_CHANNEL_PROGRAM_CHANGE,                       "Program Change" },
1895         { RTP_MIDI_STATUS_CHANNEL_CHANNEL_PRESSURE,                     "Channel Pressure" },
1896         { RTP_MIDI_STATUS_CHANNEL_PITCH_BEND_CHANGE,                    "Pitch Bend Change" },
1897         { 0,                                                            NULL }
1898 };
1899
1900 static const value_string rtp_midi_common_status[] = {
1901         /* Common 0xf0 - 0xf7 */
1902         { RTP_MIDI_STATUS_COMMON_SYSEX_START,                           "SOX: Start Of System-Exclusive / End of System-Exclusive Segment" },
1903         { RTP_MIDI_STATUS_COMMON_MTC_QUARTER_FRAME,                     "MTC Quarter Frame" },
1904         { RTP_MIDI_STATUS_COMMON_SONG_POSITION_POINTER,                 "Song Position Pointer" },
1905         { RTP_MIDI_STATUS_COMMON_SONG_SELECT,                           "Song Select" },
1906         { RTP_MIDI_STATUS_COMMON_UNDEFINED_F4,                          "Systems Exclusive Cancel" },                   /* not defined, special use in RTP-MIDI */
1907         { RTP_MIDI_STATUS_COMMON_UNDEFINED_F5,                          "Undefined 0xf5" },                     /* not defined */
1908         { RTP_MIDI_STATUS_COMMON_TUNE_REQUEST,                          "Tune Request" },
1909         { RTP_MIDI_STATUS_COMMON_SYSEX_END,                             "EOX: Start of System-Exclusive Segment / End of System-Exclusive" },
1910         /* Realtime 0xf8 - 0xff */
1911         { RTP_MIDI_STATUS_COMMON_REALTIME_TIMING_CLOCK,                 "RT: Timing Clock" },
1912         { RTP_MIDI_STATUS_COMMON_REALTIME_MIDI_TICK,                    "RT: Midi Tick" },                      /* undefined ??? */
1913         { RTP_MIDI_STATUS_COMMON_REALTIME_START,                        "RT: Start" },
1914         { RTP_MIDI_STATUS_COMMON_REALTIME_CONTINUE,                     "RT: Continue" },
1915         { RTP_MIDI_STATUS_COMMON_REALTIME_STOP,                         "RT: Stop" },
1916         { RTP_MIDI_STATUS_COMMON_REALTIME_UNDEFINED_FD,                 "RT: Undefined 0xfd" },
1917         { RTP_MIDI_STATUS_COMMON_REALTIME_ACTIVE_SENSING,               "RT: Active sensing" },
1918         { RTP_MIDI_STATUS_COMMON_REALTIME_SYSTEM_RESET,                 "RT: Systems reset" },
1919         { 0,                                                            NULL }
1920 };
1921
1922 static const value_string rtp_midi_sysex_common_rt_mtc_cue[] = {
1923         { RTP_MIDI_SYSEX_COMMON_RT_MTC_CUE_SPECIAL,                     "Special" },
1924         { RTP_MIDI_SYSEX_COMMON_RT_MTC_CUE_PUNCH_IN_POINTS,             "Punch In Points" },
1925         { RTP_MIDI_SYSEX_COMMON_RT_MTC_CUE_PUNCH_OUT_POINTS,            "Punch Out Points" },
1926         { RTP_MIDI_SYSEX_COMMON_RT_MTC_CUE_RESERVED_03,                 "(Reserved 0x03)" },
1927         { RTP_MIDI_SYSEX_COMMON_RT_MTC_CUE_RESERVED_04,                 "(Reserved 0x04)" },
1928         { RTP_MIDI_SYSEX_COMMON_RT_MTC_CUE_EVENT_START_POINTS,          "Event Start Points" },
1929         { RTP_MIDI_SYSEX_COMMON_RT_MTC_CUE_EVENT_STOP_POINTS,           "Event Stop Points" },
1930         { RTP_MIDI_SYSEX_COMMON_RT_MTC_CUE_EVENT_START_POINTS_ADD,      "Event Start Points with additional Info" },
1931         { RTP_MIDI_SYSEX_COMMON_RT_MTC_CUE_EVENT_STOP_POINTS_ADD,       "Event Stop Points with additional Info" },
1932         { RTP_MIDI_SYSEX_COMMON_RT_MTC_CUE_RESERVED_09,                 "(Reserved 0x09)" },
1933         { RTP_MIDI_SYSEX_COMMON_RT_MTC_CUE_RESERVED_0A,                 "(Reserved 0x0a)" },
1934         { RTP_MIDI_SYSEX_COMMON_RT_MTC_CUE_CUE_POINTS,                  "Cue Points" },
1935         { RTP_MIDI_SYSEX_COMMON_RT_MTC_CUE_CUE_POINTS_ADD,              "Cue Points with additional Info" },
1936         { RTP_MIDI_SYSEX_COMMON_RT_MTC_CUE_RESERVED_0D,                 "(Reserved 0x0d)" },
1937         { RTP_MIDI_SYSEX_COMMON_RT_MTC_CUE_EVENT_NAME_ADD,              "Event Name in additional Info" },
1938         { 0,                                                            NULL }
1939 };
1940
1941
1942 static const value_string rtp_midi_sysex_common_nrt_mtc[] = {
1943         { RTP_MIDI_SYSEX_COMMON_NRT_MTC_SPECIAL,                        "Special" },
1944         { RTP_MIDI_SYSEX_COMMON_NRT_MTC_PUNCH_IN_POINTS,                "Punch In Points" },
1945         { RTP_MIDI_SYSEX_COMMON_NRT_MTC_PUNGH_OUT_POINTS,               "Punch Out Points" },
1946         { RTP_MIDI_SYSEX_COMMON_NRT_MTC_DELETE_PUNCH_IN_POINTS,         "Delete Punch In Points" },
1947         { RTP_MIDI_SYSEX_COMMON_NRT_MTC_DELETE_PUNCH_OUT_POINTS,        "Delete Punch Out Points" },
1948         { RTP_MIDI_SYSEX_COMMON_NRT_MTC_EVENT_START_POINT,              "Event Start Point" },
1949         { RTP_MIDI_SYSEX_COMMON_NRT_MTC_EVENT_STOP_POINT,               "Event Stop Point" },
1950         { RTP_MIDI_SYSEX_COMMON_NRT_MTC_EVENT_START_POINT_ADD,          "Event Start Point with additional Info" },
1951         { RTP_MIDI_SYSEX_COMMON_NRT_MTC_EVENT_STOP_POINT_ADD,           "Event Stop Point with additional Info" },
1952         { RTP_MIDI_SYSEX_COMMON_NRT_MTC_DELETE_EVENT_START_POINT,       "Delete Event Start Point" },
1953         { RTP_MIDI_SYSEX_COMMON_NRT_MTC_DELETE_EVENT_STOP_POINT,        "Delete Event Stop Point" },
1954         { RTP_MIDI_SYSEX_COMMON_NRT_MTC_CUE_POINTS,                     "Cue Points" },
1955         { RTP_MIDI_SYSEX_COMMON_NRT_MTC_CUE_POINTS_ADD,                 "Cue Points with additional Info" },
1956         { RTP_MIDI_SYSEX_COMMON_NRT_MTC_DELETE_CUE_POINT,               "Delete Cue Point" },
1957         { RTP_MIDI_SYSEX_COMMON_NRT_MTC_EVENT_NAME_IN_ADD,              "Event Name in additional Info" },
1958         { 0,                                                            NULL }
1959 };
1960
1961 static const value_string rtp_midi_sysex_common_nrt_sd_ext[] = {
1962         { RTP_MIDI_SYSEX_COMMON_NRT_SD_EXT_LOOP_POINT_TRANSMISSION,     "Loop Point Transmission" },
1963         { RTP_MIDI_SYSEX_COMMON_NRT_SD_EXT_LOOP_POINTS_REQUEST,         "Loop Points Request" },
1964         { 0,                                                            NULL }
1965 };
1966
1967 static const value_string rtp_midi_sysex_common_nrt_sd_lt[] = {
1968         { RTP_MIDI_SYSEX_COMMON_NRT_SD_EXT_LP_UNI,                      "Forwards only (unidirectional)" },
1969         { RTP_MIDI_SYSEX_COMMON_NRT_SD_EXT_LP_BI,                       "Backwards/Forwards (bi-directional)" },
1970         { RTP_MIDI_SYSEX_COMMON_NRT_SD_EXT_LP_OFF,                      "Off" },
1971         { 0,                                                            NULL }
1972 };
1973
1974 static const value_string rtp_midi_sysex_common_nrt_gi[] = {
1975         { RTP_MIDI_SYSEX_COMMON_NRT_GI_IDENTITY_REQUEST,                "Identity Request" },
1976         { RTP_MIDI_SYSEX_COMMON_NRT_GI_IDENTITY_REPLY,                  "Identity Reply" },
1977         { 0,                                                            NULL }
1978 };
1979
1980 static const value_string rtp_midi_sysex_common_nrt_fd[] = {
1981         { RTP_MIDI_SYSEX_COMMON_NRT_FD_HEADER,                          "Header" },
1982         { RTP_MIDI_SYSEX_COMMON_NRT_FD_DATA_PACKET,                     "Data Packet" },
1983         { RTP_MIDI_SYSEX_COMMON_NRT_FD_REQUEST,                         "Request" },
1984         { 0,                                                            NULL }
1985 };
1986
1987 static const value_string rtp_midi_sysex_common_tuning[] = {
1988         { RTP_MIDI_SYSEX_COMMON_TUNING_BULK_DUMP_REQUEST,               "Bulk Dump Request" },
1989         { RTP_MIDI_SYSEX_COMMON_TUNING_BULK_DUMP_REPLY,                 "Bulk Dump Reply" },
1990         { RTP_MIDI_SYSEX_COMMON_TUNING_NOTE_CHANGE,                     "Note Change" },
1991         { 0,                                                            NULL }
1992 };
1993
1994 static const value_string rtp_midi_sysex_common_nrt_gm[] = {
1995         { RTP_MIDI_SYSEX_COMMON_NRT_GM_ON,                              "General MIDI System On" },
1996         { RTP_MIDI_SYSEX_COMMON_NRT_GM_OFF,                             "General MIDI System Off" },
1997         { 0,                                                            NULL }
1998 };
1999
2000 static const value_string rtp_midi_sysex_common_nrt_dls[] = {
2001         { RTP_MIDI_SYSEX_COMMON_NRT_DLS_LEVEL1_ON,                      "DLS Level 1 On" },
2002         { RTP_MIDI_SYSEX_COMMON_NRT_DLS_LEVEL1_OFF,                     "DLS Level 1 Off" },
2003         { RTP_MIDI_SYSEX_COMMON_NRT_DLS_LEVEL1_VOICE_ALLOCATION_OFF,    "DLS Level 1 Voice Allocation Off" },
2004         { RTP_MIDI_SYSEX_COMMON_NRT_DLS_LEVEL1_VOICE_ALLOCATION_ON,     "DLS Level 1 Voice Allocation On" },
2005         { 0,                                                            NULL }
2006 };
2007
2008
2009 static const value_string rtp_midi_sysex_common_rt_mtc[] = {
2010         { RTP_MIDI_SYSEX_COMMON_RT_MTC_FULL_MESSAGE,                    "Full Message" },
2011         { RTP_MIDI_SYSEX_COMMON_RT_MTC_USER_BITS,                       "User Bits" },
2012         { 0,                                                            NULL }
2013 };
2014
2015 static const value_string rtp_midi_sysex_common_rt_show_control[] = {
2016         { RTP_MIDI_SYSEX_COMMON_RT_SCL_EXTENSIONS,                      "Extensions" },
2017         { RTP_MIDI_SYSEX_COMMON_RT_SC_LIGHTING,                         "Lighting (General Category)" },
2018         { RTP_MIDI_SYSEX_COMMON_RT_SC_MOVING_LIGHTS,                    "Moving Lights" },
2019         { RTP_MIDI_SYSEX_COMMON_RT_SC_COLOR_CHANGERS,                   "Color Changers" },
2020         { RTP_MIDI_SYSEX_COMMON_RT_SC_STROBES,                          "Strobes" },
2021         { RTP_MIDI_SYSEX_COMMON_RT_SCL_LASERS,                          "Lasers" },
2022         { RTP_MIDI_SYSEX_COMMON_RT_SCL_CHASERS,                         "Chasers" },
2023         { RTP_MIDI_SYSEX_COMMON_RT_SC_SOUND,                            "Sound (General Category)" },
2024         { RTP_MIDI_SYSEX_COMMON_RT_SC_MUSIC,                            "Music" },
2025         { RTP_MIDI_SYSEX_COMMON_RT_SC_CD_PLAYERS,                       "CD Players" },
2026         { RTP_MIDI_SYSEX_COMMON_RT_SC_EPROM_PLAYBACK,                   "EPROM Playback" },
2027         { RTP_MIDI_SYSEX_COMMON_RT_SCL_AUDIO_TAPE_MACHINE,              "Audio Tape Machine" },
2028         { RTP_MIDI_SYSEX_COMMON_RT_SC_INTERCOMS,                        "Intercoms" },
2029         { RTP_MIDI_SYSEX_COMMON_RT_SC_AMPLIFIERS,                       "Amplifiers" },
2030         { RTP_MIDI_SYSEX_COMMON_RT_SC_AUDIO_EFFECTS,                    "Audio Effects Devices" },
2031         { RTP_MIDI_SYSEX_COMMON_RT_SC_EQUALIZERS,                       "Equalizers" },
2032         { RTP_MIDI_SYSEX_COMMON_RT_SC_MACHINERY,                        "Machinery (General Category" },
2033         { RTP_MIDI_SYSEX_COMMON_RT_SC_RIGGING,                          "Rigging" },
2034         { RTP_MIDI_SYSEX_COMMON_RT_SC_FLYS,                             "Flys" },
2035         { RTP_MIDI_SYSEX_COMMON_RT_SC_LIFTS,                            "Lifts" },
2036         { RTP_MIDI_SYSEX_COMMON_RT_SC_TURNTABLES,                       "Turntables" },
2037         { RTP_MIDI_SYSEX_COMMON_RT_SC_TRUSSES,                          "Trusses" },
2038         { RTP_MIDI_SYSEX_COMMON_RT_SC_ROBOTS,                           "Robots" },
2039         { RTP_MIDI_SYSEX_COMMON_RT_SC_ANIMATION,                        "Animation" },
2040         { RTP_MIDI_SYSEX_COMMON_RT_SC_FLOATS,                           "Floats" },
2041         { RTP_MIDI_SYSEX_COMMON_RT_SC_BREAKAWAYS,                       "Breakaways" },
2042         { RTP_MIDI_SYSEX_COMMON_RT_SC_BARGES,                           "Barges" },
2043         { RTP_MIDI_SYSEX_COMMON_RT_SC_VIDEO,                            "Video (General Category" },
2044         { RTP_MIDI_SYSEX_COMMON_RT_SC_VIDEO_TAPE_MACHINES,              "Video Tape Machines" },
2045         { RTP_MIDI_SYSEX_COMMON_RT_SC_VIDEO_CASSETTE_MACHINES,          "Video Cassette Machines" },
2046         { RTP_MIDI_SYSEX_COMMON_RT_SC_VIDEO_DISC_PLAYERS,               "Video Disc Players" },
2047         { RTP_MIDI_SYSEX_COMMON_RT_SC_VIDEO_SWITCHERS,                  "Video Switchers" },
2048         { RTP_MIDI_SYSEX_COMMON_RT_SC_VIDEO_EFFECT,                     "Video Effects" },
2049         { RTP_MIDI_SYSEX_COMMON_RT_SC_VIDEO_CHARACTER_GENERATORS,       "Video Character Generators" },
2050         { RTP_MIDI_SYSEX_COMMON_RT_SC_VIDEO_STIL_STORES,                "Video Still Stores" },
2051         { RTP_MIDI_SYSEX_COMMON_RT_SC_VIDEO_MONITORS,                   "Video Monitors" },
2052         { RTP_MIDI_SYSEX_COMMON_RT_SC_PROJECTION,                       "Projections (General)" },
2053         { RTP_MIDI_SYSEX_COMMON_RT_SC_FILM_PROJECTORS,                  "Film Projectors" },
2054         { RTP_MIDI_SYSEX_COMMON_RT_SC_SLIDE_PROJECTORS,                 "Slide Projectors" },
2055         { RTP_MIDI_SYSEX_COMMON_RT_SC_VIDEO_PROJECTORS,                 "Video Projectors" },
2056         { RTP_MIDI_SYSEX_COMMON_RT_SC_DISSOLVERS,                       "Dissolvers" },
2057         { RTP_MIDI_SYSEX_COMMON_RT_SC_SHUTTER_CONTROLS,                 "Shutter Controls" },
2058         { RTP_MIDI_SYSEX_COMMON_RT_SC_PROCESS_CONTROL,                  "Process Control (General)" },
2059         { RTP_MIDI_SYSEX_COMMON_RT_SC_HYDRAULIC_OIL,                    "Hydraulic Oil" },
2060         { RTP_MIDI_SYSEX_COMMON_RT_SC_H2O,                              "H2O" },
2061         { RTP_MIDI_SYSEX_COMMON_RT_SC_CO2,                              "CO2" },
2062         { RTP_MIDI_SYSEX_COMMON_RT_SC_COMPRESSED_AIR,                   "Compressed Air" },
2063         { RTP_MIDI_SYSEX_COMMON_RT_SC_NATURAL_GAS,                      "Natural Gas" },
2064         { RTP_MIDI_SYSEX_COMMON_RT_SC_FOG,                              "Fog" },
2065         { RTP_MIDI_SYSEX_COMMON_RT_SC_SMOKE,                            "Smoke" },
2066         { RTP_MIDI_SYSEX_COMMON_RT_SC_CRACKED_HAZE,                     "Cracked Haze" },
2067         { RTP_MIDI_SYSEX_COMMON_RT_SC_PYRO,                             "Pyro (General Category)" },
2068         { RTP_MIDI_SYSEX_COMMON_RT_SC_FIREWORKS,                        "Fireworks" },
2069         { RTP_MIDI_SYSEX_COMMON_RT_SC_EXPLOSIONS,                       "Explosions" },
2070         { RTP_MIDI_SYSEX_COMMON_RT_SC_FLAME,                            "Flame" },
2071         { RTP_MIDI_SYSEX_COMMON_RT_SC_SMOKE_POTS,                       "Smoke Pots" },
2072         { RTP_MIDI_SYSEX_COMMON_RT_SC_ALL_TYPES,                        "All Types" },
2073         { 0,                                                            NULL }
2074 };
2075
2076 static const value_string rtp_midi_sysex_common_rt_notations[] = {
2077         { RTP_MIDI_SYSEX_COMMON_RT_NT_BAR_NUMBER,                       "Bar Number" },
2078         { RTP_MIDI_SYSEX_COMMON_RT_NT_TIME_SIGNATURE_IMMEDIATE,         "Time Signature (Immediate)" },
2079         { RTP_MIDI_SYSEX_COMMON_RT_NT_TIME_SIGNATURE_DELAYED,           "Time Signature (Delayed)" },
2080         { 0,                                                            NULL }
2081 };
2082
2083 static const value_string rtp_midi_sysex_common_rt_device_control[] = {
2084         { RTP_MIDI_SYSEX_COMMON_RT_DC_MASTER_VOLUME,                    "Master Volume" },
2085         { RTP_MIDI_SYSEX_COMMON_RT_DC_MASTER_BALANCE,                   "Master Balance" },
2086         { 0,                                                            NULL }
2087 };
2088
2089
2090 /* TODO: Add MMC Commands */
2091 static const value_string rtp_midi_sysex_common_rt_mmc_commands[] = {
2092         { 0,                                                            NULL }
2093 };
2094
2095 /* TODO: Add MMC Responses */
2096 static const value_string rtp_midi_sysex_common_rt_mmc_responses[] = {
2097         { 0,                                                            NULL }
2098 };
2099
2100
2101
2102 static const value_string rtp_midi_sysex_common_nrt[] = {
2103         { RTP_MIDI_SYSEX_COMMON_NRT_SAMPLE_DUMP_HEADER,                 "Common NRT: Sample Dump Header" },
2104         { RTP_MIDI_SYSEX_COMMON_NRT_SAMPLE_DATA_PACKET,                 "Common NRT: Sample Data Packet" },
2105         { RTP_MIDI_SYSEX_COMMON_NRT_SAMPLE_DUMP_REQUEST,                "Common NRT: Sample Dump Request" },
2106         { RTP_MIDI_SYSEX_COMMON_NRT_MTC,                                "Common NRT: MIDI Time Code (MTC)" },
2107         { RTP_MIDI_SYSEX_COMMON_NRT_SAMPLE_DUMP_EXTENSIONS,             "Common NRT: Sample Dump Extensions" },
2108         { RTP_MIDI_SYSEX_COMMON_NRT_GENERAL_INFORMATION,                "Common NRT: General Information" },
2109         { RTP_MIDI_SYSEX_COMMON_NRT_FILE_DUMP,                          "Common NRT: File Dump" },
2110         { RTP_MIDI_SYSEX_COMMON_NRT_MIDI_TUNING_STANDARD,               "Common NRT: Midi Tuning Standard" },
2111         { RTP_MIDI_SYSEX_COMMON_NRT_GENERAL_MIDI,                       "Common NRT: General MIDI (GM)" },
2112         { RTP_MIDI_SYSEX_COMMON_NRT_DOWNLOADABLE_SOUNDS,                "Common NRT: Downloadable Sounds (DLS)" },
2113         { RTP_MIDI_SYSEX_COMMON_NRT_END_OF_FILE,                        "Common NRT: End Of File" },
2114         { RTP_MIDI_SYSEX_COMMON_NRT_WAIT,                               "Common NRT: Wait" },
2115         { RTP_MIDI_SYSEX_COMMON_NRT_CANCEL,                             "Common NRT: Cancel" },
2116         { RTP_MIDI_SYSEX_COMMON_NRT_NAK,                                "Common NRT: NAK" },
2117         { RTP_MIDI_SYSEX_COMMON_NRT_ACK,                                "Common NRT: ACK" },
2118         { 0,                                                            NULL }
2119 };
2120
2121
2122 static const value_string rtp_midi_sysex_common_rt[] = {
2123         { RTP_MIDI_SYSEX_COMMON_RT_MIDI_TIME_CODE,                      "Common RT: MIDI Time Code (MTC)" },
2124         { RTP_MIDI_SYSEX_COMMON_RT_MIDI_SHOW_CONTROL,                   "Common RT: MIDI Show Control" },
2125         { RTP_MIDI_SYSEX_COMMON_RT_NOTATION_INFORMATION,                "Common RT: Notation Information" },
2126         { RTP_MIDI_SYSEX_COMMON_RT_DEVICE_CONTROL,                      "Common RT: Device Control" },
2127         { RTP_MIDI_SYSEX_COMMON_RT_MTC_CUEING,                          "Common RT: Real Time MTC Cueing" },
2128         { RTP_MIDI_SYSEX_COMMON_RT_MIDI_MACHINE_CONTROL_COMMAND,        "Common RT: MIDI Machine Control Command" },
2129         { RTP_MIDI_SYSEX_COMMON_RT_MIDI_MACHINE_CONTROL_RESPONSE,       "Common RT: MIDI Machine Control Response" },
2130         { RTP_MIDI_SYSEX_COMMON_RT_MIDI_TUNING_STANDARD,                "Common RT: MIDI Tuning Standard" },
2131         { 0,                                                            NULL }
2132 };
2133
2134
2135
2136 static const value_string rtp_midi_js_tot_channels[] = {
2137         { 0,                                                            "1 channel" },
2138         { 1,                                                            "2 channels" },
2139         { 2,                                                            "3 channels" },
2140         { 3,                                                            "4 channels" },
2141         { 4,                                                            "5 channels" },
2142         { 5,                                                            "6 channels" },
2143         { 6,                                                            "7 channels" },
2144         { 7,                                                            "8 channels" },
2145         { 8,                                                            "9 channels" },
2146         { 9,                                                            "10 channels" },
2147         { 10,                                                           "11 channels" },
2148         { 11,                                                           "12 channels" },
2149         { 12,                                                           "13 channels" },
2150         { 13,                                                           "14 channels" },
2151         { 14,                                                           "15 channels" },
2152         { 15,                                                           "16 channels" },
2153         { 0,                                                            NULL }
2154 };
2155
2156 static const value_string rtp_midi_qft_values[] = {
2157         { RTP_MIDI_COMMON_MTC_QF_FRAME_LS_NIBBLE,                       "Frame count LS nibble" },
2158         { RTP_MIDI_COMMON_MTC_QF_FRAME_MS_NIBBLE,                       "Frame count MS nibble" },
2159         { RTP_MIDI_COMMON_MTC_QF_SECONDS_LS_NIBBLE,                     "Seconds count LS nibble" },
2160         { RTP_MIDI_COMMON_MTC_QF_SECONDS_MS_NIBBLE,                     "Seconds count MS nibble" },
2161         { RTP_MIDI_COMMON_MTC_QF_MINUTES_LS_NIBBLE,                     "Minutes count LS nibble" },
2162         { RTP_MIDI_COMMON_MTC_QF_MINUTES_MS_NIBBLE,                     "Minutes count MS nibble" },
2163         { RTP_MIDI_COMMON_MTC_QF_HOURS_LS_NIBBLE,                       "Hours count LS nibble" },
2164         { RTP_MIDI_COMMON_MTC_QF_HOURS_MS_NIBBLE,                       "Hours count MS nibble" },
2165         { 0,                                                            NULL }
2166 };
2167
2168 static const value_string rtp_midi_sj_chapter_d_syscom_dsz_values[] = {
2169         { 0,                                                            "Command has 0 octets" },
2170         { 1,                                                            "Command has 1 octet" },
2171         { 2,                                                            "Command has 2 octets" },
2172         { 3,                                                            "Command has 3 or more octets" },
2173         { 0,                                                            NULL }
2174 };
2175
2176 static const value_string rtp_midi_mtc_fm_type_values[] = {
2177         { 0,                                                            "24 Frames/Second" },
2178         { 1,                                                            "25 Frames/Second" },
2179         { 2,                                                            "30 Frames/Second (drop frame)" },
2180         { 3,                                                            "30 Frames/Second (non-drop frame)" },
2181         { 0,                                                            NULL }
2182 };
2183
2184 static const true_false_string rtp_midi_cs_flag_b= {
2185         "Long Header: 2 octets",
2186         "Short Header: 1 octet"
2187 };
2188
2189 static const true_false_string rtp_midi_cs_flag_j= {
2190         "Journal present",
2191         "No Journal present"
2192 };
2193
2194 static const true_false_string rtp_midi_cs_flag_z= {
2195         "Delta-Time present for first MIDI-command",
2196         "No Delta-Time for first MIDI-command"
2197 };
2198
2199 static const true_false_string rtp_midi_cs_flag_p= {
2200         "Status byte was NOT present in original MIDI-command",
2201         "Status byte was present in original MIDI-command"
2202 };
2203
2204 static const true_false_string rtp_midi_js_flag_y = {
2205         "System-jounral present",
2206         "System-journal NOT present"
2207 };
2208
2209 static const true_false_string rtp_midi_js_flag_s = {
2210         "Standard journal behaviour",
2211         "Journal encodes data in preceding RTP-packet"
2212 };
2213
2214 static const true_false_string rtp_midi_js_flag_a = {
2215         "Channel-journal present",
2216         "Channel-journal NOT present"
2217 };
2218
2219 static const true_false_string rtp_midi_js_flag_h = {
2220         "Enhanced Encoding",
2221         "Standard Encoding"
2222 };
2223
2224 static const true_false_string rtp_midi_sj_flag_d = {
2225         "Chapter D journal present",
2226         "Chapter D journal NOT present"
2227 };
2228
2229 static const true_false_string rtp_midi_sj_flag_v = {
2230         "Chapter V journal present",
2231         "Chapter V journal NOT present"
2232 };
2233
2234 static const true_false_string rtp_midi_sj_flag_q = {
2235         "Chapter Q journal present",
2236         "Chapter Q journal NOT present"
2237 };
2238
2239 static const true_false_string rtp_midi_sj_flag_f = {
2240         "Chapter F journal present",
2241         "Chapter F journal NOT present"
2242 };
2243
2244 static const true_false_string rtp_midi_sj_flag_x = {
2245         "Chapter X journal present",
2246         "Chapter X journal NOT present"
2247 };
2248
2249 static const true_false_string rtp_midi_cj_flag_p = {
2250         "Chapter P journal present",
2251         "Chapter P journal NOT present"
2252 };
2253
2254 static const true_false_string rtp_midi_cj_flag_c = {
2255         "Chapter C journal present",
2256         "Chapter C journal NOT present"
2257 };
2258
2259 static const true_false_string rtp_midi_cj_flag_m = {
2260         "Chapter M journal present",
2261         "Chapter M journal NOT present"
2262 };
2263
2264 static const true_false_string rtp_midi_cj_flag_w = {
2265         "Chapter W journal present",
2266         "Chapter W journal NOT present"
2267 };
2268
2269 static const true_false_string rtp_midi_cj_flag_n = {
2270         "Chapter N journal present",
2271         "Chapter N journal NOT present"
2272 };
2273
2274 static const true_false_string rtp_midi_cj_flag_e = {
2275         "Chapter E journal present",
2276         "Chapter E journal NOT present"
2277 };
2278
2279 static const true_false_string rtp_midi_cj_flag_t = {
2280         "Chapter T journal present",
2281         "Chapter T journal NOT present"
2282 };
2283
2284 static const true_false_string rtp_midi_cj_flag_a = {
2285         "Chapter A journal present",
2286         "Chapter A journal NOT present"
2287 };
2288
2289 static const true_false_string rtp_midi_cj_chapter_c_flag_a = {
2290         "Alternative Coding",
2291         "Value Coding"
2292 };
2293
2294 static const true_false_string rtp_midi_cj_chapter_m_flag_p = {
2295         "Pending field is encoded",
2296         "Pending field is NOT encoded"
2297 };
2298
2299 static const true_false_string rtp_midi_cj_chapter_m_flag_e = {
2300         "Initiated transaction is in progress",
2301         "NO transaction in progress"
2302 };
2303
2304 static const true_false_string rtp_midi_cj_chapter_m_flag_u = {
2305         "All parameters are RPNs",
2306         "Parameters may include NRPNs"
2307 };
2308
2309 static const true_false_string rtp_midi_cj_chapter_m_flag_w = {
2310         "All parameters are NRPNs",
2311         "Parameters may include RPNs"
2312 };
2313
2314 static const true_false_string rtp_midi_cj_chapter_m_flag_z = {
2315         "Only LSB parameters",
2316         "Parameters may have LSB & MSB"
2317 };
2318
2319 static const true_false_string rtp_midi_cj_chapter_m_flag_q = {
2320         "Pending encodes NRPN MSB",
2321         "Pending encodes RPN MSB"
2322 };
2323
2324 static const true_false_string rtp_midi_cj_chapter_m_log_flag_q = {
2325         "NRPN parameter encoded",
2326         "RPN parameter encoded"
2327 };
2328
2329 static const true_false_string rtp_midi_cj_chapter_m_log_flag_j = {
2330         "ENTRY-MSB field present",
2331         "ENTRY-MSB field NOT present"
2332 };
2333
2334 static const true_false_string rtp_midi_cj_chapter_m_log_flag_k = {
2335         "ENTRY-LSB field present",
2336         "ENTRY-LSB field NOT present"
2337 };
2338
2339 static const true_false_string rtp_midi_cj_chapter_m_log_flag_l = {
2340         "A-Button field present",
2341         "A-Button field NOT present"
2342 };
2343
2344 static const true_false_string rtp_midi_cj_chapter_m_log_flag_m = {
2345         "C-Button field present",
2346         "C-Button field NOT present"
2347 };
2348
2349 static const true_false_string rtp_midi_cj_chapter_m_log_flag_n = {
2350         "Count field present",
2351         "Count field NOT present"
2352 };
2353
2354 static const true_false_string rtp_midi_cj_chapter_m_log_flag_t = {
2355         "Count Tool used",
2356         "Count Tool NOT used"
2357 };
2358
2359 static const true_false_string rtp_midi_cj_chapter_m_log_flag_v = {
2360         "Value Tool used",
2361         "Value Tool NOT used"
2362 };
2363
2364 static const true_false_string rtp_midi_cj_chapter_m_log_flag_r = {
2365         "Reserved-Flag set",
2366         "Reserved-Flag NOT set"
2367 };
2368
2369 static const true_false_string rtp_midi_cj_chapter_m_log_flag_x = {
2370         "Precedes most recent Control Change command for ctrl=121",
2371         "Does not precede most recent Control Change command for ctrl=121"
2372 };
2373
2374 static const true_false_string rtp_midi_cj_chapter_m_log_flag_g = {
2375         "negative value",
2376         "positive value"
2377 };
2378
2379 static const true_false_string rtp_midi_cj_chapter_n_log_flag_y = {
2380         "Execute Note-On",
2381         "Skip Note-On"
2382 };
2383
2384 static const true_false_string rtp_midi_cj_chapter_e_log_flag_v = {
2385         "Encodes Note-Off velocity",
2386         "Encodes Note-On/Off count"
2387 };
2388
2389 static const true_false_string rtp_midi_cj_chapter_a_log_flag_x = {
2390         "Precedes most recent Control Change command for ctrl=123-127",
2391         "Does not precede most recent Control Change command for ctrl=123-127"
2392 };
2393
2394 static const true_false_string rtp_midi_cj_chapter_p_log_flag_x = {
2395         "Reset all controllers received between MSB and LSB",
2396         "NO Reset all controllers received between MSB and LSB"
2397 };
2398
2399 static const true_false_string rtp_midi_sj_chapter_d_flag_b = {
2400         "Reset field present",
2401         "Reset field NOT present"
2402 };
2403
2404 static const true_false_string rtp_midi_sj_chapter_d_flag_g = {
2405         "Tune request field present",
2406         "Tune request field NOT present"
2407 };
2408
2409 static const true_false_string rtp_midi_sj_chapter_d_flag_h = {
2410         "Song select field present",
2411         "Song select field NOT present"
2412 };
2413
2414 static const true_false_string rtp_midi_sj_chapter_d_flag_j = {
2415         "Undefined system common 0xF4 field present",
2416         "Undefined system common 0xF4 field NOT present"
2417 };
2418
2419 static const true_false_string rtp_midi_sj_chapter_d_flag_k = {
2420         "Undefined system common 0xF5 field present",
2421         "Undefined system common 0xF5 field NOT present"
2422 };
2423
2424 static const true_false_string rtp_midi_sj_chapter_d_flag_y = {
2425         "Undefined system common 0xF9 field present",
2426         "Undefined system common 0xF9 field NOT present"
2427 };
2428
2429 static const true_false_string rtp_midi_sj_chapter_d_flag_z = {
2430         "Undefined system common 0xFD field present",
2431         "Undefined system common 0xFD field NOT present"
2432 };
2433
2434 static const true_false_string rtp_midi_sj_chapter_d_syscom_flag_c = {
2435         "Count field present",
2436         "Count field NOT present"
2437 };
2438
2439 static const true_false_string rtp_midi_sj_chapter_d_syscom_flag_v = {
2440         "Value field present",
2441         "Value field NOT present"
2442 };
2443
2444 static const true_false_string rtp_midi_sj_chapter_d_syscom_flag_l = {
2445         "Legal field present",
2446         "Legal field NOT present"
2447 };
2448
2449 static const true_false_string rtp_midi_sj_chapter_q_flag_n = {
2450         "Active Start / Continue",
2451         "NO active Start / Stop Continue"
2452 };
2453
2454 static const true_false_string rtp_midi_sj_chapter_q_flag_d = {
2455         "Song position already reached",
2456         "Song position yet to be reached"
2457 };
2458
2459 static const true_false_string rtp_midi_sj_chapter_q_flag_c = {
2460         "Clock field present",
2461         "Clock field NOT present"
2462 };
2463
2464 static const true_false_string rtp_midi_sj_chapter_q_flag_t = {
2465         "Timetools field present",
2466         "Timetools field NOT present"
2467 };
2468
2469 static const true_false_string rtp_midi_sj_chapter_f_flag_c = {
2470         "Complete field present",
2471         "Complete field NOT present"
2472 };
2473
2474 static const true_false_string rtp_midi_sj_chapter_f_flag_p = {
2475         "Partial field present",
2476         "Partial field NOT present"
2477 };
2478
2479 static const true_false_string rtp_midi_sj_chapter_f_flag_q = {
2480         "Complete field contains quarter frames",
2481         "Complete field contains full frame format"
2482 };
2483
2484 static const true_false_string rtp_midi_sj_chapter_f_flag_d = {
2485         "Tape head is moving reverse",
2486         "Tape head is moving forward or undefined"
2487 };
2488
2489 static const true_false_string rtp_midi_sj_chapter_x_flag_t = {
2490         "TCOUNT field present",
2491         "TCOUNT field NOT present"
2492 };
2493
2494 static const true_false_string rtp_midi_sj_chapter_x_flag_c = {
2495         "COUNT field present",
2496         "COUNT field NOT present"
2497 };
2498
2499 static const true_false_string rtp_midi_sj_chapter_x_flag_f = {
2500         "FIRST field present",
2501         "FIRST field NOT present"
2502 };
2503
2504 static const true_false_string rtp_midi_sj_chapter_x_flag_d = {
2505         "DATA field present",
2506         "DATA field not present"
2507 };
2508
2509 static const true_false_string rtp_midi_sj_chapter_x_flag_l = {
2510         "List Tool used",
2511         "Recency Tool used"
2512 };
2513
2514
2515
2516 static int hf_rtp_midi_bflag                            = -1;
2517 static int hf_rtp_midi_jflag                            = -1;
2518 static int hf_rtp_midi_zflag                            = -1;
2519 static int hf_rtp_midi_pflag                            = -1;
2520 static int hf_rtp_midi_shortlen                         = -1;
2521 static int hf_rtp_midi_longlen                          = -1;
2522
2523 static int hf_rtp_midi_sflag                            = -1;
2524 static int hf_rtp_midi_yflag                            = -1;
2525 static int hf_rtp_midi_aflag                            = -1;
2526 static int hf_rtp_midi_hflag                            = -1;
2527 static int hf_rtp_midi_totchan                          = -1;
2528 static int hf_rtp_midi_check_seq_num                    = -1;
2529
2530 static int hf_rtp_midi_deltatime1                       = -1;
2531 static int hf_rtp_midi_deltatime2                       = -1;
2532 static int hf_rtp_midi_deltatime3                       = -1;
2533 static int hf_rtp_midi_deltatime4                       = -1;
2534
2535 static int hf_rtp_midi_channel_status                   = -1;
2536 static int hf_rtp_midi_common_status                    = -1;
2537 static int hf_rtp_midi_channel                          = -1;
2538 static int hf_rtp_midi_note                             = -1;
2539 static int hf_rtp_midi_velocity                         = -1;
2540 static int hf_rtp_midi_pressure                         = -1;
2541 static int hf_rtp_midi_controller                       = -1;
2542 static int hf_rtp_midi_controller_value                 = -1;
2543 static int hf_rtp_midi_program                          = -1;
2544 static int hf_rtp_midi_channel_pressure                 = -1;
2545 static int hf_rtp_midi_pitch_bend                       = -1;
2546 static int hf_rtp_midi_pitch_bend_truncated             = -1;
2547
2548 static int hf_rtp_midi_manu_short                       = -1;
2549 static int hf_rtp_midi_manu_long                        = -1;
2550
2551 static int hf_rtp_midi_sysjour_toc_s                    = -1;
2552 static int hf_rtp_midi_sysjour_toc_d                    = -1;
2553 static int hf_rtp_midi_sysjour_toc_v                    = -1;
2554 static int hf_rtp_midi_sysjour_toc_q                    = -1;
2555 static int hf_rtp_midi_sysjour_toc_f                    = -1;
2556 static int hf_rtp_midi_sysjour_toc_x                    = -1;
2557 static int hf_rtp_midi_sysjour_len                      = -1;
2558
2559 static int hf_rtp_midi_chanjour_sflag                   = -1;
2560 static int hf_rtp_midi_chanjour_chan                    = -1;
2561 static int hf_rtp_midi_chanjour_hflag                   = -1;
2562 static int hf_rtp_midi_chanjour_len                     = -1;
2563 static int hf_rtp_midi_chanjour_toc_p                   = -1;
2564 static int hf_rtp_midi_chanjour_toc_c                   = -1;
2565 static int hf_rtp_midi_chanjour_toc_m                   = -1;
2566 static int hf_rtp_midi_chanjour_toc_w                   = -1;
2567 static int hf_rtp_midi_chanjour_toc_n                   = -1;
2568 static int hf_rtp_midi_chanjour_toc_e                   = -1;
2569 static int hf_rtp_midi_chanjour_toc_t                   = -1;
2570 static int hf_rtp_midi_chanjour_toc_a                   = -1;
2571
2572 static int hf_rtp_midi_cj_chapter_p_sflag               = -1;
2573 static int hf_rtp_midi_cj_chapter_p_program             = -1;
2574 static int hf_rtp_midi_cj_chapter_p_bflag               = -1;
2575 static int hf_rtp_midi_cj_chapter_p_bank_msb            = -1;
2576 static int hf_rtp_midi_cj_chapter_p_xflag               = -1;
2577 static int hf_rtp_midi_cj_chapter_p_bank_lsb            = -1;
2578
2579 static int hf_rtp_midi_cj_chapter_c_sflag               = -1;
2580 static int hf_rtp_midi_cj_chapter_c_length              = -1;
2581 static int hf_rtp_midi_cj_chapter_c_number              = -1;
2582 static int hf_rtp_midi_cj_chapter_c_aflag               = -1;
2583 static int hf_rtp_midi_cj_chapter_c_value               = -1;
2584 static int hf_rtp_midi_cj_chapter_c_tflag               = -1;
2585 static int hf_rtp_midi_cj_chapter_c_alt                 = -1;
2586
2587 static int hf_rtp_midi_cj_chapter_m_sflag               = -1;
2588 static int hf_rtp_midi_cj_chapter_m_pflag               = -1;
2589 static int hf_rtp_midi_cj_chapter_m_eflag               = -1;
2590 static int hf_rtp_midi_cj_chapter_m_uflag               = -1;
2591 static int hf_rtp_midi_cj_chapter_m_wflag               = -1;
2592 static int hf_rtp_midi_cj_chapter_m_zflag               = -1;
2593 static int hf_rtp_midi_cj_chapter_m_length              = -1;
2594 static int hf_rtp_midi_cj_chapter_m_qflag               = -1;
2595 static int hf_rtp_midi_cj_chapter_m_pending             = -1;
2596 static int hf_rtp_midi_cj_chapter_m_log_sflag           = -1;
2597 static int hf_rtp_midi_cj_chapter_m_log_pnum_lsb        = -1;
2598 static int hf_rtp_midi_cj_chapter_m_log_qflag           = -1;
2599 static int hf_rtp_midi_cj_chapter_m_log_pnum_msb        = -1;
2600 static int hf_rtp_midi_cj_chapter_m_log_jflag           = -1;
2601 static int hf_rtp_midi_cj_chapter_m_log_kflag           = -1;
2602 static int hf_rtp_midi_cj_chapter_m_log_lflag           = -1;
2603 static int hf_rtp_midi_cj_chapter_m_log_mflag           = -1;
2604 static int hf_rtp_midi_cj_chapter_m_log_nflag           = -1;
2605 static int hf_rtp_midi_cj_chapter_m_log_tflag           = -1;
2606 static int hf_rtp_midi_cj_chapter_m_log_vflag           = -1;
2607 static int hf_rtp_midi_cj_chapter_m_log_rflag           = -1;
2608 static int hf_rtp_midi_cj_chapter_m_log_msb             = -1;
2609 static int hf_rtp_midi_cj_chapter_m_log_msb_x           = -1;
2610 static int hf_rtp_midi_cj_chapter_m_log_lsb             = -1;
2611 static int hf_rtp_midi_cj_chapter_m_log_lsb_x           = -1;
2612 static int hf_rtp_midi_cj_chapter_m_log_a_button_g      = -1;
2613 static int hf_rtp_midi_cj_chapter_m_log_a_button_x      = -1;
2614 static int hf_rtp_midi_cj_chapter_m_log_a_button        = -1;
2615 static int hf_rtp_midi_cj_chapter_m_log_c_button        = -1;
2616 static int hf_rtp_midi_cj_chapter_m_log_c_button_g      = -1;
2617 static int hf_rtp_midi_cj_chapter_m_log_c_button_r      = -1;
2618 static int hf_rtp_midi_cj_chapter_m_log_count           = -1;
2619 static int hf_rtp_midi_cj_chapter_m_log_count_x         = -1;
2620
2621 static int hf_rtp_midi_cj_chapter_w_sflag               = -1;
2622 static int hf_rtp_midi_cj_chapter_w_first               = -1;
2623 static int hf_rtp_midi_cj_chapter_w_rflag               = -1;
2624 static int hf_rtp_midi_cj_chapter_w_second              = -1;
2625
2626 static int hf_rtp_midi_cj_chapter_n_bflag               = -1;
2627 static int hf_rtp_midi_cj_chapter_n_len                 = -1;
2628 static int hf_rtp_midi_cj_chapter_n_low                 = -1;
2629 static int hf_rtp_midi_cj_chapter_n_high                = -1;
2630 static int hf_rtp_midi_cj_chapter_n_log_sflag           = -1;
2631 static int hf_rtp_midi_cj_chapter_n_log_notenum         = -1;
2632 static int hf_rtp_midi_cj_chapter_n_log_yflag           = -1;
2633 static int hf_rtp_midi_cj_chapter_n_log_velocity        = -1;
2634 static int hf_rtp_midi_cj_chapter_n_log_octet           = -1;
2635
2636 static int hf_rtp_midi_cj_chapter_e_sflag               = -1;
2637 static int hf_rtp_midi_cj_chapter_e_len                 = -1;
2638 static int hf_rtp_midi_cj_chapter_e_log_sflag           = -1;
2639 static int hf_rtp_midi_cj_chapter_e_log_notenum         = -1;
2640 static int hf_rtp_midi_cj_chapter_e_log_vflag           = -1;
2641 static int hf_rtp_midi_cj_chapter_e_log_velocity        = -1;
2642 static int hf_rtp_midi_cj_chapter_e_log_count           = -1;
2643
2644 static int hf_rtp_midi_cj_chapter_t_sflag               = -1;
2645 static int hf_rtp_midi_cj_chapter_t_pressure            = -1;
2646
2647 static int hf_rtp_midi_cj_chapter_a_sflag               = -1;
2648 static int hf_rtp_midi_cj_chapter_a_len                 = -1;
2649 static int hf_rtp_midi_cj_chapter_a_log_sflag           = -1;
2650 static int hf_rtp_midi_cj_chapter_a_log_notenum         = -1;
2651 static int hf_rtp_midi_cj_chapter_a_log_xflag           = -1;
2652 static int hf_rtp_midi_cj_chapter_a_log_pressure        = -1;
2653
2654 static int hf_rtp_midi_sj_chapter_v_sflag               = -1;
2655 static int hf_rtp_midi_sj_chapter_v_count               = -1;
2656
2657 static int hf_rtp_midi_sj_chapter_d_sflag               = -1;
2658 static int hf_rtp_midi_sj_chapter_d_bflag               = -1;
2659 static int hf_rtp_midi_sj_chapter_d_gflag               = -1;
2660 static int hf_rtp_midi_sj_chapter_d_hflag               = -1;
2661 static int hf_rtp_midi_sj_chapter_d_jflag               = -1;
2662 static int hf_rtp_midi_sj_chapter_d_kflag               = -1;
2663 static int hf_rtp_midi_sj_chapter_d_yflag               = -1;
2664 static int hf_rtp_midi_sj_chapter_d_zflag               = -1;
2665
2666 static int hf_rtp_midi_sj_chapter_d_reset_sflag         = -1;
2667 static int hf_rtp_midi_sj_chapter_d_reset_count         = -1;
2668 static int hf_rtp_midi_sj_chapter_d_tune_sflag          = -1;
2669 static int hf_rtp_midi_sj_chapter_d_tune_count          = -1;
2670 static int hf_rtp_midi_sj_chapter_d_song_sel_sflag      = -1;
2671 static int hf_rtp_midi_sj_chapter_d_song_sel_value      = -1;
2672
2673 static int hf_rtp_midi_sj_chapter_d_syscom_sflag        = -1;
2674 static int hf_rtp_midi_sj_chapter_d_syscom_cflag        = -1;
2675 static int hf_rtp_midi_sj_chapter_d_syscom_vflag        = -1;
2676 static int hf_rtp_midi_sj_chapter_d_syscom_lflag        = -1;
2677 static int hf_rtp_midi_sj_chapter_d_syscom_dsz          = -1;
2678 static int hf_rtp_midi_sj_chapter_d_syscom_length       = -1;
2679 static int hf_rtp_midi_sj_chapter_d_syscom_count        = -1;
2680 static int hf_rtp_midi_sj_chapter_d_syscom_value        = -1;
2681 static int hf_rtp_midi_sj_chapter_d_syscom_legal        = -1;
2682 static int hf_rtp_midi_sj_chapter_d_syscom_data         = -1;
2683
2684 static int hf_rtp_midi_sj_chapter_d_sysreal_sflag       = -1;
2685 static int hf_rtp_midi_sj_chapter_d_sysreal_cflag       = -1;
2686 static int hf_rtp_midi_sj_chapter_d_sysreal_lflag       = -1;
2687 static int hf_rtp_midi_sj_chapter_d_sysreal_length      = -1;
2688 static int hf_rtp_midi_sj_chapter_d_sysreal_count       = -1;
2689 static int hf_rtp_midi_sj_chapter_d_sysreal_legal       = -1;
2690 static int hf_rtp_midi_sj_chapter_d_sysreal_data        = -1;
2691
2692 static int hf_rtp_midi_sj_chapter_q_sflag               = -1;
2693 static int hf_rtp_midi_sj_chapter_q_nflag               = -1;
2694 static int hf_rtp_midi_sj_chapter_q_dflag               = -1;
2695 static int hf_rtp_midi_sj_chapter_q_cflag               = -1;
2696 static int hf_rtp_midi_sj_chapter_q_tflag               = -1;
2697 static int hf_rtp_midi_sj_chapter_q_top                 = -1;
2698 static int hf_rtp_midi_sj_chapter_q_clock               = -1;
2699 static int hf_rtp_midi_sj_chapter_q_timetools           = -1;
2700
2701 static int hf_rtp_midi_sj_chapter_f_sflag               = -1;
2702 static int hf_rtp_midi_sj_chapter_f_cflag               = -1;
2703 static int hf_rtp_midi_sj_chapter_f_pflag               = -1;
2704 static int hf_rtp_midi_sj_chapter_f_qflag               = -1;
2705 static int hf_rtp_midi_sj_chapter_f_dflag               = -1;
2706 static int hf_rtp_midi_sj_chapter_f_point               = -1;
2707 static int hf_rtp_midi_sj_chapter_f_mt0                 = -1;
2708 static int hf_rtp_midi_sj_chapter_f_mt1                 = -1;
2709 static int hf_rtp_midi_sj_chapter_f_mt2                 = -1;
2710 static int hf_rtp_midi_sj_chapter_f_mt3                 = -1;
2711 static int hf_rtp_midi_sj_chapter_f_mt4                 = -1;
2712 static int hf_rtp_midi_sj_chapter_f_mt5                 = -1;
2713 static int hf_rtp_midi_sj_chapter_f_mt6                 = -1;
2714 static int hf_rtp_midi_sj_chapter_f_mt7                 = -1;
2715 static int hf_rtp_midi_sj_chapter_f_hr                  = -1;
2716 static int hf_rtp_midi_sj_chapter_f_mn                  = -1;
2717 static int hf_rtp_midi_sj_chapter_f_sc                  = -1;
2718 static int hf_rtp_midi_sj_chapter_f_fr                  = -1;
2719
2720 static int hf_rtp_midi_sj_chapter_x_sflag               = -1;
2721 static int hf_rtp_midi_sj_chapter_x_tflag               = -1;
2722 static int hf_rtp_midi_sj_chapter_x_cflag               = -1;
2723 static int hf_rtp_midi_sj_chapter_x_fflag               = -1;
2724 static int hf_rtp_midi_sj_chapter_x_dflag               = -1;
2725 static int hf_rtp_midi_sj_chapter_x_lflag               = -1;
2726 static int hf_rtp_midi_sj_chapter_x_sta                 = -1;
2727 static int hf_rtp_midi_sj_chapter_x_tcount              = -1;
2728 static int hf_rtp_midi_sj_chapter_x_count               = -1;
2729 static int hf_rtp_midi_sj_chapter_x_first1              = -1;
2730 static int hf_rtp_midi_sj_chapter_x_first2              = -1;
2731 static int hf_rtp_midi_sj_chapter_x_first3              = -1;
2732 static int hf_rtp_midi_sj_chapter_x_first4              = -1;
2733 static int hf_rtp_midi_sj_chapter_x_data                = -1;
2734 static int hf_rtp_midi_sj_chapter_x_invalid_data        = -1;
2735
2736 static int hf_rtp_midi_quarter_frame_type               = -1;
2737 static int hf_rtp_midi_quarter_frame_value              = -1;
2738 static int hf_rtp_midi_spp_truncated                    = -1;
2739 static int hf_rtp_midi_spp                              = -1;
2740 static int hf_rtp_midi_song_select                      = -1;
2741 static int hf_rtp_midi_manu_data                        = -1;
2742 static int hf_rtp_midi_edu_data                         = -1;
2743 static int hf_rtp_midi_unknown_data                     = -1;
2744 static int hf_rtp_midi_sysex_common_non_realtime        = -1;
2745 static int hf_rtp_midi_sysex_common_realtime            = -1;
2746 static int hf_rtp_midi_sysex_common_device_id           = -1;
2747
2748 static int hf_rtp_midi_sysex_common_nrt_mtc             = -1;
2749 static int hf_rtp_midi_sysex_common_nrt_sd_ext          = -1;
2750 static int hf_rtp_midi_sysex_common_nrt_gi              = -1;
2751 static int hf_rtp_midi_sysex_common_nrt_fd              = -1;
2752 static int hf_rtp_midi_sysex_common_tuning              = -1;
2753 static int hf_rtp_midi_sysex_common_nrt_gm              = -1;
2754 static int hf_rtp_midi_sysex_common_nrt_dls             = -1;
2755
2756 static int hf_rtp_midi_sysex_common_rt_mtc              = -1;
2757 static int hf_rtp_midi_sysex_common_rt_sc               = -1;
2758 static int hf_rtp_midi_sysex_common_rt_ni               = -1;
2759 static int hf_rtp_midi_sysex_common_rt_dc               = -1;
2760 static int hf_rtp_midi_sysex_common_rt_mtc_cueing       = -1;
2761 static int hf_rtp_midi_sysex_common_rt_mmc_commands     = -1;
2762 static int hf_rtp_midi_sysex_common_rt_mmc_responses    = -1;
2763
2764 static int hf_rtp_midi_sysex_common_nrt_gi_device_family = -1;
2765 static int hf_rtp_midi_sysex_common_nrt_gi_device_family_member = -1;
2766 static int hf_rtp_midi_sysex_common_nrt_gi_software_rev = -1;
2767
2768 static int hf_rtp_midi_sysex_common_nrt_sd_packet_number = -1;
2769
2770 static int hf_rtp_midi_sysex_common_nrt_sd_header_sn    = -1;
2771 static int hf_rtp_midi_sysex_common_nrt_sd_header_sf    = -1;
2772 static int hf_rtp_midi_sysex_common_nrt_sd_header_sp    = -1;
2773 static int hf_rtp_midi_sysex_common_nrt_sd_header_sl    = -1;
2774 static int hf_rtp_midi_sysex_common_nrt_sd_header_ls    = -1;
2775 static int hf_rtp_midi_sysex_common_nrt_sd_header_le    = -1;
2776 static int hf_rtp_midi_sysex_common_nrt_sd_header_lt    = -1;
2777
2778 static int hf_rtp_midi_sysex_common_nrt_sd_packet_count = -1;
2779 static int hf_rtp_midi_sysex_common_nrt_sd_packet_check = -1;
2780 static int hf_rtp_midi_sysex_common_nrt_sd_packet_data  = -1;
2781
2782 static int hf_rtp_midi_sysex_common_nrt_sd_ext_ln       = -1;
2783
2784 static int hf_rtp_midi_sysex_common_nrt_fd_device_id    = -1;
2785 static int hf_rtp_midi_sysex_common_nrt_fd_type         = -1;
2786 static int hf_rtp_midi_sysex_common_nrt_fd_name         = -1;
2787 static int hf_rtp_midi_sysex_common_nrt_fd_length       = -1;
2788 static int hf_rtp_midi_sysex_common_nrt_fd_packet_num   = -1;
2789 static int hf_rtp_midi_sysex_common_nrt_fd_byte_count   = -1;
2790 static int hf_rtp_midi_sysex_common_nrt_fd_packet_data  = -1;
2791 static int hf_rtp_midi_sysex_common_nrt_fd_checksum     = -1;
2792
2793 static int hf_rtp_midi_sysex_common_tune_program        = -1;
2794 static int hf_rtp_midi_sysex_common_tune_name           = -1;
2795 static int hf_rtp_midi_sysex_common_tune_freq           = -1;
2796 static int hf_rtp_midi_sysex_common_tune_checksum       = -1;
2797 static int hf_rtp_midi_sysex_common_tune_changes        = -1;
2798 static int hf_rtp_midi_sysex_common_tune_note           = -1;
2799
2800 static int hf_rtp_midi_sysex_common_rt_mtc_fm_type      = -1;
2801 static int hf_rtp_midi_sysex_common_rt_mtc_fm_hr        = -1;
2802 static int hf_rtp_midi_sysex_common_rt_mtc_fm_mn        = -1;
2803 static int hf_rtp_midi_sysex_common_rt_mtc_fm_sc        = -1;
2804 static int hf_rtp_midi_sysex_common_rt_mtc_fm_fr        = -1;
2805
2806 static int hf_rtp_midi_sysex_common_rt_mtc_ub_u1        = -1;
2807 static int hf_rtp_midi_sysex_common_rt_mtc_ub_u2        = -1;
2808 static int hf_rtp_midi_sysex_common_rt_mtc_ub_u3        = -1;
2809 static int hf_rtp_midi_sysex_common_rt_mtc_ub_u4        = -1;
2810 static int hf_rtp_midi_sysex_common_rt_mtc_ub_u5        = -1;
2811 static int hf_rtp_midi_sysex_common_rt_mtc_ub_u6        = -1;
2812 static int hf_rtp_midi_sysex_common_rt_mtc_ub_u7        = -1;
2813 static int hf_rtp_midi_sysex_common_rt_mtc_ub_u8        = -1;
2814 static int hf_rtp_midi_sysex_common_rt_mtc_ub_u9        = -1;
2815
2816 static int hf_rtp_midi_sysex_common_nrt_mtc_type        = -1;
2817 static int hf_rtp_midi_sysex_common_nrt_mtc_hr          = -1;
2818 static int hf_rtp_midi_sysex_common_nrt_mtc_mn          = -1;
2819 static int hf_rtp_midi_sysex_common_nrt_mtc_sc          = -1;
2820 static int hf_rtp_midi_sysex_common_nrt_mtc_fr          = -1;
2821 static int hf_rtp_midi_sysex_common_nrt_mtc_ff          = -1;
2822 static int hf_rtp_midi_sysex_common_nrt_mtc_enl         = -1;
2823 static int hf_rtp_midi_sysex_common_nrt_mtc_enm         = -1;
2824 static int hf_rtp_midi_sysex_common_nrt_mtc_add         = -1;
2825
2826 static int hf_rtp_midi_sysex_common_rt_mtc_cue_enl      = -1;
2827 static int hf_rtp_midi_sysex_common_rt_mtc_cue_enm      = -1;
2828 static int hf_rtp_midi_sysex_common_rt_mtc_cue_add      = -1;
2829
2830 static int hf_rtp_midi_sysex_common_rt_ni_bar_num       = -1;
2831 static int hf_rtp_midi_sysex_common_rt_ni_bytes         = -1;
2832 static int hf_rtp_midi_sysex_common_rt_ni_numerator     = -1;
2833 static int hf_rtp_midi_sysex_common_rt_ni_denominator   = -1;
2834 static int hf_rtp_midi_sysex_common_rt_ni_midi_clocks   = -1;
2835 static int hf_rtp_midi_sysex_common_rt_ni_32nds         = -1;
2836
2837 static int hf_rtp_midi_sysex_common_rt_dc_volume        = -1;
2838 static int hf_rtp_midi_sysex_common_rt_dc_balance       = -1;
2839
2840
2841 /* RTP MIDI fields defining a subtree */
2842
2843 static gint ett_rtp_midi                                = -1;
2844 static gint ett_rtp_midi_commands                       = -1;
2845 static gint ett_rtp_midi_journal                        = -1;
2846 static gint ett_rtp_midi_command                        = -1;
2847 static gint ett_rtp_midi_systemjournal                  = -1;
2848 static gint ett_rtp_midi_channeljournals                = -1;
2849 static gint ett_rtp_midi_systemchapters                 = -1;
2850 static gint ett_rtp_midi_sj_chapter_d                   = -1;
2851 static gint ett_rtp_midi_sj_chapter_d_field_b           = -1;
2852 static gint ett_rtp_midi_sj_chapter_d_field_g           = -1;
2853 static gint ett_rtp_midi_sj_chapter_d_field_h           = -1;
2854 static gint ett_rtp_midi_sj_chapter_d_field_j           = -1;
2855 static gint ett_rtp_midi_sj_chapter_d_field_k           = -1;
2856 static gint ett_rtp_midi_sj_chapter_d_field_y           = -1;
2857 static gint ett_rtp_midi_sj_chapter_d_field_z           = -1;
2858 static gint ett_rtp_midi_sj_chapter_v                   = -1;
2859 static gint ett_rtp_midi_sj_chapter_q                   = -1;
2860 static gint ett_rtp_midi_sj_chapter_f                   = -1;
2861 static gint ett_rtp_midi_sj_chapter_f_complete          = -1;
2862 static gint ett_rtp_midi_sj_chapter_f_partial           = -1;
2863 static gint ett_rtp_midi_sj_chapter_x                   = -1;
2864 static gint ett_rtp_midi_sj_chapter_x_first             = -1;
2865 static gint ett_rtp_midi_sj_chapter_x_data              = -1;
2866 static gint ett_rtp_midi_channeljournal                 = -1;
2867 static gint ett_rtp_midi_channelchapters                = -1;
2868 static gint ett_rtp_midi_cj_chapter_p                   = -1;
2869 static gint ett_rtp_midi_cj_chapter_c                   = -1;
2870 static gint ett_rtp_midi_cj_chapter_c_loglist           = -1;
2871 static gint ett_rtp_midi_cj_chapter_c_logitem           = -1;
2872 static gint ett_rtp_midi_cj_chapter_m                   = -1;
2873 static gint ett_rtp_midi_cj_chapter_m_loglist           = -1;
2874 static gint ett_rtp_midi_cj_chapter_m_logitem           = -1;
2875 static gint ett_rtp_midi_cj_chapter_m_log_msb           = -1;
2876 static gint ett_rtp_midi_cj_chapter_m_log_lsb           = -1;
2877 static gint ett_rtp_midi_cj_chapter_m_log_a_button      = -1;
2878 static gint ett_rtp_midi_cj_chapter_m_log_c_button      = -1;
2879 static gint ett_rtp_midi_cj_chapter_m_log_count         = -1;
2880 static gint ett_rtp_midi_cj_chapter_w                   = -1;
2881 static gint ett_rtp_midi_cj_chapter_n                   = -1;
2882 static gint ett_rtp_midi_cj_chapter_n_loglist           = -1;
2883 static gint ett_rtp_midi_cj_chapter_n_logitem           = -1;
2884 static gint ett_rtp_midi_cj_chapter_n_octets            = -1;
2885 static gint ett_rtp_midi_cj_chapter_e                   = -1;
2886 static gint ett_rtp_midi_cj_chapter_e_loglist           = -1;
2887 static gint ett_rtp_midi_cj_chapter_e_logitem           = -1;
2888 static gint ett_rtp_midi_cj_chapter_t                   = -1;
2889 static gint ett_rtp_midi_cj_chapter_a                   = -1;
2890 static gint ett_rtp_midi_cj_chapter_a_loglist           = -1;
2891 static gint ett_rtp_midi_cj_chapter_a_logitem           = -1;
2892 static gint ett_rtp_midi_sysex_data                     = -1;
2893 static gint ett_rtp_midi_sysex_edu                      = -1;
2894 static gint ett_rtp_midi_sysex_manu                     = -1;
2895 static gint ett_rtp_midi_sysex_common_rt                = -1;
2896 static gint ett_rtp_midi_sysex_common_nrt               = -1;
2897 static gint ett_rtp_midi_sysex_common_tune_note         = -1;
2898
2899
2900 static guint rtp_midi_payload_type_value        = 0;
2901 static guint saved_payload_type_value;
2902
2903
2904 static int proto_rtp_midi                       = -1;
2905
2906
2907
2908
2909 void proto_reg_handoff_rtp_midi( void );
2910
2911
2912 /*
2913  * This decodes the delta-time before a MIDI-command
2914  */
2915 static int
2916 decodetime(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int cmd_len)
2917 {
2918         guint8          octet;
2919         unsigned int    consumed;
2920         unsigned int    i;
2921         unsigned long   deltatime;
2922
2923         consumed  = 0;
2924         deltatime = 0;
2925
2926
2927         /* RTP-MIDI deltatime is "compressed" using only the necessary amount of octets */
2928         for ( i=0; i < 4; i++ ) {
2929
2930                 if ( !cmd_len ) {
2931                         return -1;
2932                 }
2933
2934                 octet = tvb_get_guint8( tvb, offset + consumed );
2935                 deltatime = ( deltatime << 7 ) | ( octet & RTP_MIDI_DELTA_TIME_OCTET_MASK );
2936                 consumed++;
2937
2938                 if ( ( octet & RTP_MIDI_DELTA_TIME_EXTENSION ) == 0 ) {
2939                         break;
2940                 }
2941         }
2942
2943         switch (consumed) {
2944                 case 1:
2945                     proto_tree_add_uint ( tree, hf_rtp_midi_deltatime1, tvb, offset, consumed, deltatime );
2946                         break;
2947                 case 2:
2948                     proto_tree_add_uint ( tree, hf_rtp_midi_deltatime2, tvb, offset, consumed, deltatime );
2949                         break;
2950                 case 3:
2951                     proto_tree_add_uint ( tree, hf_rtp_midi_deltatime3, tvb, offset, consumed, deltatime );
2952                         break;
2953                 case 4:
2954                     proto_tree_add_uint ( tree, hf_rtp_midi_deltatime4, tvb, offset, consumed, deltatime );
2955                         break;
2956
2957         }
2958
2959         return consumed;
2960 }
2961
2962
2963
2964 /*
2965  * Here a Note-Off command is decoded.
2966  */
2967 static int
2968 decode_note_off(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned int cmd_count, unsigned int offset, unsigned int cmd_len, guint8 status, unsigned int rsoffset, gboolean using_rs ) {
2969
2970         guint8           note           = 0;
2971         guint8           velocity       = 0;
2972         const gchar     *status_str     = NULL;
2973         const gchar     *note_str       = NULL;
2974         proto_item      *command_item   = NULL;
2975         proto_tree      *command_tree   = NULL;
2976
2977         status_str = val_to_str( status >> 4, rtp_midi_channel_status, rtp_midi_unknown_value_hex );
2978
2979         /* broken: we have no further data */
2980         if ( !cmd_len ) {
2981                 /* this case should never happen */
2982                 if ( using_rs ) {
2983                         command_item = proto_tree_add_text( tree, tvb, offset, 0, "TRUNCATED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
2984                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
2985                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
2986                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
2987
2988                 } else {
2989                         command_item = proto_tree_add_text( tree, tvb, offset - 1, 1, "TRUNCATED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1);
2990                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
2991                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
2992                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
2993                         }
2994                 return -1;
2995         }
2996
2997         note = tvb_get_guint8( tvb, offset );
2998
2999         /* seems to be an aborted MIDI-command */
3000         if ( note & RTP_MIDI_COMMAND_STATUS_FLAG ) {
3001                 /* this case should never happen */
3002                 if ( using_rs ) {
3003                         command_item = proto_tree_add_text( tree, tvb, offset, 0, "ABORTED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3004                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3005                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3006                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3007
3008                 } else {
3009                         command_item = proto_tree_add_text( tree, tvb, offset - 1, 1, "ABORTED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3010                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3011                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3012                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3013                         }
3014                 return -1;
3015         }
3016
3017         note_str = val_to_str( note, rtp_midi_note_values, rtp_midi_unknown_value_dec );
3018
3019         /* broken: we have only one further octet */
3020         if ( cmd_len < 2 ) {
3021                 if ( using_rs ) {
3022                         command_item = proto_tree_add_text( tree, tvb, offset, 1, "TRUNCATED: %s (c=%d, n=%s)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, note_str );
3023                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command);
3024                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3025                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3026                         proto_tree_add_item( command_tree, hf_rtp_midi_note, tvb, offset, 1, ENC_BIG_ENDIAN );
3027
3028                 } else {
3029                         command_item = proto_tree_add_text( tree, tvb, offset - 1, 2, "TRUNCATED: %s (c=%d, n=%s)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, note_str );
3030                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3031                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3032                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3033                         proto_tree_add_item( command_tree, hf_rtp_midi_note, tvb, offset, 1, ENC_BIG_ENDIAN );
3034                         }
3035                 return -1;
3036         }
3037
3038         velocity = tvb_get_guint8( tvb, offset + 1 );
3039
3040         /* seems to be an aborted MIDI-command */
3041         if ( velocity  & RTP_MIDI_COMMAND_STATUS_FLAG ) {
3042                 if ( using_rs ) {
3043                         command_item = proto_tree_add_text( tree, tvb, offset, 1, "ABORTED: %s (c=%d, n=%s)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, note_str );
3044                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command);
3045                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3046                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3047                         proto_tree_add_item( command_tree, hf_rtp_midi_note, tvb, offset, 1, ENC_BIG_ENDIAN );
3048
3049                 } else {
3050                         command_item = proto_tree_add_text( tree, tvb, offset - 1, 2, "ABORTED: %s (c=%d, n=%s)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, note_str );
3051                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3052                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3053                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3054                         proto_tree_add_item( command_tree, hf_rtp_midi_note, tvb, offset, 1, ENC_BIG_ENDIAN );
3055                         }
3056                 return -1;
3057         }
3058
3059
3060         if ( using_rs ) {
3061                 command_item = proto_tree_add_text( tree, tvb, offset, 2, "%s (c=%d, n=%s, v=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, note_str, velocity );
3062                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command);
3063                 proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3064                 proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3065                 proto_tree_add_item( command_tree, hf_rtp_midi_note, tvb, offset, 1, ENC_BIG_ENDIAN );
3066                 proto_tree_add_item( command_tree, hf_rtp_midi_velocity, tvb, offset + 1, 1, ENC_BIG_ENDIAN );
3067         } else {
3068                 command_item = proto_tree_add_text(tree, tvb, offset - 1, 3, "%s (c=%d, n=%s, v=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, note_str, velocity );
3069                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3070                 proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3071                 proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3072                 proto_tree_add_item( command_tree, hf_rtp_midi_note, tvb, offset, 1, ENC_BIG_ENDIAN );
3073                 proto_tree_add_item( command_tree, hf_rtp_midi_velocity, tvb, offset + 1, 1, ENC_BIG_ENDIAN );
3074         }
3075
3076         if ( cmd_count ) {
3077                 col_append_fstr(pinfo->cinfo, COL_INFO,", %s (c=%d, n=%s, v=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, note_str, velocity );
3078         } else {
3079                 col_append_fstr(pinfo->cinfo, COL_INFO, "%s (c=%d, n=%s, v=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, note_str, velocity );
3080         }
3081         return 2;
3082 }
3083
3084
3085 /*
3086  * Here a Note-On command is decoded.
3087  */
3088 static int
3089 decode_note_on(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned int cmd_count, unsigned int offset, unsigned int cmd_len, guint8 status, unsigned int rsoffset, gboolean using_rs ) {
3090
3091         guint8           note           = 0;
3092         guint8           velocity       = 0;
3093         const gchar     *status_str     = NULL;
3094         const gchar     *note_str       = NULL;
3095         proto_item      *command_item   = NULL;
3096         proto_tree      *command_tree   = NULL;
3097
3098         status_str = val_to_str( status >> 4, rtp_midi_channel_status, rtp_midi_unknown_value_hex );
3099
3100         /* broken: we have no further data */
3101         if ( !cmd_len ) {
3102                 /*  this should never happen! */
3103                 if ( using_rs ) {
3104                         command_item = proto_tree_add_text( tree, tvb, offset, 0, "TRUNCATED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3105                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3106                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3107                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3108
3109                 } else {
3110                         command_item = proto_tree_add_text( tree, tvb, offset - 1, 1, "TRUNCATED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1);
3111                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3112                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3113                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3114                         }
3115                 return -1;
3116         }
3117
3118         note = tvb_get_guint8( tvb, offset );
3119
3120         /* seems to be an aborted MIDI-command */
3121         if ( note & RTP_MIDI_COMMAND_STATUS_FLAG ) {
3122                 /* this should never happethis should never happen */
3123                 if ( using_rs ) {
3124                         command_item = proto_tree_add_text( tree, tvb, offset, 0, "ABORTED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3125                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3126                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3127                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3128
3129                 } else {
3130                         command_item = proto_tree_add_text( tree, tvb, offset - 1, 1, "ABORTED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3131                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3132                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3133                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3134                         }
3135                 return -1;
3136         }
3137
3138         note_str = val_to_str( note, rtp_midi_note_values, rtp_midi_unknown_value_dec );
3139
3140         /* broken: we have only one further octet */
3141         if ( cmd_len < 2 ) {
3142                 if ( using_rs ) {
3143                         command_item = proto_tree_add_text( tree, tvb, offset, 1, "TRUNCATED: %s (c=%d, n=%s)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, note_str );
3144                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command);
3145                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3146                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3147                         proto_tree_add_item( command_tree, hf_rtp_midi_note, tvb, offset, 1, ENC_BIG_ENDIAN );
3148
3149                 } else {
3150                         command_item = proto_tree_add_text( tree, tvb, offset - 1, 2, "TRUNCATED: %s (c=%d, n=%s)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, note_str );
3151                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3152                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3153                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3154                         proto_tree_add_item( command_tree, hf_rtp_midi_note, tvb, offset, 1, ENC_BIG_ENDIAN );
3155                         }
3156                 return -1;
3157         }
3158
3159         velocity = tvb_get_guint8( tvb, offset + 1 );
3160
3161         /* seems to be an aborted MIDI-command */
3162         if ( velocity  & RTP_MIDI_COMMAND_STATUS_FLAG ) {
3163                 if ( using_rs ) {
3164                         command_item = proto_tree_add_text( tree, tvb, offset, 1, "ABORTED: %s (c=%d, n=%s)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, note_str );
3165                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command);
3166                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3167                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3168                         proto_tree_add_item( command_tree, hf_rtp_midi_note, tvb, offset, 1, ENC_BIG_ENDIAN );
3169
3170                 } else {
3171                         command_item = proto_tree_add_text( tree, tvb, offset - 1, 2, "ABORTED: %s (c=%d, n=%s)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, note_str );
3172                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3173                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3174                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3175                         proto_tree_add_item( command_tree, hf_rtp_midi_note, tvb, offset, 1, ENC_BIG_ENDIAN );
3176                         }
3177                 return -1;
3178         }
3179
3180         /* special case velocity=0 for Note-On means Note-Off (to preserve running-status!) */
3181         if ( velocity == 0 ) {
3182                 status_str = rtp_midi_channel_status_special_off;
3183         }
3184
3185         if ( using_rs ) {
3186                 command_item = proto_tree_add_text( tree, tvb, offset, 2, "%s (c=%d, n=%s, v=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, note_str, velocity );
3187                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command);
3188                 proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3189                 proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3190                 proto_tree_add_item( command_tree, hf_rtp_midi_note, tvb, offset, 1, ENC_BIG_ENDIAN );
3191                 proto_tree_add_item( command_tree, hf_rtp_midi_velocity, tvb, offset + 1, 1, ENC_BIG_ENDIAN );
3192         } else {
3193                 command_item = proto_tree_add_text(tree, tvb, offset - 1, 3, "%s (c=%d, n=%s, v=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, note_str, velocity );
3194                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3195                 proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3196                 proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3197                 proto_tree_add_item( command_tree, hf_rtp_midi_note, tvb, offset, 1, ENC_BIG_ENDIAN );
3198                 proto_tree_add_item( command_tree, hf_rtp_midi_velocity, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
3199         }
3200
3201         if ( cmd_count ) {
3202                 col_append_fstr(pinfo->cinfo, COL_INFO,", %s (c=%d, n=%s, v=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, note_str, velocity );
3203         } else {
3204                 col_append_fstr(pinfo->cinfo, COL_INFO, "%s (c=%d, n=%s, v=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, note_str, velocity );
3205         }
3206         return 2;
3207 }
3208
3209
3210
3211
3212 /*
3213  * Here polyphonic aftertouch is decoded.
3214  */
3215 static int
3216 decode_poly_pressure(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned int cmd_count, unsigned int offset, unsigned int cmd_len, guint8 status, unsigned int rsoffset, gboolean using_rs ) {
3217
3218         guint8           note           = 0;
3219         guint8           pressure       = 0;
3220         const gchar     *status_str     = NULL;
3221         const gchar     *note_str       = NULL;
3222         proto_item      *command_item   = NULL;
3223         proto_tree      *command_tree   = NULL;
3224
3225         status_str = val_to_str( status >> 4, rtp_midi_channel_status, rtp_midi_unknown_value_hex );
3226
3227         /* broken: we have no further data */
3228         if ( !cmd_len ) {
3229                 /* this should never happen */
3230                 if ( using_rs ) {
3231                         command_item = proto_tree_add_text( tree, tvb, offset, 0, "TRUNCATED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3232                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3233                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3234                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3235
3236                 } else {
3237                         command_item = proto_tree_add_text( tree, tvb, offset - 1, 1, "TRUNCATED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1);
3238                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3239                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3240                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3241                         }
3242                 return -1;
3243         }
3244
3245         note = tvb_get_guint8( tvb, offset );
3246
3247         /* seems to be an aborted MIDI-command */
3248         if ( note & RTP_MIDI_COMMAND_STATUS_FLAG ) {
3249                 /* this should never happen */
3250                 if ( using_rs ) {
3251                         command_item = proto_tree_add_text( tree, tvb, offset, 0, "ABORTED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3252                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3253                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3254                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3255
3256                 } else {
3257                         command_item = proto_tree_add_text( tree, tvb, offset - 1, 1, "ABORTED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3258                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3259                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3260                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3261                         }
3262                 return -1;
3263         }
3264
3265         note_str = val_to_str( note, rtp_midi_note_values, rtp_midi_unknown_value_dec );
3266
3267         /* broken: we have only one further octet */
3268         if ( cmd_len < 2 ) {
3269                 if ( using_rs ) {
3270                         command_item = proto_tree_add_text( tree, tvb, offset, 1, "TRUNCATED: %s (c=%d, n=%s)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, note_str );
3271                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command);
3272                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3273                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3274                         proto_tree_add_item( command_tree, hf_rtp_midi_note, tvb, offset, 1, ENC_BIG_ENDIAN );
3275
3276                 } else {
3277                         command_item = proto_tree_add_text( tree, tvb, offset - 1, 2, "TRUNCATED: %s (c=%d, n=%s)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, note_str );
3278                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3279                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3280                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3281                         proto_tree_add_item( command_tree, hf_rtp_midi_note, tvb, offset, 1, ENC_BIG_ENDIAN );
3282                         }
3283                 return -1;
3284         }
3285
3286         pressure = tvb_get_guint8( tvb, offset + 1 );
3287
3288         /* seems to be an aborted MIDI-command */
3289         if ( pressure  & RTP_MIDI_COMMAND_STATUS_FLAG ) {
3290                 if ( using_rs ) {
3291                         command_item = proto_tree_add_text( tree, tvb, offset, 1, "ABORTED: %s (c=%d, n=%s)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, note_str );
3292                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command);
3293                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3294                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3295                         proto_tree_add_item( command_tree, hf_rtp_midi_note, tvb, offset, 1, ENC_BIG_ENDIAN );
3296
3297                 } else {
3298                         command_item = proto_tree_add_text( tree, tvb, offset - 1, 2, "ABORTED: %s (c=%d, n=%s)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, note_str );
3299                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3300                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3301                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3302                         proto_tree_add_item( command_tree, hf_rtp_midi_note, tvb, offset, 1, ENC_BIG_ENDIAN );
3303                         }
3304                 return -1;
3305         }
3306
3307
3308         if ( using_rs ) {
3309                 command_item = proto_tree_add_text( tree, tvb, offset, 2, "%s (c=%d, n=%s, p=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, note_str, pressure );
3310                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command);
3311                 proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3312                 proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3313                 proto_tree_add_item( command_tree, hf_rtp_midi_note, tvb, offset, 1, ENC_BIG_ENDIAN );
3314                 proto_tree_add_item( command_tree, hf_rtp_midi_pressure, tvb, offset + 1, 1, ENC_BIG_ENDIAN );
3315         } else {
3316                 command_item = proto_tree_add_text(tree, tvb, offset - 1, 3, "%s (c=%d, n=%s, p=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, note_str, pressure );
3317                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3318                 proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3319                 proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3320                 proto_tree_add_item( command_tree, hf_rtp_midi_note, tvb, offset, 1, ENC_BIG_ENDIAN );
3321                 proto_tree_add_item( command_tree, hf_rtp_midi_pressure, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
3322         }
3323
3324         if ( cmd_count ) {
3325                 col_append_fstr(pinfo->cinfo, COL_INFO,", %s (c=%d, n=%s, p=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, note_str, pressure );
3326         } else {
3327                 col_append_fstr(pinfo->cinfo, COL_INFO, "%s (c=%d, n=%s, p=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, note_str, pressure );
3328         }
3329         return 2;
3330 }
3331
3332
3333 /*
3334  * Here channel aftertouch is decoded.
3335  */
3336 static int
3337 decode_channel_pressure(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned int cmd_count, unsigned int offset, unsigned int cmd_len, guint8 status, unsigned int rsoffset, gboolean using_rs ) {
3338
3339         guint8           pressure       = 0;
3340         const gchar     *status_str     = NULL;
3341         proto_item      *command_item   = NULL;
3342         proto_tree      *command_tree   = NULL;
3343
3344         status_str = val_to_str( status >> 4, rtp_midi_channel_status, rtp_midi_unknown_value_hex );
3345
3346         /* broken: we have no further data */
3347         if ( !cmd_len ) {
3348                 /* this should never happen */
3349                 if ( using_rs ) {
3350                         command_item = proto_tree_add_text( tree, tvb, offset, 0, "TRUNCATED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3351                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3352                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3353                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3354
3355                 } else {
3356                         command_item = proto_tree_add_text( tree, tvb, offset - 1, 1, "TRUNCATED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1);
3357                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3358                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3359                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3360                         }
3361                 return -1;
3362         }
3363
3364         pressure = tvb_get_guint8( tvb, offset );
3365
3366         /* seems to be an aborted MIDI-command */
3367         if ( pressure  & RTP_MIDI_COMMAND_STATUS_FLAG ) {
3368                 if ( using_rs ) {
3369                         /* this should never happen */
3370                         command_item = proto_tree_add_text( tree, tvb, offset, 0, "ABORTED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3371                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3372                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3373                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3374
3375                 } else {
3376                         command_item = proto_tree_add_text( tree, tvb, offset - 1, 1, "ABORTED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1);
3377                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3378                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3379                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3380                         }
3381                 return -1;
3382         }
3383
3384
3385         if ( using_rs ) {
3386                 command_item = proto_tree_add_text( tree, tvb, offset, 1, "%s (c=%d, p=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, pressure );
3387                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command);
3388                 proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3389                 proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3390                 proto_tree_add_item( command_tree, hf_rtp_midi_channel_pressure, tvb, offset, 1, ENC_BIG_ENDIAN );
3391         } else {
3392                 command_item = proto_tree_add_text(tree, tvb, offset - 1, 2, "%s (c=%d, p=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, pressure );
3393                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3394                 proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3395                 proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3396                 proto_tree_add_item( command_tree, hf_rtp_midi_channel_pressure, tvb, offset, 1, ENC_BIG_ENDIAN);
3397         }
3398
3399         if ( cmd_count ) {
3400                 col_append_fstr(pinfo->cinfo, COL_INFO,", %s (c=%d, p=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, pressure );
3401         } else {
3402                 col_append_fstr(pinfo->cinfo, COL_INFO, "%s (c=%d, p=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, pressure );
3403         }
3404         return 1;
3405 }
3406
3407
3408
3409 /*
3410  * Here pitch-bend is decoded.
3411  */
3412 static int
3413 decode_pitch_bend_change(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int cmd_count, unsigned int offset, unsigned int cmd_len, guint8 status, unsigned int rsoffset, gboolean using_rs ) {
3414
3415         guint8           octet1         = 0;
3416         guint8           octet2         = 0;
3417         guint8           pitch          = 0;
3418         const gchar     *status_str     = NULL;
3419         proto_item      *command_item   = NULL;
3420         proto_tree      *command_tree   = NULL;
3421
3422         status_str = val_to_str( status >> 4, rtp_midi_channel_status, rtp_midi_unknown_value_hex );
3423
3424         /* broken: we have no further data */
3425         if ( !cmd_len ) {
3426                 /* this should never happen */
3427                 if ( using_rs ) {
3428                         command_item = proto_tree_add_text( tree, tvb, offset, 0, "TRUNCATED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3429                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3430                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3431                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3432
3433                 } else {
3434                         command_item = proto_tree_add_text( tree, tvb, offset - 1, 1, "TRUNCATED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3435                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3436                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3437                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3438                         }
3439                 return -1;
3440         }
3441
3442         octet1 = tvb_get_guint8( tvb, offset );
3443
3444         /* seems to be an aborted MIDI-command */
3445         if ( octet1 & RTP_MIDI_COMMAND_STATUS_FLAG ) {
3446                 /* this should never happen */
3447                 if ( using_rs ) {
3448                         command_item = proto_tree_add_text( tree, tvb, offset, 0, "ABORTED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3449                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3450                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3451                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3452
3453                 } else {
3454                         command_item = proto_tree_add_text( tree, tvb, offset - 1, 1, "ABORTED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3455                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3456                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3457                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3458                         }
3459                 return -1;
3460         }
3461
3462         /* broken: we have only one further octet */
3463         if ( cmd_len < 2 ) {
3464                 if ( using_rs ) {
3465                         command_item = proto_tree_add_text( tree, tvb, offset, 1, "TRUNCATED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3466                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command);
3467                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3468                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3469                         proto_tree_add_item( command_tree, hf_rtp_midi_pitch_bend_truncated, tvb, offset, 1, ENC_BIG_ENDIAN );
3470
3471                 } else {
3472                         command_item = proto_tree_add_text( tree, tvb, offset - 1, 2, "TRUNCATED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3473                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3474                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3475                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3476                         proto_tree_add_item( command_tree, hf_rtp_midi_pitch_bend_truncated, tvb, offset, 1, ENC_BIG_ENDIAN );
3477                         }
3478                 return -1;
3479         }
3480
3481         octet2 = tvb_get_guint8( tvb, offset + 1 );
3482
3483         /* seems to be an aborted MIDI-command */
3484         if ( octet2  & RTP_MIDI_COMMAND_STATUS_FLAG ) {
3485                 if ( using_rs ) {
3486                         command_item = proto_tree_add_text( tree, tvb, offset, 1, "ABORTED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3487                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command);
3488                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3489                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3490                         proto_tree_add_item( command_tree, hf_rtp_midi_pitch_bend_truncated, tvb, offset, 1, ENC_BIG_ENDIAN );
3491
3492                 } else {
3493                         command_item = proto_tree_add_text( tree, tvb, offset - 1, 2, "ABORTED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3494                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3495                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3496                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3497                         proto_tree_add_item( command_tree, hf_rtp_midi_pitch_bend_truncated, tvb, offset, 1, ENC_BIG_ENDIAN );
3498                         }
3499                 return -1;
3500         }
3501
3502         pitch = ( octet1 << 7 ) | octet2;
3503
3504         if ( using_rs ) {
3505                 command_item = proto_tree_add_text( tree, tvb, offset, 2, "%s (c=%d, pb=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, pitch );
3506                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command);
3507                 proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3508                 proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3509                 proto_tree_add_item( command_tree, hf_rtp_midi_pitch_bend, tvb, offset, 2, ENC_BIG_ENDIAN );
3510         } else {
3511                 command_item = proto_tree_add_text(tree, tvb, offset - 1, 3, "%s (c=%d, pb=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, pitch );
3512                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3513                 proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3514                 proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3515                 proto_tree_add_item( command_tree, hf_rtp_midi_pitch_bend, tvb, offset, 2, ENC_BIG_ENDIAN );
3516         }
3517
3518         if ( cmd_count ) {
3519                 col_append_fstr(pinfo->cinfo, COL_INFO,", %s (c=%d, pb=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, pitch );
3520         } else {
3521                 col_append_fstr(pinfo->cinfo, COL_INFO, "%s (c=%d, pb=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, pitch );
3522         }
3523         return 2;
3524 }
3525
3526
3527
3528
3529 /*
3530  * Here program_change is decoded.
3531  */
3532 static int
3533 decode_program_change(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned int cmd_count, unsigned int offset, unsigned int cmd_len, guint8 status, unsigned int rsoffset, gboolean using_rs ) {
3534
3535         guint8           program        = 0;
3536         const gchar     *status_str     = NULL;
3537         proto_item      *command_item   = NULL;
3538         proto_tree      *command_tree   = NULL;
3539
3540         status_str = val_to_str( status >> 4, rtp_midi_channel_status, rtp_midi_unknown_value_hex );
3541
3542         /* broken: we have no further data */
3543         if ( !cmd_len ) {
3544                 /* this should never happen */
3545                 if ( using_rs ) {
3546                         command_item = proto_tree_add_text( tree, tvb, offset, 0, "TRUNCATED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3547                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3548                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3549                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3550
3551                 } else {
3552                         command_item = proto_tree_add_text( tree, tvb, offset - 1, 1, "TRUNCATED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1);
3553                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3554                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3555                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3556                         }
3557                 return -1;
3558         }
3559
3560         program = tvb_get_guint8( tvb, offset );
3561
3562         /* seems to be an aborted MIDI-command */
3563         if ( program  & RTP_MIDI_COMMAND_STATUS_FLAG ) {
3564                 /* this should never happen */
3565                 if ( using_rs ) {
3566                         command_item = proto_tree_add_text( tree, tvb, offset, 0, "ABORTED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3567                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3568                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3569                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3570
3571                 } else {
3572                         command_item = proto_tree_add_text( tree, tvb, offset - 1, 1, "ABORTED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1);
3573                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3574                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3575                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3576                         }
3577                 return -1;
3578         }
3579
3580
3581         if ( using_rs ) {
3582                 command_item = proto_tree_add_text( tree, tvb, offset, 1, "%s (c=%d, p=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, program );
3583                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command);
3584                 proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3585                 proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3586                 proto_tree_add_item( command_tree, hf_rtp_midi_program, tvb, offset, 1, ENC_BIG_ENDIAN );
3587         } else {
3588                 command_item = proto_tree_add_text(tree, tvb, offset - 1, 2, "%s (c=%d, p=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, program );
3589                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3590                 proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3591                 proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3592                 proto_tree_add_item( command_tree, hf_rtp_midi_program, tvb, offset, 1, ENC_BIG_ENDIAN);
3593         }
3594
3595         if ( cmd_count ) {
3596                 col_append_fstr(pinfo->cinfo, COL_INFO,", %s (c=%d, p=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, program );
3597         } else {
3598                 col_append_fstr(pinfo->cinfo, COL_INFO, "%s (c=%d, p=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, program );
3599         }
3600
3601
3602 return 1;
3603 }
3604
3605
3606
3607 /*
3608  * Here control change is decoded.
3609  */
3610 static int
3611 decode_control_change(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned int cmd_count, unsigned int offset, unsigned int cmd_len, guint8 status, unsigned int rsoffset, gboolean using_rs ) {
3612
3613         guint8           controller     = 0;
3614         guint8           value          = 0;
3615         const gchar     *status_str     = NULL;
3616         const gchar     *ctrl_str       = NULL;
3617         proto_item      *command_item   = NULL;
3618         proto_tree      *command_tree   = NULL;
3619
3620         status_str = val_to_str( status >> 4, rtp_midi_channel_status, rtp_midi_unknown_value_hex );
3621
3622         /* broken: we have no further data */
3623         if ( !cmd_len ) {
3624                 /* this should never happen */
3625                 if ( using_rs ) {
3626                         command_item = proto_tree_add_text( tree, tvb, offset, 0, "TRUNCATED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3627                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3628                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3629                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3630
3631                 } else {
3632                         command_item = proto_tree_add_text( tree, tvb, offset - 1, 1, "TRUNCATED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3633                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3634                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3635                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3636                         }
3637                 return -1;
3638         }
3639
3640         controller = tvb_get_guint8( tvb, offset );
3641
3642         /* seems to be an aborted MIDI-command */
3643         if ( controller & RTP_MIDI_COMMAND_STATUS_FLAG ) {
3644                 /* this should never happen */
3645                 if ( using_rs ) {
3646                         command_item = proto_tree_add_text( tree, tvb, offset, 0, "ABORTED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3647                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3648                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3649                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3650
3651                 } else {
3652                         command_item = proto_tree_add_text( tree, tvb, offset - 1, 1, "ABORTED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3653                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3654                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3655                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3656                         }
3657                 return -1;
3658         }
3659
3660         ctrl_str = val_to_str( controller, rtp_midi_controller_values, "Unknown: %d" );
3661
3662         /* broken: we have only one further octet */
3663         if ( cmd_len < 2 ) {
3664                 if ( using_rs ) {
3665                         command_item = proto_tree_add_text( tree, tvb, offset, 1, "TRUNCATED: %s (c=%d, ctrl=%s)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, ctrl_str );
3666                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command);
3667                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3668                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3669                         proto_tree_add_item( command_tree, hf_rtp_midi_note, tvb, offset, 1, ENC_BIG_ENDIAN );
3670
3671                 } else {
3672                         command_item = proto_tree_add_text( tree, tvb, offset - 1, 2, "TRUNCATED: %s (c=%d, ctrl=%s)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, ctrl_str );
3673                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3674                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3675                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3676                         proto_tree_add_item( command_tree, hf_rtp_midi_note, tvb, offset, 1, ENC_BIG_ENDIAN );
3677                         }
3678                 return -1;
3679         }
3680
3681         value = tvb_get_guint8( tvb, offset + 1 );
3682
3683         /* seems to be an aborted MIDI-command */
3684         if ( value  & RTP_MIDI_COMMAND_STATUS_FLAG ) {
3685                 if ( using_rs ) {
3686                         command_item = proto_tree_add_text( tree, tvb, offset, 1, "ABORTED: %s (c=%d, ctrl=%s)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, ctrl_str );
3687                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command);
3688                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3689                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3690                         proto_tree_add_item( command_tree, hf_rtp_midi_controller, tvb, offset, 1, ENC_BIG_ENDIAN );
3691
3692                 } else {
3693                         command_item = proto_tree_add_text( tree, tvb, offset - 1, 2, "ABORTED: %s (c=%d, ctrl=%s)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, ctrl_str );
3694                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3695                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3696                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3697                         proto_tree_add_item( command_tree, hf_rtp_midi_controller, tvb, offset, 1, ENC_BIG_ENDIAN );
3698                         }
3699                 return -1;
3700         }
3701
3702
3703         if ( using_rs ) {
3704                 command_item = proto_tree_add_text( tree, tvb, offset, 2, "%s (c=%d, ctrl=%s, v=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, ctrl_str, value );
3705                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command);
3706                 proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3707                 proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3708                 proto_tree_add_item( command_tree, hf_rtp_midi_controller, tvb, offset, 1, ENC_BIG_ENDIAN );
3709                 proto_tree_add_item( command_tree, hf_rtp_midi_controller_value, tvb, offset + 1, 1, ENC_BIG_ENDIAN );
3710         } else {
3711                 command_item = proto_tree_add_text(tree, tvb, offset - 1, 3, "%s (c=%d, ctrl=%s, v=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, ctrl_str, value );
3712                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3713                 proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3714                 proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3715                 proto_tree_add_item( command_tree, hf_rtp_midi_controller, tvb, offset, 1, ENC_BIG_ENDIAN );
3716                 proto_tree_add_item( command_tree, hf_rtp_midi_controller_value, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
3717         }
3718
3719         if ( cmd_count ) {
3720                 col_append_fstr(pinfo->cinfo, COL_INFO,", %s (c=%d, ctrl=%s, p=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, ctrl_str, value );
3721         } else {
3722                 col_append_fstr(pinfo->cinfo, COL_INFO, "%s (c=%d, ctrl=%s, p=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, ctrl_str, value );
3723         }
3724         return 2;
3725 }
3726
3727
3728 /*
3729  * Here a Sysex-Common Non-Realtime Sample Dump Header command is decoded.
3730  */
3731 static unsigned int
3732 decode_sysex_common_nrt_sd_hdr( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
3733         int              consumed       = 0;
3734
3735         if ( data_len < 2 )
3736                 return -1;
3737
3738         /* sample number */
3739         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_header_sn, tvb, offset, 2, ENC_BIG_ENDIAN );
3740         offset += 2;
3741         data_len -= 2;
3742         consumed += 2;
3743
3744         if ( data_len < 1 )
3745                 return -1;
3746
3747         /* sample format */
3748         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_header_sf, tvb, offset, 1, ENC_BIG_ENDIAN );
3749         offset++;
3750         data_len--;
3751         consumed++;
3752
3753         if ( data_len < 3 )
3754                 return -1;
3755
3756         /* sample period */
3757         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_header_sp, tvb, offset, 3, ENC_BIG_ENDIAN );
3758         offset += 3;
3759         data_len -= 3;
3760         consumed += 3;
3761
3762         if ( data_len < 3 )
3763                 return -1;
3764
3765         /* sample length */
3766         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_header_sl, tvb, offset, 3, ENC_BIG_ENDIAN );
3767         offset += 3;
3768         data_len -= 3;
3769         consumed += 3;
3770
3771         if ( data_len < 3 )
3772                 return -1;
3773
3774         /* loop start */
3775         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_header_ls, tvb, offset, 3, ENC_BIG_ENDIAN );
3776         offset += 3;
3777         data_len -= 3;
3778         consumed += 3;
3779
3780         if ( data_len < 3 )
3781                 return -1;
3782
3783         /* loop end */
3784         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_header_le, tvb, offset, 3, ENC_BIG_ENDIAN );
3785         offset += 3;
3786         data_len -= 3;
3787         consumed += 3;
3788
3789         if ( data_len < 1 )
3790                 return -1;
3791
3792         /* loop type */
3793         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_header_lt, tvb, offset, 1, ENC_BIG_ENDIAN );
3794         offset++;
3795         data_len--;
3796         consumed++;
3797
3798         return consumed;
3799 }
3800
3801 /*
3802  * Here a Sysex-Common Non-Realtime Sample Dump Packet command is decoded.
3803  */
3804 static unsigned int
3805 decode_sysex_common_nrt_sd_packet( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
3806         int              consumed       = 0;
3807
3808         if ( data_len < 1 )
3809                 return -1;
3810
3811         /* sample number */
3812         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_packet_count, tvb, offset, 1, ENC_BIG_ENDIAN );
3813         offset++;
3814         data_len--;
3815         consumed++;
3816
3817         /* do we have sample-data? */
3818         if ( data_len > 1 ) {
3819
3820                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_packet_data, tvb, offset, data_len - 1, ENC_NA );
3821
3822                 offset += ( data_len - 1 );
3823                 data_len -= ( data_len - 1 );
3824                 consumed += ( data_len -1 );
3825         }
3826
3827         /* do we have data for the checksum! */
3828         if ( data_len < 1 )
3829                 return -1;
3830
3831         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_packet_check, tvb, offset, 1, ENC_BIG_ENDIAN );
3832         offset++;
3833         data_len--;
3834         consumed++;
3835
3836         return consumed;
3837 }
3838
3839 /*
3840  * Here a Sysex-Common Non-Realtime Sample Dump Request command is decoded.
3841  */
3842 static unsigned int
3843 decode_sysex_common_nrt_sd_req( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
3844         int              consumed       = 0;
3845
3846         if ( data_len < 2 )
3847                 return -1;
3848
3849         /* sample number */
3850         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_header_sn, tvb, offset, 2, ENC_BIG_ENDIAN );
3851         offset += 2;
3852         data_len -= 2;
3853         consumed += 2;
3854
3855         return consumed;
3856 }
3857
3858
3859 /*
3860  * Here a Sysex-Common Non-Realtime Sample Dump Extension command is decoded.
3861  */
3862 static unsigned int
3863 decode_sysex_common_nrt_sd_ext( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
3864         guint8           sub_id         = 0;
3865         int              consumed       = 0;
3866
3867         if ( data_len < 1 )
3868                 return consumed;
3869
3870         /* first we retrieve the sub-command */
3871         sub_id = tvb_get_guint8( tvb, offset );
3872         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_ext, tvb, offset, 1, ENC_BIG_ENDIAN );
3873         offset++;
3874         data_len--;
3875         consumed++;
3876
3877         if ( sub_id == RTP_MIDI_SYSEX_COMMON_NRT_SD_EXT_LOOP_POINT_TRANSMISSION ) {
3878
3879                 if ( data_len < 2 )
3880                         return -1;
3881
3882                 /* sample number */
3883                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_header_sn, tvb, offset, 2, ENC_BIG_ENDIAN );
3884                 offset += 2;
3885                 data_len -= 2;
3886                 consumed += 2;
3887
3888                 if ( data_len < 2 )
3889                         return -1;
3890
3891                 /* loop number */
3892                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_ext_ln, tvb, offset, 2, ENC_BIG_ENDIAN );
3893                 offset += 2;
3894                 data_len -= 2;
3895                 consumed += 2;
3896
3897                 if ( data_len < 1 )
3898                         return -1;
3899
3900                 /* loop type */
3901                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_header_lt, tvb, offset, 1, ENC_BIG_ENDIAN );
3902                 offset++;
3903                 data_len--;
3904                 consumed++;
3905
3906                 if ( data_len < 3 )
3907                         return -1;
3908
3909                 /* loop start */
3910                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_header_ls, tvb, offset, 3, ENC_BIG_ENDIAN );
3911                 offset += 3;
3912                 data_len -= 3;
3913                 consumed += 3;
3914
3915                 if ( data_len < 3 )
3916                         return -1;
3917
3918                 /* loop end */
3919                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_header_le, tvb, offset, 3, ENC_BIG_ENDIAN );
3920                 offset += 3;
3921                 data_len -= 3;
3922                 consumed += 3;
3923
3924         } else if ( sub_id == RTP_MIDI_SYSEX_COMMON_NRT_SD_EXT_LOOP_POINTS_REQUEST ) {
3925
3926                 if ( data_len < 2 )
3927                         return -1;
3928
3929                 /* sample number */
3930                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_header_sn, tvb, offset, 2, ENC_BIG_ENDIAN );
3931                 offset += 2;
3932                 data_len -= 2;
3933                 consumed += 2;
3934
3935                 if ( data_len < 2 )
3936                         return -1;
3937
3938                 /* loop number */
3939                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_ext_ln, tvb, offset, 2, ENC_BIG_ENDIAN );
3940                 offset += 2;
3941                 data_len -= 2;
3942                 consumed += 2;
3943
3944         };
3945
3946         return consumed;
3947 }
3948
3949 /*
3950  * Here a Sysex-Common Non-Realtime General Information command is decoded.
3951  */
3952 static unsigned int
3953 decode_sysex_common_nrt_gi( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
3954         guint8           sub_id         = 0;
3955         guint8           manu_short     = 0;
3956         int              consumed       = 0;
3957
3958         if ( data_len < 1 )
3959                 return consumed;
3960
3961         /* first we retrieve the sub-command */
3962         sub_id = tvb_get_guint8( tvb, offset );
3963         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_gi, tvb, offset, 1, ENC_BIG_ENDIAN );
3964         offset++;
3965         data_len--;
3966         consumed++;
3967
3968
3969         /* This is the only sub-command that we know that we can decode,
3970          * the Identity Request has already been decoded up to this point. */
3971         if ( sub_id != RTP_MIDI_SYSEX_COMMON_NRT_GI_IDENTITY_REQUEST ) {
3972
3973                 /* nothing more to do... */
3974
3975         } else if ( sub_id == RTP_MIDI_SYSEX_COMMON_NRT_GI_IDENTITY_REPLY ) {
3976
3977                 if ( data_len < 1 ) {
3978                         return consumed;
3979                 }
3980
3981                 /* the manu-id should follow */
3982                 proto_tree_add_item( tree, hf_rtp_midi_manu_short, tvb, offset, 1, ENC_BIG_ENDIAN );
3983                 manu_short = tvb_get_guint8( tvb, offset );
3984                 offset++;
3985                 data_len--;
3986                 consumed++;
3987
3988                 /* possibly escaped to be a long manu-id */
3989                 if ( manu_short == RTP_MIDI_MANU_SHORT_ISLONG ) {
3990                         if ( data_len < 2 ) {
3991                                 return consumed;
3992                         }
3993                         proto_tree_add_item( tree, hf_rtp_midi_manu_long, tvb, offset, 2, ENC_BIG_ENDIAN );
3994                         offset +=2 ;
3995                         data_len -= 2;
3996                         consumed += 2;
3997                 }
3998
3999                 /* lets see if we can get the device family for this unit */
4000                 if ( data_len < 2 ) {
4001                         return consumed;
4002                 }
4003                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_gi_device_family, tvb, offset, 2, ENC_BIG_ENDIAN );
4004                 offset +=2 ;
4005                 data_len -= 2;
4006                 consumed += 2;
4007
4008                 /* ...also get the detailed member of this family... */
4009                 if ( data_len < 2 ) {
4010                         return consumed;
4011                 }
4012                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_gi_device_family_member, tvb, offset, 2, ENC_BIG_ENDIAN );
4013                 offset +=2 ;
4014                 data_len -= 2;
4015                 consumed += 2;
4016
4017                 /* and even the software-revision-level */
4018                 if ( data_len < 4 ) {
4019                         return consumed;
4020                 }
4021                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_gi_software_rev, tvb, offset, 4, ENC_BIG_ENDIAN );
4022                 offset +=4 ;
4023                 data_len -= 4;
4024                 consumed += 4;
4025         };
4026
4027         return consumed;
4028 }
4029
4030 /*
4031  * Here a Sysex-Common Non-Realtime File Dump command is decoded.
4032  */
4033 static unsigned int
4034 decode_sysex_common_nrt_fd( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
4035         guint8           sub_id         = 0;
4036         int              consumed       = 0;
4037
4038         if ( data_len < 1 )
4039                 return consumed;
4040
4041         /* first we retrieve the sub-command */
4042         sub_id = tvb_get_guint8( tvb, offset );
4043         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_fd, tvb, offset, 1, ENC_BIG_ENDIAN );
4044         offset++;
4045         data_len--;
4046         consumed++;
4047
4048         if ( sub_id == RTP_MIDI_SYSEX_COMMON_NRT_FD_HEADER ) {
4049
4050                 if ( data_len < 1 )
4051                         return -1;
4052
4053                 /* type */
4054                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_fd_device_id, tvb, offset, 1, ENC_BIG_ENDIAN );
4055                 offset++;
4056                 data_len--;
4057                 consumed++;
4058
4059                 if ( data_len < 4 )
4060                         return -1;
4061
4062                 /* file type */
4063                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_fd_type, tvb, offset, 4, ENC_ASCII|ENC_NA );
4064                 offset += 4;
4065                 data_len -= 4;
4066                 consumed += 4;
4067
4068                 if ( data_len < 4 )
4069                         return -1;
4070
4071                 /* file length */
4072                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_fd_length, tvb, offset, 4, ENC_BIG_ENDIAN );
4073                 offset += 4;
4074                 data_len -= 4;
4075                 consumed += 4;
4076
4077                 if ( data_len ) {
4078
4079                         /* file-name */
4080                         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_fd_name, tvb, offset, data_len, ENC_ASCII|ENC_NA );
4081                         offset += data_len;
4082                         data_len -= data_len;
4083                         consumed += data_len;
4084                 }
4085
4086         } else if ( sub_id == RTP_MIDI_SYSEX_COMMON_NRT_FD_DATA_PACKET ) {
4087
4088                 if ( data_len < 1 )
4089                         return -1;
4090
4091                 /* packet-num */
4092                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_fd_packet_num, tvb, offset, 1, ENC_BIG_ENDIAN );
4093                 offset++;
4094                 data_len--;
4095                 consumed++;
4096
4097                 if ( data_len < 1 )
4098                         return -1;
4099
4100                 /* byte count */
4101                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_fd_byte_count, tvb, offset, 1, ENC_BIG_ENDIAN );
4102                 offset++;
4103                 data_len--;
4104                 consumed++;
4105
4106                 /* do we have file-data? */
4107                 if ( data_len > 1 ) {
4108
4109                         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_fd_packet_data, tvb, offset, data_len - 1, ENC_NA );
4110
4111                         offset += ( data_len - 1 );
4112                         data_len -= ( data_len - 1 );
4113                         consumed += ( data_len -1 );
4114                 }
4115
4116                 /* do we have data for the checksum? */
4117                 if ( data_len < 1 )
4118                         return -1;
4119
4120                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_fd_checksum, tvb, offset, 1, ENC_BIG_ENDIAN );
4121                 offset++;
4122                 data_len--;
4123                 consumed++;
4124
4125         } else if ( sub_id == RTP_MIDI_SYSEX_COMMON_NRT_FD_REQUEST ) {
4126
4127                 if ( data_len < 1 )
4128                         return -1;
4129
4130                 /* type */
4131                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_fd_device_id, tvb, offset, 1, ENC_BIG_ENDIAN );
4132                 offset++;
4133                 data_len--;
4134                 consumed++;
4135
4136                 if ( data_len < 4 )
4137                         return -1;
4138
4139                 /* file type */
4140                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_fd_type, tvb, offset, 4, ENC_ASCII|ENC_NA );
4141                 offset += 4;
4142                 data_len -= 4;
4143                 consumed += 4;
4144
4145                 if ( data_len ) {
4146
4147                         /* file-name */
4148                         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_fd_name, tvb, offset, data_len, ENC_ASCII|ENC_NA );
4149                         offset += data_len;
4150                         data_len -= data_len;
4151                         consumed += data_len;
4152                 }
4153         }
4154
4155         return consumed;
4156 }
4157
4158 /*
4159  * Here a Sysex-Common (Non-)Realtime MIDI Tuning Standard command is decoded.
4160  * As the code-points do not overlap, both RT and NRT are decoded here...
4161  */
4162 static unsigned int
4163 decode_sysex_common_tuning( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
4164
4165         proto_item      *tune_item      = NULL;
4166         proto_tree      *tune_tree      = NULL;
4167         const gchar     *note_str       = NULL;
4168         guint8           sub_id         = 0;
4169         guint8           changes        = 0;
4170         guint8           note           = 0;
4171         int              consumed       = 0;
4172         unsigned int     i;
4173
4174         if ( data_len < 1 )
4175                 return consumed;
4176
4177         /* first we retrieve the sub-command */
4178         sub_id = tvb_get_guint8( tvb, offset );
4179         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_tuning, tvb, offset, 1, ENC_BIG_ENDIAN );
4180         offset++;
4181         data_len--;
4182         consumed++;
4183
4184         if ( sub_id == RTP_MIDI_SYSEX_COMMON_TUNING_BULK_DUMP_REQUEST ) {
4185
4186                 if ( data_len < 1 )
4187                         return -1;
4188
4189                 /* type */
4190                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_tune_program, tvb, offset, 1, ENC_BIG_ENDIAN );
4191                 offset++;
4192                 data_len--;
4193                 consumed++;
4194
4195         } else if ( sub_id == RTP_MIDI_SYSEX_COMMON_TUNING_BULK_DUMP_REPLY ) {
4196
4197                 if ( data_len < 1 )
4198                         return -1;
4199
4200                 /* type */
4201                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_tune_program, tvb, offset, 1, ENC_BIG_ENDIAN );
4202                 offset++;
4203                 data_len--;
4204                 consumed++;
4205
4206                 if ( data_len < 16 )
4207                         return -1;
4208
4209                 /* file length */
4210                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_tune_name, tvb, offset, 16, ENC_ASCII|ENC_NA );
4211                 offset += 16;
4212                 data_len -= 16;
4213                 consumed += 16;
4214
4215                 for ( i=0; i < 128; i++ ) {
4216
4217                         if ( data_len < 3 )
4218                                 return -1;
4219
4220                         note_str = val_to_str( i, rtp_midi_note_values, rtp_midi_unknown_value_dec );
4221
4222                         tune_item = proto_tree_add_text(tree, tvb, offset, 3, "Note: %s", note_str );
4223                         tune_tree = proto_item_add_subtree( tune_item, ett_rtp_midi_sysex_common_tune_note );
4224
4225                         /* frequency */
4226                         proto_tree_add_item( tune_tree, hf_rtp_midi_sysex_common_tune_freq, tvb, offset, 3, ENC_BIG_ENDIAN );
4227
4228                         offset += 3;
4229                         data_len -= 3;
4230                         consumed += 3;
4231
4232                 }
4233
4234                 if ( data_len < 1 )
4235                         return -1;
4236
4237                 /* checksum */
4238                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_tune_checksum, tvb, offset, 1, ENC_BIG_ENDIAN );
4239                 offset++;
4240                 data_len--;
4241                 consumed++;
4242
4243         } else if ( sub_id == RTP_MIDI_SYSEX_COMMON_TUNING_NOTE_CHANGE ) {
4244
4245                 if ( data_len < 1 )
4246                         return -1;
4247
4248                 /* type */
4249                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_tune_program, tvb, offset, 1, ENC_BIG_ENDIAN );
4250                 offset++;
4251                 data_len--;
4252                 consumed++;
4253
4254                 if ( data_len < 1 )
4255                         return -1;
4256
4257                 /* changes */
4258                 changes = tvb_get_guint8( tvb, offset );
4259                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_tune_changes, tvb, offset, 1, ENC_BIG_ENDIAN );
4260                 offset++;
4261                 data_len--;
4262                 consumed++;
4263
4264                 for ( i=0; i < changes; i++ ) {
4265
4266                         if ( data_len < 4 )
4267                                 return -1;
4268
4269                         note = tvb_get_guint8( tvb, offset );
4270
4271                         note_str = val_to_str( note, rtp_midi_note_values, rtp_midi_unknown_value_dec );
4272
4273                         tune_item = proto_tree_add_text(tree, tvb, offset, 3, "Note: %s", note_str );
4274                         tune_tree = proto_item_add_subtree( tune_item, ett_rtp_midi_sysex_common_tune_note );
4275
4276                         /* note */
4277                         proto_tree_add_item( tune_tree, hf_rtp_midi_sysex_common_tune_note, tvb, offset, 1, ENC_BIG_ENDIAN );
4278                         offset++;
4279                         data_len--;
4280                         consumed++;
4281
4282                         /* frequency */
4283                         proto_tree_add_item( tune_tree, hf_rtp_midi_sysex_common_tune_freq, tvb, offset, 3, ENC_BIG_ENDIAN );
4284
4285                         offset += 3;
4286                         data_len -= 3;
4287                         consumed += 3;
4288
4289                 }
4290
4291         }
4292
4293         return consumed;
4294 }
4295
4296 /*
4297  * Here a Sysex-Common Non-Realtime General MIDI command is decoded.
4298  */
4299 static unsigned int
4300 decode_sysex_common_nrt_gm( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
4301         guint8           sub_id         = 0;
4302         int              consumed       = 0;
4303
4304         if ( data_len < 1 )
4305                 return consumed;
4306
4307         /* first we retrieve the sub-command */
4308         sub_id = tvb_get_guint8( tvb, offset );
4309         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_gm, tvb, offset, 1, ENC_BIG_ENDIAN );
4310         offset++;
4311         data_len--;
4312         consumed++;
4313
4314         return consumed;
4315 }
4316
4317 /*
4318  * Here a Sysex-Common Non-Realtime Downloadable Sounds command is decoded.
4319  */
4320 static unsigned int
4321 decode_sysex_common_nrt_dls( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
4322         guint8           sub_id         = 0;
4323         int              consumed       = 0;
4324
4325         if ( data_len < 1 )
4326                 return consumed;
4327
4328         /* first we retrieve the sub-command */
4329         sub_id = tvb_get_guint8( tvb, offset );
4330         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_dls, tvb, offset, 1, ENC_BIG_ENDIAN );
4331         offset++;
4332         data_len--;
4333         consumed++;
4334
4335         return consumed;
4336 }
4337
4338 /*
4339  * Here a Sysex-Common Non-Realtime End Of File command is decoded.
4340  */
4341 static unsigned int
4342 decode_sysex_common_nrt_eof( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
4343         int              consumed       = 0;
4344
4345         if ( data_len < 1 )
4346                 return consumed;
4347
4348         /* we only have a packet-number */
4349         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_packet_number, tvb, offset, 1, ENC_BIG_ENDIAN );
4350         offset++;
4351         data_len--;
4352         consumed++;
4353
4354         return consumed;
4355 }
4356
4357 /*
4358  * Here a Sysex-Common Non-Realtime Wait command is decoded.
4359  */
4360 static unsigned int
4361 decode_sysex_common_nrt_wait( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
4362         int              consumed       = 0;
4363
4364         if ( data_len < 1 )
4365                 return consumed;
4366
4367         /* we only have a packet-number */
4368         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_packet_number, tvb, offset, 1, ENC_BIG_ENDIAN );
4369         offset++;
4370         data_len--;
4371         consumed++;
4372
4373         return consumed;
4374 }
4375
4376 /*
4377  * Here a Sysex-Common Non-Realtime Cancel command is decoded.
4378  */
4379 static unsigned int
4380 decode_sysex_common_nrt_cancel( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
4381         int              consumed       = 0;
4382
4383         if ( data_len < 1 )
4384                 return consumed;
4385
4386         /* we only have a packet-number */
4387         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_packet_number, tvb, offset, 1, ENC_BIG_ENDIAN );
4388         offset++;
4389         data_len--;
4390         consumed++;
4391
4392         return consumed;
4393 }
4394
4395 /*
4396  * Here a Sysex-Common Non-Realtime NAK command is decoded.
4397  */
4398 static unsigned int
4399 decode_sysex_common_nrt_nak( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
4400         int              consumed       = 0;
4401
4402         if ( data_len < 1 )
4403                 return consumed;
4404
4405         /* we only have a packet-number */
4406         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_packet_number, tvb, offset, 1, ENC_BIG_ENDIAN );
4407         offset++;
4408         data_len--;
4409         consumed++;
4410
4411         return consumed;
4412 }
4413
4414 /*
4415  * Here a Sysex-Common Non-Realtime ACK command is decoded.
4416  */
4417 static unsigned int
4418 decode_sysex_common_nrt_ack( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
4419         int              consumed       = 0;
4420
4421         if ( data_len < 1 )
4422                 return consumed;
4423
4424         /* we only have a packet-number */
4425         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_packet_number, tvb, offset, 1, ENC_BIG_ENDIAN );
4426         offset++;
4427         data_len--;
4428         consumed++;
4429
4430         return consumed;
4431 }
4432
4433 /*
4434  * here a sysex-common non-realtime midi time code cueing command is decoded.
4435  * as the codepoints are the same, we decode both realtime and non-realtime here.
4436  */
4437 static unsigned int
4438 decode_sysex_common_nrt_mtc( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
4439         guint8           sub_id         = 0;
4440         int              consumed       = 0;
4441
4442         if ( data_len < 1 )
4443                 return consumed;
4444
4445         /* first we retrieve the sub-command */
4446         sub_id = tvb_get_guint8( tvb, offset );
4447         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_mtc, tvb, offset, 1, ENC_BIG_ENDIAN );
4448         offset++;
4449         data_len--;
4450         consumed++;
4451
4452         if ( data_len < 1 )
4453                 return -1;
4454
4455         /* type and hours */
4456         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_mtc_type, tvb, offset, 1, ENC_BIG_ENDIAN );
4457         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_mtc_hr, tvb, offset, 1, ENC_BIG_ENDIAN );
4458         offset++;
4459         data_len--;
4460         consumed++;
4461
4462         if ( data_len < 1 )
4463                 return -1;
4464
4465         /* minutes */
4466         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_mtc_mn, tvb, offset, 1, ENC_BIG_ENDIAN );
4467         offset++;
4468         data_len--;
4469         consumed++;
4470
4471         if ( data_len < 1 )
4472                 return -1;
4473
4474         /* seconds */
4475         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_mtc_sc, tvb, offset, 1, ENC_BIG_ENDIAN );
4476         offset++;
4477         data_len--;
4478         consumed++;
4479
4480         if ( data_len < 1 )
4481                 return -1;
4482
4483         /* frames */
4484         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_mtc_fr, tvb, offset, 1, ENC_BIG_ENDIAN );
4485         offset++;
4486         data_len--;
4487         consumed++;
4488
4489         if ( data_len < 1 )
4490                 return -1;
4491
4492         /* fractional frames */
4493         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_mtc_ff, tvb, offset, 1, ENC_BIG_ENDIAN );
4494         offset++;
4495         data_len--;
4496         consumed++;
4497
4498         if ( data_len < 1 )
4499                 return -1;
4500
4501         /* event-number (lsb) */
4502         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_mtc_enl, tvb, offset, 1, ENC_BIG_ENDIAN );
4503         offset++;
4504         data_len--;
4505         consumed++;
4506
4507         if ( data_len < 1 )
4508                 return -1;
4509
4510         /* event-number (msb) */
4511         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_mtc_enm, tvb, offset, 1, ENC_BIG_ENDIAN );
4512         offset++;
4513         data_len--;
4514         consumed++;
4515
4516         if ( data_len ) {
4517
4518                 /* additional data */
4519                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_mtc_add, tvb, offset, data_len, ENC_NA );
4520                 offset += data_len;
4521                 data_len -= data_len;
4522                 consumed += data_len;
4523         }
4524
4525         return consumed;
4526 }
4527
4528 /*
4529  * Here a Sysex-Common Realtime MIDI Time Code Cueing command is decoded.
4530  * As the codepoints are the same, we decode both realtime and non-realtime here.
4531  */
4532 static unsigned int
4533 decode_sysex_common_rt_mtc_cue( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
4534         guint8           sub_id         = 0;
4535         int              consumed       = 0;
4536
4537         if ( data_len < 1 )
4538                 return consumed;
4539
4540         /* first we retrieve the sub-command */
4541         sub_id = tvb_get_guint8( tvb, offset );
4542         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_cueing, tvb, offset, 1, ENC_BIG_ENDIAN );
4543         offset++;
4544         data_len--;
4545         consumed++;
4546
4547         if ( data_len < 1 )
4548                 return -1;
4549
4550         /* event-number (lsb) */
4551         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_cue_enl, tvb, offset, 1, ENC_BIG_ENDIAN );
4552         offset++;
4553         data_len--;
4554         consumed++;
4555
4556         if ( data_len < 1 )
4557                 return -1;
4558
4559         /* event-number (msb) */
4560         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_cue_enm, tvb, offset, 1, ENC_BIG_ENDIAN );
4561         offset++;
4562         data_len--;
4563         consumed++;
4564
4565         if ( data_len ) {
4566
4567                 /* additional data */
4568                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_cue_add, tvb, offset, data_len, ENC_NA );
4569                 offset += data_len;
4570                 data_len -= data_len;
4571                 consumed += data_len;
4572         }
4573
4574         return consumed;
4575 }
4576
4577
4578
4579
4580 /*
4581  * Here a Sysex-Common Non-Realtime command is decoded.
4582  */
4583 static unsigned int
4584 decode_sysex_common_nrt( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
4585         guint8           common_nrt     = 0;
4586         guint8           device_id      = 0;
4587         const gchar     *nrt_str        = NULL;
4588         proto_item      *command_item   = NULL;
4589         proto_tree      *command_tree   = NULL;
4590         int              consumed       = 0;
4591         int              ext_consumed   = 0;
4592
4593         if ( data_len < 1 )
4594                 return consumed;
4595
4596         device_id = tvb_get_guint8( tvb, offset );
4597         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_device_id, tvb, offset, 1, ENC_BIG_ENDIAN );
4598         offset++;
4599         data_len--;
4600         consumed++;
4601
4602         if ( data_len < 1 ) {
4603                 return consumed;
4604         }
4605
4606         common_nrt = tvb_get_guint8( tvb, offset );
4607
4608         nrt_str = val_to_str( common_nrt, rtp_midi_sysex_common_nrt, "Unknown 0x%02x" );
4609
4610         command_item = proto_tree_add_text(tree, tvb, offset, data_len, "%s",nrt_str );
4611         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_sysex_common_nrt );
4612         proto_tree_add_item( command_tree, hf_rtp_midi_sysex_common_non_realtime, tvb, offset, 1, ENC_BIG_ENDIAN );
4613
4614         offset++;
4615         data_len--;
4616         consumed++;
4617
4618         switch ( common_nrt ) {
4619                 case RTP_MIDI_SYSEX_COMMON_NRT_SAMPLE_DUMP_HEADER:
4620                         ext_consumed = decode_sysex_common_nrt_sd_hdr( tvb, pinfo, command_tree, offset, data_len );
4621                         break;
4622                 case RTP_MIDI_SYSEX_COMMON_NRT_SAMPLE_DATA_PACKET:
4623                         ext_consumed = decode_sysex_common_nrt_sd_packet( tvb, pinfo, command_tree, offset, data_len );
4624                         break;
4625                 case RTP_MIDI_SYSEX_COMMON_NRT_SAMPLE_DUMP_REQUEST:
4626                         ext_consumed = decode_sysex_common_nrt_sd_req( tvb, pinfo, command_tree, offset, data_len );
4627                         break;
4628                 case RTP_MIDI_SYSEX_COMMON_NRT_MTC:
4629                         ext_consumed = decode_sysex_common_nrt_mtc( tvb, pinfo, command_tree, offset, data_len );
4630                         break;
4631                 case RTP_MIDI_SYSEX_COMMON_NRT_SAMPLE_DUMP_EXTENSIONS:
4632                         ext_consumed = decode_sysex_common_nrt_sd_ext( tvb, pinfo, command_tree, offset, data_len );
4633                         break;
4634                 case RTP_MIDI_SYSEX_COMMON_NRT_GENERAL_INFORMATION:
4635                         ext_consumed = decode_sysex_common_nrt_gi( tvb, pinfo, command_tree, offset, data_len );
4636                         break;
4637                 case RTP_MIDI_SYSEX_COMMON_NRT_FILE_DUMP:
4638                         ext_consumed = decode_sysex_common_nrt_fd( tvb, pinfo, command_tree, offset, data_len );
4639                         break;
4640                 case RTP_MIDI_SYSEX_COMMON_NRT_MIDI_TUNING_STANDARD:
4641                         ext_consumed = decode_sysex_common_tuning( tvb, pinfo, command_tree, offset, data_len );
4642                         break;
4643                 case RTP_MIDI_SYSEX_COMMON_NRT_GENERAL_MIDI:
4644                         ext_consumed = decode_sysex_common_nrt_gm( tvb, pinfo, command_tree, offset, data_len );
4645                         break;
4646                 case RTP_MIDI_SYSEX_COMMON_NRT_DOWNLOADABLE_SOUNDS:             /* ??? not in Spec */
4647                         ext_consumed = decode_sysex_common_nrt_dls( tvb, pinfo, command_tree, offset, data_len );
4648                         break;
4649                 case RTP_MIDI_SYSEX_COMMON_NRT_END_OF_FILE:
4650                         ext_consumed = decode_sysex_common_nrt_eof( tvb, pinfo, command_tree, offset, data_len );
4651                         break;
4652                 case RTP_MIDI_SYSEX_COMMON_NRT_WAIT:
4653                         ext_consumed = decode_sysex_common_nrt_wait( tvb, pinfo, command_tree, offset, data_len );
4654                         break;
4655                 case RTP_MIDI_SYSEX_COMMON_NRT_CANCEL:
4656                         ext_consumed = decode_sysex_common_nrt_cancel( tvb, pinfo, command_tree, offset, data_len );
4657                         break;
4658                 case RTP_MIDI_SYSEX_COMMON_NRT_NAK:
4659                         ext_consumed = decode_sysex_common_nrt_nak( tvb, pinfo, command_tree, offset, data_len );
4660                         break;
4661                 case RTP_MIDI_SYSEX_COMMON_NRT_ACK:
4662                         ext_consumed = decode_sysex_common_nrt_ack( tvb, pinfo, command_tree, offset, data_len );
4663                         break;
4664         }
4665
4666         if ( ext_consumed < 0 ) {
4667                 return -1;
4668         }
4669
4670         /* set our pointers correct to move past already decoded data */
4671         offset += ext_consumed;
4672         data_len -= ext_consumed;
4673         consumed += ext_consumed;
4674
4675         if ( data_len > 0 ) {
4676                 proto_tree_add_item( command_tree, hf_rtp_midi_unknown_data, tvb, offset, data_len, ENC_NA );
4677                 consumed += data_len;
4678         }
4679
4680         return consumed;
4681 }
4682
4683
4684
4685
4686
4687
4688 /*
4689  * Here a Sysex-Common Realtime MIDI Time Code command is decoded.
4690  */
4691 static unsigned int
4692 decode_sysex_common_rt_mtc( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
4693         guint8           sub_id         = 0;
4694         int              consumed       = 0;
4695
4696         if ( data_len < 1 )
4697                 return consumed;
4698
4699         /* first we retrieve the sub-command */
4700         sub_id = tvb_get_guint8( tvb, offset );
4701         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc, tvb, offset, 1, ENC_BIG_ENDIAN );
4702         offset++;
4703         data_len--;
4704         consumed++;
4705
4706         if ( sub_id == RTP_MIDI_SYSEX_COMMON_RT_MTC_FULL_MESSAGE ) {
4707
4708                 if ( data_len < 1 )
4709                         return -1;
4710
4711                 /* type and hours */
4712                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_fm_type, tvb, offset, 1, ENC_BIG_ENDIAN );
4713                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_fm_hr, tvb, offset, 1, ENC_BIG_ENDIAN );
4714                 offset++;
4715                 data_len--;
4716                 consumed++;
4717
4718                 if ( data_len < 1 )
4719                         return -1;
4720
4721                 /* minutes */
4722                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_fm_mn, tvb, offset, 1, ENC_BIG_ENDIAN );
4723                 offset++;
4724                 data_len--;
4725                 consumed++;
4726
4727                 if ( data_len < 1 )
4728                         return -1;
4729
4730                 /* seconds */
4731                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_fm_sc, tvb, offset, 1, ENC_BIG_ENDIAN );
4732                 offset++;
4733                 data_len--;
4734                 consumed++;
4735
4736                 if ( data_len < 1 )
4737                         return -1;
4738
4739                 /* frames */
4740                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_fm_fr, tvb, offset, 1, ENC_BIG_ENDIAN );
4741                 offset++;
4742                 data_len--;
4743                 consumed++;
4744
4745         } else if ( sub_id == RTP_MIDI_SYSEX_COMMON_RT_MTC_USER_BITS ) {
4746
4747                 if ( data_len < 1 )
4748                         return -1;
4749
4750                 /* U1 */
4751                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_ub_u1, tvb, offset, 1, ENC_BIG_ENDIAN );
4752                 offset++;
4753                 data_len--;
4754                 consumed++;
4755
4756                 if ( data_len < 1 )
4757                         return -1;
4758
4759                 /* U2 */
4760                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_ub_u2, tvb, offset, 1, ENC_BIG_ENDIAN );
4761                 offset++;
4762                 data_len--;
4763                 consumed++;
4764
4765                 if ( data_len < 1 )
4766                         return -1;
4767
4768                 /* U3 */
4769                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_ub_u3, tvb, offset, 1, ENC_BIG_ENDIAN );
4770                 offset++;
4771                 data_len--;
4772                 consumed++;
4773
4774                 if ( data_len < 1 )
4775                         return -1;
4776
4777                 /* U4 */
4778                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_ub_u4, tvb, offset, 1, ENC_BIG_ENDIAN );
4779                 offset++;
4780                 data_len--;
4781                 consumed++;
4782
4783                 if ( data_len < 1 )
4784                         return -1;
4785
4786                 /* U5 */
4787                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_ub_u5, tvb, offset, 1, ENC_BIG_ENDIAN );
4788                 offset++;
4789                 data_len--;
4790                 consumed++;
4791
4792                 if ( data_len < 1 )
4793                         return -1;
4794
4795                 /* U6 */
4796                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_ub_u6, tvb, offset, 1, ENC_BIG_ENDIAN );
4797                 offset++;
4798                 data_len--;
4799                 consumed++;
4800
4801                 if ( data_len < 1 )
4802                         return -1;
4803
4804                 /* U7 */
4805                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_ub_u7, tvb, offset, 1, ENC_BIG_ENDIAN );
4806                 offset++;
4807                 data_len--;
4808                 consumed++;
4809
4810                 if ( data_len < 1 )
4811                         return -1;
4812
4813                 /* U8 */
4814                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_ub_u8, tvb, offset, 1, ENC_BIG_ENDIAN );
4815                 offset++;
4816                 data_len--;
4817                 consumed++;
4818
4819                 if ( data_len < 1 )
4820                         return -1;
4821
4822                 /* U9 */
4823                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_ub_u9, tvb, offset, 1, ENC_BIG_ENDIAN );
4824                 offset++;
4825                 data_len--;
4826                 consumed++;
4827
4828         }
4829
4830         return consumed;
4831 }
4832
4833 /*
4834  * Here a Sysex-Common Realtime MIDI Show Control command is decoded.
4835  */
4836 static unsigned int
4837 decode_sysex_common_rt_sc( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
4838         guint8           sub_id         = 0;
4839         int              consumed       = 0;
4840
4841         if ( data_len < 1 )
4842                 return consumed;
4843
4844         /* first we retrieve the sub-command */
4845         sub_id = tvb_get_guint8( tvb, offset );
4846         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_sc, tvb, offset, 1, ENC_BIG_ENDIAN );
4847         offset++;
4848         data_len--;
4849         consumed++;
4850
4851         /* TODO: decode Show Control stuff */
4852         return consumed;
4853 }
4854
4855 /*
4856  * Here a Sysex-Common Realtime Notation Information command is decoded.
4857  */
4858 static unsigned int
4859 decode_sysex_common_rt_ni( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
4860         guint8           sub_id         = 0;
4861         int              consumed       = 0;
4862         int              bytes          = 0;
4863
4864         if ( data_len < 1 )
4865                 return consumed;
4866
4867         /* first we retrieve the sub-command */
4868         sub_id = tvb_get_guint8( tvb, offset );
4869         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_ni, tvb, offset, 1, ENC_BIG_ENDIAN );
4870         offset++;
4871         data_len--;
4872         consumed++;
4873
4874         if ( sub_id == RTP_MIDI_SYSEX_COMMON_RT_NT_BAR_NUMBER ) {
4875
4876                 if ( data_len < 2 )
4877                         return -1;
4878
4879                 /* bar number */
4880                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_ni_bar_num, tvb, offset, 2, ENC_BIG_ENDIAN );
4881                 offset += 2;
4882                 data_len -= 2;
4883                 consumed += 2;
4884
4885         } else if ( ( sub_id == RTP_MIDI_SYSEX_COMMON_RT_NT_TIME_SIGNATURE_IMMEDIATE ) ||
4886                         ( sub_id == RTP_MIDI_SYSEX_COMMON_RT_NT_TIME_SIGNATURE_DELAYED ) ) {
4887
4888                 if ( data_len < 1 )
4889                         return -1;
4890
4891                 /* bytes */
4892                 bytes = tvb_get_guint8( tvb, offset );
4893                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_ni_bytes, tvb, offset, 1, ENC_BIG_ENDIAN );
4894                 offset++;
4895                 data_len--;
4896                 consumed++;
4897
4898                 if ( data_len < 1 )
4899                         return -1;
4900
4901                 /* beats / numerator */
4902                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_ni_numerator, tvb, offset, 1, ENC_BIG_ENDIAN );
4903                 offset++;
4904                 data_len--;
4905                 consumed++;
4906                 bytes--;
4907
4908                 /* beats / denominator */
4909                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_ni_denominator, tvb, offset, 1, ENC_BIG_ENDIAN );
4910                 offset++;
4911                 data_len--;
4912                 consumed++;
4913                 bytes--;
4914
4915                 /* clocks */
4916                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_ni_midi_clocks, tvb, offset, 1, ENC_BIG_ENDIAN );
4917                 offset++;
4918                 data_len--;
4919                 consumed++;
4920                 bytes--;
4921
4922                 /* 32nds */
4923                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_ni_32nds, tvb, offset, 1, ENC_BIG_ENDIAN );
4924                 offset++;
4925                 data_len--;
4926                 consumed++;
4927                 bytes--;
4928
4929                 while ( bytes > 0 ) {
4930                         if ( data_len < 1 )
4931                                 return -1;
4932
4933                         /* beats / numerator */
4934                         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_ni_numerator, tvb, offset, 1, ENC_BIG_ENDIAN );
4935                         offset++;
4936                         data_len--;
4937                         consumed++;
4938                         bytes--;
4939
4940                         /* beats / denominator */
4941                         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_ni_denominator, tvb, offset, 1, ENC_BIG_ENDIAN );
4942                         offset++;
4943                         data_len--;
4944                         consumed++;
4945                         bytes--;
4946                 }
4947         }
4948
4949         return consumed;
4950 }
4951
4952 /*
4953  * Here a Sysex-Common Realtime Device Control command is decoded.
4954  */
4955 static unsigned int
4956 decode_sysex_common_rt_dc( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
4957         guint8           sub_id         = 0;
4958         int              consumed       = 0;
4959
4960         if ( data_len < 1 )
4961                 return consumed;
4962
4963         /* first we retrieve the sub-command */
4964         sub_id = tvb_get_guint8( tvb, offset );
4965         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_dc, tvb, offset, 1, ENC_BIG_ENDIAN );
4966         offset++;
4967         data_len--;
4968         consumed++;
4969
4970         if ( sub_id == RTP_MIDI_SYSEX_COMMON_RT_DC_MASTER_VOLUME ) {
4971
4972                 if ( data_len < 2 )
4973                         return -1;
4974
4975                 /* volume */
4976                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_dc_volume, tvb, offset, 2, ENC_BIG_ENDIAN );
4977                 offset += 2;
4978                 data_len -= 2;
4979                 consumed += 2;
4980
4981         } else if ( sub_id == RTP_MIDI_SYSEX_COMMON_RT_DC_MASTER_BALANCE ) {
4982
4983                 if ( data_len < 2 )
4984                         return -1;
4985
4986                 /* balance */
4987                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_dc_balance, tvb, offset, 2, ENC_BIG_ENDIAN );
4988                 offset += 2;
4989                 data_len -= 2;
4990                 consumed += 2;
4991
4992         }
4993
4994         return consumed;
4995 }
4996
4997
4998 /*
4999  * Here a Sysex-Common Realtime MIDI Machine Control command is decoded.
5000  */
5001 static unsigned int
5002 decode_sysex_common_rt_mmc_command( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
5003         guint8           sub_id         = 0;
5004         int              consumed       = 0;
5005
5006         if ( data_len < 1 )
5007                 return consumed;
5008
5009         /* first we retrieve the sub-command */
5010         sub_id = tvb_get_guint8( tvb, offset );
5011         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mmc_commands, tvb, offset, 1, ENC_BIG_ENDIAN );
5012         offset++;
5013         data_len--;
5014         consumed++;
5015
5016         /* TODO: decode MMC stuff */
5017         return consumed;
5018 }
5019
5020 /*
5021  * Here a Sysex-Common Realtime MIDI Machine Control response is decoded.
5022  */
5023 static unsigned int
5024 decode_sysex_common_rt_mmc_response( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
5025         guint8           sub_id         = 0;
5026         int              consumed       = 0;
5027
5028         if ( data_len < 1 )
5029                 return consumed;
5030
5031         /* first we retrieve the sub-command */
5032         sub_id = tvb_get_guint8( tvb, offset );
5033         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mmc_responses, tvb, offset, 1, ENC_BIG_ENDIAN );
5034         offset++;
5035         data_len--;
5036         consumed++;
5037
5038         /* TODO: decode MMC stuff */
5039         return consumed;
5040 }
5041
5042
5043
5044
5045
5046 /*
5047  * Here a Sysex-Common Realtime command is decoded.
5048  */
5049 static unsigned int
5050 decode_sysex_common_rt( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
5051         guint8           common_rt      = 0;
5052         guint8           device_id      = 0;
5053         const gchar     *rt_str         = NULL;
5054         proto_item      *command_item   = NULL;
5055         proto_tree      *command_tree   = NULL;
5056         int              consumed       = 0;
5057         int              ext_consumed   = 0;
5058
5059         if ( data_len < 1 )
5060                 return consumed;
5061
5062         device_id = tvb_get_guint8( tvb, offset );
5063         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_device_id, tvb, offset, 1, ENC_BIG_ENDIAN );
5064         offset++;
5065         data_len--;
5066         consumed++;
5067
5068         if ( data_len < 1 ) {
5069                 return consumed;
5070         }
5071
5072         common_rt = tvb_get_guint8( tvb, offset );
5073         rt_str = val_to_str( common_rt, rtp_midi_sysex_common_rt, "Unknown 0x%02x" );
5074
5075         command_item = proto_tree_add_text(tree, tvb, offset, data_len, "%s", rt_str );
5076         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_sysex_common_rt );
5077         proto_tree_add_item( command_tree, hf_rtp_midi_sysex_common_realtime, tvb, offset, 1, ENC_BIG_ENDIAN );
5078
5079         data_len--;
5080         offset++;
5081         consumed++;
5082
5083         switch ( common_rt ) {
5084                 case RTP_MIDI_SYSEX_COMMON_RT_MIDI_TIME_CODE:
5085                         ext_consumed = decode_sysex_common_rt_mtc( tvb, pinfo, command_tree, offset, data_len );
5086                         break;
5087                 case RTP_MIDI_SYSEX_COMMON_RT_MIDI_SHOW_CONTROL:
5088                         ext_consumed = decode_sysex_common_rt_sc( tvb, pinfo, command_tree, offset, data_len );
5089                         break;
5090                 case RTP_MIDI_SYSEX_COMMON_RT_NOTATION_INFORMATION:
5091                         ext_consumed = decode_sysex_common_rt_ni( tvb, pinfo, command_tree, offset, data_len );
5092                         break;
5093                 case RTP_MIDI_SYSEX_COMMON_RT_DEVICE_CONTROL:
5094                         ext_consumed = decode_sysex_common_rt_dc( tvb, pinfo, command_tree, offset, data_len );
5095                         break;
5096                 case RTP_MIDI_SYSEX_COMMON_RT_MTC_CUEING:
5097                         ext_consumed = decode_sysex_common_rt_mtc_cue( tvb, pinfo, command_tree, offset, data_len );
5098                         break;
5099                 case RTP_MIDI_SYSEX_COMMON_RT_MIDI_MACHINE_CONTROL_COMMAND:
5100                         ext_consumed = decode_sysex_common_rt_mmc_command( tvb, pinfo, command_tree, offset, data_len );
5101                         break;
5102                 case RTP_MIDI_SYSEX_COMMON_RT_MIDI_MACHINE_CONTROL_RESPONSE:
5103                         ext_consumed = decode_sysex_common_rt_mmc_response( tvb, pinfo, command_tree, offset, data_len );
5104                         break;
5105                 case RTP_MIDI_SYSEX_COMMON_RT_MIDI_TUNING_STANDARD:
5106                         ext_consumed = decode_sysex_common_tuning( tvb, pinfo, command_tree, offset, data_len );
5107                         break;
5108         }
5109
5110         if ( ext_consumed < 0 ) {
5111                 return -1;
5112         }
5113
5114         /* set our pointers correct to move past already decoded data */
5115         offset += ext_consumed;
5116         data_len -= ext_consumed;
5117         consumed += ext_consumed;
5118
5119         if ( data_len > 0 ) {
5120                 proto_tree_add_item( command_tree, hf_rtp_midi_unknown_data, tvb, offset, data_len, ENC_NA );
5121                 consumed += data_len;
5122         }
5123
5124         return consumed;
5125 }
5126
5127
5128 /*
5129  * Here a Sysex-Common Educational command is decoded.
5130  * According to the MIDI-specification, this should never be found "in the wild".
5131  * We don't know what this data encodes, so we just dump it.
5132  */
5133 static unsigned int
5134 decode_sysex_common_educational( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
5135         proto_item      *command_item   = NULL;
5136         proto_tree      *command_tree   = NULL;
5137         int              consumed       = 0;
5138
5139         if ( data_len < 1 )
5140                 return consumed;
5141
5142         command_item = proto_tree_add_text(tree, tvb, offset, data_len, RTP_MIDI_TREE_NAME_COMMAND_SYSEX_EDU );
5143         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_sysex_edu );
5144         proto_tree_add_item( command_tree, hf_rtp_midi_edu_data, tvb, offset, data_len, ENC_NA );
5145
5146         /* We consumed everything */
5147         return data_len;
5148 }
5149
5150 /*
5151  * Here a Sysex-Common Manufacturer command is decoded.
5152  * We don't know what this data encodes, so we just dump it.
5153  */
5154 static unsigned int
5155 decode_sysex_common_manufacturer( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len, unsigned int manu_code _U_) {
5156         proto_item      *command_item   = NULL;
5157         proto_tree      *command_tree   = NULL;
5158         int              consumed       = 0;
5159
5160         if ( data_len < 1 )
5161                 return consumed;
5162
5163         /* Instead of dumping, at this point we could implement to start manufacturer-specific decoding
5164          * of the sysex-data...
5165          */
5166
5167         command_item = proto_tree_add_text(tree, tvb, offset, data_len, RTP_MIDI_TREE_NAME_COMMAND_SYSEX_MANU );
5168         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_sysex_manu );
5169
5170         proto_tree_add_item( command_tree, hf_rtp_midi_manu_data, tvb, offset, data_len, ENC_NA );
5171
5172         /* We consumed everything */
5173         return data_len;
5174 }
5175
5176
5177
5178 /*
5179  * Here a Sysex-Start command is decoded.
5180  */
5181 static unsigned int
5182 decode_sysex_start(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int cmd_count, unsigned int offset, unsigned int cmd_len ) {
5183         guint8           octet          = 0;
5184         guint8           manu_short     = 0;
5185         const gchar     *status_str     = NULL;
5186         proto_item      *command_item   = NULL;
5187         proto_tree      *command_tree   = NULL;
5188         int              consumed       = 0;
5189         int              data_len       = 0;
5190         int              ext_consumed   = 0;
5191         guint16          manufacturer   = 0;
5192
5193         status_str = val_to_str( RTP_MIDI_STATUS_COMMON_SYSEX_END, rtp_midi_common_status, rtp_midi_unknown_value_hex );
5194
5195         /* we need to parse "away" data until the next command */
5196         while ( cmd_len ) {
5197                 octet = tvb_get_guint8( tvb, offset + consumed );
5198                 consumed++;
5199
5200                 /*
5201                  * lets check if we have a "normal" end -
5202                  * if so, the last status-byte is consumed
5203                  * as it belongs to the message
5204                  */
5205                 if ( octet == RTP_MIDI_STATUS_COMMON_SYSEX_END ) {
5206                         status_str = rtp_midi_common_status_sysex_segment_complete;
5207                 } else if ( octet == RTP_MIDI_STATUS_COMMON_SYSEX_START ) {
5208                         status_str = rtp_midi_common_status_sysex_segment_start;
5209                 } else if ( octet == RTP_MIDI_STATUS_COMMON_UNDEFINED_F4 ) {
5210                         status_str = rtp_midi_common_status_sysex_cancel;
5211                 }
5212
5213                 /* Is this command through? */
5214                 if ( octet & RTP_MIDI_COMMAND_STATUS_FLAG ) {
5215                         break;
5216                 }
5217         }
5218
5219         /* the unknown data we have does not include the trailing status-command */
5220         data_len = consumed - 1;
5221
5222         command_item = proto_tree_add_text(tree, tvb, offset - 1, 1 + consumed, "%s", status_str );
5223         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
5224         proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
5225
5226         /* lets see if we have enough data for the sysex-id */
5227         if ( data_len > 1 ) {
5228                 manufacturer = tvb_get_guint8( tvb, offset );
5229                 proto_tree_add_item( command_tree, hf_rtp_midi_manu_short, tvb, offset, 1, ENC_BIG_ENDIAN );
5230                 manu_short = tvb_get_guint8( tvb, offset );
5231                 offset++;
5232                 data_len--;
5233
5234                 switch( manu_short ) {
5235                         case RTP_MIDI_MANU_SHORT_NON_REALTIME_UNIVERSAL:
5236                                 ext_consumed = decode_sysex_common_nrt( tvb, pinfo, command_tree, offset, data_len );
5237                                 break;
5238                         case RTP_MIDI_MANU_SHORT_REALTIME_UNIVERSAL:
5239                                 ext_consumed = decode_sysex_common_rt( tvb, pinfo, command_tree, offset, data_len );
5240                                 break;
5241                         case RTP_MIDI_MANU_SHORT_EDUCATIONAL_USE:
5242                                 ext_consumed = decode_sysex_common_educational( tvb, pinfo, command_tree, offset, data_len );
5243                                 break;
5244                         case RTP_MIDI_MANU_SHORT_ISLONG:
5245                                 /* lets see if we have enough data to decode a long sysex-id and if we have a long id at all */
5246                                 if ( data_len > 2 ) {
5247                                         manufacturer = tvb_get_ntohs( tvb, offset );
5248                                         proto_tree_add_item( command_tree, hf_rtp_midi_manu_long, tvb, offset, 2, ENC_BIG_ENDIAN );
5249                                         offset +=2 ;
5250                                         data_len -= 2;
5251                                         ext_consumed = decode_sysex_common_manufacturer( tvb, pinfo, command_tree, offset, data_len, manufacturer );
5252                                 }  else {
5253                                         ext_consumed = -1;
5254                                 }
5255                                 break;
5256                         default:
5257                                 ext_consumed = decode_sysex_common_manufacturer( tvb, pinfo, command_tree, offset, data_len, manufacturer );
5258                                 break;
5259                 }
5260         }
5261
5262         if ( ext_consumed < 0 ) {
5263                 return -1;
5264         }
5265
5266         /* set our pointers correct to move past already decoded data */
5267         offset += ext_consumed;
5268         data_len -= ext_consumed;
5269
5270         proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset, 1, ENC_BIG_ENDIAN );
5271
5272         if ( cmd_count ) {
5273                 col_append_fstr(pinfo->cinfo, COL_INFO,", %s", status_str );
5274         } else {
5275                 col_append_str(pinfo->cinfo, COL_INFO, status_str );
5276         }
5277
5278         return consumed;
5279 }
5280
5281 /*
5282  * Here the MIDI-Time-Code (MTC) Quarter Frame command is decoded.
5283  */
5284 static int
5285 decode_mtc_quarter_frame(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int cmd_count, unsigned int offset, unsigned int cmd_len ) {
5286         guint8           value          = 0;
5287         const gchar     *status_str     = NULL;
5288         proto_item      *command_item   = NULL;
5289         proto_tree      *command_tree   = NULL;
5290
5291         status_str = val_to_str( RTP_MIDI_STATUS_COMMON_MTC_QUARTER_FRAME, rtp_midi_common_status, rtp_midi_unknown_value_hex );
5292
5293         /* broken: we have no further data */
5294         if ( !cmd_len ) {
5295                 command_item = proto_tree_add_text( tree, tvb, offset - 1, 1, "TRUNCATED: %s ", status_str );
5296                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
5297                 proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
5298                 return -1;
5299         }
5300
5301         value = tvb_get_guint8( tvb, offset );
5302
5303         /* seems to be an aborted MIDI-command */
5304         if ( value & RTP_MIDI_COMMAND_STATUS_FLAG ) {
5305                 command_item = proto_tree_add_text( tree, tvb, offset - 1, 1, "ABORTED: %s", status_str );
5306                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
5307                 proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
5308                 return -1;
5309         }
5310
5311
5312         command_item = proto_tree_add_text(tree, tvb, offset - 1, 2, "%s", status_str );
5313         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
5314         proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
5315         proto_tree_add_item( command_tree, hf_rtp_midi_quarter_frame_type, tvb, offset, 1, ENC_BIG_ENDIAN );
5316         proto_tree_add_item( command_tree, hf_rtp_midi_quarter_frame_value, tvb, offset + 1, 1, ENC_BIG_ENDIAN );
5317
5318         if ( cmd_count ) {
5319                 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", status_str );
5320         } else {
5321                 col_append_str(pinfo->cinfo, COL_INFO, status_str );
5322         }
5323         return 1;
5324 }
5325
5326 /*
5327  * Here the Song Position Pointer command is decoded.
5328  */
5329 static int
5330 decode_song_position_pointer(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int cmd_count, unsigned int offset, unsigned int cmd_len ) {
5331         guint8           octet1         = 0;
5332         guint8           octet2         = 0;
5333         guint8           position       = 0;
5334         const gchar     *status_str     = NULL;
5335         proto_item      *command_item   = NULL;
5336         proto_tree      *command_tree   = NULL;
5337
5338         status_str = val_to_str( RTP_MIDI_STATUS_COMMON_SONG_POSITION_POINTER, rtp_midi_common_status, rtp_midi_unknown_value_hex );
5339
5340         /* broken: we have no further data */
5341         if ( !cmd_len ) {
5342                 command_item = proto_tree_add_text( tree, tvb, offset - 1, 1, "TRUNCATED: %s", status_str );
5343                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
5344                 proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
5345                 return -1;
5346         }
5347
5348         octet1 = tvb_get_guint8( tvb, offset );
5349
5350         /* seems to be an aborted MIDI-command */
5351         if ( octet1 & RTP_MIDI_COMMAND_STATUS_FLAG ) {
5352                 command_item = proto_tree_add_text( tree, tvb, offset - 1, 1, "ABORTED: %s", status_str );
5353                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
5354                 proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
5355                 return -1;
5356         }
5357
5358         /* broken: we have only one further octet */
5359         if ( cmd_len < 2 ) {
5360                 command_item = proto_tree_add_text( tree, tvb, offset - 1, 2, "TRUNCATED: %s" status_str );
5361                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
5362                 proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
5363                 proto_tree_add_item( command_tree, hf_rtp_midi_spp_truncated, tvb, offset, 1, ENC_BIG_ENDIAN );
5364                 return -1;
5365         }
5366
5367         octet2 = tvb_get_guint8( tvb, offset + 1 );
5368
5369         /* seems to be an aborted MIDI-command */
5370         if ( octet2  & RTP_MIDI_COMMAND_STATUS_FLAG ) {
5371                 command_item = proto_tree_add_text( tree, tvb, offset - 1, 2, "ABORTED: %s", status_str );
5372                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
5373                 proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
5374                 proto_tree_add_item( command_tree, hf_rtp_midi_spp_truncated, tvb, offset, 1, ENC_BIG_ENDIAN );
5375                 return -1;
5376         }
5377
5378         position = ( octet1 << 7 ) | octet2;
5379
5380         command_item = proto_tree_add_text(tree, tvb, offset - 1, 3, "%s (p=%d)", status_str, position );
5381         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
5382         proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
5383         proto_tree_add_item( command_tree, hf_rtp_midi_spp, tvb, offset, 2, ENC_BIG_ENDIAN );
5384
5385         if ( cmd_count ) {
5386                 col_append_fstr(pinfo->cinfo, COL_INFO,", %s (p=%d)", status_str, position );
5387         } else {
5388                 col_append_fstr(pinfo->cinfo, COL_INFO, "%s (p=%d)", status_str, position );
5389         }
5390         return 2;
5391 }
5392
5393 /*
5394  * Here a Song-Select command is decoded.
5395  */
5396 static int
5397 decode_song_select(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int cmd_count, unsigned int offset, unsigned int cmd_len ) {
5398         guint8           song_nr        = 0;
5399         const gchar     *status_str     = NULL;
5400         proto_item      *command_item   = NULL;
5401         proto_tree      *command_tree   = NULL;
5402
5403         status_str = val_to_str( RTP_MIDI_STATUS_COMMON_SONG_SELECT, rtp_midi_common_status, rtp_midi_unknown_value_hex );
5404
5405         /* broken: we have no further data */
5406         if ( !cmd_len ) {
5407                 command_item = proto_tree_add_text( tree, tvb, offset - 1, 1, "TRUNCATED: %s", status_str );
5408                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
5409                 proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
5410                 return -1;
5411         }
5412
5413         song_nr = tvb_get_guint8( tvb, offset );
5414
5415         /* seems to be an aborted MIDI-command */
5416         if ( song_nr & RTP_MIDI_COMMAND_STATUS_FLAG ) {
5417                 command_item = proto_tree_add_text( tree, tvb, offset - 1, 1, "ABORTED: %s", status_str );
5418                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
5419                 proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
5420                 return -1;
5421         }
5422
5423         command_item = proto_tree_add_text(tree, tvb, offset - 1, 2, "%s (s=%d)", status_str, song_nr );
5424         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
5425         proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
5426         proto_tree_add_item( command_tree, hf_rtp_midi_song_select, tvb, offset, 1, ENC_BIG_ENDIAN );
5427
5428         if ( cmd_count ) {
5429                 col_append_fstr(pinfo->cinfo, COL_INFO,", %s (s=%d)", status_str, song_nr );
5430         } else {
5431                 col_append_fstr(pinfo->cinfo, COL_INFO, "%s (s=%d)", status_str, song_nr );
5432         }
5433         return 1;
5434 }
5435
5436 /*
5437  * Here the undefined common-command 0xf4 is decoded.
5438  */
5439 static int
5440 decode_undefined_f4(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int cmd_count, unsigned int offset, unsigned int cmd_len ) {
5441         guint8           octet          = 0;
5442         const gchar     *status_str     = NULL;
5443         proto_item      *command_item   = NULL;
5444         proto_tree      *command_tree   = NULL;
5445         int              consumed       = 0;
5446
5447         status_str = val_to_str( RTP_MIDI_STATUS_COMMON_UNDEFINED_F4, rtp_midi_common_status, rtp_midi_unknown_value_hex );
5448
5449         /* we need to parse "away" data until the next command */
5450         while ( cmd_len ) {
5451                 octet = tvb_get_guint8( tvb, offset + consumed );
5452                 consumed++;
5453
5454                 /* Is this command through? */
5455                 if ( octet & RTP_MIDI_COMMAND_STATUS_FLAG ) {
5456                         break;
5457                 }
5458         }
5459
5460         command_item = proto_tree_add_text(tree, tvb, offset - 1, 1 + consumed, "%s", status_str );
5461         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
5462         proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
5463         /* just add the unknown data to the tree */
5464         proto_tree_add_item( command_tree, hf_rtp_midi_unknown_data, tvb, offset, consumed, ENC_NA );
5465         proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset + consumed - 1, 1, ENC_BIG_ENDIAN );
5466
5467         if ( cmd_count ) {
5468                 col_append_fstr(pinfo->cinfo, COL_INFO,", %s", status_str );
5469         } else {
5470                 col_append_str(pinfo->cinfo, COL_INFO, status_str );
5471         }
5472         return consumed;
5473 }
5474
5475 /*
5476  * Here the undefined common-command 0xf5 is decoded.
5477  */
5478 static int
5479 decode_undefined_f5(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int cmd_count, unsigned int offset, unsigned int cmd_len ) {
5480         guint8           octet          = 0;
5481         const gchar     *status_str     = NULL;
5482         proto_item      *command_item   = NULL;
5483         proto_tree      *command_tree   = NULL;
5484         int              consumed       = 0;
5485
5486         status_str = val_to_str( RTP_MIDI_STATUS_COMMON_UNDEFINED_F5, rtp_midi_common_status, rtp_midi_unknown_value_hex );
5487
5488         /* we need to parse "away" data until the next command */
5489         while ( cmd_len ) {
5490                 octet = tvb_get_guint8( tvb, offset + consumed );
5491                 consumed++;
5492                 /* Is this command done? */
5493                 if ( octet & RTP_MIDI_COMMAND_STATUS_FLAG ) {
5494                         break;
5495                 }
5496         }
5497
5498         command_item = proto_tree_add_text(tree, tvb, offset - 1, 1 + consumed, "%s", status_str );
5499         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
5500         proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
5501         /* just add the unknown data to the tree */
5502         proto_tree_add_item( command_tree, hf_rtp_midi_unknown_data, tvb, offset, consumed, ENC_NA );
5503         proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset + consumed - 1, 1, ENC_BIG_ENDIAN );
5504
5505         if ( cmd_count ) {
5506                 col_append_fstr(pinfo->cinfo, COL_INFO,", %s", status_str );
5507         } else {
5508                 col_append_str(pinfo->cinfo, COL_INFO, status_str );
5509         }
5510         return consumed;
5511 }
5512
5513 /*
5514  * Here a Tune-Request command is decoded.
5515  */
5516 static int
5517 decode_tune_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int cmd_count, unsigned int offset, unsigned int cmd_len _U_ ) {
5518         const gchar     *status_str     = NULL;
5519         proto_item      *command_item   = NULL;
5520         proto_tree      *command_tree   = NULL;
5521
5522         status_str = val_to_str( RTP_MIDI_STATUS_COMMON_TUNE_REQUEST, rtp_midi_common_status, rtp_midi_unknown_value_hex );
5523         command_item = proto_tree_add_text(tree, tvb, offset - 1, 1, "%s", status_str );
5524         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
5525         proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
5526
5527         if ( cmd_count ) {
5528                 col_append_fstr(pinfo->cinfo, COL_INFO,", %s)", status_str );
5529         } else {
5530                 col_append_str(pinfo->cinfo, COL_INFO, status_str );
5531         }
5532         return 0;
5533 }
5534
5535 /*
5536  * Here a Sysex-End command is decoded - in RTP-MIDI this has a special semantic, it either starts a segmented Sysex-frame or a Sysex-Cancel
5537  */
5538 static int
5539 decode_sysex_end(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int cmd_count, unsigned int offset, unsigned int cmd_len ) {
5540         guint8           octet          = 0;
5541         const gchar     *status_str     = NULL;
5542         proto_item      *command_item   = NULL;
5543         proto_tree      *command_tree   = NULL;
5544         int              consumed       = 0;
5545
5546         status_str = val_to_str( RTP_MIDI_STATUS_COMMON_SYSEX_END, rtp_midi_common_status, rtp_midi_unknown_value_hex );
5547
5548         /* we need to parse "away" data until the next command */
5549         while ( cmd_len ) {
5550                 octet = tvb_get_guint8( tvb, offset + consumed );
5551                 consumed++;
5552
5553                 /*
5554                  * lets check if we have a "normal" end -
5555                  * if so, the last status-byte is consumed
5556                  * as it belongs to the message
5557                  */
5558                 if ( octet == RTP_MIDI_STATUS_COMMON_SYSEX_END ) {
5559                         status_str = rtp_midi_common_status_sysex_segment_end;
5560                 } else if ( octet == RTP_MIDI_STATUS_COMMON_SYSEX_START ) {
5561                         status_str = rtp_midi_common_status_sysex_segment;
5562                 } else if ( octet == RTP_MIDI_STATUS_COMMON_UNDEFINED_F4 ) {
5563                         status_str = rtp_midi_common_status_sysex_cancel;
5564                 }
5565
5566                 /* Is this command through? */
5567                 if ( octet & RTP_MIDI_COMMAND_STATUS_FLAG ) {
5568                         break;
5569                 }
5570         }
5571
5572         command_item = proto_tree_add_text(tree, tvb, offset - 1, 1 + consumed, "%s", status_str );
5573         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
5574         proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
5575         proto_tree_add_item( command_tree, hf_rtp_midi_unknown_data, tvb, offset, consumed - 1, ENC_NA );
5576         proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset + consumed - 1, 1, ENC_BIG_ENDIAN );
5577
5578
5579         if ( cmd_count ) {
5580                 col_append_fstr(pinfo->cinfo, COL_INFO,", %s", status_str );
5581         } else {
5582                 col_append_str(pinfo->cinfo, COL_INFO, status_str );
5583         }
5584
5585         return consumed;
5586 }
5587
5588
5589
5590 /*
5591  * Here each single MIDI-command is decoded.
5592  * The Status-octet is read and then the decoding
5593  * of the individual MIDI-commands is punted to
5594  * external decoders.
5595  */
5596
5597 static int
5598 decodemidi(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int cmd_count, unsigned int offset, unsigned int cmd_len, guint8 *runningstatus, unsigned int *rsoffset )
5599 {
5600         guint8           octet          = 0;
5601         const gchar     *valstr         = NULL;
5602         int              consumed       = 0;
5603         int              ext_consumed   = 0;
5604         gboolean         using_rs       = FALSE;
5605         proto_item      *command_item     = NULL;
5606         proto_tree      *command_tree     = NULL;
5607
5608
5609 /*      guint8          octet2;
5610         guint8          octet3;
5611         guint8          cmd;
5612         guint8          channel;
5613         proto_tree      *sysexdata_tree   = NULL;
5614         gboolean        foundend;
5615         guint16         wordvalue;
5616         char            helptext[200];
5617         char            entry[200];
5618         char            segtype[200];
5619         guint8          manu1;
5620         guint16         manu2;
5621         guint8          subid1;
5622         guint8          subid2;
5623         guint8          sysexchan;
5624         unsigned int    helpoffset;*/
5625
5626
5627         /* extra sanity check */
5628         if ( !cmd_len ) {
5629                 return -1;
5630         }
5631
5632
5633         octet = tvb_get_guint8( tvb, offset );
5634
5635
5636         /* midi realtime-data -> one octet  -- unlike serial-wired MIDI realtime-commands in RTP-MIDI will
5637          * not be intermingled with other MIDI-commands, so we handle this case right here and return */
5638         if ( octet >= 0xf8 ) {
5639                 valstr =  val_to_str( octet, rtp_midi_common_status, rtp_midi_unknown_value_hex );
5640                 command_item = proto_tree_add_text(tree, tvb, offset, 1, "%s", valstr );
5641                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command);
5642                 proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset, 1, ENC_BIG_ENDIAN );
5643
5644                 if ( cmd_count ) {
5645                         col_add_fstr(pinfo->cinfo, COL_INFO,", %s", valstr );
5646                 } else {
5647                         col_add_str(pinfo->cinfo, COL_INFO, valstr );
5648                 }
5649                 return 1;
5650         }
5651
5652
5653
5654         /* see if this first octet is a status message */
5655         if ( ( octet & RTP_MIDI_COMMAND_STATUS_FLAG ) == 0 ) {
5656                 /* if we have no running status yet -> error */
5657                 if ( ( ( *runningstatus ) & RTP_MIDI_COMMAND_STATUS_FLAG ) == 0 ) {
5658                         return -1;
5659                 }
5660                 /* our first octet is "virtual" coming from a preceding MIDI-command,
5661                  * so actually we have not really consumed anything yet */
5662                 octet = *runningstatus;
5663                 using_rs = TRUE;
5664         } else {
5665                 /* We have a "real" status-byte */
5666                 using_rs = FALSE;
5667
5668                 /* Let's see how this octet influences our running-status */
5669                 /* if we have a "normal" MIDI-command then the new status replaces the current running-status */
5670                 if ( octet < 0xf0 ) {
5671                         *rsoffset = offset ;
5672                         *runningstatus = octet;
5673                 } else {
5674                         /* system-realtime-commands maintain the current running-status
5675                          * other system-commands clear the running-status, since we
5676                          * already handled realtime, we can reset it here */
5677                         *runningstatus = 0;
5678                 }
5679
5680                 /* lets update our pointers */
5681                 consumed++;
5682                 cmd_len--;
5683                 offset++;
5684         }
5685
5686
5687
5688
5689         /* non-system MIDI-commands encode the command in the high nibble and the channel
5690          * in the low nibble - so we will take care of those cases next */
5691
5692         if ( octet < 0xf0 ) {
5693                 switch ( octet >> 4 ) {
5694                         case RTP_MIDI_STATUS_CHANNEL_NOTE_OFF:
5695                                 ext_consumed = decode_note_off( tvb, pinfo, tree, cmd_count, offset,  cmd_len, octet, *rsoffset, using_rs );
5696                                 break;
5697                         case RTP_MIDI_STATUS_CHANNEL_NOTE_ON:
5698                                 ext_consumed = decode_note_on( tvb, pinfo, tree, cmd_count, offset, cmd_len, octet, *rsoffset, using_rs );
5699                                 break;
5700                         case RTP_MIDI_STATUS_CHANNEL_POLYPHONIC_KEY_PRESSURE:
5701                                 ext_consumed = decode_poly_pressure(tvb, pinfo, tree, cmd_count, offset, cmd_len, octet, *rsoffset, using_rs );
5702                                 break;
5703                         case RTP_MIDI_STATUS_CHANNEL_CONTROL_CHANGE:
5704                                 ext_consumed = decode_control_change(tvb, pinfo, tree, cmd_count, offset, cmd_len, octet, *rsoffset, using_rs );
5705                                 break;
5706                         case RTP_MIDI_STATUS_CHANNEL_PROGRAM_CHANGE:
5707                                 ext_consumed = decode_program_change(tvb, pinfo, tree, cmd_count, offset, cmd_len, octet, *rsoffset, using_rs );
5708                                 break;
5709                         case RTP_MIDI_STATUS_CHANNEL_CHANNEL_PRESSURE:
5710                                 ext_consumed = decode_channel_pressure(tvb, pinfo, tree, cmd_count, offset, cmd_len, octet, *rsoffset, using_rs );
5711                                 break;
5712                         case RTP_MIDI_STATUS_CHANNEL_PITCH_BEND_CHANGE:
5713                                 ext_consumed = decode_pitch_bend_change(tvb, pinfo, tree, cmd_count, offset, cmd_len, octet, *rsoffset, using_rs );
5714                                 break;
5715                 }
5716                 /* external decoder informed us of error -> pass this through */
5717                 if ( ext_consumed < 0 ) {
5718                         return ext_consumed;
5719                 }
5720                 return consumed + ext_consumed;
5721         }
5722
5723         /* Here we catch the remaining system-common commands */
5724         switch ( octet ) {
5725                 case RTP_MIDI_STATUS_COMMON_SYSEX_START:
5726                         ext_consumed =  decode_sysex_start( tvb, pinfo, tree, cmd_count, offset, cmd_len );
5727                         break;
5728                 case RTP_MIDI_STATUS_COMMON_MTC_QUARTER_FRAME:
5729                         ext_consumed =  decode_mtc_quarter_frame( tvb, pinfo, tree, cmd_count, offset, cmd_len );
5730                         break;
5731                 case RTP_MIDI_STATUS_COMMON_SONG_POSITION_POINTER:
5732                         ext_consumed =  decode_song_position_pointer( tvb, pinfo, tree, cmd_count, offset, cmd_len );
5733                         break;
5734                 case RTP_MIDI_STATUS_COMMON_SONG_SELECT:
5735                         ext_consumed =  decode_song_select( tvb, pinfo, tree, cmd_count, offset, cmd_len );
5736                         break;
5737                 case RTP_MIDI_STATUS_COMMON_UNDEFINED_F4:
5738                         ext_consumed =  decode_undefined_f4( tvb, pinfo, tree, cmd_count, offset, cmd_len );
5739                         break;
5740                 case RTP_MIDI_STATUS_COMMON_UNDEFINED_F5:
5741                         ext_consumed =  decode_undefined_f5( tvb, pinfo, tree, cmd_count, offset, cmd_len );
5742                         break;
5743                 case RTP_MIDI_STATUS_COMMON_TUNE_REQUEST:
5744                         ext_consumed =  decode_tune_request( tvb, pinfo, tree, cmd_count, offset, cmd_len );
5745                         break;
5746                 case RTP_MIDI_STATUS_COMMON_SYSEX_END:
5747                         ext_consumed =  decode_sysex_end( tvb, pinfo, tree, cmd_count, offset, cmd_len );
5748                         break;
5749         }
5750         /* external decoder informed us of error -> pass this through */
5751         if ( ext_consumed < 0 ) {
5752                 return ext_consumed;
5753         }
5754         return consumed + ext_consumed;
5755 }
5756
5757
5758
5759 /*
5760  * Here the chapter c of the channel-journal is decoded.
5761  */
5762 static int
5763 decode_cj_chapter_c( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset ) {
5764         proto_item                      *ti                             = NULL;
5765         proto_tree                      *rtp_midi_cj_chapter_tree       = NULL;
5766         proto_tree                      *rtp_midi_loglist_tree          = NULL;
5767         int                              consumed                       = 0;
5768         guint8                           octet;
5769         int                              count;
5770         int                              i;
5771
5772         /* Can we at least read the length of the control changes chapter? */
5773         if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
5774                 return -1;
5775         }
5776
5777         octet = tvb_get_guint8( tvb, offset );
5778         count = octet & 0x7f;
5779
5780         /* count encoded is n+1 */
5781         count++;
5782
5783         ti = proto_tree_add_text( tree, tvb, offset, 1 + 2 * count, RTP_MIDI_TREE_NAME_CJ_CHAPTER_C );
5784         rtp_midi_cj_chapter_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_c );
5785
5786         proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_c_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
5787         proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_c_length, tvb, offset, 1, ENC_BIG_ENDIAN );
5788
5789         offset++;
5790         consumed++;
5791
5792         ti = proto_tree_add_text( rtp_midi_cj_chapter_tree, tvb, offset, count * 2, RTP_MIDI_TREE_NAME_CJ_CHAPTER_C_LOGLIST );
5793         rtp_midi_loglist_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_c_loglist );
5794
5795         for ( i = 0; i < count; i++ ) {
5796                 /* Can we still read this number/value-pair? */
5797                 if ( !tvb_bytes_exist( tvb, offset, 2 ) ) {
5798                         return -1;
5799                 }
5800
5801                 ti = proto_tree_add_text(rtp_midi_loglist_tree, tvb, offset, 2, RTP_MIDI_TREE_NAME_CJ_CHAPTER_C_LOGITEM );
5802                 ti = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_c_logitem );
5803
5804                 proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_c_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
5805                 proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_c_number, tvb, offset, 1, ENC_BIG_ENDIAN );
5806
5807                 offset++;
5808                 consumed++;
5809
5810                 octet = tvb_get_guint8( tvb, offset );
5811                 proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_c_aflag, tvb, offset, 1, ENC_BIG_ENDIAN );
5812
5813                 /* do we have a value or alternative coding? */
5814                 if ( octet & 0x80 ) {
5815                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_c_tflag, tvb, offset, 1, ENC_BIG_ENDIAN );
5816                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_c_alt, tvb, offset, 1, ENC_BIG_ENDIAN );
5817                 } else {
5818                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_c_value, tvb, offset, 1, ENC_BIG_ENDIAN );
5819                 }
5820
5821                 offset++;
5822                 consumed++;
5823         }
5824         return consumed;
5825 }
5826
5827
5828
5829 /*
5830  * Here the chapter m of the channel-journal is decoded, possibly the most complex part of the RTP-MIDI stuff ;-)
5831  */
5832 static int
5833 decode_cj_chapter_m( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset ) {
5834         proto_item                      *ti                             = NULL;
5835         proto_tree                      *rtp_midi_cj_chapter_tree       = NULL;
5836         proto_tree                      *rtp_midi_loglist_tree          = NULL;
5837         proto_tree                      *rtp_midi_loglist_item_tree     = NULL;
5838         guint16                         header;
5839         guint8                          logitemheader;
5840         int                             length;
5841         int                             logitemhdrlen;
5842         int                             logitemlen;
5843         gboolean                        no_pnum_msb;
5844         int                             consumed = 0;
5845
5846         /* Can we read this channel-journals header? */
5847         if ( !tvb_bytes_exist( tvb, offset, 2 ) ) {
5848                 return -1;
5849         }
5850
5851         /* first we need to get the flags & length of this chapter */
5852         header = tvb_get_ntohs( tvb, offset );
5853         length = header & RTP_MIDI_CJ_CHAPTER_M_MASK_LENGTH;
5854         /* take of length of header */
5855         length -= 2;
5856
5857         ti = proto_tree_add_text( tree, tvb, offset, length, RTP_MIDI_TREE_NAME_CJ_CHAPTER_M );
5858         rtp_midi_cj_chapter_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_m );
5859
5860         proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_m_sflag, tvb, offset, 2, ENC_BIG_ENDIAN );
5861         proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_m_pflag, tvb, offset, 2, ENC_BIG_ENDIAN );
5862         proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_m_eflag, tvb, offset, 2, ENC_BIG_ENDIAN );
5863         proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_m_uflag, tvb, offset, 2, ENC_BIG_ENDIAN );
5864         proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_m_wflag, tvb, offset, 2, ENC_BIG_ENDIAN );
5865         proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_m_zflag, tvb, offset, 2, ENC_BIG_ENDIAN );
5866         proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_m_length, tvb, offset, 2, ENC_BIG_ENDIAN );
5867
5868         /* done with header */
5869         consumed += 2;
5870         offset += 2;
5871
5872         /* do we have the pending field? */
5873         if ( header & 0x4000 ) {
5874                 /* Can we read this pending field? */
5875                 if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
5876                         return -1;
5877                 }
5878
5879                 proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_m_qflag, tvb, offset, 1, ENC_BIG_ENDIAN );
5880                 proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_m_pending, tvb, offset, 1, ENC_BIG_ENDIAN );
5881
5882                 consumed++;
5883                 offset++;
5884         }
5885
5886         /*
5887          * lets find out if we need to decode the pnum_msb:
5888          * if Z = 1 and either U = 1 or W = 1 we don't
5889          */
5890         no_pnum_msb = ( header & 0x0400 ) && ( ( header & 0x0800 ) || ( header & 0x1000 ) );
5891         logitemhdrlen = no_pnum_msb ? 2 : 3;
5892
5893         ti = proto_tree_add_text( rtp_midi_cj_chapter_tree, tvb, offset, length, RTP_MIDI_TREE_NAME_CJ_CHAPTER_M_LOGLIST );
5894         rtp_midi_loglist_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_m_loglist );
5895
5896         /* lets step through the loglist */
5897         while ( length > 0 ) {
5898
5899                 /* Can we read this channel-journals header? */
5900                 if ( !tvb_bytes_exist( tvb, offset, logitemhdrlen ) ) {
5901                         return -1;
5902                 }
5903
5904                 if ( no_pnum_msb ) {
5905                         logitemheader = tvb_get_guint8( tvb, offset + 1 );
5906                 } else {
5907                         logitemheader = tvb_get_guint8( tvb, offset + 2 );
5908                 }
5909
5910                 logitemlen = logitemhdrlen;
5911
5912                 /* do we have a msb field? */
5913                 if ( logitemheader & RTP_MIDI_CJ_CHAPTER_M_FLAG_J ) {
5914                         logitemlen++;
5915                 }
5916
5917                 /* do we have a lsb field? */
5918                 if ( logitemheader & RTP_MIDI_CJ_CHAPTER_M_FLAG_K ) {
5919                         logitemlen++;
5920                 }
5921
5922                 /* do we have an a-button field? */
5923                 if ( logitemheader & RTP_MIDI_CJ_CHAPTER_M_FLAG_L ) {
5924                         logitemlen +=2;
5925                 }
5926
5927                 /* do we have a c-button field? */
5928                 if ( logitemheader & RTP_MIDI_CJ_CHAPTER_M_FLAG_M ) {
5929                         logitemlen +=2;
5930                 }
5931
5932                 /* do we have a count field? */
5933                 if ( logitemheader & RTP_MIDI_CJ_CHAPTER_M_FLAG_N ) {
5934                         logitemlen++;
5935                 }
5936
5937                 /* now that we have the length of the logitem, we can create the tree... */
5938                 ti = proto_tree_add_text( rtp_midi_loglist_tree, tvb, offset, logitemlen, RTP_MIDI_TREE_NAME_CJ_CHAPTER_M_LOGITEM );
5939                 rtp_midi_loglist_item_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_m_logitem );
5940
5941                 proto_tree_add_item( rtp_midi_loglist_item_tree, hf_rtp_midi_cj_chapter_m_log_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
5942                 proto_tree_add_item( rtp_midi_loglist_item_tree, hf_rtp_midi_cj_chapter_m_log_pnum_lsb, tvb, offset, 1, ENC_BIG_ENDIAN );
5943                 consumed++;
5944                 offset++;
5945                 length--;
5946
5947                 /* if we have the msb, we need to decode it */
5948                 if ( !no_pnum_msb ) {
5949                         proto_tree_add_item( rtp_midi_loglist_item_tree, hf_rtp_midi_cj_chapter_m_log_qflag, tvb, offset, 1, ENC_BIG_ENDIAN );
5950                         proto_tree_add_item( rtp_midi_loglist_item_tree, hf_rtp_midi_cj_chapter_m_log_pnum_msb, tvb, offset, 1, ENC_BIG_ENDIAN );
5951                         consumed++;
5952                         offset++;
5953                         length--;
5954                 }
5955
5956                 proto_tree_add_item( rtp_midi_loglist_item_tree, hf_rtp_midi_cj_chapter_m_log_jflag, tvb, offset, 1, ENC_BIG_ENDIAN );
5957                 proto_tree_add_item( rtp_midi_loglist_item_tree, hf_rtp_midi_cj_chapter_m_log_kflag, tvb, offset, 1, ENC_BIG_ENDIAN );
5958                 proto_tree_add_item( rtp_midi_loglist_item_tree, hf_rtp_midi_cj_chapter_m_log_lflag, tvb, offset, 1, ENC_BIG_ENDIAN );
5959                 proto_tree_add_item( rtp_midi_loglist_item_tree, hf_rtp_midi_cj_chapter_m_log_mflag, tvb, offset, 1, ENC_BIG_ENDIAN );
5960                 proto_tree_add_item( rtp_midi_loglist_item_tree, hf_rtp_midi_cj_chapter_m_log_nflag, tvb, offset, 1, ENC_BIG_ENDIAN );
5961                 proto_tree_add_item( rtp_midi_loglist_item_tree, hf_rtp_midi_cj_chapter_m_log_tflag, tvb, offset, 1, ENC_BIG_ENDIAN );
5962                 proto_tree_add_item( rtp_midi_loglist_item_tree, hf_rtp_midi_cj_chapter_m_log_vflag, tvb, offset, 1, ENC_BIG_ENDIAN );
5963                 proto_tree_add_item( rtp_midi_loglist_item_tree, hf_rtp_midi_cj_chapter_m_log_rflag, tvb, offset, 1, ENC_BIG_ENDIAN );
5964                 consumed++;
5965                 offset++;
5966                 length--;
5967
5968                 /* do we have a entry-msb field? */
5969                 if ( logitemheader & RTP_MIDI_CJ_CHAPTER_M_FLAG_J ) {
5970
5971                         /* Can we read this table? */
5972                         if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
5973                                 return -1;
5974                         }
5975
5976                         ti = proto_tree_add_text( rtp_midi_loglist_tree, tvb, offset, 1, RTP_MIDI_TREE_NAME_CJ_CHAPTER_M_LOG_MSB );
5977                         ti = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_m_log_msb );
5978
5979                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_m_log_msb_x, tvb, offset, 1, ENC_BIG_ENDIAN );
5980                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_m_log_msb, tvb, offset, 1, ENC_BIG_ENDIAN );
5981
5982                         consumed++;
5983                         offset++;
5984                         length--;
5985                 }
5986
5987                 /* do we have a entry-lsb field? */
5988                 if ( logitemheader & RTP_MIDI_CJ_CHAPTER_M_FLAG_K ) {
5989                         /* Can we read this table? */
5990                         if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
5991                                 return -1;
5992                         }
5993
5994                         ti = proto_tree_add_text( rtp_midi_loglist_tree, tvb, offset, 1, RTP_MIDI_TREE_NAME_CJ_CHAPTER_M_LOG_LSB );
5995                         ti = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_m_log_lsb );
5996
5997                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_m_log_lsb_x, tvb, offset, 1, ENC_BIG_ENDIAN );
5998                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_m_log_lsb, tvb, offset, 1, ENC_BIG_ENDIAN );
5999
6000                         consumed++;
6001                         offset++;
6002                         length--;
6003                 }
6004
6005                 /* do we have an a-button field? */
6006                 if ( logitemheader & RTP_MIDI_CJ_CHAPTER_M_FLAG_L ) {
6007                         /* Can we read this table? */
6008                         if ( !tvb_bytes_exist( tvb, offset, 2 ) ) {
6009                                 return -1;
6010                         }
6011
6012                         ti = proto_tree_add_text( rtp_midi_loglist_tree, tvb, offset, 2, RTP_MIDI_TREE_NAME_CJ_CHAPTER_M_LOG_A_BUTTON );
6013                         ti = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_m_log_a_button );
6014
6015                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_m_log_a_button_g, tvb, offset, 2, ENC_BIG_ENDIAN );
6016                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_m_log_a_button_x, tvb, offset, 2, ENC_BIG_ENDIAN );
6017                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_m_log_a_button, tvb, offset, 2, ENC_BIG_ENDIAN );
6018
6019                         consumed += 2;
6020                         offset += 2;
6021                         length -= 2;
6022                 }
6023
6024                 /* do we have a c-button field? */
6025                 if ( logitemheader & RTP_MIDI_CJ_CHAPTER_M_FLAG_M ) {
6026                         /* Can we read this table? */
6027                         if ( !tvb_bytes_exist( tvb, offset, 2 ) ) {
6028                                 return -1;
6029                         }
6030                         ti = proto_tree_add_text( rtp_midi_loglist_tree, tvb, offset, 2, RTP_MIDI_TREE_NAME_CJ_CHAPTER_M_LOG_C_BUTTON );
6031                         ti = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_m_log_c_button );
6032
6033                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_m_log_c_button_g, tvb, offset, 2, ENC_BIG_ENDIAN );
6034                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_m_log_c_button_r, tvb, offset, 2, ENC_BIG_ENDIAN );
6035                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_m_log_c_button, tvb, offset, 2, ENC_BIG_ENDIAN );
6036
6037                         consumed += 2;
6038                         offset += 2;
6039                         length -= 2;
6040                 }
6041
6042                 /* do we have a count field? */
6043                 if ( logitemheader & RTP_MIDI_CJ_CHAPTER_M_FLAG_N ) {
6044                         /* Can we read this table? */
6045                         if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
6046                                 return -1;
6047                         }
6048                         ti = proto_tree_add_text( rtp_midi_loglist_tree, tvb, offset, 1, RTP_MIDI_TREE_NAME_CJ_CHAPTER_M_LOG_COUNT );
6049                         ti = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_m_log_count );
6050
6051                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_m_log_count_x, tvb, offset, 1, ENC_BIG_ENDIAN );
6052                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_m_log_count, tvb, offset, 1, ENC_BIG_ENDIAN );
6053
6054                         consumed++;
6055                         offset++;
6056                         length--;
6057                 }
6058
6059         }
6060
6061
6062         return consumed;
6063 }
6064
6065
6066 /*
6067  * Here the chapter n of the channel-journal is decoded.
6068  */
6069 static int
6070 decode_cj_chapter_n( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset ) {
6071         proto_item                      *ti                             = NULL;
6072         proto_tree                      *rtp_midi_cj_chapter_tree       = NULL;
6073         proto_tree                      *rtp_midi_loglist_tree          = NULL;
6074         const gchar                     *note_str                       = NULL;
6075         int                              consumed                       = 0;
6076         guint16                          header;
6077         guint8                           note;
6078         guint8                           velocity;
6079         int                              log_count;
6080         int                              octet_count;
6081         int                              low;
6082         int                              high;
6083         int                              i;
6084
6085         /* Can we read this channel-journals header? */
6086         if ( !tvb_bytes_exist( tvb, offset, 2 ) ) {
6087                 return -1;
6088         }
6089
6090         /* first we need to get the flags & length of this chapter */
6091         header = tvb_get_ntohs( tvb, offset );
6092         log_count = ( header & RTP_MIDI_CJ_CHAPTER_N_MASK_LENGTH ) >> 8;
6093         low = ( header & RTP_MIDI_CJ_CHAPTER_N_MASK_LOW ) >> 4;
6094         high = header & RTP_MIDI_CJ_CHAPTER_N_MASK_HIGH;
6095
6096         /* how many offbits octets do we have? */
6097         if ( low <= high ) {
6098                 octet_count = high - low + 1;
6099         } else if ( ( low == 15 ) && ( high == 0 ) ) {
6100                 octet_count = 0;
6101         } else if ( ( low == 15 ) && ( high == 1 ) ) {
6102                 octet_count = 0;
6103         } else {
6104                 return -1;
6105         }
6106
6107         /* special case -> no offbit octets, but 128 note-logs */
6108         if ( ( log_count == 127 ) && ( low == 15) && ( high == 0 ) ) {
6109                 log_count++;
6110         }
6111
6112         ti = proto_tree_add_text( tree, tvb, offset, 2 + ( log_count * 2 ) + octet_count, RTP_MIDI_TREE_NAME_CJ_CHAPTER_N );
6113         rtp_midi_cj_chapter_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_n );
6114
6115         proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_n_bflag, tvb, offset, 2, ENC_BIG_ENDIAN );
6116         proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_n_len, tvb, offset, 2, ENC_BIG_ENDIAN );
6117         proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_n_low, tvb, offset, 2, ENC_BIG_ENDIAN );
6118         proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_n_high, tvb, offset, 2, ENC_BIG_ENDIAN );
6119
6120         offset += 2;
6121         consumed += 2;
6122
6123         if ( log_count > 0 ) {
6124
6125                 /* Can we read this loglist? */
6126                 if ( !tvb_bytes_exist( tvb, offset, log_count * 2 ) ) {
6127                         return -1;
6128                 }
6129
6130                 ti = proto_tree_add_text( rtp_midi_cj_chapter_tree, tvb, offset, log_count * 2, RTP_MIDI_TREE_NAME_CJ_CHAPTER_N_LOGLIST );
6131                 rtp_midi_loglist_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_n_loglist );
6132
6133                 for ( i = 0; i < log_count; i++ ) {
6134
6135                         note = tvb_get_guint8( tvb, offset ) & 0x7f;
6136                         velocity = tvb_get_guint8( tvb, offset + 1 ) & 0x7f;;
6137
6138                         note_str = val_to_str( note, rtp_midi_note_values, rtp_midi_unknown_value_dec );
6139
6140                         ti = proto_tree_add_text(rtp_midi_loglist_tree, tvb, offset, 2, "%s (n=%s, v=%d)", RTP_MIDI_TREE_NAME_CJ_CHAPTER_N_LOGITEM, note_str, velocity );
6141                         ti = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_n_logitem );
6142
6143                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_n_log_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6144                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_n_log_notenum, tvb, offset, 1, ENC_BIG_ENDIAN );
6145
6146                         offset++;
6147                         consumed++;
6148
6149                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_n_log_yflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6150                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_n_log_velocity, tvb, offset, 1, ENC_BIG_ENDIAN );
6151
6152                         offset++;
6153                         consumed++;
6154                 }
6155
6156         }
6157
6158         if ( octet_count > 0 ) {
6159
6160                 /* Can we read this loglist? */
6161                 if ( !tvb_bytes_exist( tvb, offset, octet_count ) ) {
6162                         return -1;
6163                 }
6164                 ti = proto_tree_add_text( rtp_midi_cj_chapter_tree, tvb, offset, log_count, RTP_MIDI_TREE_NAME_CJ_CHAPTER_N_OCTETS );
6165                 rtp_midi_loglist_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_n_octets );
6166
6167                 for ( i = 0; i < octet_count; i++ ) {
6168
6169                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_n_log_octet, tvb, offset, 1, ENC_BIG_ENDIAN );
6170
6171                         offset++;
6172                         consumed++;
6173                 }
6174         }
6175
6176         return consumed;
6177 }
6178
6179
6180 /*
6181  * Here the chapter e of the channel-journal is decoded.
6182  */
6183 static int
6184 decode_cj_chapter_e( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset ) {
6185         proto_item                      *ti                             = NULL;
6186         proto_tree                      *rtp_midi_cj_chapter_tree       = NULL;
6187         proto_tree                      *rtp_midi_loglist_tree          = NULL;
6188         const gchar                     *note_str                       = NULL;
6189         int                              consumed                       = 0;
6190         guint8                           header;
6191         guint8                           note;
6192         guint8                           count_vel;
6193         guint8                           octet;
6194         int                              log_count;
6195         int                              i;
6196
6197         /* Can we read this channel-journals header? */
6198         if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
6199                 return -1;
6200         }
6201
6202         /* first we need to get the flags & length of this chapter */
6203         header = tvb_get_guint8( tvb, offset );
6204         log_count = header & RTP_MIDI_CJ_CHAPTER_E_MASK_LENGTH;
6205
6206         /* count is encoded n+1 */
6207         log_count++;
6208
6209         ti = proto_tree_add_text( tree, tvb, offset, 1 + ( log_count * 2 ), RTP_MIDI_TREE_NAME_CJ_CHAPTER_E );
6210         rtp_midi_cj_chapter_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_e );
6211
6212         proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_e_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6213         proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_e_len, tvb, offset, 2, ENC_BIG_ENDIAN );
6214
6215         offset++;
6216         consumed++;
6217
6218         /* Can we read this loglist? */
6219         if ( !tvb_bytes_exist( tvb, offset, log_count * 2 ) ) {
6220                 return -1;
6221         }
6222
6223         ti = proto_tree_add_text( rtp_midi_cj_chapter_tree, tvb, offset, log_count * 2, RTP_MIDI_TREE_NAME_CJ_CHAPTER_E_LOGLIST );
6224         rtp_midi_loglist_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_e_loglist );
6225
6226         for ( i = 0; i < log_count; i++ ) {
6227
6228                 note = tvb_get_guint8( tvb, offset ) & 0x7f;
6229                 octet = tvb_get_guint8( tvb, offset + 1 );
6230                 count_vel = octet & 0x7f;
6231
6232                 note_str = val_to_str( note, rtp_midi_note_values, rtp_midi_unknown_value_dec );
6233
6234                 if ( octet & 0x80 ) {
6235                         ti = proto_tree_add_text(rtp_midi_loglist_tree, tvb, offset, 2, "%s (n=%s, v=%d)", RTP_MIDI_TREE_NAME_CJ_CHAPTER_E_LOGITEM1, note_str, count_vel );
6236                 } else {
6237                         ti = proto_tree_add_text(rtp_midi_loglist_tree, tvb, offset, 2, "%s (n=%s, c=%d)", RTP_MIDI_TREE_NAME_CJ_CHAPTER_E_LOGITEM2, note_str, count_vel );
6238                 }
6239                 ti = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_e_logitem );
6240
6241                 proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_e_log_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6242                 proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_e_log_notenum, tvb, offset, 1, ENC_BIG_ENDIAN );
6243
6244                 offset++;
6245                 consumed++;
6246
6247                 proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_e_log_vflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6248                 if ( octet & 0x80 ) {
6249                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_e_log_velocity, tvb, offset, 1, ENC_BIG_ENDIAN );
6250                 } else {
6251                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_e_log_count, tvb, offset, 1, ENC_BIG_ENDIAN );
6252                 }
6253
6254                 offset++;
6255                 consumed++;
6256         }
6257
6258         return consumed;
6259 }
6260
6261
6262
6263
6264
6265
6266
6267
6268 /*
6269  * Here the chapter a of the channel-journal is decoded.
6270  */
6271 static int
6272 decode_cj_chapter_a( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset ) {
6273         proto_item                      *ti                             = NULL;
6274         proto_tree                      *rtp_midi_cj_chapter_tree       = NULL;
6275         proto_tree                      *rtp_midi_loglist_tree          = NULL;
6276         const gchar                     *note_str                       = NULL;
6277         int                              consumed                       = 0;
6278         guint8                           header;
6279         guint8                           note;
6280         guint8                           pressure;
6281         int                              log_count;
6282         int                              i;
6283
6284         /* Can we read this channel-journals header? */
6285         if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
6286                 return -1;
6287         }
6288
6289         /* first we need to get the flags & length of this chapter */
6290         header = tvb_get_guint8( tvb, offset );
6291         log_count = header & RTP_MIDI_CJ_CHAPTER_A_MASK_LENGTH;
6292
6293         /* count is encoded n+1 */
6294         log_count++;
6295
6296         ti = proto_tree_add_text( tree, tvb, offset, 1 + ( log_count * 2 ), RTP_MIDI_TREE_NAME_CJ_CHAPTER_A );
6297         rtp_midi_cj_chapter_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_a );
6298
6299         proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_a_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6300         proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_a_len, tvb, offset, 2, ENC_BIG_ENDIAN );
6301
6302         offset++;
6303         consumed++;
6304
6305         /* Can we read this loglist? */
6306         if ( !tvb_bytes_exist( tvb, offset, log_count * 2 ) ) {
6307                 return -1;
6308         }
6309
6310         ti = proto_tree_add_text( rtp_midi_cj_chapter_tree, tvb, offset, log_count * 2, RTP_MIDI_TREE_NAME_CJ_CHAPTER_A_LOGLIST );
6311         rtp_midi_loglist_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_a_loglist );
6312
6313         for ( i = 0; i < log_count; i++ ) {
6314
6315                 note = tvb_get_guint8( tvb, offset ) & 0x7f;
6316                 pressure = tvb_get_guint8( tvb, offset + 1 ) & 0x7f;
6317
6318                 note_str = val_to_str( note, rtp_midi_note_values, rtp_midi_unknown_value_dec );
6319
6320                 ti = proto_tree_add_text(rtp_midi_loglist_tree, tvb, offset, 2, "%s (n=%s, p=%d)", RTP_MIDI_TREE_NAME_CJ_CHAPTER_A_LOGITEM, note_str, pressure );
6321                 ti = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_a_logitem );
6322
6323                 proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_a_log_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6324                 proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_a_log_notenum, tvb, offset, 1, ENC_BIG_ENDIAN );
6325
6326                 offset++;
6327                 consumed++;
6328
6329                 proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_a_log_xflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6330                 proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_a_log_pressure, tvb, offset, 1, ENC_BIG_ENDIAN );
6331
6332                 offset++;
6333                 consumed++;
6334         }
6335
6336         return consumed;
6337 }
6338
6339
6340
6341
6342
6343 /*
6344  * Here a channel-journal is decoded.
6345  */
6346 static int
6347 decode_channel_journal( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset ) {
6348         proto_item                      *ti                             = NULL;
6349         proto_tree                      *rtp_midi_chanjournal_tree      = NULL;
6350         proto_tree                      *rtp_midi_cj_chapters_tree      = NULL;
6351         proto_tree                      *rtp_midi_cj_chapter_tree       = NULL;
6352         guint32                         chanflags;
6353         guint16                         chanjourlen;
6354         int                             consumed = 0;
6355         int                             ext_consumed = 0;
6356
6357         /* Can we read this channel-journals header? */
6358         if ( !tvb_bytes_exist( tvb, offset, 3 ) ) {
6359                 return -1;
6360         }
6361
6362         /* first we need to get the flags & length of this channel-journal */
6363         chanflags = tvb_get_ntoh24( tvb, offset );
6364         chanjourlen = ( chanflags & RTP_MIDI_CJ_MASK_LENGTH ) >> 8;
6365
6366         ti = proto_tree_add_text( tree, tvb, offset, chanjourlen, "%s", val_to_str( ( chanflags & RTP_MIDI_CJ_MASK_CHANNEL ) >> RTP_MIDI_CJ_CHANNEL_SHIFT, rtp_midi_channels, rtp_midi_unknown_value_hex ) );
6367         rtp_midi_chanjournal_tree = proto_item_add_subtree( ti, ett_rtp_midi_channeljournal );
6368
6369         proto_tree_add_item( rtp_midi_chanjournal_tree, hf_rtp_midi_chanjour_sflag, tvb, offset, 3, ENC_BIG_ENDIAN );
6370         proto_tree_add_item( rtp_midi_chanjournal_tree, hf_rtp_midi_chanjour_chan, tvb, offset, 3, ENC_BIG_ENDIAN );
6371         proto_tree_add_item( rtp_midi_chanjournal_tree, hf_rtp_midi_chanjour_hflag, tvb, offset, 3, ENC_BIG_ENDIAN );
6372         proto_tree_add_item( rtp_midi_chanjournal_tree, hf_rtp_midi_chanjour_len, tvb, offset, 3, ENC_BIG_ENDIAN );
6373         proto_tree_add_item( rtp_midi_chanjournal_tree, hf_rtp_midi_chanjour_toc_p, tvb, offset, 3, ENC_BIG_ENDIAN );
6374         proto_tree_add_item( rtp_midi_chanjournal_tree, hf_rtp_midi_chanjour_toc_c, tvb, offset, 3, ENC_BIG_ENDIAN );
6375         proto_tree_add_item( rtp_midi_chanjournal_tree, hf_rtp_midi_chanjour_toc_m, tvb, offset, 3, ENC_BIG_ENDIAN );
6376         proto_tree_add_item( rtp_midi_chanjournal_tree, hf_rtp_midi_chanjour_toc_w, tvb, offset, 3, ENC_BIG_ENDIAN );
6377         proto_tree_add_item( rtp_midi_chanjournal_tree, hf_rtp_midi_chanjour_toc_n, tvb, offset, 3, ENC_BIG_ENDIAN );
6378         proto_tree_add_item( rtp_midi_chanjournal_tree, hf_rtp_midi_chanjour_toc_e, tvb, offset, 3, ENC_BIG_ENDIAN );
6379         proto_tree_add_item( rtp_midi_chanjournal_tree, hf_rtp_midi_chanjour_toc_t, tvb, offset, 3, ENC_BIG_ENDIAN );
6380         proto_tree_add_item( rtp_midi_chanjournal_tree, hf_rtp_midi_chanjour_toc_a, tvb, offset, 3, ENC_BIG_ENDIAN );
6381
6382         ti = proto_tree_add_text( rtp_midi_chanjournal_tree, tvb, offset + 3, chanjourlen - 3, RTP_MIDI_TREE_NAME_CHANNEL_CHAPTERS );
6383         rtp_midi_cj_chapters_tree = proto_item_add_subtree( ti, ett_rtp_midi_channelchapters );
6384
6385         /* take care of length of header */
6386         offset += 3;
6387         consumed += 3;
6388
6389         /* Do we have a program change chapter? */
6390         if ( chanflags & RTP_MIDI_CJ_FLAG_P ) {
6391
6392                 /* Can we read the program change chapter? */
6393                 if ( !tvb_bytes_exist( tvb, offset, 3 ) ) {
6394                         return -1;
6395                 }
6396
6397                 ti = proto_tree_add_text( rtp_midi_cj_chapters_tree, tvb, offset, 3, RTP_MIDI_TREE_NAME_CJ_CHAPTER_P );
6398                 rtp_midi_cj_chapter_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_p );
6399
6400                 proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_p_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6401                 proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_p_program, tvb, offset, 1, ENC_BIG_ENDIAN );
6402                 proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_p_bflag, tvb, offset + 1, 1, ENC_BIG_ENDIAN );
6403                 proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_p_bank_msb, tvb, offset + 1, 1, ENC_BIG_ENDIAN );
6404                 proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_p_xflag, tvb, offset + 2, 1, ENC_BIG_ENDIAN );
6405                 proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_p_bank_lsb, tvb, offset + 2, 1, ENC_BIG_ENDIAN );
6406
6407                 offset += 3;
6408                 consumed += 3;
6409         }
6410
6411         /* Do we have a control chapter? */
6412         if ( chanflags & RTP_MIDI_CJ_FLAG_C ) {
6413                 ext_consumed = decode_cj_chapter_c( tvb, pinfo, rtp_midi_cj_chapters_tree, offset );
6414                 if ( ext_consumed < 0 ) {
6415                         return ext_consumed;
6416                 }
6417                 consumed += ext_consumed;
6418                 offset += ext_consumed;
6419
6420         }
6421
6422         /* Do we have a parameter changes? */
6423         if ( chanflags & RTP_MIDI_CJ_FLAG_M ) {
6424                 ext_consumed = decode_cj_chapter_m( tvb, pinfo, rtp_midi_cj_chapters_tree, offset );
6425                 if ( ext_consumed < 0 ) {
6426                         return ext_consumed;
6427                 }
6428                 consumed += ext_consumed;
6429                 offset += ext_consumed;
6430         }
6431
6432         /* Do we have a pitch-wheel chapter? */
6433         if ( chanflags & RTP_MIDI_CJ_FLAG_W ) {
6434
6435                 /* Can we get the data for the Pitch Wheel chapter? */
6436                 if ( !tvb_bytes_exist( tvb, offset, 2 ) ) {
6437                         return -1;
6438                 }
6439
6440                 ti = proto_tree_add_text( rtp_midi_cj_chapters_tree, tvb, offset, 2, RTP_MIDI_TREE_NAME_CJ_CHAPTER_W );
6441                 rtp_midi_cj_chapter_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_w );
6442
6443                 proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_w_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6444                 proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_w_first, tvb, offset, 1, ENC_BIG_ENDIAN );
6445
6446                 offset++;
6447                 consumed++;
6448
6449                 proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_w_rflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6450                 proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_w_second, tvb, offset, 1, ENC_BIG_ENDIAN );
6451
6452                 offset++;
6453                 consumed++;
6454         }
6455
6456         /* Do we have a note on/off chapter? */
6457         if ( chanflags & RTP_MIDI_CJ_FLAG_N ) {
6458                 ext_consumed = decode_cj_chapter_n( tvb, pinfo, rtp_midi_cj_chapters_tree, offset );
6459                 if ( ext_consumed < 0 ) {
6460                         return ext_consumed;
6461                 }
6462                 consumed += ext_consumed;
6463                 offset += ext_consumed;
6464         }
6465
6466         /* Do we have a note command extras chapter? */
6467         if ( chanflags & RTP_MIDI_CJ_FLAG_E ) {
6468                 ext_consumed = decode_cj_chapter_e( tvb, pinfo, rtp_midi_cj_chapters_tree, offset );
6469                 if ( ext_consumed < 0 ) {
6470                         return ext_consumed;
6471                 }
6472                 consumed += ext_consumed;
6473                 offset += ext_consumed;
6474         }
6475
6476         /* Do we have channel aftertouch chapter? */
6477         if ( chanflags & RTP_MIDI_CJ_FLAG_T ) {
6478                 /* Can we get the data for the Pitch Wheel chapter? */
6479                 if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
6480                         return -1;
6481                 }
6482
6483                 ti = proto_tree_add_text( rtp_midi_cj_chapters_tree, tvb, offset, 1, RTP_MIDI_TREE_NAME_CJ_CHAPTER_T );
6484                 rtp_midi_cj_chapter_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_t );
6485
6486                 proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_t_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6487                 proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_t_pressure, tvb, offset, 1, ENC_BIG_ENDIAN );
6488
6489                 offset++;
6490                 consumed++;
6491         }
6492
6493         /* Do we have a poly aftertouch chapter? */
6494         if ( chanflags & RTP_MIDI_CJ_FLAG_A ) {
6495                 ext_consumed = decode_cj_chapter_a( tvb, pinfo, rtp_midi_cj_chapters_tree, offset );
6496                 if ( ext_consumed < 0 ) {
6497                         return ext_consumed;
6498                 }
6499                 consumed += ext_consumed;
6500                 offset += ext_consumed;
6501         }
6502
6503         /* Make sanity check for consumed data vs. stated length of this channels journal */
6504         if ( consumed != chanjourlen ) {
6505                 return -1;
6506         }
6507         return consumed;
6508 }
6509
6510
6511 /*
6512  * Here the chapter D F4-field of the system-journal is decoded.
6513  */
6514 static int
6515 decode_sj_chapter_d_f4( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset ) {
6516
6517         proto_item      *ti                     = NULL;
6518         proto_tree      *rtp_midi_field_tree    = NULL;
6519         int              consumed               = 0;
6520         guint16          f4flags;
6521         guint16          f4length;
6522
6523         /* Can we read this fields header? */
6524         if ( !tvb_bytes_exist( tvb, offset, 2 ) ) {
6525                 return -1;
6526         }
6527
6528         /* Get flags & length */
6529         f4flags = tvb_get_ntohs( tvb, offset );
6530         f4length = f4flags & RTP_MIDI_SJ_CHAPTER_D_SYSCOM_MASK_LENGTH;
6531
6532         /* now we can display our tree, as we now have the full length */
6533         ti = proto_tree_add_text( tree, tvb, offset, f4length, RTP_MIDI_TREE_NAME_SJ_CHAPTER_D_FIELD_J );
6534         rtp_midi_field_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_d_field_j );
6535
6536         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_sflag, tvb, offset, 2, ENC_BIG_ENDIAN );
6537         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_cflag, tvb, offset, 2, ENC_BIG_ENDIAN );
6538         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_vflag, tvb, offset, 2, ENC_BIG_ENDIAN );
6539         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_lflag, tvb, offset, 2, ENC_BIG_ENDIAN );
6540         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_dsz, tvb, offset, 2, ENC_BIG_ENDIAN );
6541         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_length, tvb, offset, 2, ENC_BIG_ENDIAN );
6542
6543         offset += 2;
6544         consumed += 2;
6545         f4length -= 2;
6546
6547         if ( f4flags & RTP_MIDI_SJ_CHAPTER_D_SYSCOM_FLAG_C ) {
6548
6549                 if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
6550                         return -1;
6551                 }
6552
6553                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_count, tvb, offset, 1, ENC_BIG_ENDIAN );
6554
6555                 offset++;
6556                 consumed++;
6557                 f4length--;
6558         }
6559
6560         if ( f4flags & RTP_MIDI_SJ_CHAPTER_D_SYSCOM_FLAG_V ) {
6561
6562                 int valuelen = 0;
6563                 guint8 octet;
6564
6565                 /* variable length field - ends with an octet with MSB set */
6566                 for (;;) {
6567                         if ( !tvb_bytes_exist( tvb, offset+valuelen, 1 ) ) {
6568                                 return -1;
6569                         }
6570                         octet = tvb_get_guint8( tvb, offset+valuelen );
6571                         valuelen++;
6572                         if ( octet & 0x80 ) {
6573                                 break;
6574                         }
6575                 }
6576                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_value, tvb, offset, valuelen, ENC_NA );
6577                 offset+=valuelen;
6578                 f4length-=valuelen;
6579         }
6580
6581         if ( f4flags & RTP_MIDI_SJ_CHAPTER_D_SYSCOM_FLAG_L ) {
6582
6583                 if ( !tvb_bytes_exist( tvb, offset, f4length ) ) {
6584                         return -1;
6585                 }
6586
6587                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_legal, tvb, offset, f4length, ENC_NA );
6588                 offset+=f4length;
6589                 f4length-=f4length;
6590         }
6591
6592         /* if we still have data, the length-field was incorrect we dump the data here and abort! */
6593         if ( f4length > 0 ) {
6594
6595                 if ( !tvb_bytes_exist( tvb, offset, f4length ) ) {
6596                         return -1;
6597                 }
6598
6599                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_data, tvb, offset, f4length, ENC_NA );
6600
6601                 offset += f4length;
6602                 consumed += f4length;
6603                 /* must be a protocol error - since we have a length, we can recover...*/
6604         }
6605
6606
6607         return consumed;
6608 }
6609
6610
6611 /*
6612  * Here the chapter D F5-field of the system-journal is decoded.
6613  */
6614 static int
6615 decode_sj_chapter_d_f5( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset ) {
6616
6617         proto_item      *ti                     = NULL;
6618         proto_tree      *rtp_midi_field_tree    = NULL;
6619         int              consumed               = 0;
6620         guint16          f5flags;
6621         guint16          f5length;
6622
6623         /* Can we read this fields header? */
6624         if ( !tvb_bytes_exist( tvb, offset, 2 ) ) {
6625                 return -1;
6626         }
6627
6628         /* Get flags & length */
6629         f5flags = tvb_get_ntohs( tvb, offset );
6630         f5length = f5flags & RTP_MIDI_SJ_CHAPTER_D_SYSCOM_MASK_LENGTH;
6631
6632         /* now we can display our tree, as we now have the full length */
6633         ti = proto_tree_add_text( tree, tvb, offset, f5length, RTP_MIDI_TREE_NAME_SJ_CHAPTER_D_FIELD_K );
6634         rtp_midi_field_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_d_field_k );
6635
6636         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_sflag, tvb, offset, 2, ENC_BIG_ENDIAN );
6637         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_cflag, tvb, offset, 2, ENC_BIG_ENDIAN );
6638         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_vflag, tvb, offset, 2, ENC_BIG_ENDIAN );
6639         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_lflag, tvb, offset, 2, ENC_BIG_ENDIAN );
6640         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_dsz, tvb, offset, 2, ENC_BIG_ENDIAN );
6641         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_length, tvb, offset, 2, ENC_BIG_ENDIAN );
6642
6643         offset += 2;
6644         consumed += 2;
6645         f5length -= 2;
6646
6647         if ( f5flags & RTP_MIDI_SJ_CHAPTER_D_SYSCOM_FLAG_C ) {
6648
6649                 if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
6650                         return -1;
6651                 }
6652
6653                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_count, tvb, offset, 1, ENC_BIG_ENDIAN );
6654
6655                 offset++;
6656                 consumed++;
6657                 f5length--;
6658         }
6659
6660         if ( f5flags & RTP_MIDI_SJ_CHAPTER_D_SYSCOM_FLAG_V ) {
6661
6662                 int valuelen = 0;
6663                 guint8 octet;
6664
6665                 /* variable length field - ends with an octet with MSB set */
6666                 for (;;) {
6667                         if ( !tvb_bytes_exist( tvb, offset+valuelen, 1 ) ) {
6668                                 return -1;
6669                         }
6670                         octet = tvb_get_guint8( tvb, offset+valuelen );
6671                         valuelen++;
6672                         if ( octet & 0x80 ) {
6673                                 break;
6674                         }
6675                 }
6676                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_value, tvb, offset, valuelen, ENC_NA );
6677                 offset+=valuelen;
6678                 f5length-=valuelen;
6679         }
6680
6681         if ( f5flags & RTP_MIDI_SJ_CHAPTER_D_SYSCOM_FLAG_L ) {
6682
6683                 if ( !tvb_bytes_exist( tvb, offset, f5length ) ) {
6684                         return -1;
6685                 }
6686
6687                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_legal, tvb, offset, f5length, ENC_NA );
6688                 offset+=f5length;
6689                 f5length-=f5length;
6690         }
6691
6692         /* if we still have data, we dump it here - see above! */
6693         if ( f5length > 0 ) {
6694
6695                 if ( !tvb_bytes_exist( tvb, offset, f5length ) ) {
6696                         return -1;
6697                 }
6698
6699                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_data, tvb, offset, f5length, ENC_NA );
6700
6701                 offset += f5length;
6702                 consumed += f5length;
6703                 /* must be a protocol error - since we have a length, we can recover...*/
6704         }
6705
6706         return consumed;
6707 }
6708
6709 /*
6710  * Here the chapter D F9-field of the system-journal is decoded.
6711  */
6712 static int
6713 decode_sj_chapter_d_f9( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset ) {
6714
6715         proto_item      *ti                     = NULL;
6716         proto_tree      *rtp_midi_field_tree    = NULL;
6717         int              consumed               = 0;
6718         guint8           f9flags;
6719         guint8           f9length;
6720
6721         /* Can we read this fields header? */
6722         if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
6723                 return -1;
6724         }
6725
6726         /* Get flags & length */
6727         f9flags = tvb_get_guint8( tvb, offset );
6728         f9length = f9flags & RTP_MIDI_SJ_CHAPTER_D_SYSREAL_MASK_LENGTH;
6729
6730         /* now we can display our tree, as we now have the full length */
6731         ti = proto_tree_add_text( tree, tvb, offset, f9length, RTP_MIDI_TREE_NAME_SJ_CHAPTER_D_FIELD_Y );
6732         rtp_midi_field_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_d_field_y );
6733
6734         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6735         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_cflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6736         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_lflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6737         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_length, tvb, offset, 1, ENC_BIG_ENDIAN );
6738
6739         offset++;
6740         consumed++;
6741         f9length--;
6742
6743         if ( f9flags & RTP_MIDI_SJ_CHAPTER_D_SYSREAL_FLAG_C ) {
6744
6745                 if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
6746                         return -1;
6747                 }
6748
6749                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_count, tvb, offset, 1, ENC_BIG_ENDIAN );
6750
6751                 offset++;
6752                 consumed++;
6753                 f9length--;
6754         }
6755
6756         if ( f9flags & RTP_MIDI_SJ_CHAPTER_D_SYSREAL_FLAG_L ) {
6757
6758                 if ( !tvb_bytes_exist( tvb, offset, f9length ) ) {
6759                         return -1;
6760                 }
6761
6762                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_legal, tvb, offset, f9length, ENC_NA );
6763                 offset+=f9length;
6764                 f9length-=f9length;
6765         }
6766
6767         /* if we still have data, the length-field was incorrect we dump the data here and abort! */
6768
6769         if ( f9length > 0 ) {
6770
6771                 if ( !tvb_bytes_exist( tvb, offset, f9length ) ) {
6772                         return -1;
6773                 }
6774
6775                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_data, tvb, offset, f9length, ENC_NA );
6776
6777                 offset += f9length;
6778                 consumed += f9length;
6779                 /* must be a protocol error - since we have a length, we can recover...*/
6780         }
6781
6782         return consumed;
6783 }
6784
6785
6786 /*
6787  * Here the chapter D FD-field of the system-journal is decoded.
6788  */
6789 static int
6790 decode_sj_chapter_d_fd( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset ) {
6791
6792         proto_item      *ti                     = NULL;
6793         proto_tree      *rtp_midi_field_tree    = NULL;
6794         int              consumed               = 0;
6795         guint8           fdflags;
6796         guint8           fdlength;
6797
6798         /* Can we read this fields header? */
6799         if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
6800                 return -1;
6801         }
6802
6803         /* Get flags & length */
6804         fdflags = tvb_get_guint8( tvb, offset );
6805         fdlength = fdflags & RTP_MIDI_SJ_CHAPTER_D_SYSREAL_MASK_LENGTH;
6806
6807         /* now we can display our tree, as we now have the full length */
6808         ti = proto_tree_add_text( tree, tvb, offset, fdlength, RTP_MIDI_TREE_NAME_SJ_CHAPTER_D_FIELD_Z );
6809         rtp_midi_field_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_d_field_z );
6810
6811         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6812         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_cflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6813         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_lflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6814         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_length, tvb, offset, 1, ENC_BIG_ENDIAN );
6815
6816         offset++;
6817         consumed++;
6818         fdlength--;
6819
6820         if ( fdflags & RTP_MIDI_SJ_CHAPTER_D_SYSREAL_FLAG_C ) {
6821
6822                 if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
6823                         return -1;
6824                 }
6825
6826                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_count, tvb, offset, 1, ENC_BIG_ENDIAN );
6827
6828                 offset++;
6829                 consumed++;
6830                 fdlength--;
6831         }
6832
6833         if ( fdflags & RTP_MIDI_SJ_CHAPTER_D_SYSREAL_FLAG_L ) {
6834
6835                 if ( !tvb_bytes_exist( tvb, offset, fdlength ) ) {
6836                         return -1;
6837                 }
6838
6839                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_legal, tvb, offset, fdlength, ENC_NA );
6840                 offset+=fdlength;
6841                 fdlength-=fdlength;
6842         }
6843
6844         /* if we still have data, the length-field was incorrect we dump the data here and abort! */
6845
6846         if ( fdlength > 0 ) {
6847
6848                 if ( !tvb_bytes_exist( tvb, offset, fdlength ) ) {
6849                         return -1;
6850                 }
6851
6852                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_data, tvb, offset, fdlength, ENC_NA );
6853
6854                 offset += fdlength;
6855                 consumed += fdlength;
6856                 /* must be a protocol error - since we have a length, we can recover...*/
6857         }
6858
6859         return consumed;
6860 }
6861
6862
6863
6864 /*
6865  * Here the chapter D of the channel-journal is decoded.
6866  */
6867 static int
6868 decode_sj_chapter_d( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset ) {
6869         proto_item                      *ti                             = NULL;
6870         proto_item                      *tix                            = NULL;
6871         proto_tree                      *rtp_midi_sj_chapter_tree       = NULL;
6872         proto_tree                      *rtp_midi_field_tree            = NULL;
6873         guint8                          header;
6874         int                             consumed = 0;
6875         int                             ext_consumed;
6876
6877         /* Can we read this channel-journals header? */
6878         if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
6879                 return -1;
6880         }
6881
6882         /* first we need to get the flags of this chapter */
6883         header = tvb_get_guint8( tvb, offset );
6884
6885         /*
6886          * we don't know the complete length yet - we now that we have at least the header -> 1.
6887          * At the end we set the real length...
6888          */
6889         tix = proto_tree_add_text( tree, tvb, offset, 1, RTP_MIDI_TREE_NAME_SJ_CHAPTER_D );
6890         rtp_midi_sj_chapter_tree = proto_item_add_subtree( tix, ett_rtp_midi_sj_chapter_d );
6891
6892         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_d_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6893         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_d_bflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6894         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_d_gflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6895         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_d_hflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6896         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_d_jflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6897         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_d_kflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6898         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_d_yflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6899         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_d_zflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6900
6901         /* done with header */
6902         consumed++;
6903         offset++;
6904
6905         /* do we have Reset field? */
6906         if ( header & RTP_MIDI_SJ_CHAPTER_D_FLAG_B ) {
6907                 /* Can we get the data for the Reset chapter? */
6908                 if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
6909                         return -1;
6910                 }
6911
6912                 ti = proto_tree_add_text( rtp_midi_sj_chapter_tree, tvb, offset, 1, RTP_MIDI_TREE_NAME_SJ_CHAPTER_D_FIELD_B );
6913                 rtp_midi_field_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_d_field_b );
6914
6915                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_reset_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6916                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_reset_count, tvb, offset, 1, ENC_BIG_ENDIAN );
6917
6918                 offset++;
6919                 consumed++;
6920         }
6921
6922         /* do we have Tune request field? */
6923         if ( header & RTP_MIDI_SJ_CHAPTER_D_FLAG_G ) {
6924                 /* Can we get the data for the Reset chapter? */
6925                 if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
6926                         return -1;
6927                 }
6928
6929                 ti = proto_tree_add_text( rtp_midi_sj_chapter_tree, tvb, offset, 1, RTP_MIDI_TREE_NAME_SJ_CHAPTER_D_FIELD_G );
6930                 rtp_midi_field_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_d_field_g );
6931
6932                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_tune_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6933                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_tune_count, tvb, offset, 1, ENC_BIG_ENDIAN );
6934
6935                 offset++;
6936                 consumed++;
6937         }
6938
6939         /* do we have Song select field? */
6940         if ( header & RTP_MIDI_SJ_CHAPTER_D_FLAG_H ) {
6941                 /* Can we get the data for the Reset chapter? */
6942                 if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
6943                         return -1;
6944                 }
6945
6946                 ti = proto_tree_add_text( rtp_midi_sj_chapter_tree, tvb, offset, 1, RTP_MIDI_TREE_NAME_SJ_CHAPTER_D_FIELD_H );
6947                 rtp_midi_field_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_d_field_h );
6948
6949                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_song_sel_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6950                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_song_sel_value, tvb, offset, 1, ENC_BIG_ENDIAN );
6951
6952                 offset++;
6953                 consumed++;
6954         }
6955
6956         /* do we have 0xF4 field? */
6957         if ( header & RTP_MIDI_SJ_CHAPTER_D_FLAG_J ) {
6958                 ext_consumed = decode_sj_chapter_d_f4( tvb, pinfo, rtp_midi_sj_chapter_tree, offset );
6959                 if ( ext_consumed < 0 ) {
6960                         return ext_consumed;
6961                 }
6962                 consumed += ext_consumed;
6963                 offset += ext_consumed;
6964         }
6965
6966         /* do we have 0xF5 field? */
6967         if ( header & RTP_MIDI_SJ_CHAPTER_D_FLAG_K ) {
6968                 ext_consumed = decode_sj_chapter_d_f5( tvb, pinfo, rtp_midi_sj_chapter_tree, offset );
6969                 if ( ext_consumed < 0 ) {
6970                         return ext_consumed;
6971                 }
6972                 consumed += ext_consumed;
6973                 offset += ext_consumed;
6974         }
6975
6976         /* do we have 0xF9 field? */
6977         if ( header & RTP_MIDI_SJ_CHAPTER_D_FLAG_Y ) {
6978                 ext_consumed = decode_sj_chapter_d_f9( tvb, pinfo, rtp_midi_sj_chapter_tree, offset );
6979                 if ( ext_consumed < 0 ) {
6980                         return ext_consumed;
6981                 }
6982                 consumed += ext_consumed;
6983                 offset += ext_consumed;
6984         }
6985
6986         /* do we have 0xFD field? */
6987         if ( header & RTP_MIDI_SJ_CHAPTER_D_FLAG_Z ) {
6988                 ext_consumed = decode_sj_chapter_d_fd( tvb, pinfo, rtp_midi_sj_chapter_tree, offset );
6989                 if ( ext_consumed < 0 ) {
6990                         return ext_consumed;
6991                 }
6992                 consumed += ext_consumed;
6993                 offset += ext_consumed;
6994         }
6995
6996
6997         /* now we know the complete length and set it. */
6998         proto_item_set_len( tix, consumed );
6999         return consumed;
7000 }
7001
7002 /*
7003  * Here the chapter Q of the channel-journal is decoded.
7004  */
7005 static int
7006 decode_sj_chapter_q( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset ) {
7007         proto_item                      *ti                             = NULL;
7008         proto_tree                      *rtp_midi_sj_chapter_tree       = NULL;
7009         guint8                          header;
7010         int                             consumed = 0;
7011         int                             len = 1;
7012
7013         /* Can we read this chapters header? */
7014         if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
7015                 return -1;
7016         }
7017
7018         /* first we need to get the flags of this chapter */
7019         header = tvb_get_guint8( tvb, offset );
7020
7021         if ( header & RTP_MIDI_SJ_CHAPTER_Q_FLAG_C ) {
7022                 len += 2;
7023         }
7024         if ( header & RTP_MIDI_SJ_CHAPTER_Q_FLAG_T ) {
7025                 len += 3;
7026         }
7027
7028         /* now we have the length... */
7029         ti = proto_tree_add_text( tree, tvb, offset, len, RTP_MIDI_TREE_NAME_SJ_CHAPTER_Q );
7030         rtp_midi_sj_chapter_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_q );
7031
7032         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_q_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7033         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_q_nflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7034         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_q_dflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7035         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_q_cflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7036         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_q_tflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7037
7038         if ( header & RTP_MIDI_SJ_CHAPTER_Q_FLAG_C ) {
7039
7040                 if ( !tvb_bytes_exist( tvb, offset, 3 ) ) {
7041                         return -1;
7042                 }
7043
7044                 proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_q_clock, tvb, offset, 3, ENC_BIG_ENDIAN );
7045
7046                 consumed += 3;
7047                 offset += 3;
7048
7049         } else {
7050                 proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_q_top, tvb, offset, 1, ENC_BIG_ENDIAN );
7051
7052                 consumed++;
7053                 offset++;
7054         }
7055
7056         if ( header & RTP_MIDI_SJ_CHAPTER_Q_FLAG_T ) {
7057                 if ( !tvb_bytes_exist( tvb, offset, 3 ) ) {
7058                         return -1;
7059                 }
7060
7061                 proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_q_timetools, tvb, offset, 3, ENC_BIG_ENDIAN );
7062
7063                 consumed += 3;
7064                 offset += 3;
7065         }
7066
7067         return consumed;
7068 }
7069
7070 /*
7071  * Here the chapter F of the channel-journal is decoded.
7072  */
7073 static int
7074 decode_sj_chapter_f( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset ) {
7075         proto_item                      *ti                             = NULL;
7076         proto_tree                      *rtp_midi_sj_chapter_tree       = NULL;
7077         proto_tree                      *rtp_midi_sj_field_tree         = NULL;
7078         guint8                          header;
7079         int                             consumed = 0;
7080         int                             len = 1;
7081
7082         /* Can we read this chapters header? */
7083         if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
7084                 return -1;
7085         }
7086
7087         /* first we need to get the flags of this chapter */
7088         header = tvb_get_guint8( tvb, offset );
7089
7090         if ( header & RTP_MIDI_SJ_CHAPTER_F_FLAG_C ) {
7091                 len += 4;
7092         }
7093         if ( header & RTP_MIDI_SJ_CHAPTER_F_FLAG_P ) {
7094                 len += 4;
7095         }
7096
7097         /* now we have the length... */
7098         ti = proto_tree_add_text( tree, tvb, offset, len, RTP_MIDI_TREE_NAME_SJ_CHAPTER_F );
7099         rtp_midi_sj_chapter_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_f );
7100
7101         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_f_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7102         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_f_cflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7103         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_f_pflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7104         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_f_qflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7105         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_f_dflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7106         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_f_point, tvb, offset, 1, ENC_BIG_ENDIAN );
7107
7108         consumed++;
7109         offset++;
7110
7111         if ( header & RTP_MIDI_SJ_CHAPTER_F_FLAG_C ) {
7112                 if ( !tvb_bytes_exist( tvb, offset, 4 ) ) {
7113                         return -1;
7114                 }
7115
7116                 ti = proto_tree_add_text( rtp_midi_sj_chapter_tree, tvb, offset, 4, RTP_MIDI_TREE_NAME_SJ_CHAPTER_F_COMPLETE );
7117                 rtp_midi_sj_field_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_f_complete );
7118
7119                 if ( header & RTP_MIDI_SJ_CHAPTER_F_FLAG_Q ) {
7120                         proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_mt0, tvb, offset, 4, ENC_BIG_ENDIAN );
7121                         proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_mt1, tvb, offset, 4, ENC_BIG_ENDIAN );
7122                         proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_mt2, tvb, offset, 4, ENC_BIG_ENDIAN );
7123                         proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_mt3, tvb, offset, 4, ENC_BIG_ENDIAN );
7124                         proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_mt4, tvb, offset, 4, ENC_BIG_ENDIAN );
7125                         proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_mt5, tvb, offset, 4, ENC_BIG_ENDIAN );
7126                         proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_mt6, tvb, offset, 4, ENC_BIG_ENDIAN );
7127                         proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_mt7, tvb, offset, 4, ENC_BIG_ENDIAN );
7128
7129                 } else {
7130                         proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_hr, tvb, offset, 4, ENC_BIG_ENDIAN );
7131                         proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_mn, tvb, offset, 4, ENC_BIG_ENDIAN );
7132                         proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_sc, tvb, offset, 4, ENC_BIG_ENDIAN );
7133                         proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_fr, tvb, offset, 4, ENC_BIG_ENDIAN );
7134                 }
7135
7136                 consumed += 4;
7137                 offset += 4;
7138         }
7139
7140         if ( header & RTP_MIDI_SJ_CHAPTER_F_FLAG_P ) {
7141                 if ( !tvb_bytes_exist( tvb, offset, 4 ) ) {
7142                         return -1;
7143                 }
7144
7145                 ti = proto_tree_add_text( rtp_midi_sj_chapter_tree, tvb, offset, 4, RTP_MIDI_TREE_NAME_SJ_CHAPTER_F_PARTIAL );
7146                 rtp_midi_sj_field_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_f_partial );
7147
7148                 proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_mt0, tvb, offset, 4, ENC_BIG_ENDIAN );
7149                 proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_mt1, tvb, offset, 4, ENC_BIG_ENDIAN );
7150                 proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_mt2, tvb, offset, 4, ENC_BIG_ENDIAN );
7151                 proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_mt3, tvb, offset, 4, ENC_BIG_ENDIAN );
7152                 proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_mt4, tvb, offset, 4, ENC_BIG_ENDIAN );
7153                 proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_mt5, tvb, offset, 4, ENC_BIG_ENDIAN );
7154                 proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_mt6, tvb, offset, 4, ENC_BIG_ENDIAN );
7155                 proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_mt7, tvb, offset, 4, ENC_BIG_ENDIAN );
7156
7157                 consumed += 4;
7158                 offset += 4;
7159         }
7160
7161         return consumed;
7162 }
7163
7164 /*
7165  * Here the chapter X of the channel-journal is decoded.
7166  */
7167 static int
7168 decode_sj_chapter_x( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int max_length ) {
7169         proto_item                      *ti                             = NULL;
7170         proto_tree                      *rtp_midi_sj_chapter_tree       = NULL;
7171         proto_tree                      *rtp_midi_sj_data_tree          = NULL;
7172         guint8                          header;
7173         guint8                          octet;
7174         unsigned int                    consumed = 0;
7175         unsigned long                   field = 0;
7176         unsigned long                   fieldlen = 0;
7177         unsigned long                   cmdlen = 0;
7178         unsigned int                    i;
7179
7180         /* Can we read this chapters header? */
7181         if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
7182                 return -1;
7183         }
7184
7185         /* first we need to get the flags of this chapter */
7186         header = tvb_get_guint8( tvb, offset );
7187
7188         ti = proto_tree_add_text( tree, tvb, offset, max_length, RTP_MIDI_TREE_NAME_SJ_CHAPTER_X );
7189         rtp_midi_sj_chapter_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_x );
7190
7191         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_x_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7192         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_x_tflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7193         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_x_cflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7194         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_x_fflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7195         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_x_dflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7196         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_x_lflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7197         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_x_sta, tvb, offset, 1, ENC_BIG_ENDIAN );
7198
7199         consumed++;
7200         offset++;
7201
7202         if ( header & RTP_MIDI_SJ_CHAPTER_X_FLAG_T ) {
7203
7204                 if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
7205                         return -1;
7206                 }
7207
7208                 proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_x_tcount, tvb, offset, 1, ENC_BIG_ENDIAN );
7209
7210                 consumed++;
7211                 offset++;
7212         }
7213
7214         if ( header & RTP_MIDI_SJ_CHAPTER_X_FLAG_C ) {
7215
7216                 if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
7217                         return -1;
7218                 }
7219
7220                 proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_x_count, tvb, offset, 1, ENC_BIG_ENDIAN );
7221
7222                 consumed++;
7223                 offset++;
7224         }
7225
7226         if ( header & RTP_MIDI_SJ_CHAPTER_X_FLAG_F ) {
7227
7228                 /* FIRST is "compressed" using only the necessary amount of octets, like delta-time */
7229                 for ( i=0; i < 4; i++ ) {
7230
7231                         /* do we still fit in the dissected packet & in the length restriction of this chapter? */
7232                         if ( ( !( consumed >= max_length ) ) || ( !tvb_bytes_exist( tvb, offset + fieldlen, 1 ) ) ) {
7233                                 return -1;
7234                         }
7235
7236                         octet = tvb_get_guint8( tvb, offset + fieldlen );
7237                         field = ( field << 7 ) | ( octet & RTP_MIDI_DELTA_TIME_OCTET_MASK );
7238                         fieldlen++;
7239
7240                         if ( ( octet & RTP_MIDI_DELTA_TIME_EXTENSION ) == 0 ) {
7241                                 break;
7242                         }
7243                 }
7244
7245                 switch (fieldlen) {
7246                         case 1:
7247                             proto_tree_add_uint ( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_x_first1, tvb, offset, fieldlen, field );
7248                                 break;
7249                         case 2:
7250                             proto_tree_add_uint ( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_x_first2, tvb, offset, fieldlen, field );
7251                                 break;
7252                         case 3:
7253                             proto_tree_add_uint ( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_x_first3, tvb, offset, fieldlen, field );
7254                                 break;
7255                         case 4:
7256                             proto_tree_add_uint ( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_x_first4, tvb, offset, fieldlen, field );
7257                                 break;
7258
7259                 }
7260                 consumed+=fieldlen;
7261                 offset+=fieldlen;
7262
7263         }
7264
7265         if ( header & RTP_MIDI_SJ_CHAPTER_X_FLAG_D ) {
7266                 ti = proto_tree_add_text( rtp_midi_sj_chapter_tree, tvb, offset,  max_length - consumed, RTP_MIDI_TREE_NAME_SJ_CHAPTER_X_DATA );
7267                 rtp_midi_sj_data_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_x_data );
7268                 while ( consumed < max_length ) {
7269                         octet = tvb_get_guint8( tvb, offset + cmdlen );
7270                         if ( octet & 0x80 ) {
7271                                 proto_tree_add_item( rtp_midi_sj_data_tree, hf_rtp_midi_sj_chapter_x_data, tvb, offset, cmdlen, ENC_NA );
7272                                 offset += cmdlen;
7273                                 cmdlen = 0;
7274                         }
7275                         consumed +=1;
7276                 }
7277                 /* unfinished command still to put into tree */
7278                 if ( cmdlen ) {
7279                         proto_tree_add_item( rtp_midi_sj_data_tree, hf_rtp_midi_sj_chapter_x_invalid_data, tvb, offset, cmdlen, ENC_NA );
7280                         offset += cmdlen;
7281                 }
7282         }
7283
7284         /* this should not ever enter - we still have data, but flag d was apparently not set...  */
7285         if ( consumed < max_length ) {
7286
7287                 ti = proto_tree_add_text( rtp_midi_sj_chapter_tree, tvb, offset,  max_length - consumed, RTP_MIDI_TREE_NAME_SJ_CHAPTER_X_INVALID_DATA );
7288                 rtp_midi_sj_data_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_x_data );
7289
7290                 proto_tree_add_item( rtp_midi_sj_data_tree, hf_rtp_midi_sj_chapter_x_invalid_data, tvb, offset, max_length - consumed, ENC_NA );
7291
7292                 consumed = max_length;
7293
7294         }
7295
7296         return consumed;
7297 }
7298
7299
7300
7301 /*
7302  * Here the system-journal is decoded.
7303  */
7304 static int
7305 decode_system_journal( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset ) {
7306         proto_item                      *ti                             = NULL;
7307         proto_tree                      *rtp_midi_sysjournal_tree       = NULL;
7308         proto_tree                      *rtp_midi_sj_chapters_tree      = NULL;
7309         proto_tree                      *rtp_midi_sj_chapter_tree       = NULL;
7310         int                             consumed = 0;
7311         int                             ext_consumed = 0;
7312         guint16                         sysjourlen;
7313         guint16                         systemflags;
7314
7315
7316
7317         /* Can we read this channel-journals header? */
7318         if ( !tvb_bytes_exist( tvb, offset, 2 ) ) {
7319                 return -1;
7320         }
7321
7322         systemflags = tvb_get_ntohs( tvb, offset );
7323         sysjourlen = systemflags & RTP_MIDI_SJ_MASK_LENGTH;
7324
7325         ti = proto_tree_add_text( tree, tvb, offset, sysjourlen, RTP_MIDI_TREE_NAME_SYSTEM_JOURNAL );
7326         rtp_midi_sysjournal_tree = proto_item_add_subtree( ti, ett_rtp_midi_systemjournal );
7327
7328         proto_tree_add_item( rtp_midi_sysjournal_tree, hf_rtp_midi_sysjour_toc_s, tvb, offset, 2, ENC_BIG_ENDIAN );
7329         proto_tree_add_item( rtp_midi_sysjournal_tree, hf_rtp_midi_sysjour_toc_d, tvb, offset, 2, ENC_BIG_ENDIAN );
7330         proto_tree_add_item( rtp_midi_sysjournal_tree, hf_rtp_midi_sysjour_toc_v, tvb, offset, 2, ENC_BIG_ENDIAN );
7331         proto_tree_add_item( rtp_midi_sysjournal_tree, hf_rtp_midi_sysjour_toc_q, tvb, offset, 2, ENC_BIG_ENDIAN );
7332         proto_tree_add_item( rtp_midi_sysjournal_tree, hf_rtp_midi_sysjour_toc_f, tvb, offset, 2, ENC_BIG_ENDIAN );
7333         proto_tree_add_item( rtp_midi_sysjournal_tree, hf_rtp_midi_sysjour_toc_x, tvb, offset, 2, ENC_BIG_ENDIAN );
7334         proto_tree_add_item( rtp_midi_sysjournal_tree, hf_rtp_midi_sysjour_len, tvb, offset, 2, ENC_BIG_ENDIAN );
7335
7336         offset += 2;
7337         consumed += 2;
7338
7339         ti = proto_tree_add_text( rtp_midi_sysjournal_tree, tvb, offset, sysjourlen - 2, RTP_MIDI_TREE_NAME_SYSTEM_CHAPTERS );
7340         rtp_midi_sj_chapters_tree = proto_item_add_subtree( ti, ett_rtp_midi_systemchapters );
7341
7342         /* Do we have a simple system commands chapter? */
7343         if ( systemflags & RTP_MIDI_SJ_FLAG_D ) {
7344                 ext_consumed = decode_sj_chapter_d( tvb, pinfo, rtp_midi_sj_chapters_tree, offset );
7345                 if ( ext_consumed < 0 ) {
7346                         return ext_consumed;
7347                 }
7348                 consumed += ext_consumed;
7349                 offset += ext_consumed;
7350         }
7351
7352         /* Do we have a active sensing chapter? */
7353         if ( systemflags & RTP_MIDI_SJ_FLAG_V ) {
7354                 /* Can we get the data for the Active Sense chapter? */
7355                 if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
7356                         return -1;
7357                 }
7358
7359                 ti = proto_tree_add_text( rtp_midi_sj_chapters_tree, tvb, offset, 1, RTP_MIDI_TREE_NAME_SJ_CHAPTER_V );
7360                 rtp_midi_sj_chapter_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_v );
7361
7362                 proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_v_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7363                 proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_v_count, tvb, offset, 1, ENC_BIG_ENDIAN );
7364
7365                 offset++;
7366                 consumed++;
7367         }
7368
7369         /* Do we have a sequencer state commands chapter? */
7370         if ( systemflags & RTP_MIDI_SJ_FLAG_Q ) {
7371                 ext_consumed = decode_sj_chapter_q( tvb, pinfo, rtp_midi_sj_chapters_tree, offset );
7372                 if ( ext_consumed < 0 ) {
7373                         return ext_consumed;
7374                 }
7375                 consumed += ext_consumed;
7376                 offset += ext_consumed;
7377         }
7378
7379         /* Do we have a MTC chapter? */
7380         if ( systemflags & RTP_MIDI_SJ_FLAG_F ) {
7381                 ext_consumed = decode_sj_chapter_f( tvb, pinfo, rtp_midi_sj_chapters_tree, offset );
7382                 if ( ext_consumed < 0 ) {
7383                         return ext_consumed;
7384                 }
7385                 consumed += ext_consumed;
7386                 offset += ext_consumed;
7387         }
7388
7389
7390         /* Make sanity check for consumed data vs. stated length of system journal */
7391         if ( consumed <= sysjourlen ) {
7392                 return -1;
7393         }
7394
7395         /* Do we have a Sysex chapter? */
7396         if ( systemflags & RTP_MIDI_SJ_FLAG_X ) {
7397                 ext_consumed = decode_sj_chapter_x( tvb, pinfo, rtp_midi_sj_chapters_tree, offset, sysjourlen - consumed );
7398                 if ( ext_consumed < 0 ) {
7399                         return ext_consumed;
7400                 }
7401                 consumed += ext_consumed;
7402                 offset += ext_consumed;
7403         }
7404
7405
7406         /* Make sanity check for consumed data vs. stated length of system journal */
7407         if ( consumed != sysjourlen ) {
7408                 return -1;
7409         }
7410         return consumed;
7411 }
7412
7413
7414
7415
7416
7417
7418 /*
7419  * This is the main dissector function for the RTP-MIDI protocol
7420  * It decodes the wrapper of the command-section and punts
7421  * decoding of delta-time and the actual MIDI-command itself to
7422  * external decoders.  Afterwards the journal-section is decoded.
7423  */
7424
7425 static void
7426 dissect_rtp_midi( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree )
7427 {
7428         proto_item                      *ti                             = NULL;
7429         proto_item                      *command_item                   = NULL;
7430         proto_item                      *journal_item                   = NULL;
7431         proto_tree                      *rtp_midi_tree                  = NULL;
7432         proto_tree                      *rtp_midi_commands_tree         = NULL;
7433         proto_tree                      *rtp_midi_journal_tree          = NULL;
7434         proto_tree                      *rtp_midi_chanjournals_tree     = NULL;
7435         unsigned int                     offset                         = 0;
7436
7437         guint8                          flags;                          /* used for command-section and journal-section*/
7438         guint8                          octet;
7439         unsigned int            cmd_len;
7440         unsigned int            cmd_count;
7441         guint8                          runningstatus;
7442
7443         int                                     consumed;
7444         unsigned int            rsoffset;
7445
7446         guint8                          totchan;
7447
7448         unsigned int            i;
7449
7450         col_set_str( pinfo->cinfo, COL_PROTOCOL, RTP_MIDI_DISSECTOR_SHORTNAME );
7451         col_clear( pinfo->cinfo, COL_INFO );
7452
7453         /*
7454          * MIDI command section
7455          */
7456
7457         /* RTP-MIDI starts with 4 bits of flags... */
7458         flags = tvb_get_guint8( tvb, offset );
7459
7460         ti = proto_tree_add_item( tree, proto_rtp_midi, tvb, 0, -1, ENC_NA );
7461         rtp_midi_tree = proto_item_add_subtree( ti, ett_rtp_midi);
7462
7463         /* Decode those four flags */
7464         proto_tree_add_item( rtp_midi_tree, hf_rtp_midi_bflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7465         proto_tree_add_item( rtp_midi_tree, hf_rtp_midi_jflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7466         proto_tree_add_item( rtp_midi_tree, hf_rtp_midi_zflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7467         proto_tree_add_item( rtp_midi_tree, hf_rtp_midi_pflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7468
7469         /* ...followed by a length-field of at least 4 bits */
7470         cmd_len = flags & RTP_MIDI_CS_MASK_SHORTLEN;
7471
7472         /* see if we have small or large len-field */
7473         if (flags & RTP_MIDI_CS_FLAG_B)  {
7474                 octet = tvb_get_guint8( tvb, offset+1 );
7475                 cmd_len = ( cmd_len << 8 ) | octet;
7476                 proto_tree_add_item( rtp_midi_tree, hf_rtp_midi_longlen, tvb, offset, 2, ENC_BIG_ENDIAN );
7477                 offset += 2;
7478         } else {
7479                 proto_tree_add_item( rtp_midi_tree, hf_rtp_midi_shortlen, tvb, offset, 1, ENC_BIG_ENDIAN );
7480                         offset++;
7481         }
7482
7483         /* if we have a command-section -> dissect it */
7484         if ( cmd_len ) {
7485                 command_item = proto_tree_add_text( rtp_midi_tree, tvb, offset, cmd_len, RTP_MIDI_TREE_NAME_COMMAND );
7486                 rtp_midi_commands_tree = proto_item_add_subtree( command_item, ett_rtp_midi_commands );
7487
7488                 /* if the reported command-length larger than data found in packet -> error */
7489                 if ( !tvb_bytes_exist( tvb, offset, cmd_len ) ) {
7490                         THROW( ReportedBoundsError );
7491                         return;
7492                 }
7493
7494                 /* No commands decoded yet */
7495                 cmd_count=0;
7496
7497                 /* RTP-MIDI-pdus always start with no running status */
7498                 runningstatus=0;
7499
7500                 /* Multiple MIDI-commands might follow - the exact number can only be discovered by really decoding the commands! */
7501                 while ( cmd_len) {
7502
7503                         /* for the first command we only have a delta-time if Z-Flag is set */
7504                         if ( ( cmd_count ) || ( flags & RTP_MIDI_CS_FLAG_Z ) ) {
7505
7506                                 /* Decode a delta-time - if 0 is returned something went wrong */
7507                                 consumed=decodetime( tvb, pinfo, rtp_midi_commands_tree, offset, cmd_len );
7508                                 if ( -1 == consumed ) {
7509                                         THROW( ReportedBoundsError );
7510                                         return;
7511                                 }
7512
7513                                 /* seek to next command and set remaining length */
7514                                 offset += consumed;
7515                                 cmd_len -= consumed;
7516                         }
7517
7518                         /* Only decode MIDI-command if there is any data left - it is valid to only have delta-time! */
7519                         if ( cmd_len ) {
7520
7521                                 /* Decode a MIDI-command - if 0 is returned something went wrong */
7522                                 consumed = decodemidi( tvb, pinfo, rtp_midi_commands_tree, cmd_count, offset, cmd_len, &runningstatus, &rsoffset );
7523                                 if ( -1 == consumed ) {
7524                                         THROW( ReportedBoundsError );
7525                                         return;
7526                                 }
7527
7528                                 /* seek to next delta-time and set remaining length */
7529                                 offset += consumed;
7530                                 cmd_len -= consumed;
7531
7532                                 /* as we have successfully decoded another command, increment count */
7533                                 cmd_count++;
7534                         }
7535                 }
7536         }
7537         /*
7538          * Journal section
7539          */
7540
7541         /* if we have a journal-section -> dissect it */
7542         if ( flags & RTP_MIDI_CS_FLAG_J ) {
7543
7544                 journal_item = proto_tree_add_text( rtp_midi_tree, tvb, offset, -1, RTP_MIDI_TREE_NAME_JOURNAL );
7545                 rtp_midi_journal_tree = proto_item_add_subtree( journal_item, ett_rtp_midi_journal );
7546
7547                 /* lets get the main flags from the recovery journal header */
7548                 flags = tvb_get_guint8( tvb, offset );
7549
7550                 proto_tree_add_item( rtp_midi_journal_tree, hf_rtp_midi_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7551                 proto_tree_add_item( rtp_midi_journal_tree, hf_rtp_midi_yflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7552                 proto_tree_add_item( rtp_midi_journal_tree, hf_rtp_midi_aflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7553                 proto_tree_add_item( rtp_midi_journal_tree, hf_rtp_midi_hflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7554
7555                 /* At the same place we find the total channels encoded in the channel journal */
7556                 totchan = flags & RTP_MIDI_JS_MASK_TOTALCHANNELS;
7557                 proto_tree_add_item( rtp_midi_journal_tree, hf_rtp_midi_totchan, tvb, offset, 1, ENC_BIG_ENDIAN);
7558                 offset++;
7559
7560                 /* the checkpoint-sequence-number can be used to see if the recovery journal covers all lost events */
7561                 proto_tree_add_item( rtp_midi_journal_tree, hf_rtp_midi_check_seq_num, tvb, offset, 2, ENC_BIG_ENDIAN );
7562                 offset += 2;
7563
7564
7565                 /* do we have system journal? */
7566                 if ( flags & RTP_MIDI_JS_FLAG_Y ) {
7567                         /* first we need to get the flags & length from the system-journal */
7568                         consumed = decode_system_journal( tvb, pinfo, rtp_midi_journal_tree, offset );
7569
7570                         if ( -1 == consumed ) {
7571                                 THROW( ReportedBoundsError );
7572                                 return;
7573                         }
7574
7575                         /* seek to optional channel-journals-section */
7576                         offset += consumed;
7577
7578                 }
7579
7580                 /* do we have channel journal(s)? */
7581                 if ( flags & RTP_MIDI_JS_FLAG_A ) {
7582                         ti = proto_tree_add_text( rtp_midi_journal_tree, tvb, offset, -1, RTP_MIDI_TREE_NAME_CHANNEL_JOURNAL );
7583                         rtp_midi_chanjournals_tree = proto_item_add_subtree( ti, ett_rtp_midi_channeljournals );
7584
7585                         /* iterate through all the channels specified in header */
7586                         for ( i = 0; i <= totchan; i++ ) {
7587
7588                                 consumed = decode_channel_journal( tvb, pinfo, rtp_midi_chanjournals_tree, offset );
7589
7590                                 if ( -1 == consumed ) {
7591                                         THROW( ReportedBoundsError );
7592                                         return;
7593                                 }
7594
7595                                 /* seek to next channel-journal */
7596                                 offset += consumed;
7597
7598                         }
7599                 }
7600         }
7601 }
7602
7603
7604
7605
7606 void
7607 proto_register_rtp_midi( void )
7608 {
7609         module_t *rtp_midi_module;
7610
7611         static hf_register_info hf[] = {
7612                 {
7613                         &hf_rtp_midi_bflag,
7614                         {
7615                                 "B-Flag",
7616                                 "rtpmidi.b_flag",
7617                                 FT_BOOLEAN,
7618                                 8,
7619                                 TFS(&rtp_midi_cs_flag_b),
7620                                 RTP_MIDI_CS_FLAG_B,
7621                                 NULL, HFILL
7622                         }
7623                 },
7624                 {
7625                         &hf_rtp_midi_jflag,
7626                         {
7627                                 "J-Flag",
7628                                 "rtpmidi.j_flag",
7629                                 FT_BOOLEAN,
7630                                 8,
7631                                 TFS(&rtp_midi_cs_flag_j),
7632                                 RTP_MIDI_CS_FLAG_J,
7633                                 NULL, HFILL
7634                         }
7635                 },
7636                 {
7637                         &hf_rtp_midi_zflag,
7638                         {
7639                                 "Z-Flag",
7640                                 "rtpmidi.z_flag",
7641                                 FT_BOOLEAN,
7642                                 8,
7643                                 TFS(&rtp_midi_cs_flag_z),
7644                                 RTP_MIDI_CS_FLAG_Z,
7645                                 NULL, HFILL
7646                         }
7647                 },
7648                 {
7649                         &hf_rtp_midi_pflag,
7650                         {
7651                                 "P-Flag",
7652                                 "rtpmidi.p_flag",
7653                                 FT_BOOLEAN,
7654                                 8,
7655                                 TFS(&rtp_midi_cs_flag_p),
7656                                 RTP_MIDI_CS_FLAG_P,
7657                                 NULL, HFILL
7658                         }
7659                 },
7660                 {
7661                         &hf_rtp_midi_shortlen,
7662                         {
7663                                 "Command length (short)",
7664                                 "rtpmidi.cmd_length_short",
7665                                 FT_UINT8,
7666                                 BASE_DEC,
7667                                 NULL,
7668                                 RTP_MIDI_CS_MASK_SHORTLEN,
7669                                 NULL, HFILL
7670                         }
7671                 },
7672                         {
7673                         &hf_rtp_midi_longlen,
7674                         {
7675                                 "Command length (long)",
7676                                 "rtpmidi.cmd_length_long",
7677                                 FT_UINT16,
7678                                 BASE_DEC,
7679                                 NULL,
7680                                 RTP_MIDI_CS_MASK_LONGLEN,
7681                                 NULL, HFILL
7682                         }
7683                 },
7684                 {
7685                         &hf_rtp_midi_sflag,
7686                         {
7687                                 "S-Flag",
7688                                 "rtpmidi.s_flag",
7689                                 FT_BOOLEAN,
7690                                 8,
7691                                 TFS(&rtp_midi_js_flag_s),
7692                                 RTP_MIDI_JS_FLAG_S,
7693                                 NULL, HFILL
7694                         }
7695                 },
7696                 {
7697                         &hf_rtp_midi_yflag,
7698                         {
7699                                 "Y-Flag",
7700                                 "rtpmidi.y_flag",
7701                                 FT_BOOLEAN,
7702                                 8,
7703                                 TFS(&rtp_midi_js_flag_y),
7704                                 RTP_MIDI_JS_FLAG_Y,
7705                                 NULL, HFILL
7706                         }
7707                 },
7708                 {
7709                         &hf_rtp_midi_aflag,
7710                         {
7711                                 "A-Flag",
7712                                 "rtpmidi.a_flag",
7713                                 FT_BOOLEAN,
7714                                 8,
7715                                 TFS(&rtp_midi_js_flag_a),
7716                                 RTP_MIDI_JS_FLAG_A,
7717                                 NULL, HFILL
7718                         }
7719                 },
7720                 {
7721                         &hf_rtp_midi_hflag,
7722                         {
7723                                 "H-Flag",
7724                                 "rtpmidi.h_flag",
7725                                 FT_BOOLEAN,
7726                                 8,
7727                                 TFS(&rtp_midi_js_flag_h),
7728                                 RTP_MIDI_JS_FLAG_H,
7729                                 NULL, HFILL
7730                         }
7731                 },
7732                 {
7733                         &hf_rtp_midi_totchan,
7734                         {
7735                                 "Total channels",
7736                                 "rtpmidi.total_channels",
7737                                 FT_UINT8,
7738                                 BASE_DEC,
7739                                 VALS(rtp_midi_js_tot_channels),
7740                                 RTP_MIDI_JS_MASK_TOTALCHANNELS,
7741                                 NULL, HFILL
7742                         }
7743                 },
7744                 {
7745                         &hf_rtp_midi_check_seq_num,
7746                         {
7747                                 "Checkpoint Packet Seqnum",
7748                                 "rtpmidi.check_Seq_num",
7749                                 FT_UINT16,
7750                                 BASE_DEC,
7751                                 NULL,
7752                                 0x00,
7753                                 NULL, HFILL
7754                         }
7755                 },
7756                 {
7757                         &hf_rtp_midi_deltatime1,
7758                         {
7759                                 "Delta Time (one octet)",
7760                                 "rtpmidi.deltatime_1",
7761                                 FT_UINT8,
7762                                 BASE_HEX,
7763                                 NULL,
7764                                 0x7f,
7765                                 NULL, HFILL
7766                         }
7767                 },
7768                 {
7769                         &hf_rtp_midi_deltatime2,
7770                         {
7771                                 "Delta Time (two octets)",
7772                                 "rtpmidi.deltatime_2",
7773                                 FT_UINT16,
7774                                 BASE_HEX,
7775                                 NULL,
7776                                 0x7f7f,
7777                                 NULL, HFILL
7778                         }
7779                 },
7780                 {
7781                         &hf_rtp_midi_deltatime3,
7782                         {
7783                                 "Delta Time (three octets)",
7784                                 "rtpmidi.deltatime_3",
7785                                 FT_UINT24,
7786                                 BASE_HEX,
7787                                 NULL,
7788                                 0x7f7f7f,
7789                                 NULL, HFILL
7790                         }
7791                 },
7792                 {
7793                         &hf_rtp_midi_deltatime4,
7794                         {
7795                                 "Delta Time (four octets)",
7796                                 "rtpmidi.deltatime_4",
7797                                 FT_UINT32,
7798                                 BASE_HEX,
7799                                 NULL,
7800                                 0x7f7f7f7f,
7801                                 NULL, HFILL
7802                         }
7803                 },
7804                 {
7805                         &hf_rtp_midi_channel_status,
7806                         {
7807                                 "Channel Status",
7808                                 "rtpmidi.channel_status",
7809                                 FT_UINT8,
7810                                 BASE_HEX,
7811                                 VALS(rtp_midi_channel_status),
7812                                 0xf0,
7813                                 NULL, HFILL
7814                         }
7815                 },
7816                 {
7817                         &hf_rtp_midi_common_status,
7818                         {
7819                                 "Common Status",
7820                                 "rtpmidi.common_status",
7821                                 FT_UINT8,
7822                                 BASE_HEX,
7823                                 VALS(rtp_midi_common_status),
7824                                 0xff,
7825                                 NULL, HFILL
7826                         }
7827                 },
7828                 {
7829                         &hf_rtp_midi_channel,
7830                         {
7831                                 "Channel",
7832                                 "rtpmidi.channel",
7833                                 FT_UINT8,
7834                                 BASE_HEX,
7835                                 VALS(rtp_midi_channels),
7836                                 0x0f,
7837                                 NULL, HFILL
7838                         }
7839                 },
7840                 {
7841                         &hf_rtp_midi_note,
7842                         {
7843                                 "Note",
7844                                 "rtpmidi.note",
7845                                 FT_UINT8,
7846                                 BASE_DEC,
7847                                 VALS(rtp_midi_note_values),
7848                                 0x7f,
7849                                 NULL, HFILL
7850                         }
7851                 },
7852                 {
7853                         &hf_rtp_midi_velocity,
7854                         {
7855                                 "Velocity",
7856                                 "rtpmidi.velocity",
7857                                 FT_UINT8,
7858                                 BASE_DEC,
7859                                 NULL,
7860                                 0x7f,
7861                                 NULL, HFILL
7862                         }
7863                 },
7864                 {
7865                         &hf_rtp_midi_pressure,
7866                         {
7867                                 "Pressure",
7868                                 "rtpmidi.pressure",
7869                                 FT_UINT8,
7870                                 BASE_DEC,
7871                                 NULL,
7872                                 0x7f,
7873                                 NULL, HFILL
7874                         }
7875                 },
7876                 {
7877                         &hf_rtp_midi_controller,
7878                         {
7879                                 "Controller",
7880                                 "rtpevent.controller",
7881                                 FT_UINT8,
7882                                 BASE_DEC,
7883                                 VALS(rtp_midi_controller_values),
7884                                 0x7f,
7885                                 NULL, HFILL
7886                         }
7887                 },
7888                 {
7889                         &hf_rtp_midi_controller_value,
7890                         {
7891                                 "Value",
7892                                 "rtpmidi.controller_value",
7893                                 FT_UINT8,
7894                                 BASE_DEC,
7895                                 NULL,
7896                                 0x7f,
7897                                 NULL, HFILL
7898                         }
7899                 },
7900                 {
7901                         &hf_rtp_midi_program,
7902                         {
7903                                 "Program",
7904                                 "rtpmidi.program",
7905                                 FT_UINT8,
7906                                 BASE_DEC,
7907                                 NULL,
7908                                 0x7f,
7909                                 NULL, HFILL
7910                         }
7911                 },
7912                 {
7913                         &hf_rtp_midi_channel_pressure,
7914                         {
7915                                 "Pressure",
7916                                 "rtpmidi.channel_pressure",
7917                                 FT_UINT8,
7918                                 BASE_DEC,
7919                                 NULL,
7920                                 0x7f,
7921                                 NULL, HFILL
7922                         }
7923                 },
7924                 {
7925                         &hf_rtp_midi_pitch_bend,
7926                         {
7927                                 "Pitch Bend",
7928                                 "rtpmidi.pitch_bend",
7929                                 FT_UINT16,
7930                                 BASE_DEC,
7931                                 NULL,
7932                                 0x7f7f,
7933                                 NULL, HFILL
7934                         }
7935                 },
7936                 {
7937                         &hf_rtp_midi_pitch_bend_truncated,
7938                         {
7939                                 "Pitch Bend (truncated)",
7940                                 "rtpmidi.pitch_bend_truncated",
7941                                 FT_UINT8,
7942                                 BASE_DEC,
7943                                 NULL,
7944                                 0x7f,
7945                                 NULL, HFILL
7946                         }
7947                 },
7948                 {
7949                         &hf_rtp_midi_manu_short,
7950                         {
7951                                 "Manufacturer (short)",
7952                                 "rtpmidi.manufacturer_short",
7953                                 FT_UINT8,
7954                                 BASE_HEX,
7955                                 VALS(rtp_midi_manu_short_values),
7956                                 0x7f,
7957                                 NULL, HFILL
7958                         }
7959                 },
7960                 {
7961                         &hf_rtp_midi_manu_long,
7962                         {
7963                                 "Manufacturer (long)",
7964                                 "rtpmidi.manufacturer_long",
7965                                 FT_UINT16,
7966                                 BASE_HEX,
7967                                 VALS(rtp_midi_manu_long_values),
7968                                 0x7f7f,
7969                                 NULL, HFILL
7970                         }
7971                 },
7972                 {
7973                         &hf_rtp_midi_sysjour_toc_s,
7974                         {
7975                                 "System-Journal TOC-S-Flag",
7976                                 "rtpmidi.sysjour_toc_s",
7977                                 FT_BOOLEAN,
7978                                 16,
7979                                 TFS(&rtp_midi_js_flag_s),
7980                                 RTP_MIDI_SJ_FLAG_S,
7981                                 NULL, HFILL
7982                         }
7983                 },
7984                 {
7985                         &hf_rtp_midi_sysjour_toc_d,
7986                         {
7987                                 "System-Journal TOC-D-Flag",
7988                                 "rtpmidi.sysjour_toc_d",
7989                                 FT_BOOLEAN,
7990                                 16,
7991                                 TFS(&rtp_midi_sj_flag_d),
7992                                 RTP_MIDI_SJ_FLAG_D,
7993                                 NULL, HFILL
7994                         }
7995                 },
7996                 {
7997                         &hf_rtp_midi_sysjour_toc_v,
7998                         {
7999                                 "System-Journal TOC-V-Flag",
8000                                 "rtpmidi.sysjour_toc_v",
8001                                 FT_BOOLEAN,
8002                                 16,
8003                                 TFS(&rtp_midi_sj_flag_v),
8004                                 RTP_MIDI_SJ_FLAG_V,
8005                                 NULL, HFILL
8006                         }
8007                 },
8008                 {
8009                         &hf_rtp_midi_sysjour_toc_q,
8010                         {
8011                                 "System-Journal TOC-Q-Flag",
8012                                 "rtpmidi.sysjour_toc_q",
8013                                 FT_BOOLEAN,
8014                                 16,
8015                                 TFS(&rtp_midi_sj_flag_q),
8016                                 RTP_MIDI_SJ_FLAG_Q,
8017                                 NULL, HFILL
8018                         }
8019                 },
8020                 {
8021                         &hf_rtp_midi_sysjour_toc_f,
8022                         {
8023                                 "System-Journal TOC-F-Flag",
8024                                 "rtpmidi.sysjour_toc_f",
8025                                 FT_BOOLEAN,
8026                                 16,
8027                                 TFS(&rtp_midi_sj_flag_f),
8028                                 RTP_MIDI_SJ_FLAG_F,
8029                                 NULL, HFILL
8030                         }
8031                 },
8032                 {
8033                         &hf_rtp_midi_sysjour_toc_x,
8034                         {
8035                                 "System-Journal TOC-X-Flag",
8036                                 "rtpmidi.sysjour_toc_x",
8037                                 FT_BOOLEAN,
8038                                 16,
8039                                 TFS(&rtp_midi_sj_flag_x),
8040                                 RTP_MIDI_SJ_FLAG_X,
8041                                 NULL, HFILL
8042                         }
8043                 },
8044                 {
8045                         &hf_rtp_midi_sysjour_len,
8046                         {
8047                                 "System-Journal-Length",
8048                                 "rtpmidi.cmd_sysjour_len",
8049                                 FT_UINT16,
8050                                 BASE_DEC,
8051                                 NULL,
8052                                 RTP_MIDI_SJ_MASK_LENGTH,
8053                                 NULL, HFILL
8054                         }
8055                 },
8056                 {
8057                         &hf_rtp_midi_chanjour_sflag,
8058                         {
8059                                 "Channel-Journal S-Flag",
8060                                 "rtpmidi.chanjour_s",
8061                                 FT_BOOLEAN,
8062                                 24,
8063                                 TFS(&rtp_midi_js_flag_s),
8064                                 0x800000,
8065                                 NULL, HFILL
8066                         }
8067                 },
8068                 {
8069                         &hf_rtp_midi_chanjour_chan,
8070                         {
8071                                 "Channel",
8072                                 "rtpmidi.chanjour_channel",
8073                                 FT_UINT24,
8074                                 BASE_HEX,
8075                                 VALS(rtp_midi_channels),
8076                                 0x780000,
8077                                 NULL, HFILL
8078                         }
8079                 },
8080                 {
8081                         &hf_rtp_midi_chanjour_hflag,
8082                         {
8083                                 "Channel-Journal H-Flag",
8084                                 "rtpmidi.chanjour_h",
8085                                 FT_BOOLEAN,
8086                                 24,
8087                                 TFS(&rtp_midi_js_flag_h),
8088                                 0x040000,
8089                                 NULL, HFILL
8090                         }
8091                 },
8092                 {
8093                         &hf_rtp_midi_chanjour_len,
8094                         {
8095                                 "Channel-Journal-Length",
8096                                 "rtpmidi.cmd_chanjour_len",
8097                                 FT_UINT24,
8098                                 BASE_DEC,
8099                                 NULL,
8100                                 0x03FF00,
8101                                 NULL, HFILL
8102                         }
8103                 },
8104                 {
8105                         &hf_rtp_midi_chanjour_toc_p,
8106                         {
8107                                 "Channel-Journal TOC-P-Flag",
8108                                 "rtpmidi.chanjour_toc_p",
8109                                 FT_BOOLEAN,
8110                                 24,
8111                                 TFS(&rtp_midi_cj_flag_p),
8112                                 0x80,
8113                                 NULL, HFILL
8114                         }
8115                 },
8116                 {
8117                         &hf_rtp_midi_chanjour_toc_c,
8118                         {
8119                                 "Channel-Journal TOC-C-Flag",
8120                                 "rtpmidi.chanjour_toc_c",
8121                                 FT_BOOLEAN,
8122                                 24,
8123                                 TFS(&rtp_midi_cj_flag_c),
8124                                 0x40,
8125                                 NULL, HFILL
8126                         }
8127                 },
8128                 {
8129                         &hf_rtp_midi_chanjour_toc_m,
8130                         {
8131                                 "Channel-Journal TOC-M-Flag",
8132                                 "rtpmidi.chanjour_toc_m",
8133                                 FT_BOOLEAN,
8134                                 24,
8135                                 TFS(&rtp_midi_cj_flag_m),
8136                                 0x20,
8137                                 NULL, HFILL
8138                         }
8139                 },
8140                 {
8141                         &hf_rtp_midi_chanjour_toc_w,
8142                         {
8143                                 "Channel-Journal TOC-W-Flag",
8144                                 "rtpmidi.chanjour_toc_w",
8145                                 FT_BOOLEAN,
8146                                 24,
8147                                 TFS(&rtp_midi_cj_flag_w),
8148                                 0x10,
8149                                 NULL, HFILL
8150                         }
8151                 },
8152                 {
8153                         &hf_rtp_midi_chanjour_toc_n,
8154                         {
8155                                 "Channel-Journal TOC-N-Flag",
8156                                 "rtpmidi.chanjour_toc_n",
8157                                 FT_BOOLEAN,
8158                                 24,
8159                                 TFS(&rtp_midi_cj_flag_n),
8160                                 0x08,
8161                                 NULL, HFILL
8162                         }
8163                 },
8164                 {
8165                         &hf_rtp_midi_chanjour_toc_e,
8166                         {
8167                                 "Channel-Journal TOC-E-Flag",
8168                                 "rtpmidi.chanjour_toc_e",
8169                                 FT_BOOLEAN,
8170                                 24,
8171                                 TFS(&rtp_midi_cj_flag_e),
8172                                 0x04,
8173                                 NULL, HFILL
8174                         }
8175                 },
8176                 {
8177                         &hf_rtp_midi_chanjour_toc_t,
8178                         {
8179                                 "Channel-Journal TOC-T-Flag",
8180                                 "rtpmidi.chanjour_toc_t",
8181                                 FT_BOOLEAN,
8182                                 24,
8183                                 TFS(&rtp_midi_cj_flag_t),
8184                                 0x02,
8185                                 NULL, HFILL
8186                         }
8187                 },
8188                 {
8189                         &hf_rtp_midi_chanjour_toc_a,
8190                         {
8191                                 "Channel-Journal TOC-A-Flag",
8192                                 "rtpmidi.chanjour_toc_a",
8193                                 FT_BOOLEAN,
8194                                 24,
8195                                 TFS(&rtp_midi_cj_flag_a),
8196                                 0x01,
8197                                 NULL, HFILL
8198                         }
8199                 },
8200
8201                 {
8202                         &hf_rtp_midi_cj_chapter_p_sflag,
8203                         {
8204                                 "Chapter P S-Flag",
8205                                 "rtpmidi.cj_chapter_p_sflag",
8206                                 FT_BOOLEAN,
8207                                 8,
8208                                 TFS(&rtp_midi_js_flag_s),
8209                                 0x80,
8210                                 NULL, HFILL
8211                         }
8212                 },
8213
8214                 {
8215                         &hf_rtp_midi_cj_chapter_p_program,
8216                         {
8217                                 "Chapter P Program",
8218                                 "rtpmidi.cj_chapter_p_program",
8219                                 FT_UINT8,
8220                                 BASE_DEC,
8221                                 NULL,
8222                                 0x7f,
8223                                 NULL, HFILL
8224                         }
8225                 },
8226
8227                 {
8228                         &hf_rtp_midi_cj_chapter_p_bflag,
8229                         {
8230                                 "Chapter P B-Flag",
8231                                 "rtpmidi.cj_chapter_p_bflag",
8232                                 FT_BOOLEAN,
8233                                 8,
8234                                 NULL,
8235                                 0x80,
8236                                 NULL, HFILL
8237                         }
8238                 },
8239
8240                 {
8241                         &hf_rtp_midi_cj_chapter_p_bank_msb,
8242                         {
8243                                 "Chapter P Bank-MSB",
8244                                 "rtpmidi.cj_chapter_p_bank_msb",
8245                                 FT_UINT8,
8246                                 BASE_HEX,
8247                                 NULL,
8248                                 0x7f,
8249                                 NULL, HFILL
8250                         }
8251                 },
8252
8253                 {
8254                         &hf_rtp_midi_cj_chapter_p_xflag,
8255                         {
8256                                 "Chapter P X-Flag",
8257                                 "rtpmidi.cj_chapter_p_xflag",
8258                                 FT_BOOLEAN,
8259                                 8,
8260                                 TFS(&rtp_midi_cj_chapter_p_log_flag_x),
8261                                 0x80,
8262                                 NULL, HFILL
8263                         }
8264                 },
8265                 {
8266                         &hf_rtp_midi_cj_chapter_p_bank_lsb,
8267                         {
8268                                 "Chapter P Bank-LSB",
8269                                 "rtpmidi.cj_chapter_p_bank_lsb",
8270                                 FT_UINT8,
8271                                 BASE_HEX,
8272                                 NULL,
8273                                 0x7f,
8274                                 NULL, HFILL
8275                         }
8276                 },
8277
8278                 {
8279                         &hf_rtp_midi_cj_chapter_c_sflag,
8280                         {
8281                                 "Chapter C S-Flag",
8282                                 "rtpmidi.cj_chapter_c_sflag",
8283                                 FT_BOOLEAN,
8284                                 8,
8285                                 TFS(&rtp_midi_js_flag_s),
8286                                 0x80,
8287                                 NULL, HFILL
8288                         }
8289                 },
8290
8291                 {
8292                         &hf_rtp_midi_cj_chapter_c_length,
8293                         {
8294                                 "Chapter C Length",
8295                                 "rtpmidi.cj_chapter_c_length",
8296                                 FT_UINT8,
8297                                 BASE_DEC,
8298                                 NULL,
8299                                 0x7f,
8300                                 NULL, HFILL
8301                         }
8302                 },
8303
8304                 {
8305                         &hf_rtp_midi_cj_chapter_c_number,
8306                         {
8307                                 "Chapter C Number",
8308                                 "rtpmidi.cj_chapter_c_number",
8309                                 FT_UINT8,
8310                                 BASE_DEC,
8311                                 VALS(rtp_midi_controller_values),
8312                                 0x7f,
8313                                 NULL, HFILL
8314                         }
8315                 },
8316
8317                 {
8318                         &hf_rtp_midi_cj_chapter_c_aflag,
8319                         {
8320                                 "Chapter C A-Flag",
8321                                 "rtpmidi.cj_chapter_c_aflag",
8322                                 FT_BOOLEAN,
8323                                 8,
8324                                 TFS(&rtp_midi_cj_chapter_c_flag_a),
8325                                 0x80,
8326                                 NULL, HFILL
8327                         }
8328                 },
8329
8330                 {
8331                         &hf_rtp_midi_cj_chapter_c_tflag,
8332                         {
8333                                 "Chapter C T-Flag",
8334                                 "rtpmidi.cj_chapter_c_tflag",
8335                                 FT_BOOLEAN,
8336                                 8,
8337                                 NULL,
8338                                 0x40,
8339                                 NULL, HFILL
8340                         }
8341                 },
8342
8343                 {
8344                         &hf_rtp_midi_cj_chapter_c_value,
8345                         {
8346                                 "Chapter C Value",
8347                                 "rtpmidi.cj_chapter_c_value",
8348                                 FT_UINT8,
8349                                 BASE_HEX,
8350                                 NULL,
8351                                 0x7f,
8352                                 NULL, HFILL
8353                         }
8354                 },
8355
8356                 {
8357                         &hf_rtp_midi_cj_chapter_c_alt,
8358                         {
8359                                 "Chapter C Alt",
8360                                 "rtpmidi.cj_chapter_c_alt",
8361                                 FT_UINT8,
8362                                 BASE_HEX,
8363                                 NULL,
8364                                 0x3f,
8365                                 NULL, HFILL
8366                         }
8367                 },
8368
8369                 {
8370                         &hf_rtp_midi_cj_chapter_m_sflag,
8371                         {
8372                                 "Chapter M S-Flag",
8373                                 "rtpmidi.cj_chapter_m_sflag",
8374                                 FT_BOOLEAN,
8375                                 16,
8376                                 TFS(&rtp_midi_js_flag_s),
8377                                 0x8000,
8378                                 NULL, HFILL
8379                         }
8380                 },
8381
8382                 {
8383                         &hf_rtp_midi_cj_chapter_m_pflag,
8384                         {
8385                                 "Chapter M P-Flag",
8386                                 "rtpmidi.cj_chapter_m_pflag",
8387                                 FT_BOOLEAN,
8388                                 16,
8389                                 TFS(&rtp_midi_cj_chapter_m_flag_p),
8390                                 0x4000,
8391                                 NULL, HFILL
8392                         }
8393                 },
8394
8395                 {
8396                         &hf_rtp_midi_cj_chapter_m_eflag,
8397                         {
8398                                 "Chapter M E-Flag",
8399                                 "rtpmidi.cj_chapter_m_eflag",
8400                                 FT_BOOLEAN,
8401                                 16,
8402                                 TFS(&rtp_midi_cj_chapter_m_flag_e),
8403                                 0x2000,
8404                                 NULL, HFILL
8405                         }
8406                 },
8407
8408                 {
8409                         &hf_rtp_midi_cj_chapter_m_uflag,
8410                         {
8411                                 "Chapter M U-Flag",
8412                                 "rtpmidi.cj_chapter_m_uflag",
8413                                 FT_BOOLEAN,
8414                                 16,
8415                                 TFS(&rtp_midi_cj_chapter_m_flag_u),
8416                                 0x1000,
8417                                 NULL, HFILL
8418                         }
8419                 },
8420
8421                 {
8422                         &hf_rtp_midi_cj_chapter_m_wflag,
8423                         {
8424                                 "Chapter M W-Flag",
8425                                 "rtpmidi.cj_chapter_m_wflag",
8426                                 FT_BOOLEAN,
8427                                 16,
8428                                 TFS(&rtp_midi_cj_chapter_m_flag_w),
8429                                 0x0800,
8430                                 NULL, HFILL
8431                         }
8432                 },
8433
8434                 {
8435                         &hf_rtp_midi_cj_chapter_m_zflag,
8436                         {
8437                                 "Chapter M Z-Flag",
8438                                 "rtpmidi.cj_chapter_m_zflag",
8439                                 FT_BOOLEAN,
8440                                 16,
8441                                 TFS(&rtp_midi_cj_chapter_m_flag_z),
8442                                 0x0400,
8443                                 NULL, HFILL
8444                         }
8445                 },
8446
8447                 {
8448                         &hf_rtp_midi_cj_chapter_m_length,
8449                         {
8450                                 "Chapter M Length",
8451                                 "rtpmidi.cj_chapter_m_length",
8452                                 FT_UINT16,
8453                                 BASE_DEC,
8454                                 NULL,
8455                                 0x03ff,
8456                                 NULL, HFILL
8457                         }
8458                 },
8459
8460                 {
8461                         &hf_rtp_midi_cj_chapter_m_qflag,
8462                         {
8463                                 "Chapter M Q-Flag",
8464                                 "rtpmidi.cj_chapter_m_qflag",
8465                                 FT_BOOLEAN,
8466                                 8,
8467                                 TFS(&rtp_midi_cj_chapter_m_flag_q),
8468                                 0x80,
8469                                 NULL, HFILL
8470                         }
8471                 },
8472
8473                 {
8474                         &hf_rtp_midi_cj_chapter_m_pending,
8475                         {
8476                                 "Chapter M Pending",
8477                                 "rtpmidi.cj_chapter_m_pending",
8478                                 FT_UINT8,
8479                                 BASE_HEX,
8480                                 NULL,
8481                                 0x7f,
8482                                 NULL, HFILL
8483                         }
8484                 },
8485
8486                 {
8487                         &hf_rtp_midi_cj_chapter_m_log_sflag,
8488                         {
8489                                 "Chapter M Log S-Flag",
8490                                 "rtpmidi.cj_chapter_m_log_sflag",
8491                                 FT_BOOLEAN,
8492                                 8,
8493                                 TFS(&rtp_midi_js_flag_s),
8494                                 0x80,
8495                                 NULL, HFILL
8496                         }
8497                 },
8498
8499                 {
8500                         &hf_rtp_midi_cj_chapter_m_log_pnum_lsb,
8501                         {
8502                                 "Chapter M Log PNUM-LSB",
8503                                 "rtpmidi.cj_chapter_m_log_pnum_lsb",
8504                                 FT_UINT8,
8505                                 BASE_HEX,
8506                                 NULL,
8507                                 0x7f,
8508                                 NULL, HFILL
8509                         }
8510                 },
8511
8512                 {
8513                         &hf_rtp_midi_cj_chapter_m_log_qflag,
8514                         {
8515                                 "Chapter M Log Q-Flag",
8516                                 "rtpmidi.cj_chapter_m_log_qflag",
8517                                 FT_BOOLEAN,
8518                                 8,
8519                                 TFS(&rtp_midi_cj_chapter_m_log_flag_q),
8520                                 0x80,
8521                                 NULL, HFILL
8522                         }
8523                 },
8524
8525                 {
8526                         &hf_rtp_midi_cj_chapter_m_log_pnum_msb,
8527                         {
8528                                 "Chapter M Log PNUM-MSB",
8529                                 "rtpmidi.cj_chapter_m_log_pnum_msb",
8530                                 FT_UINT8,
8531                                 BASE_HEX,
8532                                 NULL,
8533                                 0x7f,
8534                                 NULL, HFILL
8535                         }
8536                 },
8537
8538                 {
8539                         &hf_rtp_midi_cj_chapter_m_log_jflag,
8540                         {
8541                                 "Chapter M Log J-Flag",
8542                                 "rtpmidi.cj_chapter_m_log_jflag",
8543                                 FT_BOOLEAN,
8544                                 8,
8545                                 TFS(&rtp_midi_cj_chapter_m_log_flag_j),
8546                                 RTP_MIDI_CJ_CHAPTER_M_FLAG_J,
8547                                 NULL, HFILL
8548                         }
8549                 },
8550
8551                 {
8552                         &hf_rtp_midi_cj_chapter_m_log_kflag,
8553                         {
8554                                 "Chapter M Log K-Flag",
8555                                 "rtpmidi.cj_chapter_m_log_kflag",
8556                                 FT_BOOLEAN,
8557                                 8,
8558                                 TFS(&rtp_midi_cj_chapter_m_log_flag_k),
8559                                 RTP_MIDI_CJ_CHAPTER_M_FLAG_K,
8560                                 NULL, HFILL
8561                         }
8562                 },
8563
8564                 {
8565                         &hf_rtp_midi_cj_chapter_m_log_lflag,
8566                         {
8567                                 "Chapter M Log L-Flag",
8568                                 "rtpmidi.cj_chapter_m_log_lflag",
8569                                 FT_BOOLEAN,
8570                                 8,
8571                                 TFS(&rtp_midi_cj_chapter_m_log_flag_l),
8572                                 RTP_MIDI_CJ_CHAPTER_M_FLAG_L,
8573                                 NULL, HFILL
8574                         }
8575                 },
8576
8577                 {
8578                         &hf_rtp_midi_cj_chapter_m_log_mflag,
8579                         {
8580                                 "Chapter M Log M-Flag",
8581                                 "rtpmidi.cj_chapter_m_log_mflag",
8582                                 FT_BOOLEAN,
8583                                 8,
8584                                 TFS(&rtp_midi_cj_chapter_m_log_flag_m),
8585                                 RTP_MIDI_CJ_CHAPTER_M_FLAG_M,
8586                                 NULL, HFILL
8587                         }
8588                 },
8589
8590                 {
8591                         &hf_rtp_midi_cj_chapter_m_log_nflag,
8592                         {
8593                                 "Chapter M Log N-Flag",
8594                                 "rtpmidi.cj_chapter_m_log_nflag",
8595                                 FT_BOOLEAN,
8596                                 8,
8597                                 TFS(&rtp_midi_cj_chapter_m_log_flag_n),
8598                                 RTP_MIDI_CJ_CHAPTER_M_FLAG_N,
8599                                 NULL, HFILL
8600                         }
8601                 },
8602
8603                 {
8604                         &hf_rtp_midi_cj_chapter_m_log_tflag,
8605                         {
8606                                 "Chapter M Log T-Flag",
8607                                 "rtpmidi.cj_chapter_m_log_tflag",
8608                                 FT_BOOLEAN,
8609                                 8,
8610                                 TFS(&rtp_midi_cj_chapter_m_log_flag_t),
8611                                 RTP_MIDI_CJ_CHAPTER_M_FLAG_T,
8612                                 NULL, HFILL
8613                         }
8614                 },
8615
8616                 {
8617                         &hf_rtp_midi_cj_chapter_m_log_vflag,
8618                         {
8619                                 "Chapter M Log V-Flag",
8620                                 "rtpmidi.cj_chapter_m_log_vflag",
8621                                 FT_BOOLEAN,
8622                                 8,
8623                                 TFS(&rtp_midi_cj_chapter_m_log_flag_v),
8624                                 RTP_MIDI_CJ_CHAPTER_M_FLAG_V,
8625                                 NULL, HFILL
8626                         }
8627                 },
8628
8629                 {
8630                         &hf_rtp_midi_cj_chapter_m_log_rflag,
8631                         {
8632                                 "Chapter M Log R-Flag",
8633                                 "rtpmidi.cj_chapter_m_log_rflag",
8634                                 FT_BOOLEAN,
8635                                 8,
8636                                 TFS(&rtp_midi_cj_chapter_m_log_flag_r),
8637                                 RTP_MIDI_CJ_CHAPTER_M_FLAG_R,
8638                                 NULL, HFILL
8639                         }
8640                 },
8641
8642                 {
8643                         &hf_rtp_midi_cj_chapter_m_log_msb_x,
8644                         {
8645                                 "Chapter M Log MSB X-Flag",
8646                                 "rtpmidi.cj_chapter_m_log_msb_xflag",
8647                                 FT_BOOLEAN,
8648                                 8,
8649                                 TFS(&rtp_midi_cj_chapter_m_log_flag_x),
8650                                 0x80,
8651                                 NULL, HFILL
8652                         }
8653                 },
8654
8655                 {
8656                         &hf_rtp_midi_cj_chapter_m_log_msb,
8657                         {
8658                                 "Chapter M Log MSB",
8659                                 "rtpmidi.cj_chapter_m_log_msb",
8660                                 FT_UINT8,
8661                                 BASE_HEX,
8662                                 NULL,
8663                                 0x7f,
8664                                 NULL, HFILL
8665                         }
8666                 },
8667
8668                 {
8669                         &hf_rtp_midi_cj_chapter_m_log_lsb_x,
8670                         {
8671                                 "Chapter M Log LSB X-Flag",
8672                                 "rtpmidi.cj_chapter_m_log_lsb_xflag",
8673                                 FT_BOOLEAN,
8674                                 8,
8675                                 TFS(&rtp_midi_cj_chapter_m_log_flag_x),
8676                                 0x80,
8677                                 NULL, HFILL
8678                         }
8679                 },
8680
8681                 {
8682                         &hf_rtp_midi_cj_chapter_m_log_lsb,
8683                         {
8684                                 "Chapter M Log LSB",
8685                                 "rtpmidi.cj_chapter_m_log_lsb",
8686                                 FT_UINT8,
8687                                 BASE_HEX,
8688                                 NULL,
8689                                 0x7f,
8690                                 NULL, HFILL
8691                         }
8692                 },
8693
8694                 {
8695                         &hf_rtp_midi_cj_chapter_m_log_a_button_g,
8696                         {
8697                                 "Chapter M Log A-Button G-Flag",
8698                                 "rtpmidi.cj_chapter_m_log_a_button_gflag",
8699                                 FT_BOOLEAN,
8700                                 16,
8701                                 TFS(&rtp_midi_cj_chapter_m_log_flag_g),
8702                                 0x8000,
8703                                 NULL, HFILL
8704                         }
8705                 },
8706
8707                 {
8708                         &hf_rtp_midi_cj_chapter_m_log_a_button_x,
8709                         {
8710                                 "Chapter M Log A-Button X-Flag",
8711                                 "rtpmidi.cj_chapter_m_log_a_button_xflag",
8712                                 FT_BOOLEAN,
8713                                 16,
8714                                 TFS(&rtp_midi_cj_chapter_m_log_flag_x),
8715                                 0x4000,
8716                                 NULL, HFILL
8717                         }
8718                 },
8719
8720                 {
8721                         &hf_rtp_midi_cj_chapter_m_log_a_button,
8722                         {
8723                                 "Chapter M Log A-Button",
8724                                 "rtpmidi.cj_chapter_m_log_a_button",
8725                                 FT_UINT16,
8726                                 BASE_HEX,
8727                                 NULL,
8728                                 0x3fff,
8729                                 NULL, HFILL
8730                         }
8731                 },
8732
8733                 {
8734                         &hf_rtp_midi_cj_chapter_m_log_c_button_g,
8735                         {
8736                                 "Chapter M Log C-Button G-Flag",
8737                                 "rtpmidi.cj_chapter_m_log_c_button_gflag",
8738                                 FT_BOOLEAN,
8739                                 16,
8740                                 TFS(&rtp_midi_cj_chapter_m_log_flag_g),
8741                                 0x8000,
8742                                 NULL, HFILL
8743                         }
8744                 },
8745
8746                 {
8747                         &hf_rtp_midi_cj_chapter_m_log_c_button_r,
8748                         {
8749                                 "Chapter M Log C-Button R-Flag",
8750                                 "rtpmidi.cj_chapter_m_log_c_button_rflag",
8751                                 FT_BOOLEAN,
8752                                 16,
8753                                 TFS(&rtp_midi_cj_chapter_m_log_flag_r),
8754                                 0x4000,
8755                                 NULL, HFILL
8756                         }
8757                 },
8758
8759                 {
8760                         &hf_rtp_midi_cj_chapter_m_log_c_button,
8761                         {
8762                                 "Chapter M Log C-Button",
8763                                 "rtpmidi.cj_chapter_m_log_c_button",
8764                                 FT_UINT16,
8765                                 BASE_HEX,
8766                                 NULL,
8767                                 0x3fff,
8768                                 NULL, HFILL
8769                         }
8770                 },
8771
8772                 {
8773                         &hf_rtp_midi_cj_chapter_m_log_count_x,
8774                         {
8775                                 "Chapter M Log Count X-Flag",
8776                                 "rtpmidi.cj_chapter_m_log_count_xflag",
8777                                 FT_BOOLEAN,
8778                                 8,
8779                                 TFS(&rtp_midi_cj_chapter_m_log_flag_x),
8780                                 0x80,
8781                                 NULL, HFILL
8782                         }
8783                 },
8784
8785                 {
8786                         &hf_rtp_midi_cj_chapter_m_log_count,
8787                         {
8788                                 "Chapter M Log Count",
8789                                 "rtpmidi.cj_chapter_m_log_count",
8790                                 FT_UINT8,
8791                                 BASE_DEC,
8792                                 NULL,
8793                                 0x7f,
8794                                 NULL, HFILL
8795                         }
8796                 },
8797
8798                 {
8799                         &hf_rtp_midi_cj_chapter_w_sflag,
8800                         {
8801                                 "Chapter W S-Flag",
8802                                 "rtpmidi.cj_chapter_w_sflag",
8803                                 FT_BOOLEAN,
8804                                 8,
8805                                 TFS(&rtp_midi_js_flag_s),
8806                                 0x80,
8807                                 NULL, HFILL
8808                         }
8809                 },
8810
8811                 {
8812                         &hf_rtp_midi_cj_chapter_w_first,
8813                         {
8814                                 "Chapter W First",
8815                                 "rtpmidi.cj_chapter_w_first",
8816                                 FT_UINT8,
8817                                 BASE_HEX,
8818                                 NULL,
8819                                 0x7f,
8820                                 NULL, HFILL
8821                         }
8822                 },
8823
8824                 {
8825                         &hf_rtp_midi_cj_chapter_w_rflag,
8826                         {
8827                                 "Chapter W R-Flag",
8828                                 "rtpmidi.cj_chapter_w_rflag",
8829                                 FT_BOOLEAN,
8830                                 8,
8831                                 TFS(&rtp_midi_cj_chapter_m_log_flag_r),
8832                                 0x80,
8833                                 NULL, HFILL
8834                         }
8835                 },
8836
8837                 {
8838                         &hf_rtp_midi_cj_chapter_w_second,
8839                         {
8840                                 "Chapter W Second",
8841                                 "rtpmidi.cj_chapter_w_second",
8842                                 FT_UINT8,
8843                                 BASE_HEX,
8844                                 NULL,
8845                                 0x7f,
8846                                 NULL, HFILL
8847                         }
8848                 },
8849
8850                 {
8851                         &hf_rtp_midi_cj_chapter_n_bflag,
8852                         {
8853                                 "Chapter N B-Flag",
8854                                 "rtpmidi.cj_chapter_n_bflag",
8855                                 FT_BOOLEAN,
8856                                 16,
8857                                 TFS(&rtp_midi_js_flag_s),
8858                                 0x8000,
8859                                 NULL, HFILL
8860                         }
8861                 },
8862
8863                 {
8864                         &hf_rtp_midi_cj_chapter_n_len,
8865                         {
8866                                 "Chapter N Length",
8867                                 "rtpmidi.cj_chapter_n_length",
8868                                 FT_UINT16,
8869                                 BASE_DEC,
8870                                 NULL,
8871                                 0x7f00,
8872                                 NULL, HFILL
8873                         }
8874                 },
8875
8876                 {
8877                         &hf_rtp_midi_cj_chapter_n_low,
8878                         {
8879                                 "Chapter N Low",
8880                                 "rtpmidi.cj_chapter_n_low",
8881                                 FT_UINT16,
8882                                 BASE_DEC,
8883                                 NULL,
8884                                 0x00f0,
8885                                 NULL, HFILL
8886                         }
8887                 },
8888
8889                 {
8890                         &hf_rtp_midi_cj_chapter_n_high,
8891                         {
8892                                 "Chapter N High",
8893                                 "rtpmidi.cj_chapter_n_high",
8894                                 FT_UINT16,
8895                                 BASE_DEC,
8896                                 NULL,
8897                                 0x000f,
8898                                 NULL, HFILL
8899                         }
8900                 },
8901
8902                 {
8903                         &hf_rtp_midi_cj_chapter_n_log_sflag,
8904                         {
8905                                 "Chapter N Log S-Flag",
8906                                 "rtpmidi.cj_chapter_n_log_sflag",
8907                                 FT_BOOLEAN,
8908                                 8,
8909                                 TFS(&rtp_midi_js_flag_s),
8910                                 0x80,
8911                                 NULL, HFILL
8912                         }
8913                 },
8914
8915                 {
8916                         &hf_rtp_midi_cj_chapter_n_log_notenum,
8917                         {
8918                                 "Chapter N Log Note",
8919                                 "rtpmidi.cj_chapter_n_log_note",
8920                                 FT_UINT8,
8921                                 BASE_DEC,
8922                                 VALS(rtp_midi_note_values),
8923                                 0x7f,
8924                                 NULL, HFILL
8925                         }
8926                 },
8927
8928                 {
8929                         &hf_rtp_midi_cj_chapter_n_log_yflag,
8930                         {
8931                                 "Chapter N Log Y-Flag",
8932                                 "rtpmidi.cj_chapter_n_log_yflag",
8933                                 FT_BOOLEAN,
8934                                 8,
8935                                 TFS(&rtp_midi_cj_chapter_n_log_flag_y),
8936                                 0x80,
8937                                 NULL, HFILL
8938                         }
8939                 },
8940
8941                 {
8942                         &hf_rtp_midi_cj_chapter_n_log_velocity,
8943                         {
8944                                 "Chapter N Log Velocity",
8945                                 "rtpmidi.cj_chapter_n_log_velocity",
8946                                 FT_UINT8,
8947                                 BASE_DEC,
8948                                 NULL,
8949                                 0x7f,
8950                                 NULL, HFILL
8951                         }
8952                 },
8953
8954                 {
8955                         &hf_rtp_midi_cj_chapter_n_log_octet,
8956                         {
8957                                 "Chapter N Log Octet",
8958                                 "rtpmidi.cj_chapter_n_log_octet",
8959                                 FT_UINT8,
8960                                 BASE_HEX,
8961                                 NULL,
8962                                 0xff,
8963                                 NULL, HFILL
8964                         }
8965                 },
8966
8967                 {
8968                         &hf_rtp_midi_cj_chapter_e_sflag,
8969                         {
8970                                 "Chapter E S-Flag",
8971                                 "rtpmidi.cj_chapter_e_sflag",
8972                                 FT_BOOLEAN,
8973                                 8,
8974                                 TFS(&rtp_midi_js_flag_s),
8975                                 0x80,
8976                                 NULL, HFILL
8977                         }
8978                 },
8979
8980                 {
8981                         &hf_rtp_midi_cj_chapter_e_len,
8982                         {
8983                                 "Chapter E Length",
8984                                 "rtpmidi.cj_chapter_e_length",
8985                                 FT_UINT8,
8986                                 BASE_DEC,
8987                                 NULL,
8988                                 0x7f,
8989                                 NULL, HFILL
8990                         }
8991                 },
8992
8993                 {
8994                         &hf_rtp_midi_cj_chapter_e_log_sflag,
8995                         {
8996                                 "Chapter E Log S-Flag",
8997                                 "rtpmidi.cj_chapter_e_log_sflag",
8998                                 FT_BOOLEAN,
8999                                 8,
9000                                 TFS(&rtp_midi_js_flag_s),
9001                                 0x80,
9002                                 NULL, HFILL
9003                         }
9004                 },
9005
9006                 {
9007                         &hf_rtp_midi_cj_chapter_e_log_notenum,
9008                         {
9009                                 "Chapter E Log Note",
9010                                 "rtpmidi.cj_chapter_e_log_note",
9011                                 FT_UINT8,
9012                                 BASE_DEC,
9013                                 VALS(rtp_midi_note_values),
9014                                 0x7f,
9015                                 NULL, HFILL
9016                         }
9017                 },
9018
9019                 {
9020                         &hf_rtp_midi_cj_chapter_e_log_vflag,
9021                         {
9022                                 "Chapter N Log V-Flag",
9023                                 "rtpmidi.cj_chapter_n_log_vflag",
9024                                 FT_BOOLEAN,
9025                                 8,
9026                                 TFS(&rtp_midi_cj_chapter_e_log_flag_v),
9027                                 0x80,
9028                                 NULL, HFILL
9029                         }
9030                 },
9031
9032                 {
9033                         &hf_rtp_midi_cj_chapter_e_log_velocity,
9034                         {
9035                                 "Chapter E Log Velocity",
9036                                 "rtpmidi.cj_chapter_e_log_velocity",
9037                                 FT_UINT8,
9038                                 BASE_DEC,
9039                                 NULL,
9040                                 0x7f,
9041                                 NULL, HFILL
9042                         }
9043                 },
9044
9045                 {
9046                         &hf_rtp_midi_cj_chapter_e_log_count,
9047                         {
9048                                 "Chapter E Log Count",
9049                                 "rtpmidi.cj_chapter_e_log_count",
9050                                 FT_UINT8,
9051                                 BASE_DEC,
9052                                 NULL,
9053                                 0x7f,
9054                                 NULL, HFILL
9055                         }
9056                 },
9057
9058                 {
9059                         &hf_rtp_midi_cj_chapter_t_sflag,
9060                         {
9061                                 "Chapter T S-Flag",
9062                                 "rtpmidi.cj_chapter_t_sflag",
9063                                 FT_BOOLEAN,
9064                                 8,
9065                                 TFS(&rtp_midi_js_flag_s),
9066                                 0x80,
9067                                 NULL, HFILL
9068                         }
9069                 },
9070
9071                 {
9072                         &hf_rtp_midi_cj_chapter_t_pressure,
9073                         {
9074                                 "Chapter T Pressure",
9075                                 "rtpmidi.cj_chapter_t_pressure",
9076                                 FT_UINT8,
9077                                 BASE_DEC,
9078                                 NULL,
9079                                 0x7f,
9080                                 NULL, HFILL
9081                         }
9082                 },
9083
9084                 {
9085                         &hf_rtp_midi_cj_chapter_a_sflag,
9086                         {
9087                                 "Chapter A S-Flag",
9088                                 "rtpmidi.cj_chapter_a_sflag",
9089                                 FT_BOOLEAN,
9090                                 8,
9091                                 TFS(&rtp_midi_js_flag_s),
9092                                 0x80,
9093                                 NULL, HFILL
9094                         }
9095                 },
9096
9097                 {
9098                         &hf_rtp_midi_cj_chapter_a_len,
9099                         {
9100                                 "Chapter A Length",
9101                                 "rtpmidi.cj_chapter_a_length",
9102                                 FT_UINT8,
9103                                 BASE_DEC,
9104                                 NULL,
9105                                 0x7f,
9106                                 NULL, HFILL
9107                         }
9108                 },
9109
9110                 {
9111                         &hf_rtp_midi_cj_chapter_a_log_sflag,
9112                         {
9113                                 "Chapter A Log S-Flag",
9114                                 "rtpmidi.cj_chapter_a_log_sflag",
9115                                 FT_BOOLEAN,
9116                                 8,
9117                                 TFS(&rtp_midi_js_flag_s),
9118                                 0x80,
9119                                 NULL, HFILL
9120                         }
9121                 },
9122
9123                 {
9124                         &hf_rtp_midi_cj_chapter_a_log_notenum,
9125                         {
9126                                 "Chapter A Log Note",
9127                                 "rtpmidi.cj_chapter_a_log_note",
9128                                 FT_UINT8,
9129                                 BASE_DEC,
9130                                 VALS(rtp_midi_note_values),
9131                                 0x7f,
9132                                 NULL, HFILL
9133                         }
9134                 },
9135
9136                 {
9137                         &hf_rtp_midi_cj_chapter_a_log_xflag,
9138                         {
9139                                 "Chapter A Log X-Flag",
9140                                 "rtpmidi.cj_chapter_a_log_xflag",
9141                                 FT_BOOLEAN,
9142                                 8,
9143                                 TFS(&rtp_midi_cj_chapter_a_log_flag_x),
9144                                 0x80,
9145                                 NULL, HFILL
9146                         }
9147                 },
9148
9149                 {
9150                         &hf_rtp_midi_cj_chapter_a_log_pressure,
9151                         {
9152                                 "Chapter A Log Pressure",
9153                                 "rtpmidi.cj_chapter_a_log_pressure",
9154                                 FT_UINT8,
9155                                 BASE_DEC,
9156                                 NULL,
9157                                 0x7f,
9158                                 NULL, HFILL
9159                         }
9160                 },
9161
9162                 {
9163                         &hf_rtp_midi_sj_chapter_v_sflag,
9164                         {
9165                                 "Chapter V S-Flag",
9166                                 "rtpmidi.sj_chapter_v_sflag",
9167                                 FT_BOOLEAN,
9168                                 8,
9169                                 TFS(&rtp_midi_js_flag_s),
9170                                 0x80,
9171                                 NULL, HFILL
9172                         }
9173                 },
9174
9175                 {
9176                         &hf_rtp_midi_sj_chapter_v_count,
9177                         {
9178                                 "Chapter V Count",
9179                                 "rtpmidi.sj_chapter_v_count",
9180                                 FT_UINT8,
9181                                 BASE_DEC,
9182                                 NULL,
9183                                 0x7f,
9184                                 NULL, HFILL
9185                         }
9186                 },
9187
9188                 {
9189                         &hf_rtp_midi_sj_chapter_d_sflag,
9190                         {
9191                                 "Chapter D S-Flag",
9192                                 "rtpmidi.sj_chapter_d_sflag",
9193                                 FT_BOOLEAN,
9194                                 8,
9195                                 TFS(&rtp_midi_js_flag_s),
9196                                 RTP_MIDI_SJ_CHAPTER_D_FLAG_S,
9197                                 NULL, HFILL
9198                         }
9199                 },
9200
9201                 {
9202                         &hf_rtp_midi_sj_chapter_d_bflag,
9203                         {
9204                                 "Chapter D B-Flag",
9205                                 "rtpmidi.sj_chapter_d_bflag",
9206                                 FT_BOOLEAN,
9207                                 8,
9208                                 TFS(&rtp_midi_sj_chapter_d_flag_b),
9209                                 RTP_MIDI_SJ_CHAPTER_D_FLAG_B,
9210                                 NULL, HFILL
9211                         }
9212                 },
9213
9214                 {
9215                         &hf_rtp_midi_sj_chapter_d_gflag,
9216                         {
9217                                 "Chapter D G-Flag",
9218                                 "rtpmidi.sj_chapter_d_gflag",
9219                                 FT_BOOLEAN,
9220                                 8,
9221                                 TFS(&rtp_midi_sj_chapter_d_flag_g),
9222                                 RTP_MIDI_SJ_CHAPTER_D_FLAG_G,
9223                                 NULL, HFILL
9224                         }
9225                 },
9226
9227                 {
9228                         &hf_rtp_midi_sj_chapter_d_hflag,
9229                         {
9230                                 "Chapter D H-Flag",
9231                                 "rtpmidi.sj_chapter_d_hflag",
9232                                 FT_BOOLEAN,
9233                                 8,
9234                                 TFS(&rtp_midi_sj_chapter_d_flag_h),
9235                                 RTP_MIDI_SJ_CHAPTER_D_FLAG_H,
9236                                 NULL, HFILL
9237                         }
9238                 },
9239
9240                 {
9241                         &hf_rtp_midi_sj_chapter_d_jflag,
9242                         {
9243                                 "Chapter D J-Flag",
9244                                 "rtpmidi.sj_chapter_d_jflag",
9245                                 FT_BOOLEAN,
9246                                 8,
9247                                 TFS(&rtp_midi_sj_chapter_d_flag_j),
9248                                 RTP_MIDI_SJ_CHAPTER_D_FLAG_J,
9249                                 NULL, HFILL
9250                         }
9251                 },
9252
9253                 {
9254                         &hf_rtp_midi_sj_chapter_d_kflag,
9255                         {
9256                                 "Chapter D K-Flag",
9257                                 "rtpmidi.sj_chapter_d_kflag",
9258                                 FT_BOOLEAN,
9259                                 8,
9260                                 TFS(&rtp_midi_sj_chapter_d_flag_k),
9261                                 RTP_MIDI_SJ_CHAPTER_D_FLAG_K,
9262                                 NULL, HFILL
9263                         }
9264                 },
9265
9266                 {
9267                         &hf_rtp_midi_sj_chapter_d_yflag,
9268                         {
9269                                 "Chapter D Y-Flag",
9270                                 "rtpmidi.sj_chapter_d_yflag",
9271                                 FT_BOOLEAN,
9272                                 8,
9273                                 TFS(&rtp_midi_sj_chapter_d_flag_y),
9274                                 RTP_MIDI_SJ_CHAPTER_D_FLAG_Y,
9275                                 NULL, HFILL
9276                         }
9277                 },
9278
9279                 {
9280                         &hf_rtp_midi_sj_chapter_d_zflag,
9281                         {
9282                                 "Chapter D Z-Flag",
9283                                 "rtpmidi.sj_chapter_d_zflag",
9284                                 FT_BOOLEAN,
9285                                 8,
9286                                 TFS(&rtp_midi_sj_chapter_d_flag_z),
9287                                 RTP_MIDI_SJ_CHAPTER_D_FLAG_Z,
9288                                 NULL, HFILL
9289                         }
9290                 },
9291
9292                 {
9293                         &hf_rtp_midi_sj_chapter_d_reset_sflag,
9294                         {
9295                                 "Chapter D Reset S-Flag",
9296                                 "rtpmidi.sj_chapter_d_reset_sflag",
9297                                 FT_BOOLEAN,
9298                                 8,
9299                                 TFS(&rtp_midi_js_flag_s),
9300                                 RTP_MIDI_SJ_CHAPTER_D_RESET_FLAG_S,
9301                                 NULL, HFILL
9302                         }
9303                 },
9304
9305                 {
9306                         &hf_rtp_midi_sj_chapter_d_reset_count,
9307                         {
9308                                 "Chapter D Reset Count",
9309                                 "rtpmidi.cj_chapter_d_reset_count",
9310                                 FT_UINT8,
9311                                 BASE_DEC,
9312                                 NULL,
9313                                 RTP_MIDI_SJ_CHAPTER_D_RESET_COUNT,
9314                                 NULL, HFILL
9315                         }
9316                 },
9317
9318                 {
9319                         &hf_rtp_midi_sj_chapter_d_tune_sflag,
9320                         {
9321                                 "Chapter D Tune Request S-Flag",
9322                                 "rtpmidi.sj_chapter_d_tune_sflag",
9323                                 FT_BOOLEAN,
9324                                 8,
9325                                 TFS(&rtp_midi_js_flag_s),
9326                                 RTP_MIDI_SJ_CHAPTER_D_TUNE_FLAG_S,
9327                                 NULL, HFILL
9328                         }
9329                 },
9330
9331                 {
9332                         &hf_rtp_midi_sj_chapter_d_tune_count,
9333                         {
9334                                 "Chapter D Tune Request Count",
9335                                 "rtpmidi.cj_chapter_d_tune_count",
9336                                 FT_UINT8,
9337                                 BASE_DEC,
9338                                 NULL,
9339                                 RTP_MIDI_SJ_CHAPTER_D_TUNE_COUNT,
9340                                 NULL, HFILL
9341                         }
9342                 },
9343
9344                 {
9345                         &hf_rtp_midi_sj_chapter_d_song_sel_sflag,
9346                         {
9347                                 "Chapter D Song Select S-Flag",
9348                                 "rtpmidi.sj_chapter_d_song_sel_sflag",
9349                                 FT_BOOLEAN,
9350                                 8,
9351                                 TFS(&rtp_midi_js_flag_s),
9352                                 RTP_MIDI_SJ_CHAPTER_D_SONG_SEL_FLAG_S,
9353                                 NULL, HFILL
9354                         }
9355                 },
9356
9357                 {
9358                         &hf_rtp_midi_sj_chapter_d_song_sel_value,
9359                         {
9360                                 "Chapter D Song Select Value",
9361                                 "rtpmidi.cj_chapter_d_song_sel_value",
9362                                 FT_UINT8,
9363                                 BASE_DEC,
9364                                 NULL,
9365                                 RTP_MIDI_SJ_CHAPTER_D_SONG_SEL_VALUE,
9366                                 NULL, HFILL
9367                         }
9368                 },
9369
9370                 {
9371                         &hf_rtp_midi_sj_chapter_d_syscom_sflag,
9372                         {
9373                                 "Chapter D System Common (F4/F5) S-Flag",
9374                                 "rtpmidi.sj_chapter_d_syscom_sflag",
9375                                 FT_BOOLEAN,
9376                                 16,
9377                                 TFS(&rtp_midi_js_flag_s),
9378                                 RTP_MIDI_SJ_CHAPTER_D_SYSCOM_FLAG_S,
9379                                 NULL, HFILL
9380                         }
9381                 },
9382
9383                 {
9384                         &hf_rtp_midi_sj_chapter_d_syscom_cflag,
9385                         {
9386                                 "Chapter D System Common (F4/F5) C-Flag",
9387                                 "rtpmidi.sj_chapter_d_syscom_cflag",
9388                                 FT_BOOLEAN,
9389                                 16,
9390                                 TFS(&rtp_midi_sj_chapter_d_syscom_flag_c),
9391                                 RTP_MIDI_SJ_CHAPTER_D_SYSCOM_FLAG_C,
9392                                 NULL, HFILL
9393                         }
9394                 },
9395                 {
9396                         &hf_rtp_midi_sj_chapter_d_syscom_vflag,
9397                         {
9398                                 "Chapter D System Common (F4/F5) V-Flag",
9399                                 "rtpmidi.sj_chapter_d_syscom_vflag",
9400                                 FT_BOOLEAN,
9401                                 16,
9402                                 TFS(&rtp_midi_sj_chapter_d_syscom_flag_v),
9403                                 RTP_MIDI_SJ_CHAPTER_D_SYSCOM_FLAG_V,
9404                                 NULL, HFILL
9405                         }
9406                 },
9407                 {
9408                         &hf_rtp_midi_sj_chapter_d_syscom_lflag,
9409                         {
9410                                 "Chapter D System Common (F4/F5) L-Flag",
9411                                 "rtpmidi.sj_chapter_d_syscom_lflag",
9412                                 FT_BOOLEAN,
9413                                 16,
9414                                 TFS(&rtp_midi_sj_chapter_d_syscom_flag_l),
9415                                 RTP_MIDI_SJ_CHAPTER_D_SYSCOM_FLAG_L,
9416                                 NULL, HFILL
9417                         }
9418                 },
9419                 {
9420                         &hf_rtp_midi_sj_chapter_d_syscom_dsz,
9421                         {
9422                                 "Chapter D System Common (F4/F5) DSZ",
9423                                 "rtpmidi.sj_chapter_d_syscom_dsz",
9424                                 FT_UINT16,
9425                                 BASE_DEC,
9426                                 VALS(rtp_midi_sj_chapter_d_syscom_dsz_values),
9427                                 RTP_MIDI_SJ_CHAPTER_D_SYSCOM_MASK_DSZ,
9428                                 NULL, HFILL
9429                         }
9430                 },
9431                 {
9432                         &hf_rtp_midi_sj_chapter_d_syscom_length,
9433                         {
9434                                 "Chapter D System Common (F4/F5) Length",
9435                                 "rtpmidi.sj_chapter_d_syscom_len",
9436                                 FT_UINT16,
9437                                 BASE_DEC,
9438                                 NULL,
9439                                 RTP_MIDI_SJ_CHAPTER_D_SYSCOM_MASK_LENGTH,
9440                                 NULL, HFILL
9441                         }
9442                 },
9443                 {
9444                         &hf_rtp_midi_sj_chapter_d_syscom_count,
9445                         {
9446                                 "Chapter D System Common (F4/F5) Count",
9447                                 "rtpmidi.sj_chapter_d_syscom_count",
9448                                 FT_UINT8,
9449                                 BASE_DEC,
9450                                 NULL,
9451                                 RTP_MIDI_SJ_CHAPTER_D_SYSCOM_MASK_COUNT,
9452                                 NULL, HFILL
9453                         }
9454                 },
9455                 {
9456                         &hf_rtp_midi_sj_chapter_d_syscom_value,
9457                         {
9458                                 "Chapter D System Common (F4/F5) Value",
9459                                 "rtpmidi.sj_chapter_d_syscom_value",
9460                                 FT_BYTES,
9461                                 BASE_NONE,
9462                                 NULL,
9463                                 0x00,
9464                                 NULL, HFILL
9465                         }
9466                 },
9467                 {
9468                         &hf_rtp_midi_sj_chapter_d_syscom_legal,
9469                         {
9470                                 "Chapter D System Common (F4/F5) Legal - for future extension",
9471                                 "rtpmidi.sj_chapter_d_syscom_legal",
9472                                 FT_BYTES,
9473                                 BASE_NONE,
9474                                 NULL,
9475                                 0x00,
9476                                 NULL, HFILL
9477                         }
9478                 },
9479                 {
9480                         &hf_rtp_midi_sj_chapter_d_syscom_data,
9481                         {
9482                                 "Chapter D System Common (F4/F5) Erroneous Data",
9483                                 "rtpmidi.sj_chapter_d_syscom_data",
9484                                 FT_BYTES,
9485                                 BASE_NONE,
9486                                 NULL,
9487                                 0x00,
9488                                 NULL, HFILL
9489                         }
9490                 },
9491                 {
9492                         &hf_rtp_midi_sj_chapter_d_sysreal_sflag,
9493                         {
9494                                 "Chapter D System Realtime (F9/FD) S-Flag",
9495                                 "rtpmidi.sj_chapter_d_sysreal_sflag",
9496                                 FT_BOOLEAN,
9497                                 8,
9498                                 TFS(&rtp_midi_js_flag_s),
9499                                 RTP_MIDI_SJ_CHAPTER_D_SYSREAL_FLAG_S,
9500                                 NULL, HFILL
9501                         }
9502                 },
9503                 {
9504                         &hf_rtp_midi_sj_chapter_d_sysreal_cflag,
9505                         {
9506                                 "Chapter D System Realtime (F9/FF) C-Flag",
9507                                 "rtpmidi.sj_chapter_d_sysreal_cflag",
9508                                 FT_BOOLEAN,
9509                                 8,
9510                                 TFS(&rtp_midi_sj_chapter_d_syscom_flag_c),
9511                                 RTP_MIDI_SJ_CHAPTER_D_SYSREAL_FLAG_C,
9512                                 NULL, HFILL
9513                         }
9514                 },
9515                 {
9516                         &hf_rtp_midi_sj_chapter_d_sysreal_lflag,
9517                         {
9518                                 "Chapter D System Realtime (F9/FD) L-Flag",
9519                                 "rtpmidi.sj_chapter_d_sysreal_lflag",
9520                                 FT_BOOLEAN,
9521                                 8,
9522                                 TFS(&rtp_midi_sj_chapter_d_syscom_flag_l),
9523                                 RTP_MIDI_SJ_CHAPTER_D_SYSREAL_FLAG_L,
9524                                 NULL, HFILL
9525                         }
9526                 },
9527                 {
9528                         &hf_rtp_midi_sj_chapter_d_sysreal_length,
9529                         {
9530                                 "Chapter D System Realtime (F9/FD) Length",
9531                                 "rtpmidi.sj_chapter_d_sysreal_len",
9532                                 FT_UINT8,
9533                                 BASE_DEC,
9534                                 NULL,
9535                                 RTP_MIDI_SJ_CHAPTER_D_SYSREAL_MASK_LENGTH,
9536                                 NULL, HFILL
9537                         }
9538                 },
9539                 {
9540                         &hf_rtp_midi_sj_chapter_d_sysreal_count,
9541                         {
9542                                 "Chapter D System Realtime (F9/FD) Count",
9543                                 "rtpmidi.sj_chapter_d_sysreal_count",
9544                                 FT_UINT8,
9545                                 BASE_DEC,
9546                                 NULL,
9547                                 RTP_MIDI_SJ_CHAPTER_D_SYSREAL_MASK_COUNT,
9548                                 NULL, HFILL
9549                         }
9550                 },
9551                 {
9552                         &hf_rtp_midi_sj_chapter_d_sysreal_legal,
9553                         {
9554                                 "Chapter D System Realtime (F9/FD) Legal - for future extension",
9555                                 "rtpmidi.sj_chapter_d_sysreal_legal",
9556                                 FT_BYTES,
9557                                 BASE_NONE,
9558                                 NULL,
9559                                 0x00,
9560                                 NULL, HFILL
9561                         }
9562                 },
9563                 {
9564                         &hf_rtp_midi_sj_chapter_d_sysreal_data,
9565                         {
9566                                 "Chapter D System Realtime (F9/FD) Erroneous Data",
9567                                 "rtpmidi.sj_chapter_d_sysreal_data",
9568                                 FT_BYTES,
9569                                 BASE_NONE,
9570                                 NULL,
9571                                 0x00,
9572                                 NULL, HFILL
9573                         }
9574                 },
9575
9576                 {
9577                         &hf_rtp_midi_sj_chapter_q_sflag,
9578                         {
9579                                 "Chapter Q Sequencer State S-Flag",
9580                                 "rtpmidi.sj_chapter_q_sflag",
9581                                 FT_BOOLEAN,
9582                                 8,
9583                                 TFS(&rtp_midi_js_flag_s),
9584                                 RTP_MIDI_SJ_CHAPTER_Q_FLAG_S,
9585                                 NULL, HFILL
9586                         }
9587                 },
9588
9589                 {
9590                         &hf_rtp_midi_sj_chapter_q_nflag,
9591                         {
9592                                 "Chapter Q Sequencer State N-Flag",
9593                                 "rtpmidi.sj_chapter_q_nflag",
9594                                 FT_BOOLEAN,
9595                                 8,
9596                                 TFS(&rtp_midi_sj_chapter_q_flag_n),
9597                                 RTP_MIDI_SJ_CHAPTER_Q_FLAG_N,
9598                                 NULL, HFILL
9599                         }
9600                 },
9601
9602                 {
9603                         &hf_rtp_midi_sj_chapter_q_dflag,
9604                         {
9605                                 "Chapter Q Sequencer State D-Flag",
9606                                 "rtpmidi.sj_chapter_q_dflag",
9607                                 FT_BOOLEAN,
9608                                 8,
9609                                 TFS(&rtp_midi_sj_chapter_q_flag_d),
9610                                 RTP_MIDI_SJ_CHAPTER_Q_FLAG_D,
9611                                 NULL, HFILL
9612                         }
9613                 },
9614
9615                 {
9616                         &hf_rtp_midi_sj_chapter_q_cflag,
9617                         {
9618                                 "Chapter Q Sequencer State C-Flag",
9619                                 "rtpmidi.sj_chapter_q_cflag",
9620                                 FT_BOOLEAN,
9621                                 8,
9622                                 TFS(&rtp_midi_sj_chapter_q_flag_c),
9623                                 RTP_MIDI_SJ_CHAPTER_Q_FLAG_C,
9624                                 NULL, HFILL
9625                         }
9626                 },
9627                 {
9628                         &hf_rtp_midi_sj_chapter_q_tflag,
9629                         {
9630                                 "Chapter Q Sequencer State T-Flag",
9631                                 "rtpmidi.sj_chapter_q_tflag",
9632                                 FT_BOOLEAN,
9633                                 8,
9634                                 TFS(&rtp_midi_sj_chapter_q_flag_t),
9635                                 RTP_MIDI_SJ_CHAPTER_Q_FLAG_T,
9636                                 NULL, HFILL
9637                         }
9638                 },
9639                 {
9640                         &hf_rtp_midi_sj_chapter_q_top,
9641                         {
9642                                 "Chapter Q Sequencer State Top",
9643                                 "rtpmidi.sj_chapter_q_top",
9644                                 FT_UINT8,
9645                                 BASE_DEC,
9646                                 NULL,
9647                                 RTP_MIDI_SJ_CHAPTER_Q_MASK_TOP,
9648                                 NULL, HFILL
9649                         }
9650                 },
9651                 {
9652                         &hf_rtp_midi_sj_chapter_q_clock,
9653                         {
9654                                 "Chapter Q Sequencer State Clock",
9655                                 "rtpmidi.sj_chapter_q_clock",
9656                                 FT_UINT24,
9657                                 BASE_DEC,
9658                                 NULL,
9659                                 RTP_MIDI_SJ_CHAPTER_Q_MASK_CLOCK,
9660                                 NULL, HFILL
9661                         }
9662                 },
9663
9664                 {
9665                         &hf_rtp_midi_sj_chapter_q_timetools,
9666                         {
9667                                 "Chapter Q Sequencer State Timetools",
9668                                 "rtpmidi.sj_chapter_q_timetools",
9669                                 FT_UINT24,
9670                                 BASE_DEC,
9671                                 NULL,
9672                                 RTP_MIDI_SJ_CHAPTER_Q_MASK_TIMETOOLS,
9673                                 NULL, HFILL
9674                         }
9675                 },
9676
9677                 {
9678                         &hf_rtp_midi_sj_chapter_f_sflag,
9679                         {
9680                                 "Chapter F MTC S-Flag",
9681                                 "rtpmidi.sj_chapter_f_sflag",
9682                                 FT_BOOLEAN,
9683                                 8,
9684                                 TFS(&rtp_midi_js_flag_s),
9685                                 RTP_MIDI_SJ_CHAPTER_F_FLAG_S,
9686                                 NULL, HFILL
9687                         }
9688                 },
9689                 {
9690                         &hf_rtp_midi_sj_chapter_f_cflag,
9691                         {
9692                                 "Chapter F MTC C-Flag",
9693                                 "rtpmidi.sj_chapter_f_cflag",
9694                                 FT_BOOLEAN,
9695                                 8,
9696                                 TFS(&rtp_midi_sj_chapter_f_flag_c),
9697                                 RTP_MIDI_SJ_CHAPTER_F_FLAG_C,
9698                                 NULL, HFILL
9699                         }
9700                 },
9701                 {
9702                         &hf_rtp_midi_sj_chapter_f_pflag,
9703                         {
9704                                 "Chapter F MTC P-Flag",
9705                                 "rtpmidi.sj_chapter_f_pflag",
9706                                 FT_BOOLEAN,
9707                                 8,
9708                                 TFS(&rtp_midi_sj_chapter_f_flag_p),
9709                                 RTP_MIDI_SJ_CHAPTER_F_FLAG_P,
9710                                 NULL, HFILL
9711                         }
9712                 },
9713                 {
9714                         &hf_rtp_midi_sj_chapter_f_qflag,
9715                         {
9716                                 "Chapter F MTC Q-Flag",
9717                                 "rtpmidi.sj_chapter_f_qflag",
9718                                 FT_BOOLEAN,
9719                                 8,
9720                                 TFS(&rtp_midi_sj_chapter_f_flag_q),
9721                                 RTP_MIDI_SJ_CHAPTER_F_FLAG_Q,
9722                                 NULL, HFILL
9723                         }
9724                 },
9725                 {
9726                         &hf_rtp_midi_sj_chapter_f_dflag,
9727                         {
9728                                 "Chapter F MTC D-Flag",
9729                                 "rtpmidi.sj_chapter_f_dflag",
9730                                 FT_BOOLEAN,
9731                                 8,
9732                                 TFS(&rtp_midi_sj_chapter_f_flag_d),
9733                                 RTP_MIDI_SJ_CHAPTER_F_FLAG_D,
9734                                 NULL, HFILL
9735                         }
9736                 },
9737                 {
9738                         &hf_rtp_midi_sj_chapter_f_point,
9739                         {
9740                                 "Chapter F MTC Point",
9741                                 "rtpmidi.sj_chapter_f_point",
9742                                 FT_UINT8,
9743                                 BASE_DEC,
9744                                 NULL,
9745                                 RTP_MIDI_SJ_CHAPTER_F_MASK_POINT,
9746                                 NULL, HFILL
9747                         }
9748                 },
9749                 {
9750                         &hf_rtp_midi_sj_chapter_f_mt0,
9751                         {
9752                                 "Chapter F MTC MT0",
9753                                 "rtpmidi.sj_chapter_f_mt0",
9754                                 FT_UINT32,
9755                                 BASE_HEX,
9756                                 NULL,
9757                                 RTP_MIDI_SJ_CHAPTER_F_MASK_MT0,
9758                                 NULL, HFILL
9759                         }
9760                 },
9761                 {
9762                         &hf_rtp_midi_sj_chapter_f_mt1,
9763                         {
9764                                 "Chapter F MTC MT1",
9765                                 "rtpmidi.sj_chapter_f_mt1",
9766                                 FT_UINT32,
9767                                 BASE_HEX,
9768                                 NULL,
9769                                 RTP_MIDI_SJ_CHAPTER_F_MASK_MT1,
9770                                 NULL, HFILL
9771                         }
9772                 },
9773                 {
9774                         &hf_rtp_midi_sj_chapter_f_mt2,
9775                         {
9776                                 "Chapter F MTC MT2",
9777                                 "rtpmidi.sj_chapter_f_mt2",
9778                                 FT_UINT32,
9779                                 BASE_HEX,
9780                                 NULL,
9781                                 RTP_MIDI_SJ_CHAPTER_F_MASK_MT2,
9782                                 NULL, HFILL
9783                         }
9784                 },
9785                 {
9786                         &hf_rtp_midi_sj_chapter_f_mt3,
9787                         {
9788                                 "Chapter F MTC MT3",
9789                                 "rtpmidi.sj_chapter_f_mt3",
9790                                 FT_UINT32,
9791                                 BASE_HEX,
9792                                 NULL,
9793                                 RTP_MIDI_SJ_CHAPTER_F_MASK_MT3,
9794                                 NULL, HFILL
9795                         }
9796                 },
9797                 {
9798                         &hf_rtp_midi_sj_chapter_f_mt4,
9799                         {
9800                                 "Chapter F MTC MT4",
9801                                 "rtpmidi.sj_chapter_f_mt4",
9802                                 FT_UINT32,
9803                                 BASE_HEX,
9804                                 NULL,
9805                                 RTP_MIDI_SJ_CHAPTER_F_MASK_MT4,
9806                                 NULL, HFILL
9807                         }
9808                 },
9809                 {
9810                         &hf_rtp_midi_sj_chapter_f_mt5,
9811                         {
9812                                 "Chapter F MTC MT5",
9813                                 "rtpmidi.sj_chapter_f_mt5",
9814                                 FT_UINT32,
9815                                 BASE_HEX,
9816                                 NULL,
9817                                 RTP_MIDI_SJ_CHAPTER_F_MASK_MT5,
9818                                 NULL, HFILL
9819                         }
9820                 },
9821                 {
9822                         &hf_rtp_midi_sj_chapter_f_mt6,
9823                         {
9824                                 "Chapter F MTC MT6",
9825                                 "rtpmidi.sj_chapter_f_mt6",
9826                                 FT_UINT32,
9827                                 BASE_HEX,
9828                                 NULL,
9829                                 RTP_MIDI_SJ_CHAPTER_F_MASK_MT6,
9830                                 NULL, HFILL
9831                         }
9832                 },
9833                 {
9834                         &hf_rtp_midi_sj_chapter_f_mt7,
9835                         {
9836                                 "Chapter F MTC MT7",
9837                                 "rtpmidi.sj_chapter_f_mt7",
9838                                 FT_UINT32,
9839                                 BASE_HEX,
9840                                 NULL,
9841                                 RTP_MIDI_SJ_CHAPTER_F_MASK_MT7,
9842                                 NULL, HFILL
9843                         }
9844                 },
9845                 {
9846                         &hf_rtp_midi_sj_chapter_f_hr,
9847                         {
9848                                 "Chapter F MTC Hour",
9849                                 "rtpmidi.sj_chapter_f_hr",
9850                                 FT_UINT32,
9851                                 BASE_HEX,
9852                                 NULL,
9853                                 RTP_MIDI_SJ_CHAPTER_F_MASK_HR,
9854                                 NULL, HFILL
9855                         }
9856                 },
9857                 {
9858                         &hf_rtp_midi_sj_chapter_f_mn,
9859                         {
9860                                 "Chapter F MTC Minute",
9861                                 "rtpmidi.sj_chapter_f_mn",
9862                                 FT_UINT32,
9863                                 BASE_HEX,
9864                                 NULL,
9865                                 RTP_MIDI_SJ_CHAPTER_F_MASK_MN,
9866                                 NULL, HFILL
9867                         }
9868                 },
9869                 {
9870                         &hf_rtp_midi_sj_chapter_f_sc,
9871                         {
9872                                 "Chapter F MTC Second",
9873                                 "rtpmidi.sj_chapter_f_sc",
9874                                 FT_UINT32,
9875                                 BASE_HEX,
9876                                 NULL,
9877                                 RTP_MIDI_SJ_CHAPTER_F_MASK_SC,
9878                                 NULL, HFILL
9879                         }
9880                 },
9881                 {
9882                         &hf_rtp_midi_sj_chapter_f_fr,
9883                         {
9884                                 "Chapter F MTC Frame",
9885                                 "rtpmidi.sj_chapter_f_fr",
9886                                 FT_UINT32,
9887                                 BASE_HEX,
9888                                 NULL,
9889                                 RTP_MIDI_SJ_CHAPTER_F_MASK_FR,
9890                                 NULL, HFILL
9891                         }
9892                 },
9893                 {
9894                         &hf_rtp_midi_sj_chapter_x_sflag,
9895                         {
9896                                 "Chapter X Sysex S-Flag",
9897                                 "rtpmidi.sj_chapter_x_sflag",
9898                                 FT_BOOLEAN,
9899                                 8,
9900                                 TFS(&rtp_midi_js_flag_s),
9901                                 RTP_MIDI_SJ_CHAPTER_X_FLAG_S,
9902                                 NULL, HFILL
9903                         }
9904                 },
9905                 {
9906                         &hf_rtp_midi_sj_chapter_x_tflag,
9907                         {
9908                                 "Chapter X Sysex T-Flag",
9909                                 "rtpmidi.sj_chapter_x_tflag",
9910                                 FT_BOOLEAN,
9911                                 8,
9912                                 TFS(&rtp_midi_sj_chapter_x_flag_t),
9913                                 RTP_MIDI_SJ_CHAPTER_X_FLAG_T,
9914                                 NULL, HFILL
9915                         }
9916                 },
9917                 {
9918                         &hf_rtp_midi_sj_chapter_x_cflag,
9919                         {
9920                                 "Chapter X Sysex C-Flag",
9921                                 "rtpmidi.sj_chapter_x_cflag",
9922                                 FT_BOOLEAN,
9923                                 8,
9924                                 TFS(&rtp_midi_sj_chapter_x_flag_c),
9925                                 RTP_MIDI_SJ_CHAPTER_X_FLAG_C,
9926                                 NULL, HFILL
9927                         }
9928                 },
9929                 {
9930                         &hf_rtp_midi_sj_chapter_x_fflag,
9931                         {
9932                                 "Chapter X Sysex F-Flag",
9933                                 "rtpmidi.sj_chapter_x_fflag",
9934                                 FT_BOOLEAN,
9935                                 8,
9936                                 TFS(&rtp_midi_sj_chapter_x_flag_f),
9937                                 RTP_MIDI_SJ_CHAPTER_X_FLAG_F,
9938                                 NULL, HFILL
9939                         }
9940                 },
9941                 {
9942                         &hf_rtp_midi_sj_chapter_x_dflag,
9943                         {
9944                                 "Chapter X Sysex D-Flag",
9945                                 "rtpmidi.sj_chapter_x_dflag",
9946                                 FT_BOOLEAN,
9947                                 8,
9948                                 TFS(&rtp_midi_sj_chapter_x_flag_d),
9949                                 RTP_MIDI_SJ_CHAPTER_X_FLAG_D,
9950                                 NULL, HFILL
9951                         }
9952                 },
9953                 {
9954                         &hf_rtp_midi_sj_chapter_x_lflag,
9955                         {
9956                                 "Chapter X Sysex L-Flag",
9957                                 "rtpmidi.sj_chapter_x_lflag",
9958                                 FT_BOOLEAN,
9959                                 8,
9960                                 TFS(&rtp_midi_sj_chapter_x_flag_l),
9961                                 RTP_MIDI_SJ_CHAPTER_X_FLAG_L,
9962                                 NULL, HFILL
9963                         }
9964                 },
9965                 {
9966                         &hf_rtp_midi_sj_chapter_x_sta,
9967                         {
9968                                 "Chapter X Sysex STA",
9969                                 "rtpmidi.sj_chapter_x_sta",
9970                                 FT_UINT8,
9971                                 BASE_HEX,
9972                                 NULL,
9973                                 RTP_MIDI_SJ_CHAPTER_X_MASK_STA,
9974                                 NULL, HFILL
9975                         }
9976                 },
9977                 {
9978                         &hf_rtp_midi_sj_chapter_x_tcount,
9979                         {
9980                                 "Chapter X Sysex TCOUT",
9981                                 "rtpmidi.sj_chapter_x_tcount",
9982                                 FT_UINT8,
9983                                 BASE_DEC,
9984                                 NULL,
9985                                 RTP_MIDI_SJ_CHAPTER_X_MASK_TCOUNT,
9986                                 NULL, HFILL
9987                         }
9988                 },
9989                 {
9990                         &hf_rtp_midi_sj_chapter_x_count,
9991                         {
9992                                 "Chapter X Sysex COUNT",
9993                                 "rtpmidi.sj_chapter_x_count",
9994                                 FT_UINT8,
9995                                 BASE_DEC,
9996                                 NULL,
9997                                 RTP_MIDI_SJ_CHAPTER_X_MASK_COUNT,
9998                                 NULL, HFILL
9999                         }
10000                 },
10001                 {
10002                         &hf_rtp_midi_sj_chapter_x_first1,
10003                         {
10004                                 "Chapter X Sysex FIRST (one octet)",
10005                                 "rtpmidi.sj_chapter_x_first_1",
10006                                 FT_UINT8,
10007                                 BASE_HEX,
10008                                 NULL,
10009                                 0x7f,
10010                                 NULL, HFILL
10011                         }
10012                 },
10013                 {
10014                         &hf_rtp_midi_sj_chapter_x_first2,
10015                         {
10016                                 "Chapter X Sysex FIRST (two octets)",
10017                                 "rtpmidi.sj_chapter_x_first_2",
10018                                 FT_UINT16,
10019                                 BASE_HEX,
10020                                 NULL,
10021                                 0x7f7f,
10022                                 NULL, HFILL
10023                         }
10024                 },
10025                 {
10026                         &hf_rtp_midi_sj_chapter_x_first3,
10027                         {
10028                                 "Chapter X Sysex FIRST (three octets)",
10029                                 "rtpmidi.sj_chapter_x_first_3",
10030                                 FT_UINT24,
10031                                 BASE_HEX,
10032                                 NULL,
10033                                 0x7f7f7f,
10034                                 NULL, HFILL
10035                         }
10036                 },
10037                 {
10038                         &hf_rtp_midi_sj_chapter_x_first4,
10039                         {
10040                                 "Chapter X Sysex FIRST (four octets)",
10041                                 "rtpmidi.sj_chapter_x_first_4",
10042                                 FT_UINT32,
10043                                 BASE_HEX,
10044                                 NULL,
10045                                 0x7f7f7f7f,
10046                                 NULL, HFILL
10047                         }
10048                 },
10049                 {
10050                         &hf_rtp_midi_sj_chapter_x_data,
10051                         {
10052                                 "Chapter X Sysex Data",
10053                                 "rtpmidi.sj_chapter_x_data",
10054                                 FT_BYTES,
10055                                 BASE_NONE,
10056                                 NULL,
10057                                 0x00,
10058                                 NULL, HFILL
10059                         }
10060                 },
10061                 {
10062                         &hf_rtp_midi_sj_chapter_x_invalid_data,
10063                         {
10064                                 "Chapter X Invalid Sysex Data",
10065                                 "rtpmidi.sj_chapter_x_invalid_data",
10066                                 FT_BYTES,
10067                                 BASE_NONE,
10068                                 NULL,
10069                                 0x00,
10070                                 NULL, HFILL
10071                         }
10072                 },
10073                 {
10074                         &hf_rtp_midi_quarter_frame_type,
10075                         {
10076                                 "MTC-quarter-frame-type",
10077                                 "rtpmidi.mtc_quarter_frame_type",
10078                                 FT_UINT8,
10079                                 BASE_HEX,
10080                                 VALS(rtp_midi_qft_values),
10081                                 0x70,
10082                                 NULL, HFILL
10083                         }
10084                 },
10085                 {
10086                         &hf_rtp_midi_quarter_frame_value,
10087                         {
10088                                 "MTC-quarter-frame-value",
10089                                 "rtpmidi.mtc_quarter_frame_value",
10090                                 FT_UINT8,
10091                                 BASE_HEX,
10092                                 NULL,
10093                                 0x0f,
10094                                 NULL, HFILL
10095                         }
10096                 },
10097                 {
10098                         &hf_rtp_midi_spp,
10099                         {
10100                                 "Song Position Pointer",
10101                                 "rtpmidi.song_position_pointer",
10102                                 FT_UINT16,
10103                                 BASE_DEC,
10104                                 NULL,
10105                                 0x7f7f,
10106                                 NULL, HFILL
10107                         }
10108                 },
10109                 {
10110                         &hf_rtp_midi_spp_truncated,
10111                         {
10112                                 "Song Position Pointer (truncated)",
10113                                 "rtpmidi.song_position_pointer_truncated",
10114                                 FT_UINT8,
10115                                 BASE_DEC,
10116                                 NULL,
10117                                 0x7f,
10118                                 NULL, HFILL
10119                         }
10120                 },
10121                 {
10122                         &hf_rtp_midi_song_select,
10123                         {
10124                                 "Song Select",
10125                                 "rtpmidi.song_select",
10126                                 FT_UINT8,
10127                                 BASE_DEC,
10128                                 NULL,
10129                                 0x7f,
10130                                 NULL, HFILL
10131                         }
10132                 },
10133                 {
10134                         &hf_rtp_midi_manu_data,
10135                         {
10136                                 "Manufacturer specific data",
10137                                 "rtpmidi.manu_data",
10138                                 FT_BYTES,
10139                                 BASE_NONE,
10140                                 NULL,
10141                                 0x00,
10142                                 NULL, HFILL
10143                         }
10144                 },
10145                 {
10146                         &hf_rtp_midi_edu_data,
10147                         {
10148                                 "Educational command data",
10149                                 "rtpmidi.edu_data",
10150                                 FT_BYTES,
10151                                 BASE_NONE,
10152                                 NULL,
10153                                 0x00,
10154                                 NULL, HFILL
10155                         }
10156                 },
10157                 {
10158                         &hf_rtp_midi_unknown_data,
10159                         {
10160                                 "Unknown Data",
10161                                 "rtpmidi.unknown_data",
10162                                 FT_BYTES,
10163                                 BASE_NONE,
10164                                 NULL,
10165                                 0x00,
10166                                 NULL, HFILL
10167                         }
10168                 },
10169                 {
10170                         &hf_rtp_midi_sysex_common_realtime,
10171                         {
10172                                 "Sysex Common Realtime",
10173                                 "rtpmidi.sysex_common_realtime",
10174                                 FT_UINT8,
10175                                 BASE_HEX,
10176                                 VALS(rtp_midi_sysex_common_rt),
10177                                 0x7f,
10178                                 NULL, HFILL
10179                         }
10180                 },
10181                 {
10182                         &hf_rtp_midi_sysex_common_non_realtime,
10183                         {
10184                                 "Sysex Common Non-Realtime",
10185                                 "rtpmidi.sysex_common_non_realtime",
10186                                 FT_UINT8,
10187                                 BASE_HEX,
10188                                 VALS(rtp_midi_sysex_common_nrt),
10189                                 0x7f,
10190                                 NULL, HFILL
10191                         }
10192                 },
10193                 {
10194                         &hf_rtp_midi_sysex_common_device_id,
10195                         {
10196                                 "Sysex Common Device ID",
10197                                 "rtpmidi.sysex_common_device_id",
10198                                 FT_UINT8,
10199                                 BASE_HEX,
10200                                 NULL,
10201                                 0x7f,
10202                                 NULL, HFILL
10203                         }
10204                 },
10205                 {
10206                         &hf_rtp_midi_sysex_common_nrt_sd_ext,
10207                         {
10208                                 "Sysex Common Non-Realtime Sample Dump Extension",
10209                                 "rtpmidi.sysex_common_non_realtime_sample_dump_ext",
10210                                 FT_UINT8,
10211                                 BASE_HEX,
10212                                 VALS(rtp_midi_sysex_common_nrt_sd_ext),
10213                                 0x7f,
10214                                 NULL, HFILL
10215                         }
10216                 },
10217                 {
10218                         &hf_rtp_midi_sysex_common_nrt_gi,
10219                         {
10220                                 "Sysex Common Non-Realtime General Information",
10221                                 "rtpmidi.sysex_common_non_realtime_general_information",
10222                                 FT_UINT8,
10223                                 BASE_HEX,
10224                                 VALS(rtp_midi_sysex_common_nrt_gi),
10225                                 0x7f,
10226                                 NULL, HFILL
10227                         }
10228                 },
10229                 {
10230                         &hf_rtp_midi_sysex_common_nrt_fd,
10231                         {
10232                                 "Sysex Common Non-Realtime File Dump",
10233                                 "rtpmidi.sysex_common_non_realtime_file_dump",
10234                                 FT_UINT8,
10235                                 BASE_HEX,
10236                                 VALS(rtp_midi_sysex_common_nrt_fd),
10237                                 0x7f,
10238                                 NULL, HFILL
10239                         }
10240                 },
10241                 {
10242                         &hf_rtp_midi_sysex_common_tuning,
10243                         {
10244                                 "Sysex Common (Non-)Realtime Tuning",
10245                                 "rtpmidi.sysex_common_tuning",
10246                                 FT_UINT8,
10247                                 BASE_HEX,
10248                                 VALS(rtp_midi_sysex_common_tuning),
10249                                 0x7f,
10250                                 NULL, HFILL
10251                         }
10252                 },
10253                 {
10254                         &hf_rtp_midi_sysex_common_nrt_gm,
10255                         {
10256                                 "Sysex Common Non-Realtime General MIDI (GM)",
10257                                 "rtpmidi.sysex_common_non_realtime_gm",
10258                                 FT_UINT8,
10259                                 BASE_HEX,
10260                                 VALS(rtp_midi_sysex_common_nrt_gm),
10261                                 0x7f,
10262                                 NULL, HFILL
10263                         }
10264                 },
10265                 {
10266                         &hf_rtp_midi_sysex_common_nrt_dls,
10267                         {
10268                                 "Sysex Common Non-Realtime Downloadable Sounds (DLS)",
10269                                 "rtpmidi.sysex_common_non_realtime_dls",
10270                                 FT_UINT8,
10271                                 BASE_HEX,
10272                                 VALS(rtp_midi_sysex_common_nrt_dls),
10273                                 0x7f,
10274                                 NULL, HFILL
10275                         }
10276                 },
10277                 {
10278                         &hf_rtp_midi_sysex_common_rt_mtc,
10279                         {
10280                                 "Sysex Common Realtime MTC",
10281                                 "rtpmidi.sysex_common_realtime_mtc",
10282                                 FT_UINT8,
10283                                 BASE_HEX,
10284                                 VALS(rtp_midi_sysex_common_rt_mtc),
10285                                 0x7f,
10286                                 NULL, HFILL
10287                         }
10288                 },
10289                 {
10290                         &hf_rtp_midi_sysex_common_rt_sc,
10291                         {
10292                                 "Sysex Common Realtime Show Control",
10293                                 "rtpmidi.sysex_common_realtime_sc",
10294                                 FT_UINT8,
10295                                 BASE_HEX,
10296                                 VALS(rtp_midi_sysex_common_rt_show_control),
10297                                 0x7f,
10298                                 NULL, HFILL
10299                         }
10300                 },
10301                 {
10302                         &hf_rtp_midi_sysex_common_rt_ni,
10303                         {
10304                                 "Sysex Common Realtime Notation Information",
10305                                 "rtpmidi.sysex_common_realtime_ni",
10306                                 FT_UINT8,
10307                                 BASE_HEX,
10308                                 VALS(rtp_midi_sysex_common_rt_notations),
10309                                 0x7f,
10310                                 NULL, HFILL
10311                         }
10312                 },
10313                 {
10314                         &hf_rtp_midi_sysex_common_rt_dc,
10315                         {
10316                                 "Sysex Common Realtime Device Control",
10317                                 "rtpmidi.sysex_common_realtime_dc",
10318                                 FT_UINT8,
10319                                 BASE_HEX,
10320                                 VALS(rtp_midi_sysex_common_rt_device_control),
10321                                 0x7f,
10322                                 NULL, HFILL
10323                         }
10324                 },
10325                 {
10326                         &hf_rtp_midi_sysex_common_rt_mtc_cueing,
10327                         {
10328                                 "Sysex Common Realtime MTC Cueing",
10329                                 "rtpmidi.sysex_common_rt_mtc_cue",
10330                                 FT_UINT8,
10331                                 BASE_HEX,
10332                                 VALS(rtp_midi_sysex_common_rt_mtc_cue),
10333                                 0x7f,
10334                                 NULL, HFILL
10335                         }
10336                 },
10337                 {
10338                         &hf_rtp_midi_sysex_common_nrt_mtc,
10339                         {
10340                                 "Sysex Common Non-Realtime MTC",
10341                                 "rtpmidi.sysex_common_nrt_mtc",
10342                                 FT_UINT8,
10343                                 BASE_HEX,
10344                                 VALS(rtp_midi_sysex_common_nrt_mtc),
10345                                 0x7f,
10346                                 NULL, HFILL
10347                         }
10348                 },
10349                 {
10350                         &hf_rtp_midi_sysex_common_rt_mmc_commands,
10351                         {
10352                                 "Sysex Common Realtime Machine Control Commands",
10353                                 "rtpmidi.sysex_common_realtime_mmc_cmds",
10354                                 FT_UINT8,
10355                                 BASE_HEX,
10356                                 VALS(rtp_midi_sysex_common_rt_mmc_commands),
10357                                 0x7f,
10358                                 NULL, HFILL
10359                         }
10360                 },
10361                 {
10362                         &hf_rtp_midi_sysex_common_rt_mmc_responses,
10363                         {
10364                                 "Sysex Common Realtime Machine Control Responses",
10365                                 "rtpmidi.sysex_common_realtime_mmc_resps",
10366                                 FT_UINT8,
10367                                 BASE_HEX,
10368                                 VALS(rtp_midi_sysex_common_rt_mmc_responses),
10369                                 0x7f,
10370                                 NULL, HFILL
10371                         }
10372                 },
10373                 {
10374                         &hf_rtp_midi_sysex_common_nrt_gi_device_family,
10375                         {
10376                                 "Sysex Common Non-Realtime General Information Device Family",
10377                                 "rtpmidi.sysex_common_non_realtime_general_information_device_family",
10378                                 FT_UINT16,
10379                                 BASE_HEX,
10380                                 NULL,
10381                                 0x7f7f,
10382                                 NULL, HFILL
10383                         }
10384                 },
10385                 {
10386                         &hf_rtp_midi_sysex_common_nrt_gi_device_family_member,
10387                         {
10388                                 "Sysex Common Non-Realtime General Information Device Family Member",
10389                                 "rtpmidi.sysex_common_non_realtime_general_information_device_family_member",
10390                                 FT_UINT16,
10391                                 BASE_HEX,
10392                                 NULL,
10393                                 0x7f7f,
10394                                 NULL, HFILL
10395                         }
10396                 },
10397                 {
10398                         &hf_rtp_midi_sysex_common_nrt_gi_software_rev,
10399                         {
10400                                 "Sysex Common Non-Realtime General Information Software Revision",
10401                                 "rtpmidi.sysex_common_non_realtime_general_information_software_revision",
10402                                 FT_UINT32,
10403                                 BASE_HEX,
10404                                 NULL,
10405                                 0x7f7f7f7f,
10406                                 NULL, HFILL
10407                         }
10408                 },
10409                 {
10410                         &hf_rtp_midi_sysex_common_nrt_sd_packet_number,
10411                         {
10412                                 "Sysex Common Non-Realtime Sample Dump Packet Number",
10413                                 "rtpmidi.sysex_common_non_realtime_sample_dump_packet_number",
10414                                 FT_UINT8,
10415                                 BASE_DEC,
10416                                 NULL,
10417                                 0x7f,
10418                                 NULL, HFILL
10419                         }
10420                 },
10421                 {
10422                         &hf_rtp_midi_sysex_common_nrt_sd_header_sn,
10423                         {
10424                                 "Sysex Common Non-Realtime Sample Dump Sample Number",
10425                                 "rtpmidi.sysex_common_non_realtime_sample_dump_sample_number",
10426                                 FT_UINT16,
10427                                 BASE_DEC,
10428                                 NULL,
10429                                 0x7f7f,
10430                                 NULL, HFILL
10431                         }
10432                 },
10433                 {
10434                         &hf_rtp_midi_sysex_common_nrt_sd_header_sf,
10435                         {
10436                                 "Sysex Common Non-Realtime Sample Dump Sample Format",
10437                                 "rtpmidi.sysex_common_non_realtime_sample_dump_sample_format",
10438                                 FT_UINT8,
10439                                 BASE_DEC,
10440                                 NULL,
10441                                 0x7f,
10442                                 NULL, HFILL
10443                         }
10444                 },
10445                 {
10446                         &hf_rtp_midi_sysex_common_nrt_sd_header_sp,
10447                         {
10448                                 "Sysex Common Non-Realtime Sample Dump Sample Period",
10449                                 "rtpmidi.sysex_common_non_realtime_sample_dump_sample_period",
10450                                 FT_UINT24,
10451                                 BASE_DEC,
10452                                 NULL,
10453                                 0x7f7f7f,
10454                                 NULL, HFILL
10455                         }
10456                 },
10457                 {
10458                         &hf_rtp_midi_sysex_common_nrt_sd_header_sl,
10459                         {
10460                                 "Sysex Common Non-Realtime Sample Dump Sample Length",
10461                                 "rtpmidi.sysex_common_non_realtime_sample_dump_sample_length",
10462                                 FT_UINT24,
10463                                 BASE_DEC,
10464                                 NULL,
10465                                 0x7f7f7f,
10466                                 NULL, HFILL
10467                         }
10468                 },
10469                 {
10470                         &hf_rtp_midi_sysex_common_nrt_sd_header_ls,
10471                         {
10472                                 "Sysex Common Non-Realtime Sample Dump Loop Start",
10473                                 "rtpmidi.sysex_common_non_realtime_sample_dump_loop_start",
10474                                 FT_UINT24,
10475                                 BASE_DEC,
10476                                 NULL,
10477                                 0x7f7f7f,
10478                                 NULL, HFILL
10479                         }
10480                 },
10481                 {
10482                         &hf_rtp_midi_sysex_common_nrt_sd_header_le,
10483                         {
10484                                 "Sysex Common Non-Realtime Sample Dump Loop End",
10485                                 "rtpmidi.sysex_common_non_realtime_sample_dump_loop_end",
10486                                 FT_UINT24,
10487                                 BASE_DEC,
10488                                 NULL,
10489                                 0x7f7f7f,
10490                                 NULL, HFILL
10491                         }
10492                 },
10493                 {
10494                         &hf_rtp_midi_sysex_common_nrt_sd_header_lt,
10495                         {
10496                                 "Sysex Common Non-Realtime Sample Dump Loop Type",
10497                                 "rtpmidi.sysex_common_non_realtime_sample_dump_loop_type",
10498                                 FT_UINT8,
10499                                 BASE_DEC,
10500                                 VALS(rtp_midi_sysex_common_nrt_sd_lt),
10501                                 0x7f,
10502                                 NULL, HFILL
10503                         }
10504                 },
10505                 {
10506                         &hf_rtp_midi_sysex_common_nrt_sd_packet_count,
10507                         {
10508                                 "Sysex Common Non-Realtime Sample Dump Running Packet Count",
10509                                 "rtpmidi.sysex_common_non_realtime_sample_dump_packet_count",
10510                                 FT_UINT8,
10511                                 BASE_DEC,
10512                                 NULL,
10513                                 0x7f,
10514                                 NULL, HFILL
10515                         }
10516                 },
10517                 {
10518                         &hf_rtp_midi_sysex_common_nrt_sd_packet_check,
10519                         {
10520                                 "Sysex Common Non-Realtime Sample Dump Checkum",
10521                                 "rtpmidi.sysex_common_non_realtime_sample_dump_checksum",
10522                                 FT_UINT8,
10523                                 BASE_HEX,
10524                                 NULL,
10525                                 0x7f,
10526                                 NULL, HFILL
10527                         }
10528                 },
10529                 {
10530                         &hf_rtp_midi_sysex_common_nrt_sd_packet_data,
10531                         {
10532                                 "Sysex Common Non-Realtime Sample Dump Data Byte",
10533                                 "rtpmidi.sysex_common_non_realtime_sample_dump_data",
10534                                 FT_BYTES,
10535                                 BASE_NONE,
10536                                 NULL,
10537                                 0,
10538                                 NULL, HFILL
10539                         }
10540                 },
10541                 {
10542                         &hf_rtp_midi_sysex_common_nrt_sd_ext_ln,
10543                         {
10544                                 "Sysex Common Non-Realtime Sample Dump LP Transmission Loop Number",
10545                                 "rtpmidi.sysex_common_non_realtime_sample_dump_lp_trans_ln",
10546                                 FT_UINT16,
10547                                 BASE_DEC,
10548                                 NULL,
10549                                 0x7f7f,
10550                                 NULL, HFILL
10551                         }
10552                 },
10553                 {
10554                         &hf_rtp_midi_sysex_common_nrt_fd_device_id,
10555                         {
10556                                 "Sysex Common Non-Realtime File Dump Device ID",
10557                                 "rtpmidi.sysex_common_non_realtime_fd_device_id",
10558                                 FT_UINT8,
10559                                 BASE_HEX,
10560                                 NULL,
10561                                 0x7f,
10562                                 NULL, HFILL
10563                         }
10564                 },
10565                 {
10566                         &hf_rtp_midi_sysex_common_nrt_fd_type,
10567                         {
10568                                 "Sysex Common Non-Realtime File Dump File Type",
10569                                 "rtpmidi.sysex_common_non_realtime_fd_type",
10570                                 FT_STRING,
10571                                 BASE_NONE,
10572                                 NULL,
10573                                 0x0,
10574                                 NULL, HFILL
10575                         }
10576                 },
10577                 {
10578                         &hf_rtp_midi_sysex_common_nrt_fd_name,
10579                         {
10580                                 "Sysex Common Non-Realtime File Dump File Name",
10581                                 "rtpmidi.sysex_common_non_realtime_fd_name",
10582                                 FT_STRING,
10583                                 BASE_NONE,
10584                                 NULL,
10585                                 0x0,
10586                                 NULL, HFILL
10587                         }
10588                 },
10589                 {
10590                         &hf_rtp_midi_sysex_common_nrt_fd_length,
10591                         {
10592                                 "Sysex Common Non-Realtime File Dump Length",
10593                                 "rtpmidi.sysex_common_non_realtime_fd_length",
10594                                 FT_UINT32,
10595                                 BASE_DEC,
10596                                 NULL,
10597                                 0x7f7f7f7f,
10598                                 NULL, HFILL
10599                         }
10600                 },
10601                 {
10602                         &hf_rtp_midi_sysex_common_nrt_fd_packet_num,
10603                         {
10604                                 "Sysex Common Non-Realtime File Packet Number",
10605                                 "rtpmidi.sysex_common_non_realtime_fd_packet_num",
10606                                 FT_UINT8,
10607                                 BASE_DEC,
10608                                 NULL,
10609                                 0x7f,
10610                                 NULL, HFILL
10611                         }
10612                 },
10613                 {
10614                         &hf_rtp_midi_sysex_common_nrt_fd_byte_count,
10615                         {
10616                                 "Sysex Common Non-Realtime File Byte Count",
10617                                 "rtpmidi.sysex_common_non_realtime_fd_byte_count",
10618                                 FT_UINT8,
10619                                 BASE_DEC,
10620                                 NULL,
10621                                 0x7f,
10622                                 NULL, HFILL
10623                         }
10624                 },
10625                 {
10626                         &hf_rtp_midi_sysex_common_nrt_fd_packet_data,
10627                         {
10628                                 "Sysex Common Non-Realtime File Packet Data",
10629                                 "rtpmidi.sysex_common_non_realtime_fd_packet_data",
10630                                 FT_BYTES,
10631                                 BASE_NONE,
10632                                 NULL,
10633                                 0x0,
10634                                 NULL, HFILL
10635                         }
10636                 },
10637                 {
10638                         &hf_rtp_midi_sysex_common_nrt_fd_checksum,
10639                         {
10640                                 "Sysex Common Non-Realtime File Checksum",
10641                                 "rtpmidi.sysex_common_non_realtime_fd_checksum",
10642                                 FT_UINT8,
10643                                 BASE_HEX,
10644                                 NULL,
10645                                 0x7f,
10646                                 NULL, HFILL
10647                         }
10648                 },
10649                 {
10650                         &hf_rtp_midi_sysex_common_tune_program,
10651                         {
10652                                 "Sysex Common (Non-)Realtime Tuning Program",
10653                                 "rtpmidi.sysex_common_tune_program",
10654                                 FT_UINT8,
10655                                 BASE_HEX,
10656                                 NULL,
10657                                 0x7f,
10658                                 NULL, HFILL
10659                         }
10660                 },
10661                 {
10662                         &hf_rtp_midi_sysex_common_tune_name,
10663                         {
10664                                 "Sysex Common (Non-)Realtime Tuning Name",
10665                                 "rtpmidi.sysex_common_tune_name",
10666                                 FT_STRING,
10667                                 BASE_NONE,
10668                                 NULL,
10669                                 0x0,
10670                                 NULL, HFILL
10671                         }
10672                 },
10673                 {
10674                         &hf_rtp_midi_sysex_common_tune_freq,
10675                         {
10676                                 "Sysex Common (Non-)Realtime Tuning Frequency",
10677                                 "rtpmidi.sysex_common_tune_freq",
10678                                 FT_UINT24,
10679                                 BASE_HEX,
10680                                 NULL,
10681                                 0x7f7f7f,
10682                                 NULL, HFILL
10683                         }
10684                 },
10685                 {
10686                         &hf_rtp_midi_sysex_common_tune_checksum,
10687                         {
10688                                 "Sysex Common (Non-)Realtime Tuning Checksum",
10689                                 "rtpmidi.sysex_common_tune_checksum",
10690                                 FT_UINT8,
10691                                 BASE_HEX,
10692                                 NULL,
10693                                 0x7f,
10694                                 NULL, HFILL
10695                         }
10696                 },
10697                 {
10698                         &hf_rtp_midi_sysex_common_tune_changes,
10699                         {
10700                                 "Sysex Common (Non-)Realtime Tuning Changes",
10701                                 "rtpmidi.sysex_common_tune_changes",
10702                                 FT_UINT8,
10703                                 BASE_DEC,
10704                                 NULL,
10705                                 0x7f,
10706                                 NULL, HFILL
10707                         }
10708                 },
10709                 {
10710                         &hf_rtp_midi_sysex_common_tune_note,
10711                         {
10712                                 "Sysex Common (Non-)Realtime Tuning Note",
10713                                 "rtpmidi.sysex_common_tune_note",
10714                                 FT_UINT8,
10715                                 BASE_DEC,
10716                                 VALS(rtp_midi_note_values),
10717                                 0x7f,
10718                                 NULL, HFILL
10719                         }
10720                 },
10721                 {
10722                         &hf_rtp_midi_sysex_common_rt_mtc_fm_type,
10723                         {
10724                                 "Sysex Common Realtime MTC Full Message Type",
10725                                 "rtpmidi.sysex_common_rt_mtc_fm_type",
10726                                 FT_UINT8,
10727                                 BASE_HEX,
10728                                 VALS(rtp_midi_mtc_fm_type_values),
10729                                 0x60,
10730                                 NULL, HFILL
10731                         }
10732                 },
10733                 {
10734                         &hf_rtp_midi_sysex_common_rt_mtc_fm_hr,
10735                         {
10736                                 "Sysex Common Realtime MTC Full Message Hour",
10737                                 "rtpmidi.sysex_common_rt_mtc_fm_hour",
10738                                 FT_UINT8,
10739                                 BASE_DEC,
10740                                 NULL,
10741                                 0x1f,
10742                                 NULL, HFILL
10743                         }
10744                 },
10745                 {
10746                         &hf_rtp_midi_sysex_common_rt_mtc_fm_mn,
10747                         {
10748                                 "Sysex Common Realtime MTC Full Message Minute",
10749                                 "rtpmidi.sysex_common_rt_mtc_fm_minute",
10750                                 FT_UINT8,
10751                                 BASE_DEC,
10752                                 NULL,
10753                                 0x7f,
10754                                 NULL, HFILL
10755                         }
10756                 },
10757                 {
10758                         &hf_rtp_midi_sysex_common_rt_mtc_fm_sc,
10759                         {
10760                                 "Sysex Common Realtime MTC Full Message Second",
10761                                 "rtpmidi.sysex_common_rt_mtc_fm_second",
10762                                 FT_UINT8,
10763                                 BASE_DEC,
10764                                 NULL,
10765                                 0x7f,
10766                                 NULL, HFILL
10767                         }
10768                 },
10769                 {
10770                         &hf_rtp_midi_sysex_common_rt_mtc_fm_fr,
10771                         {
10772                                 "Sysex Common Realtime MTC Full Message Frame",
10773                                 "rtpmidi.sysex_common_rt_mtc_fm_frame",
10774                                 FT_UINT8,
10775                                 BASE_DEC,
10776                                 NULL,
10777                                 0x7f,
10778                                 NULL, HFILL
10779                         }
10780                 },
10781                 {
10782                         &hf_rtp_midi_sysex_common_rt_mtc_ub_u1,
10783                         {
10784                                 "Sysex Common Realtime MTC User Bits U1",
10785                                 "rtpmidi.sysex_common_rt_mtc_ub_u1",
10786                                 FT_UINT8,
10787                                 BASE_HEX,
10788                                 NULL,
10789                                 0x0f,
10790                                 NULL, HFILL
10791                         }
10792                 },
10793                 {
10794                         &hf_rtp_midi_sysex_common_rt_mtc_ub_u2,
10795                         {
10796                                 "Sysex Common Realtime MTC User Bits U2",
10797                                 "rtpmidi.sysex_common_rt_mtc_ub_u2",
10798                                 FT_UINT8,
10799                                 BASE_HEX,
10800                                 NULL,
10801                                 0x0f,
10802                                 NULL, HFILL
10803                         }
10804                 },
10805                 {
10806                         &hf_rtp_midi_sysex_common_rt_mtc_ub_u3,
10807                         {
10808                                 "Sysex Common Realtime MTC User Bits U3",
10809                                 "rtpmidi.sysex_common_rt_mtc_ub_u3",
10810                                 FT_UINT8,
10811                                 BASE_HEX,
10812                                 NULL,
10813                                 0x0f,
10814                                 NULL, HFILL
10815                         }
10816                 },
10817                 {
10818                         &hf_rtp_midi_sysex_common_rt_mtc_ub_u4,
10819                         {
10820                                 "Sysex Common Realtime MTC User Bits U4",
10821                                 "rtpmidi.sysex_common_rt_mtc_ub_u4",
10822                                 FT_UINT8,
10823                                 BASE_HEX,
10824                                 NULL,
10825                                 0x0f,
10826                                 NULL, HFILL
10827                         }
10828                 },
10829                 {
10830                         &hf_rtp_midi_sysex_common_rt_mtc_ub_u5,
10831                         {
10832                                 "Sysex Common Realtime MTC User Bits U5",
10833                                 "rtpmidi.sysex_common_rt_mtc_ub_u5",
10834                                 FT_UINT8,
10835                                 BASE_HEX,
10836                                 NULL,
10837                                 0x0f,
10838                                 NULL, HFILL
10839                         }
10840                 },
10841                 {
10842                         &hf_rtp_midi_sysex_common_rt_mtc_ub_u6,
10843                         {
10844                                 "Sysex Common Realtime MTC User Bits U6",
10845                                 "rtpmidi.sysex_common_rt_mtc_ub_u6",
10846                                 FT_UINT8,
10847                                 BASE_HEX,
10848                                 NULL,
10849                                 0x0f,
10850                                 NULL, HFILL
10851                         }
10852                 },
10853                 {
10854                         &hf_rtp_midi_sysex_common_rt_mtc_ub_u7,
10855                         {
10856                                 "Sysex Common Realtime MTC User Bits U7",
10857                                 "rtpmidi.sysex_common_rt_mtc_ub_u7",
10858                                 FT_UINT8,
10859                                 BASE_HEX,
10860                                 NULL,
10861                                 0x0f,
10862                                 NULL, HFILL
10863                         }
10864                 },
10865                 {
10866                         &hf_rtp_midi_sysex_common_rt_mtc_ub_u8,
10867                         {
10868                                 "Sysex Common Realtime MTC User Bits U8",
10869                                 "rtpmidi.sysex_common_rt_mtc_ub_u8",
10870                                 FT_UINT8,
10871                                 BASE_HEX,
10872                                 NULL,
10873                                 0x0f,
10874                                 NULL, HFILL
10875                         }
10876                 },
10877                 {
10878                         &hf_rtp_midi_sysex_common_rt_mtc_ub_u9,
10879                         {
10880                                 "Sysex Common Realtime MTC User Bits U9",
10881                                 "rtpmidi.sysex_common_rt_mtc_ub_u9",
10882                                 FT_UINT8,
10883                                 BASE_HEX,
10884                                 NULL,
10885                                 0x03,
10886                                 NULL, HFILL
10887                         }
10888                 },
10889                 {
10890                         &hf_rtp_midi_sysex_common_nrt_mtc_type,
10891                         {
10892                                 "Sysex Common Non-Realtime MTC Type",
10893                                 "rtpmidi.sysex_common_nrt_mtc_type",
10894                                 FT_UINT8,
10895                                 BASE_HEX,
10896                                 VALS(rtp_midi_mtc_fm_type_values),
10897                                 0x60,
10898                                 NULL, HFILL
10899                         }
10900                 },
10901                 {
10902                         &hf_rtp_midi_sysex_common_nrt_mtc_hr,
10903                         {
10904                                 "Sysex Common Non-Realtime MTC Hour",
10905                                 "rtpmidi.sysex_common_nrt_mtc_hour",
10906                                 FT_UINT8,
10907                                 BASE_DEC,
10908                                 NULL,
10909                                 0x1f,
10910                                 NULL, HFILL
10911                         }
10912                 },
10913                 {
10914                         &hf_rtp_midi_sysex_common_nrt_mtc_mn,
10915                         {
10916                                 "Sysex Common Non-Realtime MTCMinute",
10917                                 "rtpmidi.sysex_common_nrt_mtc_minute",
10918                                 FT_UINT8,
10919                                 BASE_DEC,
10920                                 NULL,
10921                                 0x7f,
10922                                 NULL, HFILL
10923                         }
10924                 },
10925                 {
10926                         &hf_rtp_midi_sysex_common_nrt_mtc_sc,
10927                         {
10928                                 "Sysex Common Non-Realtime MTC Second",
10929                                 "rtpmidi.sysex_common_nrt_mtc_second",
10930                                 FT_UINT8,
10931                                 BASE_DEC,
10932                                 NULL,
10933                                 0x7f,
10934                                 NULL, HFILL
10935                         }
10936                 },
10937                 {
10938                         &hf_rtp_midi_sysex_common_nrt_mtc_fr,
10939                         {
10940                                 "Sysex Common Non-Realtime MTC Frame",
10941                                 "rtpmidi.sysex_common_nrt_mtc_frame",
10942                                 FT_UINT8,
10943                                 BASE_DEC,
10944                                 NULL,
10945                                 0x7f,
10946                                 NULL, HFILL
10947                         }
10948                 },
10949                 {
10950                         &hf_rtp_midi_sysex_common_nrt_mtc_ff,
10951                         {
10952                                 "Sysex Common Non-Realtime MTC Fractional Frame",
10953                                 "rtpmidi.sysex_common_nrt_mtc_fract_frame",
10954                                 FT_UINT8,
10955                                 BASE_DEC,
10956                                 NULL,
10957                                 0x7f,
10958                                 NULL, HFILL
10959                         }
10960                 },
10961                 {
10962                         &hf_rtp_midi_sysex_common_nrt_mtc_enl,
10963                         {
10964                                 "Sysex Common Non-Realtime MTC Event Number (LSB)",
10965                                 "rtpmidi.sysex_common_nrt_mtc_en_lsb",
10966                                 FT_UINT8,
10967                                 BASE_DEC,
10968                                 NULL,
10969                                 0x7f,
10970                                 NULL, HFILL
10971                         }
10972                 },
10973                 {
10974                         &hf_rtp_midi_sysex_common_nrt_mtc_enm,
10975                         {
10976                                 "Sysex Common Non-Realtime MTC Event Number (MSB)",
10977                                 "rtpmidi.sysex_common_nrt_mtc_en_msb",
10978                                 FT_UINT8,
10979                                 BASE_DEC,
10980                                 NULL,
10981                                 0x7f,
10982                                 NULL, HFILL
10983                         }
10984                 },
10985                 {
10986                         &hf_rtp_midi_sysex_common_nrt_mtc_add,
10987                         {
10988                                 "Sysex Common Non-Realtime MTC Additional Info",
10989                                 "rtpmidi.sysex_common_nrt_mtc_add",
10990                                 FT_BYTES,
10991                                 BASE_NONE,
10992                                 NULL,
10993                                 0x0,
10994                                 NULL, HFILL
10995                         }
10996                 },
10997                 {
10998                         &hf_rtp_midi_sysex_common_rt_mtc_cue_enl,
10999                         {
11000                                 "Sysex Common Realtime MTC Cue Event Number (LSB)",
11001                                 "rtpmidi.sysex_common_rt_mtc_cue_en_lsb",
11002                                 FT_UINT8,
11003                                 BASE_DEC,
11004                                 NULL,
11005                                 0x7f,
11006                                 NULL, HFILL
11007                         }
11008                 },
11009                 {
11010                         &hf_rtp_midi_sysex_common_rt_mtc_cue_enm,
11011                         {
11012                                 "Sysex Common Realtime MTC Cue Event Number (MSB)",
11013                                 "rtpmidi.sysex_common_rt_mtc_cue_en_msb",
11014                                 FT_UINT8,
11015                                 BASE_DEC,
11016                                 NULL,
11017                                 0x7f,
11018                                 NULL, HFILL
11019                         }
11020                 },
11021                 {
11022                         &hf_rtp_midi_sysex_common_rt_mtc_cue_add,
11023                         {
11024                                 "Sysex Common Realtime MTC Cue Additional Info",
11025                                 "rtpmidi.sysex_common_rt_mtc_cue_add",
11026                                 FT_BYTES,
11027                                 BASE_NONE,
11028                                 NULL,
11029                                 0x0,
11030                                 NULL, HFILL
11031                         }
11032                 },
11033                 {
11034                         &hf_rtp_midi_sysex_common_rt_ni_bar_num,
11035                         {
11036                                 "Sysex Common Realtime NI Bar Number",
11037                                 "rtpmidi.sysex_common_rt_ni_barnum",
11038                                 FT_UINT16,
11039                                 BASE_HEX,
11040                                 NULL,
11041                                 0x7f7f,
11042                                 NULL, HFILL
11043                         }
11044                 },
11045                 {
11046                         &hf_rtp_midi_sysex_common_rt_ni_bytes,
11047                         {
11048                                 "Sysex Common Realtime NI Bytes",
11049                                 "rtpmidi.sysex_common_rt_ni_bytes",
11050                                 FT_UINT8,
11051                                 BASE_DEC,
11052                                 NULL,
11053                                 0x7f,
11054                                 NULL, HFILL
11055                         }
11056                 },
11057                 {
11058                         &hf_rtp_midi_sysex_common_rt_ni_numerator,
11059                         {
11060                                 "Sysex Common Realtime NI Numerator",
11061                                 "rtpmidi.sysex_common_rt_ni_numerator",
11062                                 FT_UINT8,
11063                                 BASE_DEC,
11064                                 NULL,
11065                                 0x7f,
11066                                 NULL, HFILL
11067                         }
11068                 },
11069                 {
11070                         &hf_rtp_midi_sysex_common_rt_ni_denominator,
11071                         {
11072                                 "Sysex Common Realtime NI Denominator",
11073                                 "rtpmidi.sysex_common_rt_ni_denominator",
11074                                 FT_UINT8,
11075                                 BASE_DEC,
11076                                 NULL,
11077                                 0x7f,
11078                                 NULL, HFILL
11079                         }
11080                 },
11081                 {
11082                         &hf_rtp_midi_sysex_common_rt_ni_midi_clocks,
11083                         {
11084                                 "Sysex Common Realtime NI MIDI clocks in click",
11085                                 "rtpmidi.sysex_common_rt_ni_midiclock",
11086                                 FT_UINT8,
11087                                 BASE_DEC,
11088                                 NULL,
11089                                 0x7f,
11090                                 NULL, HFILL
11091                         }
11092                 },
11093                 {
11094                         &hf_rtp_midi_sysex_common_rt_ni_32nds,
11095                         {
11096                                 "Sysex Common Realtime NI 32nd notes in MIDI quarter note",
11097                                 "rtpmidi.sysex_common_rt_ni_32nds",
11098                                 FT_UINT8,
11099                                 BASE_DEC,
11100                                 NULL,
11101                                 0x7f,
11102                                 NULL, HFILL
11103                         }
11104                 },
11105                 {
11106                         &hf_rtp_midi_sysex_common_rt_dc_volume,
11107                         {
11108                                 "Sysex Common Realtime DC Volume",
11109                                 "rtpmidi.sysex_common_rt_dc_volume",
11110                                 FT_UINT16,
11111                                 BASE_DEC,
11112                                 NULL,
11113                                 0x7f7f,
11114                                 NULL, HFILL
11115                         }
11116                 },
11117                 {
11118                         &hf_rtp_midi_sysex_common_rt_dc_balance,
11119                         {
11120                                 "Sysex Common Realtime DC Balance",
11121                                 "rtpmidi.sysex_common_rt_dc_balance",
11122                                 FT_UINT16,
11123                                 BASE_DEC,
11124                                 NULL,
11125                                 0x7f7f,
11126                                 NULL, HFILL
11127                         }
11128                 }
11129
11130         };
11131
11132
11133
11134
11135
11136         static gint *ett[] = {
11137                 &ett_rtp_midi,
11138                 &ett_rtp_midi_commands,
11139                 &ett_rtp_midi_journal,
11140                 &ett_rtp_midi_command,
11141                 &ett_rtp_midi_systemjournal,
11142                 &ett_rtp_midi_channeljournals,
11143                 &ett_rtp_midi_channelchapters,
11144                 &ett_rtp_midi_cj_chapter_p,
11145                 &ett_rtp_midi_cj_chapter_c,
11146                 &ett_rtp_midi_cj_chapter_c_loglist,
11147                 &ett_rtp_midi_cj_chapter_c_logitem,
11148                 &ett_rtp_midi_cj_chapter_m,
11149                 &ett_rtp_midi_cj_chapter_m_loglist,
11150                 &ett_rtp_midi_cj_chapter_m_logitem,
11151                 &ett_rtp_midi_cj_chapter_m_log_msb,
11152                 &ett_rtp_midi_cj_chapter_m_log_lsb,
11153                 &ett_rtp_midi_cj_chapter_m_log_a_button,
11154                 &ett_rtp_midi_cj_chapter_m_log_c_button,
11155                 &ett_rtp_midi_cj_chapter_m_log_count,
11156                 &ett_rtp_midi_cj_chapter_w,
11157                 &ett_rtp_midi_cj_chapter_n,
11158                 &ett_rtp_midi_cj_chapter_n_loglist,
11159                 &ett_rtp_midi_cj_chapter_n_logitem,
11160                 &ett_rtp_midi_cj_chapter_n_octets,
11161                 &ett_rtp_midi_cj_chapter_e,
11162                 &ett_rtp_midi_cj_chapter_e_loglist,
11163                 &ett_rtp_midi_cj_chapter_e_logitem,
11164                 &ett_rtp_midi_cj_chapter_t,
11165                 &ett_rtp_midi_cj_chapter_a,
11166                 &ett_rtp_midi_cj_chapter_a_loglist,
11167                 &ett_rtp_midi_cj_chapter_a_logitem,
11168                 &ett_rtp_midi_systemchapters,
11169                 &ett_rtp_midi_sj_chapter_d,
11170                 &ett_rtp_midi_sj_chapter_d_field_b,
11171                 &ett_rtp_midi_sj_chapter_d_field_g,
11172                 &ett_rtp_midi_sj_chapter_d_field_h,
11173                 &ett_rtp_midi_sj_chapter_d_field_j,
11174                 &ett_rtp_midi_sj_chapter_d_field_k,
11175                 &ett_rtp_midi_sj_chapter_d_field_y,
11176                 &ett_rtp_midi_sj_chapter_d_field_z,
11177                 &ett_rtp_midi_sj_chapter_v,
11178                 &ett_rtp_midi_sj_chapter_q,
11179                 &ett_rtp_midi_sj_chapter_f,
11180                 &ett_rtp_midi_sj_chapter_f_complete,
11181                 &ett_rtp_midi_sj_chapter_f_partial,
11182                 &ett_rtp_midi_sj_chapter_x,
11183                 &ett_rtp_midi_sj_chapter_x_first,
11184                 &ett_rtp_midi_sj_chapter_x_data,
11185                 &ett_rtp_midi_channeljournal,
11186                 &ett_rtp_midi_sysex_data,
11187                 &ett_rtp_midi_sysex_common_rt,
11188                 &ett_rtp_midi_sysex_common_nrt,
11189                 &ett_rtp_midi_sysex_common_tune_note,
11190                 &ett_rtp_midi_sysex_manu,
11191                 &ett_rtp_midi_sysex_edu
11192         };
11193
11194         proto_rtp_midi = proto_register_protocol( RTP_MIDI_DISSECTOR_NAME, RTP_MIDI_DISSECTOR_SHORTNAME, RTP_MIDI_DISSECTOR_ABBREVIATION );
11195         proto_register_field_array( proto_rtp_midi, hf, array_length( hf ) );
11196         proto_register_subtree_array( ett, array_length( ett ) );
11197
11198         rtp_midi_module = prefs_register_protocol ( proto_rtp_midi, proto_reg_handoff_rtp_midi );
11199         prefs_register_uint_preference ( rtp_midi_module, "midi_payload_type_value", "Payload Type for RFC 4695/6295 RTP-MIDI", "This is the value of the Payload Type field that specifies RTP-MIDI", 10, &rtp_midi_payload_type_value );
11200         register_dissector( RTP_MIDI_DISSECTOR_ABBREVIATION, dissect_rtp_midi, proto_rtp_midi );
11201 }
11202
11203
11204
11205 void
11206 proto_reg_handoff_rtp_midi( void )
11207 {
11208         static dissector_handle_t       rtp_midi_handle;
11209         static int                      rtp_midi_prefs_initialized = FALSE;
11210
11211
11212         if ( !rtp_midi_prefs_initialized ) {
11213                 rtp_midi_handle = find_dissector( RTP_MIDI_DISSECTOR_ABBREVIATION );
11214                 dissector_add_string("rtp_dyn_payload_type", "rtp-midi", rtp_midi_handle);
11215                 rtp_midi_prefs_initialized = TRUE;
11216         }
11217         else {
11218                 dissector_delete_uint( "rtp.pt", saved_payload_type_value, rtp_midi_handle );
11219         }
11220
11221         saved_payload_type_value = rtp_midi_payload_type_value;
11222
11223         dissector_add_uint( "rtp.pt", saved_payload_type_value, rtp_midi_handle );
11224
11225 }