Fix some unused parameter warnings etc.
[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         const gchar     *note_str       = NULL;
3420         proto_item      *command_item   = NULL;
3421         proto_tree      *command_tree   = NULL;
3422
3423         status_str = val_to_str( status >> 4, rtp_midi_channel_status, rtp_midi_unknown_value_hex );
3424
3425         /* broken: we have no further data */
3426         if ( !cmd_len ) {
3427                 /* this should never happen */
3428                 if ( using_rs ) {
3429                         command_item = proto_tree_add_text( tree, tvb, offset, 0, "TRUNCATED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3430                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3431                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3432                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3433
3434                 } else {
3435                         command_item = proto_tree_add_text( tree, tvb, offset - 1, 1, "TRUNCATED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3436                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3437                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3438                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3439                         }
3440                 return -1;
3441         }
3442
3443         octet1 = tvb_get_guint8( tvb, offset );
3444
3445         /* seems to be an aborted MIDI-command */
3446         if ( octet1 & RTP_MIDI_COMMAND_STATUS_FLAG ) {
3447                 /* this should never happen */
3448                 if ( using_rs ) {
3449                         command_item = proto_tree_add_text( tree, tvb, offset, 0, "ABORTED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3450                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3451                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3452                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3453
3454                 } else {
3455                         command_item = proto_tree_add_text( tree, tvb, offset - 1, 1, "ABORTED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3456                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3457                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3458                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3459                         }
3460                 return -1;
3461         }
3462
3463         /* broken: we have only one further octet */
3464         if ( cmd_len < 2 ) {
3465                 if ( using_rs ) {
3466                         command_item = proto_tree_add_text( tree, tvb, offset, 1, "TRUNCATED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3467                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command);
3468                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3469                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3470                         proto_tree_add_item( command_tree, hf_rtp_midi_pitch_bend_truncated, tvb, offset, 1, ENC_BIG_ENDIAN );
3471
3472                 } else {
3473                         command_item = proto_tree_add_text( tree, tvb, offset - 1, 2, "TRUNCATED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3474                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3475                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3476                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3477                         proto_tree_add_item( command_tree, hf_rtp_midi_pitch_bend_truncated, tvb, offset, 1, ENC_BIG_ENDIAN );
3478                         }
3479                 return -1;
3480         }
3481
3482         octet2 = tvb_get_guint8( tvb, offset + 1 );
3483
3484         /* seems to be an aborted MIDI-command */
3485         if ( octet2  & RTP_MIDI_COMMAND_STATUS_FLAG ) {
3486                 if ( using_rs ) {
3487                         command_item = proto_tree_add_text( tree, tvb, offset, 1, "ABORTED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3488                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command);
3489                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3490                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3491                         proto_tree_add_item( command_tree, hf_rtp_midi_pitch_bend_truncated, tvb, offset, 1, ENC_BIG_ENDIAN );
3492
3493                 } else {
3494                         command_item = proto_tree_add_text( tree, tvb, offset - 1, 2, "ABORTED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3495                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3496                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3497                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3498                         proto_tree_add_item( command_tree, hf_rtp_midi_pitch_bend_truncated, tvb, offset, 1, ENC_BIG_ENDIAN );
3499                         }
3500                 return -1;
3501         }
3502
3503         pitch = ( octet1 << 7 ) | octet2;
3504
3505         if ( using_rs ) {
3506                 command_item = proto_tree_add_text( tree, tvb, offset, 2, "%s (c=%d, pb=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, pitch );
3507                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command);
3508                 proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3509                 proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3510                 proto_tree_add_item( command_tree, hf_rtp_midi_pitch_bend, tvb, offset, 2, ENC_BIG_ENDIAN );
3511         } else {
3512                 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 );
3513                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3514                 proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3515                 proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3516                 proto_tree_add_item( command_tree, hf_rtp_midi_pitch_bend, tvb, offset, 2, ENC_BIG_ENDIAN );
3517         }
3518
3519         if ( cmd_count ) {
3520                 col_append_fstr(pinfo->cinfo, COL_INFO,", %s (c=%d, pb=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, pitch );
3521         } else {
3522                 col_append_fstr(pinfo->cinfo, COL_INFO, "%s (c=%d, pb=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, pitch );
3523         }
3524         return 2;
3525 }
3526
3527
3528
3529
3530 /*
3531  * Here program_change is decoded.
3532  */
3533 static int
3534 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 ) {
3535
3536         guint8           program        = 0;
3537         const gchar     *status_str     = NULL;
3538         proto_item      *command_item   = NULL;
3539         proto_tree      *command_tree   = NULL;
3540
3541         status_str = val_to_str( status >> 4, rtp_midi_channel_status, rtp_midi_unknown_value_hex );
3542
3543         /* broken: we have no further data */
3544         if ( !cmd_len ) {
3545                 /* this should never happen */
3546                 if ( using_rs ) {
3547                         command_item = proto_tree_add_text( tree, tvb, offset, 0, "TRUNCATED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3548                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3549                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3550                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3551
3552                 } else {
3553                         command_item = proto_tree_add_text( tree, tvb, offset - 1, 1, "TRUNCATED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1);
3554                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3555                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3556                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3557                         }
3558                 return -1;
3559         }
3560
3561         program = tvb_get_guint8( tvb, offset );
3562
3563         /* seems to be an aborted MIDI-command */
3564         if ( program  & RTP_MIDI_COMMAND_STATUS_FLAG ) {
3565                 /* this should never happen */
3566                 if ( using_rs ) {
3567                         command_item = proto_tree_add_text( tree, tvb, offset, 0, "ABORTED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3568                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3569                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3570                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3571
3572                 } else {
3573                         command_item = proto_tree_add_text( tree, tvb, offset - 1, 1, "ABORTED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1);
3574                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3575                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3576                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3577                         }
3578                 return -1;
3579         }
3580
3581
3582         if ( using_rs ) {
3583                 command_item = proto_tree_add_text( tree, tvb, offset, 1, "%s (c=%d, p=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, program );
3584                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command);
3585                 proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3586                 proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3587                 proto_tree_add_item( command_tree, hf_rtp_midi_program, tvb, offset, 1, ENC_BIG_ENDIAN );
3588         } else {
3589                 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 );
3590                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3591                 proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3592                 proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3593                 proto_tree_add_item( command_tree, hf_rtp_midi_program, tvb, offset, 1, ENC_BIG_ENDIAN);
3594         }
3595
3596         if ( cmd_count ) {
3597                 col_append_fstr(pinfo->cinfo, COL_INFO,", %s (c=%d, p=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, program );
3598         } else {
3599                 col_append_fstr(pinfo->cinfo, COL_INFO, "%s (c=%d, p=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1, program );
3600         }
3601
3602
3603 return 1;
3604 }
3605
3606
3607
3608 /*
3609  * Here control change is decoded.
3610  */
3611 static int
3612 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 ) {
3613
3614         guint8           controller     = 0;
3615         guint8           value          = 0;
3616         const gchar     *status_str     = NULL;
3617         const gchar     *ctrl_str       = NULL;
3618         proto_item      *command_item   = NULL;
3619         proto_tree      *command_tree   = NULL;
3620
3621         status_str = val_to_str( status >> 4, rtp_midi_channel_status, rtp_midi_unknown_value_hex );
3622
3623         /* broken: we have no further data */
3624         if ( !cmd_len ) {
3625                 /* this should never happen */
3626                 if ( using_rs ) {
3627                         command_item = proto_tree_add_text( tree, tvb, offset, 0, "TRUNCATED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3628                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3629                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3630                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3631
3632                 } else {
3633                         command_item = proto_tree_add_text( tree, tvb, offset - 1, 1, "TRUNCATED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3634                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3635                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3636                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3637                         }
3638                 return -1;
3639         }
3640
3641         controller = tvb_get_guint8( tvb, offset );
3642
3643         /* seems to be an aborted MIDI-command */
3644         if ( controller & RTP_MIDI_COMMAND_STATUS_FLAG ) {
3645                 /* this should never happen */
3646                 if ( using_rs ) {
3647                         command_item = proto_tree_add_text( tree, tvb, offset, 0, "ABORTED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3648                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3649                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3650                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3651
3652                 } else {
3653                         command_item = proto_tree_add_text( tree, tvb, offset - 1, 1, "ABORTED: %s (c=%d)", status_str, ( status & RTP_MIDI_CHANNEL_MASK ) + 1 );
3654                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3655                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3656                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3657                         }
3658                 return -1;
3659         }
3660
3661         ctrl_str = val_to_str( controller, rtp_midi_controller_values, "Unknown: %d" );
3662
3663         /* broken: we have only one further octet */
3664         if ( cmd_len < 2 ) {
3665                 if ( using_rs ) {
3666                         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 );
3667                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command);
3668                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3669                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3670                         proto_tree_add_item( command_tree, hf_rtp_midi_note, tvb, offset, 1, ENC_BIG_ENDIAN );
3671
3672                 } else {
3673                         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 );
3674                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3675                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3676                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3677                         proto_tree_add_item( command_tree, hf_rtp_midi_note, tvb, offset, 1, ENC_BIG_ENDIAN );
3678                         }
3679                 return -1;
3680         }
3681
3682         value = tvb_get_guint8( tvb, offset + 1 );
3683
3684         /* seems to be an aborted MIDI-command */
3685         if ( value  & RTP_MIDI_COMMAND_STATUS_FLAG ) {
3686                 if ( using_rs ) {
3687                         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 );
3688                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command);
3689                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3690                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3691                         proto_tree_add_item( command_tree, hf_rtp_midi_controller, tvb, offset, 1, ENC_BIG_ENDIAN );
3692
3693                 } else {
3694                         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 );
3695                         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3696                         proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3697                         proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3698                         proto_tree_add_item( command_tree, hf_rtp_midi_controller, tvb, offset, 1, ENC_BIG_ENDIAN );
3699                         }
3700                 return -1;
3701         }
3702
3703
3704         if ( using_rs ) {
3705                 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 );
3706                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command);
3707                 proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3708                 proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, rsoffset, 1, ENC_BIG_ENDIAN );
3709                 proto_tree_add_item( command_tree, hf_rtp_midi_controller, tvb, offset, 1, ENC_BIG_ENDIAN );
3710                 proto_tree_add_item( command_tree, hf_rtp_midi_controller_value, tvb, offset + 1, 1, ENC_BIG_ENDIAN );
3711         } else {
3712                 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 );
3713                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
3714                 proto_tree_add_item( command_tree, hf_rtp_midi_channel_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3715                 proto_tree_add_item( command_tree, hf_rtp_midi_channel, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
3716                 proto_tree_add_item( command_tree, hf_rtp_midi_controller, tvb, offset, 1, ENC_BIG_ENDIAN );
3717                 proto_tree_add_item( command_tree, hf_rtp_midi_controller_value, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
3718         }
3719
3720         if ( cmd_count ) {
3721                 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 );
3722         } else {
3723                 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 );
3724         }
3725         return 2;
3726 }
3727
3728
3729 /*
3730  * Here a Sysex-Common Non-Realtime Sample Dump Header command is decoded.
3731  */
3732 static unsigned int
3733 decode_sysex_common_nrt_sd_hdr( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
3734         int              consumed       = 0;
3735
3736         if ( data_len < 2 )
3737                 return -1;
3738
3739         /* sample number */
3740         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_header_sn, tvb, offset, 2, ENC_BIG_ENDIAN );
3741         offset += 2;
3742         data_len -= 2;
3743         consumed += 2;
3744
3745         if ( data_len < 1 )
3746                 return -1;
3747
3748         /* sample format */
3749         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_header_sf, tvb, offset, 1, ENC_BIG_ENDIAN );
3750         offset++;
3751         data_len--;
3752         consumed++;
3753
3754         if ( data_len < 3 )
3755                 return -1;
3756
3757         /* sample period */
3758         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_header_sp, tvb, offset, 3, ENC_BIG_ENDIAN );
3759         offset += 3;
3760         data_len -= 3;
3761         consumed += 3;
3762
3763         if ( data_len < 3 )
3764                 return -1;
3765
3766         /* sample length */
3767         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_header_sl, tvb, offset, 3, ENC_BIG_ENDIAN );
3768         offset += 3;
3769         data_len -= 3;
3770         consumed += 3;
3771
3772         if ( data_len < 3 )
3773                 return -1;
3774
3775         /* loop start */
3776         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_header_ls, tvb, offset, 3, ENC_BIG_ENDIAN );
3777         offset += 3;
3778         data_len -= 3;
3779         consumed += 3;
3780
3781         if ( data_len < 3 )
3782                 return -1;
3783
3784         /* loop end */
3785         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_header_le, tvb, offset, 3, ENC_BIG_ENDIAN );
3786         offset += 3;
3787         data_len -= 3;
3788         consumed += 3;
3789
3790         if ( data_len < 1 )
3791                 return -1;
3792
3793         /* loop type */
3794         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_header_lt, tvb, offset, 1, ENC_BIG_ENDIAN );
3795         offset++;
3796         data_len--;
3797         consumed++;
3798
3799         return consumed;
3800 }
3801
3802 /*
3803  * Here a Sysex-Common Non-Realtime Sample Dump Packet command is decoded.
3804  */
3805 static unsigned int
3806 decode_sysex_common_nrt_sd_packet( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
3807         int              consumed       = 0;
3808
3809         if ( data_len < 1 )
3810                 return -1;
3811
3812         /* sample number */
3813         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_packet_count, tvb, offset, 1, ENC_BIG_ENDIAN );
3814         offset++;
3815         data_len--;
3816         consumed++;
3817
3818         /* do we have sample-data? */
3819         if ( data_len > 1 ) {
3820
3821                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_packet_data, tvb, offset, data_len - 1, ENC_NA );
3822
3823                 offset += ( data_len - 1 );
3824                 data_len -= ( data_len - 1 );
3825                 consumed += ( data_len -1 );
3826         }
3827
3828         /* do we have data for the checksum! */
3829         if ( data_len < 1 )
3830                 return -1;
3831
3832         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_packet_check, tvb, offset, 1, ENC_BIG_ENDIAN );
3833         offset++;
3834         data_len--;
3835         consumed++;
3836
3837         return consumed;
3838 }
3839
3840 /*
3841  * Here a Sysex-Common Non-Realtime Sample Dump Request command is decoded.
3842  */
3843 static unsigned int
3844 decode_sysex_common_nrt_sd_req( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
3845         int              consumed       = 0;
3846
3847         if ( data_len < 2 )
3848                 return -1;
3849
3850         /* sample number */
3851         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_header_sn, tvb, offset, 2, ENC_BIG_ENDIAN );
3852         offset += 2;
3853         data_len -= 2;
3854         consumed += 2;
3855
3856         return consumed;
3857 }
3858
3859
3860 /*
3861  * Here a Sysex-Common Non-Realtime Sample Dump Extension command is decoded.
3862  */
3863 static unsigned int
3864 decode_sysex_common_nrt_sd_ext( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
3865         guint8           sub_id         = 0;
3866         int              consumed       = 0;
3867
3868         if ( data_len < 1 )
3869                 return consumed;
3870
3871         /* first we retrieve the sub-command */
3872         sub_id = tvb_get_guint8( tvb, offset );
3873         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_ext, tvb, offset, 1, ENC_BIG_ENDIAN );
3874         offset++;
3875         data_len--;
3876         consumed++;
3877
3878         if ( sub_id == RTP_MIDI_SYSEX_COMMON_NRT_SD_EXT_LOOP_POINT_TRANSMISSION ) {
3879
3880                 if ( data_len < 2 )
3881                         return -1;
3882
3883                 /* sample number */
3884                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_header_sn, tvb, offset, 2, ENC_BIG_ENDIAN );
3885                 offset += 2;
3886                 data_len -= 2;
3887                 consumed += 2;
3888
3889                 if ( data_len < 2 )
3890                         return -1;
3891
3892                 /* loop number */
3893                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_ext_ln, tvb, offset, 2, ENC_BIG_ENDIAN );
3894                 offset += 2;
3895                 data_len -= 2;
3896                 consumed += 2;
3897
3898                 if ( data_len < 1 )
3899                         return -1;
3900
3901                 /* loop type */
3902                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_header_lt, tvb, offset, 1, ENC_BIG_ENDIAN );
3903                 offset++;
3904                 data_len--;
3905                 consumed++;
3906
3907                 if ( data_len < 3 )
3908                         return -1;
3909
3910                 /* loop start */
3911                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_header_ls, tvb, offset, 3, ENC_BIG_ENDIAN );
3912                 offset += 3;
3913                 data_len -= 3;
3914                 consumed += 3;
3915
3916                 if ( data_len < 3 )
3917                         return -1;
3918
3919                 /* loop end */
3920                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_header_le, tvb, offset, 3, ENC_BIG_ENDIAN );
3921                 offset += 3;
3922                 data_len -= 3;
3923                 consumed += 3;
3924
3925         } else if ( sub_id == RTP_MIDI_SYSEX_COMMON_NRT_SD_EXT_LOOP_POINTS_REQUEST ) {
3926
3927                 if ( data_len < 2 )
3928                         return -1;
3929
3930                 /* sample number */
3931                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_header_sn, tvb, offset, 2, ENC_BIG_ENDIAN );
3932                 offset += 2;
3933                 data_len -= 2;
3934                 consumed += 2;
3935
3936                 if ( data_len < 2 )
3937                         return -1;
3938
3939                 /* loop number */
3940                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_ext_ln, tvb, offset, 2, ENC_BIG_ENDIAN );
3941                 offset += 2;
3942                 data_len -= 2;
3943                 consumed += 2;
3944
3945         };
3946
3947         return consumed;
3948 }
3949
3950 /*
3951  * Here a Sysex-Common Non-Realtime General Information command is decoded.
3952  */
3953 static unsigned int
3954 decode_sysex_common_nrt_gi( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
3955         guint8           sub_id         = 0;
3956         guint8           manu_short     = 0;
3957         int              consumed       = 0;
3958
3959         if ( data_len < 1 )
3960                 return consumed;
3961
3962         /* first we retrieve the sub-command */
3963         sub_id = tvb_get_guint8( tvb, offset );
3964         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_gi, tvb, offset, 1, ENC_BIG_ENDIAN );
3965         offset++;
3966         data_len--;
3967         consumed++;
3968
3969
3970         /* This is the only sub-command that we know that we can decode,
3971          * the Identity Request has already been decoded up to this point. */
3972         if ( sub_id != RTP_MIDI_SYSEX_COMMON_NRT_GI_IDENTITY_REQUEST ) {
3973
3974                 /* nothing more to do... */
3975
3976         } else if ( sub_id == RTP_MIDI_SYSEX_COMMON_NRT_GI_IDENTITY_REPLY ) {
3977
3978                 if ( data_len < 1 ) {
3979                         return consumed;
3980                 }
3981
3982                 /* the manu-id should follow */
3983                 proto_tree_add_item( tree, hf_rtp_midi_manu_short, tvb, offset, 1, ENC_BIG_ENDIAN );
3984                 manu_short = tvb_get_guint8( tvb, offset );
3985                 offset++;
3986                 data_len--;
3987                 consumed++;
3988
3989                 /* possibly escaped to be a long manu-id */
3990                 if ( manu_short == RTP_MIDI_MANU_SHORT_ISLONG ) {
3991                         if ( data_len < 2 ) {
3992                                 return consumed;
3993                         }
3994                         proto_tree_add_item( tree, hf_rtp_midi_manu_long, tvb, offset, 2, ENC_BIG_ENDIAN );
3995                         offset +=2 ;
3996                         data_len -= 2;
3997                         consumed += 2;
3998                 }
3999
4000                 /* lets see if we can get the device family for this unit */
4001                 if ( data_len < 2 ) {
4002                         return consumed;
4003                 }
4004                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_gi_device_family, tvb, offset, 2, ENC_BIG_ENDIAN );
4005                 offset +=2 ;
4006                 data_len -= 2;
4007                 consumed += 2;
4008
4009                 /* ...also get the detailed member of this family... */
4010                 if ( data_len < 2 ) {
4011                         return consumed;
4012                 }
4013                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_gi_device_family_member, tvb, offset, 2, ENC_BIG_ENDIAN );
4014                 offset +=2 ;
4015                 data_len -= 2;
4016                 consumed += 2;
4017
4018                 /* and even the software-revision-level */
4019                 if ( data_len < 4 ) {
4020                         return consumed;
4021                 }
4022                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_gi_software_rev, tvb, offset, 4, ENC_BIG_ENDIAN );
4023                 offset +=4 ;
4024                 data_len -= 4;
4025                 consumed += 4;
4026         };
4027
4028         return consumed;
4029 }
4030
4031 /*
4032  * Here a Sysex-Common Non-Realtime File Dump command is decoded.
4033  */
4034 static unsigned int
4035 decode_sysex_common_nrt_fd( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
4036         guint8           sub_id         = 0;
4037         int              consumed       = 0;
4038
4039         if ( data_len < 1 )
4040                 return consumed;
4041
4042         /* first we retrieve the sub-command */
4043         sub_id = tvb_get_guint8( tvb, offset );
4044         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_fd, tvb, offset, 1, ENC_BIG_ENDIAN );
4045         offset++;
4046         data_len--;
4047         consumed++;
4048
4049         if ( sub_id == RTP_MIDI_SYSEX_COMMON_NRT_FD_HEADER ) {
4050
4051                 if ( data_len < 1 )
4052                         return -1;
4053
4054                 /* type */
4055                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_fd_device_id, tvb, offset, 1, ENC_BIG_ENDIAN );
4056                 offset++;
4057                 data_len--;
4058                 consumed++;
4059
4060                 if ( data_len < 4 )
4061                         return -1;
4062
4063                 /* file type */
4064                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_fd_type, tvb, offset, 4, ENC_ASCII|ENC_NA );
4065                 offset += 4;
4066                 data_len -= 4;
4067                 consumed += 4;
4068
4069                 if ( data_len < 4 )
4070                         return -1;
4071
4072                 /* file length */
4073                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_fd_length, tvb, offset, 4, ENC_BIG_ENDIAN );
4074                 offset += 4;
4075                 data_len -= 4;
4076                 consumed += 4;
4077
4078                 if ( data_len ) {
4079
4080                         /* file-name */
4081                         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_fd_name, tvb, offset, data_len, ENC_ASCII|ENC_NA );
4082                         offset += data_len;
4083                         data_len -= data_len;
4084                         consumed += data_len;
4085                 }
4086
4087         } else if ( sub_id == RTP_MIDI_SYSEX_COMMON_NRT_FD_DATA_PACKET ) {
4088
4089                 if ( data_len < 1 )
4090                         return -1;
4091
4092                 /* packet-num */
4093                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_fd_packet_num, tvb, offset, 1, ENC_BIG_ENDIAN );
4094                 offset++;
4095                 data_len--;
4096                 consumed++;
4097
4098                 if ( data_len < 1 )
4099                         return -1;
4100
4101                 /* byte count */
4102                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_fd_byte_count, tvb, offset, 1, ENC_BIG_ENDIAN );
4103                 offset++;
4104                 data_len--;
4105                 consumed++;
4106
4107                 /* do we have file-data? */
4108                 if ( data_len > 1 ) {
4109
4110                         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_fd_packet_data, tvb, offset, data_len - 1, ENC_NA );
4111
4112                         offset += ( data_len - 1 );
4113                         data_len -= ( data_len - 1 );
4114                         consumed += ( data_len -1 );
4115                 }
4116
4117                 /* do we have data for the checksum? */
4118                 if ( data_len < 1 )
4119                         return -1;
4120
4121                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_fd_checksum, tvb, offset, 1, ENC_BIG_ENDIAN );
4122                 offset++;
4123                 data_len--;
4124                 consumed++;
4125
4126         } else if ( sub_id == RTP_MIDI_SYSEX_COMMON_NRT_FD_REQUEST ) {
4127
4128                 if ( data_len < 1 )
4129                         return -1;
4130
4131                 /* type */
4132                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_fd_device_id, tvb, offset, 1, ENC_BIG_ENDIAN );
4133                 offset++;
4134                 data_len--;
4135                 consumed++;
4136
4137                 if ( data_len < 4 )
4138                         return -1;
4139
4140                 /* file type */
4141                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_fd_type, tvb, offset, 4, ENC_ASCII|ENC_NA );
4142                 offset += 4;
4143                 data_len -= 4;
4144                 consumed += 4;
4145
4146                 if ( data_len ) {
4147
4148                         /* file-name */
4149                         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_fd_name, tvb, offset, data_len, ENC_ASCII|ENC_NA );
4150                         offset += data_len;
4151                         data_len -= data_len;
4152                         consumed += data_len;
4153                 }
4154         }
4155
4156         return consumed;
4157 }
4158
4159 /*
4160  * Here a Sysex-Common (Non-)Realtime MIDI Tuning Standard command is decoded.
4161  * As the code-points do not overlap, both RT and NRT are decoded here...
4162  */
4163 static unsigned int
4164 decode_sysex_common_tuning( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
4165
4166         proto_item      *tune_item      = NULL;
4167         proto_tree      *tune_tree      = NULL;
4168         const gchar     *note_str       = NULL;
4169         guint8           sub_id         = 0;
4170         guint8           changes        = 0;
4171         guint8           note           = 0;
4172         int              consumed       = 0;
4173         unsigned int     i;
4174
4175         if ( data_len < 1 )
4176                 return consumed;
4177
4178         /* first we retrieve the sub-command */
4179         sub_id = tvb_get_guint8( tvb, offset );
4180         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_tuning, tvb, offset, 1, ENC_BIG_ENDIAN );
4181         offset++;
4182         data_len--;
4183         consumed++;
4184
4185         if ( sub_id == RTP_MIDI_SYSEX_COMMON_TUNING_BULK_DUMP_REQUEST ) {
4186
4187                 if ( data_len < 1 )
4188                         return -1;
4189
4190                 /* type */
4191                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_tune_program, tvb, offset, 1, ENC_BIG_ENDIAN );
4192                 offset++;
4193                 data_len--;
4194                 consumed++;
4195
4196         } else if ( sub_id == RTP_MIDI_SYSEX_COMMON_TUNING_BULK_DUMP_REPLY ) {
4197
4198                 if ( data_len < 1 )
4199                         return -1;
4200
4201                 /* type */
4202                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_tune_program, tvb, offset, 1, ENC_BIG_ENDIAN );
4203                 offset++;
4204                 data_len--;
4205                 consumed++;
4206
4207                 if ( data_len < 16 )
4208                         return -1;
4209
4210                 /* file length */
4211                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_tune_name, tvb, offset, 16, ENC_ASCII|ENC_NA );
4212                 offset += 16;
4213                 data_len -= 16;
4214                 consumed += 16;
4215
4216                 for ( i=0; i < 128; i++ ) {
4217
4218                         if ( data_len < 3 )
4219                                 return -1;
4220
4221                         note_str = val_to_str( i, rtp_midi_note_values, rtp_midi_unknown_value_dec );
4222
4223                         tune_item = proto_tree_add_text(tree, tvb, offset, 3, "Note: %s", note_str );
4224                         tune_tree = proto_item_add_subtree( tune_item, ett_rtp_midi_sysex_common_tune_note );
4225
4226                         /* frequency */
4227                         proto_tree_add_item( tune_tree, hf_rtp_midi_sysex_common_tune_freq, tvb, offset, 3, ENC_BIG_ENDIAN );
4228
4229                         offset += 3;
4230                         data_len -= 3;
4231                         consumed += 3;
4232
4233                 }
4234
4235                 if ( data_len < 1 )
4236                         return -1;
4237
4238                 /* checksum */
4239                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_tune_checksum, tvb, offset, 1, ENC_BIG_ENDIAN );
4240                 offset++;
4241                 data_len--;
4242                 consumed++;
4243
4244         } else if ( sub_id == RTP_MIDI_SYSEX_COMMON_TUNING_NOTE_CHANGE ) {
4245
4246                 if ( data_len < 1 )
4247                         return -1;
4248
4249                 /* type */
4250                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_tune_program, tvb, offset, 1, ENC_BIG_ENDIAN );
4251                 offset++;
4252                 data_len--;
4253                 consumed++;
4254
4255                 if ( data_len < 1 )
4256                         return -1;
4257
4258                 /* changes */
4259                 changes = tvb_get_guint8( tvb, offset );
4260                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_tune_changes, tvb, offset, 1, ENC_BIG_ENDIAN );
4261                 offset++;
4262                 data_len--;
4263                 consumed++;
4264
4265                 for ( i=0; i < changes; i++ ) {
4266
4267                         if ( data_len < 4 )
4268                                 return -1;
4269
4270                         note = tvb_get_guint8( tvb, offset );
4271
4272                         note_str = val_to_str( note, rtp_midi_note_values, rtp_midi_unknown_value_dec );
4273
4274                         tune_item = proto_tree_add_text(tree, tvb, offset, 3, "Note: %s", note_str );
4275                         tune_tree = proto_item_add_subtree( tune_item, ett_rtp_midi_sysex_common_tune_note );
4276
4277                         /* note */
4278                         proto_tree_add_item( tune_tree, hf_rtp_midi_sysex_common_tune_note, tvb, offset, 1, ENC_BIG_ENDIAN );
4279                         offset++;
4280                         data_len--;
4281                         consumed++;
4282
4283                         /* frequency */
4284                         proto_tree_add_item( tune_tree, hf_rtp_midi_sysex_common_tune_freq, tvb, offset, 3, ENC_BIG_ENDIAN );
4285
4286                         offset += 3;
4287                         data_len -= 3;
4288                         consumed += 3;
4289
4290                 }
4291
4292         }
4293
4294         return consumed;
4295 }
4296
4297 /*
4298  * Here a Sysex-Common Non-Realtime General MIDI command is decoded.
4299  */
4300 static unsigned int
4301 decode_sysex_common_nrt_gm( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
4302         guint8           sub_id         = 0;
4303         int              consumed       = 0;
4304
4305         if ( data_len < 1 )
4306                 return consumed;
4307
4308         /* first we retrieve the sub-command */
4309         sub_id = tvb_get_guint8( tvb, offset );
4310         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_gm, tvb, offset, 1, ENC_BIG_ENDIAN );
4311         offset++;
4312         data_len--;
4313         consumed++;
4314
4315         return consumed;
4316 }
4317
4318 /*
4319  * Here a Sysex-Common Non-Realtime Downloadable Sounds command is decoded.
4320  */
4321 static unsigned int
4322 decode_sysex_common_nrt_dls( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
4323         guint8           sub_id         = 0;
4324         int              consumed       = 0;
4325
4326         if ( data_len < 1 )
4327                 return consumed;
4328
4329         /* first we retrieve the sub-command */
4330         sub_id = tvb_get_guint8( tvb, offset );
4331         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_dls, tvb, offset, 1, ENC_BIG_ENDIAN );
4332         offset++;
4333         data_len--;
4334         consumed++;
4335
4336         return consumed;
4337 }
4338
4339 /*
4340  * Here a Sysex-Common Non-Realtime End Of File command is decoded.
4341  */
4342 static unsigned int
4343 decode_sysex_common_nrt_eof( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
4344         int              consumed       = 0;
4345
4346         if ( data_len < 1 )
4347                 return consumed;
4348
4349         /* we only have a packet-number */
4350         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_packet_number, tvb, offset, 1, ENC_BIG_ENDIAN );
4351         offset++;
4352         data_len--;
4353         consumed++;
4354
4355         return consumed;
4356 }
4357
4358 /*
4359  * Here a Sysex-Common Non-Realtime Wait command is decoded.
4360  */
4361 static unsigned int
4362 decode_sysex_common_nrt_wait( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
4363         int              consumed       = 0;
4364
4365         if ( data_len < 1 )
4366                 return consumed;
4367
4368         /* we only have a packet-number */
4369         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_packet_number, tvb, offset, 1, ENC_BIG_ENDIAN );
4370         offset++;
4371         data_len--;
4372         consumed++;
4373
4374         return consumed;
4375 }
4376
4377 /*
4378  * Here a Sysex-Common Non-Realtime Cancel command is decoded.
4379  */
4380 static unsigned int
4381 decode_sysex_common_nrt_cancel( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
4382         int              consumed       = 0;
4383
4384         if ( data_len < 1 )
4385                 return consumed;
4386
4387         /* we only have a packet-number */
4388         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_packet_number, tvb, offset, 1, ENC_BIG_ENDIAN );
4389         offset++;
4390         data_len--;
4391         consumed++;
4392
4393         return consumed;
4394 }
4395
4396 /*
4397  * Here a Sysex-Common Non-Realtime NAK command is decoded.
4398  */
4399 static unsigned int
4400 decode_sysex_common_nrt_nak( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
4401         int              consumed       = 0;
4402
4403         if ( data_len < 1 )
4404                 return consumed;
4405
4406         /* we only have a packet-number */
4407         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_packet_number, tvb, offset, 1, ENC_BIG_ENDIAN );
4408         offset++;
4409         data_len--;
4410         consumed++;
4411
4412         return consumed;
4413 }
4414
4415 /*
4416  * Here a Sysex-Common Non-Realtime ACK command is decoded.
4417  */
4418 static unsigned int
4419 decode_sysex_common_nrt_ack( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
4420         int              consumed       = 0;
4421
4422         if ( data_len < 1 )
4423                 return consumed;
4424
4425         /* we only have a packet-number */
4426         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_sd_packet_number, tvb, offset, 1, ENC_BIG_ENDIAN );
4427         offset++;
4428         data_len--;
4429         consumed++;
4430
4431         return consumed;
4432 }
4433
4434 /*
4435  * here a sysex-common non-realtime midi time code cueing command is decoded.
4436  * as the codepoints are the same, we decode both realtime and non-realtime here.
4437  */
4438 static unsigned int
4439 decode_sysex_common_nrt_mtc( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
4440         guint8           sub_id         = 0;
4441         int              consumed       = 0;
4442
4443         if ( data_len < 1 )
4444                 return consumed;
4445
4446         /* first we retrieve the sub-command */
4447         sub_id = tvb_get_guint8( tvb, offset );
4448         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_mtc, tvb, offset, 1, ENC_BIG_ENDIAN );
4449         offset++;
4450         data_len--;
4451         consumed++;
4452
4453         if ( data_len < 1 )
4454                 return -1;
4455
4456         /* type and hours */
4457         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_mtc_type, tvb, offset, 1, ENC_BIG_ENDIAN );
4458         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_mtc_hr, tvb, offset, 1, ENC_BIG_ENDIAN );
4459         offset++;
4460         data_len--;
4461         consumed++;
4462
4463         if ( data_len < 1 )
4464                 return -1;
4465
4466         /* minutes */
4467         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_mtc_mn, tvb, offset, 1, ENC_BIG_ENDIAN );
4468         offset++;
4469         data_len--;
4470         consumed++;
4471
4472         if ( data_len < 1 )
4473                 return -1;
4474
4475         /* seconds */
4476         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_mtc_sc, tvb, offset, 1, ENC_BIG_ENDIAN );
4477         offset++;
4478         data_len--;
4479         consumed++;
4480
4481         if ( data_len < 1 )
4482                 return -1;
4483
4484         /* frames */
4485         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_mtc_fr, tvb, offset, 1, ENC_BIG_ENDIAN );
4486         offset++;
4487         data_len--;
4488         consumed++;
4489
4490         if ( data_len < 1 )
4491                 return -1;
4492
4493         /* fractional frames */
4494         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_mtc_ff, tvb, offset, 1, ENC_BIG_ENDIAN );
4495         offset++;
4496         data_len--;
4497         consumed++;
4498
4499         if ( data_len < 1 )
4500                 return -1;
4501
4502         /* event-number (lsb) */
4503         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_mtc_enl, tvb, offset, 1, ENC_BIG_ENDIAN );
4504         offset++;
4505         data_len--;
4506         consumed++;
4507
4508         if ( data_len < 1 )
4509                 return -1;
4510
4511         /* event-number (msb) */
4512         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_mtc_enm, tvb, offset, 1, ENC_BIG_ENDIAN );
4513         offset++;
4514         data_len--;
4515         consumed++;
4516
4517         if ( data_len ) {
4518
4519                 /* additional data */
4520                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_mtc_add, tvb, offset, data_len, ENC_NA );
4521                 offset += data_len;
4522                 data_len -= data_len;
4523                 consumed += data_len;
4524         }
4525
4526         return consumed;
4527 }
4528
4529 /*
4530  * Here a Sysex-Common Realtime MIDI Time Code Cueing command is decoded.
4531  * As the codepoints are the same, we decode both realtime and non-realtime here.
4532  */
4533 static unsigned int
4534 decode_sysex_common_rt_mtc_cue( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
4535         guint8           sub_id         = 0;
4536         int              consumed       = 0;
4537
4538         if ( data_len < 1 )
4539                 return consumed;
4540
4541         /* first we retrieve the sub-command */
4542         sub_id = tvb_get_guint8( tvb, offset );
4543         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_cueing, tvb, offset, 1, ENC_BIG_ENDIAN );
4544         offset++;
4545         data_len--;
4546         consumed++;
4547
4548         if ( data_len < 1 )
4549                 return -1;
4550
4551         /* event-number (lsb) */
4552         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_cue_enl, tvb, offset, 1, ENC_BIG_ENDIAN );
4553         offset++;
4554         data_len--;
4555         consumed++;
4556
4557         if ( data_len < 1 )
4558                 return -1;
4559
4560         /* event-number (msb) */
4561         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_cue_enm, tvb, offset, 1, ENC_BIG_ENDIAN );
4562         offset++;
4563         data_len--;
4564         consumed++;
4565
4566         if ( data_len ) {
4567
4568                 /* additional data */
4569                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_cue_add, tvb, offset, data_len, ENC_NA );
4570                 offset += data_len;
4571                 data_len -= data_len;
4572                 consumed += data_len;
4573         }
4574
4575         return consumed;
4576 }
4577
4578
4579
4580
4581 /*
4582  * Here a Sysex-Common Non-Realtime command is decoded.
4583  */
4584 static unsigned int
4585 decode_sysex_common_nrt( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
4586         guint8           common_nrt     = 0;
4587         guint8           device_id      = 0;
4588         const gchar     *nrt_str        = NULL;
4589         proto_item      *command_item   = NULL;
4590         proto_tree      *command_tree   = NULL;
4591         int              consumed       = 0;
4592         int              ext_consumed   = 0;
4593
4594         if ( data_len < 1 )
4595                 return consumed;
4596
4597         device_id = tvb_get_guint8( tvb, offset );
4598         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_device_id, tvb, offset, 1, ENC_BIG_ENDIAN );
4599         offset++;
4600         data_len--;
4601         consumed++;
4602
4603         if ( data_len < 1 ) {
4604                 return consumed;
4605         }
4606
4607         common_nrt = tvb_get_guint8( tvb, offset );
4608
4609         nrt_str = val_to_str( common_nrt, rtp_midi_sysex_common_nrt, "Unknown 0x%02x" );
4610
4611         command_item = proto_tree_add_text(tree, tvb, offset, data_len, "%s",nrt_str );
4612         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_sysex_common_nrt );
4613         proto_tree_add_item( command_tree, hf_rtp_midi_sysex_common_non_realtime, tvb, offset, 1, ENC_BIG_ENDIAN );
4614
4615         offset++;
4616         data_len--;
4617         consumed++;
4618
4619         switch ( common_nrt ) {
4620                 case RTP_MIDI_SYSEX_COMMON_NRT_SAMPLE_DUMP_HEADER:
4621                         ext_consumed = decode_sysex_common_nrt_sd_hdr( tvb, pinfo, command_tree, offset, data_len );
4622                         break;
4623                 case RTP_MIDI_SYSEX_COMMON_NRT_SAMPLE_DATA_PACKET:
4624                         ext_consumed = decode_sysex_common_nrt_sd_packet( tvb, pinfo, command_tree, offset, data_len );
4625                         break;
4626                 case RTP_MIDI_SYSEX_COMMON_NRT_SAMPLE_DUMP_REQUEST:
4627                         ext_consumed = decode_sysex_common_nrt_sd_req( tvb, pinfo, command_tree, offset, data_len );
4628                         break;
4629                 case RTP_MIDI_SYSEX_COMMON_NRT_MTC:
4630                         ext_consumed = decode_sysex_common_nrt_mtc( tvb, pinfo, command_tree, offset, data_len );
4631                         break;
4632                 case RTP_MIDI_SYSEX_COMMON_NRT_SAMPLE_DUMP_EXTENSIONS:
4633                         ext_consumed = decode_sysex_common_nrt_sd_ext( tvb, pinfo, command_tree, offset, data_len );
4634                         break;
4635                 case RTP_MIDI_SYSEX_COMMON_NRT_GENERAL_INFORMATION:
4636                         ext_consumed = decode_sysex_common_nrt_gi( tvb, pinfo, command_tree, offset, data_len );
4637                         break;
4638                 case RTP_MIDI_SYSEX_COMMON_NRT_FILE_DUMP:
4639                         ext_consumed = decode_sysex_common_nrt_fd( tvb, pinfo, command_tree, offset, data_len );
4640                         break;
4641                 case RTP_MIDI_SYSEX_COMMON_NRT_MIDI_TUNING_STANDARD:
4642                         ext_consumed = decode_sysex_common_tuning( tvb, pinfo, command_tree, offset, data_len );
4643                         break;
4644                 case RTP_MIDI_SYSEX_COMMON_NRT_GENERAL_MIDI:
4645                         ext_consumed = decode_sysex_common_nrt_gm( tvb, pinfo, command_tree, offset, data_len );
4646                         break;
4647                 case RTP_MIDI_SYSEX_COMMON_NRT_DOWNLOADABLE_SOUNDS:             /* ??? not in Spec */
4648                         ext_consumed = decode_sysex_common_nrt_dls( tvb, pinfo, command_tree, offset, data_len );
4649                         break;
4650                 case RTP_MIDI_SYSEX_COMMON_NRT_END_OF_FILE:
4651                         ext_consumed = decode_sysex_common_nrt_eof( tvb, pinfo, command_tree, offset, data_len );
4652                         break;
4653                 case RTP_MIDI_SYSEX_COMMON_NRT_WAIT:
4654                         ext_consumed = decode_sysex_common_nrt_wait( tvb, pinfo, command_tree, offset, data_len );
4655                         break;
4656                 case RTP_MIDI_SYSEX_COMMON_NRT_CANCEL:
4657                         ext_consumed = decode_sysex_common_nrt_cancel( tvb, pinfo, command_tree, offset, data_len );
4658                         break;
4659                 case RTP_MIDI_SYSEX_COMMON_NRT_NAK:
4660                         ext_consumed = decode_sysex_common_nrt_nak( tvb, pinfo, command_tree, offset, data_len );
4661                         break;
4662                 case RTP_MIDI_SYSEX_COMMON_NRT_ACK:
4663                         ext_consumed = decode_sysex_common_nrt_ack( tvb, pinfo, command_tree, offset, data_len );
4664                         break;
4665         }
4666
4667         if ( ext_consumed < 0 ) {
4668                 return -1;
4669         }
4670
4671         /* set our pointers correct to move past already decoded data */
4672         offset += ext_consumed;
4673         data_len -= ext_consumed;
4674         consumed += ext_consumed;
4675
4676         if ( data_len > 0 ) {
4677                 proto_tree_add_item( command_tree, hf_rtp_midi_unknown_data, tvb, offset, data_len, ENC_NA );
4678                 consumed += data_len;
4679         }
4680
4681         return consumed;
4682 }
4683
4684
4685
4686
4687
4688
4689 /*
4690  * Here a Sysex-Common Realtime MIDI Time Code command is decoded.
4691  */
4692 static unsigned int
4693 decode_sysex_common_rt_mtc( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
4694         guint8           sub_id         = 0;
4695         int              consumed       = 0;
4696
4697         if ( data_len < 1 )
4698                 return consumed;
4699
4700         /* first we retrieve the sub-command */
4701         sub_id = tvb_get_guint8( tvb, offset );
4702         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc, tvb, offset, 1, ENC_BIG_ENDIAN );
4703         offset++;
4704         data_len--;
4705         consumed++;
4706
4707         if ( sub_id == RTP_MIDI_SYSEX_COMMON_RT_MTC_FULL_MESSAGE ) {
4708
4709                 if ( data_len < 1 )
4710                         return -1;
4711
4712                 /* type and hours */
4713                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_fm_type, tvb, offset, 1, ENC_BIG_ENDIAN );
4714                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_fm_hr, tvb, offset, 1, ENC_BIG_ENDIAN );
4715                 offset++;
4716                 data_len--;
4717                 consumed++;
4718
4719                 if ( data_len < 1 )
4720                         return -1;
4721
4722                 /* minutes */
4723                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_fm_mn, tvb, offset, 1, ENC_BIG_ENDIAN );
4724                 offset++;
4725                 data_len--;
4726                 consumed++;
4727
4728                 if ( data_len < 1 )
4729                         return -1;
4730
4731                 /* seconds */
4732                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_fm_sc, tvb, offset, 1, ENC_BIG_ENDIAN );
4733                 offset++;
4734                 data_len--;
4735                 consumed++;
4736
4737                 if ( data_len < 1 )
4738                         return -1;
4739
4740                 /* frames */
4741                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_fm_fr, tvb, offset, 1, ENC_BIG_ENDIAN );
4742                 offset++;
4743                 data_len--;
4744                 consumed++;
4745
4746         } else if ( sub_id == RTP_MIDI_SYSEX_COMMON_RT_MTC_USER_BITS ) {
4747
4748                 if ( data_len < 1 )
4749                         return -1;
4750
4751                 /* U1 */
4752                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_ub_u1, tvb, offset, 1, ENC_BIG_ENDIAN );
4753                 offset++;
4754                 data_len--;
4755                 consumed++;
4756
4757                 if ( data_len < 1 )
4758                         return -1;
4759
4760                 /* U2 */
4761                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_ub_u2, tvb, offset, 1, ENC_BIG_ENDIAN );
4762                 offset++;
4763                 data_len--;
4764                 consumed++;
4765
4766                 if ( data_len < 1 )
4767                         return -1;
4768
4769                 /* U3 */
4770                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_ub_u3, tvb, offset, 1, ENC_BIG_ENDIAN );
4771                 offset++;
4772                 data_len--;
4773                 consumed++;
4774
4775                 if ( data_len < 1 )
4776                         return -1;
4777
4778                 /* U4 */
4779                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_ub_u4, tvb, offset, 1, ENC_BIG_ENDIAN );
4780                 offset++;
4781                 data_len--;
4782                 consumed++;
4783
4784                 if ( data_len < 1 )
4785                         return -1;
4786
4787                 /* U5 */
4788                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_ub_u5, tvb, offset, 1, ENC_BIG_ENDIAN );
4789                 offset++;
4790                 data_len--;
4791                 consumed++;
4792
4793                 if ( data_len < 1 )
4794                         return -1;
4795
4796                 /* U6 */
4797                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_ub_u6, tvb, offset, 1, ENC_BIG_ENDIAN );
4798                 offset++;
4799                 data_len--;
4800                 consumed++;
4801
4802                 if ( data_len < 1 )
4803                         return -1;
4804
4805                 /* U7 */
4806                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_ub_u7, tvb, offset, 1, ENC_BIG_ENDIAN );
4807                 offset++;
4808                 data_len--;
4809                 consumed++;
4810
4811                 if ( data_len < 1 )
4812                         return -1;
4813
4814                 /* U8 */
4815                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_ub_u8, tvb, offset, 1, ENC_BIG_ENDIAN );
4816                 offset++;
4817                 data_len--;
4818                 consumed++;
4819
4820                 if ( data_len < 1 )
4821                         return -1;
4822
4823                 /* U9 */
4824                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mtc_ub_u9, tvb, offset, 1, ENC_BIG_ENDIAN );
4825                 offset++;
4826                 data_len--;
4827                 consumed++;
4828
4829         }
4830
4831         return consumed;
4832 }
4833
4834 /*
4835  * Here a Sysex-Common Realtime MIDI Show Control command is decoded.
4836  */
4837 static unsigned int
4838 decode_sysex_common_rt_sc( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
4839         guint8           sub_id         = 0;
4840         int              consumed       = 0;
4841
4842         if ( data_len < 1 )
4843                 return consumed;
4844
4845         /* first we retrieve the sub-command */
4846         sub_id = tvb_get_guint8( tvb, offset );
4847         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_sc, tvb, offset, 1, ENC_BIG_ENDIAN );
4848         offset++;
4849         data_len--;
4850         consumed++;
4851
4852         /* TODO: decode Show Control stuff */
4853         return consumed;
4854 }
4855
4856 /*
4857  * Here a Sysex-Common Realtime Notation Information command is decoded.
4858  */
4859 static unsigned int
4860 decode_sysex_common_rt_ni( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
4861         guint8           sub_id         = 0;
4862         int              consumed       = 0;
4863         int              bytes          = 0;
4864
4865         if ( data_len < 1 )
4866                 return consumed;
4867
4868         /* first we retrieve the sub-command */
4869         sub_id = tvb_get_guint8( tvb, offset );
4870         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_ni, tvb, offset, 1, ENC_BIG_ENDIAN );
4871         offset++;
4872         data_len--;
4873         consumed++;
4874
4875         if ( sub_id == RTP_MIDI_SYSEX_COMMON_RT_NT_BAR_NUMBER ) {
4876
4877                 if ( data_len < 2 )
4878                         return -1;
4879
4880                 /* bar number */
4881                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_ni_bar_num, tvb, offset, 2, ENC_BIG_ENDIAN );
4882                 offset += 2;
4883                 data_len -= 2;
4884                 consumed += 2;
4885
4886         } else if ( ( sub_id == RTP_MIDI_SYSEX_COMMON_RT_NT_TIME_SIGNATURE_IMMEDIATE ) ||
4887                         ( sub_id == RTP_MIDI_SYSEX_COMMON_RT_NT_TIME_SIGNATURE_DELAYED ) ) {
4888
4889                 if ( data_len < 1 )
4890                         return -1;
4891
4892                 /* bytes */
4893                 bytes = tvb_get_guint8( tvb, offset );
4894                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_ni_bytes, tvb, offset, 1, ENC_BIG_ENDIAN );
4895                 offset++;
4896                 data_len--;
4897                 consumed++;
4898
4899                 if ( data_len < 1 )
4900                         return -1;
4901
4902                 /* beats / numerator */
4903                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_ni_numerator, tvb, offset, 1, ENC_BIG_ENDIAN );
4904                 offset++;
4905                 data_len--;
4906                 consumed++;
4907                 bytes--;
4908
4909                 /* beats / denominator */
4910                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_ni_denominator, tvb, offset, 1, ENC_BIG_ENDIAN );
4911                 offset++;
4912                 data_len--;
4913                 consumed++;
4914                 bytes--;
4915
4916                 /* clocks */
4917                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_ni_midi_clocks, tvb, offset, 1, ENC_BIG_ENDIAN );
4918                 offset++;
4919                 data_len--;
4920                 consumed++;
4921                 bytes--;
4922
4923                 /* 32nds */
4924                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_ni_32nds, tvb, offset, 1, ENC_BIG_ENDIAN );
4925                 offset++;
4926                 data_len--;
4927                 consumed++;
4928                 bytes--;
4929
4930                 while ( bytes > 0 ) {
4931                         if ( data_len < 1 )
4932                                 return -1;
4933
4934                         /* beats / numerator */
4935                         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_ni_numerator, tvb, offset, 1, ENC_BIG_ENDIAN );
4936                         offset++;
4937                         data_len--;
4938                         consumed++;
4939                         bytes--;
4940
4941                         /* beats / denominator */
4942                         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_ni_denominator, tvb, offset, 1, ENC_BIG_ENDIAN );
4943                         offset++;
4944                         data_len--;
4945                         consumed++;
4946                         bytes--;
4947                 }
4948         }
4949
4950         return consumed;
4951 }
4952
4953 /*
4954  * Here a Sysex-Common Realtime Device Control command is decoded.
4955  */
4956 static unsigned int
4957 decode_sysex_common_rt_dc( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
4958         guint8           sub_id         = 0;
4959         int              consumed       = 0;
4960
4961         if ( data_len < 1 )
4962                 return consumed;
4963
4964         /* first we retrieve the sub-command */
4965         sub_id = tvb_get_guint8( tvb, offset );
4966         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_dc, tvb, offset, 1, ENC_BIG_ENDIAN );
4967         offset++;
4968         data_len--;
4969         consumed++;
4970
4971         if ( sub_id == RTP_MIDI_SYSEX_COMMON_RT_DC_MASTER_VOLUME ) {
4972
4973                 if ( data_len < 2 )
4974                         return -1;
4975
4976                 /* volume */
4977                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_dc_volume, tvb, offset, 2, ENC_BIG_ENDIAN );
4978                 offset += 2;
4979                 data_len -= 2;
4980                 consumed += 2;
4981
4982         } else if ( sub_id == RTP_MIDI_SYSEX_COMMON_RT_DC_MASTER_BALANCE ) {
4983
4984                 if ( data_len < 2 )
4985                         return -1;
4986
4987                 /* balance */
4988                 proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_dc_balance, tvb, offset, 2, ENC_BIG_ENDIAN );
4989                 offset += 2;
4990                 data_len -= 2;
4991                 consumed += 2;
4992
4993         }
4994
4995         return consumed;
4996 }
4997
4998
4999 /*
5000  * Here a Sysex-Common Realtime MIDI Machine Control command is decoded.
5001  */
5002 static unsigned int
5003 decode_sysex_common_rt_mmc_command( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
5004         guint8           sub_id         = 0;
5005         int              consumed       = 0;
5006
5007         if ( data_len < 1 )
5008                 return consumed;
5009
5010         /* first we retrieve the sub-command */
5011         sub_id = tvb_get_guint8( tvb, offset );
5012         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mmc_commands, tvb, offset, 1, ENC_BIG_ENDIAN );
5013         offset++;
5014         data_len--;
5015         consumed++;
5016
5017         /* TODO: decode MMC stuff */
5018         return consumed;
5019 }
5020
5021 /*
5022  * Here a Sysex-Common Realtime MIDI Machine Control response is decoded.
5023  */
5024 static unsigned int
5025 decode_sysex_common_rt_mmc_response( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
5026         guint8           sub_id         = 0;
5027         int              consumed       = 0;
5028
5029         if ( data_len < 1 )
5030                 return consumed;
5031
5032         /* first we retrieve the sub-command */
5033         sub_id = tvb_get_guint8( tvb, offset );
5034         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_mmc_responses, tvb, offset, 1, ENC_BIG_ENDIAN );
5035         offset++;
5036         data_len--;
5037         consumed++;
5038
5039         /* TODO: decode MMC stuff */
5040         return consumed;
5041 }
5042
5043
5044
5045
5046
5047 /*
5048  * Here a Sysex-Common Realtime command is decoded.
5049  */
5050 static unsigned int
5051 decode_sysex_common_rt( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
5052         guint8           common_rt      = 0;
5053         guint8           device_id      = 0;
5054         const gchar     *rt_str         = NULL;
5055         proto_item      *command_item   = NULL;
5056         proto_tree      *command_tree   = NULL;
5057         int              consumed       = 0;
5058         int              ext_consumed   = 0;
5059
5060         if ( data_len < 1 )
5061                 return consumed;
5062
5063         device_id = tvb_get_guint8( tvb, offset );
5064         proto_tree_add_item( tree, hf_rtp_midi_sysex_common_device_id, tvb, offset, 1, ENC_BIG_ENDIAN );
5065         offset++;
5066         data_len--;
5067         consumed++;
5068
5069         if ( data_len < 1 ) {
5070                 return consumed;
5071         }
5072
5073         common_rt = tvb_get_guint8( tvb, offset );
5074         rt_str = val_to_str( common_rt, rtp_midi_sysex_common_rt, "Unknown 0x%02x" );
5075
5076         command_item = proto_tree_add_text(tree, tvb, offset, data_len, "%s", rt_str );
5077         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_sysex_common_rt );
5078         proto_tree_add_item( command_tree, hf_rtp_midi_sysex_common_realtime, tvb, offset, 1, ENC_BIG_ENDIAN );
5079
5080         data_len--;
5081         offset++;
5082         consumed++;
5083
5084         switch ( common_rt ) {
5085                 case RTP_MIDI_SYSEX_COMMON_RT_MIDI_TIME_CODE:
5086                         ext_consumed = decode_sysex_common_rt_mtc( tvb, pinfo, command_tree, offset, data_len );
5087                         break;
5088                 case RTP_MIDI_SYSEX_COMMON_RT_MIDI_SHOW_CONTROL:
5089                         ext_consumed = decode_sysex_common_rt_sc( tvb, pinfo, command_tree, offset, data_len );
5090                         break;
5091                 case RTP_MIDI_SYSEX_COMMON_RT_NOTATION_INFORMATION:
5092                         ext_consumed = decode_sysex_common_rt_ni( tvb, pinfo, command_tree, offset, data_len );
5093                         break;
5094                 case RTP_MIDI_SYSEX_COMMON_RT_DEVICE_CONTROL:
5095                         ext_consumed = decode_sysex_common_rt_dc( tvb, pinfo, command_tree, offset, data_len );
5096                         break;
5097                 case RTP_MIDI_SYSEX_COMMON_RT_MTC_CUEING:
5098                         ext_consumed = decode_sysex_common_rt_mtc_cue( tvb, pinfo, command_tree, offset, data_len );
5099                         break;
5100                 case RTP_MIDI_SYSEX_COMMON_RT_MIDI_MACHINE_CONTROL_COMMAND:
5101                         ext_consumed = decode_sysex_common_rt_mmc_command( tvb, pinfo, command_tree, offset, data_len );
5102                         break;
5103                 case RTP_MIDI_SYSEX_COMMON_RT_MIDI_MACHINE_CONTROL_RESPONSE:
5104                         ext_consumed = decode_sysex_common_rt_mmc_response( tvb, pinfo, command_tree, offset, data_len );
5105                         break;
5106                 case RTP_MIDI_SYSEX_COMMON_RT_MIDI_TUNING_STANDARD:
5107                         ext_consumed = decode_sysex_common_tuning( tvb, pinfo, command_tree, offset, data_len );
5108                         break;
5109         }
5110
5111         if ( ext_consumed < 0 ) {
5112                 return -1;
5113         }
5114
5115         /* set our pointers correct to move past already decoded data */
5116         offset += ext_consumed;
5117         data_len -= ext_consumed;
5118         consumed += ext_consumed;
5119
5120         if ( data_len > 0 ) {
5121                 proto_tree_add_item( command_tree, hf_rtp_midi_unknown_data, tvb, offset, data_len, ENC_NA );
5122                 consumed += data_len;
5123         }
5124
5125         return consumed;
5126 }
5127
5128
5129 /*
5130  * Here a Sysex-Common Educational command is decoded.
5131  * According to the MIDI-specification, this should never be found "in the wild".
5132  * We don't know what this data encodes, so we just dump it.
5133  */
5134 static unsigned int
5135 decode_sysex_common_educational( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len ) {
5136         proto_item      *command_item   = NULL;
5137         proto_tree      *command_tree   = NULL;
5138         int              consumed       = 0;
5139
5140         if ( data_len < 1 )
5141                 return consumed;
5142
5143         command_item = proto_tree_add_text(tree, tvb, offset, data_len, RTP_MIDI_TREE_NAME_COMMAND_SYSEX_EDU );
5144         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_sysex_edu );
5145         proto_tree_add_item( command_tree, hf_rtp_midi_edu_data, tvb, offset, data_len, ENC_NA );
5146
5147         /* We consumed everything */
5148         return data_len;
5149 }
5150
5151 /*
5152  * Here a Sysex-Common Manufacturer command is decoded.
5153  * We don't know what this data encodes, so we just dump it.
5154  */
5155 static unsigned int
5156 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 ) {
5157         proto_item      *command_item   = NULL;
5158         proto_tree      *command_tree   = NULL;
5159         int              consumed       = 0;
5160
5161         if ( data_len < 1 )
5162                 return consumed;
5163
5164         /* Instead of dumping, at this point we could implement to start manufacturer-specific decoding
5165          * of the sysex-data...
5166          */
5167
5168         command_item = proto_tree_add_text(tree, tvb, offset, data_len, RTP_MIDI_TREE_NAME_COMMAND_SYSEX_MANU );
5169         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_sysex_manu );
5170
5171         proto_tree_add_item( command_tree, hf_rtp_midi_manu_data, tvb, offset, data_len, ENC_NA );
5172
5173         /* We consumed everything */
5174         return data_len;
5175 }
5176
5177
5178
5179 /*
5180  * Here a Sysex-Start command is decoded.
5181  */
5182 static unsigned int
5183 decode_sysex_start(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int cmd_count, unsigned int offset, unsigned int cmd_len ) {
5184         guint8           octet          = 0;
5185         guint8           manu_short     = 0;
5186         const gchar     *status_str     = NULL;
5187         proto_item      *command_item   = NULL;
5188         proto_tree      *command_tree   = NULL;
5189         proto_tree      *manu_tree      = NULL;
5190         int              consumed       = 0;
5191         int              data_len       = 0;
5192         int              ext_consumed   = 0;
5193         guint16          manufacturer   = 0;
5194
5195         status_str = val_to_str( RTP_MIDI_STATUS_COMMON_SYSEX_END, rtp_midi_common_status, rtp_midi_unknown_value_hex );
5196
5197         /* we need to parse "away" data until the next command */
5198         while ( cmd_len ) {
5199                 octet = tvb_get_guint8( tvb, offset + consumed );
5200                 consumed++;
5201
5202                 /*
5203                  * lets check if we have a "normal" end -
5204                  * if so, the last status-byte is consumed
5205                  * as it belongs to the message
5206                  */
5207                 if ( octet == RTP_MIDI_STATUS_COMMON_SYSEX_END ) {
5208                         status_str = rtp_midi_common_status_sysex_segment_complete;
5209                 } else if ( octet == RTP_MIDI_STATUS_COMMON_SYSEX_START ) {
5210                         status_str = rtp_midi_common_status_sysex_segment_start;
5211                 } else if ( octet == RTP_MIDI_STATUS_COMMON_UNDEFINED_F4 ) {
5212                         status_str = rtp_midi_common_status_sysex_cancel;
5213                 }
5214
5215                 /* Is this command through? */
5216                 if ( octet & RTP_MIDI_COMMAND_STATUS_FLAG ) {
5217                         break;
5218                 }
5219         }
5220
5221         /* the unknown data we have does not include the trailing status-command */
5222         data_len = consumed - 1;
5223
5224         command_item = proto_tree_add_text(tree, tvb, offset - 1, 1 + consumed, "%s", status_str );
5225         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
5226         proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
5227
5228         /* lets see if we have enough data for the sysex-id */
5229         if ( data_len > 1 ) {
5230                 manufacturer = tvb_get_guint8( tvb, offset );
5231                 proto_tree_add_item( command_tree, hf_rtp_midi_manu_short, tvb, offset, 1, ENC_BIG_ENDIAN );
5232                 manu_short = tvb_get_guint8( tvb, offset );
5233                 offset++;
5234                 data_len--;
5235
5236                 switch( manu_short ) {
5237                         case RTP_MIDI_MANU_SHORT_NON_REALTIME_UNIVERSAL:
5238                                 ext_consumed = decode_sysex_common_nrt( tvb, pinfo, command_tree, offset, data_len );
5239                                 break;
5240                         case RTP_MIDI_MANU_SHORT_REALTIME_UNIVERSAL:
5241                                 ext_consumed = decode_sysex_common_rt( tvb, pinfo, command_tree, offset, data_len );
5242                                 break;
5243                         case RTP_MIDI_MANU_SHORT_EDUCATIONAL_USE:
5244                                 ext_consumed = decode_sysex_common_educational( tvb, pinfo, command_tree, offset, data_len );
5245                                 break;
5246                         case RTP_MIDI_MANU_SHORT_ISLONG:
5247                                 /* lets see if we have enough data to decode a long sysex-id and if we have a long id at all */
5248                                 if ( data_len > 2 ) {
5249                                         manufacturer = tvb_get_ntohs( tvb, offset );
5250                                         proto_tree_add_item( command_tree, hf_rtp_midi_manu_long, tvb, offset, 2, ENC_BIG_ENDIAN );
5251                                         offset +=2 ;
5252                                         data_len -= 2;
5253                                         ext_consumed = decode_sysex_common_manufacturer( tvb, pinfo, command_tree, offset, data_len, manufacturer );
5254                                 }  else {
5255                                         ext_consumed = -1;
5256                                 }
5257                                 break;
5258                         default:
5259                                 ext_consumed = decode_sysex_common_manufacturer( tvb, pinfo, command_tree, offset, data_len, manufacturer );
5260                                 break;
5261                 }
5262         }
5263
5264         if ( ext_consumed < 0 ) {
5265                 return -1;
5266         }
5267
5268         /* set our pointers correct to move past already decoded data */
5269         offset += ext_consumed;
5270         data_len -= ext_consumed;
5271
5272         proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset, 1, ENC_BIG_ENDIAN );
5273
5274         if ( cmd_count ) {
5275                 col_append_fstr(pinfo->cinfo, COL_INFO,", %s", status_str );
5276         } else {
5277                 col_append_str(pinfo->cinfo, COL_INFO, status_str );
5278         }
5279
5280         return consumed;
5281 }
5282
5283 /*
5284  * Here the MIDI-Time-Code (MTC) Quarter Frame command is decoded.
5285  */
5286 static int
5287 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 ) {
5288         guint8           value          = 0;
5289         const gchar     *status_str     = NULL;
5290         proto_item      *command_item   = NULL;
5291         proto_tree      *command_tree   = NULL;
5292
5293         status_str = val_to_str( RTP_MIDI_STATUS_COMMON_MTC_QUARTER_FRAME, rtp_midi_common_status, rtp_midi_unknown_value_hex );
5294
5295         /* broken: we have no further data */
5296         if ( !cmd_len ) {
5297                 command_item = proto_tree_add_text( tree, tvb, offset - 1, 1, "TRUNCATED: %s ", status_str );
5298                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
5299                 proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
5300                 return -1;
5301         }
5302
5303         value = tvb_get_guint8( tvb, offset );
5304
5305         /* seems to be an aborted MIDI-command */
5306         if ( value & RTP_MIDI_COMMAND_STATUS_FLAG ) {
5307                 command_item = proto_tree_add_text( tree, tvb, offset - 1, 1, "ABORTED: %s", status_str );
5308                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
5309                 proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
5310                 return -1;
5311         }
5312
5313
5314         command_item = proto_tree_add_text(tree, tvb, offset - 1, 2, "%s", status_str );
5315         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
5316         proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
5317         proto_tree_add_item( command_tree, hf_rtp_midi_quarter_frame_type, tvb, offset, 1, ENC_BIG_ENDIAN );
5318         proto_tree_add_item( command_tree, hf_rtp_midi_quarter_frame_value, tvb, offset + 1, 1, ENC_BIG_ENDIAN );
5319
5320         if ( cmd_count ) {
5321                 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", status_str );
5322         } else {
5323                 col_append_str(pinfo->cinfo, COL_INFO, status_str );
5324         }
5325         return 1;
5326 }
5327
5328 /*
5329  * Here the Song Position Pointer command is decoded.
5330  */
5331 static int
5332 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 ) {
5333         guint8           octet1         = 0;
5334         guint8           octet2         = 0;
5335         guint8           position       = 0;
5336         const gchar     *status_str     = NULL;
5337         proto_item      *command_item   = NULL;
5338         proto_tree      *command_tree   = NULL;
5339
5340         status_str = val_to_str( RTP_MIDI_STATUS_COMMON_SONG_POSITION_POINTER, rtp_midi_common_status, rtp_midi_unknown_value_hex );
5341
5342         /* broken: we have no further data */
5343         if ( !cmd_len ) {
5344                 command_item = proto_tree_add_text( tree, tvb, offset - 1, 1, "TRUNCATED: %s", status_str );
5345                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
5346                 proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
5347                 return -1;
5348         }
5349
5350         octet1 = tvb_get_guint8( tvb, offset );
5351
5352         /* seems to be an aborted MIDI-command */
5353         if ( octet1 & RTP_MIDI_COMMAND_STATUS_FLAG ) {
5354                 command_item = proto_tree_add_text( tree, tvb, offset - 1, 1, "ABORTED: %s", status_str );
5355                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
5356                 proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
5357                 return -1;
5358         }
5359
5360         /* broken: we have only one further octet */
5361         if ( cmd_len < 2 ) {
5362                 command_item = proto_tree_add_text( tree, tvb, offset - 1, 2, "TRUNCATED: %s" );
5363                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
5364                 proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
5365                 proto_tree_add_item( command_tree, hf_rtp_midi_spp_truncated, tvb, offset, 1, ENC_BIG_ENDIAN );
5366                 return -1;
5367         }
5368
5369         octet2 = tvb_get_guint8( tvb, offset + 1 );
5370
5371         /* seems to be an aborted MIDI-command */
5372         if ( octet2  & RTP_MIDI_COMMAND_STATUS_FLAG ) {
5373                 command_item = proto_tree_add_text( tree, tvb, offset - 1, 2, "ABORTED: %s", status_str );
5374                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
5375                 proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
5376                 proto_tree_add_item( command_tree, hf_rtp_midi_spp_truncated, tvb, offset, 1, ENC_BIG_ENDIAN );
5377                 return -1;
5378         }
5379
5380         position = ( octet1 << 7 ) | octet2;
5381
5382         command_item = proto_tree_add_text(tree, tvb, offset - 1, 3, "%s (p=%d)", status_str, position );
5383         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
5384         proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
5385         proto_tree_add_item( command_tree, hf_rtp_midi_spp, tvb, offset, 2, ENC_BIG_ENDIAN );
5386
5387         if ( cmd_count ) {
5388                 col_append_fstr(pinfo->cinfo, COL_INFO,", %s (p=%d)", status_str, position );
5389         } else {
5390                 col_append_fstr(pinfo->cinfo, COL_INFO, "%s (p=%d)", status_str, position );
5391         }
5392         return 2;
5393 }
5394
5395 /*
5396  * Here a Song-Select command is decoded.
5397  */
5398 static int
5399 decode_song_select(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int cmd_count, unsigned int offset, unsigned int cmd_len ) {
5400         guint8           song_nr        = 0;
5401         const gchar     *status_str     = NULL;
5402         proto_item      *command_item   = NULL;
5403         proto_tree      *command_tree   = NULL;
5404
5405         status_str = val_to_str( RTP_MIDI_STATUS_COMMON_SONG_SELECT, rtp_midi_common_status, rtp_midi_unknown_value_hex );
5406
5407         /* broken: we have no further data */
5408         if ( !cmd_len ) {
5409                 command_item = proto_tree_add_text( tree, tvb, offset - 1, 1, "TRUNCATED: %s", status_str );
5410                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
5411                 proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
5412                 return -1;
5413         }
5414
5415         song_nr = tvb_get_guint8( tvb, offset );
5416
5417         /* seems to be an aborted MIDI-command */
5418         if ( song_nr & RTP_MIDI_COMMAND_STATUS_FLAG ) {
5419                 command_item = proto_tree_add_text( tree, tvb, offset - 1, 1, "ABORTED: %s", status_str );
5420                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
5421                 proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
5422                 return -1;
5423         }
5424
5425         command_item = proto_tree_add_text(tree, tvb, offset - 1, 2, "%s (s=%d)", status_str, song_nr );
5426         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
5427         proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
5428         proto_tree_add_item( command_tree, hf_rtp_midi_song_select, tvb, offset, 1, ENC_BIG_ENDIAN );
5429
5430         if ( cmd_count ) {
5431                 col_append_fstr(pinfo->cinfo, COL_INFO,", %s (s=%d)", status_str, song_nr );
5432         } else {
5433                 col_append_fstr(pinfo->cinfo, COL_INFO, "%s (s=%d)", status_str, song_nr );
5434         }
5435         return 1;
5436 }
5437
5438 /*
5439  * Here the undefined common-command 0xf4 is decoded.
5440  */
5441 static int
5442 decode_undefined_f4(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int cmd_count, unsigned int offset, unsigned int cmd_len ) {
5443         guint8           octet          = 0;
5444         const gchar     *status_str     = NULL;
5445         proto_item      *command_item   = NULL;
5446         proto_tree      *command_tree   = NULL;
5447         int              consumed       = 0;
5448
5449         status_str = val_to_str( RTP_MIDI_STATUS_COMMON_UNDEFINED_F4, rtp_midi_common_status, rtp_midi_unknown_value_hex );
5450
5451         /* we need to parse "away" data until the next command */
5452         while ( cmd_len ) {
5453                 octet = tvb_get_guint8( tvb, offset + consumed );
5454                 consumed++;
5455
5456                 /* Is this command through? */
5457                 if ( octet & RTP_MIDI_COMMAND_STATUS_FLAG ) {
5458                         break;
5459                 }
5460         }
5461
5462         command_item = proto_tree_add_text(tree, tvb, offset - 1, 1 + consumed, "%s", status_str );
5463         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
5464         proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
5465         /* just add the unknown data to the tree */
5466         proto_tree_add_item( command_tree, hf_rtp_midi_unknown_data, tvb, offset, consumed, ENC_NA );
5467         proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset + consumed - 1, 1, ENC_BIG_ENDIAN );
5468
5469         if ( cmd_count ) {
5470                 col_append_fstr(pinfo->cinfo, COL_INFO,", %s", status_str );
5471         } else {
5472                 col_append_str(pinfo->cinfo, COL_INFO, status_str );
5473         }
5474         return consumed;
5475 }
5476
5477 /*
5478  * Here the undefined common-command 0xf5 is decoded.
5479  */
5480 static int
5481 decode_undefined_f5(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int cmd_count, unsigned int offset, unsigned int cmd_len ) {
5482         guint8           octet          = 0;
5483         const gchar     *status_str     = NULL;
5484         proto_item      *command_item   = NULL;
5485         proto_tree      *command_tree   = NULL;
5486         int              consumed       = 0;
5487
5488         status_str = val_to_str( RTP_MIDI_STATUS_COMMON_UNDEFINED_F5, rtp_midi_common_status, rtp_midi_unknown_value_hex );
5489
5490         /* we need to parse "away" data until the next command */
5491         while ( cmd_len ) {
5492                 octet = tvb_get_guint8( tvb, offset + consumed );
5493                 consumed++;
5494                 /* Is this command done? */
5495                 if ( octet & RTP_MIDI_COMMAND_STATUS_FLAG ) {
5496                         break;
5497                 }
5498         }
5499
5500         command_item = proto_tree_add_text(tree, tvb, offset - 1, 1 + consumed, "%s", status_str );
5501         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
5502         proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
5503         /* just add the unknown data to the tree */
5504         proto_tree_add_item( command_tree, hf_rtp_midi_unknown_data, tvb, offset, consumed, ENC_NA );
5505         proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset + consumed - 1, 1, ENC_BIG_ENDIAN );
5506
5507         if ( cmd_count ) {
5508                 col_append_fstr(pinfo->cinfo, COL_INFO,", %s", status_str );
5509         } else {
5510                 col_append_str(pinfo->cinfo, COL_INFO, status_str );
5511         }
5512         return consumed;
5513 }
5514
5515 /*
5516  * Here a Tune-Request command is decoded.
5517  */
5518 static int
5519 decode_tune_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int cmd_count, unsigned int offset, unsigned int cmd_len ) {
5520         const gchar     *status_str     = NULL;
5521         proto_item      *command_item   = NULL;
5522         proto_tree      *command_tree   = NULL;
5523
5524         status_str = val_to_str( RTP_MIDI_STATUS_COMMON_TUNE_REQUEST, rtp_midi_common_status, rtp_midi_unknown_value_hex );
5525         command_item = proto_tree_add_text(tree, tvb, offset - 1, 1, "%s", status_str );
5526         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
5527         proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
5528
5529         if ( cmd_count ) {
5530                 col_append_fstr(pinfo->cinfo, COL_INFO,", %s)", status_str );
5531         } else {
5532                 col_append_str(pinfo->cinfo, COL_INFO, status_str );
5533         }
5534         return 0;
5535 }
5536
5537 /*
5538  * 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
5539  */
5540 static int
5541 decode_sysex_end(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int cmd_count, unsigned int offset, unsigned int cmd_len ) {
5542         guint8           octet          = 0;
5543         const gchar     *status_str     = NULL;
5544         proto_item      *command_item   = NULL;
5545         proto_tree      *command_tree   = NULL;
5546         int              consumed       = 0;
5547
5548         status_str = val_to_str( RTP_MIDI_STATUS_COMMON_SYSEX_END, rtp_midi_common_status, rtp_midi_unknown_value_hex );
5549
5550         /* we need to parse "away" data until the next command */
5551         while ( cmd_len ) {
5552                 octet = tvb_get_guint8( tvb, offset + consumed );
5553                 consumed++;
5554
5555                 /*
5556                  * lets check if we have a "normal" end -
5557                  * if so, the last status-byte is consumed
5558                  * as it belongs to the message
5559                  */
5560                 if ( octet == RTP_MIDI_STATUS_COMMON_SYSEX_END ) {
5561                         status_str = rtp_midi_common_status_sysex_segment_end;
5562                 } else if ( octet == RTP_MIDI_STATUS_COMMON_SYSEX_START ) {
5563                         status_str = rtp_midi_common_status_sysex_segment;
5564                 } else if ( octet == RTP_MIDI_STATUS_COMMON_UNDEFINED_F4 ) {
5565                         status_str = rtp_midi_common_status_sysex_cancel;
5566                 }
5567
5568                 /* Is this command through? */
5569                 if ( octet & RTP_MIDI_COMMAND_STATUS_FLAG ) {
5570                         break;
5571                 }
5572         }
5573
5574         command_item = proto_tree_add_text(tree, tvb, offset - 1, 1 + consumed, "%s", status_str );
5575         command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command );
5576         proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset - 1, 1, ENC_BIG_ENDIAN );
5577         proto_tree_add_item( command_tree, hf_rtp_midi_unknown_data, tvb, offset, consumed - 1, ENC_NA );
5578         proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset + consumed - 1, 1, ENC_BIG_ENDIAN );
5579
5580
5581         if ( cmd_count ) {
5582                 col_append_fstr(pinfo->cinfo, COL_INFO,", %s", status_str );
5583         } else {
5584                 col_append_str(pinfo->cinfo, COL_INFO, status_str );
5585         }
5586
5587         return consumed;
5588 }
5589
5590
5591
5592 /*
5593  * Here each single MIDI-command is decoded.
5594  * The Status-octet is read and then the decoding
5595  * of the individual MIDI-commands is punted to
5596  * external decoders.
5597  */
5598
5599 static int
5600 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 )
5601 {
5602         guint8           octet          = 0;
5603         const gchar     *valstr         = NULL;
5604         const gchar     *valstr2        = NULL;
5605         int              consumed       = 0;
5606         int              ext_consumed   = 0;
5607         gboolean         using_rs       = FALSE;
5608         proto_item      *command_item     = NULL;
5609         proto_tree      *command_tree     = NULL;
5610
5611
5612 /*      guint8          octet2;
5613         guint8          octet3;
5614         guint8          cmd;
5615         guint8          channel;
5616         proto_tree      *sysexdata_tree   = NULL;
5617         gboolean        foundend;
5618         guint16         wordvalue;
5619         char            helptext[200];
5620         char            entry[200];
5621         char            segtype[200];
5622         guint8          manu1;
5623         guint16         manu2;
5624         guint8          subid1;
5625         guint8          subid2;
5626         guint8          sysexchan;
5627         unsigned int    helpoffset;*/
5628
5629
5630         /* extra sanity check */
5631         if ( !cmd_len ) {
5632                 return -1;
5633         }
5634
5635
5636         octet = tvb_get_guint8( tvb, offset );
5637
5638
5639         /* midi realtime-data -> one octet  -- unlike serial-wired MIDI realtime-commands in RTP-MIDI will
5640          * not be intermingled with other MIDI-commands, so we handle this case right here and return */
5641         if ( octet >= 0xf8 ) {
5642                 valstr =  val_to_str( octet, rtp_midi_common_status, rtp_midi_unknown_value_hex );
5643                 command_item = proto_tree_add_text(tree, tvb, offset, 1, "%s", valstr );
5644                 command_tree = proto_item_add_subtree( command_item, ett_rtp_midi_command);
5645                 proto_tree_add_item( command_tree, hf_rtp_midi_common_status, tvb, offset, 1, ENC_BIG_ENDIAN );
5646
5647                 if ( cmd_count ) {
5648                         col_add_fstr(pinfo->cinfo, COL_INFO,", %s", valstr );
5649                 } else {
5650                         col_add_str(pinfo->cinfo, COL_INFO, valstr );
5651                 }
5652                 return 1;
5653         }
5654
5655
5656
5657         /* see if this first octet is a status message */
5658         if ( ( octet & RTP_MIDI_COMMAND_STATUS_FLAG ) == 0 ) {
5659                 /* if we have no running status yet -> error */
5660                 if ( ( ( *runningstatus ) & RTP_MIDI_COMMAND_STATUS_FLAG ) == 0 ) {
5661                         return -1;
5662                 }
5663                 /* our first octet is "virtual" coming from a preceding MIDI-command,
5664                  * so actually we have not really consumed anything yet */
5665                 octet = *runningstatus;
5666                 using_rs = TRUE;
5667         } else {
5668                 /* We have a "real" status-byte */
5669                 using_rs = FALSE;
5670
5671                 /* Let's see how this octet influences our running-status */
5672                 /* if we have a "normal" MIDI-command then the new status replaces the current running-status */
5673                 if ( octet < 0xf0 ) {
5674                         *rsoffset = offset ;
5675                         *runningstatus = octet;
5676                 } else {
5677                         /* system-realtime-commands maintain the current running-status
5678                          * other system-commands clear the running-status, since we
5679                          * already handled realtime, we can reset it here */
5680                         *runningstatus = 0;
5681                 }
5682
5683                 /* lets update our pointers */
5684                 consumed++;
5685                 cmd_len--;
5686                 offset++;
5687         }
5688
5689
5690
5691
5692         /* non-system MIDI-commands encode the command in the high nibble and the channel
5693          * in the low nibble - so we will take care of those cases next */
5694
5695         if ( octet < 0xf0 ) {
5696                 switch ( octet >> 4 ) {
5697                         case RTP_MIDI_STATUS_CHANNEL_NOTE_OFF:
5698                                 ext_consumed = decode_note_off( tvb, pinfo, tree, cmd_count, offset,  cmd_len, octet, *rsoffset, using_rs );
5699                                 break;
5700                         case RTP_MIDI_STATUS_CHANNEL_NOTE_ON:
5701                                 ext_consumed = decode_note_on( tvb, pinfo, tree, cmd_count, offset, cmd_len, octet, *rsoffset, using_rs );
5702                                 break;
5703                         case RTP_MIDI_STATUS_CHANNEL_POLYPHONIC_KEY_PRESSURE:
5704                                 ext_consumed = decode_poly_pressure(tvb, pinfo, tree, cmd_count, offset, cmd_len, octet, *rsoffset, using_rs );
5705                                 break;
5706                         case RTP_MIDI_STATUS_CHANNEL_CONTROL_CHANGE:
5707                                 ext_consumed = decode_control_change(tvb, pinfo, tree, cmd_count, offset, cmd_len, octet, *rsoffset, using_rs );
5708                                 break;
5709                         case RTP_MIDI_STATUS_CHANNEL_PROGRAM_CHANGE:
5710                                 ext_consumed = decode_program_change(tvb, pinfo, tree, cmd_count, offset, cmd_len, octet, *rsoffset, using_rs );
5711                                 break;
5712                         case RTP_MIDI_STATUS_CHANNEL_CHANNEL_PRESSURE:
5713                                 ext_consumed = decode_channel_pressure(tvb, pinfo, tree, cmd_count, offset, cmd_len, octet, *rsoffset, using_rs );
5714                                 break;
5715                         case RTP_MIDI_STATUS_CHANNEL_PITCH_BEND_CHANGE:
5716                                 ext_consumed = decode_pitch_bend_change(tvb, pinfo, tree, cmd_count, offset, cmd_len, octet, *rsoffset, using_rs );
5717                                 break;
5718                 }
5719                 /* external decoder informed us of error -> pass this through */
5720                 if ( ext_consumed < 0 ) {
5721                         return ext_consumed;
5722                 }
5723                 return consumed + ext_consumed;
5724         }
5725
5726         /* Here we catch the remaining system-common commands */
5727         switch ( octet ) {
5728                 case RTP_MIDI_STATUS_COMMON_SYSEX_START:
5729                         ext_consumed =  decode_sysex_start( tvb, pinfo, tree, cmd_count, offset, cmd_len );
5730                         break;
5731                 case RTP_MIDI_STATUS_COMMON_MTC_QUARTER_FRAME:
5732                         ext_consumed =  decode_mtc_quarter_frame( tvb, pinfo, tree, cmd_count, offset, cmd_len );
5733                         break;
5734                 case RTP_MIDI_STATUS_COMMON_SONG_POSITION_POINTER:
5735                         ext_consumed =  decode_song_position_pointer( tvb, pinfo, tree, cmd_count, offset, cmd_len );
5736                         break;
5737                 case RTP_MIDI_STATUS_COMMON_SONG_SELECT:
5738                         ext_consumed =  decode_song_select( tvb, pinfo, tree, cmd_count, offset, cmd_len );
5739                         break;
5740                 case RTP_MIDI_STATUS_COMMON_UNDEFINED_F4:
5741                         ext_consumed =  decode_undefined_f4( tvb, pinfo, tree, cmd_count, offset, cmd_len );
5742                         break;
5743                 case RTP_MIDI_STATUS_COMMON_UNDEFINED_F5:
5744                         ext_consumed =  decode_undefined_f5( tvb, pinfo, tree, cmd_count, offset, cmd_len );
5745                         break;
5746                 case RTP_MIDI_STATUS_COMMON_TUNE_REQUEST:
5747                         ext_consumed =  decode_tune_request( tvb, pinfo, tree, cmd_count, offset, cmd_len );
5748                         break;
5749                 case RTP_MIDI_STATUS_COMMON_SYSEX_END:
5750                         ext_consumed =  decode_sysex_end( tvb, pinfo, tree, cmd_count, offset, cmd_len );
5751                         break;
5752         }
5753         /* external decoder informed us of error -> pass this through */
5754         if ( ext_consumed < 0 ) {
5755                 return ext_consumed;
5756         }
5757         return consumed + ext_consumed;
5758 }
5759
5760
5761
5762 /*
5763  * Here the chapter c of the channel-journal is decoded.
5764  */
5765 static int
5766 decode_cj_chapter_c( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset ) {
5767         proto_item                      *ti                             = NULL;
5768         proto_tree                      *rtp_midi_cj_chapter_tree       = NULL;
5769         proto_tree                      *rtp_midi_loglist_tree          = NULL;
5770         int                              consumed                       = 0;
5771         guint8                           octet;
5772         int                              count;
5773         int                              i;
5774
5775         /* Can we at least read the length of the control changes chapter? */
5776         if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
5777                 return -1;
5778         }
5779
5780         octet = tvb_get_guint8( tvb, offset );
5781         count = octet & 0x7f;
5782
5783         /* count encoded is n+1 */
5784         count++;
5785
5786         ti = proto_tree_add_text( tree, tvb, offset, 1 + 2 * count, RTP_MIDI_TREE_NAME_CJ_CHAPTER_C );
5787         rtp_midi_cj_chapter_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_c );
5788
5789         proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_c_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
5790         proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_c_length, tvb, offset, 1, ENC_BIG_ENDIAN );
5791
5792         offset++;
5793         consumed++;
5794
5795         ti = proto_tree_add_text( rtp_midi_cj_chapter_tree, tvb, offset, count * 2, RTP_MIDI_TREE_NAME_CJ_CHAPTER_C_LOGLIST );
5796         rtp_midi_loglist_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_c_loglist );
5797
5798         for ( i = 0; i < count; i++ ) {
5799                 /* Can we still read this number/value-pair? */
5800                 if ( !tvb_bytes_exist( tvb, offset, 2 ) ) {
5801                         return -1;
5802                 }
5803
5804                 ti = proto_tree_add_text(rtp_midi_loglist_tree, tvb, offset, 2, RTP_MIDI_TREE_NAME_CJ_CHAPTER_C_LOGITEM );
5805                 ti = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_c_logitem );
5806
5807                 proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_c_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
5808                 proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_c_number, tvb, offset, 1, ENC_BIG_ENDIAN );
5809
5810                 offset++;
5811                 consumed++;
5812
5813                 octet = tvb_get_guint8( tvb, offset );
5814                 proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_c_aflag, tvb, offset, 1, ENC_BIG_ENDIAN );
5815
5816                 /* do we have a value or alternative coding? */
5817                 if ( octet & 0x80 ) {
5818                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_c_tflag, tvb, offset, 1, ENC_BIG_ENDIAN );
5819                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_c_alt, tvb, offset, 1, ENC_BIG_ENDIAN );
5820                 } else {
5821                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_c_value, tvb, offset, 1, ENC_BIG_ENDIAN );
5822                 }
5823
5824                 offset++;
5825                 consumed++;
5826         }
5827         return consumed;
5828 }
5829
5830
5831
5832 /*
5833  * Here the chapter m of the channel-journal is decoded, possibly the most complex part of the RTP-MIDI stuff ;-)
5834  */
5835 static int
5836 decode_cj_chapter_m( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset ) {
5837         proto_item                      *ti                             = NULL;
5838         proto_tree                      *rtp_midi_cj_chapter_tree       = NULL;
5839         proto_tree                      *rtp_midi_loglist_tree          = NULL;
5840         proto_tree                      *rtp_midi_loglist_item_tree     = NULL;
5841         guint16                         header;
5842         guint8                          logitemheader;
5843         int                             length;
5844         int                             logitemhdrlen;
5845         int                             logitemlen;
5846         gboolean                        no_pnum_msb;
5847         int                             consumed = 0;
5848
5849         /* Can we read this channel-journals header? */
5850         if ( !tvb_bytes_exist( tvb, offset, 2 ) ) {
5851                 return -1;
5852         }
5853
5854         /* first we need to get the flags & length of this chapter */
5855         header = tvb_get_ntohs( tvb, offset );
5856         length = header & RTP_MIDI_CJ_CHAPTER_M_MASK_LENGTH;
5857         /* take of length of header */
5858         length -= 2;
5859
5860         ti = proto_tree_add_text( tree, tvb, offset, length, RTP_MIDI_TREE_NAME_CJ_CHAPTER_M );
5861         rtp_midi_cj_chapter_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_m );
5862
5863         proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_m_sflag, tvb, offset, 2, ENC_BIG_ENDIAN );
5864         proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_m_pflag, tvb, offset, 2, ENC_BIG_ENDIAN );
5865         proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_m_eflag, tvb, offset, 2, ENC_BIG_ENDIAN );
5866         proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_m_uflag, tvb, offset, 2, ENC_BIG_ENDIAN );
5867         proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_m_wflag, tvb, offset, 2, ENC_BIG_ENDIAN );
5868         proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_m_zflag, tvb, offset, 2, ENC_BIG_ENDIAN );
5869         proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_m_length, tvb, offset, 2, ENC_BIG_ENDIAN );
5870
5871         /* done with header */
5872         consumed += 2;
5873         offset += 2;
5874
5875         /* do we have the pending field? */
5876         if ( header & 0x4000 ) {
5877                 /* Can we read this pending field? */
5878                 if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
5879                         return -1;
5880                 }
5881
5882                 proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_m_qflag, tvb, offset, 1, ENC_BIG_ENDIAN );
5883                 proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_m_pending, tvb, offset, 1, ENC_BIG_ENDIAN );
5884
5885                 consumed++;
5886                 offset++;
5887         }
5888
5889         /*
5890          * lets find out if we need to decode the pnum_msb:
5891          * if Z = 1 and either U = 1 or W = 1 we don't
5892          */
5893         no_pnum_msb = ( header & 0x0400 ) && ( ( header & 0x0800 ) || ( header & 0x1000 ) );
5894         logitemhdrlen = no_pnum_msb ? 2 : 3;
5895
5896         ti = proto_tree_add_text( rtp_midi_cj_chapter_tree, tvb, offset, length, RTP_MIDI_TREE_NAME_CJ_CHAPTER_M_LOGLIST );
5897         rtp_midi_loglist_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_m_loglist );
5898
5899         /* lets step through the loglist */
5900         while ( length > 0 ) {
5901
5902                 /* Can we read this channel-journals header? */
5903                 if ( !tvb_bytes_exist( tvb, offset, logitemhdrlen ) ) {
5904                         return -1;
5905                 }
5906
5907                 if ( no_pnum_msb ) {
5908                         logitemheader = tvb_get_guint8( tvb, offset + 1 );
5909                 } else {
5910                         logitemheader = tvb_get_guint8( tvb, offset + 2 );
5911                 }
5912
5913                 logitemlen = logitemhdrlen;
5914
5915                 /* do we have a msb field? */
5916                 if ( logitemheader & RTP_MIDI_CJ_CHAPTER_M_FLAG_J ) {
5917                         logitemlen++;
5918                 }
5919
5920                 /* do we have a lsb field? */
5921                 if ( logitemheader & RTP_MIDI_CJ_CHAPTER_M_FLAG_K ) {
5922                         logitemlen++;
5923                 }
5924
5925                 /* do we have an a-button field? */
5926                 if ( logitemheader & RTP_MIDI_CJ_CHAPTER_M_FLAG_L ) {
5927                         logitemlen +=2;
5928                 }
5929
5930                 /* do we have a c-button field? */
5931                 if ( logitemheader & RTP_MIDI_CJ_CHAPTER_M_FLAG_M ) {
5932                         logitemlen +=2;
5933                 }
5934
5935                 /* do we have a count field? */
5936                 if ( logitemheader & RTP_MIDI_CJ_CHAPTER_M_FLAG_N ) {
5937                         logitemlen++;
5938                 }
5939
5940                 /* now that we have the length of the logitem, we can create the tree... */
5941                 ti = proto_tree_add_text( rtp_midi_loglist_tree, tvb, offset, logitemlen, RTP_MIDI_TREE_NAME_CJ_CHAPTER_M_LOGITEM );
5942                 rtp_midi_loglist_item_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_m_logitem );
5943
5944                 proto_tree_add_item( rtp_midi_loglist_item_tree, hf_rtp_midi_cj_chapter_m_log_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
5945                 proto_tree_add_item( rtp_midi_loglist_item_tree, hf_rtp_midi_cj_chapter_m_log_pnum_lsb, tvb, offset, 1, ENC_BIG_ENDIAN );
5946                 consumed++;
5947                 offset++;
5948                 length--;
5949
5950                 /* if we have the msb, we need to decode it */
5951                 if ( !no_pnum_msb ) {
5952                         proto_tree_add_item( rtp_midi_loglist_item_tree, hf_rtp_midi_cj_chapter_m_log_qflag, tvb, offset, 1, ENC_BIG_ENDIAN );
5953                         proto_tree_add_item( rtp_midi_loglist_item_tree, hf_rtp_midi_cj_chapter_m_log_pnum_msb, tvb, offset, 1, ENC_BIG_ENDIAN );
5954                         consumed++;
5955                         offset++;
5956                         length--;
5957                 }
5958
5959                 proto_tree_add_item( rtp_midi_loglist_item_tree, hf_rtp_midi_cj_chapter_m_log_jflag, tvb, offset, 1, ENC_BIG_ENDIAN );
5960                 proto_tree_add_item( rtp_midi_loglist_item_tree, hf_rtp_midi_cj_chapter_m_log_kflag, tvb, offset, 1, ENC_BIG_ENDIAN );
5961                 proto_tree_add_item( rtp_midi_loglist_item_tree, hf_rtp_midi_cj_chapter_m_log_lflag, tvb, offset, 1, ENC_BIG_ENDIAN );
5962                 proto_tree_add_item( rtp_midi_loglist_item_tree, hf_rtp_midi_cj_chapter_m_log_mflag, tvb, offset, 1, ENC_BIG_ENDIAN );
5963                 proto_tree_add_item( rtp_midi_loglist_item_tree, hf_rtp_midi_cj_chapter_m_log_nflag, tvb, offset, 1, ENC_BIG_ENDIAN );
5964                 proto_tree_add_item( rtp_midi_loglist_item_tree, hf_rtp_midi_cj_chapter_m_log_tflag, tvb, offset, 1, ENC_BIG_ENDIAN );
5965                 proto_tree_add_item( rtp_midi_loglist_item_tree, hf_rtp_midi_cj_chapter_m_log_vflag, tvb, offset, 1, ENC_BIG_ENDIAN );
5966                 proto_tree_add_item( rtp_midi_loglist_item_tree, hf_rtp_midi_cj_chapter_m_log_rflag, tvb, offset, 1, ENC_BIG_ENDIAN );
5967                 consumed++;
5968                 offset++;
5969                 length--;
5970
5971                 /* do we have a entry-msb field? */
5972                 if ( logitemheader & RTP_MIDI_CJ_CHAPTER_M_FLAG_J ) {
5973
5974                         /* Can we read this table? */
5975                         if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
5976                                 return -1;
5977                         }
5978
5979                         ti = proto_tree_add_text( rtp_midi_loglist_tree, tvb, offset, 1, RTP_MIDI_TREE_NAME_CJ_CHAPTER_M_LOG_MSB );
5980                         ti = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_m_log_msb );
5981
5982                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_m_log_msb_x, tvb, offset, 1, ENC_BIG_ENDIAN );
5983                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_m_log_msb, tvb, offset, 1, ENC_BIG_ENDIAN );
5984
5985                         consumed++;
5986                         offset++;
5987                         length--;
5988                 }
5989
5990                 /* do we have a entry-lsb field? */
5991                 if ( logitemheader & RTP_MIDI_CJ_CHAPTER_M_FLAG_K ) {
5992                         /* Can we read this table? */
5993                         if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
5994                                 return -1;
5995                         }
5996
5997                         ti = proto_tree_add_text( rtp_midi_loglist_tree, tvb, offset, 1, RTP_MIDI_TREE_NAME_CJ_CHAPTER_M_LOG_LSB );
5998                         ti = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_m_log_lsb );
5999
6000                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_m_log_lsb_x, tvb, offset, 1, ENC_BIG_ENDIAN );
6001                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_m_log_lsb, tvb, offset, 1, ENC_BIG_ENDIAN );
6002
6003                         consumed++;
6004                         offset++;
6005                         length--;
6006                 }
6007
6008                 /* do we have an a-button field? */
6009                 if ( logitemheader & RTP_MIDI_CJ_CHAPTER_M_FLAG_L ) {
6010                         /* Can we read this table? */
6011                         if ( !tvb_bytes_exist( tvb, offset, 2 ) ) {
6012                                 return -1;
6013                         }
6014
6015                         ti = proto_tree_add_text( rtp_midi_loglist_tree, tvb, offset, 2, RTP_MIDI_TREE_NAME_CJ_CHAPTER_M_LOG_A_BUTTON );
6016                         ti = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_m_log_a_button );
6017
6018                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_m_log_a_button_g, tvb, offset, 2, ENC_BIG_ENDIAN );
6019                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_m_log_a_button_x, tvb, offset, 2, ENC_BIG_ENDIAN );
6020                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_m_log_a_button, tvb, offset, 2, ENC_BIG_ENDIAN );
6021
6022                         consumed += 2;
6023                         offset += 2;
6024                         length -= 2;
6025                 }
6026
6027                 /* do we have a c-button field? */
6028                 if ( logitemheader & RTP_MIDI_CJ_CHAPTER_M_FLAG_M ) {
6029                         /* Can we read this table? */
6030                         if ( !tvb_bytes_exist( tvb, offset, 2 ) ) {
6031                                 return -1;
6032                         }
6033                         ti = proto_tree_add_text( rtp_midi_loglist_tree, tvb, offset, 2, RTP_MIDI_TREE_NAME_CJ_CHAPTER_M_LOG_C_BUTTON );
6034                         ti = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_m_log_c_button );
6035
6036                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_m_log_c_button_g, tvb, offset, 2, ENC_BIG_ENDIAN );
6037                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_m_log_c_button_r, tvb, offset, 2, ENC_BIG_ENDIAN );
6038                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_m_log_c_button, tvb, offset, 2, ENC_BIG_ENDIAN );
6039
6040                         consumed += 2;
6041                         offset += 2;
6042                         length -= 2;
6043                 }
6044
6045                 /* do we have a count field? */
6046                 if ( logitemheader & RTP_MIDI_CJ_CHAPTER_M_FLAG_N ) {
6047                         /* Can we read this table? */
6048                         if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
6049                                 return -1;
6050                         }
6051                         ti = proto_tree_add_text( rtp_midi_loglist_tree, tvb, offset, 1, RTP_MIDI_TREE_NAME_CJ_CHAPTER_M_LOG_COUNT );
6052                         ti = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_m_log_count );
6053
6054                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_m_log_count_x, tvb, offset, 1, ENC_BIG_ENDIAN );
6055                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_m_log_count, tvb, offset, 1, ENC_BIG_ENDIAN );
6056
6057                         consumed++;
6058                         offset++;
6059                         length--;
6060                 }
6061
6062         }
6063
6064
6065         return consumed;
6066 }
6067
6068
6069 /*
6070  * Here the chapter n of the channel-journal is decoded.
6071  */
6072 static int
6073 decode_cj_chapter_n( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset ) {
6074         proto_item                      *ti                             = NULL;
6075         proto_tree                      *rtp_midi_cj_chapter_tree       = NULL;
6076         proto_tree                      *rtp_midi_loglist_tree          = NULL;
6077         const gchar                     *note_str                       = NULL;
6078         int                              consumed                       = 0;
6079         guint16                          header;
6080         guint8                           note;
6081         guint8                           velocity;
6082         int                              log_count;
6083         int                              octet_count;
6084         int                              low;
6085         int                              high;
6086         int                              i;
6087
6088         /* Can we read this channel-journals header? */
6089         if ( !tvb_bytes_exist( tvb, offset, 2 ) ) {
6090                 return -1;
6091         }
6092
6093         /* first we need to get the flags & length of this chapter */
6094         header = tvb_get_ntohs( tvb, offset );
6095         log_count = ( header & RTP_MIDI_CJ_CHAPTER_N_MASK_LENGTH ) >> 8;
6096         low = ( header & RTP_MIDI_CJ_CHAPTER_N_MASK_LOW ) >> 4;
6097         high = header & RTP_MIDI_CJ_CHAPTER_N_MASK_HIGH;
6098
6099         /* how many offbits octets do we have? */
6100         if ( low <= high ) {
6101                 octet_count = high - low + 1;
6102         } else if ( ( low == 15 ) && ( high == 0 ) ) {
6103                 octet_count = 0;
6104         } else if ( ( low == 15 ) && ( high == 1 ) ) {
6105                 octet_count = 0;
6106         } else {
6107                 return -1;
6108         }
6109
6110         /* special case -> no offbit octets, but 128 note-logs */
6111         if ( ( log_count == 127 ) && ( low == 15) && ( high == 0 ) ) {
6112                 log_count++;
6113         }
6114
6115         ti = proto_tree_add_text( tree, tvb, offset, 2 + ( log_count * 2 ) + octet_count, RTP_MIDI_TREE_NAME_CJ_CHAPTER_N );
6116         rtp_midi_cj_chapter_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_n );
6117
6118         proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_n_bflag, tvb, offset, 2, ENC_BIG_ENDIAN );
6119         proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_n_len, tvb, offset, 2, ENC_BIG_ENDIAN );
6120         proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_n_low, tvb, offset, 2, ENC_BIG_ENDIAN );
6121         proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_n_high, tvb, offset, 2, ENC_BIG_ENDIAN );
6122
6123         offset += 2;
6124         consumed += 2;
6125
6126         if ( log_count > 0 ) {
6127
6128                 /* Can we read this loglist? */
6129                 if ( !tvb_bytes_exist( tvb, offset, log_count * 2 ) ) {
6130                         return -1;
6131                 }
6132
6133                 ti = proto_tree_add_text( rtp_midi_cj_chapter_tree, tvb, offset, log_count * 2, RTP_MIDI_TREE_NAME_CJ_CHAPTER_N_LOGLIST );
6134                 rtp_midi_loglist_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_n_loglist );
6135
6136                 for ( i = 0; i < log_count; i++ ) {
6137
6138                         note = tvb_get_guint8( tvb, offset ) & 0x7f;
6139                         velocity = tvb_get_guint8( tvb, offset + 1 ) & 0x7f;;
6140
6141                         note_str = val_to_str( note, rtp_midi_note_values, rtp_midi_unknown_value_dec );
6142
6143                         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 );
6144                         ti = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_n_logitem );
6145
6146                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_n_log_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6147                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_n_log_notenum, tvb, offset, 1, ENC_BIG_ENDIAN );
6148
6149                         offset++;
6150                         consumed++;
6151
6152                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_n_log_yflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6153                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_n_log_velocity, tvb, offset, 1, ENC_BIG_ENDIAN );
6154
6155                         offset++;
6156                         consumed++;
6157                 }
6158
6159         }
6160
6161         if ( octet_count > 0 ) {
6162
6163                 /* Can we read this loglist? */
6164                 if ( !tvb_bytes_exist( tvb, offset, octet_count ) ) {
6165                         return -1;
6166                 }
6167                 ti = proto_tree_add_text( rtp_midi_cj_chapter_tree, tvb, offset, log_count, RTP_MIDI_TREE_NAME_CJ_CHAPTER_N_OCTETS );
6168                 rtp_midi_loglist_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_n_octets );
6169
6170                 for ( i = 0; i < octet_count; i++ ) {
6171
6172                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_n_log_octet, tvb, offset, 1, ENC_BIG_ENDIAN );
6173
6174                         offset++;
6175                         consumed++;
6176                 }
6177         }
6178
6179         return consumed;
6180 }
6181
6182
6183 /*
6184  * Here the chapter e of the channel-journal is decoded.
6185  */
6186 static int
6187 decode_cj_chapter_e( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset ) {
6188         proto_item                      *ti                             = NULL;
6189         proto_tree                      *rtp_midi_cj_chapter_tree       = NULL;
6190         proto_tree                      *rtp_midi_loglist_tree          = NULL;
6191         const gchar                     *note_str                       = NULL;
6192         int                              consumed                       = 0;
6193         guint8                           header;
6194         guint8                           note;
6195         guint8                           count_vel;
6196         guint8                           octet;
6197         int                              log_count;
6198         int                              i;
6199
6200         /* Can we read this channel-journals header? */
6201         if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
6202                 return -1;
6203         }
6204
6205         /* first we need to get the flags & length of this chapter */
6206         header = tvb_get_guint8( tvb, offset );
6207         log_count = header & RTP_MIDI_CJ_CHAPTER_E_MASK_LENGTH;
6208
6209         /* count is encoded n+1 */
6210         log_count++;
6211
6212         ti = proto_tree_add_text( tree, tvb, offset, 1 + ( log_count * 2 ), RTP_MIDI_TREE_NAME_CJ_CHAPTER_E );
6213         rtp_midi_cj_chapter_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_e );
6214
6215         proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_e_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6216         proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_e_len, tvb, offset, 2, ENC_BIG_ENDIAN );
6217
6218         offset++;
6219         consumed++;
6220
6221         /* Can we read this loglist? */
6222         if ( !tvb_bytes_exist( tvb, offset, log_count * 2 ) ) {
6223                 return -1;
6224         }
6225
6226         ti = proto_tree_add_text( rtp_midi_cj_chapter_tree, tvb, offset, log_count * 2, RTP_MIDI_TREE_NAME_CJ_CHAPTER_E_LOGLIST );
6227         rtp_midi_loglist_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_e_loglist );
6228
6229         for ( i = 0; i < log_count; i++ ) {
6230
6231                 note = tvb_get_guint8( tvb, offset ) & 0x7f;
6232                 octet = tvb_get_guint8( tvb, offset + 1 );
6233                 count_vel = octet & 0x7f;
6234
6235                 note_str = val_to_str( note, rtp_midi_note_values, rtp_midi_unknown_value_dec );
6236
6237                 if ( octet & 0x80 ) {
6238                         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 );
6239                 } else {
6240                         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 );
6241                 }
6242                 ti = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_e_logitem );
6243
6244                 proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_e_log_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6245                 proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_e_log_notenum, tvb, offset, 1, ENC_BIG_ENDIAN );
6246
6247                 offset++;
6248                 consumed++;
6249
6250                 proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_e_log_vflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6251                 if ( octet & 0x80 ) {
6252                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_e_log_velocity, tvb, offset, 1, ENC_BIG_ENDIAN );
6253                 } else {
6254                         proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_e_log_count, tvb, offset, 1, ENC_BIG_ENDIAN );
6255                 }
6256
6257                 offset++;
6258                 consumed++;
6259         }
6260
6261         return consumed;
6262 }
6263
6264
6265
6266
6267
6268
6269
6270
6271 /*
6272  * Here the chapter a of the channel-journal is decoded.
6273  */
6274 static int
6275 decode_cj_chapter_a( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset ) {
6276         proto_item                      *ti                             = NULL;
6277         proto_tree                      *rtp_midi_cj_chapter_tree       = NULL;
6278         proto_tree                      *rtp_midi_loglist_tree          = NULL;
6279         proto_tree                      *rtp_midi_loglist_item_tree     = NULL;
6280         const gchar                     *note_str                       = NULL;
6281         int                              consumed                       = 0;
6282         guint8                           header;
6283         guint8                           note;
6284         guint8                           pressure;
6285         int                              log_count;
6286         int                              i;
6287
6288         /* Can we read this channel-journals header? */
6289         if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
6290                 return -1;
6291         }
6292
6293         /* first we need to get the flags & length of this chapter */
6294         header = tvb_get_guint8( tvb, offset );
6295         log_count = header & RTP_MIDI_CJ_CHAPTER_A_MASK_LENGTH;
6296
6297         /* count is encoded n+1 */
6298         log_count++;
6299
6300         ti = proto_tree_add_text( tree, tvb, offset, 1 + ( log_count * 2 ), RTP_MIDI_TREE_NAME_CJ_CHAPTER_A );
6301         rtp_midi_cj_chapter_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_a );
6302
6303         proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_a_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6304         proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_a_len, tvb, offset, 2, ENC_BIG_ENDIAN );
6305
6306         offset++;
6307         consumed++;
6308
6309         /* Can we read this loglist? */
6310         if ( !tvb_bytes_exist( tvb, offset, log_count * 2 ) ) {
6311                 return -1;
6312         }
6313
6314         ti = proto_tree_add_text( rtp_midi_cj_chapter_tree, tvb, offset, log_count * 2, RTP_MIDI_TREE_NAME_CJ_CHAPTER_A_LOGLIST );
6315         rtp_midi_loglist_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_a_loglist );
6316
6317         for ( i = 0; i < log_count; i++ ) {
6318
6319                 note = tvb_get_guint8( tvb, offset ) & 0x7f;
6320                 pressure = tvb_get_guint8( tvb, offset + 1 ) & 0x7f;
6321
6322                 note_str = val_to_str( note, rtp_midi_note_values, rtp_midi_unknown_value_dec );
6323
6324                 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 );
6325                 ti = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_a_logitem );
6326
6327                 proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_a_log_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6328                 proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_a_log_notenum, tvb, offset, 1, ENC_BIG_ENDIAN );
6329
6330                 offset++;
6331                 consumed++;
6332
6333                 proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_a_log_xflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6334                 proto_tree_add_item( ti, hf_rtp_midi_cj_chapter_a_log_pressure, tvb, offset, 1, ENC_BIG_ENDIAN );
6335
6336                 offset++;
6337                 consumed++;
6338         }
6339
6340         return consumed;
6341 }
6342
6343
6344
6345
6346
6347 /*
6348  * Here a channel-journal is decoded.
6349  */
6350 static int
6351 decode_channel_journal( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset ) {
6352         proto_item                      *ti                             = NULL;
6353         proto_tree                      *rtp_midi_chanjournal_tree      = NULL;
6354         proto_tree                      *rtp_midi_cj_chapters_tree      = NULL;
6355         proto_tree                      *rtp_midi_cj_chapter_tree       = NULL;
6356         guint32                         chanflags;
6357         guint16                         chanjourlen;
6358         int                             consumed = 0;
6359         int                             ext_consumed = 0;
6360
6361         /* Can we read this channel-journals header? */
6362         if ( !tvb_bytes_exist( tvb, offset, 3 ) ) {
6363                 return -1;
6364         }
6365
6366         /* first we need to get the flags & length of this channel-journal */
6367         chanflags = tvb_get_ntoh24( tvb, offset );
6368         chanjourlen = ( chanflags & RTP_MIDI_CJ_MASK_LENGTH ) >> 8;
6369
6370         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 ) );
6371         rtp_midi_chanjournal_tree = proto_item_add_subtree( ti, ett_rtp_midi_channeljournal );
6372
6373         proto_tree_add_item( rtp_midi_chanjournal_tree, hf_rtp_midi_chanjour_sflag, tvb, offset, 3, ENC_BIG_ENDIAN );
6374         proto_tree_add_item( rtp_midi_chanjournal_tree, hf_rtp_midi_chanjour_chan, tvb, offset, 3, ENC_BIG_ENDIAN );
6375         proto_tree_add_item( rtp_midi_chanjournal_tree, hf_rtp_midi_chanjour_hflag, tvb, offset, 3, ENC_BIG_ENDIAN );
6376         proto_tree_add_item( rtp_midi_chanjournal_tree, hf_rtp_midi_chanjour_len, tvb, offset, 3, ENC_BIG_ENDIAN );
6377         proto_tree_add_item( rtp_midi_chanjournal_tree, hf_rtp_midi_chanjour_toc_p, tvb, offset, 3, ENC_BIG_ENDIAN );
6378         proto_tree_add_item( rtp_midi_chanjournal_tree, hf_rtp_midi_chanjour_toc_c, tvb, offset, 3, ENC_BIG_ENDIAN );
6379         proto_tree_add_item( rtp_midi_chanjournal_tree, hf_rtp_midi_chanjour_toc_m, tvb, offset, 3, ENC_BIG_ENDIAN );
6380         proto_tree_add_item( rtp_midi_chanjournal_tree, hf_rtp_midi_chanjour_toc_w, tvb, offset, 3, ENC_BIG_ENDIAN );
6381         proto_tree_add_item( rtp_midi_chanjournal_tree, hf_rtp_midi_chanjour_toc_n, tvb, offset, 3, ENC_BIG_ENDIAN );
6382         proto_tree_add_item( rtp_midi_chanjournal_tree, hf_rtp_midi_chanjour_toc_e, tvb, offset, 3, ENC_BIG_ENDIAN );
6383         proto_tree_add_item( rtp_midi_chanjournal_tree, hf_rtp_midi_chanjour_toc_t, tvb, offset, 3, ENC_BIG_ENDIAN );
6384         proto_tree_add_item( rtp_midi_chanjournal_tree, hf_rtp_midi_chanjour_toc_a, tvb, offset, 3, ENC_BIG_ENDIAN );
6385
6386         ti = proto_tree_add_text( rtp_midi_chanjournal_tree, tvb, offset + 3, chanjourlen - 3, RTP_MIDI_TREE_NAME_CHANNEL_CHAPTERS );
6387         rtp_midi_cj_chapters_tree = proto_item_add_subtree( ti, ett_rtp_midi_channelchapters );
6388
6389         /* take care of length of header */
6390         offset += 3;
6391         consumed += 3;
6392
6393         /* Do we have a program change chapter? */
6394         if ( chanflags & RTP_MIDI_CJ_FLAG_P ) {
6395
6396                 /* Can we read the program change chapter? */
6397                 if ( !tvb_bytes_exist( tvb, offset, 3 ) ) {
6398                         return -1;
6399                 }
6400
6401                 ti = proto_tree_add_text( rtp_midi_cj_chapters_tree, tvb, offset, 3, RTP_MIDI_TREE_NAME_CJ_CHAPTER_P );
6402                 rtp_midi_cj_chapter_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_p );
6403
6404                 proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_p_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6405                 proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_p_program, tvb, offset, 1, ENC_BIG_ENDIAN );
6406                 proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_p_bflag, tvb, offset + 1, 1, ENC_BIG_ENDIAN );
6407                 proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_p_bank_msb, tvb, offset + 1, 1, ENC_BIG_ENDIAN );
6408                 proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_p_xflag, tvb, offset + 2, 1, ENC_BIG_ENDIAN );
6409                 proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_p_bank_lsb, tvb, offset + 2, 1, ENC_BIG_ENDIAN );
6410
6411                 offset += 3;
6412                 consumed += 3;
6413         }
6414
6415         /* Do we have a control chapter? */
6416         if ( chanflags & RTP_MIDI_CJ_FLAG_C ) {
6417                 ext_consumed = decode_cj_chapter_c( tvb, pinfo, rtp_midi_cj_chapters_tree, offset );
6418                 if ( ext_consumed < 0 ) {
6419                         return ext_consumed;
6420                 }
6421                 consumed += ext_consumed;
6422                 offset += ext_consumed;
6423
6424         }
6425
6426         /* Do we have a parameter changes? */
6427         if ( chanflags & RTP_MIDI_CJ_FLAG_M ) {
6428                 ext_consumed = decode_cj_chapter_m( tvb, pinfo, rtp_midi_cj_chapters_tree, offset );
6429                 if ( ext_consumed < 0 ) {
6430                         return ext_consumed;
6431                 }
6432                 consumed += ext_consumed;
6433                 offset += ext_consumed;
6434         }
6435
6436         /* Do we have a pitch-wheel chapter? */
6437         if ( chanflags & RTP_MIDI_CJ_FLAG_W ) {
6438
6439                 /* Can we get the data for the Pitch Wheel chapter? */
6440                 if ( !tvb_bytes_exist( tvb, offset, 2 ) ) {
6441                         return -1;
6442                 }
6443
6444                 ti = proto_tree_add_text( rtp_midi_cj_chapters_tree, tvb, offset, 2, RTP_MIDI_TREE_NAME_CJ_CHAPTER_W );
6445                 rtp_midi_cj_chapter_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_w );
6446
6447                 proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_w_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6448                 proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_w_first, tvb, offset, 1, ENC_BIG_ENDIAN );
6449
6450                 offset++;
6451                 consumed++;
6452
6453                 proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_w_rflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6454                 proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_w_second, tvb, offset, 1, ENC_BIG_ENDIAN );
6455
6456                 offset++;
6457                 consumed++;
6458         }
6459
6460         /* Do we have a note on/off chapter? */
6461         if ( chanflags & RTP_MIDI_CJ_FLAG_N ) {
6462                 ext_consumed = decode_cj_chapter_n( tvb, pinfo, rtp_midi_cj_chapters_tree, offset );
6463                 if ( ext_consumed < 0 ) {
6464                         return ext_consumed;
6465                 }
6466                 consumed += ext_consumed;
6467                 offset += ext_consumed;
6468         }
6469
6470         /* Do we have a note command extras chapter? */
6471         if ( chanflags & RTP_MIDI_CJ_FLAG_E ) {
6472                 ext_consumed = decode_cj_chapter_e( tvb, pinfo, rtp_midi_cj_chapters_tree, offset );
6473                 if ( ext_consumed < 0 ) {
6474                         return ext_consumed;
6475                 }
6476                 consumed += ext_consumed;
6477                 offset += ext_consumed;
6478         }
6479
6480         /* Do we have channel aftertouch chapter? */
6481         if ( chanflags & RTP_MIDI_CJ_FLAG_T ) {
6482                 /* Can we get the data for the Pitch Wheel chapter? */
6483                 if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
6484                         return -1;
6485                 }
6486
6487                 ti = proto_tree_add_text( rtp_midi_cj_chapters_tree, tvb, offset, 1, RTP_MIDI_TREE_NAME_CJ_CHAPTER_T );
6488                 rtp_midi_cj_chapter_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_t );
6489
6490                 proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_t_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6491                 proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_t_pressure, tvb, offset, 1, ENC_BIG_ENDIAN );
6492
6493                 offset++;
6494                 consumed++;
6495         }
6496
6497         /* Do we have a poly aftertouch chapter? */
6498         if ( chanflags & RTP_MIDI_CJ_FLAG_A ) {
6499                 ext_consumed = decode_cj_chapter_a( tvb, pinfo, rtp_midi_cj_chapters_tree, offset );
6500                 if ( ext_consumed < 0 ) {
6501                         return ext_consumed;
6502                 }
6503                 consumed += ext_consumed;
6504                 offset += ext_consumed;
6505         }
6506
6507         /* Make sanity check for consumed data vs. stated length of this channels journal */
6508         if ( consumed != chanjourlen ) {
6509                 return -1;
6510         }
6511         return consumed;
6512 }
6513
6514
6515 /*
6516  * Here the chapter D F4-field of the system-journal is decoded.
6517  */
6518 static int
6519 decode_sj_chapter_d_f4( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset ) {
6520
6521         proto_item      *ti                     = NULL;
6522         proto_tree      *rtp_midi_field_tree    = NULL;
6523         int              consumed               = 0;
6524         guint16          f4flags;
6525         guint16          f4length;
6526
6527         /* Can we read this fields header? */
6528         if ( !tvb_bytes_exist( tvb, offset, 2 ) ) {
6529                 return -1;
6530         }
6531
6532         /* Get flags & length */
6533         f4flags = tvb_get_ntohs( tvb, offset );
6534         f4length = f4flags & RTP_MIDI_SJ_CHAPTER_D_SYSCOM_MASK_LENGTH;
6535
6536         /* now we can display our tree, as we now have the full length */
6537         ti = proto_tree_add_text( tree, tvb, offset, f4length, RTP_MIDI_TREE_NAME_SJ_CHAPTER_D_FIELD_J );
6538         rtp_midi_field_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_d_field_j );
6539
6540         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_sflag, tvb, offset, 2, ENC_BIG_ENDIAN );
6541         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_cflag, tvb, offset, 2, ENC_BIG_ENDIAN );
6542         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_vflag, tvb, offset, 2, ENC_BIG_ENDIAN );
6543         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_lflag, tvb, offset, 2, ENC_BIG_ENDIAN );
6544         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_dsz, tvb, offset, 2, ENC_BIG_ENDIAN );
6545         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_length, tvb, offset, 2, ENC_BIG_ENDIAN );
6546
6547         offset += 2;
6548         consumed += 2;
6549         f4length -= 2;
6550
6551         if ( f4flags & RTP_MIDI_SJ_CHAPTER_D_SYSCOM_FLAG_C ) {
6552
6553                 if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
6554                         return -1;
6555                 }
6556
6557                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_count, tvb, offset, 1, ENC_BIG_ENDIAN );
6558
6559                 offset++;
6560                 consumed++;
6561                 f4length--;
6562         }
6563
6564         if ( f4flags & RTP_MIDI_SJ_CHAPTER_D_SYSCOM_FLAG_V ) {
6565
6566                 int valuelen = 0;
6567                 guint8 octet;
6568
6569                 /* variable length field - ends with an octet with MSB set */
6570                 for (;;) {
6571                         if ( !tvb_bytes_exist( tvb, offset+valuelen, 1 ) ) {
6572                                 return -1;
6573                         }
6574                         octet = tvb_get_guint8( tvb, offset+valuelen );
6575                         valuelen++;
6576                         if ( octet & 0x80 ) {
6577                                 break;
6578                         }
6579                 }
6580                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_value, tvb, offset, valuelen, ENC_NA );
6581                 offset+=valuelen;
6582                 f4length-=valuelen;
6583         }
6584
6585         if ( f4flags & RTP_MIDI_SJ_CHAPTER_D_SYSCOM_FLAG_L ) {
6586
6587                 if ( !tvb_bytes_exist( tvb, offset, f4length ) ) {
6588                         return -1;
6589                 }
6590
6591                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_legal, tvb, offset, f4length, ENC_NA );
6592                 offset+=f4length;
6593                 f4length-=f4length;
6594         }
6595
6596         /* if we still have data, the length-field was incorrect we dump the data here and abort! */
6597         if ( f4length > 0 ) {
6598
6599                 if ( !tvb_bytes_exist( tvb, offset, f4length ) ) {
6600                         return -1;
6601                 }
6602
6603                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_data, tvb, offset, f4length, ENC_NA );
6604
6605                 offset += f4length;
6606                 consumed += f4length;
6607                 /* must be a protocol error - since we have a length, we can recover...*/
6608         }
6609
6610
6611         return consumed;
6612 }
6613
6614
6615 /*
6616  * Here the chapter D F5-field of the system-journal is decoded.
6617  */
6618 static int
6619 decode_sj_chapter_d_f5( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset ) {
6620
6621         proto_item      *ti                     = NULL;
6622         proto_tree      *rtp_midi_field_tree    = NULL;
6623         int              consumed               = 0;
6624         guint16          f5flags;
6625         guint16          f5length;
6626
6627         /* Can we read this fields header? */
6628         if ( !tvb_bytes_exist( tvb, offset, 2 ) ) {
6629                 return -1;
6630         }
6631
6632         /* Get flags & length */
6633         f5flags = tvb_get_ntohs( tvb, offset );
6634         f5length = f5flags & RTP_MIDI_SJ_CHAPTER_D_SYSCOM_MASK_LENGTH;
6635
6636         /* now we can display our tree, as we now have the full length */
6637         ti = proto_tree_add_text( tree, tvb, offset, f5length, RTP_MIDI_TREE_NAME_SJ_CHAPTER_D_FIELD_K );
6638         rtp_midi_field_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_d_field_k );
6639
6640         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_sflag, tvb, offset, 2, ENC_BIG_ENDIAN );
6641         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_cflag, tvb, offset, 2, ENC_BIG_ENDIAN );
6642         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_vflag, tvb, offset, 2, ENC_BIG_ENDIAN );
6643         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_lflag, tvb, offset, 2, ENC_BIG_ENDIAN );
6644         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_dsz, tvb, offset, 2, ENC_BIG_ENDIAN );
6645         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_length, tvb, offset, 2, ENC_BIG_ENDIAN );
6646
6647         offset += 2;
6648         consumed += 2;
6649         f5length -= 2;
6650
6651         if ( f5flags & RTP_MIDI_SJ_CHAPTER_D_SYSCOM_FLAG_C ) {
6652
6653                 if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
6654                         return -1;
6655                 }
6656
6657                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_count, tvb, offset, 1, ENC_BIG_ENDIAN );
6658
6659                 offset++;
6660                 consumed++;
6661                 f5length--;
6662         }
6663
6664         if ( f5flags & RTP_MIDI_SJ_CHAPTER_D_SYSCOM_FLAG_V ) {
6665
6666                 int valuelen = 0;
6667                 guint8 octet;
6668
6669                 /* variable length field - ends with an octet with MSB set */
6670                 for (;;) {
6671                         if ( !tvb_bytes_exist( tvb, offset+valuelen, 1 ) ) {
6672                                 return -1;
6673                         }
6674                         octet = tvb_get_guint8( tvb, offset+valuelen );
6675                         valuelen++;
6676                         if ( octet & 0x80 ) {
6677                                 break;
6678                         }
6679                 }
6680                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_value, tvb, offset, valuelen, ENC_NA );
6681                 offset+=valuelen;
6682                 f5length-=valuelen;
6683         }
6684
6685         if ( f5flags & RTP_MIDI_SJ_CHAPTER_D_SYSCOM_FLAG_L ) {
6686
6687                 if ( !tvb_bytes_exist( tvb, offset, f5length ) ) {
6688                         return -1;
6689                 }
6690
6691                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_legal, tvb, offset, f5length, ENC_NA );
6692                 offset+=f5length;
6693                 f5length-=f5length;
6694         }
6695
6696         /* if we still have data, we dump it here - see above! */
6697         if ( f5length > 0 ) {
6698
6699                 if ( !tvb_bytes_exist( tvb, offset, f5length ) ) {
6700                         return -1;
6701                 }
6702
6703                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_data, tvb, offset, f5length, ENC_NA );
6704
6705                 offset += f5length;
6706                 consumed += f5length;
6707                 /* must be a protocol error - since we have a length, we can recover...*/
6708         }
6709
6710         return consumed;
6711 }
6712
6713 /*
6714  * Here the chapter D F9-field of the system-journal is decoded.
6715  */
6716 static int
6717 decode_sj_chapter_d_f9( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset ) {
6718
6719         proto_item      *ti                     = NULL;
6720         proto_tree      *rtp_midi_field_tree    = NULL;
6721         int              consumed               = 0;
6722         guint8           f9flags;
6723         guint8           f9length;
6724
6725         /* Can we read this fields header? */
6726         if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
6727                 return -1;
6728         }
6729
6730         /* Get flags & length */
6731         f9flags = tvb_get_guint8( tvb, offset );
6732         f9length = f9flags & RTP_MIDI_SJ_CHAPTER_D_SYSREAL_MASK_LENGTH;
6733
6734         /* now we can display our tree, as we now have the full length */
6735         ti = proto_tree_add_text( tree, tvb, offset, f9length, RTP_MIDI_TREE_NAME_SJ_CHAPTER_D_FIELD_Y );
6736         rtp_midi_field_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_d_field_y );
6737
6738         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6739         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_cflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6740         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_lflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6741         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_length, tvb, offset, 1, ENC_BIG_ENDIAN );
6742
6743         offset++;
6744         consumed++;
6745         f9length--;
6746
6747         if ( f9flags & RTP_MIDI_SJ_CHAPTER_D_SYSREAL_FLAG_C ) {
6748
6749                 if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
6750                         return -1;
6751                 }
6752
6753                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_count, tvb, offset, 1, ENC_BIG_ENDIAN );
6754
6755                 offset++;
6756                 consumed++;
6757                 f9length--;
6758         }
6759
6760         if ( f9flags & RTP_MIDI_SJ_CHAPTER_D_SYSREAL_FLAG_L ) {
6761
6762                 if ( !tvb_bytes_exist( tvb, offset, f9length ) ) {
6763                         return -1;
6764                 }
6765
6766                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_legal, tvb, offset, f9length, ENC_NA );
6767                 offset+=f9length;
6768                 f9length-=f9length;
6769         }
6770
6771         /* if we still have data, the length-field was incorrect we dump the data here and abort! */
6772
6773         if ( f9length > 0 ) {
6774
6775                 if ( !tvb_bytes_exist( tvb, offset, f9length ) ) {
6776                         return -1;
6777                 }
6778
6779                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_data, tvb, offset, f9length, ENC_NA );
6780
6781                 offset += f9length;
6782                 consumed += f9length;
6783                 /* must be a protocol error - since we have a length, we can recover...*/
6784         }
6785
6786         return consumed;
6787 }
6788
6789
6790 /*
6791  * Here the chapter D FD-field of the system-journal is decoded.
6792  */
6793 static int
6794 decode_sj_chapter_d_fd( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset ) {
6795
6796         proto_item      *ti                     = NULL;
6797         proto_tree      *rtp_midi_field_tree    = NULL;
6798         int              consumed               = 0;
6799         guint8           fdflags;
6800         guint8           fdlength;
6801
6802         /* Can we read this fields header? */
6803         if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
6804                 return -1;
6805         }
6806
6807         /* Get flags & length */
6808         fdflags = tvb_get_guint8( tvb, offset );
6809         fdlength = fdflags & RTP_MIDI_SJ_CHAPTER_D_SYSREAL_MASK_LENGTH;
6810
6811         /* now we can display our tree, as we now have the full length */
6812         ti = proto_tree_add_text( tree, tvb, offset, fdlength, RTP_MIDI_TREE_NAME_SJ_CHAPTER_D_FIELD_Z );
6813         rtp_midi_field_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_d_field_z );
6814
6815         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6816         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_cflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6817         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_lflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6818         proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_length, tvb, offset, 1, ENC_BIG_ENDIAN );
6819
6820         offset++;
6821         consumed++;
6822         fdlength--;
6823
6824         if ( fdflags & RTP_MIDI_SJ_CHAPTER_D_SYSREAL_FLAG_C ) {
6825
6826                 if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
6827                         return -1;
6828                 }
6829
6830                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_count, tvb, offset, 1, ENC_BIG_ENDIAN );
6831
6832                 offset++;
6833                 consumed++;
6834                 fdlength--;
6835         }
6836
6837         if ( fdflags & RTP_MIDI_SJ_CHAPTER_D_SYSREAL_FLAG_L ) {
6838
6839                 if ( !tvb_bytes_exist( tvb, offset, fdlength ) ) {
6840                         return -1;
6841                 }
6842
6843                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_legal, tvb, offset, fdlength, ENC_NA );
6844                 offset+=fdlength;
6845                 fdlength-=fdlength;
6846         }
6847
6848         /* if we still have data, the length-field was incorrect we dump the data here and abort! */
6849
6850         if ( fdlength > 0 ) {
6851
6852                 if ( !tvb_bytes_exist( tvb, offset, fdlength ) ) {
6853                         return -1;
6854                 }
6855
6856                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_data, tvb, offset, fdlength, ENC_NA );
6857
6858                 offset += fdlength;
6859                 consumed += fdlength;
6860                 /* must be a protocol error - since we have a length, we can recover...*/
6861         }
6862
6863         return consumed;
6864 }
6865
6866
6867
6868 /*
6869  * Here the chapter D of the channel-journal is decoded.
6870  */
6871 static int
6872 decode_sj_chapter_d( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset ) {
6873         proto_item                      *ti                             = NULL;
6874         proto_item                      *tix                            = NULL;
6875         proto_tree                      *rtp_midi_sj_chapter_tree       = NULL;
6876         proto_tree                      *rtp_midi_field_tree            = NULL;
6877         guint8                          header;
6878         int                             consumed = 0;
6879         int                             ext_consumed;
6880
6881         /* Can we read this channel-journals header? */
6882         if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
6883                 return -1;
6884         }
6885
6886         /* first we need to get the flags of this chapter */
6887         header = tvb_get_guint8( tvb, offset );
6888
6889         /*
6890          * we don't know the complete length yet - we now that we have at least the header -> 1.
6891          * At the end we set the real length...
6892          */
6893         tix = proto_tree_add_text( tree, tvb, offset, 1, RTP_MIDI_TREE_NAME_SJ_CHAPTER_D );
6894         rtp_midi_sj_chapter_tree = proto_item_add_subtree( tix, ett_rtp_midi_sj_chapter_d );
6895
6896         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_d_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6897         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_d_bflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6898         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_d_gflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6899         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_d_hflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6900         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_d_jflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6901         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_d_kflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6902         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_d_yflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6903         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_d_zflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6904
6905         /* done with header */
6906         consumed++;
6907         offset++;
6908
6909         /* do we have Reset field? */
6910         if ( header & RTP_MIDI_SJ_CHAPTER_D_FLAG_B ) {
6911                 /* Can we get the data for the Reset chapter? */
6912                 if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
6913                         return -1;
6914                 }
6915
6916                 ti = proto_tree_add_text( rtp_midi_sj_chapter_tree, tvb, offset, 1, RTP_MIDI_TREE_NAME_SJ_CHAPTER_D_FIELD_B );
6917                 rtp_midi_field_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_d_field_b );
6918
6919                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_reset_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6920                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_reset_count, tvb, offset, 1, ENC_BIG_ENDIAN );
6921
6922                 offset++;
6923                 consumed++;
6924         }
6925
6926         /* do we have Tune request field? */
6927         if ( header & RTP_MIDI_SJ_CHAPTER_D_FLAG_G ) {
6928                 /* Can we get the data for the Reset chapter? */
6929                 if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
6930                         return -1;
6931                 }
6932
6933                 ti = proto_tree_add_text( rtp_midi_sj_chapter_tree, tvb, offset, 1, RTP_MIDI_TREE_NAME_SJ_CHAPTER_D_FIELD_G );
6934                 rtp_midi_field_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_d_field_g );
6935
6936                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_tune_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6937                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_tune_count, tvb, offset, 1, ENC_BIG_ENDIAN );
6938
6939                 offset++;
6940                 consumed++;
6941         }
6942
6943         /* do we have Song select field? */
6944         if ( header & RTP_MIDI_SJ_CHAPTER_D_FLAG_H ) {
6945                 /* Can we get the data for the Reset chapter? */
6946                 if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
6947                         return -1;
6948                 }
6949
6950                 ti = proto_tree_add_text( rtp_midi_sj_chapter_tree, tvb, offset, 1, RTP_MIDI_TREE_NAME_SJ_CHAPTER_D_FIELD_H );
6951                 rtp_midi_field_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_d_field_h );
6952
6953                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_song_sel_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
6954                 proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_song_sel_value, tvb, offset, 1, ENC_BIG_ENDIAN );
6955
6956                 offset++;
6957                 consumed++;
6958         }
6959
6960         /* do we have 0xF4 field? */
6961         if ( header & RTP_MIDI_SJ_CHAPTER_D_FLAG_J ) {
6962                 ext_consumed = decode_sj_chapter_d_f4( tvb, pinfo, rtp_midi_sj_chapter_tree, offset );
6963                 if ( ext_consumed < 0 ) {
6964                         return ext_consumed;
6965                 }
6966                 consumed += ext_consumed;
6967                 offset += ext_consumed;
6968         }
6969
6970         /* do we have 0xF5 field? */
6971         if ( header & RTP_MIDI_SJ_CHAPTER_D_FLAG_K ) {
6972                 ext_consumed = decode_sj_chapter_d_f5( tvb, pinfo, rtp_midi_sj_chapter_tree, offset );
6973                 if ( ext_consumed < 0 ) {
6974                         return ext_consumed;
6975                 }
6976                 consumed += ext_consumed;
6977                 offset += ext_consumed;
6978         }
6979
6980         /* do we have 0xF9 field? */
6981         if ( header & RTP_MIDI_SJ_CHAPTER_D_FLAG_Y ) {
6982                 ext_consumed = decode_sj_chapter_d_f9( tvb, pinfo, rtp_midi_sj_chapter_tree, offset );
6983                 if ( ext_consumed < 0 ) {
6984                         return ext_consumed;
6985                 }
6986                 consumed += ext_consumed;
6987                 offset += ext_consumed;
6988         }
6989
6990         /* do we have 0xFD field? */
6991         if ( header & RTP_MIDI_SJ_CHAPTER_D_FLAG_Z ) {
6992                 ext_consumed = decode_sj_chapter_d_fd( tvb, pinfo, rtp_midi_sj_chapter_tree, offset );
6993                 if ( ext_consumed < 0 ) {
6994                         return ext_consumed;
6995                 }
6996                 consumed += ext_consumed;
6997                 offset += ext_consumed;
6998         }
6999
7000
7001         /* now we know the complete length and set it. */
7002         proto_item_set_len( tix, consumed );
7003         return consumed;
7004 }
7005
7006 /*
7007  * Here the chapter Q of the channel-journal is decoded.
7008  */
7009 static int
7010 decode_sj_chapter_q( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset ) {
7011         proto_item                      *ti                             = NULL;
7012         proto_tree                      *rtp_midi_sj_chapter_tree       = NULL;
7013         guint8                          header;
7014         int                             consumed = 0;
7015         int                             len = 1;
7016
7017         /* Can we read this chapters header? */
7018         if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
7019                 return -1;
7020         }
7021
7022         /* first we need to get the flags of this chapter */
7023         header = tvb_get_guint8( tvb, offset );
7024
7025         if ( header & RTP_MIDI_SJ_CHAPTER_Q_FLAG_C ) {
7026                 len += 2;
7027         }
7028         if ( header & RTP_MIDI_SJ_CHAPTER_Q_FLAG_T ) {
7029                 len += 3;
7030         }
7031
7032         /* now we have the length... */
7033         ti = proto_tree_add_text( tree, tvb, offset, len, RTP_MIDI_TREE_NAME_SJ_CHAPTER_Q );
7034         rtp_midi_sj_chapter_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_q );
7035
7036         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_q_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7037         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_q_nflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7038         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_q_dflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7039         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_q_cflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7040         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_q_tflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7041
7042         if ( header & RTP_MIDI_SJ_CHAPTER_Q_FLAG_C ) {
7043
7044                 if ( !tvb_bytes_exist( tvb, offset, 3 ) ) {
7045                         return -1;
7046                 }
7047
7048                 proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_q_clock, tvb, offset, 3, ENC_BIG_ENDIAN );
7049
7050                 consumed += 3;
7051                 offset += 3;
7052
7053         } else {
7054                 proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_q_top, tvb, offset, 1, ENC_BIG_ENDIAN );
7055
7056                 consumed++;
7057                 offset++;
7058         }
7059
7060         if ( header & RTP_MIDI_SJ_CHAPTER_Q_FLAG_T ) {
7061                 if ( !tvb_bytes_exist( tvb, offset, 3 ) ) {
7062                         return -1;
7063                 }
7064
7065                 proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_q_timetools, tvb, offset, 3, ENC_BIG_ENDIAN );
7066
7067                 consumed += 3;
7068                 offset += 3;
7069         }
7070
7071         return consumed;
7072 }
7073
7074 /*
7075  * Here the chapter F of the channel-journal is decoded.
7076  */
7077 static int
7078 decode_sj_chapter_f( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset ) {
7079         proto_item                      *ti                             = NULL;
7080         proto_tree                      *rtp_midi_sj_chapter_tree       = NULL;
7081         proto_tree                      *rtp_midi_sj_field_tree         = NULL;
7082         guint8                          header;
7083         int                             consumed = 0;
7084         int                             len = 1;
7085
7086         /* Can we read this chapters header? */
7087         if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
7088                 return -1;
7089         }
7090
7091         /* first we need to get the flags of this chapter */
7092         header = tvb_get_guint8( tvb, offset );
7093
7094         if ( header & RTP_MIDI_SJ_CHAPTER_F_FLAG_C ) {
7095                 len += 4;
7096         }
7097         if ( header & RTP_MIDI_SJ_CHAPTER_F_FLAG_P ) {
7098                 len += 4;
7099         }
7100
7101         /* now we have the length... */
7102         ti = proto_tree_add_text( tree, tvb, offset, len, RTP_MIDI_TREE_NAME_SJ_CHAPTER_F );
7103         rtp_midi_sj_chapter_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_f );
7104
7105         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_f_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7106         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_f_cflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7107         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_f_pflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7108         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_f_qflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7109         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_f_dflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7110         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_f_point, tvb, offset, 1, ENC_BIG_ENDIAN );
7111
7112         consumed++;
7113         offset++;
7114
7115         if ( header & RTP_MIDI_SJ_CHAPTER_F_FLAG_C ) {
7116                 if ( !tvb_bytes_exist( tvb, offset, 4 ) ) {
7117                         return -1;
7118                 }
7119
7120                 ti = proto_tree_add_text( rtp_midi_sj_chapter_tree, tvb, offset, 4, RTP_MIDI_TREE_NAME_SJ_CHAPTER_F_COMPLETE );
7121                 rtp_midi_sj_field_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_f_complete );
7122
7123                 if ( header & RTP_MIDI_SJ_CHAPTER_F_FLAG_Q ) {
7124                         proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_mt0, tvb, offset, 4, ENC_BIG_ENDIAN );
7125                         proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_mt1, tvb, offset, 4, ENC_BIG_ENDIAN );
7126                         proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_mt2, tvb, offset, 4, ENC_BIG_ENDIAN );
7127                         proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_mt3, tvb, offset, 4, ENC_BIG_ENDIAN );
7128                         proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_mt4, tvb, offset, 4, ENC_BIG_ENDIAN );
7129                         proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_mt5, tvb, offset, 4, ENC_BIG_ENDIAN );
7130                         proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_mt6, tvb, offset, 4, ENC_BIG_ENDIAN );
7131                         proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_mt7, tvb, offset, 4, ENC_BIG_ENDIAN );
7132
7133                 } else {
7134                         proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_hr, tvb, offset, 4, ENC_BIG_ENDIAN );
7135                         proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_mn, tvb, offset, 4, ENC_BIG_ENDIAN );
7136                         proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_sc, tvb, offset, 4, ENC_BIG_ENDIAN );
7137                         proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_fr, tvb, offset, 4, ENC_BIG_ENDIAN );
7138                 }
7139
7140                 consumed += 4;
7141                 offset += 4;
7142         }
7143
7144         if ( header & RTP_MIDI_SJ_CHAPTER_F_FLAG_P ) {
7145                 if ( !tvb_bytes_exist( tvb, offset, 4 ) ) {
7146                         return -1;
7147                 }
7148
7149                 ti = proto_tree_add_text( rtp_midi_sj_chapter_tree, tvb, offset, 4, RTP_MIDI_TREE_NAME_SJ_CHAPTER_F_PARTIAL );
7150                 rtp_midi_sj_field_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_f_partial );
7151
7152                 proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_mt0, tvb, offset, 4, ENC_BIG_ENDIAN );
7153                 proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_mt1, tvb, offset, 4, ENC_BIG_ENDIAN );
7154                 proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_mt2, tvb, offset, 4, ENC_BIG_ENDIAN );
7155                 proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_mt3, tvb, offset, 4, ENC_BIG_ENDIAN );
7156                 proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_mt4, tvb, offset, 4, ENC_BIG_ENDIAN );
7157                 proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_mt5, tvb, offset, 4, ENC_BIG_ENDIAN );
7158                 proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_mt6, tvb, offset, 4, ENC_BIG_ENDIAN );
7159                 proto_tree_add_item( rtp_midi_sj_field_tree, hf_rtp_midi_sj_chapter_f_mt7, tvb, offset, 4, ENC_BIG_ENDIAN );
7160
7161                 consumed += 4;
7162                 offset += 4;
7163         }
7164
7165         return consumed;
7166 }
7167
7168 /*
7169  * Here the chapter X of the channel-journal is decoded.
7170  */
7171 static int
7172 decode_sj_chapter_x( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int max_length ) {
7173         proto_item                      *ti                             = NULL;
7174         proto_tree                      *rtp_midi_sj_chapter_tree       = NULL;
7175         proto_tree                      *rtp_midi_sj_data_tree          = NULL;
7176         guint8                          header;
7177         guint8                          octet;
7178         unsigned int                    consumed = 0;
7179         unsigned long                   field = 0;
7180         unsigned long                   fieldlen = 0;
7181         unsigned long                   cmdlen = 0;
7182         unsigned int                    i;
7183
7184         /* Can we read this chapters header? */
7185         if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
7186                 return -1;
7187         }
7188
7189         /* first we need to get the flags of this chapter */
7190         header = tvb_get_guint8( tvb, offset );
7191
7192         ti = proto_tree_add_text( tree, tvb, offset, max_length, RTP_MIDI_TREE_NAME_SJ_CHAPTER_X );
7193         rtp_midi_sj_chapter_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_x );
7194
7195         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_x_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7196         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_x_tflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7197         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_x_cflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7198         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_x_fflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7199         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_x_dflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7200         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_x_lflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7201         proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_x_sta, tvb, offset, 1, ENC_BIG_ENDIAN );
7202
7203         consumed++;
7204         offset++;
7205
7206         if ( header & RTP_MIDI_SJ_CHAPTER_X_FLAG_T ) {
7207
7208                 if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
7209                         return -1;
7210                 }
7211
7212                 proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_x_tcount, tvb, offset, 1, ENC_BIG_ENDIAN );
7213
7214                 consumed++;
7215                 offset++;
7216         }
7217
7218         if ( header & RTP_MIDI_SJ_CHAPTER_X_FLAG_C ) {
7219
7220                 if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
7221                         return -1;
7222                 }
7223
7224                 proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_x_count, tvb, offset, 1, ENC_BIG_ENDIAN );
7225
7226                 consumed++;
7227                 offset++;
7228         }
7229
7230         if ( header & RTP_MIDI_SJ_CHAPTER_X_FLAG_F ) {
7231
7232                 /* FIRST is "compressed" using only the necessary amount of octets, like delta-time */
7233                 for ( i=0; i < 4; i++ ) {
7234
7235                         /* do we still fit in the dissected packet & in the length restriction of this chapter? */
7236                         if ( ( !( consumed >= max_length ) ) || ( !tvb_bytes_exist( tvb, offset + fieldlen, 1 ) ) ) {
7237                                 return -1;
7238                         }
7239
7240                         octet = tvb_get_guint8( tvb, offset + fieldlen );
7241                         field = ( field << 7 ) | ( octet & RTP_MIDI_DELTA_TIME_OCTET_MASK );
7242                         fieldlen++;
7243
7244                         if ( ( octet & RTP_MIDI_DELTA_TIME_EXTENSION ) == 0 ) {
7245                                 break;
7246                         }
7247                 }
7248
7249                 switch (fieldlen) {
7250                         case 1:
7251                             proto_tree_add_uint ( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_x_first1, tvb, offset, fieldlen, field );
7252                                 break;
7253                         case 2:
7254                             proto_tree_add_uint ( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_x_first2, tvb, offset, fieldlen, field );
7255                                 break;
7256                         case 3:
7257                             proto_tree_add_uint ( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_x_first3, tvb, offset, fieldlen, field );
7258                                 break;
7259                         case 4:
7260                             proto_tree_add_uint ( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_x_first4, tvb, offset, fieldlen, field );
7261                                 break;
7262
7263                 }
7264                 consumed+=fieldlen;
7265                 offset+=fieldlen;
7266
7267         }
7268
7269         if ( header & RTP_MIDI_SJ_CHAPTER_X_FLAG_D ) {
7270                 ti = proto_tree_add_text( rtp_midi_sj_chapter_tree, tvb, offset,  max_length - consumed, RTP_MIDI_TREE_NAME_SJ_CHAPTER_X_DATA );
7271                 rtp_midi_sj_data_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_x_data );
7272                 while ( consumed < max_length ) {
7273                         octet = tvb_get_guint8( tvb, offset + cmdlen );
7274                         if ( octet & 0x80 ) {
7275                                 proto_tree_add_item( rtp_midi_sj_data_tree, hf_rtp_midi_sj_chapter_x_data, tvb, offset, cmdlen, ENC_NA );
7276                                 offset += cmdlen;
7277                                 cmdlen = 0;
7278                         }
7279                         consumed +=1;
7280                 }
7281                 /* unfinished command still to put into tree */
7282                 if ( cmdlen ) {
7283                         proto_tree_add_item( rtp_midi_sj_data_tree, hf_rtp_midi_sj_chapter_x_invalid_data, tvb, offset, cmdlen, ENC_NA );
7284                         offset += cmdlen;
7285                 }
7286         }
7287
7288         /* this should not ever enter - we still have data, but flag d was apparently not set...  */
7289         if ( consumed < max_length ) {
7290
7291                 ti = proto_tree_add_text( rtp_midi_sj_chapter_tree, tvb, offset,  max_length - consumed, RTP_MIDI_TREE_NAME_SJ_CHAPTER_X_INVALID_DATA );
7292                 rtp_midi_sj_data_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_x_data );
7293
7294                 proto_tree_add_item( rtp_midi_sj_data_tree, hf_rtp_midi_sj_chapter_x_invalid_data, tvb, offset, max_length - consumed, ENC_NA );
7295
7296                 consumed = max_length;
7297
7298         }
7299
7300         return consumed;
7301 }
7302
7303
7304
7305 /*
7306  * Here the system-journal is decoded.
7307  */
7308 static int
7309 decode_system_journal( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset ) {
7310         proto_item                      *ti                             = NULL;
7311         proto_tree                      *rtp_midi_sysjournal_tree       = NULL;
7312         proto_tree                      *rtp_midi_sj_chapters_tree      = NULL;
7313         proto_tree                      *rtp_midi_sj_chapter_tree       = NULL;
7314         int                             consumed = 0;
7315         int                             ext_consumed = 0;
7316         guint16                         sysjourlen;
7317         guint16                         systemflags;
7318
7319
7320
7321         /* Can we read this channel-journals header? */
7322         if ( !tvb_bytes_exist( tvb, offset, 2 ) ) {
7323                 return -1;
7324         }
7325
7326         systemflags = tvb_get_ntohs( tvb, offset );
7327         sysjourlen = systemflags & RTP_MIDI_SJ_MASK_LENGTH;
7328
7329         ti = proto_tree_add_text( tree, tvb, offset, sysjourlen, RTP_MIDI_TREE_NAME_SYSTEM_JOURNAL );
7330         rtp_midi_sysjournal_tree = proto_item_add_subtree( ti, ett_rtp_midi_systemjournal );
7331
7332         proto_tree_add_item( rtp_midi_sysjournal_tree, hf_rtp_midi_sysjour_toc_s, tvb, offset, 2, ENC_BIG_ENDIAN );
7333         proto_tree_add_item( rtp_midi_sysjournal_tree, hf_rtp_midi_sysjour_toc_d, tvb, offset, 2, ENC_BIG_ENDIAN );
7334         proto_tree_add_item( rtp_midi_sysjournal_tree, hf_rtp_midi_sysjour_toc_v, tvb, offset, 2, ENC_BIG_ENDIAN );
7335         proto_tree_add_item( rtp_midi_sysjournal_tree, hf_rtp_midi_sysjour_toc_q, tvb, offset, 2, ENC_BIG_ENDIAN );
7336         proto_tree_add_item( rtp_midi_sysjournal_tree, hf_rtp_midi_sysjour_toc_f, tvb, offset, 2, ENC_BIG_ENDIAN );
7337         proto_tree_add_item( rtp_midi_sysjournal_tree, hf_rtp_midi_sysjour_toc_x, tvb, offset, 2, ENC_BIG_ENDIAN );
7338         proto_tree_add_item( rtp_midi_sysjournal_tree, hf_rtp_midi_sysjour_len, tvb, offset, 2, ENC_BIG_ENDIAN );
7339
7340         offset += 2;
7341         consumed += 2;
7342
7343         ti = proto_tree_add_text( rtp_midi_sysjournal_tree, tvb, offset, sysjourlen - 2, RTP_MIDI_TREE_NAME_SYSTEM_CHAPTERS );
7344         rtp_midi_sj_chapters_tree = proto_item_add_subtree( ti, ett_rtp_midi_systemchapters );
7345
7346         /* Do we have a simple system commands chapter? */
7347         if ( systemflags & RTP_MIDI_SJ_FLAG_D ) {
7348                 ext_consumed = decode_sj_chapter_d( tvb, pinfo, rtp_midi_sj_chapters_tree, offset );
7349                 if ( ext_consumed < 0 ) {
7350                         return ext_consumed;
7351                 }
7352                 consumed += ext_consumed;
7353                 offset += ext_consumed;
7354         }
7355
7356         /* Do we have a active sensing chapter? */
7357         if ( systemflags & RTP_MIDI_SJ_FLAG_V ) {
7358                 /* Can we get the data for the Active Sense chapter? */
7359                 if ( !tvb_bytes_exist( tvb, offset, 1 ) ) {
7360                         return -1;
7361                 }
7362
7363                 ti = proto_tree_add_text( rtp_midi_sj_chapters_tree, tvb, offset, 1, RTP_MIDI_TREE_NAME_SJ_CHAPTER_V );
7364                 rtp_midi_sj_chapter_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_v );
7365
7366                 proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_v_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7367                 proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_v_count, tvb, offset, 1, ENC_BIG_ENDIAN );
7368
7369                 offset++;
7370                 consumed++;
7371         }
7372
7373         /* Do we have a sequencer state commands chapter? */
7374         if ( systemflags & RTP_MIDI_SJ_FLAG_Q ) {
7375                 ext_consumed = decode_sj_chapter_q( tvb, pinfo, rtp_midi_sj_chapters_tree, offset );
7376                 if ( ext_consumed < 0 ) {
7377                         return ext_consumed;
7378                 }
7379                 consumed += ext_consumed;
7380                 offset += ext_consumed;
7381         }
7382
7383         /* Do we have a MTC chapter? */
7384         if ( systemflags & RTP_MIDI_SJ_FLAG_F ) {
7385                 ext_consumed = decode_sj_chapter_f( tvb, pinfo, rtp_midi_sj_chapters_tree, offset );
7386                 if ( ext_consumed < 0 ) {
7387                         return ext_consumed;
7388                 }
7389                 consumed += ext_consumed;
7390                 offset += ext_consumed;
7391         }
7392
7393
7394         /* Make sanity check for consumed data vs. stated length of system journal */
7395         if ( consumed <= sysjourlen ) {
7396                 return -1;
7397         }
7398
7399         /* Do we have a Sysex chapter? */
7400         if ( systemflags & RTP_MIDI_SJ_FLAG_X ) {
7401                 ext_consumed = decode_sj_chapter_x( tvb, pinfo, rtp_midi_sj_chapters_tree, offset, sysjourlen - consumed );
7402                 if ( ext_consumed < 0 ) {
7403                         return ext_consumed;
7404                 }
7405                 consumed += ext_consumed;
7406                 offset += ext_consumed;
7407         }
7408
7409
7410         /* Make sanity check for consumed data vs. stated length of system journal */
7411         if ( consumed != sysjourlen ) {
7412                 return -1;
7413         }
7414         return consumed;
7415 }
7416
7417
7418
7419
7420
7421
7422 /*
7423  * This is the main dissector function for the RTP-MIDI protocol
7424  * It decodes the wrapper of the command-section and punts
7425  * decoding of delta-time and the actual MIDI-command itself to
7426  * external decoders.  Afterwards the journal-section is decoded.
7427  */
7428
7429 static void
7430 dissect_rtp_midi( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree )
7431 {
7432         proto_item                      *ti                             = NULL;
7433         proto_item                      *command_item                   = NULL;
7434         proto_item                      *journal_item                   = NULL;
7435         proto_tree                      *rtp_midi_tree                  = NULL;
7436         proto_tree                      *rtp_midi_commands_tree         = NULL;
7437         proto_tree                      *rtp_midi_journal_tree          = NULL;
7438         proto_tree                      *rtp_midi_chanjournals_tree     = NULL;
7439         unsigned int                     offset                         = 0;
7440         struct _rtp_conversation_info   *p_conv_data                    = NULL;
7441
7442         guint8                          flags;                          /* used for command-section and journal-section*/
7443         guint8                          octet;
7444         unsigned int                    cmd_len;
7445         unsigned int                    cmd_count;
7446         guint8                          runningstatus;
7447
7448         unsigned int                    consumed;
7449         unsigned int                    rsoffset;
7450
7451         guint8                          totchan;
7452
7453         unsigned int                    i;
7454
7455         col_set_str( pinfo->cinfo, COL_PROTOCOL, RTP_MIDI_DISSECTOR_SHORTNAME );
7456         col_clear( pinfo->cinfo, COL_INFO );
7457
7458         /*
7459          * MIDI command section
7460          */
7461
7462         /* RTP-MIDI starts with 4 bits of flags... */
7463         flags = tvb_get_guint8( tvb, offset );
7464
7465         ti = proto_tree_add_item( tree, proto_rtp_midi, tvb, 0, -1, ENC_NA );
7466         rtp_midi_tree = proto_item_add_subtree( ti, ett_rtp_midi);
7467
7468         /* Decode those four flags */
7469         proto_tree_add_item( rtp_midi_tree, hf_rtp_midi_bflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7470         proto_tree_add_item( rtp_midi_tree, hf_rtp_midi_jflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7471         proto_tree_add_item( rtp_midi_tree, hf_rtp_midi_zflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7472         proto_tree_add_item( rtp_midi_tree, hf_rtp_midi_pflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7473
7474         /* ...followed by a length-field of at least 4 bits */
7475         cmd_len = flags & RTP_MIDI_CS_MASK_SHORTLEN;
7476
7477         /* see if we have small or large len-field */
7478         if (flags & RTP_MIDI_CS_FLAG_B)  {
7479                 octet = tvb_get_guint8( tvb, offset+1 );
7480                 cmd_len = ( cmd_len << 8 ) | octet;
7481                 proto_tree_add_item( rtp_midi_tree, hf_rtp_midi_longlen, tvb, offset, 2, ENC_BIG_ENDIAN );
7482                 offset += 2;
7483         } else {
7484                 proto_tree_add_item( rtp_midi_tree, hf_rtp_midi_shortlen, tvb, offset, 1, ENC_BIG_ENDIAN );
7485                         offset++;
7486         }
7487
7488         /* if we have a command-section -> dissect it */
7489         if ( cmd_len ) {
7490                 command_item = proto_tree_add_text( rtp_midi_tree, tvb, offset, cmd_len, RTP_MIDI_TREE_NAME_COMMAND );
7491                 rtp_midi_commands_tree = proto_item_add_subtree( command_item, ett_rtp_midi_commands );
7492
7493                 /* if the reported command-length larger than data found in packet -> error */
7494                 if ( !tvb_bytes_exist( tvb, offset, cmd_len ) ) {
7495                         THROW( ReportedBoundsError );
7496                         return;
7497                 }
7498
7499                 /* No commands decoded yet */
7500                 cmd_count=0;
7501
7502                 /* RTP-MIDI-pdus always start with no running status */
7503                 runningstatus=0;
7504
7505                 /* Multiple MIDI-commands might follow - the exact number can only be discovered by really decoding the commands! */
7506                 while ( cmd_len) {
7507
7508                         /* for the first command we only have a delta-time if Z-Flag is set */
7509                         if ( ( cmd_count ) || ( flags & RTP_MIDI_CS_FLAG_Z ) ) {
7510
7511                                 /* Decode a delta-time - if 0 is returned something went wrong */
7512                                 consumed=decodetime( tvb, pinfo, rtp_midi_commands_tree, offset, cmd_len );
7513                                 if ( -1 == consumed ) {
7514                                         THROW( ReportedBoundsError );
7515                                         return;
7516                                 }
7517
7518                                 /* seek to next command and set remaining length */
7519                                 offset += consumed;
7520                                 cmd_len -= consumed;
7521                         }
7522
7523                         /* Only decode MIDI-command if there is any data left - it is valid to only have delta-time! */
7524                         if ( cmd_len ) {
7525
7526                                 /* Decode a MIDI-command - if 0 is returned something went wrong */
7527                                 consumed = decodemidi( tvb, pinfo, rtp_midi_commands_tree, cmd_count, offset, cmd_len, &runningstatus, &rsoffset );
7528                                 if ( -1 == consumed ) {
7529                                         THROW( ReportedBoundsError );
7530                                         return;
7531                                 }
7532
7533                                 /* seek to next delta-time and set remaining length */
7534                                 offset += consumed;
7535                                 cmd_len -= consumed;
7536
7537                                 /* as we have successfully decoded another command, increment count */
7538                                 cmd_count++;
7539                         }
7540                 }
7541         }
7542         /*
7543          * Journal section
7544          */
7545
7546         /* if we have a journal-section -> dissect it */
7547         if ( flags & RTP_MIDI_CS_FLAG_J ) {
7548
7549                 journal_item = proto_tree_add_text( rtp_midi_tree, tvb, offset, -1, RTP_MIDI_TREE_NAME_JOURNAL );
7550                 rtp_midi_journal_tree = proto_item_add_subtree( journal_item, ett_rtp_midi_journal );
7551
7552                 /* lets get the main flags from the recovery journal header */
7553                 flags = tvb_get_guint8( tvb, offset );
7554
7555                 proto_tree_add_item( rtp_midi_journal_tree, hf_rtp_midi_sflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7556                 proto_tree_add_item( rtp_midi_journal_tree, hf_rtp_midi_yflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7557                 proto_tree_add_item( rtp_midi_journal_tree, hf_rtp_midi_aflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7558                 proto_tree_add_item( rtp_midi_journal_tree, hf_rtp_midi_hflag, tvb, offset, 1, ENC_BIG_ENDIAN );
7559
7560                 /* At the same place we find the total channels encoded in the channel journal */
7561                 totchan = flags & RTP_MIDI_JS_MASK_TOTALCHANNELS;
7562                 proto_tree_add_item( rtp_midi_journal_tree, hf_rtp_midi_totchan, tvb, offset, 1, ENC_BIG_ENDIAN);
7563                 offset++;
7564
7565                 /* the checkpoint-sequence-number can be used to see if the recovery journal covers all lost events */
7566                 proto_tree_add_item( rtp_midi_journal_tree, hf_rtp_midi_check_seq_num, tvb, offset, 2, ENC_BIG_ENDIAN );
7567                 offset += 2;
7568
7569
7570                 /* do we have system journal? */
7571                 if ( flags & RTP_MIDI_JS_FLAG_Y ) {
7572                         /* first we need to get the flags & length from the system-journal */
7573                         consumed = decode_system_journal( tvb, pinfo, rtp_midi_journal_tree, offset );
7574
7575                         if ( -1 == consumed ) {
7576                                 THROW( ReportedBoundsError );
7577                                 return;
7578                         }
7579
7580                         /* seek to optional channel-journals-section */
7581                         offset += consumed;
7582
7583                 }
7584
7585                 /* do we have channel journal(s)? */
7586                 if ( flags & RTP_MIDI_JS_FLAG_A ) {
7587                         ti = proto_tree_add_text( rtp_midi_journal_tree, tvb, offset, -1, RTP_MIDI_TREE_NAME_CHANNEL_JOURNAL );
7588                         rtp_midi_chanjournals_tree = proto_item_add_subtree( ti, ett_rtp_midi_channeljournals );
7589
7590                         /* iterate through all the channels specified in header */
7591                         for ( i = 0; i <= totchan; i++ ) {
7592
7593                                 consumed = decode_channel_journal( tvb, pinfo, rtp_midi_chanjournals_tree, offset );
7594
7595                                 if ( -1 == consumed ) {
7596                                         THROW( ReportedBoundsError );
7597                                         return;
7598                                 }
7599
7600                                 /* seek to next channel-journal */
7601                                 offset += consumed;
7602
7603                         }
7604                 }
7605         }
7606 }
7607
7608
7609
7610
7611 void
7612 proto_register_rtp_midi( void )
7613 {
7614         module_t *rtp_midi_module;
7615
7616         static hf_register_info hf[] = {
7617                 {
7618                         &hf_rtp_midi_bflag,
7619                         {
7620                                 "B-Flag",
7621                                 "rtpmidi.b_flag",
7622                                 FT_BOOLEAN,
7623                                 8,
7624                                 TFS(&rtp_midi_cs_flag_b),
7625                                 RTP_MIDI_CS_FLAG_B,
7626                                 NULL, HFILL
7627                         }
7628                 },
7629                 {
7630                         &hf_rtp_midi_jflag,
7631                         {
7632                                 "J-Flag",
7633                                 "rtpmidi.j_flag",
7634                                 FT_BOOLEAN,
7635                                 8,
7636                                 TFS(&rtp_midi_cs_flag_j),
7637                                 RTP_MIDI_CS_FLAG_J,
7638                                 NULL, HFILL
7639                         }
7640                 },
7641                 {
7642                         &hf_rtp_midi_zflag,
7643                         {
7644                                 "Z-Flag",
7645                                 "rtpmidi.z_flag",
7646                                 FT_BOOLEAN,
7647                                 8,
7648                                 TFS(&rtp_midi_cs_flag_z),
7649                                 RTP_MIDI_CS_FLAG_Z,
7650                                 NULL, HFILL
7651                         }
7652                 },
7653                 {
7654                         &hf_rtp_midi_pflag,
7655                         {
7656                                 "P-Flag",
7657                                 "rtpmidi.p_flag",
7658                                 FT_BOOLEAN,
7659                                 8,
7660                                 TFS(&rtp_midi_cs_flag_p),
7661                                 RTP_MIDI_CS_FLAG_P,
7662                                 NULL, HFILL
7663                         }
7664                 },
7665                 {
7666                         &hf_rtp_midi_shortlen,
7667                         {
7668                                 "Command length (short)",
7669                                 "rtpmidi.cmd_length_short",
7670                                 FT_UINT8,
7671                                 BASE_DEC,
7672                                 NULL,
7673                                 RTP_MIDI_CS_MASK_SHORTLEN,
7674                                 NULL, HFILL
7675                         }
7676                 },
7677                         {
7678                         &hf_rtp_midi_longlen,
7679                         {
7680                                 "Command length (long)",
7681                                 "rtpmidi.cmd_length_long",
7682                                 FT_UINT16,
7683                                 BASE_DEC,
7684                                 NULL,
7685                                 RTP_MIDI_CS_MASK_LONGLEN,
7686                                 NULL, HFILL
7687                         }
7688                 },
7689                 {
7690                         &hf_rtp_midi_sflag,
7691                         {
7692                                 "S-Flag",
7693                                 "rtpmidi.s_flag",
7694                                 FT_BOOLEAN,
7695                                 8,
7696                                 TFS(&rtp_midi_js_flag_s),
7697                                 RTP_MIDI_JS_FLAG_S,
7698                                 NULL, HFILL
7699                         }
7700                 },
7701                 {
7702                         &hf_rtp_midi_yflag,
7703                         {
7704                                 "Y-Flag",
7705                                 "rtpmidi.y_flag",
7706                                 FT_BOOLEAN,
7707                                 8,
7708                                 TFS(&rtp_midi_js_flag_y),
7709                                 RTP_MIDI_JS_FLAG_Y,
7710                                 NULL, HFILL
7711                         }
7712                 },
7713                 {
7714                         &hf_rtp_midi_aflag,
7715                         {
7716                                 "A-Flag",
7717                                 "rtpmidi.a_flag",
7718                                 FT_BOOLEAN,
7719                                 8,
7720                                 TFS(&rtp_midi_js_flag_a),
7721                                 RTP_MIDI_JS_FLAG_A,
7722                                 NULL, HFILL
7723                         }
7724                 },
7725                 {
7726                         &hf_rtp_midi_hflag,
7727                         {
7728                                 "H-Flag",
7729                                 "rtpmidi.h_flag",
7730                                 FT_BOOLEAN,
7731                                 8,
7732                                 TFS(&rtp_midi_js_flag_h),
7733                                 RTP_MIDI_JS_FLAG_H,
7734                                 NULL, HFILL
7735                         }
7736                 },
7737                 {
7738                         &hf_rtp_midi_totchan,
7739                         {
7740                                 "Total channels",
7741                                 "rtpmidi.total_channels",
7742                                 FT_UINT8,
7743                                 BASE_DEC,
7744                                 VALS(rtp_midi_js_tot_channels),
7745                                 RTP_MIDI_JS_MASK_TOTALCHANNELS,
7746                                 NULL, HFILL
7747                         }
7748                 },
7749                 {
7750                         &hf_rtp_midi_check_seq_num,
7751                         {
7752                                 "Checkpoint Packet Seqnum",
7753                                 "rtpmidi.check_Seq_num",
7754                                 FT_UINT16,
7755                                 BASE_DEC,
7756                                 NULL,
7757                                 0x00,
7758                                 NULL, HFILL
7759                         }
7760                 },
7761                 {
7762                         &hf_rtp_midi_deltatime1,
7763                         {
7764                                 "Delta Time (one octet)",
7765                                 "rtpmidi.deltatime_1",
7766                                 FT_UINT8,
7767                                 BASE_HEX,
7768                                 NULL,
7769                                 0x7f,
7770                                 NULL, HFILL
7771                         }
7772                 },
7773                 {
7774                         &hf_rtp_midi_deltatime2,
7775                         {
7776                                 "Delta Time (two octets)",
7777                                 "rtpmidi.deltatime_2",
7778                                 FT_UINT16,
7779                                 BASE_HEX,
7780                                 NULL,
7781                                 0x7f7f,
7782                                 NULL, HFILL
7783                         }
7784                 },
7785                 {
7786                         &hf_rtp_midi_deltatime3,
7787                         {
7788                                 "Delta Time (three octets)",
7789                                 "rtpmidi.deltatime_3",
7790                                 FT_UINT24,
7791                                 BASE_HEX,
7792                                 NULL,
7793                                 0x7f7f7f,
7794                                 NULL, HFILL
7795                         }
7796                 },
7797                 {
7798                         &hf_rtp_midi_deltatime4,
7799                         {
7800                                 "Delta Time (four octets)",
7801                                 "rtpmidi.deltatime_4",
7802                                 FT_UINT32,
7803                                 BASE_HEX,
7804                                 NULL,
7805                                 0x7f7f7f7f,
7806                                 NULL, HFILL
7807                         }
7808                 },
7809                 {
7810                         &hf_rtp_midi_channel_status,
7811                         {
7812                                 "Channel Status",
7813                                 "rtpmidi.channel_status",
7814                                 FT_UINT8,
7815                                 BASE_HEX,
7816                                 VALS(rtp_midi_channel_status),
7817                                 0xf0,
7818                                 NULL, HFILL
7819                         }
7820                 },
7821                 {
7822                         &hf_rtp_midi_common_status,
7823                         {
7824                                 "Common Status",
7825                                 "rtpmidi.common_status",
7826                                 FT_UINT8,
7827                                 BASE_HEX,
7828                                 VALS(rtp_midi_common_status),
7829                                 0xff,
7830                                 NULL, HFILL
7831                         }
7832                 },
7833                 {
7834                         &hf_rtp_midi_channel,
7835                         {
7836                                 "Channel",
7837                                 "rtpmidi.channel",
7838                                 FT_UINT8,
7839                                 BASE_HEX,
7840                                 VALS(rtp_midi_channels),
7841                                 0x0f,
7842                                 NULL, HFILL
7843                         }
7844                 },
7845                 {
7846                         &hf_rtp_midi_note,
7847                         {
7848                                 "Note",
7849                                 "rtpmidi.note",
7850                                 FT_UINT8,
7851                                 BASE_DEC,
7852                                 VALS(rtp_midi_note_values),
7853                                 0x7f,
7854                                 NULL, HFILL
7855                         }
7856                 },
7857                 {
7858                         &hf_rtp_midi_velocity,
7859                         {
7860                                 "Velocity",
7861                                 "rtpmidi.velocity",
7862                                 FT_UINT8,
7863                                 BASE_DEC,
7864                                 NULL,
7865                                 0x7f,
7866                                 NULL, HFILL
7867                         }
7868                 },
7869                 {
7870                         &hf_rtp_midi_pressure,
7871                         {
7872                                 "Pressure",
7873                                 "rtpmidi.pressure",
7874                                 FT_UINT8,
7875                                 BASE_DEC,
7876                                 NULL,
7877                                 0x7f,
7878                                 NULL, HFILL
7879                         }
7880                 },
7881                 {
7882                         &hf_rtp_midi_controller,
7883                         {
7884                                 "Controller",
7885                                 "rtpevent.controller",
7886                                 FT_UINT8,
7887                                 BASE_DEC,
7888                                 VALS(rtp_midi_controller_values),
7889                                 0x7f,
7890                                 NULL, HFILL
7891                         }
7892                 },
7893                 {
7894                         &hf_rtp_midi_controller_value,
7895                         {
7896                                 "Value",
7897                                 "rtpmidi.controller_value",
7898                                 FT_UINT8,
7899                                 BASE_DEC,
7900                                 NULL,
7901                                 0x7f,
7902                                 NULL, HFILL
7903                         }
7904                 },
7905                 {
7906                         &hf_rtp_midi_program,
7907                         {
7908                                 "Program",
7909                                 "rtpmidi.program",
7910                                 FT_UINT8,
7911                                 BASE_DEC,
7912                                 NULL,
7913                                 0x7f,
7914                                 NULL, HFILL
7915                         }
7916                 },
7917                 {
7918                         &hf_rtp_midi_channel_pressure,
7919                         {
7920                                 "Pressure",
7921                                 "rtpmidi.channel_pressure",
7922                                 FT_UINT8,
7923                                 BASE_DEC,
7924                                 NULL,
7925                                 0x7f,
7926                                 NULL, HFILL
7927                         }
7928                 },
7929                 {
7930                         &hf_rtp_midi_pitch_bend,
7931                         {
7932                                 "Pitch Bend",
7933                                 "rtpmidi.pitch_bend",
7934                                 FT_UINT16,
7935                                 BASE_DEC,
7936                                 NULL,
7937                                 0x7f7f,
7938                                 NULL, HFILL
7939                         }
7940                 },
7941                 {
7942                         &hf_rtp_midi_pitch_bend_truncated,
7943                         {
7944                                 "Pitch Bend (truncated)",
7945                                 "rtpmidi.pitch_bend_truncated",
7946                                 FT_UINT8,
7947                                 BASE_DEC,
7948                                 NULL,
7949                                 0x7f,
7950                                 NULL, HFILL
7951                         }
7952                 },
7953                 {
7954                         &hf_rtp_midi_manu_short,
7955                         {
7956                                 "Manufacturer (short)",
7957                                 "rtpmidi.manufacturer_short",
7958                                 FT_UINT8,
7959                                 BASE_HEX,
7960                                 VALS(rtp_midi_manu_short_values),
7961                                 0x7f,
7962                                 NULL, HFILL
7963                         }
7964                 },
7965                 {
7966                         &hf_rtp_midi_manu_long,
7967                         {
7968                                 "Manufacturer (long)",
7969                                 "rtpmidi.manufacturer_long",
7970                                 FT_UINT16,
7971                                 BASE_HEX,
7972                                 VALS(rtp_midi_manu_long_values),
7973                                 0x7f7f,
7974                                 NULL, HFILL
7975                         }
7976                 },
7977                 {
7978                         &hf_rtp_midi_sysjour_toc_s,
7979                         {
7980                                 "System-Journal TOC-S-Flag",
7981                                 "rtpmidi.sysjour_toc_s",
7982                                 FT_BOOLEAN,
7983                                 16,
7984                                 TFS(&rtp_midi_js_flag_s),
7985                                 RTP_MIDI_SJ_FLAG_S,
7986                                 NULL, HFILL
7987                         }
7988                 },
7989                 {
7990                         &hf_rtp_midi_sysjour_toc_d,
7991                         {
7992                                 "System-Journal TOC-D-Flag",
7993                                 "rtpmidi.sysjour_toc_d",
7994                                 FT_BOOLEAN,
7995                                 16,
7996                                 TFS(&rtp_midi_sj_flag_d),
7997                                 RTP_MIDI_SJ_FLAG_D,
7998                                 NULL, HFILL
7999                         }
8000                 },
8001                 {
8002                         &hf_rtp_midi_sysjour_toc_v,
8003                         {
8004                                 "System-Journal TOC-V-Flag",
8005                                 "rtpmidi.sysjour_toc_v",
8006                                 FT_BOOLEAN,
8007                                 16,
8008                                 TFS(&rtp_midi_sj_flag_v),
8009                                 RTP_MIDI_SJ_FLAG_V,
8010                                 NULL, HFILL
8011                         }
8012                 },
8013                 {
8014                         &hf_rtp_midi_sysjour_toc_q,
8015                         {
8016                                 "System-Journal TOC-Q-Flag",
8017                                 "rtpmidi.sysjour_toc_q",
8018                                 FT_BOOLEAN,
8019                                 16,
8020                                 TFS(&rtp_midi_sj_flag_q),
8021                                 RTP_MIDI_SJ_FLAG_Q,
8022                                 NULL, HFILL
8023                         }
8024                 },
8025                 {
8026                         &hf_rtp_midi_sysjour_toc_f,
8027                         {
8028                                 "System-Journal TOC-F-Flag",
8029                                 "rtpmidi.sysjour_toc_f",
8030                                 FT_BOOLEAN,
8031                                 16,
8032                                 TFS(&rtp_midi_sj_flag_f),
8033                                 RTP_MIDI_SJ_FLAG_F,
8034                                 NULL, HFILL
8035                         }
8036                 },
8037                 {
8038                         &hf_rtp_midi_sysjour_toc_x,
8039                         {
8040                                 "System-Journal TOC-X-Flag",
8041                                 "rtpmidi.sysjour_toc_x",
8042                                 FT_BOOLEAN,
8043                                 16,
8044                                 TFS(&rtp_midi_sj_flag_x),
8045                                 RTP_MIDI_SJ_FLAG_X,
8046                                 NULL, HFILL
8047                         }
8048                 },
8049                 {
8050                         &hf_rtp_midi_sysjour_len,
8051                         {
8052                                 "System-Journal-Length",
8053                                 "rtpmidi.cmd_sysjour_len",
8054                                 FT_UINT16,
8055                                 BASE_DEC,
8056                                 NULL,
8057                                 RTP_MIDI_SJ_MASK_LENGTH,
8058                                 NULL, HFILL
8059                         }
8060                 },
8061                 {
8062                         &hf_rtp_midi_chanjour_sflag,
8063                         {
8064                                 "Channel-Journal S-Flag",
8065                                 "rtpmidi.chanjour_s",
8066                                 FT_BOOLEAN,
8067                                 24,
8068                                 TFS(&rtp_midi_js_flag_s),
8069                                 0x800000,
8070                                 NULL, HFILL
8071                         }
8072                 },
8073                 {
8074                         &hf_rtp_midi_chanjour_chan,
8075                         {
8076                                 "Channel",
8077                                 "rtpmidi.chanjour_channel",
8078                                 FT_UINT24,
8079                                 BASE_HEX,
8080                                 VALS(rtp_midi_channels),
8081                                 0x780000,
8082                                 NULL, HFILL
8083                         }
8084                 },
8085                 {
8086                         &hf_rtp_midi_chanjour_hflag,
8087                         {
8088                                 "Channel-Journal H-Flag",
8089                                 "rtpmidi.chanjour_h",
8090                                 FT_BOOLEAN,
8091                                 24,
8092                                 TFS(&rtp_midi_js_flag_h),
8093                                 0x040000,
8094                                 NULL, HFILL
8095                         }
8096                 },
8097                 {
8098                         &hf_rtp_midi_chanjour_len,
8099                         {
8100                                 "Channel-Journal-Length",
8101                                 "rtpmidi.cmd_chanjour_len",
8102                                 FT_UINT24,
8103                                 BASE_DEC,
8104                                 NULL,
8105                                 0x03FF00,
8106                                 NULL, HFILL
8107                         }
8108                 },
8109                 {
8110                         &hf_rtp_midi_chanjour_toc_p,
8111                         {
8112                                 "Channel-Journal TOC-P-Flag",
8113                                 "rtpmidi.chanjour_toc_p",
8114                                 FT_BOOLEAN,
8115                                 24,
8116                                 TFS(&rtp_midi_cj_flag_p),
8117                                 0x80,
8118                                 NULL, HFILL
8119                         }
8120                 },
8121                 {
8122                         &hf_rtp_midi_chanjour_toc_c,
8123                         {
8124                                 "Channel-Journal TOC-C-Flag",
8125                                 "rtpmidi.chanjour_toc_c",
8126                                 FT_BOOLEAN,
8127                                 24,
8128                                 TFS(&rtp_midi_cj_flag_c),
8129                                 0x40,
8130                                 NULL, HFILL
8131                         }
8132                 },
8133                 {
8134                         &hf_rtp_midi_chanjour_toc_m,
8135                         {
8136                                 "Channel-Journal TOC-M-Flag",
8137                                 "rtpmidi.chanjour_toc_m",
8138                                 FT_BOOLEAN,
8139                                 24,
8140                                 TFS(&rtp_midi_cj_flag_m),
8141                                 0x20,
8142                                 NULL, HFILL
8143                         }
8144                 },
8145                 {
8146                         &hf_rtp_midi_chanjour_toc_w,
8147                         {
8148                                 "Channel-Journal TOC-W-Flag",
8149                                 "rtpmidi.chanjour_toc_w",
8150                                 FT_BOOLEAN,
8151                                 24,
8152                                 TFS(&rtp_midi_cj_flag_w),
8153                                 0x10,
8154                                 NULL, HFILL
8155                         }
8156                 },
8157                 {
8158                         &hf_rtp_midi_chanjour_toc_n,
8159                         {
8160                                 "Channel-Journal TOC-N-Flag",
8161                                 "rtpmidi.chanjour_toc_n",
8162                                 FT_BOOLEAN,
8163                                 24,
8164                                 TFS(&rtp_midi_cj_flag_n),
8165                                 0x08,
8166                                 NULL, HFILL
8167                         }
8168                 },
8169                 {
8170                         &hf_rtp_midi_chanjour_toc_e,
8171                         {
8172                                 "Channel-Journal TOC-E-Flag",
8173                                 "rtpmidi.chanjour_toc_e",
8174                                 FT_BOOLEAN,
8175                                 24,
8176                                 TFS(&rtp_midi_cj_flag_e),
8177                                 0x04,
8178                                 NULL, HFILL
8179                         }
8180                 },
8181                 {
8182                         &hf_rtp_midi_chanjour_toc_t,
8183                         {
8184                                 "Channel-Journal TOC-T-Flag",
8185                                 "rtpmidi.chanjour_toc_t",
8186                                 FT_BOOLEAN,
8187                                 24,
8188                                 TFS(&rtp_midi_cj_flag_t),
8189                                 0x02,
8190                                 NULL, HFILL
8191                         }
8192                 },
8193                 {
8194                         &hf_rtp_midi_chanjour_toc_a,
8195                         {
8196                                 "Channel-Journal TOC-A-Flag",
8197                                 "rtpmidi.chanjour_toc_a",
8198                                 FT_BOOLEAN,
8199                                 24,
8200                                 TFS(&rtp_midi_cj_flag_a),
8201                                 0x01,
8202                                 NULL, HFILL
8203                         }
8204                 },
8205
8206                 {
8207                         &hf_rtp_midi_cj_chapter_p_sflag,
8208                         {
8209                                 "Chapter P S-Flag",
8210                                 "rtpmidi.cj_chapter_p_sflag",
8211                                 FT_BOOLEAN,
8212                                 8,
8213                                 TFS(&rtp_midi_js_flag_s),
8214                                 0x80,
8215                                 NULL, HFILL
8216                         }
8217                 },
8218
8219                 {
8220                         &hf_rtp_midi_cj_chapter_p_program,
8221                         {
8222                                 "Chapter P Program",
8223                                 "rtpmidi.cj_chapter_p_program",
8224                                 FT_UINT8,
8225                                 BASE_DEC,
8226                                 NULL,
8227                                 0x7f,
8228                                 NULL, HFILL
8229                         }
8230                 },
8231
8232                 {
8233                         &hf_rtp_midi_cj_chapter_p_bflag,
8234                         {
8235                                 "Chapter P B-Flag",
8236                                 "rtpmidi.cj_chapter_p_bflag",
8237                                 FT_BOOLEAN,
8238                                 8,
8239                                 NULL,
8240                                 0x80,
8241                                 NULL, HFILL
8242                         }
8243                 },
8244
8245                 {
8246                         &hf_rtp_midi_cj_chapter_p_bank_msb,
8247                         {
8248                                 "Chapter P Bank-MSB",
8249                                 "rtpmidi.cj_chapter_p_bank_msb",
8250                                 FT_UINT8,
8251                                 BASE_HEX,
8252                                 NULL,
8253                                 0x7f,
8254                                 NULL, HFILL
8255                         }
8256                 },
8257
8258                 {
8259                         &hf_rtp_midi_cj_chapter_p_xflag,
8260                         {
8261                                 "Chapter P X-Flag",
8262                                 "rtpmidi.cj_chapter_p_xflag",
8263                                 FT_BOOLEAN,
8264                                 8,
8265                                 TFS(&rtp_midi_cj_chapter_p_log_flag_x),
8266                                 0x80,
8267                                 NULL, HFILL
8268                         }
8269                 },
8270                 {
8271                         &hf_rtp_midi_cj_chapter_p_bank_lsb,
8272                         {
8273                                 "Chapter P Bank-LSB",
8274                                 "rtpmidi.cj_chapter_p_bank_lsb",
8275                                 FT_UINT8,
8276                                 BASE_HEX,
8277                                 NULL,
8278                                 0x7f,
8279                                 NULL, HFILL
8280                         }
8281                 },
8282
8283                 {
8284                         &hf_rtp_midi_cj_chapter_c_sflag,
8285                         {
8286                                 "Chapter C S-Flag",
8287                                 "rtpmidi.cj_chapter_c_sflag",
8288                                 FT_BOOLEAN,
8289                                 8,
8290                                 TFS(&rtp_midi_js_flag_s),
8291                                 0x80,
8292                                 NULL, HFILL
8293                         }
8294                 },
8295
8296                 {
8297                         &hf_rtp_midi_cj_chapter_c_length,
8298                         {
8299                                 "Chapter C Length",
8300                                 "rtpmidi.cj_chapter_c_length",
8301                                 FT_UINT8,
8302                                 BASE_DEC,
8303                                 NULL,
8304                                 0x7f,
8305                                 NULL, HFILL
8306                         }
8307                 },
8308
8309                 {
8310                         &hf_rtp_midi_cj_chapter_c_number,
8311                         {
8312                                 "Chapter C Number",
8313                                 "rtpmidi.cj_chapter_c_number",
8314                                 FT_UINT8,
8315                                 BASE_DEC,
8316                                 VALS(rtp_midi_controller_values),
8317                                 0x7f,
8318                                 NULL, HFILL
8319                         }
8320                 },
8321
8322                 {
8323                         &hf_rtp_midi_cj_chapter_c_aflag,
8324                         {
8325                                 "Chapter C A-Flag",
8326                                 "rtpmidi.cj_chapter_c_aflag",
8327                                 FT_BOOLEAN,
8328                                 8,
8329                                 TFS(&rtp_midi_cj_chapter_c_flag_a),
8330                                 0x80,
8331                                 NULL, HFILL
8332                         }
8333                 },
8334
8335                 {
8336                         &hf_rtp_midi_cj_chapter_c_tflag,
8337                         {
8338                                 "Chapter C T-Flag",
8339                                 "rtpmidi.cj_chapter_c_tflag",
8340                                 FT_BOOLEAN,
8341                                 8,
8342                                 NULL,
8343                                 0x40,
8344                                 NULL, HFILL
8345                         }
8346                 },
8347
8348                 {
8349                         &hf_rtp_midi_cj_chapter_c_value,
8350                         {
8351                                 "Chapter C Value",
8352                                 "rtpmidi.cj_chapter_c_value",
8353                                 FT_UINT8,
8354                                 BASE_HEX,
8355                                 NULL,
8356                                 0x7f,
8357                                 NULL, HFILL
8358                         }
8359                 },
8360
8361                 {
8362                         &hf_rtp_midi_cj_chapter_c_alt,
8363                         {
8364                                 "Chapter C Alt",
8365                                 "rtpmidi.cj_chapter_c_alt",
8366                                 FT_UINT8,
8367                                 BASE_HEX,
8368                                 NULL,
8369                                 0x3f,
8370                                 NULL, HFILL
8371                         }
8372                 },
8373
8374                 {
8375                         &hf_rtp_midi_cj_chapter_m_sflag,
8376                         {
8377                                 "Chapter M S-Flag",
8378                                 "rtpmidi.cj_chapter_m_sflag",
8379                                 FT_BOOLEAN,
8380                                 16,
8381                                 TFS(&rtp_midi_js_flag_s),
8382                                 0x8000,
8383                                 NULL, HFILL
8384                         }
8385                 },
8386
8387                 {
8388                         &hf_rtp_midi_cj_chapter_m_pflag,
8389                         {
8390                                 "Chapter M P-Flag",
8391                                 "rtpmidi.cj_chapter_m_pflag",
8392                                 FT_BOOLEAN,
8393                                 16,
8394                                 TFS(&rtp_midi_cj_chapter_m_flag_p),
8395                                 0x4000,
8396                                 NULL, HFILL
8397                         }
8398                 },
8399
8400                 {
8401                         &hf_rtp_midi_cj_chapter_m_eflag,
8402                         {
8403                                 "Chapter M E-Flag",
8404                                 "rtpmidi.cj_chapter_m_eflag",
8405                                 FT_BOOLEAN,
8406                                 16,
8407                                 TFS(&rtp_midi_cj_chapter_m_flag_e),
8408                                 0x2000,
8409                                 NULL, HFILL
8410                         }
8411                 },
8412
8413                 {
8414                         &hf_rtp_midi_cj_chapter_m_uflag,
8415                         {
8416                                 "Chapter M U-Flag",
8417                                 "rtpmidi.cj_chapter_m_uflag",
8418                                 FT_BOOLEAN,
8419                                 16,
8420                                 TFS(&rtp_midi_cj_chapter_m_flag_u),
8421                                 0x1000,
8422                                 NULL, HFILL
8423                         }
8424                 },
8425
8426                 {
8427                         &hf_rtp_midi_cj_chapter_m_wflag,
8428                         {
8429                                 "Chapter M W-Flag",
8430                                 "rtpmidi.cj_chapter_m_wflag",
8431                                 FT_BOOLEAN,
8432                                 16,
8433                                 TFS(&rtp_midi_cj_chapter_m_flag_w),
8434                                 0x0800,
8435                                 NULL, HFILL
8436                         }
8437                 },
8438
8439                 {
8440                         &hf_rtp_midi_cj_chapter_m_zflag,
8441                         {
8442                                 "Chapter M Z-Flag",
8443                                 "rtpmidi.cj_chapter_m_zflag",
8444                                 FT_BOOLEAN,
8445                                 16,
8446                                 TFS(&rtp_midi_cj_chapter_m_flag_z),
8447                                 0x0400,
8448                                 NULL, HFILL
8449                         }
8450                 },
8451
8452                 {
8453                         &hf_rtp_midi_cj_chapter_m_length,
8454                         {
8455                                 "Chapter M Length",
8456                                 "rtpmidi.cj_chapter_m_length",
8457                                 FT_UINT16,
8458                                 BASE_DEC,
8459                                 NULL,
8460                                 0x03ff,
8461                                 NULL, HFILL
8462                         }
8463                 },
8464
8465                 {
8466                         &hf_rtp_midi_cj_chapter_m_qflag,
8467                         {
8468                                 "Chapter M Q-Flag",
8469                                 "rtpmidi.cj_chapter_m_qflag",
8470                                 FT_BOOLEAN,
8471                                 8,
8472                                 TFS(&rtp_midi_cj_chapter_m_flag_q),
8473                                 0x80,
8474                                 NULL, HFILL
8475                         }
8476                 },
8477
8478                 {
8479                         &hf_rtp_midi_cj_chapter_m_pending,
8480                         {
8481                                 "Chapter M Pending",
8482                                 "rtpmidi.cj_chapter_m_pending",
8483                                 FT_UINT8,
8484                                 BASE_HEX,
8485                                 NULL,
8486                                 0x7f,
8487                                 NULL, HFILL
8488                         }
8489                 },
8490
8491                 {
8492                         &hf_rtp_midi_cj_chapter_m_log_sflag,
8493                         {
8494                                 "Chapter M Log S-Flag",
8495                                 "rtpmidi.cj_chapter_m_log_sflag",
8496                                 FT_BOOLEAN,
8497                                 8,
8498                                 TFS(&rtp_midi_js_flag_s),
8499                                 0x80,
8500                                 NULL, HFILL
8501                         }
8502                 },
8503
8504                 {
8505                         &hf_rtp_midi_cj_chapter_m_log_pnum_lsb,
8506                         {
8507                                 "Chapter M Log PNUM-LSB",
8508                                 "rtpmidi.cj_chapter_m_log_pnum_lsb",
8509                                 FT_UINT8,
8510                                 BASE_HEX,
8511                                 NULL,
8512                                 0x7f,
8513                                 NULL, HFILL
8514                         }
8515                 },
8516
8517                 {
8518                         &hf_rtp_midi_cj_chapter_m_log_qflag,
8519                         {
8520                                 "Chapter M Log Q-Flag",
8521                                 "rtpmidi.cj_chapter_m_log_qflag",
8522                                 FT_BOOLEAN,
8523                                 8,
8524                                 TFS(&rtp_midi_cj_chapter_m_log_flag_q),
8525                                 0x80,
8526                                 NULL, HFILL
8527                         }
8528                 },
8529
8530                 {
8531                         &hf_rtp_midi_cj_chapter_m_log_pnum_msb,
8532                         {
8533                                 "Chapter M Log PNUM-MSB",
8534                                 "rtpmidi.cj_chapter_m_log_pnum_msb",
8535                                 FT_UINT8,
8536                                 BASE_HEX,
8537                                 NULL,
8538                                 0x7f,
8539                                 NULL, HFILL
8540                         }
8541                 },
8542
8543                 {
8544                         &hf_rtp_midi_cj_chapter_m_log_jflag,
8545                         {
8546                                 "Chapter M Log J-Flag",
8547                                 "rtpmidi.cj_chapter_m_log_jflag",
8548                                 FT_BOOLEAN,
8549                                 8,
8550                                 TFS(&rtp_midi_cj_chapter_m_log_flag_j),
8551                                 RTP_MIDI_CJ_CHAPTER_M_FLAG_J,
8552                                 NULL, HFILL
8553                         }
8554                 },
8555
8556                 {
8557                         &hf_rtp_midi_cj_chapter_m_log_kflag,
8558                         {
8559                                 "Chapter M Log K-Flag",
8560                                 "rtpmidi.cj_chapter_m_log_kflag",
8561                                 FT_BOOLEAN,
8562                                 8,
8563                                 TFS(&rtp_midi_cj_chapter_m_log_flag_k),
8564                                 RTP_MIDI_CJ_CHAPTER_M_FLAG_K,
8565                                 NULL, HFILL
8566                         }
8567                 },
8568
8569                 {
8570                         &hf_rtp_midi_cj_chapter_m_log_lflag,
8571                         {
8572                                 "Chapter M Log L-Flag",
8573                                 "rtpmidi.cj_chapter_m_log_lflag",
8574                                 FT_BOOLEAN,
8575                                 8,
8576                                 TFS(&rtp_midi_cj_chapter_m_log_flag_l),
8577                                 RTP_MIDI_CJ_CHAPTER_M_FLAG_L,
8578                                 NULL, HFILL
8579                         }
8580                 },
8581
8582                 {
8583                         &hf_rtp_midi_cj_chapter_m_log_mflag,
8584                         {
8585                                 "Chapter M Log M-Flag",
8586                                 "rtpmidi.cj_chapter_m_log_mflag",
8587                                 FT_BOOLEAN,
8588                                 8,
8589                                 TFS(&rtp_midi_cj_chapter_m_log_flag_m),
8590                                 RTP_MIDI_CJ_CHAPTER_M_FLAG_M,
8591                                 NULL, HFILL
8592                         }
8593                 },
8594
8595                 {
8596                         &hf_rtp_midi_cj_chapter_m_log_nflag,
8597                         {
8598                                 "Chapter M Log N-Flag",
8599                                 "rtpmidi.cj_chapter_m_log_nflag",
8600                                 FT_BOOLEAN,
8601                                 8,
8602                                 TFS(&rtp_midi_cj_chapter_m_log_flag_n),
8603                                 RTP_MIDI_CJ_CHAPTER_M_FLAG_N,
8604                                 NULL, HFILL
8605                         }
8606                 },
8607
8608                 {
8609                         &hf_rtp_midi_cj_chapter_m_log_tflag,
8610                         {
8611                                 "Chapter M Log T-Flag",
8612                                 "rtpmidi.cj_chapter_m_log_tflag",
8613                                 FT_BOOLEAN,
8614                                 8,
8615                                 TFS(&rtp_midi_cj_chapter_m_log_flag_t),
8616                                 RTP_MIDI_CJ_CHAPTER_M_FLAG_T,
8617                                 NULL, HFILL
8618                         }
8619                 },
8620
8621                 {
8622                         &hf_rtp_midi_cj_chapter_m_log_vflag,
8623                         {
8624                                 "Chapter M Log V-Flag",
8625                                 "rtpmidi.cj_chapter_m_log_vflag",
8626                                 FT_BOOLEAN,
8627                                 8,
8628                                 TFS(&rtp_midi_cj_chapter_m_log_flag_v),
8629                                 RTP_MIDI_CJ_CHAPTER_M_FLAG_V,
8630                                 NULL, HFILL
8631                         }
8632                 },
8633
8634                 {
8635                         &hf_rtp_midi_cj_chapter_m_log_rflag,
8636                         {
8637                                 "Chapter M Log R-Flag",
8638                                 "rtpmidi.cj_chapter_m_log_rflag",
8639                                 FT_BOOLEAN,
8640                                 8,
8641                                 TFS(&rtp_midi_cj_chapter_m_log_flag_r),
8642                                 RTP_MIDI_CJ_CHAPTER_M_FLAG_R,
8643                                 NULL, HFILL
8644                         }
8645                 },
8646
8647                 {
8648                         &hf_rtp_midi_cj_chapter_m_log_msb_x,
8649                         {
8650                                 "Chapter M Log MSB X-Flag",
8651                                 "rtpmidi.cj_chapter_m_log_msb_xflag",
8652                                 FT_BOOLEAN,
8653                                 8,
8654                                 TFS(&rtp_midi_cj_chapter_m_log_flag_x),
8655                                 0x80,
8656                                 NULL, HFILL
8657                         }
8658                 },
8659
8660                 {
8661                         &hf_rtp_midi_cj_chapter_m_log_msb,
8662                         {
8663                                 "Chapter M Log MSB",
8664                                 "rtpmidi.cj_chapter_m_log_msb",
8665                                 FT_UINT8,
8666                                 BASE_HEX,
8667                                 NULL,
8668                                 0x7f,
8669                                 NULL, HFILL
8670                         }
8671                 },
8672
8673                 {
8674                         &hf_rtp_midi_cj_chapter_m_log_lsb_x,
8675                         {
8676                                 "Chapter M Log LSB X-Flag",
8677                                 "rtpmidi.cj_chapter_m_log_lsb_xflag",
8678                                 FT_BOOLEAN,
8679                                 8,
8680                                 TFS(&rtp_midi_cj_chapter_m_log_flag_x),
8681                                 0x80,
8682                                 NULL, HFILL
8683                         }
8684                 },
8685
8686                 {
8687                         &hf_rtp_midi_cj_chapter_m_log_lsb,
8688                         {
8689                                 "Chapter M Log LSB",
8690                                 "rtpmidi.cj_chapter_m_log_lsb",
8691                                 FT_UINT8,
8692                                 BASE_HEX,
8693                                 NULL,
8694                                 0x7f,
8695                                 NULL, HFILL
8696                         }
8697                 },
8698
8699                 {
8700                         &hf_rtp_midi_cj_chapter_m_log_a_button_g,
8701                         {
8702                                 "Chapter M Log A-Button G-Flag",
8703                                 "rtpmidi.cj_chapter_m_log_a_button_gflag",
8704                                 FT_BOOLEAN,
8705                                 16,
8706                                 TFS(&rtp_midi_cj_chapter_m_log_flag_g),
8707                                 0x8000,
8708                                 NULL, HFILL
8709                         }
8710                 },
8711
8712                 {
8713                         &hf_rtp_midi_cj_chapter_m_log_a_button_x,
8714                         {
8715                                 "Chapter M Log A-Button X-Flag",
8716                                 "rtpmidi.cj_chapter_m_log_a_button_xflag",
8717                                 FT_BOOLEAN,
8718                                 16,
8719                                 TFS(&rtp_midi_cj_chapter_m_log_flag_x),
8720                                 0x4000,
8721                                 NULL, HFILL
8722                         }
8723                 },
8724
8725                 {
8726                         &hf_rtp_midi_cj_chapter_m_log_a_button,
8727                         {
8728                                 "Chapter M Log A-Button",
8729                                 "rtpmidi.cj_chapter_m_log_a_button",
8730                                 FT_UINT16,
8731                                 BASE_HEX,
8732                                 NULL,
8733                                 0x3fff,
8734                                 NULL, HFILL
8735                         }
8736                 },
8737
8738                 {
8739                         &hf_rtp_midi_cj_chapter_m_log_c_button_g,
8740                         {
8741                                 "Chapter M Log C-Button G-Flag",
8742                                 "rtpmidi.cj_chapter_m_log_c_button_gflag",
8743                                 FT_BOOLEAN,
8744                                 16,
8745                                 TFS(&rtp_midi_cj_chapter_m_log_flag_g),
8746                                 0x8000,
8747                                 NULL, HFILL
8748                         }
8749                 },
8750
8751                 {
8752                         &hf_rtp_midi_cj_chapter_m_log_c_button_r,
8753                         {
8754                                 "Chapter M Log C-Button R-Flag",
8755                                 "rtpmidi.cj_chapter_m_log_c_button_rflag",
8756                                 FT_BOOLEAN,
8757                                 16,
8758                                 TFS(&rtp_midi_cj_chapter_m_log_flag_r),
8759                                 0x4000,
8760                                 NULL, HFILL
8761                         }
8762                 },
8763
8764                 {
8765                         &hf_rtp_midi_cj_chapter_m_log_c_button,
8766                         {
8767                                 "Chapter M Log C-Button",
8768                                 "rtpmidi.cj_chapter_m_log_c_button",
8769                                 FT_UINT16,
8770                                 BASE_HEX,
8771                                 NULL,
8772                                 0x3fff,
8773                                 NULL, HFILL
8774                         }
8775                 },
8776
8777                 {
8778                         &hf_rtp_midi_cj_chapter_m_log_count_x,
8779                         {
8780                                 "Chapter M Log Count X-Flag",
8781                                 "rtpmidi.cj_chapter_m_log_count_xflag",
8782                                 FT_BOOLEAN,
8783                                 8,
8784                                 TFS(&rtp_midi_cj_chapter_m_log_flag_x),
8785                                 0x80,
8786                                 NULL, HFILL
8787                         }
8788                 },
8789
8790                 {
8791                         &hf_rtp_midi_cj_chapter_m_log_count,
8792                         {
8793                                 "Chapter M Log Count",
8794                                 "rtpmidi.cj_chapter_m_log_count",
8795                                 FT_UINT8,
8796                                 BASE_DEC,
8797                                 NULL,
8798                                 0x7f,
8799                                 NULL, HFILL
8800                         }
8801                 },
8802
8803                 {
8804                         &hf_rtp_midi_cj_chapter_w_sflag,
8805                         {
8806                                 "Chapter W S-Flag",
8807                                 "rtpmidi.cj_chapter_w_sflag",
8808                                 FT_BOOLEAN,
8809                                 8,
8810                                 TFS(&rtp_midi_js_flag_s),
8811                                 0x80,
8812                                 NULL, HFILL
8813                         }
8814                 },
8815
8816                 {
8817                         &hf_rtp_midi_cj_chapter_w_first,
8818                         {
8819                                 "Chapter W First",
8820                                 "rtpmidi.cj_chapter_w_first",
8821                                 FT_UINT8,
8822                                 BASE_HEX,
8823                                 NULL,
8824                                 0x7f,
8825                                 NULL, HFILL
8826                         }
8827                 },
8828
8829                 {
8830                         &hf_rtp_midi_cj_chapter_w_rflag,
8831                         {
8832                                 "Chapter W R-Flag",
8833                                 "rtpmidi.cj_chapter_w_rflag",
8834                                 FT_BOOLEAN,
8835                                 8,
8836                                 TFS(&rtp_midi_cj_chapter_m_log_flag_r),
8837                                 0x80,
8838                                 NULL, HFILL
8839                         }
8840                 },
8841
8842                 {
8843                         &hf_rtp_midi_cj_chapter_w_second,
8844                         {
8845                                 "Chapter W Second",
8846                                 "rtpmidi.cj_chapter_w_second",
8847                                 FT_UINT8,
8848                                 BASE_HEX,
8849                                 NULL,
8850                                 0x7f,
8851                                 NULL, HFILL
8852                         }
8853                 },
8854
8855                 {
8856                         &hf_rtp_midi_cj_chapter_n_bflag,
8857                         {
8858                                 "Chapter N B-Flag",
8859                                 "rtpmidi.cj_chapter_n_bflag",
8860                                 FT_BOOLEAN,
8861                                 16,
8862                                 TFS(&rtp_midi_js_flag_s),
8863                                 0x8000,
8864                                 NULL, HFILL
8865                         }
8866                 },
8867
8868                 {
8869                         &hf_rtp_midi_cj_chapter_n_len,
8870                         {
8871                                 "Chapter N Length",
8872                                 "rtpmidi.cj_chapter_n_length",
8873                                 FT_UINT16,
8874                                 BASE_DEC,
8875                                 NULL,
8876                                 0x7f00,
8877                                 NULL, HFILL
8878                         }
8879                 },
8880
8881                 {
8882                         &hf_rtp_midi_cj_chapter_n_low,
8883                         {
8884                                 "Chapter N Low",
8885                                 "rtpmidi.cj_chapter_n_low",
8886                                 FT_UINT16,
8887                                 BASE_DEC,
8888                                 NULL,
8889                                 0x00f0,
8890                                 NULL, HFILL
8891                         }
8892                 },
8893
8894                 {
8895                         &hf_rtp_midi_cj_chapter_n_high,
8896                         {
8897                                 "Chapter N High",
8898                                 "rtpmidi.cj_chapter_n_high",
8899                                 FT_UINT16,
8900                                 BASE_DEC,
8901                                 NULL,
8902                                 0x000f,
8903                                 NULL, HFILL
8904                         }
8905                 },
8906
8907                 {
8908                         &hf_rtp_midi_cj_chapter_n_log_sflag,
8909                         {
8910                                 "Chapter N Log S-Flag",
8911                                 "rtpmidi.cj_chapter_n_log_sflag",
8912                                 FT_BOOLEAN,
8913                                 8,
8914                                 TFS(&rtp_midi_js_flag_s),
8915                                 0x80,
8916                                 NULL, HFILL
8917                         }
8918                 },
8919
8920                 {
8921                         &hf_rtp_midi_cj_chapter_n_log_notenum,
8922                         {
8923                                 "Chapter N Log Note",
8924                                 "rtpmidi.cj_chapter_n_log_note",
8925                                 FT_UINT8,
8926                                 BASE_DEC,
8927                                 VALS(rtp_midi_note_values),
8928                                 0x7f,
8929                                 NULL, HFILL
8930                         }
8931                 },
8932
8933                 {
8934                         &hf_rtp_midi_cj_chapter_n_log_yflag,
8935                         {
8936                                 "Chapter N Log Y-Flag",
8937                                 "rtpmidi.cj_chapter_n_log_yflag",
8938                                 FT_BOOLEAN,
8939                                 8,
8940                                 TFS(&rtp_midi_cj_chapter_n_log_flag_y),
8941                                 0x80,
8942                                 NULL, HFILL
8943                         }
8944                 },
8945
8946                 {
8947                         &hf_rtp_midi_cj_chapter_n_log_velocity,
8948                         {
8949                                 "Chapter N Log Velocity",
8950                                 "rtpmidi.cj_chapter_n_log_velocity",
8951                                 FT_UINT8,
8952                                 BASE_DEC,
8953                                 NULL,
8954                                 0x7f,
8955                                 NULL, HFILL
8956                         }
8957                 },
8958
8959                 {
8960                         &hf_rtp_midi_cj_chapter_n_log_octet,
8961                         {
8962                                 "Chapter N Log Octet",
8963                                 "rtpmidi.cj_chapter_n_log_octet",
8964                                 FT_UINT8,
8965                                 BASE_HEX,
8966                                 NULL,
8967                                 0xff,
8968                                 NULL, HFILL
8969                         }
8970                 },
8971
8972                 {
8973                         &hf_rtp_midi_cj_chapter_e_sflag,
8974                         {
8975                                 "Chapter E S-Flag",
8976                                 "rtpmidi.cj_chapter_e_sflag",
8977                                 FT_BOOLEAN,
8978                                 8,
8979                                 TFS(&rtp_midi_js_flag_s),
8980                                 0x80,
8981                                 NULL, HFILL
8982                         }
8983                 },
8984
8985                 {
8986                         &hf_rtp_midi_cj_chapter_e_len,
8987                         {
8988                                 "Chapter E Length",
8989                                 "rtpmidi.cj_chapter_e_length",
8990                                 FT_UINT8,
8991                                 BASE_DEC,
8992                                 NULL,
8993                                 0x7f,
8994                                 NULL, HFILL
8995                         }
8996                 },
8997
8998                 {
8999                         &hf_rtp_midi_cj_chapter_e_log_sflag,
9000                         {
9001                                 "Chapter E Log S-Flag",
9002                                 "rtpmidi.cj_chapter_e_log_sflag",
9003                                 FT_BOOLEAN,
9004                                 8,
9005                                 TFS(&rtp_midi_js_flag_s),
9006                                 0x80,
9007                                 NULL, HFILL
9008                         }
9009                 },
9010
9011                 {
9012                         &hf_rtp_midi_cj_chapter_e_log_notenum,
9013                         {
9014                                 "Chapter E Log Note",
9015                                 "rtpmidi.cj_chapter_e_log_note",
9016                                 FT_UINT8,
9017                                 BASE_DEC,
9018                                 VALS(rtp_midi_note_values),
9019                                 0x7f,
9020                                 NULL, HFILL
9021                         }
9022                 },
9023
9024                 {
9025                         &hf_rtp_midi_cj_chapter_e_log_vflag,
9026                         {
9027                                 "Chapter N Log V-Flag",
9028                                 "rtpmidi.cj_chapter_n_log_vflag",
9029                                 FT_BOOLEAN,
9030                                 8,
9031                                 TFS(&rtp_midi_cj_chapter_e_log_flag_v),
9032                                 0x80,
9033                                 NULL, HFILL
9034                         }
9035                 },
9036
9037                 {
9038                         &hf_rtp_midi_cj_chapter_e_log_velocity,
9039                         {
9040                                 "Chapter E Log Velocity",
9041                                 "rtpmidi.cj_chapter_e_log_velocity",
9042                                 FT_UINT8,
9043                                 BASE_DEC,
9044                                 NULL,
9045                                 0x7f,
9046                                 NULL, HFILL
9047                         }
9048                 },
9049
9050                 {
9051                         &hf_rtp_midi_cj_chapter_e_log_count,
9052                         {
9053                                 "Chapter E Log Count",
9054                                 "rtpmidi.cj_chapter_e_log_count",
9055                                 FT_UINT8,
9056                                 BASE_DEC,
9057                                 NULL,
9058                                 0x7f,
9059                                 NULL, HFILL
9060                         }
9061                 },
9062
9063                 {
9064                         &hf_rtp_midi_cj_chapter_t_sflag,
9065                         {
9066                                 "Chapter T S-Flag",
9067                                 "rtpmidi.cj_chapter_t_sflag",
9068                                 FT_BOOLEAN,
9069                                 8,
9070                                 TFS(&rtp_midi_js_flag_s),
9071                                 0x80,
9072                                 NULL, HFILL
9073                         }
9074                 },
9075
9076                 {
9077                         &hf_rtp_midi_cj_chapter_t_pressure,
9078                         {
9079                                 "Chapter T Pressure",
9080                                 "rtpmidi.cj_chapter_t_pressure",
9081                                 FT_UINT8,
9082                                 BASE_DEC,
9083                                 NULL,
9084                                 0x7f,
9085                                 NULL, HFILL
9086                         }
9087                 },
9088
9089                 {
9090                         &hf_rtp_midi_cj_chapter_a_sflag,
9091                         {
9092                                 "Chapter A S-Flag",
9093                                 "rtpmidi.cj_chapter_a_sflag",
9094                                 FT_BOOLEAN,
9095                                 8,
9096                                 TFS(&rtp_midi_js_flag_s),
9097                                 0x80,
9098                                 NULL, HFILL
9099                         }
9100                 },
9101
9102                 {
9103                         &hf_rtp_midi_cj_chapter_a_len,
9104                         {
9105                                 "Chapter A Length",
9106                                 "rtpmidi.cj_chapter_a_length",
9107                                 FT_UINT8,
9108                                 BASE_DEC,
9109                                 NULL,
9110                                 0x7f,
9111                                 NULL, HFILL
9112                         }
9113                 },
9114
9115                 {
9116                         &hf_rtp_midi_cj_chapter_a_log_sflag,
9117                         {
9118                                 "Chapter A Log S-Flag",
9119                                 "rtpmidi.cj_chapter_a_log_sflag",
9120                                 FT_BOOLEAN,
9121                                 8,
9122                                 TFS(&rtp_midi_js_flag_s),
9123                                 0x80,
9124                                 NULL, HFILL
9125                         }
9126                 },
9127
9128                 {
9129                         &hf_rtp_midi_cj_chapter_a_log_notenum,
9130                         {
9131                                 "Chapter A Log Note",
9132                                 "rtpmidi.cj_chapter_a_log_note",
9133                                 FT_UINT8,
9134                                 BASE_DEC,
9135                                 VALS(rtp_midi_note_values),
9136                                 0x7f,
9137                                 NULL, HFILL
9138                         }
9139                 },
9140
9141                 {
9142                         &hf_rtp_midi_cj_chapter_a_log_xflag,
9143                         {
9144                                 "Chapter A Log X-Flag",
9145                                 "rtpmidi.cj_chapter_a_log_xflag",
9146                                 FT_BOOLEAN,
9147                                 8,
9148                                 TFS(&rtp_midi_cj_chapter_a_log_flag_x),
9149                                 0x80,
9150                                 NULL, HFILL
9151                         }
9152                 },
9153
9154                 {
9155                         &hf_rtp_midi_cj_chapter_a_log_pressure,
9156                         {
9157                                 "Chapter A Log Pressure",
9158                                 "rtpmidi.cj_chapter_a_log_pressure",
9159                                 FT_UINT8,
9160                                 BASE_DEC,
9161                                 NULL,
9162                                 0x7f,
9163                                 NULL, HFILL
9164                         }
9165                 },
9166
9167                 {
9168                         &hf_rtp_midi_sj_chapter_v_sflag,
9169                         {
9170                                 "Chapter V S-Flag",
9171                                 "rtpmidi.sj_chapter_v_sflag",
9172                                 FT_BOOLEAN,
9173                                 8,
9174                                 TFS(&rtp_midi_js_flag_s),
9175                                 0x80,
9176                                 NULL, HFILL
9177                         }
9178                 },
9179
9180                 {
9181                         &hf_rtp_midi_sj_chapter_v_count,
9182                         {
9183                                 "Chapter V Count",
9184                                 "rtpmidi.sj_chapter_v_count",
9185                                 FT_UINT8,
9186                                 BASE_DEC,
9187                                 NULL,
9188                                 0x7f,
9189                                 NULL, HFILL
9190                         }
9191                 },
9192
9193                 {
9194                         &hf_rtp_midi_sj_chapter_d_sflag,
9195                         {
9196                                 "Chapter D S-Flag",
9197                                 "rtpmidi.sj_chapter_d_sflag",
9198                                 FT_BOOLEAN,
9199                                 8,
9200                                 TFS(&rtp_midi_js_flag_s),
9201                                 RTP_MIDI_SJ_CHAPTER_D_FLAG_S,
9202                                 NULL, HFILL
9203                         }
9204                 },
9205
9206                 {
9207                         &hf_rtp_midi_sj_chapter_d_bflag,
9208                         {
9209                                 "Chapter D B-Flag",
9210                                 "rtpmidi.sj_chapter_d_bflag",
9211                                 FT_BOOLEAN,
9212                                 8,
9213                                 TFS(&rtp_midi_sj_chapter_d_flag_b),
9214                                 RTP_MIDI_SJ_CHAPTER_D_FLAG_B,
9215                                 NULL, HFILL
9216                         }
9217                 },
9218
9219                 {
9220                         &hf_rtp_midi_sj_chapter_d_gflag,
9221                         {
9222                                 "Chapter D G-Flag",
9223                                 "rtpmidi.sj_chapter_d_gflag",
9224                                 FT_BOOLEAN,
9225                                 8,
9226                                 TFS(&rtp_midi_sj_chapter_d_flag_g),
9227                                 RTP_MIDI_SJ_CHAPTER_D_FLAG_G,
9228                                 NULL, HFILL
9229                         }
9230                 },
9231
9232                 {
9233                         &hf_rtp_midi_sj_chapter_d_hflag,
9234                         {
9235                                 "Chapter D H-Flag",
9236                                 "rtpmidi.sj_chapter_d_hflag",
9237                                 FT_BOOLEAN,
9238                                 8,
9239                                 TFS(&rtp_midi_sj_chapter_d_flag_h),
9240                                 RTP_MIDI_SJ_CHAPTER_D_FLAG_H,
9241                                 NULL, HFILL
9242                         }
9243                 },
9244
9245                 {
9246                         &hf_rtp_midi_sj_chapter_d_jflag,
9247                         {
9248                                 "Chapter D J-Flag",
9249                                 "rtpmidi.sj_chapter_d_jflag",
9250                                 FT_BOOLEAN,
9251                                 8,
9252                                 TFS(&rtp_midi_sj_chapter_d_flag_j),
9253                                 RTP_MIDI_SJ_CHAPTER_D_FLAG_J,
9254                                 NULL, HFILL
9255                         }
9256                 },
9257
9258                 {
9259                         &hf_rtp_midi_sj_chapter_d_kflag,
9260                         {
9261                                 "Chapter D K-Flag",
9262                                 "rtpmidi.sj_chapter_d_kflag",
9263                                 FT_BOOLEAN,
9264                                 8,
9265                                 TFS(&rtp_midi_sj_chapter_d_flag_k),
9266                                 RTP_MIDI_SJ_CHAPTER_D_FLAG_K,
9267                                 NULL, HFILL
9268                         }
9269                 },
9270
9271                 {
9272                         &hf_rtp_midi_sj_chapter_d_yflag,
9273                         {
9274                                 "Chapter D Y-Flag",
9275                                 "rtpmidi.sj_chapter_d_yflag",
9276                                 FT_BOOLEAN,
9277                                 8,
9278                                 TFS(&rtp_midi_sj_chapter_d_flag_y),
9279                                 RTP_MIDI_SJ_CHAPTER_D_FLAG_Y,
9280                                 NULL, HFILL
9281                         }
9282                 },
9283
9284                 {
9285                         &hf_rtp_midi_sj_chapter_d_zflag,
9286                         {
9287                                 "Chapter D Z-Flag",
9288                                 "rtpmidi.sj_chapter_d_zflag",
9289                                 FT_BOOLEAN,
9290                                 8,
9291                                 TFS(&rtp_midi_sj_chapter_d_flag_z),
9292                                 RTP_MIDI_SJ_CHAPTER_D_FLAG_Z,
9293                                 NULL, HFILL
9294                         }
9295                 },
9296
9297                 {
9298                         &hf_rtp_midi_sj_chapter_d_reset_sflag,
9299                         {
9300                                 "Chapter D Reset S-Flag",
9301                                 "rtpmidi.sj_chapter_d_reset_sflag",
9302                                 FT_BOOLEAN,
9303                                 8,
9304                                 TFS(&rtp_midi_js_flag_s),
9305                                 RTP_MIDI_SJ_CHAPTER_D_RESET_FLAG_S,
9306                                 NULL, HFILL
9307                         }
9308                 },
9309
9310                 {
9311                         &hf_rtp_midi_sj_chapter_d_reset_count,
9312                         {
9313                                 "Chapter D Reset Count",
9314                                 "rtpmidi.cj_chapter_d_reset_count",
9315                                 FT_UINT8,
9316                                 BASE_DEC,
9317                                 NULL,
9318                                 RTP_MIDI_SJ_CHAPTER_D_RESET_COUNT,
9319                                 NULL, HFILL
9320                         }
9321                 },
9322
9323                 {
9324                         &hf_rtp_midi_sj_chapter_d_tune_sflag,
9325                         {
9326                                 "Chapter D Tune Request S-Flag",
9327                                 "rtpmidi.sj_chapter_d_tune_sflag",
9328                                 FT_BOOLEAN,
9329                                 8,
9330                                 TFS(&rtp_midi_js_flag_s),
9331                                 RTP_MIDI_SJ_CHAPTER_D_TUNE_FLAG_S,
9332                                 NULL, HFILL
9333                         }
9334                 },
9335
9336                 {
9337                         &hf_rtp_midi_sj_chapter_d_tune_count,
9338                         {
9339                                 "Chapter D Tune Request Count",
9340                                 "rtpmidi.cj_chapter_d_tune_count",
9341                                 FT_UINT8,
9342                                 BASE_DEC,
9343                                 NULL,
9344                                 RTP_MIDI_SJ_CHAPTER_D_TUNE_COUNT,
9345                                 NULL, HFILL
9346                         }
9347                 },
9348
9349                 {
9350                         &hf_rtp_midi_sj_chapter_d_song_sel_sflag,
9351                         {
9352                                 "Chapter D Song Select S-Flag",
9353                                 "rtpmidi.sj_chapter_d_song_sel_sflag",
9354                                 FT_BOOLEAN,
9355                                 8,
9356                                 TFS(&rtp_midi_js_flag_s),
9357                                 RTP_MIDI_SJ_CHAPTER_D_SONG_SEL_FLAG_S,
9358                                 NULL, HFILL
9359                         }
9360                 },
9361
9362                 {
9363                         &hf_rtp_midi_sj_chapter_d_song_sel_value,
9364                         {
9365                                 "Chapter D Song Select Value",
9366                                 "rtpmidi.cj_chapter_d_song_sel_value",
9367                                 FT_UINT8,
9368                                 BASE_DEC,
9369                                 NULL,
9370                                 RTP_MIDI_SJ_CHAPTER_D_SONG_SEL_VALUE,
9371                                 NULL, HFILL
9372                         }
9373                 },
9374
9375                 {
9376                         &hf_rtp_midi_sj_chapter_d_syscom_sflag,
9377                         {
9378                                 "Chapter D System Common (F4/F5) S-Flag",
9379                                 "rtpmidi.sj_chapter_d_syscom_sflag",
9380                                 FT_BOOLEAN,
9381                                 16,
9382                                 TFS(&rtp_midi_js_flag_s),
9383                                 RTP_MIDI_SJ_CHAPTER_D_SYSCOM_FLAG_S,
9384                                 NULL, HFILL
9385                         }
9386                 },
9387
9388                 {
9389                         &hf_rtp_midi_sj_chapter_d_syscom_cflag,
9390                         {
9391                                 "Chapter D System Common (F4/F5) C-Flag",
9392                                 "rtpmidi.sj_chapter_d_syscom_cflag",
9393                                 FT_BOOLEAN,
9394                                 16,
9395                                 TFS(&rtp_midi_sj_chapter_d_syscom_flag_c),
9396                                 RTP_MIDI_SJ_CHAPTER_D_SYSCOM_FLAG_C,
9397                                 NULL, HFILL
9398                         }
9399                 },
9400                 {
9401                         &hf_rtp_midi_sj_chapter_d_syscom_vflag,
9402                         {
9403                                 "Chapter D System Common (F4/F5) V-Flag",
9404                                 "rtpmidi.sj_chapter_d_syscom_vflag",
9405                                 FT_BOOLEAN,
9406                                 16,
9407                                 TFS(&rtp_midi_sj_chapter_d_syscom_flag_v),
9408                                 RTP_MIDI_SJ_CHAPTER_D_SYSCOM_FLAG_V,
9409                                 NULL, HFILL
9410                         }
9411                 },
9412                 {
9413                         &hf_rtp_midi_sj_chapter_d_syscom_lflag,
9414                         {
9415                                 "Chapter D System Common (F4/F5) L-Flag",
9416                                 "rtpmidi.sj_chapter_d_syscom_lflag",
9417                                 FT_BOOLEAN,
9418                                 16,
9419                                 TFS(&rtp_midi_sj_chapter_d_syscom_flag_l),
9420                                 RTP_MIDI_SJ_CHAPTER_D_SYSCOM_FLAG_L,
9421                                 NULL, HFILL
9422                         }
9423                 },
9424                 {
9425                         &hf_rtp_midi_sj_chapter_d_syscom_dsz,
9426                         {
9427                                 "Chapter D System Common (F4/F5) DSZ",
9428                                 "rtpmidi.sj_chapter_d_syscom_dsz",
9429                                 FT_UINT16,
9430                                 BASE_DEC,
9431                                 VALS(rtp_midi_sj_chapter_d_syscom_dsz_values),
9432                                 RTP_MIDI_SJ_CHAPTER_D_SYSCOM_MASK_DSZ,
9433                                 NULL, HFILL
9434                         }
9435                 },
9436                 {
9437                         &hf_rtp_midi_sj_chapter_d_syscom_length,
9438                         {
9439                                 "Chapter D System Common (F4/F5) Length",
9440                                 "rtpmidi.sj_chapter_d_syscom_len",
9441                                 FT_UINT16,
9442                                 BASE_DEC,
9443                                 NULL,
9444                                 RTP_MIDI_SJ_CHAPTER_D_SYSCOM_MASK_LENGTH,
9445                                 NULL, HFILL
9446                         }
9447                 },
9448                 {
9449                         &hf_rtp_midi_sj_chapter_d_syscom_count,
9450                         {
9451                                 "Chapter D System Common (F4/F5) Count",
9452                                 "rtpmidi.sj_chapter_d_syscom_count",
9453                                 FT_UINT8,
9454                                 BASE_DEC,
9455                                 NULL,
9456                                 RTP_MIDI_SJ_CHAPTER_D_SYSCOM_MASK_COUNT,
9457                                 NULL, HFILL
9458                         }
9459                 },
9460                 {
9461                         &hf_rtp_midi_sj_chapter_d_syscom_value,
9462                         {
9463                                 "Chapter D System Common (F4/F5) Value",
9464                                 "rtpmidi.sj_chapter_d_syscom_value",
9465                                 FT_BYTES,
9466                                 BASE_NONE,
9467                                 NULL,
9468                                 0x00,
9469                                 NULL, HFILL
9470                         }
9471                 },
9472                 {
9473                         &hf_rtp_midi_sj_chapter_d_syscom_legal,
9474                         {
9475                                 "Chapter D System Common (F4/F5) Legal - for future extension",
9476                                 "rtpmidi.sj_chapter_d_syscom_legal",
9477                                 FT_BYTES,
9478                                 BASE_NONE,
9479                                 NULL,
9480                                 0x00,
9481                                 NULL, HFILL
9482                         }
9483                 },
9484                 {
9485                         &hf_rtp_midi_sj_chapter_d_syscom_data,
9486                         {
9487                                 "Chapter D System Common (F4/F5) Erroneous Data",
9488                                 "rtpmidi.sj_chapter_d_syscom_data",
9489                                 FT_BYTES,
9490                                 BASE_NONE,
9491                                 NULL,
9492                                 0x00,
9493                                 NULL, HFILL
9494                         }
9495                 },
9496                 {
9497                         &hf_rtp_midi_sj_chapter_d_sysreal_sflag,
9498                         {
9499                                 "Chapter D System Realtime (F9/FD) S-Flag",
9500                                 "rtpmidi.sj_chapter_d_sysreal_sflag",
9501                                 FT_BOOLEAN,
9502                                 8,
9503                                 TFS(&rtp_midi_js_flag_s),
9504                                 RTP_MIDI_SJ_CHAPTER_D_SYSREAL_FLAG_S,
9505                                 NULL, HFILL
9506                         }
9507                 },
9508                 {
9509                         &hf_rtp_midi_sj_chapter_d_sysreal_cflag,
9510                         {
9511                                 "Chapter D System Realtime (F9/FF) C-Flag",
9512                                 "rtpmidi.sj_chapter_d_sysreal_cflag",
9513                                 FT_BOOLEAN,
9514                                 8,
9515                                 TFS(&rtp_midi_sj_chapter_d_syscom_flag_c),
9516                                 RTP_MIDI_SJ_CHAPTER_D_SYSREAL_FLAG_C,
9517                                 NULL, HFILL
9518                         }
9519                 },
9520                 {
9521                         &hf_rtp_midi_sj_chapter_d_sysreal_lflag,
9522                         {
9523                                 "Chapter D System Realtime (F9/FD) L-Flag",
9524                                 "rtpmidi.sj_chapter_d_sysreal_lflag",
9525                                 FT_BOOLEAN,
9526                                 8,
9527                                 TFS(&rtp_midi_sj_chapter_d_syscom_flag_l),
9528                                 RTP_MIDI_SJ_CHAPTER_D_SYSREAL_FLAG_L,
9529                                 NULL, HFILL
9530                         }
9531                 },
9532                 {
9533                         &hf_rtp_midi_sj_chapter_d_sysreal_length,
9534                         {
9535                                 "Chapter D System Realtime (F9/FD) Length",
9536                                 "rtpmidi.sj_chapter_d_sysreal_len",
9537                                 FT_UINT8,
9538                                 BASE_DEC,
9539                                 NULL,
9540                                 RTP_MIDI_SJ_CHAPTER_D_SYSREAL_MASK_LENGTH,
9541                                 NULL, HFILL
9542                         }
9543                 },
9544                 {
9545                         &hf_rtp_midi_sj_chapter_d_sysreal_count,
9546                         {
9547                                 "Chapter D System Realtime (F9/FD) Count",
9548                                 "rtpmidi.sj_chapter_d_sysreal_count",
9549                                 FT_UINT8,
9550                                 BASE_DEC,
9551                                 NULL,
9552                                 RTP_MIDI_SJ_CHAPTER_D_SYSREAL_MASK_COUNT,
9553                                 NULL, HFILL
9554                         }
9555                 },
9556                 {
9557                         &hf_rtp_midi_sj_chapter_d_sysreal_legal,
9558                         {
9559                                 "Chapter D System Realtime (F9/FD) Legal - for future extension",
9560                                 "rtpmidi.sj_chapter_d_sysreal_legal",
9561                                 FT_BYTES,
9562                                 BASE_NONE,
9563                                 NULL,
9564                                 0x00,
9565                                 NULL, HFILL
9566                         }
9567                 },
9568                 {
9569                         &hf_rtp_midi_sj_chapter_d_sysreal_data,
9570                         {
9571                                 "Chapter D System Realtime (F9/FD) Erroneous Data",
9572                                 "rtpmidi.sj_chapter_d_sysreal_data",
9573                                 FT_BYTES,
9574                                 BASE_NONE,
9575                                 NULL,
9576                                 0x00,
9577                                 NULL, HFILL
9578                         }
9579                 },
9580
9581                 {
9582                         &hf_rtp_midi_sj_chapter_q_sflag,
9583                         {
9584                                 "Chapter Q Sequencer State S-Flag",
9585                                 "rtpmidi.sj_chapter_q_sflag",
9586                                 FT_BOOLEAN,
9587                                 8,
9588                                 TFS(&rtp_midi_js_flag_s),
9589                                 RTP_MIDI_SJ_CHAPTER_Q_FLAG_S,
9590                                 NULL, HFILL
9591                         }
9592                 },
9593
9594                 {
9595                         &hf_rtp_midi_sj_chapter_q_nflag,
9596                         {
9597                                 "Chapter Q Sequencer State N-Flag",
9598                                 "rtpmidi.sj_chapter_q_nflag",
9599                                 FT_BOOLEAN,
9600                                 8,
9601                                 TFS(&rtp_midi_sj_chapter_q_flag_n),
9602                                 RTP_MIDI_SJ_CHAPTER_Q_FLAG_N,
9603                                 NULL, HFILL
9604                         }
9605                 },
9606
9607                 {
9608                         &hf_rtp_midi_sj_chapter_q_dflag,
9609                         {
9610                                 "Chapter Q Sequencer State D-Flag",
9611                                 "rtpmidi.sj_chapter_q_dflag",
9612                                 FT_BOOLEAN,
9613                                 8,
9614                                 TFS(&rtp_midi_sj_chapter_q_flag_d),
9615                                 RTP_MIDI_SJ_CHAPTER_Q_FLAG_D,
9616                                 NULL, HFILL
9617                         }
9618                 },
9619
9620                 {
9621                         &hf_rtp_midi_sj_chapter_q_cflag,
9622                         {
9623                                 "Chapter Q Sequencer State C-Flag",
9624                                 "rtpmidi.sj_chapter_q_cflag",
9625                                 FT_BOOLEAN,
9626                                 8,
9627                                 TFS(&rtp_midi_sj_chapter_q_flag_c),
9628                                 RTP_MIDI_SJ_CHAPTER_Q_FLAG_C,
9629                                 NULL, HFILL
9630                         }
9631                 },
9632                 {
9633                         &hf_rtp_midi_sj_chapter_q_tflag,
9634                         {
9635                                 "Chapter Q Sequencer State T-Flag",
9636                                 "rtpmidi.sj_chapter_q_tflag",
9637                                 FT_BOOLEAN,
9638                                 8,
9639                                 TFS(&rtp_midi_sj_chapter_q_flag_t),
9640                                 RTP_MIDI_SJ_CHAPTER_Q_FLAG_T,
9641                                 NULL, HFILL
9642                         }
9643                 },
9644                 {
9645                         &hf_rtp_midi_sj_chapter_q_top,
9646                         {
9647                                 "Chapter Q Sequencer State Top",
9648                                 "rtpmidi.sj_chapter_q_top",
9649                                 FT_UINT8,
9650                                 BASE_DEC,
9651                                 NULL,
9652                                 RTP_MIDI_SJ_CHAPTER_Q_MASK_TOP,
9653                                 NULL, HFILL
9654                         }
9655                 },
9656                 {
9657                         &hf_rtp_midi_sj_chapter_q_clock,
9658                         {
9659                                 "Chapter Q Sequencer State Clock",
9660                                 "rtpmidi.sj_chapter_q_clock",
9661                                 FT_UINT24,
9662                                 BASE_DEC,
9663                                 NULL,
9664                                 RTP_MIDI_SJ_CHAPTER_Q_MASK_CLOCK,
9665                                 NULL, HFILL
9666                         }
9667                 },
9668
9669                 {
9670                         &hf_rtp_midi_sj_chapter_q_timetools,
9671                         {
9672                                 "Chapter Q Sequencer State Timetools",
9673                                 "rtpmidi.sj_chapter_q_timetools",
9674                                 FT_UINT24,
9675                                 BASE_DEC,
9676                                 NULL,
9677                                 RTP_MIDI_SJ_CHAPTER_Q_MASK_TIMETOOLS,
9678                                 NULL, HFILL
9679                         }
9680                 },
9681
9682                 {
9683                         &hf_rtp_midi_sj_chapter_f_sflag,
9684                         {
9685                                 "Chapter F MTC S-Flag",
9686                                 "rtpmidi.sj_chapter_f_sflag",
9687                                 FT_BOOLEAN,
9688                                 8,
9689                                 TFS(&rtp_midi_js_flag_s),
9690                                 RTP_MIDI_SJ_CHAPTER_F_FLAG_S,
9691                                 NULL, HFILL
9692                         }
9693                 },
9694                 {
9695                         &hf_rtp_midi_sj_chapter_f_cflag,
9696                         {
9697                                 "Chapter F MTC C-Flag",
9698                                 "rtpmidi.sj_chapter_f_cflag",
9699                                 FT_BOOLEAN,
9700                                 8,
9701                                 TFS(&rtp_midi_sj_chapter_f_flag_c),
9702                                 RTP_MIDI_SJ_CHAPTER_F_FLAG_C,
9703                                 NULL, HFILL
9704                         }
9705                 },
9706                 {
9707                         &hf_rtp_midi_sj_chapter_f_pflag,
9708                         {
9709                                 "Chapter F MTC P-Flag",
9710                                 "rtpmidi.sj_chapter_f_pflag",
9711                                 FT_BOOLEAN,
9712                                 8,
9713                                 TFS(&rtp_midi_sj_chapter_f_flag_p),
9714                                 RTP_MIDI_SJ_CHAPTER_F_FLAG_P,
9715                                 NULL, HFILL
9716                         }
9717                 },
9718                 {
9719                         &hf_rtp_midi_sj_chapter_f_qflag,
9720                         {
9721                                 "Chapter F MTC Q-Flag",
9722                                 "rtpmidi.sj_chapter_f_qflag",
9723                                 FT_BOOLEAN,
9724                                 8,
9725                                 TFS(&rtp_midi_sj_chapter_f_flag_q),
9726                                 RTP_MIDI_SJ_CHAPTER_F_FLAG_Q,
9727                                 NULL, HFILL
9728                         }
9729                 },
9730                 {
9731                         &hf_rtp_midi_sj_chapter_f_dflag,
9732                         {
9733                                 "Chapter F MTC D-Flag",
9734                                 "rtpmidi.sj_chapter_f_dflag",
9735                                 FT_BOOLEAN,
9736                                 8,
9737                                 TFS(&rtp_midi_sj_chapter_f_flag_d),
9738                                 RTP_MIDI_SJ_CHAPTER_F_FLAG_D,
9739                                 NULL, HFILL
9740                         }
9741                 },
9742                 {
9743                         &hf_rtp_midi_sj_chapter_f_point,
9744                         {
9745                                 "Chapter F MTC Point",
9746                                 "rtpmidi.sj_chapter_f_point",
9747                                 FT_UINT8,
9748                                 BASE_DEC,
9749                                 NULL,
9750                                 RTP_MIDI_SJ_CHAPTER_F_MASK_POINT,
9751                                 NULL, HFILL
9752                         }
9753                 },
9754                 {
9755                         &hf_rtp_midi_sj_chapter_f_mt0,
9756                         {
9757                                 "Chapter F MTC MT0",
9758                                 "rtpmidi.sj_chapter_f_mt0",
9759                                 FT_UINT32,
9760                                 BASE_HEX,
9761                                 NULL,
9762                                 RTP_MIDI_SJ_CHAPTER_F_MASK_MT0,
9763                                 NULL, HFILL
9764                         }
9765                 },
9766                 {
9767                         &hf_rtp_midi_sj_chapter_f_mt1,
9768                         {
9769                                 "Chapter F MTC MT1",
9770                                 "rtpmidi.sj_chapter_f_mt1",
9771                                 FT_UINT32,
9772                                 BASE_HEX,
9773                                 NULL,
9774                                 RTP_MIDI_SJ_CHAPTER_F_MASK_MT1,
9775                                 NULL, HFILL
9776                         }
9777                 },
9778                 {
9779                         &hf_rtp_midi_sj_chapter_f_mt2,
9780                         {
9781                                 "Chapter F MTC MT2",
9782                                 "rtpmidi.sj_chapter_f_mt2",
9783                                 FT_UINT32,
9784                                 BASE_HEX,
9785                                 NULL,
9786                                 RTP_MIDI_SJ_CHAPTER_F_MASK_MT2,
9787                                 NULL, HFILL
9788                         }
9789                 },
9790                 {
9791                         &hf_rtp_midi_sj_chapter_f_mt3,
9792                         {
9793                                 "Chapter F MTC MT3",
9794                                 "rtpmidi.sj_chapter_f_mt3",
9795                                 FT_UINT32,
9796                                 BASE_HEX,
9797                                 NULL,
9798                                 RTP_MIDI_SJ_CHAPTER_F_MASK_MT3,
9799                                 NULL, HFILL
9800                         }
9801                 },
9802                 {
9803                         &hf_rtp_midi_sj_chapter_f_mt4,
9804                         {
9805                                 "Chapter F MTC MT4",
9806                                 "rtpmidi.sj_chapter_f_mt4",
9807                                 FT_UINT32,
9808                                 BASE_HEX,
9809                                 NULL,
9810                                 RTP_MIDI_SJ_CHAPTER_F_MASK_MT4,
9811                                 NULL, HFILL
9812                         }
9813                 },
9814                 {
9815                         &hf_rtp_midi_sj_chapter_f_mt5,
9816                         {
9817                                 "Chapter F MTC MT5",
9818                                 "rtpmidi.sj_chapter_f_mt5",
9819                                 FT_UINT32,
9820                                 BASE_HEX,
9821                                 NULL,
9822                                 RTP_MIDI_SJ_CHAPTER_F_MASK_MT5,
9823                                 NULL, HFILL
9824                         }
9825                 },
9826                 {
9827                         &hf_rtp_midi_sj_chapter_f_mt6,
9828                         {
9829                                 "Chapter F MTC MT6",
9830                                 "rtpmidi.sj_chapter_f_mt6",
9831                                 FT_UINT32,
9832                                 BASE_HEX,
9833                                 NULL,
9834                                 RTP_MIDI_SJ_CHAPTER_F_MASK_MT6,
9835                                 NULL, HFILL
9836                         }
9837                 },
9838                 {
9839                         &hf_rtp_midi_sj_chapter_f_mt7,
9840                         {
9841                                 "Chapter F MTC MT7",
9842                                 "rtpmidi.sj_chapter_f_mt7",
9843                                 FT_UINT32,
9844                                 BASE_HEX,
9845                                 NULL,
9846                                 RTP_MIDI_SJ_CHAPTER_F_MASK_MT7,
9847                                 NULL, HFILL
9848                         }
9849                 },
9850                 {
9851                         &hf_rtp_midi_sj_chapter_f_hr,
9852                         {
9853                                 "Chapter F MTC Hour",
9854                                 "rtpmidi.sj_chapter_f_hr",
9855                                 FT_UINT32,
9856                                 BASE_HEX,
9857                                 NULL,
9858                                 RTP_MIDI_SJ_CHAPTER_F_MASK_HR,
9859                                 NULL, HFILL
9860                         }
9861                 },
9862                 {
9863                         &hf_rtp_midi_sj_chapter_f_mn,
9864                         {
9865                                 "Chapter F MTC Minute",
9866                                 "rtpmidi.sj_chapter_f_mn",
9867                                 FT_UINT32,
9868                                 BASE_HEX,
9869                                 NULL,
9870                                 RTP_MIDI_SJ_CHAPTER_F_MASK_MN,
9871                                 NULL, HFILL
9872                         }
9873                 },
9874                 {
9875                         &hf_rtp_midi_sj_chapter_f_sc,
9876                         {
9877                                 "Chapter F MTC Second",
9878                                 "rtpmidi.sj_chapter_f_sc",
9879                                 FT_UINT32,
9880                                 BASE_HEX,
9881                                 NULL,
9882                                 RTP_MIDI_SJ_CHAPTER_F_MASK_SC,
9883                                 NULL, HFILL
9884                         }
9885                 },
9886                 {
9887                         &hf_rtp_midi_sj_chapter_f_fr,
9888                         {
9889                                 "Chapter F MTC Frame",
9890                                 "rtpmidi.sj_chapter_f_fr",
9891                                 FT_UINT32,
9892                                 BASE_HEX,
9893                                 NULL,
9894                                 RTP_MIDI_SJ_CHAPTER_F_MASK_FR,
9895                                 NULL, HFILL
9896                         }
9897                 },
9898                 {
9899                         &hf_rtp_midi_sj_chapter_x_sflag,
9900                         {
9901                                 "Chapter X Sysex S-Flag",
9902                                 "rtpmidi.sj_chapter_x_sflag",
9903                                 FT_BOOLEAN,
9904                                 8,
9905                                 TFS(&rtp_midi_js_flag_s),
9906                                 RTP_MIDI_SJ_CHAPTER_X_FLAG_S,
9907                                 NULL, HFILL
9908                         }
9909                 },
9910                 {
9911                         &hf_rtp_midi_sj_chapter_x_tflag,
9912                         {
9913                                 "Chapter X Sysex T-Flag",
9914                                 "rtpmidi.sj_chapter_x_tflag",
9915                                 FT_BOOLEAN,
9916                                 8,
9917                                 TFS(&rtp_midi_sj_chapter_x_flag_t),
9918                                 RTP_MIDI_SJ_CHAPTER_X_FLAG_T,
9919                                 NULL, HFILL
9920                         }
9921                 },
9922                 {
9923                         &hf_rtp_midi_sj_chapter_x_cflag,
9924                         {
9925                                 "Chapter X Sysex C-Flag",
9926                                 "rtpmidi.sj_chapter_x_cflag",
9927                                 FT_BOOLEAN,
9928                                 8,
9929                                 TFS(&rtp_midi_sj_chapter_x_flag_c),
9930                                 RTP_MIDI_SJ_CHAPTER_X_FLAG_C,
9931                                 NULL, HFILL
9932                         }
9933                 },
9934                 {
9935                         &hf_rtp_midi_sj_chapter_x_fflag,
9936                         {
9937                                 "Chapter X Sysex F-Flag",
9938                                 "rtpmidi.sj_chapter_x_fflag",
9939                                 FT_BOOLEAN,
9940                                 8,
9941                                 TFS(&rtp_midi_sj_chapter_x_flag_f),
9942                                 RTP_MIDI_SJ_CHAPTER_X_FLAG_F,
9943                                 NULL, HFILL
9944                         }
9945                 },
9946                 {
9947                         &hf_rtp_midi_sj_chapter_x_dflag,
9948                         {
9949                                 "Chapter X Sysex D-Flag",
9950                                 "rtpmidi.sj_chapter_x_dflag",
9951                                 FT_BOOLEAN,
9952                                 8,
9953                                 TFS(&rtp_midi_sj_chapter_x_flag_d),
9954                                 RTP_MIDI_SJ_CHAPTER_X_FLAG_D,
9955                                 NULL, HFILL
9956                         }
9957                 },
9958                 {
9959                         &hf_rtp_midi_sj_chapter_x_lflag,
9960                         {
9961                                 "Chapter X Sysex L-Flag",
9962                                 "rtpmidi.sj_chapter_x_lflag",
9963                                 FT_BOOLEAN,
9964                                 8,
9965                                 TFS(&rtp_midi_sj_chapter_x_flag_l),
9966                                 RTP_MIDI_SJ_CHAPTER_X_FLAG_L,
9967                                 NULL, HFILL
9968                         }
9969                 },
9970                 {
9971                         &hf_rtp_midi_sj_chapter_x_sta,
9972                         {
9973                                 "Chapter X Sysex STA",
9974                                 "rtpmidi.sj_chapter_x_sta",
9975                                 FT_UINT8,
9976                                 BASE_HEX,
9977                                 NULL,
9978                                 RTP_MIDI_SJ_CHAPTER_X_MASK_STA,
9979                                 NULL, HFILL
9980                         }
9981                 },
9982                 {
9983                         &hf_rtp_midi_sj_chapter_x_tcount,
9984                         {
9985                                 "Chapter X Sysex TCOUT",
9986                                 "rtpmidi.sj_chapter_x_tcount",
9987                                 FT_UINT8,
9988                                 BASE_DEC,
9989                                 NULL,
9990                                 RTP_MIDI_SJ_CHAPTER_X_MASK_TCOUNT,
9991                                 NULL, HFILL
9992                         }
9993                 },
9994                 {
9995                         &hf_rtp_midi_sj_chapter_x_count,
9996                         {
9997                                 "Chapter X Sysex COUNT",
9998                                 "rtpmidi.sj_chapter_x_count",
9999                                 FT_UINT8,
10000                                 BASE_DEC,
10001                                 NULL,
10002                                 RTP_MIDI_SJ_CHAPTER_X_MASK_COUNT,
10003                                 NULL, HFILL
10004                         }
10005                 },
10006                 {
10007                         &hf_rtp_midi_sj_chapter_x_first1,
10008                         {
10009                                 "Chapter X Sysex FIRST (one octet)",
10010                                 "rtpmidi.sj_chapter_x_first_1",
10011                                 FT_UINT8,
10012                                 BASE_HEX,
10013                                 NULL,
10014                                 0x7f,
10015                                 NULL, HFILL
10016                         }
10017                 },
10018                 {
10019                         &hf_rtp_midi_sj_chapter_x_first2,
10020                         {
10021                                 "Chapter X Sysex FIRST (two octets)",
10022                                 "rtpmidi.sj_chapter_x_first_2",
10023                                 FT_UINT16,
10024                                 BASE_HEX,
10025                                 NULL,
10026                                 0x7f7f,
10027                                 NULL, HFILL
10028                         }
10029                 },
10030                 {
10031                         &hf_rtp_midi_sj_chapter_x_first3,
10032                         {
10033                                 "Chapter X Sysex FIRST (three octets)",
10034                                 "rtpmidi.sj_chapter_x_first_3",
10035                                 FT_UINT24,
10036                                 BASE_HEX,
10037                                 NULL,
10038                                 0x7f7f7f,
10039                                 NULL, HFILL
10040                         }
10041                 },
10042                 {
10043                         &hf_rtp_midi_sj_chapter_x_first4,
10044                         {
10045                                 "Chapter X Sysex FIRST (four octets)",
10046                                 "rtpmidi.sj_chapter_x_first_4",
10047                                 FT_UINT32,
10048                                 BASE_HEX,
10049                                 NULL,
10050                                 0x7f7f7f7f,
10051                                 NULL, HFILL
10052                         }
10053                 },
10054                 {
10055                         &hf_rtp_midi_sj_chapter_x_data,
10056                         {
10057                                 "Chapter X Sysex Data",
10058                                 "rtpmidi.sj_chapter_x_data",
10059                                 FT_BYTES,
10060                                 BASE_NONE,
10061                                 NULL,
10062                                 0x00,
10063                                 NULL, HFILL
10064                         }
10065                 },
10066                 {
10067                         &hf_rtp_midi_sj_chapter_x_invalid_data,
10068                         {
10069                                 "Chapter X Invalid Sysex Data",
10070                                 "rtpmidi.sj_chapter_x_invalid_data",
10071                                 FT_BYTES,
10072                                 BASE_NONE,
10073                                 NULL,
10074                                 0x00,
10075                                 NULL, HFILL
10076                         }
10077                 },
10078                 {
10079                         &hf_rtp_midi_quarter_frame_type,
10080                         {
10081                                 "MTC-quarter-frame-type",
10082                                 "rtpmidi.mtc_quarter_frame_type",
10083                                 FT_UINT8,
10084                                 BASE_HEX,
10085                                 VALS(rtp_midi_qft_values),
10086                                 0x70,
10087                                 NULL, HFILL
10088                         }
10089                 },
10090                 {
10091                         &hf_rtp_midi_quarter_frame_value,
10092                         {
10093                                 "MTC-quarter-frame-value",
10094                                 "rtpmidi.mtc_quarter_frame_value",
10095                                 FT_UINT8,
10096                                 BASE_HEX,
10097                                 NULL,
10098                                 0x0f,
10099                                 NULL, HFILL
10100                         }
10101                 },
10102                 {
10103                         &hf_rtp_midi_spp,
10104                         {
10105                                 "Song Position Pointer",
10106                                 "rtpmidi.song_position_pointer",
10107                                 FT_UINT16,
10108                                 BASE_DEC,
10109                                 NULL,
10110                                 0x7f7f,
10111                                 NULL, HFILL
10112                         }
10113                 },
10114                 {
10115                         &hf_rtp_midi_spp_truncated,
10116                         {
10117                                 "Song Position Pointer (truncated)",
10118                                 "rtpmidi.song_position_pointer_truncated",
10119                                 FT_UINT8,
10120                                 BASE_DEC,
10121                                 NULL,
10122                                 0x7f,
10123                                 NULL, HFILL
10124                         }
10125                 },
10126                 {
10127                         &hf_rtp_midi_song_select,
10128                         {
10129                                 "Song Select",
10130                                 "rtpmidi.song_select",
10131                                 FT_UINT8,
10132                                 BASE_DEC,
10133                                 NULL,
10134                                 0x7f,
10135                                 NULL, HFILL
10136                         }
10137                 },
10138                 {
10139                         &hf_rtp_midi_manu_data,
10140                         {
10141                                 "Manufacturer specific data",
10142                                 "rtpmidi.manu_data",
10143                                 FT_BYTES,
10144                                 BASE_NONE,
10145                                 NULL,
10146                                 0x00,
10147                                 NULL, HFILL
10148                         }
10149                 },
10150                 {
10151                         &hf_rtp_midi_edu_data,
10152                         {
10153                                 "Educational command data",
10154                                 "rtpmidi.edu_data",
10155                                 FT_BYTES,
10156                                 BASE_NONE,
10157                                 NULL,
10158                                 0x00,
10159                                 NULL, HFILL
10160                         }
10161                 },
10162                 {
10163                         &hf_rtp_midi_unknown_data,
10164                         {
10165                                 "Unknown Data",
10166                                 "rtpmidi.unknown_data",
10167                                 FT_BYTES,
10168                                 BASE_NONE,
10169                                 NULL,
10170                                 0x00,
10171                                 NULL, HFILL
10172                         }
10173                 },
10174                 {
10175                         &hf_rtp_midi_sysex_common_realtime,
10176                         {
10177                                 "Sysex Common Realtime",
10178                                 "rtpmidi.sysex_common_realtime",
10179                                 FT_UINT8,
10180                                 BASE_HEX,
10181                                 VALS(rtp_midi_sysex_common_rt),
10182                                 0x7f,
10183                                 NULL, HFILL
10184                         }
10185                 },
10186                 {
10187                         &hf_rtp_midi_sysex_common_non_realtime,
10188                         {
10189                                 "Sysex Common Non-Realtime",
10190                                 "rtpmidi.sysex_common_non_realtime",
10191                                 FT_UINT8,
10192                                 BASE_HEX,
10193                                 VALS(rtp_midi_sysex_common_nrt),
10194                                 0x7f,
10195                                 NULL, HFILL
10196                         }
10197                 },
10198                 {
10199                         &hf_rtp_midi_sysex_common_device_id,
10200                         {
10201                                 "Sysex Common Device ID",
10202                                 "rtpmidi.sysex_common_device_id",
10203                                 FT_UINT8,
10204                                 BASE_HEX,
10205                                 NULL,
10206                                 0x7f,
10207                                 NULL, HFILL
10208                         }
10209                 },
10210                 {
10211                         &hf_rtp_midi_sysex_common_nrt_sd_ext,
10212                         {
10213                                 "Sysex Common Non-Realtime Sample Dump Extension",
10214                                 "rtpmidi.sysex_common_non_realtime_sample_dump_ext",
10215                                 FT_UINT8,
10216                                 BASE_HEX,
10217                                 VALS(rtp_midi_sysex_common_nrt_sd_ext),
10218                                 0x7f,
10219                                 NULL, HFILL
10220                         }
10221                 },
10222                 {
10223                         &hf_rtp_midi_sysex_common_nrt_gi,
10224                         {
10225                                 "Sysex Common Non-Realtime General Information",
10226                                 "rtpmidi.sysex_common_non_realtime_general_information",
10227                                 FT_UINT8,
10228                                 BASE_HEX,
10229                                 VALS(rtp_midi_sysex_common_nrt_gi),
10230                                 0x7f,
10231                                 NULL, HFILL
10232                         }
10233                 },
10234                 {
10235                         &hf_rtp_midi_sysex_common_nrt_fd,
10236                         {
10237                                 "Sysex Common Non-Realtime File Dump",
10238                                 "rtpmidi.sysex_common_non_realtime_file_dump",
10239                                 FT_UINT8,
10240                                 BASE_HEX,
10241                                 VALS(rtp_midi_sysex_common_nrt_fd),
10242                                 0x7f,
10243                                 NULL, HFILL
10244                         }
10245                 },
10246                 {
10247                         &hf_rtp_midi_sysex_common_tuning,
10248                         {
10249                                 "Sysex Common (Non-)Realtime Tuning",
10250                                 "rtpmidi.sysex_common_tuning",
10251                                 FT_UINT8,
10252                                 BASE_HEX,
10253                                 VALS(rtp_midi_sysex_common_tuning),
10254                                 0x7f,
10255                                 NULL, HFILL
10256                         }
10257                 },
10258                 {
10259                         &hf_rtp_midi_sysex_common_nrt_gm,
10260                         {
10261                                 "Sysex Common Non-Realtime General MIDI (GM)",
10262                                 "rtpmidi.sysex_common_non_realtime_gm",
10263                                 FT_UINT8,
10264                                 BASE_HEX,
10265                                 VALS(rtp_midi_sysex_common_nrt_gm),
10266                                 0x7f,
10267                                 NULL, HFILL
10268                         }
10269                 },
10270                 {
10271                         &hf_rtp_midi_sysex_common_nrt_dls,
10272                         {
10273                                 "Sysex Common Non-Realtime Downloadable Sounds (DLS)",
10274                                 "rtpmidi.sysex_common_non_realtime_dls",
10275                                 FT_UINT8,
10276                                 BASE_HEX,
10277                                 VALS(rtp_midi_sysex_common_nrt_dls),
10278                                 0x7f,
10279                                 NULL, HFILL
10280                         }
10281                 },
10282                 {
10283                         &hf_rtp_midi_sysex_common_rt_mtc,
10284                         {
10285                                 "Sysex Common Realtime MTC",
10286                                 "rtpmidi.sysex_common_realtime_mtc",
10287                                 FT_UINT8,
10288                                 BASE_HEX,
10289                                 VALS(rtp_midi_sysex_common_rt_mtc),
10290                                 0x7f,
10291                                 NULL, HFILL
10292                         }
10293                 },
10294                 {
10295                         &hf_rtp_midi_sysex_common_rt_sc,
10296                         {
10297                                 "Sysex Common Realtime Show Control",
10298                                 "rtpmidi.sysex_common_realtime_sc",
10299                                 FT_UINT8,
10300                                 BASE_HEX,
10301                                 VALS(rtp_midi_sysex_common_rt_show_control),
10302                                 0x7f,
10303                                 NULL, HFILL
10304                         }
10305                 },
10306                 {
10307                         &hf_rtp_midi_sysex_common_rt_ni,
10308                         {
10309                                 "Sysex Common Realtime Notation Information",
10310                                 "rtpmidi.sysex_common_realtime_ni",
10311                                 FT_UINT8,
10312                                 BASE_HEX,
10313                                 VALS(rtp_midi_sysex_common_rt_notations),
10314                                 0x7f,
10315                                 NULL, HFILL
10316                         }
10317                 },
10318                 {
10319                         &hf_rtp_midi_sysex_common_rt_dc,
10320                         {
10321                                 "Sysex Common Realtime Device Control",
10322                                 "rtpmidi.sysex_common_realtime_dc",
10323                                 FT_UINT8,
10324                                 BASE_HEX,
10325                                 VALS(rtp_midi_sysex_common_rt_device_control),
10326                                 0x7f,
10327                                 NULL, HFILL
10328                         }
10329                 },
10330                 {
10331                         &hf_rtp_midi_sysex_common_rt_mtc_cueing,
10332                         {
10333                                 "Sysex Common Realtime MTC Cueing",
10334                                 "rtpmidi.sysex_common_rt_mtc_cue",
10335                                 FT_UINT8,
10336                                 BASE_HEX,
10337                                 VALS(rtp_midi_sysex_common_rt_mtc_cue),
10338                                 0x7f,
10339                                 NULL, HFILL
10340                         }
10341                 },
10342                 {
10343                         &hf_rtp_midi_sysex_common_nrt_mtc,
10344                         {
10345                                 "Sysex Common Non-Realtime MTC",
10346                                 "rtpmidi.sysex_common_nrt_mtc",
10347                                 FT_UINT8,
10348                                 BASE_HEX,
10349                                 VALS(rtp_midi_sysex_common_nrt_mtc),
10350                                 0x7f,
10351                                 NULL, HFILL
10352                         }
10353                 },
10354                 {
10355                         &hf_rtp_midi_sysex_common_rt_mmc_commands,
10356                         {
10357                                 "Sysex Common Realtime Machine Control Commands",
10358                                 "rtpmidi.sysex_common_realtime_mmc_cmds",
10359                                 FT_UINT8,
10360                                 BASE_HEX,
10361                                 VALS(rtp_midi_sysex_common_rt_mmc_commands),
10362                                 0x7f,
10363                                 NULL, HFILL
10364                         }
10365                 },
10366                 {
10367                         &hf_rtp_midi_sysex_common_rt_mmc_responses,
10368                         {
10369                                 "Sysex Common Realtime Machine Control Responses",
10370                                 "rtpmidi.sysex_common_realtime_mmc_resps",
10371                                 FT_UINT8,
10372                                 BASE_HEX,
10373                                 VALS(rtp_midi_sysex_common_rt_mmc_responses),
10374                                 0x7f,
10375                                 NULL, HFILL
10376                         }
10377                 },
10378                 {
10379                         &hf_rtp_midi_sysex_common_nrt_gi_device_family,
10380                         {
10381                                 "Sysex Common Non-Realtime General Information Device Family",
10382                                 "rtpmidi.sysex_common_non_realtime_general_information_device_family",
10383                                 FT_UINT16,
10384                                 BASE_HEX,
10385                                 NULL,
10386                                 0x7f7f,
10387                                 NULL, HFILL
10388                         }
10389                 },
10390                 {
10391                         &hf_rtp_midi_sysex_common_nrt_gi_device_family_member,
10392                         {
10393                                 "Sysex Common Non-Realtime General Information Device Family Member",
10394                                 "rtpmidi.sysex_common_non_realtime_general_information_device_family_member",
10395                                 FT_UINT16,
10396                                 BASE_HEX,
10397                                 NULL,
10398                                 0x7f7f,
10399                                 NULL, HFILL
10400                         }
10401                 },
10402                 {
10403                         &hf_rtp_midi_sysex_common_nrt_gi_software_rev,
10404                         {
10405                                 "Sysex Common Non-Realtime General Information Software Revision",
10406                                 "rtpmidi.sysex_common_non_realtime_general_information_software_revision",
10407                                 FT_UINT32,
10408                                 BASE_HEX,
10409                                 NULL,
10410                                 0x7f7f7f7f,
10411                                 NULL, HFILL
10412                         }
10413                 },
10414                 {
10415                         &hf_rtp_midi_sysex_common_nrt_sd_packet_number,
10416                         {
10417                                 "Sysex Common Non-Realtime Sample Dump Packet Number",
10418                                 "rtpmidi.sysex_common_non_realtime_sample_dump_packet_number",
10419                                 FT_UINT8,
10420                                 BASE_DEC,
10421                                 NULL,
10422                                 0x7f,
10423                                 NULL, HFILL
10424                         }
10425                 },
10426                 {
10427                         &hf_rtp_midi_sysex_common_nrt_sd_header_sn,
10428                         {
10429                                 "Sysex Common Non-Realtime Sample Dump Sample Number",
10430                                 "rtpmidi.sysex_common_non_realtime_sample_dump_sample_number",
10431                                 FT_UINT16,
10432                                 BASE_DEC,
10433                                 NULL,
10434                                 0x7f7f,
10435                                 NULL, HFILL
10436                         }
10437                 },
10438                 {
10439                         &hf_rtp_midi_sysex_common_nrt_sd_header_sf,
10440                         {
10441                                 "Sysex Common Non-Realtime Sample Dump Sample Format",
10442                                 "rtpmidi.sysex_common_non_realtime_sample_dump_sample_format",
10443                                 FT_UINT8,
10444                                 BASE_DEC,
10445                                 NULL,
10446                                 0x7f,
10447                                 NULL, HFILL
10448                         }
10449                 },
10450                 {
10451                         &hf_rtp_midi_sysex_common_nrt_sd_header_sp,
10452                         {
10453                                 "Sysex Common Non-Realtime Sample Dump Sample Period",
10454                                 "rtpmidi.sysex_common_non_realtime_sample_dump_sample_period",
10455                                 FT_UINT24,
10456                                 BASE_DEC,
10457                                 NULL,
10458                                 0x7f7f7f,
10459                                 NULL, HFILL
10460                         }
10461                 },
10462                 {
10463                         &hf_rtp_midi_sysex_common_nrt_sd_header_sl,
10464                         {
10465                                 "Sysex Common Non-Realtime Sample Dump Sample Length",
10466                                 "rtpmidi.sysex_common_non_realtime_sample_dump_sample_length",
10467                                 FT_UINT24,
10468                                 BASE_DEC,
10469                                 NULL,
10470                                 0x7f7f7f,
10471                                 NULL, HFILL
10472                         }
10473                 },
10474                 {
10475                         &hf_rtp_midi_sysex_common_nrt_sd_header_ls,
10476                         {
10477                                 "Sysex Common Non-Realtime Sample Dump Loop Start",
10478                                 "rtpmidi.sysex_common_non_realtime_sample_dump_loop_start",
10479                                 FT_UINT24,
10480                                 BASE_DEC,
10481                                 NULL,
10482                                 0x7f7f7f,
10483                                 NULL, HFILL
10484                         }
10485                 },
10486                 {
10487                         &hf_rtp_midi_sysex_common_nrt_sd_header_le,
10488                         {
10489                                 "Sysex Common Non-Realtime Sample Dump Loop End",
10490                                 "rtpmidi.sysex_common_non_realtime_sample_dump_loop_end",
10491                                 FT_UINT24,
10492                                 BASE_DEC,
10493                                 NULL,
10494                                 0x7f7f7f,
10495                                 NULL, HFILL
10496                         }
10497                 },
10498                 {
10499                         &hf_rtp_midi_sysex_common_nrt_sd_header_lt,
10500                         {
10501                                 "Sysex Common Non-Realtime Sample Dump Loop Type",
10502                                 "rtpmidi.sysex_common_non_realtime_sample_dump_loop_type",
10503                                 FT_UINT8,
10504                                 BASE_DEC,
10505                                 VALS(rtp_midi_sysex_common_nrt_sd_lt),
10506                                 0x7f,
10507                                 NULL, HFILL
10508                         }
10509                 },
10510                 {
10511                         &hf_rtp_midi_sysex_common_nrt_sd_packet_count,
10512                         {
10513                                 "Sysex Common Non-Realtime Sample Dump Running Packet Count",
10514                                 "rtpmidi.sysex_common_non_realtime_sample_dump_packet_count",
10515                                 FT_UINT8,
10516                                 BASE_DEC,
10517                                 NULL,
10518                                 0x7f,
10519                                 NULL, HFILL
10520                         }
10521                 },
10522                 {
10523                         &hf_rtp_midi_sysex_common_nrt_sd_packet_check,
10524                         {
10525                                 "Sysex Common Non-Realtime Sample Dump Checkum",
10526                                 "rtpmidi.sysex_common_non_realtime_sample_dump_checksum",
10527                                 FT_UINT8,
10528                                 BASE_HEX,
10529                                 NULL,
10530                                 0x7f,
10531                                 NULL, HFILL
10532                         }
10533                 },
10534                 {
10535                         &hf_rtp_midi_sysex_common_nrt_sd_packet_data,
10536                         {
10537                                 "Sysex Common Non-Realtime Sample Dump Data Byte",
10538                                 "rtpmidi.sysex_common_non_realtime_sample_dump_data",
10539                                 FT_BYTES,
10540                                 BASE_NONE,
10541                                 NULL,
10542                                 0,
10543                                 NULL, HFILL
10544                         }
10545                 },
10546                 {
10547                         &hf_rtp_midi_sysex_common_nrt_sd_ext_ln,
10548                         {
10549                                 "Sysex Common Non-Realtime Sample Dump LP Transmission Loop Number",
10550                                 "rtpmidi.sysex_common_non_realtime_sample_dump_lp_trans_ln",
10551                                 FT_UINT16,
10552                                 BASE_DEC,
10553                                 NULL,
10554                                 0x7f7f,
10555                                 NULL, HFILL
10556                         }
10557                 },
10558                 {
10559                         &hf_rtp_midi_sysex_common_nrt_fd_device_id,
10560                         {
10561                                 "Sysex Common Non-Realtime File Dump Device ID",
10562                                 "rtpmidi.sysex_common_non_realtime_fd_device_id",
10563                                 FT_UINT8,
10564                                 BASE_HEX,
10565                                 NULL,
10566                                 0x7f,
10567                                 NULL, HFILL
10568                         }
10569                 },
10570                 {
10571                         &hf_rtp_midi_sysex_common_nrt_fd_type,
10572                         {
10573                                 "Sysex Common Non-Realtime File Dump File Type",
10574                                 "rtpmidi.sysex_common_non_realtime_fd_type",
10575                                 FT_STRING,
10576                                 BASE_NONE,
10577                                 NULL,
10578                                 0x0,
10579                                 NULL, HFILL
10580                         }
10581                 },
10582                 {
10583                         &hf_rtp_midi_sysex_common_nrt_fd_name,
10584                         {
10585                                 "Sysex Common Non-Realtime File Dump File Name",
10586                                 "rtpmidi.sysex_common_non_realtime_fd_name",
10587                                 FT_STRING,
10588                                 BASE_NONE,
10589                                 NULL,
10590                                 0x0,
10591                                 NULL, HFILL
10592                         }
10593                 },
10594                 {
10595                         &hf_rtp_midi_sysex_common_nrt_fd_length,
10596                         {
10597                                 "Sysex Common Non-Realtime File Dump Length",
10598                                 "rtpmidi.sysex_common_non_realtime_fd_length",
10599                                 FT_UINT32,
10600                                 BASE_DEC,
10601                                 NULL,
10602                                 0x7f7f7f7f,
10603                                 NULL, HFILL
10604                         }
10605                 },
10606                 {
10607                         &hf_rtp_midi_sysex_common_nrt_fd_packet_num,
10608                         {
10609                                 "Sysex Common Non-Realtime File Packet Number",
10610                                 "rtpmidi.sysex_common_non_realtime_fd_packet_num",
10611                                 FT_UINT8,
10612                                 BASE_DEC,
10613                                 NULL,
10614                                 0x7f,
10615                                 NULL, HFILL
10616                         }
10617                 },
10618                 {
10619                         &hf_rtp_midi_sysex_common_nrt_fd_byte_count,
10620                         {
10621                                 "Sysex Common Non-Realtime File Byte Count",
10622                                 "rtpmidi.sysex_common_non_realtime_fd_byte_count",
10623                                 FT_UINT8,
10624                                 BASE_DEC,
10625                                 NULL,
10626                                 0x7f,
10627                                 NULL, HFILL
10628                         }
10629                 },
10630                 {
10631                         &hf_rtp_midi_sysex_common_nrt_fd_packet_data,
10632                         {
10633                                 "Sysex Common Non-Realtime File Packet Data",
10634                                 "rtpmidi.sysex_common_non_realtime_fd_packet_data",
10635                                 FT_BYTES,
10636                                 BASE_NONE,
10637                                 NULL,
10638                                 0x0,
10639                                 NULL, HFILL
10640                         }
10641                 },
10642                 {
10643                         &hf_rtp_midi_sysex_common_nrt_fd_checksum,
10644                         {
10645                                 "Sysex Common Non-Realtime File Checksum",
10646                                 "rtpmidi.sysex_common_non_realtime_fd_checksum",
10647                                 FT_UINT8,
10648                                 BASE_HEX,
10649                                 NULL,
10650                                 0x7f,
10651                                 NULL, HFILL
10652                         }
10653                 },
10654                 {
10655                         &hf_rtp_midi_sysex_common_tune_program,
10656                         {
10657                                 "Sysex Common (Non-)Realtime Tuning Program",
10658                                 "rtpmidi.sysex_common_tune_program",
10659                                 FT_UINT8,
10660                                 BASE_HEX,
10661                                 NULL,
10662                                 0x7f,
10663                                 NULL, HFILL
10664                         }
10665                 },
10666                 {
10667                         &hf_rtp_midi_sysex_common_tune_name,
10668                         {
10669                                 "Sysex Common (Non-)Realtime Tuning Name",
10670                                 "rtpmidi.sysex_common_tune_name",
10671                                 FT_STRING,
10672                                 BASE_NONE,
10673                                 NULL,
10674                                 0x0,
10675                                 NULL, HFILL
10676                         }
10677                 },
10678                 {
10679                         &hf_rtp_midi_sysex_common_tune_freq,
10680                         {
10681                                 "Sysex Common (Non-)Realtime Tuning Frequency",
10682                                 "rtpmidi.sysex_common_tune_freq",
10683                                 FT_UINT24,
10684                                 BASE_HEX,
10685                                 NULL,
10686                                 0x7f7f7f,
10687                                 NULL, HFILL
10688                         }
10689                 },
10690                 {
10691                         &hf_rtp_midi_sysex_common_tune_checksum,
10692                         {
10693                                 "Sysex Common (Non-)Realtime Tuning Checksum",
10694                                 "rtpmidi.sysex_common_tune_checksum",
10695                                 FT_UINT8,
10696                                 BASE_HEX,
10697                                 NULL,
10698                                 0x7f,
10699                                 NULL, HFILL
10700                         }
10701                 },
10702                 {
10703                         &hf_rtp_midi_sysex_common_tune_changes,
10704                         {
10705                                 "Sysex Common (Non-)Realtime Tuning Changes",
10706                                 "rtpmidi.sysex_common_tune_changes",
10707                                 FT_UINT8,
10708                                 BASE_DEC,
10709                                 NULL,
10710                                 0x7f,
10711                                 NULL, HFILL
10712                         }
10713                 },
10714                 {
10715                         &hf_rtp_midi_sysex_common_tune_note,
10716                         {
10717                                 "Sysex Common (Non-)Realtime Tuning Note",
10718                                 "rtpmidi.sysex_common_tune_note",
10719                                 FT_UINT8,
10720                                 BASE_DEC,
10721                                 VALS(rtp_midi_note_values),
10722                                 0x7f,
10723                                 NULL, HFILL
10724                         }
10725                 },
10726                 {
10727                         &hf_rtp_midi_sysex_common_rt_mtc_fm_type,
10728                         {
10729                                 "Sysex Common Realtime MTC Full Message Type",
10730                                 "rtpmidi.sysex_common_rt_mtc_fm_type",
10731                                 FT_UINT8,
10732                                 BASE_HEX,
10733                                 VALS(rtp_midi_mtc_fm_type_values),
10734                                 0x60,
10735                                 NULL, HFILL
10736                         }
10737                 },
10738                 {
10739                         &hf_rtp_midi_sysex_common_rt_mtc_fm_hr,
10740                         {
10741                                 "Sysex Common Realtime MTC Full Message Hour",
10742                                 "rtpmidi.sysex_common_rt_mtc_fm_hour",
10743                                 FT_UINT8,
10744                                 BASE_DEC,
10745                                 NULL,
10746                                 0x1f,
10747                                 NULL, HFILL
10748                         }
10749                 },
10750                 {
10751                         &hf_rtp_midi_sysex_common_rt_mtc_fm_mn,
10752                         {
10753                                 "Sysex Common Realtime MTC Full Message Minute",
10754                                 "rtpmidi.sysex_common_rt_mtc_fm_minute",
10755                                 FT_UINT8,
10756                                 BASE_DEC,
10757                                 NULL,
10758                                 0x7f,
10759                                 NULL, HFILL
10760                         }
10761                 },
10762                 {
10763                         &hf_rtp_midi_sysex_common_rt_mtc_fm_sc,
10764                         {
10765                                 "Sysex Common Realtime MTC Full Message Second",
10766                                 "rtpmidi.sysex_common_rt_mtc_fm_second",
10767                                 FT_UINT8,
10768                                 BASE_DEC,
10769                                 NULL,
10770                                 0x7f,
10771                                 NULL, HFILL
10772                         }
10773                 },
10774                 {
10775                         &hf_rtp_midi_sysex_common_rt_mtc_fm_fr,
10776                         {
10777                                 "Sysex Common Realtime MTC Full Message Frame",
10778                                 "rtpmidi.sysex_common_rt_mtc_fm_frame",
10779                                 FT_UINT8,
10780                                 BASE_DEC,
10781                                 NULL,
10782                                 0x7f,
10783                                 NULL, HFILL
10784                         }
10785                 },
10786                 {
10787                         &hf_rtp_midi_sysex_common_rt_mtc_ub_u1,
10788                         {
10789                                 "Sysex Common Realtime MTC User Bits U1",
10790                                 "rtpmidi.sysex_common_rt_mtc_ub_u1",
10791                                 FT_UINT8,
10792                                 BASE_HEX,
10793                                 NULL,
10794                                 0x0f,
10795                                 NULL, HFILL
10796                         }
10797                 },
10798                 {
10799                         &hf_rtp_midi_sysex_common_rt_mtc_ub_u2,
10800                         {
10801                                 "Sysex Common Realtime MTC User Bits U2",
10802                                 "rtpmidi.sysex_common_rt_mtc_ub_u2",
10803                                 FT_UINT8,
10804                                 BASE_HEX,
10805                                 NULL,
10806                                 0x0f,
10807                                 NULL, HFILL
10808                         }
10809                 },
10810                 {
10811                         &hf_rtp_midi_sysex_common_rt_mtc_ub_u3,
10812                         {
10813                                 "Sysex Common Realtime MTC User Bits U3",
10814                                 "rtpmidi.sysex_common_rt_mtc_ub_u3",
10815                                 FT_UINT8,
10816                                 BASE_HEX,
10817                                 NULL,
10818                                 0x0f,
10819                                 NULL, HFILL
10820                         }
10821                 },
10822                 {
10823                         &hf_rtp_midi_sysex_common_rt_mtc_ub_u4,
10824                         {
10825                                 "Sysex Common Realtime MTC User Bits U4",
10826                                 "rtpmidi.sysex_common_rt_mtc_ub_u4",
10827                                 FT_UINT8,
10828                                 BASE_HEX,
10829                                 NULL,
10830                                 0x0f,
10831                                 NULL, HFILL
10832                         }
10833                 },
10834                 {
10835                         &hf_rtp_midi_sysex_common_rt_mtc_ub_u5,
10836                         {
10837                                 "Sysex Common Realtime MTC User Bits U5",
10838                                 "rtpmidi.sysex_common_rt_mtc_ub_u5",
10839                                 FT_UINT8,
10840                                 BASE_HEX,
10841                                 NULL,
10842                                 0x0f,
10843                                 NULL, HFILL
10844                         }
10845                 },
10846                 {
10847                         &hf_rtp_midi_sysex_common_rt_mtc_ub_u6,
10848                         {
10849                                 "Sysex Common Realtime MTC User Bits U6",
10850                                 "rtpmidi.sysex_common_rt_mtc_ub_u6",
10851                                 FT_UINT8,
10852                                 BASE_HEX,
10853                                 NULL,
10854                                 0x0f,
10855                                 NULL, HFILL
10856                         }
10857                 },
10858                 {
10859                         &hf_rtp_midi_sysex_common_rt_mtc_ub_u7,
10860                         {
10861                                 "Sysex Common Realtime MTC User Bits U7",
10862                                 "rtpmidi.sysex_common_rt_mtc_ub_u7",
10863                                 FT_UINT8,
10864                                 BASE_HEX,
10865                                 NULL,
10866                                 0x0f,
10867                                 NULL, HFILL
10868                         }
10869                 },
10870                 {
10871                         &hf_rtp_midi_sysex_common_rt_mtc_ub_u8,
10872                         {
10873                                 "Sysex Common Realtime MTC User Bits U8",
10874                                 "rtpmidi.sysex_common_rt_mtc_ub_u8",
10875                                 FT_UINT8,
10876                                 BASE_HEX,
10877                                 NULL,
10878                                 0x0f,
10879                                 NULL, HFILL
10880                         }
10881                 },
10882                 {
10883                         &hf_rtp_midi_sysex_common_rt_mtc_ub_u9,
10884                         {
10885                                 "Sysex Common Realtime MTC User Bits U9",
10886                                 "rtpmidi.sysex_common_rt_mtc_ub_u9",
10887                                 FT_UINT8,
10888                                 BASE_HEX,
10889                                 NULL,
10890                                 0x03,
10891                                 NULL, HFILL
10892                         }
10893                 },
10894                 {
10895                         &hf_rtp_midi_sysex_common_nrt_mtc_type,
10896                         {
10897                                 "Sysex Common Non-Realtime MTC Type",
10898                                 "rtpmidi.sysex_common_nrt_mtc_type",
10899                                 FT_UINT8,
10900                                 BASE_HEX,
10901                                 VALS(rtp_midi_mtc_fm_type_values),
10902                                 0x60,
10903                                 NULL, HFILL
10904                         }
10905                 },
10906                 {
10907                         &hf_rtp_midi_sysex_common_nrt_mtc_hr,
10908                         {
10909                                 "Sysex Common Non-Realtime MTC Hour",
10910                                 "rtpmidi.sysex_common_nrt_mtc_hour",
10911                                 FT_UINT8,
10912                                 BASE_DEC,
10913                                 NULL,
10914                                 0x1f,
10915                                 NULL, HFILL
10916                         }
10917                 },
10918                 {
10919                         &hf_rtp_midi_sysex_common_nrt_mtc_mn,
10920                         {
10921                                 "Sysex Common Non-Realtime MTCMinute",
10922                                 "rtpmidi.sysex_common_nrt_mtc_minute",
10923                                 FT_UINT8,
10924                                 BASE_DEC,
10925                                 NULL,
10926                                 0x7f,
10927                                 NULL, HFILL
10928                         }
10929                 },
10930                 {
10931                         &hf_rtp_midi_sysex_common_nrt_mtc_sc,
10932                         {
10933                                 "Sysex Common Non-Realtime MTC Second",
10934                                 "rtpmidi.sysex_common_nrt_mtc_second",
10935                                 FT_UINT8,
10936                                 BASE_DEC,
10937                                 NULL,
10938                                 0x7f,
10939                                 NULL, HFILL
10940                         }
10941                 },
10942                 {
10943                         &hf_rtp_midi_sysex_common_nrt_mtc_fr,
10944                         {
10945                                 "Sysex Common Non-Realtime MTC Frame",
10946                                 "rtpmidi.sysex_common_nrt_mtc_frame",
10947                                 FT_UINT8,
10948                                 BASE_DEC,
10949                                 NULL,
10950                                 0x7f,
10951                                 NULL, HFILL
10952                         }
10953                 },
10954                 {
10955                         &hf_rtp_midi_sysex_common_nrt_mtc_ff,
10956                         {
10957                                 "Sysex Common Non-Realtime MTC Fractional Frame",
10958                                 "rtpmidi.sysex_common_nrt_mtc_fract_frame",
10959                                 FT_UINT8,
10960                                 BASE_DEC,
10961                                 NULL,
10962                                 0x7f,
10963                                 NULL, HFILL
10964                         }
10965                 },
10966                 {
10967                         &hf_rtp_midi_sysex_common_nrt_mtc_enl,
10968                         {
10969                                 "Sysex Common Non-Realtime MTC Event Number (LSB)",
10970                                 "rtpmidi.sysex_common_nrt_mtc_en_lsb",
10971                                 FT_UINT8,
10972                                 BASE_DEC,
10973                                 NULL,
10974                                 0x7f,
10975                                 NULL, HFILL
10976                         }
10977                 },
10978                 {
10979                         &hf_rtp_midi_sysex_common_nrt_mtc_enm,
10980                         {
10981                                 "Sysex Common Non-Realtime MTC Event Number (MSB)",
10982                                 "rtpmidi.sysex_common_nrt_mtc_en_msb",
10983                                 FT_UINT8,
10984                                 BASE_DEC,
10985                                 NULL,
10986                                 0x7f,
10987                                 NULL, HFILL
10988                         }
10989                 },
10990                 {
10991                         &hf_rtp_midi_sysex_common_nrt_mtc_add,
10992                         {
10993                                 "Sysex Common Non-Realtime MTC Additional Info",
10994                                 "rtpmidi.sysex_common_nrt_mtc_add",
10995                                 FT_BYTES,
10996                                 BASE_NONE,
10997                                 NULL,
10998                                 0x0,
10999                                 NULL, HFILL
11000                         }
11001                 },
11002                 {
11003                         &hf_rtp_midi_sysex_common_rt_mtc_cue_enl,
11004                         {
11005                                 "Sysex Common Realtime MTC Cue Event Number (LSB)",
11006                                 "rtpmidi.sysex_common_rt_mtc_cue_en_lsb",
11007                                 FT_UINT8,
11008                                 BASE_DEC,
11009                                 NULL,
11010                                 0x7f,
11011                                 NULL, HFILL
11012                         }
11013                 },
11014                 {
11015                         &hf_rtp_midi_sysex_common_rt_mtc_cue_enm,
11016                         {
11017                                 "Sysex Common Realtime MTC Cue Event Number (MSB)",
11018                                 "rtpmidi.sysex_common_rt_mtc_cue_en_msb",
11019                                 FT_UINT8,
11020                                 BASE_DEC,
11021                                 NULL,
11022                                 0x7f,
11023                                 NULL, HFILL
11024                         }
11025                 },
11026                 {
11027                         &hf_rtp_midi_sysex_common_rt_mtc_cue_add,
11028                         {
11029                                 "Sysex Common Realtime MTC Cue Additional Info",
11030                                 "rtpmidi.sysex_common_rt_mtc_cue_add",
11031                                 FT_BYTES,
11032                                 BASE_NONE,
11033                                 NULL,
11034                                 0x0,
11035                                 NULL, HFILL
11036                         }
11037                 },
11038                 {
11039                         &hf_rtp_midi_sysex_common_rt_ni_bar_num,
11040                         {
11041                                 "Sysex Common Realtime NI Bar Number",
11042                                 "rtpmidi.sysex_common_rt_ni_barnum",
11043                                 FT_UINT16,
11044                                 BASE_HEX,
11045                                 NULL,
11046                                 0x7f7f,
11047                                 NULL, HFILL
11048                         }
11049                 },
11050                 {
11051                         &hf_rtp_midi_sysex_common_rt_ni_bytes,
11052                         {
11053                                 "Sysex Common Realtime NI Bytes",
11054                                 "rtpmidi.sysex_common_rt_ni_bytes",
11055                                 FT_UINT8,
11056                                 BASE_DEC,
11057                                 NULL,
11058                                 0x7f,
11059                                 NULL, HFILL
11060                         }
11061                 },
11062                 {
11063                         &hf_rtp_midi_sysex_common_rt_ni_numerator,
11064                         {
11065                                 "Sysex Common Realtime NI Numerator",
11066                                 "rtpmidi.sysex_common_rt_ni_numerator",
11067                                 FT_UINT8,
11068                                 BASE_DEC,
11069                                 NULL,
11070                                 0x7f,
11071                                 NULL, HFILL
11072                         }
11073                 },
11074                 {
11075                         &hf_rtp_midi_sysex_common_rt_ni_denominator,
11076                         {
11077                                 "Sysex Common Realtime NI Denominator",
11078                                 "rtpmidi.sysex_common_rt_ni_denominator",
11079                                 FT_UINT8,
11080                                 BASE_DEC,
11081                                 NULL,
11082                                 0x7f,
11083                                 NULL, HFILL
11084                         }
11085                 },
11086                 {
11087                         &hf_rtp_midi_sysex_common_rt_ni_midi_clocks,
11088                         {
11089                                 "Sysex Common Realtime NI MIDI clocks in click",
11090                                 "rtpmidi.sysex_common_rt_ni_midiclock",
11091                                 FT_UINT8,
11092                                 BASE_DEC,
11093                                 NULL,
11094                                 0x7f,
11095                                 NULL, HFILL
11096                         }
11097                 },
11098                 {
11099                         &hf_rtp_midi_sysex_common_rt_ni_32nds,
11100                         {
11101                                 "Sysex Common Realtime NI 32nd notes in MIDI quarter note",
11102                                 "rtpmidi.sysex_common_rt_ni_32nds",
11103                                 FT_UINT8,
11104                                 BASE_DEC,
11105                                 NULL,
11106                                 0x7f,
11107                                 NULL, HFILL
11108                         }
11109                 },
11110                 {
11111                         &hf_rtp_midi_sysex_common_rt_dc_volume,
11112                         {
11113                                 "Sysex Common Realtime DC Volume",
11114                                 "rtpmidi.sysex_common_rt_dc_volume",
11115                                 FT_UINT16,
11116                                 BASE_DEC,
11117                                 NULL,
11118                                 0x7f7f,
11119                                 NULL, HFILL
11120                         }
11121                 },
11122                 {
11123                         &hf_rtp_midi_sysex_common_rt_dc_balance,
11124                         {
11125                                 "Sysex Common Realtime DC Balance",
11126                                 "rtpmidi.sysex_common_rt_dc_balance",
11127                                 FT_UINT16,
11128                                 BASE_DEC,
11129                                 NULL,
11130                                 0x7f7f,
11131                                 NULL, HFILL
11132                         }
11133                 }
11134
11135         };
11136
11137
11138
11139
11140
11141         static gint *ett[] = {
11142                 &ett_rtp_midi,
11143                 &ett_rtp_midi_commands,
11144                 &ett_rtp_midi_journal,
11145                 &ett_rtp_midi_command,
11146                 &ett_rtp_midi_systemjournal,
11147                 &ett_rtp_midi_channeljournals,
11148                 &ett_rtp_midi_channelchapters,
11149                 &ett_rtp_midi_cj_chapter_p,
11150                 &ett_rtp_midi_cj_chapter_c,
11151                 &ett_rtp_midi_cj_chapter_c_loglist,
11152                 &ett_rtp_midi_cj_chapter_c_logitem,
11153                 &ett_rtp_midi_cj_chapter_m,
11154                 &ett_rtp_midi_cj_chapter_m_loglist,
11155                 &ett_rtp_midi_cj_chapter_m_logitem,
11156                 &ett_rtp_midi_cj_chapter_m_log_msb,
11157                 &ett_rtp_midi_cj_chapter_m_log_lsb,
11158                 &ett_rtp_midi_cj_chapter_m_log_a_button,
11159                 &ett_rtp_midi_cj_chapter_m_log_c_button,
11160                 &ett_rtp_midi_cj_chapter_m_log_count,
11161                 &ett_rtp_midi_cj_chapter_w,
11162                 &ett_rtp_midi_cj_chapter_n,
11163                 &ett_rtp_midi_cj_chapter_n_loglist,
11164                 &ett_rtp_midi_cj_chapter_n_logitem,
11165                 &ett_rtp_midi_cj_chapter_n_octets,
11166                 &ett_rtp_midi_cj_chapter_e,
11167                 &ett_rtp_midi_cj_chapter_e_loglist,
11168                 &ett_rtp_midi_cj_chapter_e_logitem,
11169                 &ett_rtp_midi_cj_chapter_t,
11170                 &ett_rtp_midi_cj_chapter_a,
11171                 &ett_rtp_midi_cj_chapter_a_loglist,
11172                 &ett_rtp_midi_cj_chapter_a_logitem,
11173                 &ett_rtp_midi_systemchapters,
11174                 &ett_rtp_midi_sj_chapter_d,
11175                 &ett_rtp_midi_sj_chapter_d_field_b,
11176                 &ett_rtp_midi_sj_chapter_d_field_g,
11177                 &ett_rtp_midi_sj_chapter_d_field_h,
11178                 &ett_rtp_midi_sj_chapter_d_field_j,
11179                 &ett_rtp_midi_sj_chapter_d_field_k,
11180                 &ett_rtp_midi_sj_chapter_d_field_y,
11181                 &ett_rtp_midi_sj_chapter_d_field_z,
11182                 &ett_rtp_midi_sj_chapter_v,
11183                 &ett_rtp_midi_sj_chapter_q,
11184                 &ett_rtp_midi_sj_chapter_f,
11185                 &ett_rtp_midi_sj_chapter_f_complete,
11186                 &ett_rtp_midi_sj_chapter_f_partial,
11187                 &ett_rtp_midi_sj_chapter_x,
11188                 &ett_rtp_midi_sj_chapter_x_first,
11189                 &ett_rtp_midi_sj_chapter_x_data,
11190                 &ett_rtp_midi_channeljournal,
11191                 &ett_rtp_midi_sysex_data,
11192                 &ett_rtp_midi_sysex_common_rt,
11193                 &ett_rtp_midi_sysex_common_nrt,
11194                 &ett_rtp_midi_sysex_common_tune_note,
11195                 &ett_rtp_midi_sysex_manu,
11196                 &ett_rtp_midi_sysex_edu
11197         };
11198
11199         proto_rtp_midi = proto_register_protocol( RTP_MIDI_DISSECTOR_NAME, RTP_MIDI_DISSECTOR_SHORTNAME, RTP_MIDI_DISSECTOR_ABBREVIATION );
11200         proto_register_field_array( proto_rtp_midi, hf, array_length( hf ) );
11201         proto_register_subtree_array( ett, array_length( ett ) );
11202
11203         rtp_midi_module = prefs_register_protocol ( proto_rtp_midi, proto_reg_handoff_rtp_midi );
11204         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 );
11205         register_dissector( RTP_MIDI_DISSECTOR_ABBREVIATION, dissect_rtp_midi, proto_rtp_midi );
11206 }
11207
11208
11209
11210 void
11211 proto_reg_handoff_rtp_midi( void )
11212 {
11213         static dissector_handle_t       rtp_midi_handle;
11214         static int                      rtp_midi_prefs_initialized = FALSE;
11215
11216
11217         if ( !rtp_midi_prefs_initialized ) {
11218                 rtp_midi_handle = find_dissector( RTP_MIDI_DISSECTOR_ABBREVIATION );
11219                 dissector_add_string("rtp_dyn_payload_type", "rtp-midi", rtp_midi_handle);
11220                 rtp_midi_prefs_initialized = TRUE;
11221         }
11222         else {
11223                 dissector_delete_uint( "rtp.pt", saved_payload_type_value, rtp_midi_handle );
11224         }
11225
11226         saved_payload_type_value = rtp_midi_payload_type_value;
11227
11228         dissector_add_uint( "rtp.pt", saved_payload_type_value, rtp_midi_handle );
11229
11230 }