summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/pcmbuf.c2
-rw-r--r--apps/pcmbuf.h1
-rw-r--r--apps/playback.c27
3 files changed, 24 insertions, 6 deletions
diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c
index d0bbeb0265..bf5269a32e 100644
--- a/apps/pcmbuf.c
+++ b/apps/pcmbuf.c
@@ -93,7 +93,7 @@ void (*pcmbuf_watermark_event)(int bytes_left);
93static int last_chunksize; 93static int last_chunksize;
94static long mixpos = 0; 94static long mixpos = 0;
95 95
96static void pcmbuf_boost(bool state) 96void pcmbuf_boost(bool state)
97{ 97{
98 static bool boost_state = false; 98 static bool boost_state = false;
99 99
diff --git a/apps/pcmbuf.h b/apps/pcmbuf.h
index f2533defe6..cce7c4ec77 100644
--- a/apps/pcmbuf.h
+++ b/apps/pcmbuf.h
@@ -33,6 +33,7 @@ bool pcmbuf_add_chunk(void *addr, int size, void (*callback)(void));
33int pcmbuf_num_used_buffers(void); 33int pcmbuf_num_used_buffers(void);
34void pcmbuf_set_watermark(int numbytes, void (*callback)(int bytes_left)); 34void pcmbuf_set_watermark(int numbytes, void (*callback)(int bytes_left));
35 35
36void pcmbuf_boost(bool state);
36void pcmbuf_set_boost_mode(bool state); 37void pcmbuf_set_boost_mode(bool state);
37bool pcmbuf_is_lowdata(void); 38bool pcmbuf_is_lowdata(void);
38void pcmbuf_flush_audio(void); 39void pcmbuf_flush_audio(void);
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. */