utilrout.c
2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#include <libaudio.h>
#include <stdio.h>
#include <stdlib.h>
#include <dmedia/midi.h>
#include <u64gio.h>
#include <ultratypes.h>
#include "midiApp.h"
#include "midiDmon.h"
#include "midiGlobals.h"
#ifdef SYSEX_IMPL
/********************************************************************
* Check to see if request string is in list. maxStr is the *
* maximum number of strings in the list. If you find a match *
* return that list item number, counting from 1, else return *
* zero *
********************************************************************/
int CheckString(char **requestStr, array32 *list, int maxStr)
{
int i;
char *r,*l;
for(i=0;i<maxStr;i++)
{
r = *requestStr;
if(*r==0)
return 0;
l = (char*)&list[i];
while(*r==*l)
{
r++;
l++;
if(*l == 0)
{
if(*r == ':') /* skip any semicolons */
r++;
*requestStr = r;
return(i+1);
}
}
}
return 0;
}
char *parsename(char *name,char *nameStr)
{
char c;
while(*name!=' ' && *name!=0 && *name!=',') /* name seperated by ' ' */
{
*nameStr = *name;
name++;
nameStr++;
}
if(*name == ' ' || *name == ',')
name++;
*nameStr = 0; /* terminate string */
return name;
}
int GetNumber(char **hdl)
{
int value = 0;
char *ptr = *hdl;
while(*ptr >= '0' && *ptr<='9')
{
value *= 10;
value += *ptr - '0';
ptr++;
}
if(*ptr == ',' || *ptr == ':') /* skip comma */
ptr++;
*hdl = ptr;
return value;
}
char *listcat(char *lptr,char *nptr)
{
if(*nptr == 0) /* if null string */
return(lptr);
while(*nptr!=0)
{
*lptr = *nptr;
nptr++;
lptr++;
}
*lptr = ' '; /* add a space to end of name */
lptr++;
return (lptr);
}
void FakeProgChnge(int inst)
{
int i;
midiBlock midiBlk;
u64_write_arg_t writeHdr;
for(i=0;i<MAX_SEQ_CHANNELS;i++)
{
if(gCurChanInst[i]==inst)
{
midiBlk.pcktType = STATUS_TYPE;
midiBlk.numEvts = 1;
midiBlk.mess[0].midiByte[0] = 0xC0 + i;
midiBlk.mess[0].midiByte[1] = (unsigned char)inst;
midiBlk.mess[0].midiByte[2] = 0;
writeHdr.buffer = &midiBlk;
writeHdr.ramrom_addr = RAMROM_APP_READ_ADDR;
writeHdr.nbytes = sizeof(midiBlock);
writeHdr.value = HOST_APP_CMD_READY;
if(hardware)
{
ioctl(gGIOfd, U64_SAFE_WRITE, &writeHdr);
if(verbose)
fprintf(stderr,"%s: Back from IOCTL\n",gAppName);
}
}
}
}
#endif /* SYSEX_IMPL */