diff options
author | Stepan Moskovchenko <stevenm@rockbox.org> | 2008-01-02 07:09:17 +0000 |
---|---|---|
committer | Stepan Moskovchenko <stevenm@rockbox.org> | 2008-01-02 07:09:17 +0000 |
commit | 111049105bf20b55f8e114487f32daeda45c6d5c (patch) | |
tree | ecf8e2e2f045428c2e6dfbc0db0f7579de980f83 /apps/plugins/midi/midifile.c | |
parent | 0f8c77b306fbc5d27803a3062cdd1a65a573c325 (diff) | |
download | rockbox-111049105bf20b55f8e114487f32daeda45c6d5c.tar.gz rockbox-111049105bf20b55f8e114487f32daeda45c6d5c.zip |
MIDI player: print out track names, copyright info, song names, etc during load time. This includes
lyrics... maybe we should print those while the song is playing?
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15987 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/midi/midifile.c')
-rw-r--r-- | apps/plugins/midi/midifile.c | 67 |
1 files changed, 65 insertions, 2 deletions
diff --git a/apps/plugins/midi/midifile.c b/apps/plugins/midi/midifile.c index ac3206ca65..5f98e895a2 100644 --- a/apps/plugins/midi/midifile.c +++ b/apps/plugins/midi/midifile.c | |||
@@ -149,8 +149,71 @@ int readEvent(int file, void * dest) | |||
149 | /* Allocate and read in the data block */ | 149 | /* Allocate and read in the data block */ |
150 | if(dest != NULL) | 150 | if(dest != NULL) |
151 | { | 151 | { |
152 | ev->evData = readData(file, ev->len); | 152 | /* Null-terminate for text events */ |
153 | /* printf("\nDATA: <%s>", ev->evData); */ | 153 | ev->evData = malloc(ev->len+1); /* Extra byte for the null termination */ |
154 | |||
155 | rb->read(file, ev->evData, ev->len); | ||
156 | ev->evData[ev->len] = 0; | ||
157 | |||
158 | switch(ev->d1) | ||
159 | { | ||
160 | case 0x01: /* Generic text */ | ||
161 | { | ||
162 | printf("Text: %s", ev->evData); | ||
163 | break; | ||
164 | } | ||
165 | |||
166 | case 0x02: /* A copyright string within the file */ | ||
167 | { | ||
168 | printf("Copyright: %s", ev->evData); | ||
169 | break; | ||
170 | } | ||
171 | |||
172 | case 0x03: /* Sequence of track name */ | ||
173 | { | ||
174 | printf("Name: %s", ev->evData); | ||
175 | break; | ||
176 | } | ||
177 | |||
178 | case 0x04: /* Instrument (synth) name */ | ||
179 | { | ||
180 | printf("Instrument: %s", ev->evData); | ||
181 | break; | ||
182 | } | ||
183 | |||
184 | case 0x05: /* Lyrics. These appear on the tracks at the right times */ | ||
185 | { /* Usually only a small 'piece' of the lyrics. */ | ||
186 | /* Maybe the sequencer should print these at play time? */ | ||
187 | printf("Lyric: %s", ev->evData); | ||
188 | break; | ||
189 | } | ||
190 | |||
191 | case 0x06: /* Text marker */ | ||
192 | { | ||
193 | printf("Marker: %s", ev->evData); | ||
194 | break; | ||
195 | } | ||
196 | |||
197 | |||
198 | case 0x07: /* Cue point */ | ||
199 | { | ||
200 | printf("Cue point: %s", ev->evData); | ||
201 | break; | ||
202 | } | ||
203 | |||
204 | case 0x08: /* Program name */ | ||
205 | { | ||
206 | printf("Patch: %s", ev->evData); | ||
207 | break; | ||
208 | } | ||
209 | |||
210 | |||
211 | case 0x09: /* Device name. Very much irrelevant here, though. */ | ||
212 | { | ||
213 | printf("Port: %s", ev->evData); | ||
214 | break; | ||
215 | } | ||
216 | } | ||
154 | } | 217 | } |
155 | else | 218 | else |
156 | { | 219 | { |