From 5811214b0c6fc7b060b46a3eee3d919ffe850e89 Mon Sep 17 00:00:00 2001 From: Stepan Moskovchenko Date: Fri, 15 Apr 2005 20:27:04 +0000 Subject: Code cleanup, fix warnings, error checking, add midi2wav to viewers.config git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6304 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/midi/midiutil.c | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) (limited to 'apps/plugins/midi/midiutil.c') diff --git a/apps/plugins/midi/midiutil.c b/apps/plugins/midi/midiutil.c index 0ab5a35a78..41a02ae682 100644 --- a/apps/plugins/midi/midiutil.c +++ b/apps/plugins/midi/midiutil.c @@ -40,16 +40,18 @@ #define CTRL_PANNING 10 #define CHANNEL 1 - +//Most of these are deprecated.. rampdown is used, maybe one other one too #define STATE_ATTACK 1 #define STATE_DECAY 2 #define STATE_SUSTAIN 3 #define STATE_RELEASE 4 #define STATE_RAMPDOWN 5 +//Loop states #define STATE_LOOPING 7 #define STATE_NONLOOPING 8 +//Various bits in the GUS mode byte #define LOOP_ENABLED 4 #define LOOP_PINGPONG 8 #define LOOP_REVERSE 16 @@ -65,7 +67,8 @@ unsigned char chVol[16]; //Channel volume unsigned char chPanLeft[16]; //Channel panning unsigned char chPanRight[16]; unsigned char chPat[16]; //Channel patch -unsigned char chPW[16]; //Channel pitch wheel, MSB +unsigned char chPW[16]; //Channel pitch wheel, MSB only + struct GPatch * gusload(char *); struct GPatch * patchSet[128]; @@ -118,8 +121,19 @@ struct MIDIfile int numPatches; }; -void *my_malloc(int size); + +void sendEvent(struct Event * ev); +int tick(struct MIDIfile * mf); +inline void setPoint(struct SynthObject * so, int pt); +struct Event * getEvent(struct Track * tr, int evNum); +int readTwoBytes(int file); +int readFourBytes(int file); +int readVarData(int file); +int midimain(void * filename); + + +//Rick's code void *alloc(int size) { static char *offset = NULL; @@ -143,7 +157,7 @@ void *alloc(int size) totalSize -= size + 4; return ret; } - +/* void *ralloc(char *offset, int len) { int size; @@ -175,18 +189,13 @@ void *ralloc(char *offset, int len) return ret; } - +*/ void * allocate(int size) { return alloc(size); } -void sendEvent(struct Event * ev); -int tick(struct MIDIfile * mf); -inline void setPoint(struct SynthObject * so, int pt); -struct Event * getEvent(struct Track * tr, int evNum); - unsigned char readChar(int file) { char buf[2]; @@ -211,11 +220,9 @@ int eof(int fd) return size+1 == rb->lseek(fd, 0, SEEK_CUR); } -void printf(char *fmt, ...) {} - -//#define my_malloc(a) malloc(a) - +void printf(char *fmt, ...) {fmt=fmt; } +/* void *audio_bufferbase; void *audio_bufferpointer; unsigned int audio_buffer_free; @@ -252,11 +259,8 @@ void setmallocpos(void *pointer) audio_bufferpointer = pointer; audio_buffer_free = audio_bufferpointer - audio_bufferbase; } - +*/ void exit(int code) { + code = code; //Stub function, kill warning for now } - -void free(void * ptr) -{ -} \ No newline at end of file -- cgit