summaryrefslogtreecommitdiff
path: root/apps/playback.c
diff options
context:
space:
mode:
authorMiika Pekkarinen <miipekk@ihme.org>2005-08-28 14:16:03 +0000
committerMiika Pekkarinen <miipekk@ihme.org>2005-08-28 14:16:03 +0000
commit29aad55d978282901e5bd3b95a3d2e71c0ac6c9e (patch)
tree8ae9962909983243a78de768f808c3005507ee4f /apps/playback.c
parentd682b73749da208c38ea5f04eab38d3ab3c86bd4 (diff)
downloadrockbox-29aad55d978282901e5bd3b95a3d2e71c0ac6c9e.tar.gz
rockbox-29aad55d978282901e5bd3b95a3d2e71c0ac6c9e.zip
Fixed iriver cpu boosting problems.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7410 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/playback.c')
-rw-r--r--apps/playback.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/apps/playback.c b/apps/playback.c
index 95005815fe..ffd298fbdf 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -131,6 +131,7 @@ static struct mp3entry id3_voice;
131static char *voicebuf; 131static char *voicebuf;
132static int voice_remaining; 132static int voice_remaining;
133static bool voice_is_playing; 133static bool voice_is_playing;
134static bool voice_cpu_boosted = false;
134static void (*voice_getmore)(unsigned char** start, int* size); 135static void (*voice_getmore)(unsigned char** start, int* size);
135 136
136/* Is file buffer currently being refilled? */ 137/* Is file buffer currently being refilled? */
@@ -254,6 +255,17 @@ static void swap_codec(void)
254 logf("codec resuming:%d", current_codec); 255 logf("codec resuming:%d", current_codec);
255} 256}
256 257
258static void voice_boost_cpu(bool state)
259{
260 if (state != voice_cpu_boosted)
261 {
262#ifdef HAVE_ADJUSTABLE_CPU_FREQ
263 cpu_boost(state);
264#endif
265 voice_cpu_boosted = state;
266 }
267}
268
257bool codec_pcmbuf_insert_split_callback(void *ch1, void *ch2, 269bool codec_pcmbuf_insert_split_callback(void *ch1, void *ch2,
258 long length) 270 long length)
259{ 271{
@@ -306,9 +318,9 @@ bool codec_pcmbuf_insert_split_callback(void *ch1, void *ch2,
306 if (voice_is_playing && pcmbuf_usage() > 30 318 if (voice_is_playing && pcmbuf_usage() > 30
307 && pcmbuf_mix_usage() < 20) 319 && pcmbuf_mix_usage() < 20)
308 { 320 {
309 cpu_boost(true); 321 voice_boost_cpu(true);
310 swap_codec(); 322 swap_codec();
311 cpu_boost(false); 323 voice_boost_cpu(false);
312 } 324 }
313 break ; 325 break ;
314 326
@@ -436,8 +448,13 @@ void* voice_request_data(long *realsize, long reqsize)
436 { 448 {
437 swap_codec(); 449 swap_codec();
438 } 450 }
439 if (!voice_is_playing) 451 else if (!voice_is_playing)
452 {
453 voice_boost_cpu(false);
454 if (!pcm_is_playing())
455 pcmbuf_boost(false);
440 sleep(HZ/16); 456 sleep(HZ/16);
457 }
441 458
442 if (voice_remaining) 459 if (voice_remaining)
443 { 460 {
@@ -1277,11 +1294,11 @@ void initialize_buffer_fill(void)
1277 fill_bytesleft = filebuflen - filebufused; 1294 fill_bytesleft = filebuflen - filebufused;
1278 cur_ti->start_pos = ci.curpos; 1295 cur_ti->start_pos = ci.curpos;
1279 1296
1280 pcmbuf_set_boost_mode(true);
1281
1282 if (filling) 1297 if (filling)
1283 return ; 1298 return ;
1284 1299
1300 pcmbuf_set_boost_mode(true);
1301
1285 filling = true; 1302 filling = true;
1286 1303
1287 /* Calculate real track count after throwing away old tracks. */ 1304 /* Calculate real track count after throwing away old tracks. */