summaryrefslogtreecommitdiff
path: root/apps/plugins/midi/midiutil.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/midi/midiutil.c')
-rw-r--r--apps/plugins/midi/midiutil.c48
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 @@
63extern struct plugin_api * rb; 63extern struct plugin_api * rb;
64 64
65 65
66int chVol[16] IDATA_ATTR; /* Channel volume */ 66int chVol[16] IBSS_ATTR; /* Channel volume */
67int chPanLeft[16] IDATA_ATTR; /* Channel panning */ 67int chPanLeft[16] IBSS_ATTR; /* Channel panning */
68int chPanRight[16] IDATA_ATTR; 68int chPanRight[16] IBSS_ATTR;
69int chPat[16]; /* Channel patch */ 69int chPat[16] IBSS_ATTR; /* Channel patch */
70int chPW[16]; /* Channel pitch wheel, MSB only */ 70int chPW[16] IBSS_ATTR; /* Channel pitch wheel, MSB only */
71 71
72 72
73struct GPatch * gusload(char *); 73struct GPatch * gusload(char *);
@@ -128,12 +128,9 @@ struct SynthObject
128 int curPoint; 128 int curPoint;
129}; 129};
130 130
131struct SynthObject voices[MAX_VOICES] IDATA_ATTR; 131struct SynthObject voices[MAX_VOICES] IBSS_ATTR;
132
133
134 132
135void sendEvent(struct Event * ev); 133void sendEvent(struct Event * ev);
136int tick(struct MIDIfile * mf);
137inline void setPoint(struct SynthObject * so, int pt); 134inline void setPoint(struct SynthObject * so, int pt);
138struct Event * getEvent(struct Track * tr, int evNum); 135struct Event * getEvent(struct Track * tr, int evNum);
139int readTwoBytes(int file); 136int 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}
200void * allocate(int size) 197*/
198
199#define malloc(n) my_malloc(n)
200void * 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
212unsigned char * readData(int file, int len) 212unsigned 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
229void printf(char *fmt, ...) {fmt=fmt; } 229// Here is a hacked up printf command to get the output from the game.
230int 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
231void exit(int code) 253void exit(int code)
232{ 254{