|
Rockbox mail archiveSubject: Looping mp3 IILooping mp3 II
From: <phil_at_carangg.de>
Date: Thu, 25 Dec 2003 09:13:41 +0100 Principially I can loop now. I still do it principially like this: struct plugin_api* rb = api; /* api is given from outside */ unsigned int loop_start = 500; /* just a dummy value as example */ unsigned int loop_end = 100000 /* just a dummy value as example */ while (rb->button_get(false) == BUTTON_NONE) { if (rb->mpeg_current_track()->elapsed >= loop_end) { rb->mpeg_pause(); rb->mpeg_ff_rewind(loop_start); rb->mpeg_resume(); } } This is especially problematic when loop_start is very close to the end of a song and loop_end _is_ the end of a song. The code still works when I set global_settings.repeat_mode = REPEAT_ONE. Still the rewind part is problematic. The mpeg engine will reload data from disk to jump to loop_start. It starts playing as soon as it has enough data (low watermark) and loads till it reaches the high watermark. When it has reached the high watermark the beginning of the data has already been played and thus already was overwritten with new data. So when the playback reaches loop_end the data of loop_start isn't available any more and the mpeg engine has to reload. -> It reloads forever. If the timespan between loop_start and loop_end is really small so that reloading data isn't fast enough to reach the low watermark it even loops and reloads without playing back anything of the loop but the beginning of the song. I think this problem is not solvable without extending the very depths of mpeg.c. Maybe it is possible to extend it in a way that it provides looping. At least I'd need a way of telling it something like "don't load any further than this". Unfortunately I don't understand half of the code in mpeg.c and can't do either of this myself (yet). Can anybody at least hint me what the mechanisms are that I'd have to modify there? Phil P.s.: Anybody crying "Show me the code! :)" or "I can't compile, give me an ajbrec.ajz with a split editor!" goes here: http://www.carangg.de/splitedit_rec.zip http://www.carangg.de/splitedit_fm.zip Received on 2003-12-25 Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy |