Improvements to comments etc.
[AROS.git] / workbench / libs / camd / midimsglen.c
blob955fbb301daccb7b9ce0a15feb2b20bc0e825afc
1 /*
2 Copyright © 2001-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
9 #include "camd_intern.h"
11 /*****************************************************************************
13 NAME */
15 AROS_LH1(WORD, MidiMsgLen,
17 /* SYNOPSIS */
18 AROS_LHA(ULONG, msg, D0),
20 /* LOCATION */
21 struct CamdBase *, CamdBase, 32, Camd)
23 /* FUNCTION
24 Returns the length of a midimessage. sysex message leads to a
25 length of zero.
27 INPUTS
28 msg - Message.
30 RESULT
32 NOTES
34 EXAMPLE
36 BUGS
38 SEE ALSO
40 INTERNALS
42 HISTORY
44 2001-01-12 ksvalast first created
45 2005-05-21 Lyle Hazelwood : Add support for "To Host" bank change 0xF5
47 *****************************************************************************/
49 AROS_LIBFUNC_INIT
51 msg=0xff & msg>>24;
53 if(msg<0x80 || msg>0xff) return 0;
55 if(msg&0x80 && msg&0x40){
56 if(!(msg&0x20)){
57 return 2; //0xc0 or 0xb0
58 }else{
59 if(msg&0x10){ //0xfx
60 switch(msg){
61 case 0xf0:
62 return 0;
63 case 0xf1:
64 return 2;
65 case 0xf2:
66 return 3;
67 case 0xf3:
68 return 2;
69 case 0xf4:
70 return 0;
71 case 0xf5:
72 return 2; /* "To Host" bank change command */
73 case 0xf6:
74 return 1;
75 case 0xf7:
76 return 0;
77 default:
78 return 1; //Realtime message
79 break;
84 return 3;
86 AROS_LIBFUNC_EXIT