diff options
-rw-r--r-- | apps/pcmbuf.c | 23 | ||||
-rw-r--r-- | apps/pcmbuf.h | 5 | ||||
-rw-r--r-- | apps/playback.c | 9 |
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; | |||
61 | static int crossfade_amount; | 61 | static int crossfade_amount; |
62 | static int crossfade_rem; | 62 | static int crossfade_rem; |
63 | 63 | ||
64 | |||
65 | static 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); | |||
93 | static int last_chunksize; | 90 | static int last_chunksize; |
94 | static long mixpos = 0; | 91 | static long mixpos = 0; |
95 | 92 | ||
93 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | ||
94 | static bool boost_mode; | ||
95 | |||
96 | void pcmbuf_boost(bool state) | 96 | void 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 | ||
109 | void pcmbuf_set_boost_mode(bool state) | ||
110 | { | ||
111 | if (state) | ||
112 | pcmbuf_boost(true); | ||
113 | boost_mode = state; | ||
114 | } | ||
115 | #endif | ||
116 | |||
111 | int pcmbuf_num_used_buffers(void) | 117 | int 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 | ||
194 | void pcmbuf_set_boost_mode(bool state) | ||
195 | { | ||
196 | if (state) | ||
197 | pcmbuf_boost(true); | ||
198 | boost_mode = state; | ||
199 | } | ||
200 | |||
201 | void pcmbuf_add_event(void (*event_handler)(void)) | 200 | void 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)); | |||
33 | int pcmbuf_num_used_buffers(void); | 33 | int pcmbuf_num_used_buffers(void); |
34 | void pcmbuf_set_watermark(int numbytes, void (*callback)(int bytes_left)); | 34 | void pcmbuf_set_watermark(int numbytes, void (*callback)(int bytes_left)); |
35 | 35 | ||
36 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | ||
36 | void pcmbuf_boost(bool state); | 37 | void pcmbuf_boost(bool state); |
37 | void pcmbuf_set_boost_mode(bool state); | 38 | void 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 | ||
38 | bool pcmbuf_is_lowdata(void); | 43 | bool pcmbuf_is_lowdata(void); |
39 | void pcmbuf_flush_audio(void); | 44 | void pcmbuf_flush_audio(void); |
40 | void pcmbuf_play_start(void); | 45 | void 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; | |||
131 | static char *voicebuf; | 131 | static char *voicebuf; |
132 | static int voice_remaining; | 132 | static int voice_remaining; |
133 | static bool voice_is_playing; | 133 | static bool voice_is_playing; |
134 | static bool voice_cpu_boosted = false; | ||
135 | static void (*voice_getmore)(unsigned char** start, int* size); | 134 | static 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 | ||
258 | static void voice_boost_cpu(bool state) | 258 | static 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 | ||
269 | bool codec_pcmbuf_insert_split_callback(void *ch1, void *ch2, | 272 | bool codec_pcmbuf_insert_split_callback(void *ch1, void *ch2, |
270 | long length) | 273 | long length) |