diff options
Diffstat (limited to 'apps/plugins/midi/midiutil.c')
-rw-r--r-- | apps/plugins/midi/midiutil.c | 48 |
1 files changed, 35 insertions, 13 deletions
diff --git a/apps/plugins/midi/midiutil.c b/apps/plugins/midi/midiutil.c index d0b968e52c..8e27e739e7 100644 --- a/apps/plugins/midi/midiutil.c +++ b/apps/plugins/midi/midiutil.c | |||
@@ -63,11 +63,11 @@ | |||
63 | extern struct plugin_api * rb; | 63 | extern struct plugin_api * rb; |
64 | 64 | ||
65 | 65 | ||
66 | int chVol[16] IDATA_ATTR; /* Channel volume */ | 66 | int chVol[16] IBSS_ATTR; /* Channel volume */ |
67 | int chPanLeft[16] IDATA_ATTR; /* Channel panning */ | 67 | int chPanLeft[16] IBSS_ATTR; /* Channel panning */ |
68 | int chPanRight[16] IDATA_ATTR; | 68 | int chPanRight[16] IBSS_ATTR; |
69 | int chPat[16]; /* Channel patch */ | 69 | int chPat[16] IBSS_ATTR; /* Channel patch */ |
70 | int chPW[16]; /* Channel pitch wheel, MSB only */ | 70 | int chPW[16] IBSS_ATTR; /* Channel pitch wheel, MSB only */ |
71 | 71 | ||
72 | 72 | ||
73 | struct GPatch * gusload(char *); | 73 | struct GPatch * gusload(char *); |
@@ -128,12 +128,9 @@ struct SynthObject | |||
128 | int curPoint; | 128 | int curPoint; |
129 | }; | 129 | }; |
130 | 130 | ||
131 | struct SynthObject voices[MAX_VOICES] IDATA_ATTR; | 131 | struct SynthObject voices[MAX_VOICES] IBSS_ATTR; |
132 | |||
133 | |||
134 | 132 | ||
135 | void sendEvent(struct Event * ev); | 133 | void sendEvent(struct Event * ev); |
136 | int tick(struct MIDIfile * mf); | ||
137 | inline void setPoint(struct SynthObject * so, int pt); | 134 | inline void setPoint(struct SynthObject * so, int pt); |
138 | struct Event * getEvent(struct Track * tr, int evNum); | 135 | struct Event * getEvent(struct Track * tr, int evNum); |
139 | int readTwoBytes(int file); | 136 | int readTwoBytes(int file); |
@@ -196,8 +193,11 @@ void *alloc(int size) | |||
196 | offset += size + 4; | 193 | offset += size + 4; |
197 | totalSize -= size + 4; | 194 | totalSize -= size + 4; |
198 | return ret; | 195 | return ret; |
199 | }*/ | 196 | } |
200 | void * allocate(int size) | 197 | */ |
198 | |||
199 | #define malloc(n) my_malloc(n) | ||
200 | void * my_malloc(int size) | ||
201 | { | 201 | { |
202 | return alloc(size); | 202 | return alloc(size); |
203 | } | 203 | } |
@@ -211,7 +211,7 @@ unsigned char readChar(int file) | |||
211 | 211 | ||
212 | unsigned char * readData(int file, int len) | 212 | unsigned char * readData(int file, int len) |
213 | { | 213 | { |
214 | unsigned char * dat = allocate(len); | 214 | unsigned char * dat = malloc(len); |
215 | rb->read(file, dat, len); | 215 | rb->read(file, dat, len); |
216 | return dat; | 216 | return dat; |
217 | } | 217 | } |
@@ -226,7 +226,29 @@ int eof(int fd) | |||
226 | return size+1 == rb->lseek(fd, 0, SEEK_CUR); | 226 | return size+1 == rb->lseek(fd, 0, SEEK_CUR); |
227 | } | 227 | } |
228 | 228 | ||
229 | void printf(char *fmt, ...) {fmt=fmt; } | 229 | // Here is a hacked up printf command to get the output from the game. |
230 | int printf(const char *fmt, ...) | ||
231 | { | ||
232 | static int p_xtpt; | ||
233 | char p_buf[50]; | ||
234 | bool ok; | ||
235 | va_list ap; | ||
236 | |||
237 | va_start(ap, fmt); | ||
238 | ok = rb->vsnprintf(p_buf,sizeof(p_buf), fmt, ap); | ||
239 | va_end(ap); | ||
240 | |||
241 | rb->lcd_putsxy(1,p_xtpt, (unsigned char *)p_buf); | ||
242 | rb->lcd_update(); | ||
243 | |||
244 | p_xtpt+=8; | ||
245 | if(p_xtpt>LCD_HEIGHT-8) | ||
246 | { | ||
247 | p_xtpt=0; | ||
248 | rb->lcd_clear_display(); | ||
249 | } | ||
250 | return 1; | ||
251 | } | ||
230 | 252 | ||
231 | void exit(int code) | 253 | void exit(int code) |
232 | { | 254 | { |