summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/pcmbuf.c23
-rw-r--r--apps/pcmbuf.h5
-rw-r--r--apps/playback.c9
3 files changed, 22 insertions, 15 deletions
diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c
index bf5269a32e..1bcfb25f5e 100644
--- a/apps/pcmbuf.c
+++ b/apps/pcmbuf.c
@@ -61,9 +61,6 @@ static int crossfade_pos;
61static int crossfade_amount; 61static int crossfade_amount;
62static int crossfade_rem; 62static int crossfade_rem;
63 63
64
65static bool boost_mode;
66
67/* Crossfade modes. If CFM_CROSSFADE is selected, normal 64/* Crossfade modes. If CFM_CROSSFADE is selected, normal
68 * crossfader will activate. Selecting CFM_FLUSH is a special 65 * crossfader will activate. Selecting CFM_FLUSH is a special
69 * operation that only overwrites the pcm buffer without crossfading. 66 * operation that only overwrites the pcm buffer without crossfading.
@@ -93,6 +90,9 @@ void (*pcmbuf_watermark_event)(int bytes_left);
93static int last_chunksize; 90static int last_chunksize;
94static long mixpos = 0; 91static long mixpos = 0;
95 92
93#ifdef HAVE_ADJUSTABLE_CPU_FREQ
94static bool boost_mode;
95
96void pcmbuf_boost(bool state) 96void pcmbuf_boost(bool state)
97{ 97{
98 static bool boost_state = false; 98 static bool boost_state = false;
@@ -101,13 +101,19 @@ void pcmbuf_boost(bool state)
101 return ; 101 return ;
102 102
103 if (state != boost_state) { 103 if (state != boost_state) {
104#ifdef HAVE_ADJUSTABLE_CPU_FREQ
105 cpu_boost(state); 104 cpu_boost(state);
106#endif
107 boost_state = state; 105 boost_state = state;
108 } 106 }
109} 107}
110 108
109void pcmbuf_set_boost_mode(bool state)
110{
111 if (state)
112 pcmbuf_boost(true);
113 boost_mode = state;
114}
115#endif
116
111int pcmbuf_num_used_buffers(void) 117int pcmbuf_num_used_buffers(void)
112{ 118{
113 return (pcmbuf_write_index - pcmbuf_read_index) & NUM_PCM_BUFFERS_MASK; 119 return (pcmbuf_write_index - pcmbuf_read_index) & NUM_PCM_BUFFERS_MASK;
@@ -191,13 +197,6 @@ void pcmbuf_watermark_callback(int bytes_left)
191 crossfade_active = false; 197 crossfade_active = false;
192} 198}
193 199
194void pcmbuf_set_boost_mode(bool state)
195{
196 if (state)
197 pcmbuf_boost(true);
198 boost_mode = state;
199}
200
201void pcmbuf_add_event(void (*event_handler)(void)) 200void pcmbuf_add_event(void (*event_handler)(void))
202{ 201{
203 pcmbuf_event_handler = event_handler; 202 pcmbuf_event_handler = event_handler;
diff --git a/apps/pcmbuf.h b/apps/pcmbuf.h
index cce7c4ec77..629f969e7d 100644
--- a/apps/pcmbuf.h
+++ b/apps/pcmbuf.h
@@ -33,8 +33,13 @@ 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
36#ifdef HAVE_ADJUSTABLE_CPU_FREQ
36void pcmbuf_boost(bool state); 37void pcmbuf_boost(bool state);
37void pcmbuf_set_boost_mode(bool state); 38void pcmbuf_set_boost_mode(bool state);
39#else
40#define pcmbuf_boost(state) do { } while(0)
41#define pcmbuf_set_boost_mode(state) do { } while(0)
42#endif
38bool pcmbuf_is_lowdata(void); 43bool pcmbuf_is_lowdata(void);
39void pcmbuf_flush_audio(void); 44void pcmbuf_flush_audio(void);
40void pcmbuf_play_start(void); 45void pcmbuf_play_start(void);
diff --git a/apps/playback.c b/apps/playback.c
index ffd298fbdf..c106644d9f 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -131,7 +131,6 @@ 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;
135static void (*voice_getmore)(unsigned char** start, int* size); 134static void (*voice_getmore)(unsigned char** start, int* size);
136 135
137/* Is file buffer currently being refilled? */ 136/* Is file buffer currently being refilled? */
@@ -255,16 +254,20 @@ static void swap_codec(void)
255 logf("codec resuming:%d", current_codec); 254 logf("codec resuming:%d", current_codec);
256} 255}
257 256
257#ifdef HAVE_ADJUSTABLE_CPU_FREQ
258static void voice_boost_cpu(bool state) 258static void voice_boost_cpu(bool state)
259{ 259{
260 static bool voice_cpu_boosted = false;
261
260 if (state != voice_cpu_boosted) 262 if (state != voice_cpu_boosted)
261 { 263 {
262#ifdef HAVE_ADJUSTABLE_CPU_FREQ
263 cpu_boost(state); 264 cpu_boost(state);
264#endif
265 voice_cpu_boosted = state; 265 voice_cpu_boosted = state;
266 } 266 }
267} 267}
268#else
269#define voice_boost_cpu(state) do { } while(0)
270#endif
268 271
269bool codec_pcmbuf_insert_split_callback(void *ch1, void *ch2, 272bool codec_pcmbuf_insert_split_callback(void *ch1, void *ch2,
270 long length) 273 long length)