Replaced some yields with sleep(1) to save battery while paused or
playing files which doesn't require cpu boosting.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7103 a1c6a512-1295-4272-9138-f99709370657
diff --git a/apps/codecs/mpa.c b/apps/codecs/mpa.c
index 126d9b6..da469f2 100644
--- a/apps/codecs/mpa.c
+++ b/apps/codecs/mpa.c
@@ -111,7 +111,7 @@
file_end = 0;
while (!*ci->taginfo_ready && !ci->stop_codec)
- ci->yield();
+ ci->sleep(1);
frequency_divider = ci->id3->frequency / 100;
ci->configure(DSP_SET_FREQUENCY, (int *)ci->id3->frequency);
diff --git a/apps/codecs/vorbis.c b/apps/codecs/vorbis.c
index 561fbb4..82ebdbf 100644
--- a/apps/codecs/vorbis.c
+++ b/apps/codecs/vorbis.c
@@ -179,7 +179,7 @@
}
while (!*rb->taginfo_ready && !rb->stop_codec)
- rb->yield();
+ rb->sleep(1);
/* Create a decoder instance */
callbacks.read_func=read_handler;
@@ -263,7 +263,7 @@
DEBUGF("Error decoding frame\n");
} else {
while (!rb->audiobuffer_insert(pcmbuf, n)) {
- rb->yield();
+ rb->sleep(1);
if ( rb->seek_time ) {
/* Hmmm, a seek was requested. Throw out the
* buffer and go back to the top of the loop.
diff --git a/apps/codecs/wavpack.c b/apps/codecs/wavpack.c
index 372fe20..d363cbe 100644
--- a/apps/codecs/wavpack.c
+++ b/apps/codecs/wavpack.c
@@ -75,7 +75,7 @@
return CODEC_ERROR;
while (!*rb->taginfo_ready && !ci->stop_codec)
- ci->yield();
+ ci->sleep(1);
if (ci->id3->frequency != NATIVE_FREQUENCY) {
ci->configure(DSP_SET_FREQUENCY, (long *)(ci->id3->frequency));
@@ -190,7 +190,7 @@
break;
while (!ci->audiobuffer_insert ((char *) temp_buffer, nsamples * 4))
- rb->yield ();
+ rb->sleep (1);
ci->set_elapsed (WavpackGetSampleIndex (wpc) / sr_100 * 10);
}
diff --git a/firmware/pcm_playback.c b/firmware/pcm_playback.c
index b582cf8..af8ce18 100644
--- a/firmware/pcm_playback.c
+++ b/firmware/pcm_playback.c
@@ -478,7 +478,7 @@
while (!pcm_play_add_chunk(&audiobuffer[audiobuffer_pos],
copy_n, pcm_event_handler)) {
pcm_boost(false);
- yield();
+ sleep(1);
/* This is a fatal error situation that should never happen. */
if (!pcm_playing) {
logf("pcm_flush_fillpos error");
@@ -588,7 +588,7 @@
while (audiobuffer_free < length + audiobuffer_fillpos
+ CHUNK_SIZE && !crossfade_active) {
pcm_boost(false);
- yield();
+ sleep(1);
}
if (crossfade_active) {