comparison Plugins/Input/amidi-plug/amidi-plug.c @ 805:b8b9d7f5d371 trunk

[svn] update amidi-plug towards 0.2; bug fixes and a new option (midi length pre-calculation)
author giacomo
date Tue, 07 Mar 2006 11:47:20 -0800
parents 8efa4b799c19
children ee25017cb472
comparison
equal deleted inserted replaced
804:79c651988a44 805:b8b9d7f5d371
287 287
288 /* sure, it's possible to calculate the length of a MIDI file anytime, 288 /* sure, it's possible to calculate the length of a MIDI file anytime,
289 but the file must be entirely parsed to calculate it; this could lead 289 but the file must be entirely parsed to calculate it; this could lead
290 to performance loss, for now it's safer to calculate the length only 290 to performance loss, for now it's safer to calculate the length only
291 right before playing the file */ 291 right before playing the file */
292 *length = -1; 292
293 if ( amidiplug_cfg.length_precalc_enable )
294 {
295 /* let's calculate the midi length, using this nice helper function that
296 will return 0 if a problem occurs and the length can't be calculated */
297 midifile_t mf;
298
299 if ( i_midi_parse_from_filename( filename , &mf ) )
300 *length = (gint)(mf.length / 1000);
301 else
302 *length = -1;
303
304 i_midi_free( &mf );
305 }
306 else
307 *length = -1;
308
293 return; 309 return;
294 } 310 }
295 311
296 312
297 static void amidiplug_play( gchar * filename ) 313 static void amidiplug_play( gchar * filename )